Documentation
¶
Index ¶
- Constants
- Variables
- func InsertTestPendingTransaction(t *testing.T, db *sql.DB, tr *TestTransfer)
- func InsertTestTransfer(t *testing.T, db *sql.DB, address eth_common.Address, tr *TestTransfer)
- func InsertTestTransferWithOptions(t *testing.T, db *sql.DB, address eth_common.Address, tr *TestTransfer, ...)
- func SeedToToken(seed int) *token.Token
- func TestTrToToken(t *testing.T, tt *TestTransaction) (token *token.Token, isNative bool)
- type BalanceCache
- type BalanceReader
- type BatchDownloader
- type Block
- type BlockDAO
- func (b *BlockDAO) GetBlocksToLoadByAddress(chainID uint64, address common.Address, limit int) (rst []*big.Int, err error)
- func (b *BlockDAO) GetFirstKnownBlock(chainID uint64, address common.Address) (rst *big.Int, err error)
- func (b *BlockDAO) GetFirstSavedBlock(chainID uint64, address common.Address) (rst *DBHeader, err error)
- func (b *BlockDAO) GetLastBlockByAddress(chainID uint64, address common.Address, limit int) (rst *big.Int, err error)
- func (b *BlockDAO) GetLastKnownBlockByAddress(chainID uint64, address common.Address) (block *Block, err error)
- func (b *BlockDAO) GetLastKnownBlockByAddresses(chainID uint64, addresses []common.Address) (map[common.Address]*Block, []common.Address, error)
- type BlockRange
- type BlockRangeSequentialDAO
- type BlockView
- type BlocksRange
- type ConcurrentDownloader
- type Controller
- func (c *Controller) CheckRecentHistory(chainIDs []uint64, accounts []common.Address) error
- func (c *Controller) GetCachedBalances(ctx context.Context, chainID uint64, addresses []common.Address) ([]BlockView, error)
- func (c *Controller) GetTransfersByAddress(ctx context.Context, chainID uint64, address common.Address, toBlock *big.Int, ...) ([]View, error)
- func (c *Controller) GetTransfersForIdentities(ctx context.Context, identities []TransactionIdentity) ([]View, error)
- func (c *Controller) LoadTransferByHash(ctx context.Context, rpcClient *rpc.Client, address common.Address, ...) error
- func (c *Controller) SetInitialBlocksRange(chainIDs []uint64) error
- func (c *Controller) Start()
- func (c *Controller) Stop()
- type DBHeader
- type Database
- func (db *Database) Close() error
- func (db *Database) GetTransactionsToLoad(chainID uint64, address common.Address, blockNumber *big.Int) (rst []PreloadedTransaction, err error)
- func (db *Database) GetTransfers(chainID uint64, start, end *big.Int) (rst []Transfer, err error)
- func (db *Database) GetTransfersByAddress(chainID uint64, address common.Address, toBlock *big.Int, limit int64) (rst []Transfer, err error)
- func (db *Database) GetTransfersByAddressAndBlock(chainID uint64, address common.Address, block *big.Int, limit int64) (rst []Transfer, err error)
- func (db *Database) GetTransfersForIdentities(ctx context.Context, identities []TransactionIdentity) (rst []Transfer, err error)
- func (db *Database) GetTransfersInRange(chainID uint64, address common.Address, start, end *big.Int) (rst []Transfer, err error)
- func (db *Database) InsertBlock(chainID uint64, account common.Address, blockNumber *big.Int, ...) error
- func (db *Database) ProcessBlocks(chainID uint64, account common.Address, from *big.Int, to *Block, ...) (err error)
- func (db *Database) ProcessTransfers(chainID uint64, transfers []Transfer, removed []*DBHeader) (err error)
- func (db *Database) SaveBlocks(chainID uint64, account common.Address, headers []*DBHeader) (err error)
- func (db *Database) SaveTransfers(chainID uint64, address common.Address, transfers []Transfer) (err error)
- func (db *Database) SaveTransfersMarkBlocksLoaded(chainID uint64, address common.Address, transfers []Transfer, ...) (err error)
- type Downloader
- type ERC20TransfersDownloader
- type ETHDownloader
- type FetchStrategyType
- type HeaderReader
- type HistoryFetcher
- type IterativeDownloader
- type JSONBlob
- type MultiTransaction
- type MultiTransactionCommand
- type MultiTransactionCommandResult
- type MultiTransactionIDType
- type MultiTransactionType
- type OnDemandFetchStrategy
- type PendingTransaction
- type PendingTrxType
- type PreloadedTransaction
- type Reactor
- type Result
- type SeparatorType
- type SequentialFetchStrategy
- type SyncOption
- type TestMultiTransaction
- type TestTransaction
- type TestTransfer
- type TestTransferOptions
- type Transaction
- type TransactionIdentity
- type TransactionManager
- func (tm *TransactionManager) AddPending(transaction PendingTransaction) error
- func (tm *TransactionManager) CreateMultiTransactionFromCommand(ctx context.Context, command *MultiTransactionCommand, ...) (*MultiTransactionCommandResult, error)
- func (tm *TransactionManager) DeletePending(chainID uint64, hash common.Hash) error
- func (tm *TransactionManager) GetAllPending(chainIDs []uint64) ([]*PendingTransaction, error)
- func (tm *TransactionManager) GetBridgeDestinationMultiTransaction(ctx context.Context, toChainID uint64, crossTxID string) (*MultiTransaction, error)
- func (tm *TransactionManager) GetBridgeOriginMultiTransaction(ctx context.Context, toChainID uint64, crossTxID string) (*MultiTransaction, error)
- func (tm *TransactionManager) GetMultiTransactions(ctx context.Context, ids []MultiTransactionIDType) ([]*MultiTransaction, error)
- func (tm *TransactionManager) GetPendingByAddress(chainIDs []uint64, address common.Address) ([]*PendingTransaction, error)
- func (tm *TransactionManager) GetPendingEntry(chainID uint64, hash common.Hash) (*PendingTransaction, error)
- func (tm *TransactionManager) InsertMultiTransaction(multiTransaction *MultiTransaction) (MultiTransactionIDType, error)
- func (tm *TransactionManager) UpdateMultiTransaction(multiTransaction *MultiTransaction) error
- func (tm *TransactionManager) Watch(ctx context.Context, transactionHash common.Hash, ...) error
- type Transfer
- type View
Constants ¶
const ( // EventNewTransfers emitted when new block was added to the same canonical chan. EventNewTransfers walletevent.EventType = "new-transfers" // EventFetchingRecentHistory emitted when fetching of lastest tx history is started EventFetchingRecentHistory walletevent.EventType = "recent-history-fetching" // EventRecentHistoryReady emitted when fetching of lastest tx history is started EventRecentHistoryReady walletevent.EventType = "recent-history-ready" // EventFetchingHistoryError emitted when fetching of tx history failed EventFetchingHistoryError walletevent.EventType = "fetching-history-error" // EventNonArchivalNodeDetected emitted when a connection to a non archival node is detected EventNonArchivalNodeDetected walletevent.EventType = "non-archival-node-detected" )
const ( NoThreadLimit uint32 = 0 SequentialThreadLimit uint32 = 10 )
const ( ReactorNotStarted string = "reactor not started" NonArchivalNodeBlockChunkSize = 100 DefaultNodeBlockChunkSize = 100000 )
const ( MultiTransactionSend = iota MultiTransactionSwap MultiTransactionBridge )
const ETHSymbol string = "ETH"
const ( // PendingTransactionUpdate is emitted when a pending transaction is updated (added or deleted) EventPendingTransactionUpdate walletevent.EventType = "pending-transaction-update" )
const (
NoMultiTransactionID = MultiTransactionIDType(0)
)
const WETHSymbol string = "WETH"
Variables ¶
var DaiGoerli = token.Token{ Address: eth_common.HexToAddress("0xf2edF1c091f683E3fb452497d9a98A49cBA84666"), Name: "DAI Stablecoin", Symbol: "DAI", ChainID: 5, }
var DaiMainnet = token.Token{ Address: eth_common.HexToAddress("0xf2edF1c091f683E3fb452497d9a98A49cBA84666"), Name: "DAI Stablecoin", Symbol: "DAI", ChainID: 5, }
var EthGoerli = token.Token{ Address: eth_common.HexToAddress("0x"), Name: "Ether", Symbol: "ETH", ChainID: 5, }
var EthMainnet = token.Token{ Address: eth_common.HexToAddress("0x"), Name: "Ether", Symbol: "ETH", ChainID: 1, }
var EthOptimism = token.Token{ Address: eth_common.HexToAddress("0x"), Name: "Ether", Symbol: "ETH", ChainID: 10, }
var NativeTokenIndices = []int{0, 1, 2}
var SntMainnet = token.Token{ Address: eth_common.HexToAddress("0x744d70fdbe2ba4cf95131626614a1763df805b9e"), Name: "Status Network Token", Symbol: "SNT", ChainID: 1, }
var TestTokens = []*token.Token{ &EthMainnet, &EthGoerli, &EthOptimism, &UsdcMainnet, &UsdcGoerli, &UsdcOptimism, &SntMainnet, &DaiMainnet, &DaiGoerli, }
TestTokens contains ETH/Mainnet, ETH/Goerli, ETH/Optimism, USDC/Mainnet, USDC/Goerli, USDC/Optimism, SNT/Mainnet, DAI/Mainnet, DAI/Goerli
var UsdcGoerli = token.Token{ Address: eth_common.HexToAddress("0x98339d8c260052b7ad81c28c16c0b98420f2b46a"), Name: "USD Coin", Symbol: "USDC", ChainID: 5, }
var UsdcMainnet = token.Token{ Address: eth_common.HexToAddress("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"), Name: "USD Coin", Symbol: "USDC", ChainID: 1, }
var UsdcOptimism = token.Token{ Address: eth_common.HexToAddress("0x7f5c764cbc14f9669b88837ca1490cca17c31607"), Name: "USD Coin", Symbol: "USDC", ChainID: 10, }
Functions ¶
func InsertTestPendingTransaction ¶ added in v0.152.2
func InsertTestPendingTransaction(t *testing.T, db *sql.DB, tr *TestTransfer)
func InsertTestTransfer ¶ added in v0.151.4
func InsertTestTransfer(t *testing.T, db *sql.DB, address eth_common.Address, tr *TestTransfer)
func InsertTestTransferWithOptions ¶ added in v0.159.10
func InsertTestTransferWithOptions(t *testing.T, db *sql.DB, address eth_common.Address, tr *TestTransfer, opt *TestTransferOptions)
func SeedToToken ¶ added in v0.159.2
func TestTrToToken ¶ added in v0.159.2
Types ¶
type BalanceCache ¶
type BalanceReader ¶
type BalanceReader interface { BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) FullTransactionByBlockNumberAndIndex(ctx context.Context, blockNumber *big.Int, index uint) (*chain.FullTransaction, error) }
BalanceReader interface for reading balance at a specifeid address.
type BatchDownloader ¶
type BatchDownloader interface {
GetHeadersInRange(ctx context.Context, from, to *big.Int) ([]*DBHeader, error)
}
BatchDownloader interface for loading transfers in batches in speificed range of blocks.
type BlockDAO ¶ added in v0.148.4
type BlockDAO struct {
// contains filtered or unexported fields
}
func (*BlockDAO) GetBlocksToLoadByAddress ¶ added in v0.156.1
func (b *BlockDAO) GetBlocksToLoadByAddress(chainID uint64, address common.Address, limit int) (rst []*big.Int, err error)
GetBlocksToLoadByAddress gets unloaded blocks for a given address.
func (*BlockDAO) GetFirstKnownBlock ¶ added in v0.148.4
func (*BlockDAO) GetFirstSavedBlock ¶ added in v0.154.4
func (*BlockDAO) GetLastBlockByAddress ¶ added in v0.148.4
func (*BlockDAO) GetLastKnownBlockByAddress ¶ added in v0.148.4
func (*BlockDAO) GetLastKnownBlockByAddresses ¶ added in v0.148.4
func (b *BlockDAO) GetLastKnownBlockByAddresses(chainID uint64, addresses []common.Address) (map[common.Address]*Block, []common.Address, error)
TODO Remove the method below, it is used in one place and duplicates getLastKnownBlocks method with slight unneeded change
type BlockRange ¶ added in v0.151.13
type BlockRange struct { Start *big.Int // Block of first transfer FirstKnown *big.Int // Oldest scanned block LastKnown *big.Int // Last scanned block }
func NewBlockRange ¶ added in v0.151.13
func NewBlockRange() *BlockRange
type BlockRangeSequentialDAO ¶ added in v0.151.13
type BlockRangeSequentialDAO struct {
// contains filtered or unexported fields
}
type BlocksRange ¶
type BlocksRange struct {
// contains filtered or unexported fields
}
type ConcurrentDownloader ¶
type ConcurrentDownloader struct { *async.QueuedAtomicGroup *Result }
func NewConcurrentDownloader ¶
func NewConcurrentDownloader(ctx context.Context, limit uint32) *ConcurrentDownloader
NewConcurrentDownloader creates ConcurrentDownloader instance.
type Controller ¶
func NewTransferController ¶
func (*Controller) CheckRecentHistory ¶
func (c *Controller) CheckRecentHistory(chainIDs []uint64, accounts []common.Address) error
func (*Controller) GetCachedBalances ¶
func (*Controller) GetTransfersByAddress ¶
func (*Controller) GetTransfersForIdentities ¶ added in v0.151.4
func (c *Controller) GetTransfersForIdentities(ctx context.Context, identities []TransactionIdentity) ([]View, error)
func (*Controller) LoadTransferByHash ¶ added in v0.91.10
func (c *Controller) LoadTransferByHash(ctx context.Context, rpcClient *rpc.Client, address common.Address, hash common.Hash) error
Only used by status-mobile
func (*Controller) SetInitialBlocksRange ¶
func (c *Controller) SetInitialBlocksRange(chainIDs []uint64) error
func (*Controller) Start ¶
func (c *Controller) Start()
func (*Controller) Stop ¶
func (c *Controller) Stop()
type DBHeader ¶
type DBHeader struct { Number *big.Int Hash common.Hash Timestamp uint64 PreloadedTransactions []*PreloadedTransaction Network uint64 Address common.Address // Head is true if the block was a head at the time it was pulled from chain. Head bool // Loaded is true if transfers from this block have been already fetched Loaded bool }
DBHeader fields from header that are stored in database.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database sql wrapper for operations with wallet objects.
func (*Database) GetTransactionsToLoad ¶ added in v0.156.1
func (*Database) GetTransfers ¶
GetTransfers load transfers transfer between two blocks.
func (*Database) GetTransfersByAddress ¶
func (db *Database) GetTransfersByAddress(chainID uint64, address common.Address, toBlock *big.Int, limit int64) (rst []Transfer, err error)
GetTransfersByAddress loads transfers for a given address between two blocks.
func (*Database) GetTransfersByAddressAndBlock ¶
func (db *Database) GetTransfersByAddressAndBlock(chainID uint64, address common.Address, block *big.Int, limit int64) (rst []Transfer, err error)
GetTransfersByAddressAndBlock loads transfers for a given address and block.
func (*Database) GetTransfersForIdentities ¶ added in v0.151.4
func (*Database) GetTransfersInRange ¶
func (db *Database) GetTransfersInRange(chainID uint64, address common.Address, start, end *big.Int) (rst []Transfer, err error)
GetTransfersInRange loads transfers for a given address between two blocks.
func (*Database) InsertBlock ¶ added in v0.91.10
func (db *Database) InsertBlock(chainID uint64, account common.Address, blockNumber *big.Int, blockHash common.Hash) error
Only used by status-mobile
func (*Database) ProcessBlocks ¶
func (*Database) ProcessTransfers ¶ added in v0.135.2
func (db *Database) ProcessTransfers(chainID uint64, transfers []Transfer, removed []*DBHeader) (err error)
ProcessTransfers atomically adds/removes blocks and adds new transfers.
func (*Database) SaveBlocks ¶
type Downloader ¶
Downloader downloads transfers from single block using number.
type ERC20TransfersDownloader ¶
type ERC20TransfersDownloader struct {
// contains filtered or unexported fields
}
ERC20TransfersDownloader is a downloader for erc20 and erc721 tokens transfers. Since both transaction types share the same signature, both will be assigned type Erc20Transfer. Until the downloader gets refactored and a migration of the database gets implemented, differentiation between erc20 and erc721 will handled in the controller.
func NewERC20TransfersDownloader ¶
func NewERC20TransfersDownloader(client *chain.ClientWithFallback, accounts []common.Address, signer types.Signer) *ERC20TransfersDownloader
NewERC20TransfersDownloader returns new instance.
func (*ERC20TransfersDownloader) GetHeadersInRange ¶
func (d *ERC20TransfersDownloader) GetHeadersInRange(parent context.Context, from, to *big.Int) ([]*DBHeader, error)
GetHeadersInRange returns transfers between two blocks. time to get logs for 100000 blocks = 1.144686979s. with 249 events in the result set.
type ETHDownloader ¶
type ETHDownloader struct {
// contains filtered or unexported fields
}
ETHDownloader downloads regular eth transfers.
func (*ETHDownloader) GetTransfersByNumber ¶
type FetchStrategyType ¶ added in v0.148.4
type FetchStrategyType int32
const ( OnDemandFetchStrategyType FetchStrategyType = iota SequentialFetchStrategyType )
type HeaderReader ¶
type HeaderReader interface { HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) }
HeaderReader interface for reading headers using block number or hash.
type HistoryFetcher ¶ added in v0.148.4
type HistoryFetcher interface {
// contains filtered or unexported methods
}
type IterativeDownloader ¶
type IterativeDownloader struct {
// contains filtered or unexported fields
}
IterativeDownloader downloads batches of transfers in a specified size.
func SetupIterativeDownloader ¶
func SetupIterativeDownloader( client HeaderReader, address common.Address, downloader BatchDownloader, size *big.Int, to *big.Int, from *big.Int) (*IterativeDownloader, error)
SetupIterativeDownloader configures IterativeDownloader with last known synced block.
func (*IterativeDownloader) Finished ¶
func (d *IterativeDownloader) Finished() bool
Finished true when earliest block with given sync option is zero.
func (*IterativeDownloader) Header ¶
func (d *IterativeDownloader) Header() *big.Int
Header return last synced header.
func (*IterativeDownloader) Revert ¶
func (d *IterativeDownloader) Revert()
Revert reverts last step progress. Should be used if application failed to process transfers. For example failed to persist them.
type JSONBlob ¶
type JSONBlob struct {
// contains filtered or unexported fields
}
JSONBlob type for marshaling/unmarshaling inner type to json.
type MultiTransaction ¶ added in v0.135.2
type MultiTransaction struct { ID uint `json:"id"` Timestamp uint64 `json:"timestamp"` FromNetworkID uint64 `json:"fromNetworkID"` ToNetworkID uint64 `json:"toNetworkID"` FromTxHash common.Hash `json:"fromTxHash"` ToTxHash common.Hash `json:"toTxHash"` FromAddress common.Address `json:"fromAddress"` ToAddress common.Address `json:"toAddress"` FromAsset string `json:"fromAsset"` ToAsset string `json:"toAsset"` FromAmount *hexutil.Big `json:"fromAmount"` ToAmount *hexutil.Big `json:"toAmount"` Type MultiTransactionType `json:"type"` CrossTxID string }
type MultiTransactionCommand ¶ added in v0.158.0
type MultiTransactionCommandResult ¶ added in v0.158.0
type MultiTransactionIDType ¶ added in v0.135.2
type MultiTransactionIDType int64
func InsertTestMultiTransaction ¶ added in v0.151.4
func InsertTestMultiTransaction(t *testing.T, db *sql.DB, tr *TestMultiTransaction) MultiTransactionIDType
type MultiTransactionType ¶ added in v0.135.2
type MultiTransactionType uint8
type OnDemandFetchStrategy ¶ added in v0.148.4
type OnDemandFetchStrategy struct {
// contains filtered or unexported fields
}
type PendingTransaction ¶ added in v0.135.2
type PendingTransaction struct { Hash common.Hash `json:"hash"` Timestamp uint64 `json:"timestamp"` Value bigint.BigInt `json:"value"` From common.Address `json:"from"` To common.Address `json:"to"` Data string `json:"data"` Symbol string `json:"symbol"` GasPrice bigint.BigInt `json:"gasPrice"` GasLimit bigint.BigInt `json:"gasLimit"` Type PendingTrxType `json:"type"` AdditionalData string `json:"additionalData"` ChainID uint64 `json:"network_id"` MultiTransactionID MultiTransactionIDType `json:"multi_transaction_id"` }
type PendingTrxType ¶ added in v0.135.2
type PendingTrxType string
const ( RegisterENS PendingTrxType = "RegisterENS" ReleaseENS PendingTrxType = "ReleaseENS" SetPubKey PendingTrxType = "SetPubKey" BuyStickerPack PendingTrxType = "BuyStickerPack" WalletTransfer PendingTrxType = "WalletTransfer" CollectibleDeployment PendingTrxType = "CollectibleDeployment" CollectibleAirdrop PendingTrxType = "CollectibleAirdrop" CollectibleRemoteSelfDestruct PendingTrxType = "CollectibleRemoteSelfDestruct" CollectibleBurn PendingTrxType = "CollectibleBurn" )
type PreloadedTransaction ¶ added in v0.156.1
type PreloadedTransaction struct { NetworkID uint64 Type w_common.Type `json:"type"` ID common.Hash `json:"-"` Address common.Address `json:"address"` BlockNumber *big.Int `json:"blockNumber"` BlockHash common.Hash `json:"blockhash"` Loaded bool // From is derived from tx signature in order to offload this computation from UI component. From common.Address `json:"from"` // Log that was used to generate preloaded transaction. Log *types.Log `json:"log"` BaseGasFees string }
Partial transaction info obtained by ERC20Downloader. A PreloadedTransaction represents a Transaction which contains one or more ERC20/ERC721 transfer events. To be converted into one or many Transfer objects post-indexing.
type Reactor ¶
type Reactor struct {
// contains filtered or unexported fields
}
Reactor listens to new blocks and stores transfers into the database.
func NewReactor ¶ added in v0.148.4
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (*Result) GetHeaders ¶
func (*Result) PushHeader ¶
type SeparatorType ¶ added in v0.151.4
type SeparatorType int
const ( NoSeparator SeparatorType = iota + 1 OrSeparator AndSeparator )
Beware: please update addWhereSeparator if changing this enum
type SequentialFetchStrategy ¶ added in v0.148.4
type SequentialFetchStrategy struct {
// contains filtered or unexported fields
}
func NewSequentialFetchStrategy ¶ added in v0.151.13
func NewSequentialFetchStrategy(db *Database, blockDAO *BlockDAO, feed *event.Feed, transactionManager *TransactionManager, tokenManager *token.Manager, chainClients map[uint64]*chain.ClientWithFallback, accounts []common.Address) *SequentialFetchStrategy
type SyncOption ¶
type SyncOption uint
SyncOption is used to specify that application processed transfers for that block.
type TestMultiTransaction ¶ added in v0.159.2
type TestMultiTransaction struct { MultiTransactionID MultiTransactionIDType MultiTransactionType MultiTransactionType FromAddress eth_common.Address ToAddress eth_common.Address FromToken string ToToken string FromAmount int64 ToAmount int64 Timestamp int64 }
func GenerateTestBridgeMultiTransaction ¶ added in v0.159.2
func GenerateTestBridgeMultiTransaction(fromTr, toTr TestTransfer) TestMultiTransaction
func GenerateTestSendMultiTransaction ¶ added in v0.159.2
func GenerateTestSendMultiTransaction(tr TestTransfer) TestMultiTransaction
func GenerateTestSwapMultiTransaction ¶ added in v0.159.2
func GenerateTestSwapMultiTransaction(tr TestTransfer, toToken string, toAmount int64) TestMultiTransaction
type TestTransaction ¶ added in v0.151.4
type TestTransaction struct { Hash eth_common.Hash ChainID common.ChainID From eth_common.Address // [sender] Timestamp int64 BlkNumber int64 Success bool MultiTransactionID MultiTransactionIDType }
type TestTransfer ¶ added in v0.159.2
type TestTransfer struct { TestTransaction To eth_common.Address // [address] Value int64 Token *token.Token }
func GenerateTestTransfers ¶ added in v0.159.2
func GenerateTestTransfers(t *testing.T, db *sql.DB, firstStartIndex int, count int) (result []TestTransfer, fromAddresses, toAddresses []eth_common.Address)
GenerateTestTransfers will generate transaction based on the TestTokens index and roll over if there are more than len(TestTokens) transactions
type TestTransferOptions ¶ added in v0.159.10
type TestTransferOptions struct { TokenAddress eth_common.Address NullifyAddresses []eth_common.Address }
type Transaction ¶ added in v0.161.4
type Transaction []*Transfer
type TransactionIdentity ¶ added in v0.151.4
type TransactionManager ¶ added in v0.135.2
type TransactionManager struct {
// contains filtered or unexported fields
}
func NewTransactionManager ¶ added in v0.135.2
func NewTransactionManager(db *sql.DB, gethManager *account.GethManager, transactor *transactions.Transactor, config *params.NodeConfig, accountsDB *accounts.Database, eventFeed *event.Feed) *TransactionManager
func (*TransactionManager) AddPending ¶ added in v0.135.2
func (tm *TransactionManager) AddPending(transaction PendingTransaction) error
func (*TransactionManager) CreateMultiTransactionFromCommand ¶ added in v0.158.0
func (tm *TransactionManager) CreateMultiTransactionFromCommand(ctx context.Context, command *MultiTransactionCommand, data []*bridge.TransactionBridge, bridges map[string]bridge.Bridge, password string) (*MultiTransactionCommandResult, error)
func (*TransactionManager) DeletePending ¶ added in v0.135.2
func (tm *TransactionManager) DeletePending(chainID uint64, hash common.Hash) error
func (*TransactionManager) GetAllPending ¶ added in v0.135.2
func (tm *TransactionManager) GetAllPending(chainIDs []uint64) ([]*PendingTransaction, error)
func (*TransactionManager) GetBridgeDestinationMultiTransaction ¶ added in v0.161.4
func (tm *TransactionManager) GetBridgeDestinationMultiTransaction(ctx context.Context, toChainID uint64, crossTxID string) (*MultiTransaction, error)
func (*TransactionManager) GetBridgeOriginMultiTransaction ¶ added in v0.161.4
func (tm *TransactionManager) GetBridgeOriginMultiTransaction(ctx context.Context, toChainID uint64, crossTxID string) (*MultiTransaction, error)
func (*TransactionManager) GetMultiTransactions ¶ added in v0.138.1
func (tm *TransactionManager) GetMultiTransactions(ctx context.Context, ids []MultiTransactionIDType) ([]*MultiTransaction, error)
func (*TransactionManager) GetPendingByAddress ¶ added in v0.135.2
func (tm *TransactionManager) GetPendingByAddress(chainIDs []uint64, address common.Address) ([]*PendingTransaction, error)
func (*TransactionManager) GetPendingEntry ¶ added in v0.135.2
func (tm *TransactionManager) GetPendingEntry(chainID uint64, hash common.Hash) (*PendingTransaction, error)
GetPendingEntry returns sql.ErrNoRows if no pending transaction is found for the given identity TODO: consider using address also in case we expect to have also for the receiver
func (*TransactionManager) InsertMultiTransaction ¶ added in v0.156.1
func (tm *TransactionManager) InsertMultiTransaction(multiTransaction *MultiTransaction) (MultiTransactionIDType, error)
func (*TransactionManager) UpdateMultiTransaction ¶ added in v0.161.4
func (tm *TransactionManager) UpdateMultiTransaction(multiTransaction *MultiTransaction) error
func (*TransactionManager) Watch ¶ added in v0.135.2
func (tm *TransactionManager) Watch(ctx context.Context, transactionHash common.Hash, client *chain.ClientWithFallback) error
type Transfer ¶
type Transfer struct { Type w_common.Type `json:"type"` ID common.Hash `json:"-"` Address common.Address `json:"address"` BlockNumber *big.Int `json:"blockNumber"` BlockHash common.Hash `json:"blockhash"` Timestamp uint64 `json:"timestamp"` Transaction *types.Transaction `json:"transaction"` Loaded bool NetworkID uint64 // From is derived from tx signature in order to offload this computation from UI component. From common.Address `json:"from"` Receipt *types.Receipt `json:"receipt"` // Log that was used to generate erc20 transfer. Nil for eth transfer. Log *types.Log `json:"log"` BaseGasFees string // Internal field that is used to track multi-transaction transfers. MultiTransactionID MultiTransactionIDType `json:"multi_transaction_id"` }
Transfer stores information about transfer. A Transfer represents a plain ETH transfer or some token activity inside a Transaction
type View ¶
type View struct { ID common.Hash `json:"id"` Type w_common.Type `json:"type"` Address common.Address `json:"address"` BlockNumber *hexutil.Big `json:"blockNumber"` BlockHash common.Hash `json:"blockhash"` Timestamp hexutil.Uint64 `json:"timestamp"` GasPrice *hexutil.Big `json:"gasPrice"` MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` EffectiveTip *hexutil.Big `json:"effectiveTip"` EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice"` GasLimit hexutil.Uint64 `json:"gasLimit"` GasUsed hexutil.Uint64 `json:"gasUsed"` Nonce hexutil.Uint64 `json:"nonce"` TxStatus hexutil.Uint64 `json:"txStatus"` Input hexutil.Bytes `json:"input"` TxHash common.Hash `json:"txHash"` Value *hexutil.Big `json:"value"` // Only used for Type EthTransfer and Erc20Transfer TokenID *hexutil.Big `json:"tokenId"` // Only used for Type Erc721Transfer From common.Address `json:"from"` To common.Address `json:"to"` Contract common.Address `json:"contract"` NetworkID uint64 `json:"networkId"` MultiTransactionID int64 `json:"multiTransactionID"` BaseGasFees string `json:"base_gas_fee"` }
View stores only fields used by a client and ensures that all relevant fields are encoded in hex.