Algodesk and uint arguments

hello,
I am currently doing my first steps into Algorand, trying the stateful contract functionalities.
I am using Pyteal on my box and the Algodesk tool which is pretty intuitive imo.
Tho, there is one thing i really don’t get, whenever i want to save an int argument into the global state after converting it with Btoi, it does return the wrong value:

  • args[0]: 10
  • App.globalPut( Bytes(“test”), Btoi(Txn.application_args[0]) )
  • result: 0:{ “key”: “test”, “value”:{“bytes”:"", “type”:2, “uint”:12592}

Why is 10 converted to 12592 ?
Did i miss something ? Or is it maybe a malfunction from Algodesk ?

Hi @liva, welcome to Algorand!

Btoi converts big endian byte arrays to integers, not decimal strings to integers.

The string “10” corresponds to the byte array [49, 48], which corresponds to the integere 49*256 + 48 = 12592 in big endian.
That is why you see 12592.

I believe this an issue with passing ints in AlgoDesk. Their team is looking at it.

I see, thanks a lot for the detailed answer :+1: