0
const network = {
    blockchain:'eos',
    protocol:'https',
    host:'jungle2.cryptolions.io',
    port:443,
        chainId: 'e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473',
        sign: true,
        broadcast: true,
        debug: true,
        verbose: false,
}

try {

const scatterInfo = await ScatterJS.scatter.connect('eosbetdice');
    console.log({scatterInfo})
    if ( scatterInfo ) {

    const scatter = ScatterJS.scatter;
      const requiredFields = { accounts:[network] };
const scatterVal = await scatter.getIdentity(requiredFields);
    console.log({scatter,scatterVal})

    if ( scatterVal ) { 
const account = scatter.identity.accounts.find(x => x.blockchain === 'eos');
    console.log("account",account)
         const result = await api.transact({
        actions: [{
            account: 'eosio.token',
            name: 'transfer',
            authorization: [{
                actor: account.name,
            permission:'active',
            signatures:[signature],
            available_keys:[account.publicKey]
            }],
            data: {
            from:  'abceristest2',
            to: account.name, 
            quantity: betAsset,
            memo: memo
                },
            }]
        }, {
                blocksBehind: 3,
            expireSeconds: 30,
        });
        console.log({result})
        return result;
        }

    } return false;

      } catch ( exception ) {
    console.log( exception )
}

我希望传输功能可以正常工作,但它给了我 401 未经授权的错误。这个传递函数命中了jungle testnet的api,“ http://jungle.eosgen.io/v1/chain/get_required_keys ”我如何验证这个函数?

我得到的错误,当这个传递函数运行时

4

1 回答 1

0

我没有详细检查您的代码,但我认为需要将“abceristest2”的数据设置为authorization参数。

于 2019-07-09T22:29:40.360 回答