web3.Keypair.fromSeed issues



我以前是这么做的:

const mnemonic = Bip39.generateMnemonic()
const key = derivePath(
`m/44'/501'/0'/0'`,
Bip39.mnemonicToSeedSync(mnemonic).toString("hex")
).key
const pair = web3.Keypair.fromSeed(key.toString())

但是现在我得到:

TypeError: unexpected type, use Uint8Array
at checkArrayTypes (/Users/ttt/dev/rrr/TOKENPASS/tpass-graphql/graphql/node_modules/tweetnacl/nacl-fast.js:2165:13)
at Function.fromSecretKey (/Users/ttt/dev/rrr/TOKENPASS/tpass-graphql/graphql/node_modules/tweetnacl/nacl-fast.js:2318:3)
at Function.fromSecretKey (/Users/ttt/dev/rrr/TOKENPASS/tpass-graphql/graphql/node_modules/@solana/web3.js/src/keypair.ts:64:39)

const key = derivePath(m/44'/501'/0'/0',Bip39.mnemonicToSeedSync(助记符).toString("hex") .privateKey

const pair = web3.Keypair.fromSeed(key)

试试这个

最新更新