Documentation
¶
Index ¶
- Constants
- 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) TransactionEstimatedTime(ctx context.Context, chainID uint64, maxFeePerGas *big.Float) TransactionEstimation
- type GasFeeMode
- type Graph
- type GraphV2
- type Node
- type NodeV2
- type Path
- type PathV2
- type PriorityFees
- type RouteInputParams
- type Router
- func (r *Router) GetBridges() map[string]bridge.Bridge
- func (r *Router) GetFeesManager() *FeeManager
- 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)
- 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
- type SuggestedFees
- type SuggestedRoutes
- type SuggestedRoutesV2
- type TransactionEstimation
Constants ¶
const ERC1155TransferString = "ERC1155Transfer"
const ERC721TransferString = "ERC721Transfer"
const EstimatePubKey = "" /* 132-byte string literal not displayed */
const EstimateUsername = "RandomUsername"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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)
////////////////////////////////////////////////////////////////////////////// TODO: remove `suggestedFees` function once new router is in place
But we should check the client since this function is exposed to API as `GetSuggestedFees` call. Maybe we should keep it and remove it later when the client is ready for that change. //////////////////////////////////////////////////////////////////////////////
func (*FeeManager) TransactionEstimatedTime ¶
func (f *FeeManager) TransactionEstimatedTime(ctx context.Context, chainID uint64, maxFeePerGas *big.Float) TransactionEstimation
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 *SuggestedFees 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 { BridgeName string From *params.Network // Source chain To *params.Network // Destination chain FromToken *walletToken.Token // Token on the source chain 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 SuggestedPriorityFees *PriorityFees // Suggested priority fees for the transaction TxBaseFee *hexutil.Big // Base fee for the transaction TxPriorityFee *hexutil.Big // Priority fee for the transaction, by default we're using the Medium priority fee 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 PriorityFees ¶
type RouteInputParams ¶
type RouteInputParams struct { 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"` TokenID string `json:"tokenID" validate:"required"` ToTokenID string `json:"toTokenID"` DisabledFromChainIDs []uint64 `json:"disabledFromChainIDs"` DisabledToChaindIDs []uint64 `json:"disabledToChaindIDs"` PreferedChainIDs []uint64 `json:"preferedChainIDs"` GasFeeMode GasFeeMode `json:"gasFeeMode" validate:"required"` FromLockedAmount map[uint64]*hexutil.Big `json:"fromLockedAmount"` TestnetMode bool `json:"testnetMode"` }
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) GetFeesManager ¶
func (r *Router) GetFeesManager() *FeeManager
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, disabledToChaindIDs, 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)
type SendType ¶
type SendType int
func (SendType) EstimateGas ¶
func (SendType) FetchPrices ¶
func (SendType) IsCollectiblesTransfer ¶
type SuggestedFees ¶
type SuggestedFees 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 `SuggestedFees` struct once new router is in place //////////////////////////////////////////////////////////////////////////////
type SuggestedRoutes ¶
type SuggestedRoutesV2 ¶
type TransactionEstimation ¶
type TransactionEstimation int
const ( Unknown TransactionEstimation = iota LessThanOneMinute LessThanThreeMinutes LessThanFiveMinutes MoreThanFiveMinutes )