Documentation ¶
Index ¶
- Constants
- Variables
- type ErrorResponseWithUUID
- type FeeHistory
- type FeeManager
- func (f *FeeManager) GetL1Fee(ctx context.Context, chainID uint64, input []byte) (uint64, error)
- func (f *FeeManager) SuggestedFees(ctx context.Context, chainID uint64) (*SuggestedFees, error)
- func (f *FeeManager) SuggestedFeesGwei(ctx context.Context, chainID uint64) (*SuggestedFeesGwei, error)
- func (f *FeeManager) TransactionEstimatedTime(ctx context.Context, chainID uint64, maxFeePerGas *big.Int) TransactionEstimation
- type GasFeeMode
- type Graph
- type GraphV2
- type MaxFeesLevels
- type Node
- type NodeV2
- type Path
- type PathV2
- type RouteInputParams
- type Router
- func (r *Router) AddPathProcessor(processor pathprocessor.PathProcessor)
- func (r *Router) GetFeesManager() *FeeManager
- func (r *Router) GetPathProcessors() map[string]pathprocessor.PathProcessor
- func (r *Router) Stop()
- func (r *Router) StopSuggestedRoutesV2AsyncCalcualtion()
- func (r *Router) SuggestedRoutes(ctx context.Context, sendType SendType, addrFrom common.Address, ...) (*SuggestedRoutes, error)
- func (r *Router) SuggestedRoutesV2(ctx context.Context, input *RouteInputParams) (*SuggestedRoutesV2, error)
- func (r *Router) SuggestedRoutesV2Async(input *RouteInputParams)
- type SendType
- func (s SendType) EstimateGas(ensService *ens.Service, stickersService *stickers.Service, ...) uint64
- func (s SendType) FetchPrices(marketManager *market.Manager, tokenID string) (map[string]float64, error)
- func (s SendType) FindToken(tokenManager *token.Manager, collectibles *collectibles.Service, ...) *token.Token
- func (s SendType) IsCollectiblesTransfer() bool
- func (s SendType) IsEnsTransfer() bool
- func (s SendType) IsStickersTransfer() bool
- type SuggestedFees
- type SuggestedFeesGwei
- type SuggestedRoutes
- type SuggestedRoutesV2
- type TransactionEstimation
Constants ¶
View Source
const EstimatePubKey = "" /* 132-byte string literal not displayed */
View Source
const EstimateUsername = "RandomUsername"
TODO: remove the following two consts once we fully move to routerV2
Variables ¶
View Source
var ( ErrENSRegisterRequiresUsernameAndPubKey = &errors.ErrorResponse{Code: errors.ErrorCode("WR-001"), Details: "username and public key are required for ENSRegister"} ErrENSRegisterTestnetSTTOnly = &errors.ErrorResponse{Code: errors.ErrorCode("WR-002"), Details: "only STT is supported for ENSRegister on testnet"} ErrENSRegisterMainnetSNTOnly = &errors.ErrorResponse{Code: errors.ErrorCode("WR-003"), Details: "only SNT is supported for ENSRegister on mainnet"} ErrENSReleaseRequiresUsername = &errors.ErrorResponse{Code: errors.ErrorCode("WR-004"), Details: "username is required for ENSRelease"} ErrENSSetPubKeyRequiresUsernameAndPubKey = &errors.ErrorResponse{Code: errors.ErrorCode("WR-005"), Details: "username and public key are required for ENSSetPubKey"} ErrStickersBuyRequiresPackID = &errors.ErrorResponse{Code: errors.ErrorCode("WR-006"), Details: "packID is required for StickersBuy"} ErrSwapRequiresToTokenID = &errors.ErrorResponse{Code: errors.ErrorCode("WR-007"), Details: "toTokenID is required for Swap"} ErrSwapTokenIDMustBeDifferent = &errors.ErrorResponse{Code: errors.ErrorCode("WR-008"), Details: "tokenID and toTokenID must be different"} ErrSwapAmountInAmountOutMustBeExclusive = &errors.ErrorResponse{Code: errors.ErrorCode("WR-009"), Details: "only one of amountIn or amountOut can be set"} ErrSwapAmountInMustBePositive = &errors.ErrorResponse{Code: errors.ErrorCode("WR-010"), Details: "amountIn must be positive"} ErrSwapAmountOutMustBePositive = &errors.ErrorResponse{Code: errors.ErrorCode("WR-011"), Details: "amountOut must be positive"} ErrLockedAmountNotSupportedForNetwork = &errors.ErrorResponse{Code: errors.ErrorCode("WR-012"), Details: "locked amount is not supported for the selected network"} ErrLockedAmountNotNegative = &errors.ErrorResponse{Code: errors.ErrorCode("WR-013"), Details: "locked amount must not be negative"} ErrLockedAmountExceedsTotalSendAmount = &errors.ErrorResponse{Code: errors.ErrorCode("WR-014"), Details: "locked amount exceeds the total amount to send"} ErrLockedAmountLessThanSendAmountAllNetworks = &errors.ErrorResponse{Code: errors.ErrorCode("WR-015"), Details: "locked amount is less than the total amount to send, but all networks are locked"} ErrNotEnoughTokenBalance = &errors.ErrorResponse{Code: errors.ErrorCode("WR-016"), Details: "not enough token balance"} ErrNotEnoughNativeBalance = &errors.ErrorResponse{Code: errors.ErrorCode("WR-017"), Details: "not enough native balance"} ErrNativeTokenNotFound = &errors.ErrorResponse{Code: errors.ErrorCode("WR-018"), Details: "native token not found"} ErrDisabledChainFoundAmongLockedNetworks = &errors.ErrorResponse{Code: errors.ErrorCode("WR-019"), Details: "disabled chain found among locked networks"} ErrENSSetPubKeyInvalidUsername = &errors.ErrorResponse{Code: errors.ErrorCode("WR-020"), Details: "a valid username, ending in '.eth', is required for ENSSetPubKey"} ErrLockedAmountExcludesAllSupported = &errors.ErrorResponse{Code: errors.ErrorCode("WR-021"), Details: "all supported chains are excluded, routing impossible"} )
Abbreviation `WR` for the error code stands for Wallet Router
Functions ¶
This section is empty.
Types ¶
type ErrorResponseWithUUID ¶ added in v0.181.32
type FeeHistory ¶
type FeeHistory struct {
BaseFeePerGas []string `json:"baseFeePerGas"`
}
type FeeManager ¶
func (*FeeManager) GetL1Fee ¶
Returns L1 fee for placing a transaction to L1 chain, appicable only for txs made from L2.
func (*FeeManager) SuggestedFees ¶
func (f *FeeManager) SuggestedFees(ctx context.Context, chainID uint64) (*SuggestedFees, error)
func (*FeeManager) SuggestedFeesGwei ¶ added in v0.180.31
func (f *FeeManager) SuggestedFeesGwei(ctx context.Context, chainID uint64) (*SuggestedFeesGwei, error)
func (*FeeManager) TransactionEstimatedTime ¶
func (f *FeeManager) TransactionEstimatedTime(ctx context.Context, chainID uint64, maxFeePerGas *big.Int) TransactionEstimation
type MaxFeesLevels ¶ added in v0.180.31
type Path ¶
type Path struct { BridgeName string From *params.Network To *params.Network MaxAmountIn *hexutil.Big AmountIn *hexutil.Big AmountInLocked bool AmountOut *hexutil.Big GasAmount uint64 GasFees *SuggestedFeesGwei BonderFees *hexutil.Big TokenFees *big.Float Cost *big.Float EstimatedTime TransactionEstimation ApprovalRequired bool ApprovalGasFees *big.Float ApprovalAmountRequired *hexutil.Big ApprovalContractAddress *common.Address }
type PathV2 ¶
type PathV2 struct { ProcessorName string FromChain *params.Network // Source chain ToChain *params.Network // Destination chain FromToken *walletToken.Token // Source token ToToken *walletToken.Token // Destination token, set if applicable AmountIn *hexutil.Big // Amount that will be sent from the source chain AmountInLocked bool // Is the amount locked AmountOut *hexutil.Big // Amount that will be received on the destination chain SuggestedLevelsForMaxFeesPerGas *MaxFeesLevels // Suggested max fees for the transaction TxBaseFee *hexutil.Big // Base fee for the transaction TxPriorityFee *hexutil.Big // Priority fee for the transaction TxGasAmount uint64 // Gas used for the transaction TxBonderFees *hexutil.Big // Bonder fees for the transaction - used for Hop bridge TxTokenFees *hexutil.Big // Token fees for the transaction - used for bridges (represent the difference between the amount in and the amount out) TxL1Fee *hexutil.Big // L1 fee for the transaction - used for for transactions placed on L2 chains ApprovalRequired bool // Is approval required for the transaction ApprovalAmountRequired *hexutil.Big // Amount required for the approval transaction ApprovalContractAddress *common.Address // Address of the contract that needs to be approved ApprovalBaseFee *hexutil.Big // Base fee for the approval transaction ApprovalPriorityFee *hexutil.Big // Priority fee for the approval transaction ApprovalGasAmount uint64 // Gas used for the approval transaction ApprovalL1Fee *hexutil.Big // L1 fee for the approval transaction - used for for transactions placed on L2 chains EstimatedTime TransactionEstimation // contains filtered or unexported fields }
type RouteInputParams ¶
type RouteInputParams struct { Uuid string `json:"uuid"` SendType SendType `json:"sendType" validate:"required"` AddrFrom common.Address `json:"addrFrom" validate:"required"` AddrTo common.Address `json:"addrTo" validate:"required"` AmountIn *hexutil.Big `json:"amountIn" validate:"required"` AmountOut *hexutil.Big `json:"amountOut"` TokenID string `json:"tokenID" validate:"required"` ToTokenID string `json:"toTokenID"` DisabledFromChainIDs []uint64 `json:"disabledFromChainIDs"` DisabledToChainIDs []uint64 `json:"disabledToChainIDs"` GasFeeMode GasFeeMode `json:"gasFeeMode" validate:"required"` FromLockedAmount map[uint64]*hexutil.Big `json:"fromLockedAmount"` // For send types like EnsRegister, EnsRelease, EnsSetPubKey, StickersBuy Username string `json:"username"` PublicKey string `json:"publicKey"` PackID *hexutil.Big `json:"packID"` // contains filtered or unexported fields }
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(rpcClient *rpc.Client, transactor *transactions.Transactor, tokenManager *token.Manager, marketManager *market.Manager, collectibles *collectibles.Service, collectiblesManager *collectibles.Manager, ensService *ens.Service, stickersService *stickers.Service) *Router
func (*Router) AddPathProcessor ¶ added in v0.181.31
func (r *Router) AddPathProcessor(processor pathprocessor.PathProcessor)
func (*Router) GetFeesManager ¶
func (r *Router) GetFeesManager() *FeeManager
func (*Router) GetPathProcessors ¶ added in v0.179.29
func (r *Router) GetPathProcessors() map[string]pathprocessor.PathProcessor
func (*Router) StopSuggestedRoutesV2AsyncCalcualtion ¶ added in v0.181.32
func (r *Router) StopSuggestedRoutesV2AsyncCalcualtion()
func (*Router) SuggestedRoutes ¶
func (r *Router) SuggestedRoutes( ctx context.Context, sendType SendType, addrFrom common.Address, addrTo common.Address, amountIn *big.Int, tokenID string, toTokenID string, disabledFromChainIDs, disabledToChainIDs, preferedChainIDs []uint64, gasFeeMode GasFeeMode, fromLockedAmount map[uint64]*hexutil.Big, testnetMode bool, ) (*SuggestedRoutes, error)
func (*Router) SuggestedRoutesV2 ¶
func (r *Router) SuggestedRoutesV2(ctx context.Context, input *RouteInputParams) (*SuggestedRoutesV2, error)
func (*Router) SuggestedRoutesV2Async ¶ added in v0.181.32
func (r *Router) SuggestedRoutesV2Async(input *RouteInputParams)
type SendType ¶
type SendType int
func (SendType) EstimateGas ¶
func (s SendType) EstimateGas(ensService *ens.Service, stickersService *stickers.Service, network *params.Network, from common.Address, tokenID string) uint64
TODO: remove this function once we fully move to routerV2
func (SendType) FetchPrices ¶
func (SendType) IsCollectiblesTransfer ¶
func (SendType) IsEnsTransfer ¶ added in v0.179.28
func (SendType) IsStickersTransfer ¶ added in v0.180.31
type SuggestedFees ¶
type SuggestedFees struct { GasPrice *big.Int `json:"gasPrice"` BaseFee *big.Int `json:"baseFee"` MaxFeesLevels *MaxFeesLevels `json:"maxFeesLevels"` MaxPriorityFeePerGas *big.Int `json:"maxPriorityFeePerGas"` L1GasFee *big.Float `json:"l1GasFee,omitempty"` EIP1559Enabled bool `json:"eip1559Enabled"` }
type SuggestedFeesGwei ¶ added in v0.180.31
type SuggestedFeesGwei struct { GasPrice *big.Float `json:"gasPrice"` BaseFee *big.Float `json:"baseFee"` MaxPriorityFeePerGas *big.Float `json:"maxPriorityFeePerGas"` MaxFeePerGasLow *big.Float `json:"maxFeePerGasLow"` MaxFeePerGasMedium *big.Float `json:"maxFeePerGasMedium"` MaxFeePerGasHigh *big.Float `json:"maxFeePerGasHigh"` L1GasFee *big.Float `json:"l1GasFee,omitempty"` EIP1559Enabled bool `json:"eip1559Enabled"` }
////////////////////////////////////////////////////////////////////////////// TODO: remove `SuggestedFeesGwei` struct once new router is in place //////////////////////////////////////////////////////////////////////////////
type SuggestedRoutes ¶
type SuggestedRoutesV2 ¶
type TransactionEstimation ¶
type TransactionEstimation int
const ( Unknown TransactionEstimation = iota LessThanOneMinute LessThanThreeMinutes LessThanFiveMinutes MoreThanFiveMinutes )
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
mock_pathprocessor
Package mock_pathprocessor is a generated GoMock package.
|
Package mock_pathprocessor is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.