SecretNetwork icon indicating copy to clipboard operation
SecretNetwork copied to clipboard

Decrypt output of multiple messages [secretcli]

Open toml01 opened this issue 5 years ago • 3 comments

It's not the prettiest thing in the world, but it works. fixes #628

Example output (notice how for one of the messages there are errors instead of decrypted text):

[
  {
    "type": "execute",
    "raw_input": "e9f033de8fa6edaafd1b1c852bfa48172366ca74f9f6d76a0f968f5b115d9728{\"set_deadline\":{\"block\":1}}",
    "input": null,
    "output_data": "",
    "output_data_as_string": "",
    "output_log": [],
    "output_error": {},
    "plaintext_error": "Error: cannot decrypt error: Got an error decrypting the error: siv: authentication failed"
  },
  {
    "type": "execute",
    "raw_input": "cd400fb73f5c99edbc6aab22c2593332b8c9f2ea806bf9b42e3a523f3ad06f62{\"send\":{\"recipient\":\"secret1g6c4vq5me8ymctuvalxsqn38glxrvzadflleck\",\"amount\":\"1231231234564567897897\",\"msg\":\"eyJkZXBvc2l0X3Jld2FyZHMiOnt9fQo=\"}}",
    "input": null,
    "output_data": "",
    "output_data_as_string": "",
    "output_log": [],
    "output_error": {
      "generic_err": {
        "msg": "insufficient funds: balance=18488995000000, required=1231231234564567897897"
      }
    },
    "plaintext_error": ""
  }
]

toml01 avatar Jan 20 '21 14:01 toml01

@toml01, I don't think you can send multiple messages using the cli, when did we need this?

assafmo avatar Aug 05 '21 11:08 assafmo

@assafmo You can't, you have to construct it yourself.

This is very useful when you have operations that require multiple transactions. Specifically for:

  • When you want the user to approve only one transaction instead of prompting multiple kleplr windows - for example like in providing liquidity to a new pool
  • When you have two transactions that depend on each other, but you don't want one to pass without the other - for example in the original Earn contracts, to top up the rewards you need to 1. send rewards 2. set a new deadline. But if setting the deadline fails, you want to first transaction to fail too.

toml01 avatar Aug 05 '21 12:08 toml01

Non-trivial conflicts :weary:

assafmo avatar Jul 14 '22 09:07 assafmo

Solved in a nicer way in #1085

toml01 avatar Aug 22 '22 21:08 toml01