错误未能附加消息:错误:无效的传输数组:[object Object]

时间:2019-07-16 04:21:27

标签: node.js npm blockchain iota

我正在尝试通过使用mam.attach()将尖顶附加到tanble,并且出现以下错误MAM发布错误无法附加消息:错误:无效的传输数组:[object Object]

请在下面找到我的代码段

const Mam = require('@iota/mam');
const { asciiToTrytes, trytesToAscii } = require('@iota/converter');
var mamState = {};
var seed = '';
const publish= async (data, isJSON) => {
    try {
        const trytes = asciiToTrytes(isJSON ? JSON.stringify(data) : data);
        //console.log(trytes)
        const message = Mam.create(mamState, trytes);
        console.log(message)
        mamState = message.state;
        console.log(message)
        let attachResult = await Mam.attach(message.payload, message.address,3,9,data.platenum);
        return { transArr: attachResult, mamMsg: message, mamState: mamState };
    } catch (error) {
        console.log('MAM publish error', error);
        return null;
    }
};

0 个答案:

没有答案