transfer

package
v0.162.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2023 License: MPL-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	NoThreadLimit         uint32 = 0
	SequentialThreadLimit uint32 = 10
)
View Source
const (
	ReactorNotStarted string = "reactor not started"

	NonArchivalNodeBlockChunkSize = 100
	DefaultNodeBlockChunkSize     = 100000
)
View Source
const (
	NoMultiTransactionID = MultiTransactionIDType(0)

	// EventMTTransactionUpdate is emitted when a multi-transaction is updated (added or deleted)
	EventMTTransactionUpdate walletevent.EventType = "multi-transaction-update"
)
View Source
const (
	MultiTransactionSend = iota
	MultiTransactionSwap
	MultiTransactionBridge
)
View Source
const ETHSymbol string = "ETH"
View Source
const WETHSymbol string = "WETH"

Variables

View Source
var DaiGoerli = token.Token{
	Address: eth_common.HexToAddress("0xf2edF1c091f683E3fb452497d9a98A49cBA84666"),
	Name:    "DAI Stablecoin",
	Symbol:  "DAI",
	ChainID: 5,
}
View Source
var DaiMainnet = token.Token{
	Address: eth_common.HexToAddress("0xf2edF1c091f683E3fb452497d9a98A49cBA84666"),
	Name:    "DAI Stablecoin",
	Symbol:  "DAI",
	ChainID: 5,
}
View Source
var EthGoerli = token.Token{
	Address: eth_common.HexToAddress("0x"),
	Name:    "Ether",
	Symbol:  "ETH",
	ChainID: 5,
}
View Source
var EthMainnet = token.Token{
	Address: eth_common.HexToAddress("0x"),
	Name:    "Ether",
	Symbol:  "ETH",
	ChainID: 1,
}
View Source
var EthOptimism = token.Token{
	Address: eth_common.HexToAddress("0x"),
	Name:    "Ether",
	Symbol:  "ETH",
	ChainID: 10,
}
View Source
var NativeTokenIndices = []int{0, 1, 2}
View Source
var SntMainnet = token.Token{
	Address: eth_common.HexToAddress("0x744d70fdbe2ba4cf95131626614a1763df805b9e"),
	Name:    "Status Network Token",
	Symbol:  "SNT",
	ChainID: 1,
}

TestTokens contains ETH/Mainnet, ETH/Goerli, ETH/Optimism, USDC/Mainnet, USDC/Goerli, USDC/Optimism, SNT/Mainnet, DAI/Mainnet, DAI/Goerli

View Source
var UsdcGoerli = token.Token{
	Address: eth_common.HexToAddress("0x98339d8c260052b7ad81c28c16c0b98420f2b46a"),
	Name:    "USD Coin",
	Symbol:  "USDC",
	ChainID: 5,
}
View Source
var UsdcMainnet = token.Token{
	Address: eth_common.HexToAddress("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"),
	Name:    "USD Coin",
	Symbol:  "USDC",
	ChainID: 1,
}
View Source
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(tb testing.TB, db *sql.DB, tr *TestTransfer)

func InsertTestTransfer added in v0.151.4

func InsertTestTransfer(tb testing.TB, db *sql.DB, address eth_common.Address, tr *TestTransfer)

func InsertTestTransferWithOptions added in v0.159.10

func InsertTestTransferWithOptions(tb testing.TB, db *sql.DB, address eth_common.Address, tr *TestTransfer, opt *TestTransferOptions)

func SeedToToken added in v0.159.2

func SeedToToken(seed int) *token.Token

func TestTrToToken added in v0.159.2

func TestTrToToken(t *testing.T, tt *TestTransaction) (token *token.Token, isNative bool)

Types

type BalanceCache

type BalanceCache interface {
	BalanceAt(ctx context.Context, client BalanceReader, account common.Address, blockNumber *big.Int) (*big.Int, error)
	NonceAt(ctx context.Context, client BalanceReader, account common.Address, blockNumber *big.Int) (*int64, error)
	Clear()
}

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 Block

type Block struct {
	Number  *big.Int
	Balance *big.Int
	Nonce   *int64
}

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 (b *BlockDAO) GetFirstKnownBlock(chainID uint64, address common.Address) (rst *big.Int, err error)

func (*BlockDAO) GetFirstSavedBlock added in v0.154.4

func (b *BlockDAO) GetFirstSavedBlock(chainID uint64, address common.Address) (rst *DBHeader, err error)

func (*BlockDAO) GetLastBlockByAddress added in v0.148.4

func (b *BlockDAO) GetLastBlockByAddress(chainID uint64, address common.Address, limit int) (rst *big.Int, err error)

func (*BlockDAO) GetLastKnownBlockByAddress added in v0.148.4

func (b *BlockDAO) GetLastKnownBlockByAddress(chainID uint64, address common.Address) (block *Block, err error)

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 BlockView added in v0.148.4

type BlockView struct {
	Address common.Address `json:"address"`
	Number  *big.Int       `json:"blockNumber"`
	Balance bigint.BigInt  `json:"balance"`
	Nonce   *int64         `json:"nonce"`
}

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

