To successfully execute these examples you'll need to configure some environment variables. To do so:
- Rename the ".env.template" file located at the root of this folder to ".env"
- Uncomment, and assign your Sepolia testnet endpoint to the
RPC_PROVIDER_URL
variable in the ".env" file - Uncomment, and assign your account address to the
ACCOUNT_ADDRESS
variable in the ".env" file (make sure to have a few ETH in it) - Uncomment, and assign your starknet public key to the
PUBLIC_KEY
variable in the ".env" file - 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:
- Make sure you are in the chosen example directory
- Execute
go run main.go
to run it
- How to deploy an account via
DEPLOY_TRANSACTION
?
R: See deployAccount - How to estimate fees?
R: See deployAccount, line 89. - How to generate random public and private keys?
R: See deployAccount, line 46. - How to use my existing account importing my account address, and public and private keys?
R: See deployContractUDC, lines 54 and 64. - How to get my nonce?
R: See deployContractUDC, line 70. - How to deploy a smart contract using UDC?
R: See deployContractUDC. - How to send an invoke transaction?
R: See simpleInvoke. - How to get the transaction status?
R: See simpleInvoke, line 131. - How to deploy an ERC20 token?
R: See deployContractUDC. - How to get the balance of a ERC20 token?
R: See simpleCall. - How to make a function call?
R: See simpleCall.