#How to use app_client.get_box()

1 messages · Page 1 of 1 (latest)

slim palm
#

My contract stores a box using this format

account.bytes + Bytes(b"-") + op.itob(token_id) where token_id is a UInt64

how do recreate the key to use in algokit utils, to get the key. i'm using python

regal pine
#

what specific problem are you encountering when trying to recreate the key?

slim palm
#

It's says box not found

regal pine
#

how are you recreating the key

slim palm
#

I'm submitting a bytes value

#

b"to_alloc_" + deployer.address.encode() + b"-" + token_id.to_bytes(8, "big")

#

b"to_alloc_" is the prefix

regal pine
#

where do you get deployer.address from? what's the class/object

#

of deployer

slim palm
#

SigningAccount

regal pine
#

ok

#

so that needs to be DECODED

#

because it's a base32 encoded address

#

of length 58

#

i think that might be the issue, although i usually use the algopy Account class as key

slim palm
#

it doesn't have decode method.

regal pine
#

not totally sure if .bytes from Account works the same

#

i knw

#

you need to get it

#

from algosdk.encoding

slim palm
#

it's actually a str value

regal pine
#

import decode_address

#

import decode_address from algosdk.encoding, and decode the deployer address from base32 to bytes

#

then try using that

slim palm
#

it works now, thanks

regal pine
#

np

slim palm
#

imma need your help most times, cause i am not really reacding docs, just rawdogging this to a prototype