everx-labs/ever-cli

The offline messages sending is not working

deedlau opened this issue · 1 comments

Issue description

There is the inconsistent packing/unpacking of "tonos-cli message" JSONs here in src/call.rs. And then the "offline transactions/messages" feature of tonos-cli is not working.

Steps to reproduce the issue

  1. Run tonos-cli message <wallet_address> submitTransaction '{"dest":"<wallet_address>","value":1000000000,"bounce":true,"allBalance":false,"payload":""}' --abi SafeMultisigWallet.abi.json --sign wallet-key.json --lifetime 3600 (as per the docs: https://docs.ton.dev/86757ecb2/p/94921e-multisignature-wallet-management-in-tonos-cli/t/364e69 "4.8. Create new transaction offline")
  2. Write down the encoded message body
  3. Run tonos-cli send --abi SafeMultisigWallet.abi.json '<message_body>' (as per the docs: https://docs.ton.dev/86757ecb2/p/94921e-multisignature-wallet-management-in-tonos-cli/t/364e69 "4.10. Broadcast previously generated message")

What's the expected result?

 message: <message_body>
     abi: SafeMultisigWallet.abi.json

MessageId: <message_id>
Expire at: <expiry_date>
Calling method submitTransaction with parameters:
{
  "allBalance": false,
  "bounce": true,
  "dest": "<wallet_address>",
  "payload": "te6ccgEBAQEAAgAAAA==",
  "value": "0x3b9aca00"
}
Processing... 
Succeded.
Result: {
  "transId": "0x0"
}

And the transaction message is sent to the network.

What's the actual result?

Input arguments:
 message: <message_body>
     abi: SafeMultisigWallet.abi.json
Connecting to https://net.ton.dev
Error: couldn't find "address" key in message
Error: 1

And the transaction message is not sent to the network.

Additional details

Please note the difference in pack_message: https://github.com/tonlabs/tonos-cli/blob/90c1385039dc08737c737341b2fef570a556f703/src/call.rs#L112-L119
And unpack_message: https://github.com/tonlabs/tonos-cli/blob/90c1385039dc08737c737341b2fef570a556f703/src/call.rs#L144-L145
unpack_message expects msg->address field in JSON here: https://github.com/tonlabs/tonos-cli/blob/90c1385039dc08737c737341b2fef570a556f703/src/call.rs#L144, while the pack_message method is not providing it.

This commit added the "address" JSON field packing/unpacking: 577d54b#diff-c5c022d135afc2c596bb0084c03b78ed
And this commit removed the packing, but there is unpacking left: 2ba9f08#diff-c5c022d135afc2c596bb0084c03b78ed

Please make a decision - whether you need this field or not :)