GetScatter / ScatterWebExtension

Extension that allows you to sign transactions with your private keys securely from within the browser without ever exposing them.
MIT License
366 stars 127 forks source link

Submitting multiple EOS actions in one transaction - does not bring up Scatter window or initiate transaction #143

Closed acoutts closed 5 years ago

acoutts commented 5 years ago

Hello- I am attempting to submit multiple EOS actions in one transaction, but it doesn't appear to work.

let scatter = this.props.scatter;
let eos = scatter.eos(this.props.network, Eos, this.props.options, "https")
eos.transaction(tr => {
  tr.buyrambytes({
    payer: this.props.scatter.identity.accounts[0].name,
    receiver: this.props.scatter.identity.accounts[0].name,
    bytes: 50
  })

  tr.transfer({
    from: this.props.scatter.identity.accounts[0].name,
    to: 'gi4dcnbug4ge',
    quantity: '0.0050 EOS',
    memo: ''
  })
});

When I comment out either of the tr.[action] calls above, the code works:

When I try to use both actions in one transaction, Scatter never pops up and even with verbose mode on I can't find any feedback to give me some clues as to what the issue is.

Here is the console output that comes up when I attempt to execute the code above with both actions in the transaction:

17:23:28.404 index.js:36 api > post      https://eos.greymass.com:443/v1/chain/get_info {}
17:23:28.416 index.js:36 api > post      https://eos.greymass.com:443/v1/chain/get_info {}
17:23:28.631 index.js:36 api < response      https://eos.greymass.com:443/v1/chain/get_info {"server_version":"8777d8db","chain_id":"aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906","head_block_num":7761901,"last_irreversible_block_num":7761574,"last_irreversible_block_id":"00766ea60cdbe61c2a79022fdb55237fe600b500ee814d0b8d19ecaff0d1ce54","head_block_id":"00766fed7f1ef3e5e91d314f4774116f9f9688a42d7bfb18213d18b744e8ce51","head_block_time":"2018-07-25T21:23:26.500","head_block_producer":"argentinaeos","virtual_block_cpu_limit":21252057,"virtual_block_net_limit":1048576000,"block_cpu_limit":199900,"block_net_limit":1048576}
17:23:28.633 index.js:36 api < response      https://eos.greymass.com:443/v1/chain/get_info {"server_version":"8777d8db","chain_id":"aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906","head_block_num":7761901,"last_irreversible_block_num":7761574,"last_irreversible_block_id":"00766ea60cdbe61c2a79022fdb55237fe600b500ee814d0b8d19ecaff0d1ce54","head_block_id":"00766fed7f1ef3e5e91d314f4774116f9f9688a42d7bfb18213d18b744e8ce51","head_block_time":"2018-07-25T21:23:26.500","head_block_producer":"argentinaeos","virtual_block_cpu_limit":21252057,"virtual_block_net_limit":1048576000,"block_cpu_limit":199900,"block_net_limit":1048576}
17:23:28.634 index.js:36 api > post      https://eos.greymass.com:443/v1/chain/get_block {"block_num_or_id":7761574}
17:23:28.690 index.js:36 api < response      https://eos.greymass.com:443/v1/chain/get_block {"timestamp":"2018-07-25T21:20:41.500","producer":"eosriobrazil","confirmed":0,"previous":"00766ea5492c00015d3be84a227de6b53dc70f5afbda45d7a928fdcc4ad7e8e9","transaction_mroot":"0000000000000000000000000000000000000000000000000000000000000000","action_mroot":"e2896ff94b6ed5056b62b4ef2a56bcf9cf370a467a89949f01b21a9a031a410e","schedule_version":210,"new_producers":null,"header_extensions":[],"producer_signature":"SIG_K1_KkkrqswV5GBcnJavkUPLSReHxh96UW5VeS3muUNu15bR7Rvmq25ZSAzE82qRiYbkurLFa83SkPMpEjmqNSpQb28dDoicn7","transactions":[],"block_extensions":[],"id":"00766ea60cdbe61c2a79022fdb55237fe600b500ee814d0b8d19ecaff0d1ce54","block_num":7761574,"ref_block_prefix":788691242}

If I comment out one of the transaction pieces:

eos.transaction(tr => {
  tr.buyrambytes({
    payer: this.props.scatter.identity.accounts[0].name,
    receiver: this.props.scatter.identity.accounts[0].name,
    bytes: 50
  })

  /* tr.transfer({
    from: this.props.scatter.identity.accounts[0].name,
    to: 'gi4dcnbug4ge',
    quantity: '0.0050 EOS',
    memo: 'Fee Test'
  }) */
});

The Scatter window pops up as expected:

