Documentation ¶
Index ¶
- Constants
- func Sign(private *ecdsa.PrivateKey, hash []byte) ([]byte, error)
- func SignTx(tx *web3.Transaction, private *ecdsa.PrivateKey, chainID uint64) (*web3.Transaction, error)
- type AddressEncoder
- type Client
- func (c *Client) BalanceOf(address string, optionAsset *client.OptionAsset) (amount *big.Int, err error)
- func (c *Client) EstimateGas(tx tx.Tx) (feeRes *fee.OptionFee, err error)
- func (c *Client) GetAccount() string
- func (c *Client) GetChainID() (string, error)
- func (c *Client) QueryContract(req client.CallContractParam) (res *client.CallContractRes, err error)
- func (c *Client) QueryTx(txHash string, isWait bool) (txData *tx.TxData, err error)
- func (c *Client) SendSignedTx(signedTx tx.Tx) (txHash string, err error)
- func (c *Client) SendTx(tx tx.Tx, feeOption *fee.OptionFee) (txHash string, err error)
- func (c *Client) SetPrivate(hexPrivate string) (err error)
- func (c *Client) SetProvider(provider provider.CommonProvider) (err error)
- func (c *Client) Transfer(to string, amount *big.Int, optionAsset *client.OptionAsset, ...) (txHash string, err error)
- type Contract
- func (c *Contract) Call(method string, block web3.BlockNumber, args ...interface{}) (string, map[string]interface{}, error)
- func (c *Contract) EstimateGas(method string, args ...interface{}) (uint64, error)
- func (c *Contract) Event(name string) (*Event, bool)
- func (c *Contract) GetAddr() web3.Address
- func (c *Contract) SetFrom(addr web3.Address)
- func (c *Contract) Txn(method string, args ...interface{}) *Txn
- type ContractTxBuilder
- type Event
- type TxBuilder
- type Txn
- func (t *Txn) AddArgs(args ...interface{}) *Txn
- func (t *Txn) EncodeTx() (txEncoded string, err error)
- func (t *Txn) EstimateGas() (uint64, error)
- func (t *Txn) GetFee() *fee.OptionFee
- func (t *Txn) GetFrom() string
- func (t *Txn) GetHash() string
- func (t *Txn) GetNonce() uint64
- func (t *Txn) GetPayload() []byte
- func (t *Txn) GetReceipt() *web3.Receipt
- func (t *Txn) GetTo() string
- func (t *Txn) GetTxHash(chainID string) (string, error)
- func (t *Txn) GetValue() *big.Int
- func (t *Txn) InjectSignature(hexSignature string, chainID string) (err error)
- func (t *Txn) SetFee(fee *fee.OptionFee)
- func (t *Txn) SetGasLimit(gasLimit uint64) *Txn
- func (t *Txn) SetGasPrice(gasPrice uint64) *Txn
- func (t *Txn) SetValue(v *big.Int) *Txn
- func (t *Txn) SignHash(privateHex string, chainID string, hexHash string) (hexSignature string, err error)
- func (t *Txn) SignTx(privateHex string, chainID string) error
- func (t *Txn) Validate() error
- func (t *Txn) Wait() error
Constants ¶
View Source
const (
DefaultAddress = "0x3F43E75Aaba2c2fD6E227C10C6E7DC125A93DE3c"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddressEncoder ¶
type AddressEncoder struct { }
func NewAddressEncoder ¶
func NewAddressEncoder() *AddressEncoder
func (*AddressEncoder) AddressToHex ¶
func (a *AddressEncoder) AddressToHex(addr address.Address) string
func (*AddressEncoder) HexToAddress ¶
func (a *AddressEncoder) HexToAddress(addr string) address.Address
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) EstimateGas ¶
func (*Client) GetAccount ¶
func (*Client) GetChainID ¶
func (*Client) QueryContract ¶
func (c *Client) QueryContract(req client.CallContractParam) (res *client.CallContractRes, err error)
func (*Client) SendSignedTx ¶
func (*Client) SetPrivate ¶
func (*Client) SetProvider ¶
func (c *Client) SetProvider(provider provider.CommonProvider) (err error)
type Contract ¶
Contract is an Ethereum contract
func NewContract ¶
NewContract creates a new contract instance
func (*Contract) Call ¶
func (c *Contract) Call(method string, block web3.BlockNumber, args ...interface{}) (string, map[string]interface{}, error)
Call calls a method in the contract
func (*Contract) EstimateGas ¶
EstimateGas estimates the gas for a contract call
func (*Contract) GetAddr ¶
func (c *Contract) GetAddr() web3.Address
Addr returns the address of the contract
type ContractTxBuilder ¶
type ContractTxBuilder struct {
// contains filtered or unexported fields
}
func NewContractTxBuilder ¶
func NewContractTxBuilder(provider provider.CommonProvider) (*ContractTxBuilder, error)
func (*ContractTxBuilder) BuildDeployTx ¶
func (b *ContractTxBuilder) BuildDeployTx(req txbuilder.BuildDeployTxReq) (tx.Tx, error)
构建部署合约的交易
func (*ContractTxBuilder) BuildInvokeTx ¶
func (b *ContractTxBuilder) BuildInvokeTx(req txbuilder.BuildInvokeTxReq) (tx.Tx, error)
构建调用合约的交易
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event is a solidity event
type TxBuilder ¶
type TxBuilder struct {
// contains filtered or unexported fields
}
func NewTxBuilder ¶
func NewTxBuilder(provider provider.CommonProvider) (*TxBuilder, error)
type Txn ¶
type Txn struct { Private *ecdsa.PrivateKey `json:"private"` From web3.Address `json:"from"` Nonce uint64 `json:"nonce"` Addr *web3.Address `json:"to"` Value *big.Int `json:"value"` GasPrice uint64 `json:"gasPrice"` GasLimit uint64 `json:"gas"` Data []byte `json:"input"` Provider *jsonrpc.Client `json:"provider"` Method *abi.Method `json:"method"` Args []interface{} `json:"args"` Bin []byte `json:"bin"` SignedHash []byte `json:"signedHash"` SignedTx []byte `json:"signedTx"` Hash web3.Hash `json:"hash"` Receipt *web3.Receipt `json:"receipt"` }
func (*Txn) EstimateGas ¶
EstimateGas estimates the gas for the call
func (*Txn) GetPayload ¶
func (*Txn) GetReceipt ¶
func (t *Txn) GetReceipt() *web3.Receipt
Receipt returns the receipt of the transaction after wait
func (*Txn) InjectSignature ¶
func (*Txn) SetGasLimit ¶
SetGasLimit sets the gas limit of the transaction
func (*Txn) SetGasPrice ¶
SetGasPrice sets the gas price of the transaction
Click to show internal directories.
Click to hide internal directories.