EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

Name should be less than 13 characters, or less than 14 if last character is between 1-5 or a-j, and only contain the following symbols .12345abcdefghijklmnopqrstuvwxyz #799

Closed adeelnaqvi172 closed 4 years ago

adeelnaqvi172 commented 4 years ago

i am facing this error when i hit my Post API,Basically i am creating this API for propose the Multisig Transaction. And i am follow the documentation of EOSJS from offical website of EOSIO. MY naming convention is follow which is mention but still facing error

MY API IS

app.post('/propose', async (req, res) => { const actions = [{ account: 'eosio', name: 'updateauth', authorization: [{ actor: 'adeelabbasna', permission: 'active', }], data: { account: 'adeelabbasna', permission: 'active', parent: '', auth: { threshold: 1, keys: [{ key: 'EOS7BJChRpdmRbwLgdR2MPW4f7BkXye21quFxqN2Pjv8tJy6iejpF', weight: 1 }], accounts: [], waits: [] } }, }]; (async () => { const serialized_actions = await api.serializeActions(actions)

    proposeInput = {
        proposer: 'adeelabbasna',
        proposal_name: 'changeowner',
        requested: [{
                actor: 'adeelabbasna',
                permission: 'active'
            },
            {
                actor: 'rajazahoor11',
                permission: 'active'
            }
        ],
        trx: {
            expiration: '2019-09-16T16:39:15',
            ref_block_num: 0,
            ref_block_prefix: 0,
            max_net_usage_words: 0,
            max_cpu_usage_ms: 0,
            delay_sec: 0,
            context_free_actions: [],
            actions: serialized_actions,
            transaction_extensions: []
        }

    };
    const result = await api.transact({
        actions: [{
            account: 'eosio.msig',
            name: 'propose',
            authorization: [{
                actor: 'adeelabbasna',
                permission: 'active',
            }],
            data: proposeInput,
        }]
    }, {
        blocksBehind: 3,
        expireSeconds: 30,
        broadcast: true,
        sign: true
    });
})();

And then this error will come

UnhandledPromiseRejectionWarning: Error: Name should be less than 13 characters, or less than 14 if last character is between 1-5 or a-j, and only contain the following symbols .12345abcdefghijklmnopqrstuvwxyz at SerialBuffer.pushName (/home/adeel/Documents/EOSIO apis/Multisig Transaction/Propose/node_modules/eosjs/dist/eosjs-serialize.js:253:19) at Object.serialize (/home/adeel/Documents/EOSIO apis/Multisig Transaction/Propose/node_modules/eosjs/dist/eosjs-serialize.js:841:57) at Object.serializeStruct [as serialize] (/home/adeel/Documents/EOSIO apis/Multisig Transaction/Propose/node_modules/eosjs/dist/eosjs-serialize.js:591:28) at Object.exports.serializeActionData (/home/adeel/Documents/EOSIO apis/Multisig Transaction/Propose/node_modules/eosjs/dist/eosjs-serialize.js:1070:12) at Object.exports.serializeAction (/home/adeel/Documents/EOSIO apis/Multisig Transaction/Propose/node_modules/eosjs/dist/eosjs-serialize.js:1079:23) at Api. (/home/adeel/Documents/EOSIO apis/Multisig Transaction/Propose/node_modules/eosjs/dist/eosjs-api.js:311:71) at step (/home/adeel/Documents/EOSIO apis/Multisig Transaction/Propose/node_modules/eosjs/dist/eosjs-api.js:49:23) at Object.next (/home/adeel/Documents/EOSIO apis/Multisig Transaction/Propose/node_modules/eosjs/dist/eosjs-api.js:30:53) at fulfilled (/home/adeel/Documents/EOSIO apis/Multisig Transaction/Propose/node_modules/eosjs/dist/eosjs-api.js:21:58) at process._tickCallback (internal/process/next_tick.js:68:7) (node:26207) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:26207) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. i also attached Screen shot

123456787654321

bradlhart commented 4 years ago

Your parent is empty (which is correct) and eosjs incorrectly caught that as an issue. This has since been changed in eosjs and the fix is within the edge release on NPM, but there is a workaround for the latest release: you can set the parent to '...' (or any number of periods as long as its within 13) and the serializer will resolve that to '' without causing the error.

adeelnaqvi172 commented 4 years ago

Your parent is empty (which is correct) and eosjs incorrectly caught that as an issue. This has since been changed in eosjs and the fix is within the edge release on NPM, but there is a workaround for the latest release: you can set the parent to '...' (or any number of periods as long as its within 13) and the serializer will resolve that to '' without causing the error.

Thanks...!! working :+1: :