paraswap

package
v0.181.35 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MPL-2.0 Imports: 10 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 ClientV5

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

func NewClientV5

func NewClientV5(chainID uint64) *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)

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"`
}

Jump to

Keyboard shortcuts

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