Pass address as argument to TEAL

You need ApplicationArgs 1 to be the 32-byte raw address, not the 58-character string looking like DXTFUT4EGE76MJ2Z55ER5WD67PI7SJ3UZPK4BIFU546BDICNVXJ6OBNZ3Y.

For conversion between these two formats, see Encoding and Decoding - Algorand Developer Portal
If you call from the JS SDK, you need to call your smart contract with pk computed as:

const address = 'DXTFUT4EGE76MJ2Z55ER5WD67PI7SJ3UZPK4BIFU546BDICNVXJ6OBNZ3Y';
const pk = algosdk.decodeAddress(address);

and not with address.

There isn’t an easy way to convert between these two formats inside the smart contract in TEAL. I always recommend TEAL smart contracts to only deal with 32-bit raw addresses (aka pk above), and have the SDK do the conversions.

In general, I recommend using beaker for new smart contracts. Beaker also allows you to directly create an ABI-compliant smart contract that can easily be called from other smart contracts and from the SDK. You don’t need to worry about encoding when using beaker. For example, see beaker/examples/boxen/demo.py at fb76617ea49ed26dfa98b4dbda98649731c09bdc · algorand-devrel/beaker · GitHub

1 Like