Linking Stateless and Stateful Smart contracts

Hello everyone. I am trying to connect a stateful and a statless smart contract. The process is as follows:
1 I create the stateful smart contract
2 I create the stateless smart contract
3 I execute an Application Call of type Update with an argument equal to the address of the stateless smart contract.
The code snippet of the Stateful is as follows:

byte “Creator”
txn Sender

txn NumAppArgs
int 1

bz failed
byte “Stateless”
txna ApplicationArgs 0
int 1

The way I pass the argument with Javascript is as follows:

let args = [new Uint8Array (Buffer.from (statelessAddress, “base64”))]
await updateApp (algodClient, creatorAccount, appID, approvalProgram, clearProgram, args);

The code works fine, however, when in another teal code snippet I check that a certain transaction (in an atomic transfer) is sent by the Stateless smart contract, the check always fails. In fact I noticed that in the global state, the address of the Stateless is not stored, but a slightly different string. What am I doing wrong?

Sorry for my English.
Thank you all

Can you try passing the address using code similar to the following:

                let appArgs = [];
                var enc = new TextEncoder();

@eleonora TEAL expects the 32-byte publicKey rather than the 58-byte address. Provide the decoded address:

let args = [];
var decodedAddr = algosdk.decodeAddress(statelessAddress);

Using the Python SDK you can do

from algosdk import encoding
args = [ encoding.decode_address(stateless_contract_address) ]

Alternatively, ApplicationCallTxn takes an optional argument “accounts”, and these are address strings that do not need to be decoded. Then you can store the address (using PyTeal)

App.globalPut( Bytes("Stateless Address"), Txn.accounts[1])