Documentation ¶
Index ¶
- Variables
- func BuildSwapoutTxInput(swapoutVal *big.Int, bindAddr string) ([]byte, error)
- func InitExtCodeParts()
- func PackData(args ...interface{}) []byte
- func PackDataWithFuncHash(funcHash []byte, args ...interface{}) []byte
- type Bridge
- func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)
- func (b *Bridge) BuildSwapoutTx(from, contract string, extraArgs *tokens.EthExtraArgs, swapoutVal *big.Int, ...) (*types.Transaction, error)
- func (b *Bridge) CallContract(contract string, data hexutil.Bytes, blockNumber string) (string, error)
- func (b *Bridge) ChainID() (*big.Int, error)
- func (b *Bridge) DcrmSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signTx interface{}, txHash string, err error)
- func (b *Bridge) GetBlockByHash(blockHash string) (*types.RPCBlock, error)
- func (b *Bridge) GetBlockByNumber(number *big.Int) (*types.RPCBlock, error)
- func (b *Bridge) GetCode(contract string) ([]byte, error)
- func (b *Bridge) GetContractLogs(contractAddress, logTopic string, blockHeight uint64) ([]*types.RPCLog, error)
- func (b *Bridge) GetErc20Balance(contract, address string) (*big.Int, error)
- func (b *Bridge) GetErc20Decimals(contract string) (uint8, error)
- func (b *Bridge) GetLatestBlockNumber() (uint64, error)
- func (b *Bridge) GetLogs(filterQuery *types.FilterQuery) ([]*types.RPCLog, error)
- func (b *Bridge) GetPendingTransactions() ([]*types.RPCTransaction, error)
- func (b *Bridge) GetPoolNonce(address string) (uint64, error)
- func (b *Bridge) GetTransaction(txHash string) (interface{}, error)
- func (b *Bridge) GetTransactionByHash(txHash string) (*types.RPCTransaction, error)
- func (b *Bridge) GetTransactionReceipt(txHash string) (*types.RPCTxReceipt, error)
- func (b *Bridge) GetTransactionStatus(txHash string) *tokens.TxStatus
- func (b *Bridge) InitLatestBlockNumber()
- func (b *Bridge) IsValidAddress(address string) bool
- func (b *Bridge) SendSignedTransaction(tx *types.Transaction) error
- func (b *Bridge) SendTransaction(signedTx interface{}) (txHash string, err error)
- func (b *Bridge) SetTokenAndGateway(tokenCfg *tokens.TokenConfig, gatewayCfg *tokens.GatewayConfig)
- func (b *Bridge) StartChainTransactionScanJob()
- func (b *Bridge) StartPoolTransactionScanJob()
- func (b *Bridge) StartSwapHistoryScanJob()
- func (b *Bridge) SuggestPrice() (*big.Int, error)
- func (b *Bridge) VerifyChainID()
- func (b *Bridge) VerifyContractCode(contract string, codePartsSlice ...map[string][]byte) (err error)
- func (b *Bridge) VerifyErc20ContractAddress(contract string) (err error)
- func (b *Bridge) VerifyMbtcContractAddress(contract string) (err error)
- func (b *Bridge) VerifyMsgHash(rawTx interface{}, msgHashes []string, extra interface{}) error
- func (b *Bridge) VerifyTokenCofig()
- func (b *Bridge) VerifyTransaction(txHash string, allowUnstable bool) (*tokens.TxSwapInfo, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ExtCodeParts extended func hashes and log topics ExtCodeParts map[string][]byte )
Functions ¶
func BuildSwapoutTxInput ¶
BuildSwapoutTxInput build swapout tx input
func PackDataWithFuncHash ¶
PackDataWithFuncHash pack data with func hash
Types ¶
type Bridge ¶
type Bridge struct { *tokens.CrossChainBridgeBase Signer types.Signer }
Bridge eth bridge
func NewCrossChainBridge ¶
NewCrossChainBridge new bridge
func (*Bridge) BuildRawTransaction ¶
func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)
BuildRawTransaction build raw tx
func (*Bridge) BuildSwapoutTx ¶
func (b *Bridge) BuildSwapoutTx(from, contract string, extraArgs *tokens.EthExtraArgs, swapoutVal *big.Int, bindAddr string) (*types.Transaction, error)
BuildSwapoutTx build swapout tx
func (*Bridge) CallContract ¶
func (b *Bridge) CallContract(contract string, data hexutil.Bytes, blockNumber string) (string, error)
CallContract call eth_call
func (*Bridge) DcrmSignTransaction ¶
func (b *Bridge) DcrmSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signTx interface{}, txHash string, err error)
DcrmSignTransaction dcrm sign raw tx
func (*Bridge) GetBlockByHash ¶
GetBlockByHash call eth_getBlockByHash
func (*Bridge) GetBlockByNumber ¶
GetBlockByNumber call eth_getBlockByNumber
func (*Bridge) GetContractLogs ¶
func (b *Bridge) GetContractLogs(contractAddress, logTopic string, blockHeight uint64) ([]*types.RPCLog, error)
GetContractLogs get contract logs
func (*Bridge) GetErc20Balance ¶
GetErc20Balance get erc20 balacne of address
func (*Bridge) GetErc20Decimals ¶
GetErc20Decimals get erc20 decimals
func (*Bridge) GetLatestBlockNumber ¶
GetLatestBlockNumber call eth_blockNumber
func (*Bridge) GetPendingTransactions ¶
func (b *Bridge) GetPendingTransactions() ([]*types.RPCTransaction, error)
GetPendingTransactions call eth_pendingTransactions
func (*Bridge) GetPoolNonce ¶
GetPoolNonce call eth_getTransactionCount
func (*Bridge) GetTransaction ¶
GetTransaction impl
func (*Bridge) GetTransactionByHash ¶
func (b *Bridge) GetTransactionByHash(txHash string) (*types.RPCTransaction, error)
GetTransactionByHash call eth_getTransactionByHash
func (*Bridge) GetTransactionReceipt ¶
func (b *Bridge) GetTransactionReceipt(txHash string) (*types.RPCTxReceipt, error)
GetTransactionReceipt call eth_getTransactionReceipt
func (*Bridge) GetTransactionStatus ¶
GetTransactionStatus impl
func (*Bridge) InitLatestBlockNumber ¶
func (b *Bridge) InitLatestBlockNumber()
InitLatestBlockNumber init latest block number
func (*Bridge) IsValidAddress ¶
IsValidAddress check address
func (*Bridge) SendSignedTransaction ¶
func (b *Bridge) SendSignedTransaction(tx *types.Transaction) error
SendSignedTransaction call eth_sendRawTransaction
func (*Bridge) SendTransaction ¶
SendTransaction send signed tx
func (*Bridge) SetTokenAndGateway ¶
func (b *Bridge) SetTokenAndGateway(tokenCfg *tokens.TokenConfig, gatewayCfg *tokens.GatewayConfig)
SetTokenAndGateway set token and gateway config
func (*Bridge) StartChainTransactionScanJob ¶
func (b *Bridge) StartChainTransactionScanJob()
StartChainTransactionScanJob scan job
func (*Bridge) StartPoolTransactionScanJob ¶
func (b *Bridge) StartPoolTransactionScanJob()
StartPoolTransactionScanJob scan job
func (*Bridge) StartSwapHistoryScanJob ¶
func (b *Bridge) StartSwapHistoryScanJob()
StartSwapHistoryScanJob scan job
func (*Bridge) SuggestPrice ¶
SuggestPrice call eth_gasPrice
func (*Bridge) VerifyContractCode ¶
func (b *Bridge) VerifyContractCode(contract string, codePartsSlice ...map[string][]byte) (err error)
VerifyContractCode verify contract code
func (*Bridge) VerifyErc20ContractAddress ¶
VerifyErc20ContractAddress verify erc20 contract
func (*Bridge) VerifyMbtcContractAddress ¶
VerifyMbtcContractAddress verify mbtc contract
func (*Bridge) VerifyMsgHash ¶
VerifyMsgHash verify msg hash
func (*Bridge) VerifyTokenCofig ¶
func (b *Bridge) VerifyTokenCofig()
VerifyTokenCofig verify token config
func (*Bridge) VerifyTransaction ¶
VerifyTransaction impl