bridge/classes/WrappableTokenService.md
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, ...).
gala connect client http sdk error bridge read response invalid token reference galaconnect transport
Constructors
Constructor
new WrappableTokenService(
dexApi):WrappableTokenService
Parameters
| Parameter | Type | Description |
|---|---|---|
dexApi | DexApiReader | Reads the DEX API platform's token list |
Returns
WrappableTokenService
dex api wrappable token service reader
Methods
clearCache()
clearCache():
void
Forget the cached tokens.
Returns
void
clear cache
fetchAllWrappableTokens()
fetchAllWrappableTokens():
Promise<FetchWrappableTokensResult>
Fetch every wrappable token (every page), or the cached ones.
Returns
Promise<FetchWrappableTokensResult>
fetch all wrappable tokens result
fetchWrappableTokens()
fetchWrappableTokens(
options?):Promise<FetchWrappableTokensResult>
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
| Parameter | Type | Description |
|---|---|---|
options? | FetchWrappableTokensOptions | Offset (default 0) and limit (default and at most 1000) |
Returns
Promise<FetchWrappableTokensResult>
fetch wrappable tokens result options
getCacheStats()
getCacheStats():
WrappableTokenCacheStats
What the cache holds.
Returns
get cache stats wrappable token
getWrapCounterpart()
getWrapCounterpart(
tokenId):Promise<WrappableToken|undefined>
The token a wrappable token wraps to or unwraps from, if both are wrappable.
Parameters
| Parameter | Type |
|---|---|
tokenId | TokenClassKeyInput |
Returns
Promise<WrappableToken | undefined>
get wrap counterpart token id wrappable class key input
getWrappableToken()
getWrappableToken(
tokenId):Promise<WrappableToken|undefined>
The wrappable token with tokenId, if any.
Parameters
| Parameter | Type |
|---|---|
tokenId | TokenClassKeyInput |
Returns
Promise<WrappableToken | undefined>
get wrappable token id class key input
isTokenWrappable()
isTokenWrappable(
tokenId):Promise<IsTokenWrappableResult>
Whether a token is wrappable, with its counterpart.
Parameters
| Parameter | Type |
|---|---|
tokenId | TokenClassKeyInput |
Returns
Promise<IsTokenWrappableResult>
is token wrappable id result class key input