Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RateLimitPublic = dex.RateLimit{QPS: 5, Burst: 5}
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client speaks the Socket Swap V3 API (the successor of Bungee v1; V3 is tx-mode only — no intent submit step, routes carry txData).
func NewClient ¶
func NewClient(opts ...ClientOption) *Client
func (*Client) GetSupportedChainIds ¶
GetSupportedChainIds returns the SDK's static chain map; Socket V3 has no supported-chains endpoint.
func (*Client) Quote ¶
func (c *Client) Quote(ctx context.Context, in *dexmodel.DexQuoteIn) (*dexmodel.DexQuoteOut, error)
func (*Client) Status ¶
func (c *Client) Status(ctx context.Context, in *dexmodel.DexCheckTxIn) (*dexmodel.DexCheckTxOut, error)
Status polls /v3/swap/status; in.Hash must carry the route quoteId.
type ClientOption ¶
type ClientOption func(*clientConfig)
func WithRateLimit ¶
func WithRateLimit(r dex.RateLimit) ClientOption
type QuoteOut ¶
type QuoteOut struct {
OriginChainId int `json:"originChainId"`
DestinationChainId int `json:"destinationChainId"`
UserAddress string `json:"userAddress"`
ReceiverAddress string `json:"receiverAddress"`
Input struct {
Token Token `json:"token"`
Amount string `json:"amount"`
PriceInUsd float64 `json:"priceInUsd"`
ValueInUsd float64 `json:"valueInUsd"`
} `json:"input"`
Routes []QuoteRoute `json:"routes"`
}
type QuoteRequest ¶
type QuoteResponse ¶
type QuoteRoute ¶ added in v0.2.1
type QuoteRoute struct {
UserOp string `json:"userOp"`
QuoteId string `json:"quoteId"`
ExpiresAt int64 `json:"expiresAt"`
Output struct {
Token Token `json:"token"`
Amount string `json:"amount"`
MinAmountOut string `json:"minAmountOut"`
PriceInUsd float64 `json:"priceInUsd"`
ValueInUsd float64 `json:"valueInUsd"`
} `json:"output"`
EstimatedTime int `json:"estimatedTime"`
Slippage float64 `json:"slippage"`
SuggestedSlippage float64 `json:"suggestedSlippage"`
RouteTags []string `json:"routeTags"`
RouteDetails struct {
DexDetails *struct {
Protocol Protocol `json:"protocol"`
} `json:"dexDetails"`
BridgeDetails *struct {
Protocol Protocol `json:"protocol"`
} `json:"bridgeDetails"`
} `json:"routeDetails"`
Approval *struct {
SpenderAddress string `json:"spenderAddress"`
Amount string `json:"amount"`
TokenAddress string `json:"tokenAddress"`
UserAddress string `json:"userAddress"`
} `json:"approval"`
// Object is kind-dependent: "evm_tx" carries {chainId,to,data,
// value}; "svm_instructions" carries Solana tx ingredients.
TxData struct {
Kind string `json:"kind"`
Object json.RawMessage `json:"object"`
} `json:"txData"`
GasFee struct {
GasToken Token `json:"gasToken"`
GasLimit flexString `json:"gasLimit"`
GasPrice flexString `json:"gasPrice"`
EstimatedFee flexString `json:"estimatedFee"`
FeeInUsd float64 `json:"feeInUsd"`
} `json:"gasFee"`
StatusCheck struct {
Endpoint string `json:"endpoint"`
Method string `json:"method"`
IntervalSec int `json:"intervalSec"`
MaxDurationSec int `json:"maxDurationSec"`
} `json:"statusCheck"`
}
type StatusOut ¶ added in v0.2.1
type StatusOut struct {
QuoteId string `json:"quoteId"`
UserOp string `json:"userOp"`
Status string `json:"status"`
StatusCode string `json:"statusCode"`
Origin struct {
ChainId int `json:"chainId"`
Status string `json:"status"`
TxHash string `json:"txHash"`
} `json:"origin"`
Destination struct {
ChainId int `json:"chainId"`
Status string `json:"status"`
TxHash string `json:"txHash"`
} `json:"destination"`
Refund *struct {
ChainId int `json:"chainId"`
TxHash string `json:"txHash"`
} `json:"refund"`
}
type StatusResponse ¶ added in v0.2.1
Click to show internal directories.
Click to hide internal directories.