Skip to main content

Web3ConnectedSocket

The Socket represents the socket sdk. This is the starting point for interacting with the socket SDK. It allows you to retrieve routes and start the execution of trades based on quotes

It includes direct access to the socket api.

The connected socket sdk interfaces directly with wallets

Hierarchy

  • BaseSocket

    Web3ConnectedSocket

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Web3ConnectedSocket(options, provider)

Parameters

NameType
optionsSocketOptions
providerWeb3Provider

Overrides

BaseSocket.constructor

Defined in

socket-v2-sdk/src/web3ConnectedSocket.ts:49

Properties

_provider

Readonly _provider: Web3Provider

Overrides

BaseSocket._provider

Defined in

socket-v2-sdk/src/web3ConnectedSocket.ts:47


client

client: Object

API client for accessing the socket api directly

Type declaration

NameType
approvalstypeof Approvals
balancestypeof Balances
quotestypeof Quotes
routestypeof Routes
servertypeof Server
supportedtypeof Supported
tokenListstypeof TokenLists

Inherited from

BaseSocket.client

Defined in

socket-v2-sdk/src/baseSocket.ts:54

Methods

continue

continue(activeRouteId, callbacks): Promise<void>

Continue an active route

Parameters

NameTypeDescription
activeRouteIdnumberThe active route id of the desired route to continue
callbacksEventCallbacksoptional callbacks for different states of the execution

Returns

Promise<void>

Defined in

socket-v2-sdk/src/web3ConnectedSocket.ts:149


getActiveRoutes

getActiveRoutes(options): Promise<{ activeRoutes: ActiveRouteResponse[] ; pagination: { limit: number ; offset: number ; totalRecords: number } }>

Retrieve the active routes. Active routes can be used to continue a quote

Parameters

NameTypeDescription
optionsActiveRoutesRequestCriteria for returning active routes. Commonly address is most useful

Returns

Promise<{ activeRoutes: ActiveRouteResponse[] ; pagination: { limit: number ; offset: number ; totalRecords: number } }>

list of active routes

Inherited from

BaseSocket.getActiveRoutes

Defined in

socket-v2-sdk/src/baseSocket.ts:201


getAllQuotes

getAllQuotes(params, preferences?): Promise<SocketQuote[]>

Get All quotes

Parameters

NameTypeDescription
paramsQuoteParamsThe parameters of the quote
preferences?QuotePreferencesAdditional route preferences for retrieving the quote from the api

Returns

Promise<SocketQuote[]>

All quotes found

Inherited from

BaseSocket.getAllQuotes

Defined in

socket-v2-sdk/src/baseSocket.ts:161


getBestQuote

getBestQuote(params, preferences?): Promise<null | SocketQuote>

Get the best quote

Parameters

NameTypeDescription
paramsQuoteParamsThe parameters of the quote
preferences?QuotePreferencesAdditional route preferences for retrieving the quote from the api

Returns

Promise<null | SocketQuote>

The best quote if found or null

Inherited from

BaseSocket.getBestQuote

Defined in

socket-v2-sdk/src/baseSocket.ts:150


getChain

getChain(chainId): Promise<Chain>

Get a chain by id

Parameters

NameTypeDescription
chainIdChainIdThe numeric id of the chain

Returns

Promise<Chain>

The requested chain

Inherited from

BaseSocket.getChain

Defined in

socket-v2-sdk/src/baseSocket.ts:92


getChains

getChains(): Promise<Chain[]>

Get all supported chains

Returns

Promise<Chain[]>

List of chains

Inherited from

BaseSocket.getChains

Defined in

socket-v2-sdk/src/baseSocket.ts:77


getTokenList

getTokenList(request): Promise<{ from: TokenList ; to: TokenList }>

Get the list of tokens available for each chain for a given path

Parameters

NameType
requestTokenListRequest

Returns

Promise<{ from: TokenList ; to: TokenList }>

The from and to token lists

Inherited from

BaseSocket.getTokenList

Defined in

socket-v2-sdk/src/baseSocket.ts:110


start

start(quote, callbacks): Promise<number>

Start executing the quote on the provider

Parameters

NameTypeDescription
quoteSocketQuoteThe quote to execute
callbacksEventCallbacksoptional callbacks for different states of the execution

Returns

Promise<number>

Defined in

socket-v2-sdk/src/web3ConnectedSocket.ts:138