relaylink

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ETH = common.HexToAddress("0x0000000000000000000000000000000000000000")
)

Functions

This section is empty.

Types

type Chain

type Chain struct {
	ID                     int64             `json:"id"`
	Name                   string            `json:"name"`
	DisplayName            string            `json:"displayName"`
	HTTPRpcUrl             string            `json:"httpRpcUrl"`
	WSRpcUrl               string            `json:"wsRpcUrl"`
	ExplorerUrl            string            `json:"explorerUrl"`
	ExplorerName           string            `json:"explorerName"`
	ExplorerPaths          ExplorerPaths     `json:"explorerPaths"`
	DepositEnabled         bool              `json:"depositEnabled"`
	TokenSupport           string            `json:"tokenSupport"`
	Disabled               bool              `json:"disabled"`
	PartialDisableLimit    int               `json:"partialDisableLimit"`
	BlockProductionLagging bool              `json:"blockProductionLagging"`
	Currency               Currency          `json:"currency"`
	WithdrawalFee          int               `json:"withdrawalFee"`
	DepositFee             int               `json:"depositFee"`
	SurgeEnabled           bool              `json:"surgeEnabled"`
	FeaturedTokens         []FeaturedToken   `json:"featuredTokens"`
	ERC20Currencies        []ERC20Currency   `json:"erc20Currencies"`
	IconUrl                string            `json:"iconUrl"`
	LogoUrl                string            `json:"logoUrl"`
	BrandColor             string            `json:"brandColor"`
	Contracts              Contracts         `json:"contracts"`
	VMType                 string            `json:"vmType"`
	ExplorerQueryParams    map[string]string `json:"explorerQueryParams"`
	BaseChainId            int               `json:"baseChainId"`
	StatusMessage          string            `json:"statusMessage"`
	Tags                   []string          `json:"tags"`
}

type Chains

type Chains struct {
	Chains []Chain `json:"chains"`
}

type Check

type Check struct {
	Endpoint string `json:"endpoint"`
	Method   string `json:"method"`
}

type Contracts

type Contracts struct {
	Multicall3           string `json:"multicall3"`
	Multicaller          string `json:"multicaller"`
	OnlyOwnerMulticaller string `json:"onlyOwnerMulticaller"`
	RelayReceiver        string `json:"relayReceiver"`
	Erc20Router          string `json:"erc20Router"`
	ApprovalProxy        string `json:"approvalProxy"`
}

type Currency

type Currency struct {
	ID               string `json:"id"`
	Symbol           string `json:"symbol"`
	Name             string `json:"name"`
	Address          string `json:"address"`
	Decimals         int    `json:"decimals"`
	SupportsBridging bool   `json:"supportsBridging"`
}

type CurrencyMetadata

type CurrencyMetadata struct {
	LogoURI  string `json:"logoURI"`
	Verified bool   `json:"verified"`
	IsNative bool   `json:"isNative"`
}

type Details

type Details struct {
	Operation         string            `json:"operation"`
	Sender            string            `json:"sender"`
	Recipient         string            `json:"recipient"`
	CurrencyIn        FeeDetails        `json:"currencyIn"`
	CurrencyOut       FeeDetails        `json:"currencyOut"`
	CurrencyGasTopup  FeeDetails        `json:"currencyGasTopup"`
	TotalImpact       TotalImpact       `json:"totalImpact"`
	SwapImpact        TotalImpact       `json:"swapImpact"`
	Rate              string            `json:"rate"`
	SlippageTolerance SlippageTolerance `json:"slippageTolerance"`
	TimeEstimate      int               `json:"timeEstimate"`
	UserBalance       string            `json:"userBalance"`
}

type ERC20Currency

type ERC20Currency struct {
	ID               string `json:"id"`
	Symbol           string `json:"symbol"`
	Name             string `json:"name"`
	Address          string `json:"address"`
	Decimals         int    `json:"decimals"`
	SupportsBridging bool   `json:"supportsBridging"`
	SupportsPermit   bool   `json:"supportsPermit"`
	WithdrawalFee    int    `json:"withdrawalFee"`
	DepositFee       int    `json:"depositFee"`
	SurgeEnabled     bool   `json:"surgeEnabled"`
}

type ErrorResponse

