当我尝试在 vscode 中运行以下代码时出现此错误( (node:64344) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'hash' of undefined),我不明白该怎么做。我一直在谷歌上搜索,但没有找到答案。所以现在我在这里尝试
const lib = require('xrpl-accountlib')
const { XrplClient } = require('xrpl-client')
const secret = 's--'
const account = 'a---' // Can be derived
const client = new XrplClient('wss://s1.ripple.com')
const keypair = lib.derive.familySeed(secret)
const main = async () => {
console.log('Getting ready...')
const { account_data } = await client.send({ command: 'account_info', account })
console.log(account_data.Sequence);
const tx = {
"TransactionType": "TrustSet",
"Account": account,
"Fee": "12",
"Flags": 262144,
"LastLedgerSequence": 8007750,
"LimitAmount": {
"currency": "TET",
"issuer": "a--",
"value": "100"
},
"Sequence": account.Sequence
}
const {signedTransaction} = lib.sign(tx, keypair)
const submit = await client.send({ command: 'submit', 'tx_blob': signedTransaction })
console.log(submit.engine_result, submit.engine_result_message, submit.tx_json.hash)
console.log(submit)
client.close()
}
main()