Skip to content

Latest commit

 

History

History
 
 

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Welcome!

To successfully execute these examples you'll need to configure some environment variables. To do so:

  1. Rename the ".env.template" file located at the root of this folder to ".env"
  2. Uncomment, and assign your Sepolia testnet endpoint to the RPC_PROVIDER_URL variable in the ".env" file
  3. Uncomment, and assign your account address to the ACCOUNT_ADDRESS variable in the ".env" file (make sure to have a few ETH in it)
  4. Uncomment, and assign your starknet public key to the PUBLIC_KEY variable in the ".env" file
  5. Uncomment, and assign your private key to the PRIVATE_KEY variable in the ".env" file

The variables used vary from example to example, you'll see the required ones on each main.go file, usually after a "// Load variables from '.env' file" comment. To run an example:

  1. Make sure you are in the chosen example directory
  2. Execute go run main.go to run it

Some FAQ answered by these examples

  1. How to deploy an account via DEPLOY_TRANSACTION?
    R: See deployAccount
  2. How to estimate fees?
    R: See deployAccount, line 89.
  3. How to generate random public and private keys?
    R: See deployAccount, line 46.
  4. How to use my existing account importing my account address, and public and private keys?
    R: See deployContractUDC, lines 54 and 64.
  5. How to get my nonce?
    R: See deployContractUDC, line 70.
  6. How to deploy a smart contract using UDC?
    R: See deployContractUDC.
  7. How to send an invoke transaction?
    R: See simpleInvoke.
  8. How to get the transaction status?
    R: See simpleInvoke, line 131.
  9. How to deploy an ERC20 token?
    R: See deployContractUDC.
  10. How to get the balance of a ERC20 token?
    R: See simpleCall.
  11. How to make a function call?
    R: See simpleCall.