type ErrorResponse struct {
	Message   string `json:"message"`
	ErrorCode string `json:"errorCode"`
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type ExplorerPaths

type ExplorerPaths struct {
	Transaction string `json:"transaction"`
}

type FeaturedToken

type FeaturedToken struct {
	ID               string `json:"id"`
	Symbol           string `json:"symbol"`
	Name             string `json:"name"`
	Address          string `json:"address"`
	Decimals         int    `json:"decimals"`
	SupportsBridging bool   `json:"supportsBridging"`
	Metadata         struct {
		LogoURI string `json:"logoURI"`
	} `json:"metadata"`
}

type FeeCurrency

type FeeCurrency struct {
	ChainID  int              `json:"chainId"`
	Address  string           `json:"address"`
	Symbol   string           `json:"symbol"`
	Name     string           `json:"name"`
	Decimals int              `json:"decimals"`
	Metadata CurrencyMetadata `json:"metadata"`
}

type FeeDetails

type FeeDetails struct {
	Currency        FeeCurrency     `json:"currency"`
	Amount          decimal.Decimal `json:"amount"`
	AmountFormatted decimal.Decimal `json:"amountFormatted"`
	AmountUsd       decimal.Decimal `json:"amountUsd"`
	MinimumAmount   decimal.Decimal `json:"minimumAmount"`
}

type Fees

type Fees struct {
	Gas            FeeDetails `json:"gas"`
	Relayer        FeeDetails `json:"relayer"`
	RelayerGas     FeeDetails `json:"relayerGas"`
	RelayerService FeeDetails `json:"relayerService"`
	App            FeeDetails `json:"app"`
}

type Item

type Item struct {
	Status string          `json:"status"`
	Data   TransactionData `json:"data"`
	Check  Check           `json:"check"`
}

type QuoteResponse

type QuoteResponse struct {
	Steps   []Step  `json:"steps"`
	Fees    Fees    `json:"fees"`
	Details Details `json:"details"`
}

type RelaylinkClient

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

func NewRelaylinkClient

func NewRelaylinkClient(transportProxy *http.Transport) *RelaylinkClient

func (*RelaylinkClient) GetChains

func (client *RelaylinkClient) GetChains(ctx context.Context) ([]Chain, error)

func (*RelaylinkClient) GetChainsByID

func (client *RelaylinkClient) GetChainsByID(ctx context.Context, chainId int64) (Chain, bool)

func (*RelaylinkClient) Quote

func (client *RelaylinkClient) Quote(
	ctx context.Context,
	chainId int64,
	user,
	inputToken,
	outputToken string,
	amount *big.Int,
	slippageBps int,
	enableInfiniteApproval bool,
) (*QuoteResponse, error)

func (*RelaylinkClient) SendSwapTransaction

func (client *RelaylinkClient) SendSwapTransaction(ctx context.Context, svcCtx *svc.ServiceContext, prv *ecdsa.PrivateKey, swapResponse *QuoteResponse) (string, uint64, error)

type SlippageTolerance

type SlippageTolerance struct {
	Origin struct {
		Usd     decimal.Decimal `json:"usd"`
		Value   decimal.Decimal `json:"value"`
		Percent decimal.Decimal `json:"percent"`
	} `json:"origin"`
	Destination struct {
		Usd     decimal.Decimal `json:"usd"`
		Value   decimal.Decimal `json:"value"`
		Percent decimal.Decimal `json:"percent"`
	} `json:"destination"`
}

type SolInstruction

type SolInstruction struct {
	ProgramId string   `json:"programId"`
	Keys      []SolKey `json:"keys"`
	Data      string   `json:"data"`
}

type SolKey

type SolKey struct {
	Pubkey     string `json:"pubkey"`
	IsSigner   bool   `json:"isSigner"`
	IsWritable bool   `json:"isWritable"`
}

type Step

type Step struct {
	ID          string `json:"id"`
	Action      string `json:"action"`
	Description string `json:"description"`
	Kind        string `json:"kind"`
	RequestID   string `json:"requestId"`
	Items       []Item `json:"items"`
}

type TotalImpact

type TotalImpact struct {
	Usd     string `json:"usd"`
	Percent string `json:"percent"`
}

type TransactionData

type TransactionData struct {
	// evm
	EvmFrom                 common.Address  `json:"from"`
	EvmTo                   common.Address  `json:"to"`
	EvmGas                  decimal.Decimal `json:"gas"`
	EvmData                 string          `json:"data"`
	EvmValue                decimal.Decimal `json:"value"`
	EvmMaxFeePerGas         decimal.Decimal `json:"maxFeePerGas"`
	EvmMaxPriorityFeePerGas decimal.Decimal `json:"maxPriorityFeePerGas"`
	EvmChainID              int             `json:"chainId"`

	// sol
	SolInstructions                []SolInstruction `json:"instructions"`
	SolAddressLookupTableAddresses []string         `json:"addressLookupTableAddresses"`
}

Jump to

Keyboard shortcuts

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