bungee

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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

func (c *Client) GetSupportedChainIds(ctx context.Context) ([]string, error)

GetSupportedChainIds returns the SDK's static chain map; Socket V3 has no supported-chains endpoint.

func (*Client) Quote

func (*Client) Status

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 Protocol added in v0.2.1

type Protocol struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	Icon        string `json:"icon"`
}

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 QuoteRequest struct {
	OriginChainId      string
	DestinationChainId string
	InputToken         string
	OutputToken        string
	UserAddress        string
	ReceiverAddress    string
	InputAmount        string
	Slippage           string
}

type QuoteResponse

type QuoteResponse struct {
	Success    bool     `json:"success"`
	StatusCode int      `json:"statusCode"`
	Message    string   `json:"message,omitempty"`
	Result     QuoteOut `json:"result"`
}

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

type StatusResponse struct {
	Success    bool      `json:"success"`
	StatusCode int       `json:"statusCode"`
	Message    string    `json:"message,omitempty"`
	Result     StatusOut `json:"result"`
}

type Token added in v0.2.1

type Token struct {
	ChainId  int    `json:"chainId"`
	Address  string `json:"address"`
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Decimals int    `json:"decimals"`
	LogoURI  string `json:"logoURI"`
	Icon     string `json:"icon"`
}

Jump to

Keyboard shortcuts

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