eos Transact Without Broadcast

2019-07-15 11:28:59

https://github.com/EOSIO/eosjs/blob/849c03992e6ce3cb4b6a11bf18ab17b62136e5c9/src/tests/web.html#L144

     const transactWithoutBroadcast = async () => await api.transact({
            actions: [{
                    account: 'eosio.token',
                    name: 'transfer',
                    authorization: [{
                        actor: 'bob',
                        permission: 'active',
                    }],
                    data: {
                        from: 'bob',
                        to: 'alice',
                        quantity: '0.0001 SYS',
                        memo: '',
                    },
                }]
            }, {
                broadcast: false,
                blocksBehind: 3,
                expireSeconds: 30,
            });
                
        
            const testTransactWithoutBroadcast = async (e) => {
                resultsLabel = e.target;
                resultsLabel.innerText = EXECUTING;
        
                try {
                    transactionSignatures = await transactWithoutBroadcast();
                } catch (error) {
                    resultsLabel.className = 'failed';
                    resultsLabel.innerText = FAILED;
                    console.error('Transact without Broadcast Test Failure: ', error.message);
                    return false;
                }
        
                if(transactionSignatures.signatures && transactionSignatures.serializedTransaction) {
                    resultsLabel.className = "success";
                    resultsLabel.innerText = SUCCESS;
                    return true;
                }
                resultsLabel.className = 'failed';
                resultsLabel.innerText = FAILED;
                return false;
            };
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »