调用.getReceipt()
时,以下代码会引发错误.
请注意,交易本身是成功的.
const hcsTopicCreateTx = await new TopicCreateTransaction()
.freezeWith(client)
.sign(operatorKey);
const hcsTopicCreateTxResponse = await hcsTopicCreateTx.execute(client);
const hcsTopicCreateReceipt = await hcsTopicCreateTxResponse.getReceipt();
这是错误:
file:///Users/user/code/hedera/hedera-code-snippets/hcs-topic-permissioned-write/node_modules/@hashgraph/sdk/src/Executable.js:518
? client._logger != null
^
TypeError: Cannot read properties of undefined (reading '_logger')
at TransactionReceiptQuery.execute (file:///Users/user/code/hedera/hedera-code-snippets/hcs-topic-permissioned-write/node_modules/@hashgraph/sdk/src/Executable.js:518:26)
at TransactionResponse.getReceipt (file:///Users/user/code/hedera/hedera-code-snippets/hcs-topic-permissioned-write/node_modules/@hashgraph/sdk/src/transaction/TransactionResponse.js:81:54)
at main (file:///Users/user/code/hedera/hedera-code-snippets/hcs-topic-permissioned-write/hcs-write.js:60:66)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
为什么_logger
人失踪?
以下是client
对象的初始化方式:
const client = Client.forTestnet().setOperator(operatorId, operatorKey);
还try 在client
上手动初始化记录器,如下所示:
const client = Client.forTestnet().setOperator(operatorId, operatorKey);
client.setLogger(new Logger(LogLevel.Warn));
然而,同样的错误仍然存在.如何解决这个问题?