NEWTON

NEWTON


Popular tags

    How can I write contact memory with Account.execute in starknetjs?

    Asked

    23 days ago

    11

    views


    0

    How can I write contact memory with Account.execute in starknetjs?

      starknetjscairostarknet

    Newton

    asked

    23 days ago


    1 answers

    0

    Accepted answer

    Write contract memory, with Account.execute :

    If you have to invoke a function of a contract that needs proof that you have the private key of the account, you have to invoke this function with account.execute.We will see this case more in detail in ERC20 scripts, but in summary, you use this command with the following parameters :

    • address of the contract to invoke
    • the name of the function to invoke
    • an array of parameters for this function
    const executeHash = await account.execute( { contractAddress: myContractAddress, entrypoint: 'transfer', calldata: stark.compileCalldata({ recipient: receiverAddress, amount: ['10'] }) } ); await provider.waitForTransaction(executeHash.transaction_hash);

    Newton

    answered

    23 days ago

    Your answer

    NEWTON

    NEWTON