perawallet / pera-wallet

Source code for Pera Wallet, simply the best Algorand wallet.
https://perawallet.app
Other
178 stars 62 forks source link

Unable to submit TXN for signing which is part of a atomic group #42

Closed patrik7 closed 1 year ago

patrik7 commented 2 years ago

At a minimum, there is a discrepancy between the iOS and Android app behavior. If I am sending the transaction in in a wrong format please let me know.

I have a base64 encoded transaction that needs to be signed by the user. It is one transaction in a group of 2. (The second one will be signed by logic, not important)

base64Txns - is an array with a single string (base64 encoded transaction)

JS code:

const txnsToSign = base64Txns.map(txn => {
      return {
        txn: txn,
        message: 'Message to user',
      };
    });

const request = formatJsonRpcRequest("algo_signTxn", [txnsToSign]);

this.state.connector.sendCustomRequest(request)

The above code works as expected against the iOS version.

It fails with: "Invalid Input: Unable to parse transaction" against the Android version.

patrik7 commented 2 years ago

Note: Same txn submission works as expected against both Android and iOS if the transaction is NOT part of an atomic group.

mitsinsar commented 2 years ago

Hi @patrik7, Seems like Wallet is not able to parse transaction payload. Could you please provide transaction details? If it has private information, can you create dummy transaction with the similar attributes, please?

Thanks, best regards.

patrik7 commented 2 years ago

I was able to get this working with the help of @barnjamin

There was nothing wrong with the coding. The Android version expects to get ALL transactions from the atomic group, while the iOS is happy to get just one of them.

I was sending in just the one I needed the user to sign ... when I started sending the whole group it works as expected.

I will leave it up to you, whether you want to close this issue, or rename it and keep it as a reminder of inconsistency and maybe a possibility of improving the error messages.

patrik7 commented 2 years ago

Hi @patrik7, Seems like Wallet is not able to parse transaction payload. Could you please provide transaction details? If it has private information, can you create dummy transaction with the similar attributes, please?

Thanks, best regards.

Not a problem:

iqNhbXTOAAGtsKNmZWXNA+iiZnbOARTTNKNnZW6sdGVzdG5ldC12MS4womdoxCBIY7UYpLPITsgQ8i1PEIHLD3HwWaesIN7GL39w5Qk6IqNncnDEIDH+ckOYb/f8rFf1Pp4jx80wdFBVA5V+MROaKDllRoQ4omx2zgEU1xyjcmN2xCCqR6Lz4yhPOSrKukdrl/XwenvKRGc1FCCpMPQrAJ6nl6NzbmTEIOz89Qz+ddzbJeDb3slQjH3ljJf8IYGAc3MkzbLF4CvUpHR5cGWjcGF5

taylanpince commented 1 year ago

Just FYI that after some discussion, we've decided to never allow this situation (on iOS or Android). Going forward, both apps will show an error message to the user, letting them know that due to an obstructed transaction in the group, wallet will refuse to sign the txn group completely. The solution is to pass all txns in a group to the wallet at all times.