From 8aae0331179213f2f678eb87b79e6f1f0fc66419 Mon Sep 17 00:00:00 2001 From: "ignacio.pena@coinfabrik.com" Date: Thu, 3 Apr 2025 20:02:29 -0300 Subject: [PATCH] minor updates --- src/XLinkSDK.ts | 28 ++++++++++++++++++---------- src/utils/types/knownIds.ts | 13 +++++++++++++ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/XLinkSDK.ts b/src/XLinkSDK.ts index 603d83c..4cbfb66 100644 --- a/src/XLinkSDK.ts +++ b/src/XLinkSDK.ts @@ -288,18 +288,26 @@ export class XLinkSDK { } /** - * This function retrieves the list of supported routes for token transfers between blockchain - * networks, filtered based on optional conditions. It aggregates the results from different - * blockchain networks (Stacks, EVM, Bitcoin) to return a list of possible routes. + * Retrieves the list of all supported token bridging routes across blockchain networks. + * This function aggregates the route definitions from all supported protocols: + * - EVM chains + * - Stacks chains + * - Bitcoin + * - BRC-20 + * - Runes * - * @param conditions - An optional object containing the conditions for filtering the supported routes: - * - `fromChain?: ChainId` - The ID of the source blockchain (optional). - * - `toChain?: ChainId` - The ID of the destination blockchain (optional). - * - `fromToken?: TokenId` - The ID of the token being transferred from the source blockchain (optional). - * - `toToken?: TokenId` - The ID of the token expected on the destination blockchain (optional). + * If no filtering conditions are provided, it returns all supported bridging routes + * across both `mainnet` and `testnet`. When filtering is applied via the `conditions` parameter, + * it will return only the routes matching the specified criteria. * - * @returns A promise that resolves with an array of `KnownRoute` objects, each representing a - * possible route for the token transfer. + * @param conditions - Optional filtering criteria for narrowing down the supported routes: + * - `fromChain?: ChainId` – Filter by the source blockchain. + * - `toChain?: ChainId` – Filter by the destination blockchain. + * - `fromToken?: TokenId` – Filter by the token being sent from the source. + * - `toToken?: TokenId` – Filter by the token expected on the destination. + * + * @returns A promise that resolves with an array of `KnownRoute` objects, each representing a supported + * token transfer route between blockchains. */ async getSupportedRoutes( conditions?: GetSupportedRoutesFn_Conditions, diff --git a/src/utils/types/knownIds.ts b/src/utils/types/knownIds.ts index bda57e5..e313d3a 100644 --- a/src/utils/types/knownIds.ts +++ b/src/utils/types/knownIds.ts @@ -37,11 +37,13 @@ export namespace KnownTokenId { return _allKnownBitcoinTokens.includes(value as any) } + /** This type includes all known BRC20 tokens. */ export type BRC20Token = TokenId<"a brc20 token"> export function isBRC20Token(value: TokenId): value is BRC20Token { return value.startsWith("brc20-") } + /** This type includes all known Runes tokens. */ export type RunesToken = TokenId<"a runes token"> export function isRunesToken(value: TokenId): value is RunesToken { return value.startsWith("runes-") @@ -77,11 +79,17 @@ export namespace KnownTokenId { export const vLiSTX = tokenId("evm-vlistx") /** Represents the vLiALEX token ID on EVM-compatible blockchains. */ export const vLiALEX = tokenId("evm-vlialex") + /** Represents the uBTC token ID on EVM-compatible blockchains. */ export const uBTC = tokenId("evm-ubtc") + /** Represents the wuBTC token ID on EVM-compatible blockchains. */ export const wuBTC = tokenId("evm-wubtc") + /** Represents the DB20 token ID on EVM-compatible blockchains. */ export const DB20 = tokenId("evm-db20") + /** Represents the DOG token ID on EVM-compatible blockchains. */ export const DOG = tokenId("evm-dog") + /** Represents the STX token ID on EVM-compatible blockchains. */ export const STX = tokenId("evm-stx") + /** Represents the TRUMP token ID on EVM-compatible blockchains. */ export const TRUMP = tokenId("evm-trump") } /** This type includes all known tokens on EVM-compatible blockchains. */ @@ -109,10 +117,15 @@ export namespace KnownTokenId { export const vLiALEX = tokenId("stx-vlialex") /** Represents the vLiaBTC token ID on the Stacks blockchain. */ export const vLiaBTC = tokenId("stx-vliabtc") + /** Represents the DB20 token ID on the Stacks blockchain. */ export const DB20 = tokenId("stx-db20") + /** Represents the uBTC token ID on the Stacks blockchain. */ export const uBTC = tokenId("stx-ubtc") + /** Represents the DOG token ID on the Stacks blockchain. */ export const DOG = tokenId("stx-dog") + /** Represents the STX token ID on the Stacks blockchain. */ export const STX = tokenId("stx-stx") + /** Represents the TRUMP token ID on the Stacks blockchain. */ export const TRUMP = tokenId("stx-trump") } const _allKnownStacksTokens = [