Documentation ¶
Index ¶
- Variables
- func CreateAuthentication(privateKey *ecdsa.PrivateKey, nonce *big.Int, value *big.Int, gasLimit uint64, ...) *bind.TransactOpts
- func PrivateKeyToAddress(privateKey *ecdsa.PrivateKey) (address common.Address, err error)
- func SignTx(authCli *AuthClient, tx *types.Transaction) (signedTx *types.Transaction, err error)
- type AuthClient
- type ProviderClient
- func (cli *ProviderClient) DeployContract(authCli *AuthClient, gasPrice *big.Int, abiPath string, binPath string, ...) (contractAddress common.Address, txHash common.Hash, err error)
- func (cli *ProviderClient) DeployContractUntil(authCli *AuthClient, gasPrice *big.Int, abiPath string, binPath string, ...) (status bool, contractAddress common.Address, txHash common.Hash, err error)
- func (cli *ProviderClient) GetBalance(address string) (balance *big.Int, err error)
- func (cli *ProviderClient) GetBlockHeaderByHash(blockHash string) (header *types.Header, err error)
- func (cli *ProviderClient) GetBlockHeaderByNumber(height *big.Int) (header *types.Header, err error)
- func (cli *ProviderClient) GetBlockInfoByHash(blockHash string) (blockInfo *types.Block, err error)
- func (cli *ProviderClient) GetBlockInfoByNumber(height *big.Int) (blockInfo *types.Block, err error)
- func (cli *ProviderClient) GetHeight() (height uint64, err error)
- func (cli *ProviderClient) GetLatestBlockHeader() (header *types.Header, err error)
- func (cli *ProviderClient) GetLatestBlockInfo() (blockInfo *types.Block, err error)
- func (cli *ProviderClient) GetPendingNonce(address string) (nonce uint64, err error)
- func (cli *ProviderClient) GetTransactionByHash(transactionHash string) (tx *types.Transaction, isPending bool, err error)
- func (cli *ProviderClient) GetTransactionReceipt(transactionHash string) (receipt *types.Receipt, err error)
- func (cli *ProviderClient) IsContract(address string) (isContract bool, err error)
- func (cli *ProviderClient) Transfer(authCli *AuthClient, to string, amount *big.Int, data []byte, gasLimit uint64) (txHash string, err error)
- func (cli *ProviderClient) WaitingTransactionStatus(txHash string) (status bool, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RinkebyChainId = big.NewInt(4) AuroraChainId = big.NewInt(1313161555) ArbitrumChainId = big.NewInt(421611) )
View Source
var ( ErrInvalidAddress = errors.New("err: input address is not valid! ") ErrInvalidAuthClientParams = errors.New("err: auth cli params is not valid! ") ErrInvalidParams = errors.New("err: input params are not valid! ") ErrInvalidHashValue = errors.New("err: input hash value is not valid! ") ErrInvalidPrivateKey = errors.New("err: input private key is not valid! ") ErrGetBlockStatus = errors.New("err: error when get status from chain! ") ErrAmountLessThanZero = errors.New("err: input amount value can not less than 0! ") )
Functions ¶
func CreateAuthentication ¶
func PrivateKeyToAddress ¶
func PrivateKeyToAddress(privateKey *ecdsa.PrivateKey) (address common.Address, err error)
transfer private key to address
func SignTx ¶
func SignTx(authCli *AuthClient, tx *types.Transaction) (signedTx *types.Transaction, err error)
sign transaction
Types ¶
type AuthClient ¶
type AuthClient struct { PrivateKey *ecdsa.PrivateKey `json:"private_key"` PublicKey *ecdsa.PublicKey `json:"public_key"` Address common.Address `json:"address"` ChainId *big.Int `json:"chain_id"` }
auth of user
func NewAuthClient ¶
func NewAuthClient(cli *ProviderClient, priKey string, chainId *big.Int) (authCli *AuthClient, err error)
create a new auth cli
type ProviderClient ¶
func NewClient ¶
func NewClient(provider string) (cli *ProviderClient, err error)
func (*ProviderClient) DeployContract ¶
func (cli *ProviderClient) DeployContract(authCli *AuthClient, gasPrice *big.Int, abiPath string, binPath string, params []interface{}) (contractAddress common.Address, txHash common.Hash, err error)
deploy zecrey
func (*ProviderClient) DeployContractUntil ¶
func (cli *ProviderClient) DeployContractUntil(authCli *AuthClient, gasPrice *big.Int, abiPath string, binPath string, params []interface{}) (status bool, contractAddress common.Address, txHash common.Hash, err error)
deploy smart zecrey until it is completed
func (*ProviderClient) GetBalance ¶
func (cli *ProviderClient) GetBalance(address string) (balance *big.Int, err error)
get balance
func (*ProviderClient) GetBlockHeaderByHash ¶
func (cli *ProviderClient) GetBlockHeaderByHash(blockHash string) (header *types.Header, err error)
get block header by hash
func (*ProviderClient) GetBlockHeaderByNumber ¶
func (cli *ProviderClient) GetBlockHeaderByNumber(height *big.Int) (header *types.Header, err error)
get block header by number
func (*ProviderClient) GetBlockInfoByHash ¶
func (cli *ProviderClient) GetBlockInfoByHash(blockHash string) (blockInfo *types.Block, err error)
get block info by hash
func (*ProviderClient) GetBlockInfoByNumber ¶
func (cli *ProviderClient) GetBlockInfoByNumber(height *big.Int) (blockInfo *types.Block, err error)
get block info by number
func (*ProviderClient) GetHeight ¶
func (cli *ProviderClient) GetHeight() (height uint64, err error)
get block height
func (*ProviderClient) GetLatestBlockHeader ¶
func (cli *ProviderClient) GetLatestBlockHeader() (header *types.Header, err error)
get latest block header info
func (*ProviderClient) GetLatestBlockInfo ¶
func (cli *ProviderClient) GetLatestBlockInfo() (blockInfo *types.Block, err error)
get latest block info by hash
func (*ProviderClient) GetPendingNonce ¶
func (cli *ProviderClient) GetPendingNonce(address string) (nonce uint64, err error)
func (*ProviderClient) GetTransactionByHash ¶
func (cli *ProviderClient) GetTransactionByHash(transactionHash string) (tx *types.Transaction, isPending bool, err error)
get transaction info by hash
func (*ProviderClient) GetTransactionReceipt ¶
func (cli *ProviderClient) GetTransactionReceipt(transactionHash string) (receipt *types.Receipt, err error)
get transaction receipt
func (*ProviderClient) IsContract ¶
func (cli *ProviderClient) IsContract(address string) (isContract bool, err error)
check if the address is a zecrey address @address: address of ethereum
func (*ProviderClient) Transfer ¶
func (cli *ProviderClient) Transfer(authCli *AuthClient, to string, amount *big.Int, data []byte, gasLimit uint64) (txHash string, err error)
transfer eth
func (*ProviderClient) WaitingTransactionStatus ¶
func (cli *ProviderClient) WaitingTransactionStatus(txHash string) (status bool, err error)
wait until transaction is completed
Click to show internal directories.
Click to hide internal directories.