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
| Name | Type |
|---|---|
options | SocketOptions |
provider | Web3Provider |
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
| Name | Type |
|---|---|
approvals | typeof Approvals |
balances | typeof Balances |
quotes | typeof Quotes |
routes | typeof Routes |
server | typeof Server |
supported | typeof Supported |
tokenLists | typeof 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
| Name | Type | Description |
|---|---|---|
activeRouteId | number | The active route id of the desired route to continue |
callbacks | EventCallbacks | optional 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
| Name | Type | Description |
|---|---|---|
options | ActiveRoutesRequest | Criteria 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
| Name | Type | Description |
|---|---|---|
params | QuoteParams | The parameters of the quote |
preferences? | QuotePreferences | Additional 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
| Name | Type | Description |
|---|---|---|
params | QuoteParams | The parameters of the quote |
preferences? | QuotePreferences | Additional 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
| Name | Type | Description |
|---|---|---|
chainId | ChainId | The 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
| Name | Type |
|---|---|
request | TokenListRequest |
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
| Name | Type | Description |
|---|---|---|
quote | SocketQuote | The quote to execute |
callbacks | EventCallbacks | optional callbacks for different states of the execution |
Returns
Promise<number>