type Controller struct {
	TransferFeed *event.Feed
	// contains filtered or unexported fields
}

func NewTransferController

func NewTransferController(db *sql.DB, rpcClient *rpc.Client, accountFeed *event.Feed, transferFeed *event.Feed,
	transactionManager *TransactionManager, pendingTxManager *transactions.TransactionManager, tokenManager *token.Manager, loadAllTransfers bool) *Controller

func (*Controller) CheckRecentHistory

func (c *Controller) CheckRecentHistory(chainIDs []uint64, accounts []common.Address) error

func (*Controller) GetCachedBalances

func (c *Controller) GetCachedBalances(ctx context.Context, chainID uint64, addresses []common.Address) ([]BlockView, error)

func (*Controller) GetTransfersByAddress

func (c *Controller) GetTransfersByAddress(ctx context.Context, chainID uint64, address common.Address, toBlock *big.Int,
	limit int64, fetchMore bool) ([]View, error)

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 NewDB

func NewDB(client *sql.DB) *Database

func (*Database) Close

func (db *Database) Close() error

Close closes database.

func (*Database) GetTransactionsToLoad added in v0.156.1

func (db *Database) GetTransactionsToLoad(chainID uint64, address common.Address, blockNumber *big.Int) (rst []PreloadedTransaction, err error)

func (*Database) GetTransfers

func (db *Database) GetTransfers(chainID uint64, start, end *big.Int) (rst []Transfer, err error)

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 (db *Database) GetTransfersForIdentities(ctx context.Context, identities []TransactionIdentity) (rst []Transfer, err error)

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 (db *Database) ProcessBlocks(chainID uint64, account common.Address, from *big.Int, to *Block, headers []*DBHeader) (err error)

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

func (db *Database) SaveBlocks(chainID uint64, account common.Address, headers []*DBHeader) (err error)

func (*Database) SaveTransfers added in v0.135.2

func (db *Database) SaveTransfers(chainID uint64, address common.Address, transfers []Transfer) (err error)

SaveTransfers

func (*Database) SaveTransfersMarkBlocksLoaded added in v0.148.4

func (db *Database) SaveTransfersMarkBlocksLoaded(chainID uint64, address common.Address, transfers []Transfer, blocks []*big.Int) (err error)

SaveTransfersMarkBlocksLoaded

type Downloader

type Downloader interface {
	GetTransfersByNumber(context.Context, *big.Int) ([]Transfer, error)
}

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

func (d *ETHDownloader) GetTransfersByNumber(ctx context.Context, number *big.Int) ([]Transfer, error)

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) Next

func (d *IterativeDownloader) Next(parent context.Context) ([]*DBHeader, *big.Int, *big.Int, error)

Next moves closer to the end on every new iteration.

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.

func (*JSONBlob) Scan

func (blob *JSONBlob) Scan(value interface{}) error

Scan implements interface.

func (*JSONBlob) Value

func (blob *JSONBlob) Value() (driver.Value, error)

Value implements interface.

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 MultiTransactionCommand struct {
	FromAddress common.Address       `json:"fromAddress"`
	ToAddress   common.Address       `json:"toAddress"`
	FromAsset   string               `json:"fromAsset"`
	ToAsset     string               `json:"toAsset"`
	FromAmount  *hexutil.Big         `json:"fromAmount"`
	Type        MultiTransactionType `json:"type"`
}

type MultiTransactionCommandResult added in v0.158.0

type MultiTransactionCommandResult struct {
	ID     int64                   `json:"id"`
	Hashes map[uint64][]types.Hash `json:"hashes"`
}

type MultiTransactionIDType added in v0.135.2

type MultiTransactionIDType int64

func InsertTestMultiTransaction added in v0.151.4

func InsertTestMultiTransaction(tb testing.TB, 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 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

func NewReactor(db *Database, blockDAO *BlockDAO, feed *event.Feed, tm *TransactionManager,
	pendingTxManager *transactions.TransactionManager, tokenManager *token.Manager) *Reactor

type Result

type Result struct {
	// contains filtered or unexported fields
}

func (*Result) Get

func (r *Result) Get() []Transfer

func (*Result) GetHeaders

func (r *Result) GetHeaders() []*DBHeader

func (*Result) GetRanges

func (r *Result) GetRanges() [][]*big.Int

func (*Result) Push

func (r *Result) Push(transfers ...Transfer)

func (*Result) PushHeader

func (r *Result) PushHeader(block *DBHeader)

func (*Result) PushRange

func (r *Result) PushRange(blockRange []*big.Int)

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, pendingTxManager *transactions.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(tb testing.TB, 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 TransactionIdentity struct {
	ChainID wallet_common.ChainID `json:"chainId"`
	Hash    common.Hash           `json:"hash"`
	Address common.Address        `json:"address"`
}

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,
	pendingTxManager *transactions.TransactionManager,
	eventFeed *event.Feed,
) *TransactionManager

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) 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) 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

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.

func CastToTransferView

func CastToTransferView(t Transfer) View

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL