client

package
v0.0.0-...-d09159b Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReplacePathVariable

func ReplacePathVariable(path, pathVarName string, value interface{}) (string, error)

ReplacePathVariable replaces the path variable in the given URL with the specified value.

Types

type ActionService

type ActionService service

type Client

type Client struct {

	// Ethereum client map
	EthClientMap map[int]*ethclient.Client
	// The URL of the 1inch API
	ApiBaseURL *url.URL
	// The API key to use for authentication
	ApiKey string
	// When present, tests will simulate swaps on Tenderly
	NonceCache map[string]uint64

	// Isolated namespaces for each API
	Actions      *ActionService
	SwapApi      *SwapService
	OrderbookApi *OrderbookService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config Config) (*Client, error)

NewClient creates and initializes a new Client instance based on the provided Config.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

func (*Client) GetEthClient

func (c *Client) GetEthClient(chainId int) (*ethclient.Client, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body []byte) (*http.Request, error)

type Config

type Config struct {
	DevPortalApiKey   string
	Web3HttpProviders []Web3ProviderConfig
}

type Environment

type Environment string

type OrderbookService

type OrderbookService service

func (*OrderbookService) CreateOrder

CreateOrder creates an order in the Limit Order Protocol

func (*OrderbookService) GetActiveOrdersWithPermit

GetActiveOrdersWithPermit returns all orders in the Limit Order Protocol that are active and have a valid permit

func (*OrderbookService) GetAllOrders

GetAllOrders returns all orders in the Limit Order Protocol

func (*OrderbookService) GetCount

GetCount returns the number of orders in the Limit Order Protocol

func (*OrderbookService) GetEvent

GetEvent returns an event in the Limit Order Protocol by order hash

func (*OrderbookService) GetEvents

GetEvents returns all events in the Limit Order Protocol

func (*OrderbookService) GetOrdersByCreatorAddress

GetOrdersByCreatorAddress returns all orders created by a given address in the Limit Order Protocol

type SwapService

type SwapService service

func (*SwapService) ExecuteSwap

func (s *SwapService) ExecuteSwap(ctx context.Context, config *models.ExecuteSwapConfig) error

ExecuteSwap executes a swap on the Ethereum blockchain using swap data generated by GetSwap

func (*SwapService) GetApproveAllowance

GetApproveAllowance returns the allowance the 1inch router has to spend a token on behalf of a wallet

func (*SwapService) GetApproveSpender

GetApproveSpender returns the address of the 1inch router contract

func (*SwapService) GetApproveTransaction

GetApproveTransaction returns the transaction data for approving the 1inch router to spend a token on behalf of a wallet

func (*SwapService) GetLiquiditySources

GetLiquiditySources returns all liquidity sources tracked by the 1inch Aggregation Protocol for a given chain

func (*SwapService) GetQuote

GetQuote returns the quote for a potential swap through the Aggregation Protocol

func (*SwapService) GetSwap

GetSwap returns a swap quote with transaction data that can be used to execute a swap through the Aggregation Protocol

func (*SwapService) GetTokens

GetTokens returns all tokens officially tracked by the 1inch Aggregation Protocol for a given chain

type Web3ProviderConfig

type Web3ProviderConfig struct {
	ChainId int
	Url     string
}

Directories

Path Synopsis
examples
Package orderbook provides primitives to interact with the openapi HTTP API.
Package orderbook provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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