bridge/classes/BridgeableTokenService.md
Service for the tokens bridgeable to Ethereum and Solana.
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 BridgeableTokenService(
dexApi):BridgeableTokenService
Parameters
| Parameter | Type | Description |
|---|---|---|
dexApi | DexApiReader | Reads the DEX API platform's token list |
Returns
BridgeableTokenService
dex api bridgeable token service reader
Methods
clearCache()
clearCache(
network?):void
Forget the cached tokens of network, or of every network.
Parameters
| Parameter | Type |
|---|---|
network? | BridgeableNetwork |
Returns
void
clear cache bridgeable network
fetchAllBridgeableTokensByNetwork()
fetchAllBridgeableTokensByNetwork(
network):Promise<FetchBridgeableTokensResult>
Fetch every token bridgeable to a network (every page), or the cached ones.
Parameters
| Parameter | Type | Description |
|---|---|---|
network | BridgeableNetwork | ETHEREUM or SOLANA |
Returns
Promise<FetchBridgeableTokensResult>
fetch all bridgeable tokens by network result
fetchAllTokensBridgeableToEthereum()
fetchAllTokensBridgeableToEthereum():
Promise<FetchBridgeableTokensResult>
Every token bridgeable to Ethereum.
Returns
Promise<FetchBridgeableTokensResult>
fetch all tokens bridgeable to ethereum result
fetchAllTokensBridgeableToSolana()
fetchAllTokensBridgeableToSolana():
Promise<FetchBridgeableTokensResult>
Every token bridgeable to Solana.
Returns
Promise<FetchBridgeableTokensResult>
fetch all tokens bridgeable to solana result
fetchBridgeableTokensByNetwork()
fetchBridgeableTokensByNetwork(
options):Promise<FetchBridgeableTokensResult>
Fetch one page of the tokens bridgeable to a network. 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 | FetchBridgeableTokensOptions | Network, offset (default 0) and limit (default and at most 1000) |
Returns
Promise<FetchBridgeableTokensResult>
fetch bridgeable tokens by network result options
getCacheStats()
getCacheStats():
BridgeableTokenCacheStats
What the cache holds.
Returns
get cache stats bridgeable token
getContractAddress()
getContractAddress(
symbol,network):Promise<string|undefined>
The contract address on network of the token with symbol, if any.
Parameters
| Parameter | Type |
|---|---|
symbol | string |
network | BridgeableNetwork |
Returns
Promise<string | undefined>
get contract address bridgeable network
getSupportedTokenSymbols()
getSupportedTokenSymbols(
network):Promise<string[]>
The symbols of the tokens bridgeable to network.
Parameters
| Parameter | Type |
|---|---|
network | BridgeableNetwork |
Returns
Promise<string[]>
get supported token symbols bridgeable network
getTokenBySymbol()
getTokenBySymbol(
symbol,network):Promise<BridgeableToken|undefined>
The token bridgeable to network with symbol (any case; the first listed), if any.
Parameters
| Parameter | Type |
|---|---|
symbol | string |
network | BridgeableNetwork |
Returns
Promise<BridgeableToken | undefined>
get token by symbol bridgeable network
getTokenByTokenId()
getTokenByTokenId(
tokenId,network):Promise<BridgeableToken|undefined>
The token bridgeable to network with the token id tokenId (a pipe class key, matched
exactly: class keys are case-sensitive), if any.
Parameters
| Parameter | Type |
|---|---|
tokenId | string |
network | BridgeableNetwork |
Returns
Promise<BridgeableToken | undefined>
get token by id bridgeable network
isTokenBridgeableToEthereum()
isTokenBridgeableToEthereum(
tokenId):Promise<IsTokenBridgeableResult>
Whether a token is bridgeable to Ethereum.
Parameters
| Parameter | Type |
|---|---|
tokenId | TokenClassKeyInput |
Returns
Promise<IsTokenBridgeableResult>
is token bridgeable to ethereum id result class key input
isTokenBridgeableToNetwork()
isTokenBridgeableToNetwork(
options):Promise<IsTokenBridgeableResult>
Whether a token (by token id) is bridgeable to a network, with its symbol and contract address there. The symbol is the cached token's, never derived from the token id.
Parameters
| Parameter | Type |
|---|---|
options | IsTokenBridgeableOptions |
Returns
Promise<IsTokenBridgeableResult>
is token bridgeable to network result options
isTokenBridgeableToSolana()
isTokenBridgeableToSolana(
tokenId):Promise<IsTokenBridgeableResult>
Whether a token is bridgeable to Solana.
Parameters
| Parameter | Type |
|---|---|
tokenId | TokenClassKeyInput |
Returns
Promise<IsTokenBridgeableResult>
is token bridgeable to solana id result class key input
preload()
preload():
Promise<void>
Read both networks' token lists.
Returns
Promise<void>