inertia186 / radiator

Hive Ruby API Client
https://hive.blog/hive-139531/@inertia/radiator-v0-4-8-hive-ruby-api-client-eclipse-update
Other
50 stars 22 forks source link

Multi-transactions is it possible in radiator? #19

Closed Nerossoul closed 6 years ago

Nerossoul commented 6 years ago

How to make multi-transaction like this? If possible show code please.

golos.broadcast.send({ extensions: [], operations: [ ['transfer', {from:'user',to:'html',amount:'1.000 GBG',memo:'yo 1'}], ['transfer', {from:'user',to:'html',amount:'0.001 GBG',memo:'yo 2'}], ['transfer', {from:'user',to:'html',amount:'0.100 GBG',memo:'yo 3'}], ['transfer', {from:'user',to:'html',amount:'0.010 GBG',memo:'yo yo'}] ]}, [wif], console.log);

inertia186 commented 6 years ago
options = {chain: :golos}
tx = Radiator::Transaction.new(options.merge(wif: wif))

tx.operations << {type: :transfer, from: 'user', to: 'html', amount: '1.000 GBG', memo: 'yo 1'}
tx.operations << {type: :transfer, from: 'user', to: 'html', amount: '0.001 GBG', memo: 'yo 2'}
tx.operations << {type: :transfer, from: 'user', to: 'html', amount: '0.100 GBG', memo: 'yo 3'}
tx.operations << {type: :transfer, from: 'user', to: 'html', amount: '0.010 GBG', memo: 'yo yo'}

puts tx.process(true)