Skip to content

Instantly share code, notes, and snippets.

@pashius
Created January 25, 2022 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pashius/6ece19f38a640bfdab6d2e6807955ee2 to your computer and use it in GitHub Desktop.
Save pashius/6ece19f38a640bfdab6d2e6807955ee2 to your computer and use it in GitHub Desktop.
Активация тестового аккаунта в Hangzhou и +
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