Documentation ¶
Index ¶
- Constants
- func Deploy(contractJsonFilePath string, privateKey *ecdsa.PrivateKey, nodeURI string, ...) (common.Address, *types.Transaction, *bind.BoundContract, error)
- func Instance(contractJsonFilePath string, address common.Address, ...) (*bind.BoundContract, error)
- func ParseJsonParams(paramsJson string) ([]interface{}, error)
- func QueryBalance(contractJsonFilePath string, contractAddress string, accountAddress string, ...) (sdk.DecCoin, error)
- func SimpleQuery(contractJsonFilePath string, contractAddress string, nodeURI string, ...) ([]interface{}, error)
- func SimpleTx(contractJsonFilePath string, contractAddress string, ...) (*ethTypes.Transaction, error)
- func Transfer(contractJsonFilePath string, contractAddress string, ...) (*ethTypes.Transaction, error)
- type CompiledContract
Constants ¶
const ( METHOD_NAME = "name" METHOD_BALANCE_OF = "balanceOf" METHOD_SYMBOL = "symbol" METHOD_DECIMALS = "decimals" METHOD_TRANSFER = "transfer" )
Variables ¶
This section is empty.
Functions ¶
func Deploy ¶
func Deploy(contractJsonFilePath string, privateKey *ecdsa.PrivateKey, nodeURI string, initParamsJson string) (common.Address, *types.Transaction, *bind.BoundContract, error)
This function deploys an Ethereum contract it receives the path to the compiled contract in JSON, a private key and a nodeURI then it deploys the smart contract to the chain via the given evmos node
func Instance ¶
func Instance(contractJsonFilePath string, address common.Address, backend bind.ContractBackend) (*bind.BoundContract, error)
func ParseJsonParams ¶
This function parses the given json value for contract method's parameters It extracts the params in the same given order and converts the simple types such as numbers and strings Example: {"params":[51, "test msg"]}
func QueryBalance ¶
func QueryBalance(contractJsonFilePath string, contractAddress string, accountAddress string, nodeURI string) (sdk.DecCoin, error)
This function queries a balance of an account on a smart contract
func SimpleQuery ¶
func SimpleQuery(contractJsonFilePath string, contractAddress string, nodeURI string, method string, paramsJson string) ([]interface{}, error)
This function queries an Ethereum contract it receives the path to the compiled contract in JSON, a private key and a nodeURI then it deploys the smart contract to the chain via the given evmos node This function supports simple types as method parameters for the contract e.g numbers and strings Ex: SimpleQuery( "./contracts/compiled_contracts/HelloWorld.json", "0xe0112de09D54E3b5909A60C807BB60c973a20678", "http://localhost:8545", "message", "{\"params\":[51, \"test msg\"]}")
func SimpleTx ¶
func SimpleTx(contractJsonFilePath string, contractAddress string, privateKey *ecdsa.PrivateKey, nodeURI string, method string, paramsJson string) (*ethTypes.Transaction, error)
This function transacts an Ethereum contract it receives the path to the compiled contract in JSON, its address, a private key and a nodeURI with method to call and its parameters if there is any in Json format then it calls the given method and passes the parameters which suppose to change the state This function supports simple types as method parameters for the contract e.g numbers and strings Ex: SimpleTx( "./contracts/compiled_contracts/HelloWorld.json", "0xe0112de09D54E3b5909A60C807BB60c973a20678", <Private_Key>, "http://localhost:8545", "update", "{\"params\":[\"new msg\"]}")