Skip to content

Is the "param1" of the call receipt no longer the function selector on the testnet? #2424

Closed Answered by maschad
spacedragon asked this question in Q&A
Discussion options

You must be logged in to vote

@spacedragon I must apologize as this was overcomplicated.

I presume you are using v1 encoding, thus the value 10480 returned by param1 includes the base offset for the scriptData , and thus you do have access to the encoded function selector. Therefore you should be able to determine which function is called.

Given WORD_SIZE = 8 , CONTRACT_ID_LEN = 32 and ASSET_ID_LEN = 32 bytes, you can decode it as such:

const encodedFunctionSelectorOffset =  WORD_SIZE + ASSET_ID_LEN + CONTRACT_ID_LEN + WORD_SIZE + WORD_SIZE;

Therefore we can use the scriptData from the TransactionResult to get the decodedFunctionSelector

    // Submit the contract call
    const response = await contracts.functions.c…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@maschad
Comment options

maschad Jun 12, 2024
Collaborator

@maschad
Comment options

maschad Jun 13, 2024
Collaborator

Answer selected by spacedragon
@spacedragon
Comment options

@spacedragon
Comment options

@danielbate
Comment options

@spacedragon
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants