Documentation ¶
Index ¶
- Constants
- Variables
- func CalcEthFee(gasPrice *big.Int, gas int64) int64
- func DeployContract(opts *bind.TransactOpts, backend bind.ContractBackend, jsonAbi string, ...) (common.Address, *types.Transaction, error)
- func EstimateContractMethodGas(param TransactBaseParam, backend bind.ContractBackend, ...) (int64, error)
- func GweiToWei(v int64) *big.Int
- func HexToAddress(addr string) (common.Address, error)
- func HexToHash(s string) common.Hash
- func MakeTransactOpts(w *wallet.EthWallet, param TransactBaseParam, gasLimit int64, nonce int64) (*bind.TransactOpts, error)
- func SerializeTransaction(tx *types.Transaction) (string, error)
- func SignTx(w *wallet.EthWallet, tx *types.Transaction) (*types.Transaction, error)
- func TransferEther(opts *bind.TransactOpts, backend bind.ContractBackend, ...) (*types.Transaction, error)
- func WeiToGwei(v *big.Int) int64
- type Erc20Contract
- func (this *Erc20Contract) Allowance(tokenOwner common.Address, spender common.Address) (*big.Int, error)
- func (this *Erc20Contract) Approve(opts *bind.TransactOpts, spender common.Address, tokens *big.Int) (*types.Transaction, error)
- func (this *Erc20Contract) BalanceOf(tokenOwner common.Address) (*big.Int, error)
- func (this *Erc20Contract) Decimals() (int, error)
- func (this *Erc20Contract) EstimateApproveGas(param TransactBaseParam, spender common.Address, tokens *big.Int) (int64, error)
- func (this *Erc20Contract) EstimateTransferFromGas(param TransactBaseParam, from common.Address, to common.Address, ...) (int64, error)
- func (this *Erc20Contract) EstimateTransferGas(param TransactBaseParam, to common.Address, tokens *big.Int) (int64, error)
- func (this *Erc20Contract) Name() (string, error)
- func (this *Erc20Contract) Symbol() (string, error)
- func (this *Erc20Contract) TotalSupply() (*big.Int, error)
- func (this *Erc20Contract) Transfer(opts *bind.TransactOpts, to common.Address, tokens *big.Int) (*types.Transaction, error)
- func (this *Erc20Contract) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, ...) (*types.Transaction, error)
- type Erc20Meta
- type Erc721Contract
- func (this *Erc721Contract) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error)
- func (this *Erc721Contract) BalanceOf(owner common.Address) (*big.Int, error)
- func (this *Erc721Contract) EstimateApproveGas(param TransactBaseParam, to common.Address, tokenId *big.Int) (int64, error)
- func (this *Erc721Contract) EstimateSafeTransferFrom2Gas(param TransactBaseParam, from common.Address, to common.Address, ...) (int64, error)
- func (this *Erc721Contract) EstimateSafeTransferFromGas(param TransactBaseParam, from common.Address, to common.Address, ...) (int64, error)
- func (this *Erc721Contract) EstimateSetApprovalForAllGas(param TransactBaseParam, operator common.Address, approved bool) (int64, error)
- func (this *Erc721Contract) EstimateTransferFromGas(param TransactBaseParam, from common.Address, to common.Address, ...) (int64, error)
- func (this *Erc721Contract) GetApproved(tokenId *big.Int) (common.Address, error)
- func (this *Erc721Contract) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error)
- func (this *Erc721Contract) Name() (string, error)
- func (this *Erc721Contract) OwnerOf(tokenId *big.Int) (common.Address, error)
- func (this *Erc721Contract) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, ...) (*types.Transaction, error)
- func (this *Erc721Contract) SafeTransferFrom2(opts *bind.TransactOpts, from common.Address, to common.Address, ...) (*types.Transaction, error)
- func (this *Erc721Contract) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, approved bool) (*types.Transaction, error)
- func (this *Erc721Contract) SupportsInterface(interfaceId [4]byte) (bool, error)
- func (this *Erc721Contract) Symbol() (string, error)
- func (this *Erc721Contract) TokenByIndex(index *big.Int) (*big.Int, error)
- func (this *Erc721Contract) TokenOfOwnerByIndex(owner common.Address, index *big.Int) (*big.Int, error)
- func (this *Erc721Contract) TokenURI(tokenId *big.Int) (string, error)
- func (this *Erc721Contract) TotalSupply() (*big.Int, error)
- func (this *Erc721Contract) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, ...) (*types.Transaction, error)
- type EthClient
- func (this *EthClient) GetTransactionCountByNumber(ctx context.Context, blockNumber int64) (uint, error)
- func (this *EthClient) SendRawTransaction(ctx context.Context, signedHex string) (string, error)
- func (this *EthClient) SetHeader(key, value string)
- func (this *EthClient) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, from *common.Address, blockNumber *big.Int, err error)
- type TransactBaseParam
- type TransferEvent
Constants ¶
View Source
const ( TokenTypeErc20 = 1 TokenTypeErc721 = 2 )
View Source
const ERC20InterfaceABI = `` /* 2439-byte string literal not displayed */
View Source
const ERC721InterfaceABI = `` /* 4364-byte string literal not displayed */
Variables ¶
View Source
var BigIntEthGWei = big.NewInt(1e9)
Functions ¶
func DeployContract ¶
func DeployContract(opts *bind.TransactOpts, backend bind.ContractBackend, jsonAbi string, bytecode string, params ...interface{}) (common.Address, *types.Transaction, error)
func EstimateContractMethodGas ¶
func EstimateContractMethodGas(param TransactBaseParam, backend bind.ContractBackend, contractAddress common.Address, input []byte) (int64, error)
func MakeTransactOpts ¶
func MakeTransactOpts(w *wallet.EthWallet, param TransactBaseParam, gasLimit int64, nonce int64) (*bind.TransactOpts, error)
func SerializeTransaction ¶
func SerializeTransaction(tx *types.Transaction) (string, error)
func SignTx ¶
func SignTx(w *wallet.EthWallet, tx *types.Transaction) (*types.Transaction, error)
func TransferEther ¶
func TransferEther(opts *bind.TransactOpts, backend bind.ContractBackend, addressTo common.Address) (*types.Transaction, error)
Types ¶
type Erc20Contract ¶
type Erc20Contract struct {
// contains filtered or unexported fields
}
Erc20Contract tool for contract abi
func NewErc20Contract ¶
func NewErc20Contract(address common.Address, backend bind.ContractBackend) *Erc20Contract
func (*Erc20Contract) Approve ¶
func (this *Erc20Contract) Approve(opts *bind.TransactOpts, spender common.Address, tokens *big.Int) (*types.Transaction, error)
func (*Erc20Contract) Decimals ¶
func (this *Erc20Contract) Decimals() (int, error)
func (*Erc20Contract) EstimateApproveGas ¶
func (this *Erc20Contract) EstimateApproveGas(param TransactBaseParam, spender common.Address, tokens *big.Int) (int64, error)
func (*Erc20Contract) EstimateTransferFromGas ¶
func (this *Erc20Contract) EstimateTransferFromGas(param TransactBaseParam, from common.Address, to common.Address, tokens *big.Int) (int64, error)
func (*Erc20Contract) EstimateTransferGas ¶
func (this *Erc20Contract) EstimateTransferGas(param TransactBaseParam, to common.Address, tokens *big.Int) (int64, error)
func (*Erc20Contract) Name ¶
func (this *Erc20Contract) Name() (string, error)
func (*Erc20Contract) Symbol ¶
func (this *Erc20Contract) Symbol() (string, error)
func (*Erc20Contract) TotalSupply ¶
func (this *Erc20Contract) TotalSupply() (*big.Int, error)
func (*Erc20Contract) Transfer ¶
func (this *Erc20Contract) Transfer(opts *bind.TransactOpts, to common.Address, tokens *big.Int) (*types.Transaction, error)
func (*Erc20Contract) TransferFrom ¶
func (this *Erc20Contract) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokens *big.Int) (*types.Transaction, error)
type Erc721Contract ¶
type Erc721Contract struct {
// contains filtered or unexported fields
}
Erc721Contract tool for contract abi
func NewErc721Contract ¶
func NewErc721Contract(address common.Address, backend bind.ContractBackend) *Erc721Contract
func (*Erc721Contract) Approve ¶
func (this *Erc721Contract) Approve(opts *bind.TransactOpts, to common.Address, tokenId *big.Int) (*types.Transaction, error)
func (*Erc721Contract) EstimateApproveGas ¶
func (this *Erc721Contract) EstimateApproveGas(param TransactBaseParam, to common.Address, tokenId *big.Int) (int64, error)
func (*Erc721Contract) EstimateSafeTransferFrom2Gas ¶
func (*Erc721Contract) EstimateSafeTransferFromGas ¶
func (this *Erc721Contract) EstimateSafeTransferFromGas(param TransactBaseParam, from common.Address, to common.Address, tokenId *big.Int) (int64, error)
EstimateGas
func (*Erc721Contract) EstimateSetApprovalForAllGas ¶
func (this *Erc721Contract) EstimateSetApprovalForAllGas(param TransactBaseParam, operator common.Address, approved bool) (int64, error)
func (*Erc721Contract) EstimateTransferFromGas ¶
func (this *Erc721Contract) EstimateTransferFromGas(param TransactBaseParam, from common.Address, to common.Address, tokenId *big.Int) (int64, error)
func (*Erc721Contract) GetApproved ¶
func (*Erc721Contract) IsApprovedForAll ¶
func (*Erc721Contract) SafeTransferFrom ¶
func (this *Erc721Contract) SafeTransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error)
func (*Erc721Contract) SafeTransferFrom2 ¶
func (this *Erc721Contract) SafeTransferFrom2(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int, data []byte) (*types.Transaction, error)
func (*Erc721Contract) SetApprovalForAll ¶
func (this *Erc721Contract) SetApprovalForAll(opts *bind.TransactOpts, operator common.Address, approved bool) (*types.Transaction, error)
func (*Erc721Contract) SupportsInterface ¶
func (this *Erc721Contract) SupportsInterface(interfaceId [4]byte) (bool, error)
IERC165
func (*Erc721Contract) Symbol ¶
func (this *Erc721Contract) Symbol() (string, error)
func (*Erc721Contract) TokenByIndex ¶
func (*Erc721Contract) TokenOfOwnerByIndex ¶
func (*Erc721Contract) TokenURI ¶
func (this *Erc721Contract) TokenURI(tokenId *big.Int) (string, error)
func (*Erc721Contract) TotalSupply ¶
func (this *Erc721Contract) TotalSupply() (*big.Int, error)
IERC721Enumerable
func (*Erc721Contract) TransferFrom ¶
func (this *Erc721Contract) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, tokenId *big.Int) (*types.Transaction, error)
type EthClient ¶
func NewEthClient ¶
func (*EthClient) GetTransactionCountByNumber ¶
func (*EthClient) SendRawTransaction ¶
type TransactBaseParam ¶
type TransactBaseParam struct { From common.Address EthValue *big.Int GasPrice *big.Int GasFeeCap *big.Int GasTipCap *big.Int BaseFee *big.Int }
func (*TransactBaseParam) EnsureGasPrice ¶
func (this *TransactBaseParam) EnsureGasPrice(backend bind.ContractBackend) error
func (*TransactBaseParam) GetGasPrice ¶
func (this *TransactBaseParam) GetGasPrice() *big.Int
Click to show internal directories.
Click to hide internal directories.