Documentation ¶
Overview ¶
Moved here because transactions package depends on accounts package which depends on appdatabase where this functionality is needed
Index ¶
- Constants
- Variables
- func GetEventSignatureHash(signature string) common.Hash
- func GetLogSubTxID(log types.Log) common.Hash
- func IsTokenTransfer(logs []*types.Log) bool
- func NetworksToChainIDs(networks []*params.Network) []uint64
- func NewAndSet[T any](v T) *T
- func ParseErc1155TransferLog(ethlog *types.Log, evType EventType) (operator, from, to common.Address, ids, amounts []*big.Int, err error)
- func ParseErc20TransferLog(ethlog *types.Log) (from, to common.Address, amount *big.Int)
- func ParseErc721TransferLog(ethlog *types.Log) (from, to common.Address, tokenID *big.Int)
- func ParseHopBridgeTransferFromL1CompletedLog(ethlog *types.Log) (recipient common.Address, relayer common.Address, amount *big.Int, err error)
- func ParseHopBridgeTransferSentLog(ethlog *types.Log) (transferID *big.Int, chainID uint64, recipient common.Address, amount *big.Int, ...)
- func ParseHopBridgeTransferSentToL2Log(ethlog *types.Log) (chainID uint64, recipient common.Address, relayer common.Address, ...)
- func ParseHopWithdrawalBondedLog(ethlog *types.Log) (transferID *big.Int, amount *big.Int, err error)
- func ParseTransferLog(ethlog types.Log) (from, to common.Address, txIDs []common.Hash, tokenIDs, values []*big.Int, ...)
- func ParseUniswapV2Log(ethlog *types.Log) (pairAddress common.Address, from common.Address, to common.Address, ...)
- func ParseUniswapV3Log(ethlog *types.Log) (poolAddress common.Address, sender common.Address, recipient common.Address, ...)
- func ParseWETHDepositLog(ethlog *types.Log) (src common.Address, amount *big.Int)
- func ParseWETHWithdrawLog(ethlog *types.Log) (dst common.Address, amount *big.Int)
- func ShouldCancel(ctx context.Context) bool
- func TxDataContainsAddress(txType uint8, txData []byte, address common.Address) bool
- type ChainID
- type ContractType
- type EventType
- type MultiTransactionIDType
- type Type
Constants ¶
View Source
const ( UnknownChainID uint64 = 0 EthereumMainnet uint64 = 1 EthereumGoerli uint64 = 5 EthereumSepolia uint64 = 11155111 OptimismMainnet uint64 = 10 OptimismGoerli uint64 = 420 OptimismSepolia uint64 = 11155420 ArbitrumMainnet uint64 = 42161 ArbitrumGoerli uint64 = 421613 ArbitrumSepolia uint64 = 421614 BinanceChainID uint64 = 56 // obsolete? BinanceTestChainID uint64 = 97 // obsolete? )
View Source
const ( // Transaction types EthTransfer Type = "eth" Erc20Transfer Type = "erc20" Erc721Transfer Type = "erc721" Erc1155Transfer Type = "erc1155" UniswapV2Swap Type = "uniswapV2Swap" UniswapV3Swap Type = "uniswapV3Swap" HopBridgeFrom Type = "HopBridgeFrom" HopBridgeTo Type = "HopBridgeTo" // Event types WETHDepositEventType EventType = "wethDepositEvent" WETHWithdrawalEventType EventType = "wethWithdrawalEvent" Erc20TransferEventType EventType = "erc20Event" Erc721TransferEventType EventType = "erc721Event" Erc1155TransferSingleEventType EventType = "erc1155SingleEvent" Erc1155TransferBatchEventType EventType = "erc1155BatchEvent" UniswapV2SwapEventType EventType = "uniswapV2SwapEvent" UniswapV3SwapEventType EventType = "uniswapV3SwapEvent" HopBridgeTransferSentToL2EventType EventType = "hopBridgeTransferSentToL2Event" HopBridgeTransferFromL1CompletedEventType EventType = "hopBridgeTransferFromL1CompletedEvent" HopBridgeWithdrawalBondedEventType EventType = "hopBridgeWithdrawalBondedEvent" HopBridgeTransferSentEventType EventType = "hopBridgeTransferSentEvent" UnknownEventType EventType = "unknownEvent" // Transfer (index_topic_1 address from, index_topic_2 address to, uint256 value) // Transfer (index_topic_1 address from, index_topic_2 address to, index_topic_3 uint256 tokenId) Erc20_721TransferEventSignature = "Transfer(address,address,uint256)" Erc1155TransferSingleEventSignature = "TransferSingle(address,address,address,uint256,uint256)" // operator, from, to, id, value Erc1155TransferBatchEventSignature = "TransferBatch(address,address,address,uint256[],uint256[])" // operator, from, to, ids, values // TransferFromL1Completed (index_topic_1 address recipient, uint256 amount, uint256 amountOutMin, uint256 deadline, index_topic_2 address relayer, uint256 relayerFee) HopBridgeTransferFromL1CompletedEventSignature = "TransferFromL1Completed(address,uint256,uint256,uint256,address,uint256)" )
View Source
const (
NoMultiTransactionID = MultiTransactionIDType(0)
)
Variables ¶
View Source
var AverageBlockDurationForChain = map[ChainID]time.Duration{ ChainID(UnknownChainID): time.Duration(12000) * time.Millisecond, ChainID(EthereumMainnet): time.Duration(12000) * time.Millisecond, ChainID(EthereumGoerli): time.Duration(12000) * time.Millisecond, ChainID(OptimismMainnet): time.Duration(400) * time.Millisecond, ChainID(OptimismGoerli): time.Duration(2000) * time.Millisecond, ChainID(ArbitrumMainnet): time.Duration(300) * time.Millisecond, ChainID(ArbitrumGoerli): time.Duration(1500) * time.Millisecond, }
View Source
var ( // MaxUint256 is the maximum value that can be represented by a uint256. MaxUint256 = new(big.Int).Sub(new(big.Int).Lsh(common.Big1, 256), common.Big1) )
View Source
var (
ZeroAddress = ethCommon.HexToAddress("0x0000000000000000000000000000000000000000")
)
Functions ¶
func GetEventSignatureHash ¶ added in v0.157.2
func IsTokenTransfer ¶ added in v0.157.2
func NetworksToChainIDs ¶ added in v0.180.31
func ParseErc1155TransferLog ¶ added in v0.171.21
func ParseErc20TransferLog ¶ added in v0.157.2
func ParseErc721TransferLog ¶ added in v0.157.2
func ParseHopBridgeTransferFromL1CompletedLog ¶ added in v0.161.4
func ParseHopBridgeTransferSentLog ¶ added in v0.161.4
func ParseHopBridgeTransferSentToL2Log ¶ added in v0.161.4
func ParseHopWithdrawalBondedLog ¶ added in v0.161.4
func ParseTransferLog ¶ added in v0.171.21
func ParseUniswapV2Log ¶ added in v0.157.2
func ParseUniswapV3Log ¶ added in v0.157.2
func ParseWETHDepositLog ¶ added in v0.159.5
func ParseWETHWithdrawLog ¶ added in v0.159.5
func ShouldCancel ¶ added in v0.171.21
ShouldCancel returns true if the context has been cancelled and task should be aborted
Types ¶
type ChainID ¶
type ChainID uint64
func AllChainIDs ¶ added in v0.167.5
func AllChainIDs() []ChainID
type ContractType ¶ added in v0.174.0
type ContractType byte
const ( ContractTypeUnknown ContractType = iota ContractTypeERC20 ContractTypeERC721 ContractTypeERC1155 )
type EventType ¶ added in v0.157.2
type EventType string
Log Event type
func GetEventType ¶ added in v0.157.2
Detect event type for a cetain item from the Events Log
type MultiTransactionIDType ¶ added in v0.176.10
type MultiTransactionIDType int64
type Type ¶ added in v0.157.2
type Type string
Type type of transaction
func EventTypeToSubtransactionType ¶ added in v0.157.2
Click to show internal directories.
Click to hide internal directories.