【问题标题】:Receiving error: Class Action is missing in schema: actions.actions接收错误:架构中缺少类操作:actions.actions
【发布时间】:2021-10-18 07:56:26
【问题描述】:

我正在尝试广播具有以下操作的交易:

actions: [
    transactions.createAccount(),
    transactions.transfer(new BN(swapParams.value.toFixed())),
    transactions.deployContract(new Uint8Array(bytecode)),
    transactions.functionCall(
      ABI.init.method,
      {
        secretHash: Buffer.from(swapParams.secretHash, 'hex').toString('base64'),
        expiration: `${toNearTimestampFormat(swapParams.expiration)}`,
        buyer: swapParams.recipientAddress
      },
      new BN(ABI.init.gas),
      new BN(0)
    )
  ]

但是当我调用时

const tx = await from.signAndSendTransaction(addressToString(options.to), options.actions)

我收到以下调用堆栈:

知道可能是什么原因吗?

我正在使用:

near-js-api: 0.39.0

【问题讨论】:

    标签: nearprotocol


    【解决方案1】:

    根据documentationsource code, and defined types signAndSendTransaction 应该采用单个参数(具有receiverIdactions 字段的对象):

    const tx = await from.signAndSendTransaction({
      receiverId: addressToString(options.to),
      actions: options.actions
    })
    

    是否有一个示例/文档误导了您,所以您使用了这个函数调用接口?我们应该解决这个问题。

    【讨论】:

      猜你喜欢
      • 2012-11-16
      • 1970-01-01
      • 1970-01-01
      • 2018-10-27
      • 1970-01-01
      • 1970-01-01
      • 2013-03-19
      • 2021-06-08
      • 1970-01-01
      相关资源
      最近更新 更多