Appargs params empty on AlgoSigner while params exist from code behind

I do not know why my appargs displays empty on algosigner fields but the appargs params exist from code behind.
2021-11-17 04_07_13-swap.js - react-algo - Visual Studio Code

On Algosigner:

Hello! Have you checked on the details tab to see that the args are present in the JSON? that way we can know for sure if it’s only a display error or if the args are actually being lost in the middle of the process.

Algosigner doesn’t respond when I click the details tab or sign button at that point, I am unable to click on anything except the reject button

Can you provide the the resulting base64 string of the transaction? That would help me a lot with debugging what’s happening here and why it stops responding.

Also, have you checked if the appArgs are present and valid on the transaction after you create it with the SDK? As you can see here, using new Uint8Array(a) might not be enough to encode it correctly.

You can try using AlgoSigner.encoding.* to make sure the Uint8Array is constructed correctly. E.g:
AlgoSigner.encoding.stringToByteArray(a)

6tirlKPSUbocH/zizDLCY2ZF3P7DCl9RH2JvoU/X+xA=

I used AlgoSigner.encoding.stringToByteArray(a) you suggested but still didn’t work…
I have attached an image below:

This is the tx params

tx4 = {
            type: 'appl',
            from: from,
            appIndex: 21580889,
            appOnComplete: 0,
            appAccounts: ['JMVEVWOU3EAOUFXZ3TXFGS44AGE5VINMXTFM446XSS7RNC4KOPR5HR537U'],
            //appForeignAssets: [10458941, 22039624],
            fee: txParams["min-fee"],
            
            appArgs: [AlgoSigner.encoding.stringToByteArray('c3dhcA=='), AlgoSigner.encoding.stringToByteArray('Zmk=')],
            firstRound: txParams["last-round"],
            lastRound: txParams["last-round"] + 1000,
            genesisID: txParams["genesis-id"],
            genesisHash: txParams["genesis-hash"],
            flatFee: true,
          };

Thanks for the extra details!

I’ve noticed you may be using the old signing function of AlgoSigner (AlgoSigner.sign). The args shown ('c3dhcA==', 'Zmk=') seem to be encoded in base64, which is the correct encoding needed for this function. As so:

...
  appArgs: ['c3dhcA==', 'Zmk='],
...

However, we’re beginning to deprecate AlgoSigner.sign in the next major release, so you should migrate to the new signing function (AlgoSigner.signTxn) as it was made to eliminate most of these naming and encoding problems that were occasionally present when using the old one.

You can check out our new dApp guide for help in moving to the newer and better signing standard.
You can find links there to both the documentation, our example dapp page and a guide for transitioning from the old functions to the new one.

2 Likes

Thank you, Switched to the V2 and it worked!

1 Like