NEWTON

NEWTON


Popular tags

    How to send tokens through StarkNet.py?

    Asked

    30 days ago

    18

    views


    0

    Hey, I have some tokens on my account and would like to send them to another. How to do it in StarkNet.py?

      starknet_pystarknetpysendtokens

    0xa483...6765fa

    asked

    30 days ago


    1 answers

    0

    Accepted answer

    Hi, I recommend using the Contract interface.

    The address and ABI of the token have to be known. You will also need your account instance.

    For example, if you would like to send ETH tokens:

    • get its ABI (e.g. from the starkscan.co)
    • create the Contract instance
    • invoke transfer function
    eth_address = 0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
    
    contract = Contract(address=eth_address, abi=abi, client=account)
    
    res = await contract.functions["transfer"].invoke(recipient=recipient_address, amount=1000, max_fee=int(1e16))
    await res.wait_for_acceptance()
    

    where:

    • abi is an abi of the contract
    • account is an AccountClient instance

    war-in

    answered

    30 days ago

    Your answer

    NEWTON

    NEWTON