@silentswap/sdk 0.0.55 → 0.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asset-utils.d.ts +1 -1
- package/dist/asset-utils.js +8 -1
- package/package.json +1 -1
package/dist/asset-utils.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export declare const extractChainIdsFromAssets: (assets: string[], options?: {
|
|
|
68
68
|
* Extract chain ID from a single asset (CAIP-19 string or AssetInfo)
|
|
69
69
|
* Returns number for EVM chains, 'solana' for Solana, null if invalid
|
|
70
70
|
*/
|
|
71
|
-
export declare const extractChainIdFromAsset: (asset: string | AssetInfo | null, solanaChainId?: number) => number | "solana" | null;
|
|
71
|
+
export declare const extractChainIdFromAsset: (asset: string | AssetInfo | null, solanaChainId?: number) => number | "solana" | "bitcoin" | null;
|
|
72
72
|
/**
|
|
73
73
|
* Get chain info object for the token's chain
|
|
74
74
|
*/
|
package/dist/asset-utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getChainByCaip2 } from './assets.js';
|
|
2
2
|
// Core CAIP-19 parsing utilities
|
|
3
|
-
import { parseCaip19 as coreParseCaip19, getChainNamespace as coreGetChainNamespace, getChainId as coreGetChainId, getAssetNamespace as coreGetAssetNamespace, getAssetReference as coreGetAssetReference, getCaip2FromCaip19, getEvmChainId, isNativeToken as coreIsNativeToken, isEvmAsset, isSolanaAsset, parseEvmCaip19, isEvmNativeToken as coreIsEvmNativeToken, isErc20Token, isSolanaNativeToken as coreIsSolanaNativeToken, isSplToken, } from './caip19.js';
|
|
3
|
+
import { parseCaip19 as coreParseCaip19, getChainNamespace as coreGetChainNamespace, getChainId as coreGetChainId, getAssetNamespace as coreGetAssetNamespace, getAssetReference as coreGetAssetReference, getCaip2FromCaip19, getEvmChainId, isNativeToken as coreIsNativeToken, isEvmAsset, isSolanaAsset, parseEvmCaip19, isEvmNativeToken as coreIsEvmNativeToken, isErc20Token, isSolanaNativeToken as coreIsSolanaNativeToken, isSplToken, isBitcoinAsset, } from './caip19.js';
|
|
4
|
+
import { BITCOIN_CHAIN_ID } from './chains.js';
|
|
4
5
|
import { N_DEBRIDGE_CHAIN_ID_SOLANA } from './constants.js';
|
|
5
6
|
// ============================================================================
|
|
6
7
|
// CAIP-19 Parsing Wrappers (for AssetInfo convenience)
|
|
@@ -126,6 +127,9 @@ export const getTokenChainId = (token) => {
|
|
|
126
127
|
// This matches SOLANA_CHAIN_ID (7565164) used by isSolanaChain()
|
|
127
128
|
return N_DEBRIDGE_CHAIN_ID_SOLANA;
|
|
128
129
|
}
|
|
130
|
+
if (isBitcoinAsset(token.caip19)) {
|
|
131
|
+
return BITCOIN_CHAIN_ID;
|
|
132
|
+
}
|
|
129
133
|
// For EVM chains, return the numeric chain ID
|
|
130
134
|
return getEvmChainId(token.caip19);
|
|
131
135
|
};
|
|
@@ -172,6 +176,9 @@ export const extractChainIdFromAsset = (asset, solanaChainId) => {
|
|
|
172
176
|
if (isSolanaAsset(caip19)) {
|
|
173
177
|
return 'solana';
|
|
174
178
|
}
|
|
179
|
+
if (isBitcoinAsset(caip19)) {
|
|
180
|
+
return 'bitcoin';
|
|
181
|
+
}
|
|
175
182
|
const parsed = parseEvmCaip19(caip19);
|
|
176
183
|
if (parsed?.chainId) {
|
|
177
184
|
// Convert Solana numeric chain ID to 'solana' if provided
|