Created
January 25, 2022 17:38
-
-
Save pashius/6ece19f38a640bfdab6d2e6807955ee2 to your computer and use it in GitHub Desktop.
Активация тестового аккаунта в Hangzhou и +
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TezosToolkit } from '@taquito/taquito' | |
//импортируем inMemorySigner. Он сохранит приватный ключ в оперативной памяти и будет подписывать им транзакции | |
import { InMemorySigner } from '@taquito/signer' | |
//объявляем константу acc, которая направит скрипт к файлу acc.json | |
const acc = require('./acc.json') | |
export class Tx { | |
private tezos: TezosToolkit | |
rpcUrl: string | |
constructor(rpcUrl: string) { | |
this.tezos = new TezosToolkit(rpcUrl) | |
this.rpcUrl = rpcUrl | |
//объявляем параметры с помощью метода fromFundraiser: почту, пароль и мнемоническую фразу, из которой можно получить приватный ключ | |
this.tezos.setSignerProvider(InMemorySigner.fromFundraiser(acc.activation_code, acc.password, acc.mnemonic.join(' '))) | |
} | |
//получаем публичный и приватный ключи и активируем аккаунт | |
public async activateAccount() { | |
const { pkh, activation_code } = acc | |
try { | |
const operation = await this.tezos.tz.activate(pkh, activation_code) | |
await operation.confirmation() | |
} catch (e) { | |
console.log(e) | |
} | |
} | |
public async main() {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment