paraswap

package
v0.182.43 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SellSide = SwapSide("SELL")
	BuySide  = SwapSide("BUY")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInterface added in v0.182.42

type ClientInterface interface {
	SetChainID(chainID uint64)
	SetPartnerAddress(partnerAddress common.Address)
	SetPartnerFeePcnt(partnerFeePcnt float64)
	BuildTransaction(ctx context.Context, srcTokenAddress common.Address, srcTokenDecimals uint, srcAmountWei *big.Int,
		destTokenAddress common.Address, destTokenDecimals uint, destAmountWei *big.Int, slippageBasisPoints uint,
		addressFrom common.Address, addressTo common.Address, priceRoute json.RawMessage, side SwapSide) (Transaction, error)
	FetchPriceRoute(ctx context.Context, srcTokenAddress common.Address, srcTokenDecimals uint,
		destTokenAddress common.Address, destTokenDecimals uint, amountWei *big.Int, addressFrom common.Address,
		addressTo common.Address, side SwapSide) (Route, error)
	FetchTokensList(ctx context.Context) ([]Token, error)
}

type ClientV5

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

func NewClientV5

func NewClientV5(
	chainID uint64,
	partnerID string,
	partnerAddress common.Address,
	partnerFeePcnt float64) *ClientV5

func (*ClientV5) BuildTransaction

func (c *ClientV5) BuildTransaction(ctx context.Context, srcTokenAddress common.Address, srcTokenDecimals uint, srcAmountWei *big.Int,
	destTokenAddress common.Address, destTokenDecimals uint, destAmountWei *big.Int, slippageBasisPoints uint,
	addressFrom common.Address, addressTo common.Address, priceRoute json.RawMessage, side SwapSide) (Transaction, error)

func (*ClientV5) FetchPriceRoute

func (c *ClientV5) FetchPriceRoute(ctx context.Context, srcTokenAddress common.Address, srcTokenDecimals uint,
	destTokenAddress common.Address, destTokenDecimals uint, amountWei *big.Int, addressFrom common.Address,
	addressTo common.Address, side SwapSide) (Route, error)

func (*ClientV5) FetchTokensList

func (c *ClientV5) FetchTokensList(ctx context.Context) ([]Token, error)

func (*ClientV5) SetChainID

func (c *ClientV5) SetChainID(chainID uint64)

func (*ClientV5) SetPartnerAddress added in v0.182.38

func (c *ClientV5) SetPartnerAddress(partnerAddress common.Address)

func (*ClientV5) SetPartnerFeePcnt added in v0.182.38

func (c *ClientV5) SetPartnerFeePcnt(partnerFeePcnt float64)

type PriceRouteResponse

type PriceRouteResponse struct {
	PriceRoute json.RawMessage `json:"priceRoute"`
	Error      string          `json:"error"`
}

type Route

type Route struct {
	GasCost           *bigint.BigInt  `json:"gasCost"`
	SrcAmount         *bigint.BigInt  `json:"srcAmount"`
	SrcTokenAddress   common.Address  `json:"srcToken"`
	SrcTokenDecimals  uint            `json:"srcDecimals"`
	DestAmount        *bigint.BigInt  `json:"destAmount"`
	DestTokenAddress  common.Address  `json:"destToken"`
	DestTokenDecimals uint            `json:"destDecimals"`
	RawPriceRoute     json.RawMessage `json:"rawPriceRoute"`
	Side              SwapSide        `json:"side"`
}

type SwapSide added in v0.180.31

type SwapSide string

type Token

type Token struct {
	Symbol   string `json:"symbol"`
	Address  string `json:"address"`
	Decimals uint   `json:"decimals"`
	Img      string `json:"img"`
	Network  int    `json:"network"`
}

type TokensResponse

type TokensResponse struct {
	Tokens []Token `json:"tokens"`
	Error  string  `json:"error"`
}

type Transaction

type Transaction struct {
	From     string `json:"from"`
	To       string `json:"to"`
	Value    string `json:"value"`
	Data     string `json:"data"`
	GasPrice string `json:"gasPrice"`
	Gas      string `json:"gas"`
	ChainID  uint64 `json:"chainId"`
	Error    string `json:"error"`
}

Directories

Path Synopsis
Package mock_paraswap is a generated GoMock package.
Package mock_paraswap is a generated GoMock package.

Jump to

Keyboard shortcuts

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