cosmospy icon indicating copy to clipboard operation
cosmospy copied to clipboard

Create multiTx function

Open atmoner opened this issue 3 years ago • 1 comments

I added a function that allows sending multi tx in a single block. Here's how to use it:

data_input is send data_output is the one who receives

data_input = [{'address': 'cosmos1dwkhyqsgr6mxa2qf70rv5mpdch9vr345tsmlpm'
              , 'coins': [{'amount': '100000', 'denom': 'uatom'}]},
              {'address': 'cosmos1dwkhyqsgr6mxa2qf70rv5mpdch9vr345tsmlpm'
              , 'coins': [{'amount': '100000', 'denom': 'uatom'}]}]

data_output = [{'address': 'cosmos19xxs503q3xe6p20tngk4qa8shlp479739sly2z'
               , 'coins': [{'amount': '100000', 'denom': 'uatom'}]},
               {'address': 'cosmos1t8yky3wexwncwsdqvdet2e9l4drw69cwcgw3f0'
               , 'coins': [{'amount': '100000', 'denom': 'uatom'}]}]

tx.add_multi_transfer(data_inputF=data_input, data_outputF=data_output)

atmoner avatar Jun 12 '21 21:06 atmoner

Thanks for the PR!

The API already supports one type of one-to-many transaction via calling .add_transfer() more than once. So I'm not sure if adding this PR would allow any new use case. Where the MsgMultiSend type would be truly useful is sending from different input addresses (many-to-many type of transaction) but this PR in its current state doesn't allow that.

Also, a test would be needed for any added functionality.

hukkin avatar Jun 14 '21 19:06 hukkin