screen shot 2018-07-25 at 5 27 28 pm

..and the transaction works. Here is the console output:

17:27:22.801 api > post      https://eos.greymass.com:443/v1/chain/get_info {}
17:27:22.814 index.js:36 api > post      https://eos.greymass.com:443/v1/chain/get_info {}
17:27:22.879 index.js:36 api < response      https://eos.greymass.com:443/v1/chain/get_info {"server_version":"8777d8db","chain_id":"aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906","head_block_num":7762364,"last_irreversible_block_num":7762039,"last_irreversible_block_id":"0076707708f82767a0cefb448f77f5569901ac37abb00bc0400281060ca60828","head_block_id":"007671bc0d9b233fe74c157d7b1c63fb8f2fd3a79bf872a26a7b40e48d693fb2","head_block_time":"2018-07-25T21:27:20.500","head_block_producer":"libertyblock","virtual_block_cpu_limit":25339224,"virtual_block_net_limit":1048576000,"block_cpu_limit":199900,"block_net_limit":1048576}
17:27:22.892 index.js:36 api < response      https://eos.greymass.com:443/v1/chain/get_info {"server_version":"8777d8db","chain_id":"aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906","head_block_num":7762364,"last_irreversible_block_num":7762039,"last_irreversible_block_id":"0076707708f82767a0cefb448f77f5569901ac37abb00bc0400281060ca60828","head_block_id":"007671bc0d9b233fe74c157d7b1c63fb8f2fd3a79bf872a26a7b40e48d693fb2","head_block_time":"2018-07-25T21:27:20.500","head_block_producer":"libertyblock","virtual_block_cpu_limit":25339224,"virtual_block_net_limit":1048576000,"block_cpu_limit":199900,"block_net_limit":1048576}
17:27:22.893 index.js:36 api > post      https://eos.greymass.com:443/v1/chain/get_block {"block_num_or_id":7762039}
17:27:22.962 index.js:36 api < response      https://eos.greymass.com:443/v1/chain/get_block {"timestamp":"2018-07-25T21:24:35.500","producer":"eoshuobipool","confirmed":0,"previous":"0076707681850591f54ed5d942a07615f11adca656e06b617c5ddc7fb715ebce","transaction_mroot":"0000000000000000000000000000000000000000000000000000000000000000","action_mroot":"f02d774e3572ff7fa587f0ee2e24af976b327beeb5f63c3ef61e677b7cfa6a44","schedule_version":210,"new_producers":null,"header_extensions":[],"producer_signature":"SIG_K1_K4E3ro1moQo8DNZtRJYSesNCRpBUKoWcyUACwx5uCm7zqbK1AhJViBeUWccKgHYctELAfV4wnMhBGeGB7BrtPbEdAqTXYJ","transactions":[],"block_extensions":[],"id":"0076707708f82767a0cefb448f77f5569901ac37abb00bc0400281060ca60828","block_num":7762039,"ref_block_prefix":1157353120}
17:27:35.359 index.js:36 api > post      https://eos.greymass.com:443/v1/chain/push_transaction {"compression":"none","transaction":{"expiration":"2018-07-25T21:28:20","ref_block_num":28791,"ref_block_prefix":1157353120,"net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"buyrambytes","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":"8073d6147175d3348073d6147175d33432000000"}],"transaction_extensions":[]},"signatures":["SIG_K1_KbrBXK2HQEEC6zV9Nb26qbrQCaLV9RS7cUk5JSxTFNnEofbC8LTHZsWBCPd4oGu1HuwroRB1Mb6jPtwe9XKqv7VrMYzy3M"]}
17:27:35.424 index.js:36 api < response      https://eos.greymass.com:443/v1/chain/push_transaction {"transaction_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","processed":{"id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","receipt":{"status":"executed","cpu_usage_us":4839,"net_usage_words":14},"elapsed":4839,"net_usage":112,"scheduled":false,"action_traces":[{"receipt":{"receiver":"eosio","act_digest":"90dbe854584c7797fe9ea46eb0237ef86d2dcca1a9fb33bc698f70849b2eca14","global_sequence":93968307,"recv_sequence":9873630,"auth_sequence":[["andrewcoutts",703]],"code_sequence":7,"abi_sequence":8},"act":{"account":"eosio","name":"buyrambytes","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"payer":"andrewcoutts","receiver":"andrewcoutts","bytes":50},"hex_data":"8073d6147175d3348073d6147175d33432000000"},"elapsed":2730,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[{"receipt":{"receiver":"eosio.token","act_digest":"211ebea5a95b66eb76bbadcf11c9f7d17273db7c0a550df4aaf86f74b8f2800d","global_sequence":93968308,"recv_sequence":2246473,"auth_sequence":[["andrewcoutts",704]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ram","quantity":"0.0143 EOS","memo":"buy ram"},"hex_data":"8073d6147175d334000090e602ea30558f0000000000000004454f5300000000076275792072616d"},"elapsed":859,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[{"receipt":{"receiver":"andrewcoutts","act_digest":"211ebea5a95b66eb76bbadcf11c9f7d17273db7c0a550df4aaf86f74b8f2800d","global_sequence":93968309,"recv_sequence":232,"auth_sequence":[["andrewcoutts",705]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ram","quantity":"0.0143 EOS","memo":"buy ram"},"hex_data":"8073d6147175d334000090e602ea30558f0000000000000004454f5300000000076275792072616d"},"elapsed":12,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[]},{"receipt":{"receiver":"eosio.ram","act_digest":"211ebea5a95b66eb76bbadcf11c9f7d17273db7c0a550df4aaf86f74b8f2800d","global_sequence":93968310,"recv_sequence":644804,"auth_sequence":[["andrewcoutts",706]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ram","quantity":"0.0143 EOS","memo":"buy ram"},"hex_data":"8073d6147175d334000090e602ea30558f0000000000000004454f5300000000076275792072616d"},"elapsed":13,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[]}]},{"receipt":{"receiver":"eosio.token","act_digest":"ee148335b507080d93b265d4df3ecdb8655d824c4069879cf37014bcb64f600d","global_sequence":93968311,"recv_sequence":2246474,"auth_sequence":[["andrewcoutts",707]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ramfee","quantity":"0.0001 EOS","memo":"ram fee"},"hex_data":"8073d6147175d334a0d492e602ea3055010000000000000004454f53000000000772616d20666565"},"elapsed":685,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[{"receipt":{"receiver":"andrewcoutts","act_digest":"ee148335b507080d93b265d4df3ecdb8655d824c4069879cf37014bcb64f600d","global_sequence":93968312,"recv_sequence":233,"auth_sequence":[["andrewcoutts",708]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ramfee","quantity":"0.0001 EOS","memo":"ram fee"},"hex_data":"8073d6147175d334a0d492e602ea3055010000000000000004454f53000000000772616d20666565"},"elapsed":10,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[]},{"receipt":{"receiver":"eosio.ramfee","act_digest":"ee148335b507080d93b265d4df3ecdb8655d824c4069879cf37014bcb64f600d","global_sequence":93968313,"recv_sequence":641972,"auth_sequence":[["andrewcoutts",709]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ramfee","quantity":"0.0001 EOS","memo":"ram fee"},"hex_data":"8073d6147175d334a0d492e602ea3055010000000000000004454f53000000000772616d20666565"},"elapsed":14,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[]}]}]}],"except":null}}
17:27:35.425 index.js:36 {"broadcast":true,"transaction":{"compression":"none","transaction":{"expiration":"2018-07-25T21:28:20","ref_block_num":28791,"ref_block_prefix":1157353120,"net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"buyrambytes","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":"8073d6147175d3348073d6147175d33432000000"}],"transaction_extensions":[]},"signatures":["SIG_K1_KbrBXK2HQEEC6zV9Nb26qbrQCaLV9RS7cUk5JSxTFNnEofbC8LTHZsWBCPd4oGu1HuwroRB1Mb6jPtwe9XKqv7VrMYzy3M"]},"transaction_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","processed":{"id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","receipt":{"status":"executed","cpu_usage_us":4839,"net_usage_words":14},"elapsed":4839,"net_usage":112,"scheduled":false,"action_traces":[{"receipt":{"receiver":"eosio","act_digest":"90dbe854584c7797fe9ea46eb0237ef86d2dcca1a9fb33bc698f70849b2eca14","global_sequence":93968307,"recv_sequence":9873630,"auth_sequence":[["andrewcoutts",703]],"code_sequence":7,"abi_sequence":8},"act":{"account":"eosio","name":"buyrambytes","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"payer":"andrewcoutts","receiver":"andrewcoutts","bytes":50},"hex_data":"8073d6147175d3348073d6147175d33432000000"},"elapsed":2730,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[{"receipt":{"receiver":"eosio.token","act_digest":"211ebea5a95b66eb76bbadcf11c9f7d17273db7c0a550df4aaf86f74b8f2800d","global_sequence":93968308,"recv_sequence":2246473,"auth_sequence":[["andrewcoutts",704]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ram","quantity":"0.0143 EOS","memo":"buy ram"},"hex_data":"8073d6147175d334000090e602ea30558f0000000000000004454f5300000000076275792072616d"},"elapsed":859,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[{"receipt":{"receiver":"andrewcoutts","act_digest":"211ebea5a95b66eb76bbadcf11c9f7d17273db7c0a550df4aaf86f74b8f2800d","global_sequence":93968309,"recv_sequence":232,"auth_sequence":[["andrewcoutts",705]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ram","quantity":"0.0143 EOS","memo":"buy ram"},"hex_data":"8073d6147175d334000090e602ea30558f0000000000000004454f5300000000076275792072616d"},"elapsed":12,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[]},{"receipt":{"receiver":"eosio.ram","act_digest":"211ebea5a95b66eb76bbadcf11c9f7d17273db7c0a550df4aaf86f74b8f2800d","global_sequence":93968310,"recv_sequence":644804,"auth_sequence":[["andrewcoutts",706]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ram","quantity":"0.0143 EOS","memo":"buy ram"},"hex_data":"8073d6147175d334000090e602ea30558f0000000000000004454f5300000000076275792072616d"},"elapsed":13,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[]}]},{"receipt":{"receiver":"eosio.token","act_digest":"ee148335b507080d93b265d4df3ecdb8655d824c4069879cf37014bcb64f600d","global_sequence":93968311,"recv_sequence":2246474,"auth_sequence":[["andrewcoutts",707]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ramfee","quantity":"0.0001 EOS","memo":"ram fee"},"hex_data":"8073d6147175d334a0d492e602ea3055010000000000000004454f53000000000772616d20666565"},"elapsed":685,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[{"receipt":{"receiver":"andrewcoutts","act_digest":"ee148335b507080d93b265d4df3ecdb8655d824c4069879cf37014bcb64f600d","global_sequence":93968312,"recv_sequence":233,"auth_sequence":[["andrewcoutts",708]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ramfee","quantity":"0.0001 EOS","memo":"ram fee"},"hex_data":"8073d6147175d334a0d492e602ea3055010000000000000004454f53000000000772616d20666565"},"elapsed":10,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[]},{"receipt":{"receiver":"eosio.ramfee","act_digest":"ee148335b507080d93b265d4df3ecdb8655d824c4069879cf37014bcb64f600d","global_sequence":93968313,"recv_sequence":641972,"auth_sequence":[["andrewcoutts",709]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"andrewcoutts","permission":"active"}],"data":{"from":"andrewcoutts","to":"eosio.ramfee","quantity":"0.0001 EOS","memo":"ram fee"},"hex_data":"8073d6147175d334a0d492e602ea3055010000000000000004454f53000000000772616d20666565"},"elapsed":14,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"125eb2595fcc73fd8af4a40a4fe9dec16fdc51e6150e296a02a8112494cc2d8b","inline_traces":[]}]}]}],"except":null}}

I am attempting this referencing the EOSJS documentation where they show this example:

wif = '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'
pubkey = 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV'

eos.transaction(tr => {
  tr.newaccount({
    creator: 'eosio',
    name: 'myaccount',
    owner: pubkey,
    active: pubkey
  })

  tr.buyrambytes({
    payer: 'eosio',
    receiver: 'myaccount',
    bytes: 8192
  })

  tr.delegatebw({
    from: 'eosio',
    receiver: 'myaccount',
    stake_net_quantity: '10.0000 SYS',
    stake_cpu_quantity: '10.0000 SYS',
    transfer: 0
  })
})

Any help / guidance greatly appreciated. Thank you!

acoutts commented 5 years ago

Update: This pattern does not work either:

    await eos.transaction(['eosio', 'eosio.token'], ({eosio, eosio_token}) =>{
      eosio.buyrambytes({
        payer: this.props.scatter.identity.accounts[0].name,
        receiver: this.props.scatter.identity.accounts[0].name,
        bytes: 50
      })
      eosio_token.transfer({
        from: this.props.scatter.identity.accounts[0].name,
        to: 'gi4dcnbug4ge',
        quantity: '0.0050 EOS',
        memo: 'Test'
      })
    })
acoutts commented 5 years ago

This pattern works for two actions on the same contract, but I still can't seem to trigger two actions on two contracts:

    await eos.transaction(['eosio'], ({eosio}) => {
      eosio.buyrambytes(this.props.scatter.identity.accounts[0].name, this.props.scatter.identity.accounts[0].name, 50)
      eosio.buyrambytes(this.props.scatter.identity.accounts[0].name, this.props.scatter.identity.accounts[0].name, 503)
    })
screen shot 2018-07-25 at 7 28 43 pm
nsjames commented 5 years ago

This was likely related to an issue with multi-contract batch transactions. Should be fixed now.

fefc86f1195045c89230ebcbc09d9a4bed2e9780