Skip to main content

Class: WrappableTokenService

GalaChain core SDK 1.0.0-rc.8


GalaChain core SDK 1.0.0-rc.8 / bridge / WrappableTokenService

Class: WrappableTokenService

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2085

Service for the wrappable tokens.

Reads go through a DexApiReader (a GalaConnectClient, or launchpad-sdk's DEX API HttpClient). Failures are GalaSDKErrors: BRIDGE_READ_RESPONSE_INVALID for an answer without a token list, INVALID_TOKEN_REFERENCE for a token id that is not one, and the read's own (GALACONNECT_HTTP_ERROR, TRANSPORT_ERROR, ...).

Constructors​

Constructor​

new WrappableTokenService(dexApi): WrappableTokenService

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2093

Parameters​

dexApi​

DexApiReader

Reads the DEX API platform's token list

Returns​

WrappableTokenService

Methods​

clearCache()​

clearCache(): void

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2118

Forget the cached tokens.

Returns​

void


fetchAllWrappableTokens()​

fetchAllWrappableTokens(): Promise<FetchWrappableTokensResult>

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2108

Fetch every wrappable token (every page), or the cached ones.

Returns​

Promise<FetchWrappableTokensResult>


fetchWrappableTokens()​

fetchWrappableTokens(options?): Promise<FetchWrappableTokensResult>

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2106

Fetch one page of the wrappable tokens. Not cached: the cache holds only the full list (a page standing in for it would hide every token on the other pages).

Parameters​

options?​

FetchWrappableTokensOptions

Offset (default 0) and limit (default and at most 1000)

Returns​

Promise<FetchWrappableTokensResult>


getCacheStats()​

getCacheStats(): WrappableTokenCacheStats

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2116

What the cache holds.

Returns​

WrappableTokenCacheStats


getWrapCounterpart()​

getWrapCounterpart(tokenId): Promise<WrappableToken | undefined>

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2112

The token a wrappable token wraps to or unwraps from, if both are wrappable.

Parameters​

tokenId​

TokenClassKeyInput

Returns​

Promise<WrappableToken | undefined>


getWrappableToken()​

getWrappableToken(tokenId): Promise<WrappableToken | undefined>

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2110

The wrappable token with tokenId, if any.

Parameters​

tokenId​

TokenClassKeyInput

Returns​

Promise<WrappableToken | undefined>


isTokenWrappable()​

isTokenWrappable(tokenId): Promise<IsTokenWrappableResult>

Defined in: packages/gala-core-sdk/dist/bridge.d.ts:2114

Whether a token is wrappable, with its counterpart.

Parameters​

tokenId​

TokenClassKeyInput

Returns​

Promise<IsTokenWrappableResult>