You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何追踪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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 22:52:46