Node.js 调用链码、节点SDK、方法channel.sendTransactionProposal()时出错

Node.js 调用链码、节点SDK、方法channel.sendTransactionProposal()时出错,node.js,client,hyperledger-fabric,Node.js,Client,Hyperledger Fabric,当我尝试发送交易建议时,我从hyperledger fabric node sdk收到一个TypeError。以下是我的电话号码: const prop_response = await channel.sendTransactionProposal({ targets: peers, chaincodeId: "ccid1", fcn: ADD_ASSET, args: [mockAsset], txId:

当我尝试发送交易建议时,我从hyperledger fabric node sdk收到一个TypeError。以下是我的电话号码:

    const prop_response = await channel.sendTransactionProposal({
        targets: peers,
        chaincodeId: "ccid1",
        fcn: ADD_ASSET,
        args: [mockAsset],
        txId: client.newTransactionID()
    });
该方法的文档可在此处找到:
文档声称该方法需要一个ChaincodeInvokeRequest对象,但代码不需要对象。以下是错误:

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type object
    at Function.from (buffer.js:225:9)

任何帮助都将不胜感激

args
属性包含的数据类型不是
字符串、缓冲区、数组缓冲区、数组或类似数组的对象时,就会发生这种情况。

确保数组的每个参数都与所需的类型匹配。例如,检查是否没有未定义的
元素

在您的示例中,我假设
mockAsset
是一个json对象。根据我的经验,您应该将json字符串化,然后在链码中重新解析它

const prop_response = await channel.sendTransactionProposal({
        targets: peers,
        chaincodeId: "ccid1",
        fcn: ADD_ASSET,
        args: [JSON.stringify(mockAsset)],
        txId: client.newTransactionID()
    });
在链码中(编程模型<1.4):

编程模型>=1.4

mockAsset = JSON.parse(myParam)

为了完整地回答这个问题,您应该告诉我们什么是
mockAsset

args
属性包含的数据类型不是
字符串、缓冲区、数组缓冲区、数组或类似数组的对象时,就会发生这种情况。

确保数组的每个参数都与所需的类型匹配。例如,检查是否没有未定义的
元素

在您的示例中,我假设
mockAsset
是一个json对象。根据我的经验,您应该将json字符串化,然后在链码中重新解析它

const prop_response = await channel.sendTransactionProposal({
        targets: peers,
        chaincodeId: "ccid1",
        fcn: ADD_ASSET,
        args: [JSON.stringify(mockAsset)],
        txId: client.newTransactionID()
    });
在链码中(编程模型<1.4):

编程模型>=1.4

mockAsset = JSON.parse(myParam)
为了完整地回答这个问题,您应该告诉我们什么是
mockAsset