如何追踪TypeScript中signMessage的调用方并获取stake的txId?
问题:找不到
signMessage调用位置,无法从stake函数获取txId - 我有一个名为
signMessage的TypeScript函数,在发送交易(智能合约调用)时会被触发,它位于项目的src/NEAR/NEARFireblocksSigner.ts文件第44行。 - 调用
stake函数时,日志明确显示signMessage已被调用,但我在stake函数内部以及它调用的所有函数中,都找不到调用signMessage的代码。 - 我需要让
stake函数返回交易的txId值,但不知道该从何处获取这个值。
stake函数代码
async stake(amount: number): Promise<void> { await this.runSetupIfNeeded(); typecheck(amount, typeof 1); this.log('Validating stake request.'); let nearWallet = await this.fbks.getVaultAccountAsset("" + this.vaultAccountId, this.assetId); let nearInWallet = nearWallet.available; if (Number.parseFloat(nearInWallet) < amount) { throw new Error(`Vault account ${this.vaultAccountId} has ${nearInWallet} NEAR, but requested to stake ${amount}.`); } this.log('Validated.'); this.log('Note - stake,unstake and withdraw will print data including reciepts for transaction, make sure to save it for future reference.', 'WRN'); (this.config.signer as NEARFireblocksSigner).setNote(`NEAR Staking - Staking ${amount} NEAR`); // @ts-ignore - required because deposit_and_stake is generated at runtime. let response = await this.contract.deposit_and_stake({ args: {}, amount: parseNearAmount("" + amount) }); this.log(`Staked ${amount} NEAR to ${this.contractName}.`); }
我尝试过调试函数调用,但没有效果。虽然编译后的JavaScript代码显示signMessage被多次调用,但始终找不到它的调用位置。
内容的提问来源于stack exchange,提问作者samarpan.d
相关产品推荐
相关产品推荐

