transfer

package
v0.172.5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MPL-2.0 Imports: 50 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"

	// Internal events emitted when different kinds of transfers are detected
	EventInternalETHTransferDetected     walletevent.EventType = walletevent.InternalEventTypePrefix + "eth-transfer-detected"
	EventInternalERC20TransferDetected   walletevent.EventType = walletevent.InternalEventTypePrefix + "erc20-transfer-detected"
	EventInternalERC721TransferDetected  walletevent.EventType = walletevent.InternalEventTypePrefix + "erc721-transfer-detected"
	EventInternalERC1155TransferDetected walletevent.EventType = walletevent.InternalEventTypePrefix + "erc1155-transfer-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,
}
View Source
var TestCollectibles = []TestCollectible{
	TestCollectible{
		TokenAddress: eth_common.HexToAddress("0x97a04fda4d97c6e3547d66b572e29f4a4ff40392"),
		TokenID:      big.NewInt(1),
		ChainID:      1,
	},
	TestCollectible{
		TokenAddress: eth_common.HexToAddress("0x2cec8879915cdbd80c88d8b1416aa9413a24ddfa"),
		TokenID:      big.NewInt(1),
		ChainID:      1,
	},
	TestCollectible{
		TokenAddress: eth_common.HexToAddress("0x1dea7a3e04849840c0eb15fd26a55f6c40c4a69b"),
		TokenID:      big.NewInt(11),
		ChainID:      5,
	},
	TestCollectible{
		TokenAddress: eth_common.HexToAddress("0x1dea7a3e04849840c0eb15fd26a55f6c40c4a69b"),
		TokenID:      big.NewInt(12),
		ChainID:      5,
	},
}

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 GenerateTxField added in v0.170.0

func GenerateTxField(data []byte) *types.Transaction

func GetOwnedMultiTransactionID added in v0.166.9

func GetOwnedMultiTransactionID(tx *sql.Tx, chainID w_common.ChainID, id common.Hash, address common.Address) (mTID int64, err error)

GetOwnedMultiTransactionID returns sql.ErrNoRows if no transaction is found for the given identity

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 SaveTransfersMarkBlocksLoaded added in v0.171.30

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

For using in tests only outside the package

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 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 BlockRangeDAOer added in v0.171.33

type BlockRangeDAOer interface {
	// contains filtered or unexported methods
}

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, accountsDB *statusaccounts.Database, rpcClient *rpc.Client, accountFeed *event.Feed, transferFeed *event.Feed,
	transactionManager *TransactionManager, pendingTxManager *transactions.PendingTxTracker, tokenManager *token.Manager,
	balanceCacher balance.Cacher) *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) 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) GetLatestCollectibleTransfer added in v0.172.5

func (db *Database) GetLatestCollectibleTransfer(address common.Address, id thirdparty.CollectibleUniqueID) (*Transfer, error)

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

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

type Downloader

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

Downloader downloads transfers from single block using number.

type ERC20BlockRange added in v0.170.0

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

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.ClientInterface, accounts []common.Address, signer types.Signer, incomingOnly bool) *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 and tokens 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 (
	SequentialFetchStrategyType FetchStrategyType = iota
)

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, 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 PreloadedTransaction added in v0.156.1

type PreloadedTransaction struct {
	Type    w_common.Type  `json:"type"`
	ID      common.Hash    `json:"-"`
	Address common.Address `json:"address"`
	// Log that was used to generate preloaded transaction.
	Log     *types.Log `json:"log"`
	TokenID *big.Int   `json:"tokenId"`
	Value   *big.Int   `json:"value"`
}

Partial transaction info obtained by ERC20Downloader. A PreloadedTransaction represents a Transaction which contains one ERC20/ERC721/ERC1155 transfer event. To be converted into one Transfer object 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, blockRangesSeqDAO *BlockRangeSequentialDAO, accountsDB *accounts.Database, feed *event.Feed, tm *TransactionManager,
	pendingTxManager *transactions.PendingTxTracker, tokenManager *token.Manager,
	balanceCacher balance.Cacher, omitHistory bool) *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, blockRangesSeqDAO *BlockRangeSequentialDAO, accountsDB *accounts.Database, feed *event.Feed,
	transactionManager *TransactionManager, pendingTxManager *transactions.PendingTxTracker,
	tokenManager *token.Manager,
	chainClients map[uint64]chain.ClientInterface,
	accounts []common.Address,
	balanceCacher balance.Cacher,
	omitHistory bool,
) *SequentialFetchStrategy

type SignatureDetails added in v0.171.1

type SignatureDetails struct {
	R string `json:"r"`
	S string `json:"s"`
	V string `json:"v"`
}

type SyncOption

type SyncOption uint

SyncOption is used to specify that application processed transfers for that block.

type TestCollectible added in v0.167.5

type TestCollectible struct {
	TokenAddress eth_common.Address
	TokenID      *big.Int
	ChainID      common.ChainID
}

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
	FromNetworkID        *uint64
	ToNetworkID          *uint64
}

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
	Nonce              uint64
	Contract           eth_common.Address
	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
	TokenID          *big.Int
	NullifyAddresses []eth_common.Address
	Tx               *types.Transaction
	Receipt          *types.Receipt
}

type Transaction added in v0.161.4

type Transaction []*Transfer

type TransactionDescription added in v0.171.1

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

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

func (*TransactionManager) BuildRawTransaction added in v0.171.27

func (tm *TransactionManager) BuildRawTransaction(chainID uint64, sendArgs transactions.SendTxArgs, signature []byte) (response *TxResponse, err error)

func (*TransactionManager) BuildTransaction added in v0.171.25

func (tm *TransactionManager) BuildTransaction(chainID uint64, sendArgs transactions.SendTxArgs) (response *TxResponse, err 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)

In case of keycard account, password should be empty

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) ProceedWithTransactionsSignatures added in v0.171.1

func (tm *TransactionManager) ProceedWithTransactionsSignatures(ctx context.Context, signatures map[string]SignatureDetails) (*MultiTransactionCommandResult, error)

func (*TransactionManager) SendTransactionWithSignature added in v0.171.25

func (tm *TransactionManager) SendTransactionWithSignature(chainID uint64, txType transactions.PendingTrxType, sendArgs transactions.SendTxArgs, signature []byte) (hash types.Hash, err error)

func (*TransactionManager) SignMessage added in v0.171.25

func (tm *TransactionManager) SignMessage(message types.HexBytes, address common.Address, password string) (string, 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"`
	// TokenID is the id of the transferred token. Nil for eth transfer.
	TokenID *big.Int `json:"tokenId"`
	// TokenValue is the value of the token transfer. Nil for eth transfer.
	TokenValue  *big.Int `json:"tokenValue"`
	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 Since ERC1155 transfers can contain multiple tokens, a single Transfer represents a single token transfer, that means ERC1155 batch transfers will be represented by multiple Transfer objects.

type TxResponse added in v0.171.25

type TxResponse struct {
	KeyUID        string                  `json:"keyUid,omitempty"`
	Address       types.Address           `json:"address,omitempty"`
	AddressPath   string                  `json:"addressPath,omitempty"`
	SignOnKeycard bool                    `json:"signOnKeycard,omitempty"`
	ChainID       uint64                  `json:"chainId,omitempty"`
	MessageToSign interface{}             `json:"messageToSign,omitempty"`
	TxArgs        transactions.SendTxArgs `json:"txArgs,omitempty"`
	RawTx         string                  `json:"rawTx,omitempty"`
	TxHash        common.Hash             `json:"txHash,omitempty"`
}

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