@tuwaio/nova-connect 1.0.0-fix-test-alpha.1.1de2063 → 1.0.0-fix-test-alpha.3.f49cad1
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/chunk-6S5OTERL.cjs +2 -0
- package/dist/chunk-6S5OTERL.cjs.map +1 -0
- package/dist/chunk-CEGEQMI2.cjs +2 -0
- package/dist/chunk-CEGEQMI2.cjs.map +1 -0
- package/dist/chunk-DYDY3FCT.cjs +2 -0
- package/dist/chunk-DYDY3FCT.cjs.map +1 -0
- package/dist/{chunk-NJDPFYUJ.js → chunk-FNWARYJY.js} +2 -2
- package/dist/{chunk-NJDPFYUJ.js.map → chunk-FNWARYJY.js.map} +1 -1
- package/dist/{chunk-KKCRUSJT.js → chunk-J4TY3CJF.js} +2 -2
- package/dist/{chunk-KKCRUSJT.js.map → chunk-J4TY3CJF.js.map} +1 -1
- package/dist/evm/index.cjs +1 -1
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.js +1 -1
- package/dist/evm/index.js.map +1 -1
- package/dist/evm-7NHOTSAK.cjs +2 -0
- package/dist/evm-7NHOTSAK.cjs.map +1 -0
- package/dist/{getChainsListByWalletType-KXWMBNB4.js → getChainsListByWalletType-EO6A7Q5A.js} +2 -2
- package/dist/{getChainsListByWalletType-KXWMBNB4.js.map → getChainsListByWalletType-EO6A7Q5A.js.map} +1 -1
- package/dist/getChainsListByWalletType-ZU7OPWTP.cjs +2 -0
- package/dist/getChainsListByWalletType-ZU7OPWTP.cjs.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5951 -5965
- package/dist/index.d.ts +5951 -5965
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/solana/index.cjs +1 -1
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +40 -0
- package/dist/solana/index.d.ts +40 -0
- package/dist/solana/index.js +1 -1
- package/dist/solana/index.js.map +1 -1
- package/dist/{providers/solana-WHT5KTOF.js → solana-GLHHYZDQ.js} +2 -2
- package/dist/{solana-2MXIY6UT.js.map → solana-GLHHYZDQ.js.map} +1 -1
- package/dist/solana-JUU54KQ3.cjs +2 -0
- package/dist/solana-JUU54KQ3.cjs.map +1 -0
- package/dist/types-C0Vlrba-.d.cts +75 -0
- package/dist/types-C0Vlrba-.d.ts +75 -0
- package/dist/utils-DZB4ZTS4.cjs +2 -0
- package/dist/utils-DZB4ZTS4.cjs.map +1 -0
- package/dist/utils-H5O25MTI.cjs +2 -0
- package/dist/utils-H5O25MTI.cjs.map +1 -0
- package/dist/utils-SUIRQJIA.js +2 -0
- package/dist/{utils-72MDY3OH.js.map → utils-SUIRQJIA.js.map} +1 -1
- package/package.json +4 -9
- package/dist/evm-F7OJEDX3.js +0 -2
- package/dist/evm-F7OJEDX3.js.map +0 -1
- package/dist/providers/evm-5323YCLC.js +0 -2
- package/dist/providers/evm-5323YCLC.js.map +0 -1
- package/dist/providers/index.cjs +0 -6
- package/dist/providers/index.cjs.map +0 -1
- package/dist/providers/index.d.cts +0 -691
- package/dist/providers/index.d.ts +0 -691
- package/dist/providers/index.js +0 -6
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/solana-WHT5KTOF.js.map +0 -1
- package/dist/providers/utils-FHHKXQ5Z.js +0 -2
- package/dist/providers/utils-FHHKXQ5Z.js.map +0 -1
- package/dist/providers/utils-L6CFHW4B.js +0 -2
- package/dist/providers/utils-L6CFHW4B.js.map +0 -1
- package/dist/solana-2MXIY6UT.js +0 -2
- package/dist/solana-EV65GS7Q.js +0 -2
- package/dist/solana-EV65GS7Q.js.map +0 -1
- package/dist/utils-72MDY3OH.js +0 -2
package/dist/solana/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkDYDY3FCT_cjs=require('../chunk-DYDY3FCT.cjs');Object.defineProperty(exports,"getAvailableSolanaClusters",{enumerable:true,get:function(){return chunkDYDY3FCT_cjs.c}});Object.defineProperty(exports,"getSolanaClusters",{enumerable:true,get:function(){return chunkDYDY3FCT_cjs.a}});Object.defineProperty(exports,"isSolanaChainList",{enumerable:true,get:function(){return chunkDYDY3FCT_cjs.b}});Object.defineProperty(exports,"isValidSolanaCluster",{enumerable:true,get:function(){return chunkDYDY3FCT_cjs.d}});//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SolanaClusterMoniker } from 'gill';
|
|
2
|
+
export { SolanaClusterMoniker } from 'gill';
|
|
3
|
+
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
4
|
+
import { SolanaWallet, ConnectorSolana } from '@tuwaio/satellite-solana';
|
|
5
|
+
import { a as ChainIdentifierArray } from '../types-C0Vlrba-.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get Solana clusters from configuration
|
|
9
|
+
*/
|
|
10
|
+
declare function getSolanaClusters(solanaRPCUrls?: Partial<Record<SolanaClusterMoniker, string>>, chains?: ChainIdentifierArray): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Type guard to check if a chain list contains Solana cluster names
|
|
13
|
+
*/
|
|
14
|
+
declare function isSolanaChainList(chains: (string | number)[]): chains is string[];
|
|
15
|
+
/**
|
|
16
|
+
* Gets available Solana clusters from the default configuration
|
|
17
|
+
*/
|
|
18
|
+
declare function getAvailableSolanaClusters(): SolanaClusterMoniker[];
|
|
19
|
+
/**
|
|
20
|
+
* Validates if a string is a valid Solana cluster moniker
|
|
21
|
+
*/
|
|
22
|
+
declare function isValidSolanaCluster(cluster: string): cluster is SolanaClusterMoniker;
|
|
23
|
+
|
|
24
|
+
declare module '@tuwaio/nova-connect' {
|
|
25
|
+
interface AllChainConfigs {
|
|
26
|
+
/**
|
|
27
|
+
* Solana RPC URLs configuration - enhanced from default any type
|
|
28
|
+
* @override Replaces default `any` with specific SolanaClusterMoniker typing when gill is available
|
|
29
|
+
*/
|
|
30
|
+
solanaRPCUrls?: Partial<Record<SolanaClusterMoniker, string>>;
|
|
31
|
+
}
|
|
32
|
+
interface AllWallets {
|
|
33
|
+
[OrbitAdapter.SOLANA]: SolanaWallet;
|
|
34
|
+
}
|
|
35
|
+
interface AllConnectors {
|
|
36
|
+
[OrbitAdapter.SOLANA]: ConnectorSolana;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { getAvailableSolanaClusters, getSolanaClusters, isSolanaChainList, isValidSolanaCluster };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SolanaClusterMoniker } from 'gill';
|
|
2
|
+
export { SolanaClusterMoniker } from 'gill';
|
|
3
|
+
import { OrbitAdapter } from '@tuwaio/orbit-core';
|
|
4
|
+
import { SolanaWallet, ConnectorSolana } from '@tuwaio/satellite-solana';
|
|
5
|
+
import { a as ChainIdentifierArray } from '../types-C0Vlrba-.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get Solana clusters from configuration
|
|
9
|
+
*/
|
|
10
|
+
declare function getSolanaClusters(solanaRPCUrls?: Partial<Record<SolanaClusterMoniker, string>>, chains?: ChainIdentifierArray): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Type guard to check if a chain list contains Solana cluster names
|
|
13
|
+
*/
|
|
14
|
+
declare function isSolanaChainList(chains: (string | number)[]): chains is string[];
|
|
15
|
+
/**
|
|
16
|
+
* Gets available Solana clusters from the default configuration
|
|
17
|
+
*/
|
|
18
|
+
declare function getAvailableSolanaClusters(): SolanaClusterMoniker[];
|
|
19
|
+
/**
|
|
20
|
+
* Validates if a string is a valid Solana cluster moniker
|
|
21
|
+
*/
|
|
22
|
+
declare function isValidSolanaCluster(cluster: string): cluster is SolanaClusterMoniker;
|
|
23
|
+
|
|
24
|
+
declare module '@tuwaio/nova-connect' {
|
|
25
|
+
interface AllChainConfigs {
|
|
26
|
+
/**
|
|
27
|
+
* Solana RPC URLs configuration - enhanced from default any type
|
|
28
|
+
* @override Replaces default `any` with specific SolanaClusterMoniker typing when gill is available
|
|
29
|
+
*/
|
|
30
|
+
solanaRPCUrls?: Partial<Record<SolanaClusterMoniker, string>>;
|
|
31
|
+
}
|
|
32
|
+
interface AllWallets {
|
|
33
|
+
[OrbitAdapter.SOLANA]: SolanaWallet;
|
|
34
|
+
}
|
|
35
|
+
interface AllConnectors {
|
|
36
|
+
[OrbitAdapter.SOLANA]: ConnectorSolana;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { getAvailableSolanaClusters, getSolanaClusters, isSolanaChainList, isValidSolanaCluster };
|
package/dist/solana/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export{c as getAvailableSolanaClusters,a as getSolanaClusters,b as isSolanaChainList,d as isValidSolanaCluster}from'../chunk-J4TY3CJF.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/solana/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
async function n(){try{return await import('./utils-
|
|
2
|
-
//# sourceMappingURL=solana-
|
|
1
|
+
async function n(){try{return await import('./utils-SUIRQJIA.js')}catch(a){return console.warn("Solana utilities not available:",a),null}}async function r(){let a=await n();return {getChains(t,e){return a?.getSolanaClusters?a.getSolanaClusters(t,e):t&&typeof t=="object"?Object.keys(t):[]},isChainList(t){return a?.isSolanaChainList?a.isSolanaChainList(t):t.length>0&&t.every(e=>typeof e=="string")},getAvailableClusters(){return a?.getAvailableSolanaClusters?a.getAvailableSolanaClusters():[]},isValidCluster(t){return a?.isValidSolanaCluster?a.isValidSolanaCluster(t):false}}}async function l(){try{return await import('./utils-SUIRQJIA.js'),!0}catch{return false}}export{r as createSolanaAdapter,l as isSolanaAdapterAvailable};//# sourceMappingURL=solana-GLHHYZDQ.js.map
|
|
2
|
+
//# sourceMappingURL=solana-GLHHYZDQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/adapters/solana.ts"],"names":["getSolanaUtils","error","createSolanaAdapter","solanaUtils","solanaRPCUrls","chains","chain","cluster","isSolanaAdapterAvailable"],"mappings":"AAiCA,eAAeA,CAAAA,EAAoD,CACjE,GAAI,CAGF,OADoB,MAAM,OAAO,qBAAoB,CAEvD,CAAA,MAASC,CAAAA,CAAO,CACd,eAAQ,IAAA,CAAK,iCAAA,CAAmCA,CAAK,CAAA,CAC9C,IACT,CACF,CAiCA,eAAsBC,CAAAA,EAA6C,CACjE,IAAMC,CAAAA,CAAc,MAAMH,CAAAA,GAE1B,OAAO,CAQL,SAAA,CAAUI,CAAAA,CAAoBC,CAAAA,CAAmC,CAE/D,OAAIF,CAAAA,EAAa,iBAAA,CACRA,CAAAA,CAAY,iBAAA,CAAkBC,CAAAA,CAAeC,CAAM,EAIxDD,CAAAA,EAAiB,OAAOA,CAAAA,EAAkB,QAAA,CACrC,MAAA,CAAO,IAAA,CAAKA,CAAa,CAAA,CAE3B,EACT,CAAA,CASA,WAAA,CAAYC,CAAAA,CAAsC,CAChD,OAAIF,CAAAA,EAAa,iBAAA,CACRA,CAAAA,CAAY,iBAAA,CAAkBE,CAAM,CAAA,CAItCA,EAAO,MAAA,CAAS,CAAA,EAAKA,CAAAA,CAAO,KAAA,CAAOC,CAAAA,EAAU,OAAOA,GAAU,QAAQ,CAC/E,CAAA,CAcA,oBAAA,EAAiC,CAC/B,OAAIH,CAAAA,EAAa,0BAAA,CACRA,CAAAA,CAAY,0BAAA,EAA2B,CAEzC,EACT,CAAA,CAkBA,eAAeI,CAAAA,CAA0B,CACvC,OAAIJ,CAAAA,EAAa,oBAAA,CACRA,CAAAA,CAAY,oBAAA,CAAqBI,CAAO,CAAA,CAE1C,KACT,CACF,CACF,CAuBA,eAAsBC,GAA6C,CACjE,GAAI,CACF,OAAA,MAAM,OAAO,qBAAoB,CAAA,CAC1B,CAAA,CACT,CAAA,KAAQ,CACN,OAAO,MACT,CACF","file":"solana-
|
|
1
|
+
{"version":3,"sources":["../src/utils/adapters/solana.ts"],"names":["getSolanaUtils","error","createSolanaAdapter","solanaUtils","solanaRPCUrls","chains","chain","cluster","isSolanaAdapterAvailable"],"mappings":"AAiCA,eAAeA,CAAAA,EAAoD,CACjE,GAAI,CAGF,OADoB,MAAM,OAAO,qBAAoB,CAEvD,CAAA,MAASC,CAAAA,CAAO,CACd,eAAQ,IAAA,CAAK,iCAAA,CAAmCA,CAAK,CAAA,CAC9C,IACT,CACF,CAiCA,eAAsBC,CAAAA,EAA6C,CACjE,IAAMC,CAAAA,CAAc,MAAMH,CAAAA,GAE1B,OAAO,CAQL,SAAA,CAAUI,CAAAA,CAAoBC,CAAAA,CAAmC,CAE/D,OAAIF,CAAAA,EAAa,iBAAA,CACRA,CAAAA,CAAY,iBAAA,CAAkBC,CAAAA,CAAeC,CAAM,EAIxDD,CAAAA,EAAiB,OAAOA,CAAAA,EAAkB,QAAA,CACrC,MAAA,CAAO,IAAA,CAAKA,CAAa,CAAA,CAE3B,EACT,CAAA,CASA,WAAA,CAAYC,CAAAA,CAAsC,CAChD,OAAIF,CAAAA,EAAa,iBAAA,CACRA,CAAAA,CAAY,iBAAA,CAAkBE,CAAM,CAAA,CAItCA,EAAO,MAAA,CAAS,CAAA,EAAKA,CAAAA,CAAO,KAAA,CAAOC,CAAAA,EAAU,OAAOA,GAAU,QAAQ,CAC/E,CAAA,CAcA,oBAAA,EAAiC,CAC/B,OAAIH,CAAAA,EAAa,0BAAA,CACRA,CAAAA,CAAY,0BAAA,EAA2B,CAEzC,EACT,CAAA,CAkBA,eAAeI,CAAAA,CAA0B,CACvC,OAAIJ,CAAAA,EAAa,oBAAA,CACRA,CAAAA,CAAY,oBAAA,CAAqBI,CAAO,CAAA,CAE1C,KACT,CACF,CACF,CAuBA,eAAsBC,GAA6C,CACjE,GAAI,CACF,OAAA,MAAM,OAAO,qBAAoB,CAAA,CAC1B,CAAA,CACT,CAAA,KAAQ,CACN,OAAO,MACT,CACF","file":"solana-GLHHYZDQ.js","sourcesContent":["import type { ChainAdapter } from './types';\n\n/**\n * Solana utilities module interface for dynamic imports.\n *\n * @internal\n * @since 1.0.0\n */\ninterface SolanaUtilsModule {\n getSolanaClusters?: (solanaRPCUrls: any, chains?: any) => string[];\n isSolanaChainList?: (chains: (string | number)[]) => boolean;\n getAvailableSolanaClusters?: () => string[];\n isValidSolanaCluster?: (cluster: string) => boolean;\n}\n\n/**\n * Dynamically imports and checks availability of Solana utilities.\n * This function attempts to load Solana-specific utilities without throwing errors\n * if the Solana package is not installed in the current environment.\n *\n * @internal\n * @returns Promise resolving to Solana utilities module or null if not available\n *\n * @example\n * ```typescript\n * const solanaUtils = await getSolanaUtils();\n * if (solanaUtils?.getSolanaClusters) {\n * const clusters = solanaUtils.getSolanaClusters(rpcUrls);\n * }\n * ```\n *\n * @since 1.0.0\n */\nasync function getSolanaUtils(): Promise<SolanaUtilsModule | null> {\n try {\n // Dynamic import of Solana utilities - fails gracefully if package not installed\n const solanaUtils = await import('../../solana/utils');\n return solanaUtils;\n } catch (error) {\n console.warn('Solana utilities not available:', error);\n return null;\n }\n}\n\n/**\n * Creates a Solana chain adapter with dynamic loading and fallback support.\n *\n * This adapter provides Solana-specific functionality while gracefully handling\n * environments where Solana utilities are not available. It includes Solana-specific\n * methods like cluster management that are unique to the Solana blockchain architecture.\n *\n * @returns Promise resolving to a configured Solana ChainAdapter\n *\n * @example\n * ```typescript\n * const adapter = await createSolanaAdapter();\n *\n * // Get Solana cluster names from RPC configuration\n * const clusters = adapter.getChains({\n * 'mainnet-beta': 'https://api.mainnet-beta.solana.com',\n * devnet: 'https://api.devnet.solana.com'\n * });\n * console.log(clusters); // ['mainnet-beta', 'devnet']\n *\n * // Validate cluster list format\n * const isValid = adapter.isChainList(['mainnet-beta', 'devnet']);\n * console.log(isValid); // true (string identifiers are valid for Solana)\n *\n * // Get available clusters\n * const availableClusters = adapter.getAvailableClusters?.();\n * console.log(availableClusters); // All configured cluster names\n * ```\n *\n * @since 1.0.0\n */\nexport async function createSolanaAdapter(): Promise<ChainAdapter> {\n const solanaUtils = await getSolanaUtils();\n\n return {\n /**\n * Extracts cluster names from Solana RPC URL configuration.\n *\n * @param solanaRPCUrls Object mapping cluster names to RPC URLs\n * @param chains Optional array of specific chains to filter\n * @returns Array of cluster names (strings)\n */\n getChains(solanaRPCUrls: any, chains?: any): (string | number)[] {\n // Use imported Solana utilities if available\n if (solanaUtils?.getSolanaClusters) {\n return solanaUtils.getSolanaClusters(solanaRPCUrls, chains);\n }\n\n // Fallback implementation for basic cluster extraction\n if (solanaRPCUrls && typeof solanaRPCUrls === 'object') {\n return Object.keys(solanaRPCUrls);\n }\n return [];\n },\n\n /**\n * Validates whether the provided chains list conforms to Solana cluster format.\n * Solana clusters are typically identified by string names like 'mainnet-beta', 'devnet'.\n *\n * @param chains Array of chain identifiers to validate\n * @returns True if the chain list is valid for Solana\n */\n isChainList(chains: (string | number)[]): boolean {\n if (solanaUtils?.isSolanaChainList) {\n return solanaUtils.isSolanaChainList(chains);\n }\n\n // Fallback validation: Solana clusters should be strings\n return chains.length > 0 && chains.every((chain) => typeof chain === 'string');\n },\n\n /**\n * Gets all available Solana clusters from the current configuration.\n * This is a Solana-specific method that returns cluster names that can be used.\n *\n * @returns Array of available cluster names\n *\n * @example\n * ```typescript\n * const clusters = adapter.getAvailableClusters?.();\n * // Might return: ['mainnet-beta', 'devnet', 'testnet']\n * ```\n */\n getAvailableClusters(): string[] {\n if (solanaUtils?.getAvailableSolanaClusters) {\n return solanaUtils.getAvailableSolanaClusters();\n }\n return [];\n },\n\n /**\n * Validates whether a cluster name is valid for Solana.\n * Checks against known Solana cluster monikers and custom configurations.\n *\n * @param cluster Cluster name to validate\n * @returns True if the cluster name is valid\n *\n * @example\n * ```typescript\n * const isValid = adapter.isValidCluster?.('mainnet-beta');\n * console.log(isValid); // true\n *\n * const isInvalid = adapter.isValidCluster?.('invalid-cluster');\n * console.log(isInvalid); // false\n * ```\n */\n isValidCluster(cluster: string): boolean {\n if (solanaUtils?.isValidSolanaCluster) {\n return solanaUtils.isValidSolanaCluster(cluster);\n }\n return false;\n },\n };\n}\n\n/**\n * Checks if the Solana adapter can be created in the current environment.\n * This function verifies that the required Solana utilities are available\n * by attempting to import them.\n *\n * @returns Promise resolving to true if Solana adapter is available\n *\n * @example\n * ```typescript\n * const hasSolana = await isSolanaAdapterAvailable();\n * if (hasSolana) {\n * const adapter = await createSolanaAdapter();\n * // Use Solana functionality\n * const clusters = adapter.getAvailableClusters?.();\n * } else {\n * console.log('Solana support not available in this build');\n * }\n * ```\n *\n * @since 1.0.0\n */\nexport async function isSolanaAdapterAvailable(): Promise<boolean> {\n try {\n await import('../../solana/utils');\n return true;\n } catch {\n return false;\n }\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';async function n(){try{return await import('./utils-H5O25MTI.cjs')}catch(a){return console.warn("Solana utilities not available:",a),null}}async function r(){let a=await n();return {getChains(t,e){return a?.getSolanaClusters?a.getSolanaClusters(t,e):t&&typeof t=="object"?Object.keys(t):[]},isChainList(t){return a?.isSolanaChainList?a.isSolanaChainList(t):t.length>0&&t.every(e=>typeof e=="string")},getAvailableClusters(){return a?.getAvailableSolanaClusters?a.getAvailableSolanaClusters():[]},isValidCluster(t){return a?.isValidSolanaCluster?a.isValidSolanaCluster(t):false}}}async function l(){try{return await import('./utils-H5O25MTI.cjs'),!0}catch{return false}}exports.createSolanaAdapter=r;exports.isSolanaAdapterAvailable=l;//# sourceMappingURL=solana-JUU54KQ3.cjs.map
|
|
2
|
+
//# sourceMappingURL=solana-JUU54KQ3.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/adapters/solana.ts"],"names":["getSolanaUtils","error","createSolanaAdapter","solanaUtils","solanaRPCUrls","chains","chain","cluster","isSolanaAdapterAvailable"],"mappings":"aAiCA,eAAeA,CAAAA,EAAoD,CACjE,GAAI,CAGF,OADoB,MAAM,OAAO,sBAAoB,CAEvD,CAAA,MAASC,CAAAA,CAAO,CACd,eAAQ,IAAA,CAAK,iCAAA,CAAmCA,CAAK,CAAA,CAC9C,IACT,CACF,CAiCA,eAAsBC,CAAAA,EAA6C,CACjE,IAAMC,CAAAA,CAAc,MAAMH,CAAAA,GAE1B,OAAO,CAQL,SAAA,CAAUI,CAAAA,CAAoBC,CAAAA,CAAmC,CAE/D,OAAIF,CAAAA,EAAa,iBAAA,CACRA,CAAAA,CAAY,iBAAA,CAAkBC,CAAAA,CAAeC,CAAM,EAIxDD,CAAAA,EAAiB,OAAOA,CAAAA,EAAkB,QAAA,CACrC,MAAA,CAAO,IAAA,CAAKA,CAAa,CAAA,CAE3B,EACT,CAAA,CASA,WAAA,CAAYC,CAAAA,CAAsC,CAChD,OAAIF,CAAAA,EAAa,iBAAA,CACRA,CAAAA,CAAY,iBAAA,CAAkBE,CAAM,CAAA,CAItCA,EAAO,MAAA,CAAS,CAAA,EAAKA,CAAAA,CAAO,KAAA,CAAOC,CAAAA,EAAU,OAAOA,GAAU,QAAQ,CAC/E,CAAA,CAcA,oBAAA,EAAiC,CAC/B,OAAIH,CAAAA,EAAa,0BAAA,CACRA,CAAAA,CAAY,0BAAA,EAA2B,CAEzC,EACT,CAAA,CAkBA,eAAeI,CAAAA,CAA0B,CACvC,OAAIJ,CAAAA,EAAa,oBAAA,CACRA,CAAAA,CAAY,oBAAA,CAAqBI,CAAO,CAAA,CAE1C,KACT,CACF,CACF,CAuBA,eAAsBC,GAA6C,CACjE,GAAI,CACF,OAAA,MAAM,OAAO,sBAAoB,CAAA,CAC1B,CAAA,CACT,CAAA,KAAQ,CACN,OAAO,MACT,CACF","file":"solana-JUU54KQ3.cjs","sourcesContent":["import type { ChainAdapter } from './types';\n\n/**\n * Solana utilities module interface for dynamic imports.\n *\n * @internal\n * @since 1.0.0\n */\ninterface SolanaUtilsModule {\n getSolanaClusters?: (solanaRPCUrls: any, chains?: any) => string[];\n isSolanaChainList?: (chains: (string | number)[]) => boolean;\n getAvailableSolanaClusters?: () => string[];\n isValidSolanaCluster?: (cluster: string) => boolean;\n}\n\n/**\n * Dynamically imports and checks availability of Solana utilities.\n * This function attempts to load Solana-specific utilities without throwing errors\n * if the Solana package is not installed in the current environment.\n *\n * @internal\n * @returns Promise resolving to Solana utilities module or null if not available\n *\n * @example\n * ```typescript\n * const solanaUtils = await getSolanaUtils();\n * if (solanaUtils?.getSolanaClusters) {\n * const clusters = solanaUtils.getSolanaClusters(rpcUrls);\n * }\n * ```\n *\n * @since 1.0.0\n */\nasync function getSolanaUtils(): Promise<SolanaUtilsModule | null> {\n try {\n // Dynamic import of Solana utilities - fails gracefully if package not installed\n const solanaUtils = await import('../../solana/utils');\n return solanaUtils;\n } catch (error) {\n console.warn('Solana utilities not available:', error);\n return null;\n }\n}\n\n/**\n * Creates a Solana chain adapter with dynamic loading and fallback support.\n *\n * This adapter provides Solana-specific functionality while gracefully handling\n * environments where Solana utilities are not available. It includes Solana-specific\n * methods like cluster management that are unique to the Solana blockchain architecture.\n *\n * @returns Promise resolving to a configured Solana ChainAdapter\n *\n * @example\n * ```typescript\n * const adapter = await createSolanaAdapter();\n *\n * // Get Solana cluster names from RPC configuration\n * const clusters = adapter.getChains({\n * 'mainnet-beta': 'https://api.mainnet-beta.solana.com',\n * devnet: 'https://api.devnet.solana.com'\n * });\n * console.log(clusters); // ['mainnet-beta', 'devnet']\n *\n * // Validate cluster list format\n * const isValid = adapter.isChainList(['mainnet-beta', 'devnet']);\n * console.log(isValid); // true (string identifiers are valid for Solana)\n *\n * // Get available clusters\n * const availableClusters = adapter.getAvailableClusters?.();\n * console.log(availableClusters); // All configured cluster names\n * ```\n *\n * @since 1.0.0\n */\nexport async function createSolanaAdapter(): Promise<ChainAdapter> {\n const solanaUtils = await getSolanaUtils();\n\n return {\n /**\n * Extracts cluster names from Solana RPC URL configuration.\n *\n * @param solanaRPCUrls Object mapping cluster names to RPC URLs\n * @param chains Optional array of specific chains to filter\n * @returns Array of cluster names (strings)\n */\n getChains(solanaRPCUrls: any, chains?: any): (string | number)[] {\n // Use imported Solana utilities if available\n if (solanaUtils?.getSolanaClusters) {\n return solanaUtils.getSolanaClusters(solanaRPCUrls, chains);\n }\n\n // Fallback implementation for basic cluster extraction\n if (solanaRPCUrls && typeof solanaRPCUrls === 'object') {\n return Object.keys(solanaRPCUrls);\n }\n return [];\n },\n\n /**\n * Validates whether the provided chains list conforms to Solana cluster format.\n * Solana clusters are typically identified by string names like 'mainnet-beta', 'devnet'.\n *\n * @param chains Array of chain identifiers to validate\n * @returns True if the chain list is valid for Solana\n */\n isChainList(chains: (string | number)[]): boolean {\n if (solanaUtils?.isSolanaChainList) {\n return solanaUtils.isSolanaChainList(chains);\n }\n\n // Fallback validation: Solana clusters should be strings\n return chains.length > 0 && chains.every((chain) => typeof chain === 'string');\n },\n\n /**\n * Gets all available Solana clusters from the current configuration.\n * This is a Solana-specific method that returns cluster names that can be used.\n *\n * @returns Array of available cluster names\n *\n * @example\n * ```typescript\n * const clusters = adapter.getAvailableClusters?.();\n * // Might return: ['mainnet-beta', 'devnet', 'testnet']\n * ```\n */\n getAvailableClusters(): string[] {\n if (solanaUtils?.getAvailableSolanaClusters) {\n return solanaUtils.getAvailableSolanaClusters();\n }\n return [];\n },\n\n /**\n * Validates whether a cluster name is valid for Solana.\n * Checks against known Solana cluster monikers and custom configurations.\n *\n * @param cluster Cluster name to validate\n * @returns True if the cluster name is valid\n *\n * @example\n * ```typescript\n * const isValid = adapter.isValidCluster?.('mainnet-beta');\n * console.log(isValid); // true\n *\n * const isInvalid = adapter.isValidCluster?.('invalid-cluster');\n * console.log(isInvalid); // false\n * ```\n */\n isValidCluster(cluster: string): boolean {\n if (solanaUtils?.isValidSolanaCluster) {\n return solanaUtils.isValidSolanaCluster(cluster);\n }\n return false;\n },\n };\n}\n\n/**\n * Checks if the Solana adapter can be created in the current environment.\n * This function verifies that the required Solana utilities are available\n * by attempting to import them.\n *\n * @returns Promise resolving to true if Solana adapter is available\n *\n * @example\n * ```typescript\n * const hasSolana = await isSolanaAdapterAvailable();\n * if (hasSolana) {\n * const adapter = await createSolanaAdapter();\n * // Use Solana functionality\n * const clusters = adapter.getAvailableClusters?.();\n * } else {\n * console.log('Solana support not available in this build');\n * }\n * ```\n *\n * @since 1.0.0\n */\nexport async function isSolanaAdapterAvailable(): Promise<boolean> {\n try {\n await import('../../solana/utils');\n return true;\n } catch {\n return false;\n }\n}\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* This interface provides default fallback types for chain configurations.
|
|
4
|
+
* Chain-specific packages will use module augmentation to override these
|
|
5
|
+
* with more specific types while maintaining backward compatibility.
|
|
6
|
+
*
|
|
7
|
+
* Default values are `any` to ensure the system works without specific
|
|
8
|
+
* chain packages, but gets enhanced type safety when they are installed.
|
|
9
|
+
*/
|
|
10
|
+
interface AllChainConfigs {
|
|
11
|
+
/**
|
|
12
|
+
* App chains configuration - defaults to any, gets enhanced by chain-specific packages
|
|
13
|
+
* @default any - Will be typed as `readonly [Chain, ...Chain[]]` when viem is available
|
|
14
|
+
*/
|
|
15
|
+
appChains?: any;
|
|
16
|
+
/**
|
|
17
|
+
* Solana RPC URLs configuration - defaults to any, gets enhanced by Solana packages
|
|
18
|
+
* @default any - Will be typed as `Partial<Record<SolanaClusterMoniker, string>>` when gill is available
|
|
19
|
+
*/
|
|
20
|
+
solanaRPCUrls?: any;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Union type for all supported chain configurations.
|
|
24
|
+
* Gets automatically extended when packages augment AllChainConfigs.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // Without specific packages - uses any types
|
|
29
|
+
* const config: InitialChains = {
|
|
30
|
+
* appChains: [], // any
|
|
31
|
+
* solanaRPCUrls: {} // any
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* // With viem package installed - gets proper Chain[] typing
|
|
35
|
+
* // With gill package installed - gets proper SolanaClusterMoniker typing
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
type InitialChains = AllChainConfigs;
|
|
39
|
+
/**
|
|
40
|
+
* Array of chain identifiers (replaces IdentifierArray from @wallet-standard/base)
|
|
41
|
+
* Can contain strings, numbers, or other primitive types
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const chainIds: ChainIdentifierArray = ['ethereum', 1, 'solana:mainnet-beta'];
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
type ChainIdentifierArray = readonly (string | number)[];
|
|
49
|
+
/**
|
|
50
|
+
* @description
|
|
51
|
+
* This interface is intentionally left empty.
|
|
52
|
+
* Other packages (@tuwaio/satellite-*) will use module
|
|
53
|
+
* augmentation to add their specific wallet types here.
|
|
54
|
+
*/
|
|
55
|
+
interface AllWallets {
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @description
|
|
59
|
+
* This interface is intentionally left empty.
|
|
60
|
+
* It will be augmented by satellite packages.
|
|
61
|
+
*/
|
|
62
|
+
interface AllConnectors {
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Union type for all supported wallet types.
|
|
66
|
+
* It's created from the values of the AllWallets interface.
|
|
67
|
+
* e.g., { evm: EVMWallet, solana: SolanaWallet } -> EVMWallet | SolanaWallet
|
|
68
|
+
*/
|
|
69
|
+
type Wallet = AllWallets[keyof AllWallets];
|
|
70
|
+
/**
|
|
71
|
+
* Union type for all supported connector types.
|
|
72
|
+
*/
|
|
73
|
+
type Connector = AllConnectors[keyof AllConnectors];
|
|
74
|
+
|
|
75
|
+
export type { AllChainConfigs as A, Connector as C, InitialChains as I, Wallet as W, ChainIdentifierArray as a, AllConnectors as b, AllWallets as c };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* This interface provides default fallback types for chain configurations.
|
|
4
|
+
* Chain-specific packages will use module augmentation to override these
|
|
5
|
+
* with more specific types while maintaining backward compatibility.
|
|
6
|
+
*
|
|
7
|
+
* Default values are `any` to ensure the system works without specific
|
|
8
|
+
* chain packages, but gets enhanced type safety when they are installed.
|
|
9
|
+
*/
|
|
10
|
+
interface AllChainConfigs {
|
|
11
|
+
/**
|
|
12
|
+
* App chains configuration - defaults to any, gets enhanced by chain-specific packages
|
|
13
|
+
* @default any - Will be typed as `readonly [Chain, ...Chain[]]` when viem is available
|
|
14
|
+
*/
|
|
15
|
+
appChains?: any;
|
|
16
|
+
/**
|
|
17
|
+
* Solana RPC URLs configuration - defaults to any, gets enhanced by Solana packages
|
|
18
|
+
* @default any - Will be typed as `Partial<Record<SolanaClusterMoniker, string>>` when gill is available
|
|
19
|
+
*/
|
|
20
|
+
solanaRPCUrls?: any;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Union type for all supported chain configurations.
|
|
24
|
+
* Gets automatically extended when packages augment AllChainConfigs.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // Without specific packages - uses any types
|
|
29
|
+
* const config: InitialChains = {
|
|
30
|
+
* appChains: [], // any
|
|
31
|
+
* solanaRPCUrls: {} // any
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* // With viem package installed - gets proper Chain[] typing
|
|
35
|
+
* // With gill package installed - gets proper SolanaClusterMoniker typing
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
type InitialChains = AllChainConfigs;
|
|
39
|
+
/**
|
|
40
|
+
* Array of chain identifiers (replaces IdentifierArray from @wallet-standard/base)
|
|
41
|
+
* Can contain strings, numbers, or other primitive types
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const chainIds: ChainIdentifierArray = ['ethereum', 1, 'solana:mainnet-beta'];
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
type ChainIdentifierArray = readonly (string | number)[];
|
|
49
|
+
/**
|
|
50
|
+
* @description
|
|
51
|
+
* This interface is intentionally left empty.
|
|
52
|
+
* Other packages (@tuwaio/satellite-*) will use module
|
|
53
|
+
* augmentation to add their specific wallet types here.
|
|
54
|
+
*/
|
|
55
|
+
interface AllWallets {
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @description
|
|
59
|
+
* This interface is intentionally left empty.
|
|
60
|
+
* It will be augmented by satellite packages.
|
|
61
|
+
*/
|
|
62
|
+
interface AllConnectors {
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Union type for all supported wallet types.
|
|
66
|
+
* It's created from the values of the AllWallets interface.
|
|
67
|
+
* e.g., { evm: EVMWallet, solana: SolanaWallet } -> EVMWallet | SolanaWallet
|
|
68
|
+
*/
|
|
69
|
+
type Wallet = AllWallets[keyof AllWallets];
|
|
70
|
+
/**
|
|
71
|
+
* Union type for all supported connector types.
|
|
72
|
+
*/
|
|
73
|
+
type Connector = AllConnectors[keyof AllConnectors];
|
|
74
|
+
|
|
75
|
+
export type { AllChainConfigs as A, Connector as C, InitialChains as I, Wallet as W, ChainIdentifierArray as a, AllConnectors as b, AllWallets as c };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkCEGEQMI2_cjs=require('./chunk-CEGEQMI2.cjs');Object.defineProperty(exports,"getEvmChains",{enumerable:true,get:function(){return chunkCEGEQMI2_cjs.a}});Object.defineProperty(exports,"isEvmChainList",{enumerable:true,get:function(){return chunkCEGEQMI2_cjs.b}});//# sourceMappingURL=utils-DZB4ZTS4.cjs.map
|
|
2
|
+
//# sourceMappingURL=utils-DZB4ZTS4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"utils-DZB4ZTS4.cjs"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkDYDY3FCT_cjs=require('./chunk-DYDY3FCT.cjs');Object.defineProperty(exports,"getAvailableSolanaClusters",{enumerable:true,get:function(){return chunkDYDY3FCT_cjs.c}});Object.defineProperty(exports,"getSolanaClusters",{enumerable:true,get:function(){return chunkDYDY3FCT_cjs.a}});Object.defineProperty(exports,"isSolanaChainList",{enumerable:true,get:function(){return chunkDYDY3FCT_cjs.b}});Object.defineProperty(exports,"isValidSolanaCluster",{enumerable:true,get:function(){return chunkDYDY3FCT_cjs.d}});//# sourceMappingURL=utils-H5O25MTI.cjs.map
|
|
2
|
+
//# sourceMappingURL=utils-H5O25MTI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"utils-H5O25MTI.cjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"utils-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"utils-SUIRQJIA.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuwaio/nova-connect",
|
|
3
|
-
"version": "1.0.0-fix-test-alpha.
|
|
3
|
+
"version": "1.0.0-fix-test-alpha.3.f49cad1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -15,11 +15,6 @@
|
|
|
15
15
|
"import": "./dist/index.cjs",
|
|
16
16
|
"default": "./dist/index.js"
|
|
17
17
|
},
|
|
18
|
-
"./providers": {
|
|
19
|
-
"types": "./dist/providers/index.d.ts",
|
|
20
|
-
"import": "./dist/providers/index.cjs",
|
|
21
|
-
"default": "./dist/providers/index.js"
|
|
22
|
-
},
|
|
23
18
|
"./evm": {
|
|
24
19
|
"types": "./dist/evm/index.d.ts",
|
|
25
20
|
"import": "./dist/evm/index.cjs",
|
|
@@ -191,7 +186,7 @@
|
|
|
191
186
|
"@tuwaio/orbit-solana": "^0.1.0",
|
|
192
187
|
"@tuwaio/satellite-core": "^0.1.0",
|
|
193
188
|
"@tuwaio/satellite-evm": "^0.1.0",
|
|
194
|
-
"@tuwaio/satellite-react": "
|
|
189
|
+
"@tuwaio/satellite-react": "1.0.0-fix-watchers-alpha.1.39245f5",
|
|
195
190
|
"@tuwaio/satellite-solana": "^0.1.0",
|
|
196
191
|
"@tuwaio/pulsar-core": "^0.2.0",
|
|
197
192
|
"@wallet-standard/react": "^1.0.1",
|
|
@@ -219,8 +214,8 @@
|
|
|
219
214
|
"tw-animate-css": "^1.4.0",
|
|
220
215
|
"typescript": "^5.9.3",
|
|
221
216
|
"tsup": "^8.5.0",
|
|
222
|
-
"@tuwaio/nova-core": "^1.0.0-fix-test-alpha.
|
|
223
|
-
"@tuwaio/nova-transactions": "^1.0.0-fix-test-alpha.
|
|
217
|
+
"@tuwaio/nova-core": "^1.0.0-fix-test-alpha.3.f49cad1",
|
|
218
|
+
"@tuwaio/nova-transactions": "^1.0.0-fix-test-alpha.3.f49cad1"
|
|
224
219
|
},
|
|
225
220
|
"scripts": {
|
|
226
221
|
"start": "tsup src/index.ts --watch",
|
package/dist/evm-F7OJEDX3.js
DELETED
package/dist/evm-F7OJEDX3.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"evm-F7OJEDX3.js"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
async function n(){try{return await import('./utils-L6CFHW4B.js')}catch(r){return console.warn("EVM utilities not available:",r),null}}async function i(){let r=await n();return {getChains(e){return r?.getEvmChains?r.getEvmChains(e):!Array.isArray(e)||e.length===0?[]:e.map(t=>typeof t=="object"&&t?.id!==void 0?t.id:typeof t=="number"||typeof t=="string"?t:null).filter(t=>t!==null&&(typeof t=="string"||typeof t=="number"))},isChainList(e){return r?.isEvmChainList?r.isEvmChainList(e):e.length>0&&e.every(t=>typeof t=="number")}}}async function s(){try{return await import('./utils-L6CFHW4B.js'),!0}catch{return false}}export{i as createEvmAdapter,s as isEvmAdapterAvailable};//# sourceMappingURL=evm-5323YCLC.js.map
|
|
2
|
-
//# sourceMappingURL=evm-5323YCLC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/adapters/evm.ts"],"names":["getEvmUtils","error","createEvmAdapter","evmUtils","appChains","chain","id","chains","isEvmAdapterAvailable"],"mappings":"AA+BA,eAAeA,CAAAA,EAA8C,CAC3D,GAAI,CAGF,OADiB,MAAM,OAAO,qBAAiB,CAEjD,CAAA,MAASC,CAAAA,CAAO,CACd,OAAA,OAAA,CAAQ,KAAK,8BAAA,CAAgCA,CAAK,CAAA,CAC3C,IACT,CACF,CA6BA,eAAsBC,CAAAA,EAA0C,CAC9D,IAAMC,CAAAA,CAAW,MAAMH,CAAAA,EAAY,CAEnC,OAAO,CAOL,SAAA,CAAUI,CAAAA,CAAqC,CAE7C,OAAID,CAAAA,EAAU,YAAA,CACLA,CAAAA,CAAS,YAAA,CAAaC,CAAS,CAAA,CAIpC,CAAC,KAAA,CAAM,OAAA,CAAQA,CAAS,CAAA,EAAKA,CAAAA,CAAU,MAAA,GAAW,CAAA,CAC7C,EAAC,CAGHA,CAAAA,CACJ,GAAA,CAAKC,CAAAA,EAEA,OAAOA,CAAAA,EAAU,QAAA,EAAYA,CAAAA,EAAO,EAAA,GAAO,MAAA,CACtCA,EAAM,EAAA,CAGX,OAAOA,CAAAA,EAAU,QAAA,EAAY,OAAOA,CAAAA,EAAU,QAAA,CACzCA,CAAAA,CAEF,IACR,CAAA,CACA,MAAA,CAAQC,CAAAA,EAAmCA,CAAAA,GAAO,IAAA,GAAS,OAAOA,CAAAA,EAAO,QAAA,EAAY,OAAOA,CAAAA,EAAO,QAAA,CAAS,CACjH,CAAA,CASA,WAAA,CAAYC,CAAAA,CAAsC,CAChD,OAAIJ,CAAAA,EAAU,cAAA,CACLA,CAAAA,CAAS,cAAA,CAAeI,CAAM,CAAA,CAIhCA,CAAAA,CAAO,MAAA,CAAS,CAAA,EAAKA,CAAAA,CAAO,KAAA,CAAOF,CAAAA,EAAU,OAAOA,CAAAA,EAAU,QAAQ,CAC/E,CACF,CACF,CAsBA,eAAsBG,CAAAA,EAA0C,CAC9D,GAAI,CACF,OAAA,MAAM,OAAO,qBAAiB,CAAA,CACvB,CAAA,CACT,CAAA,KAAQ,CACN,OAAO,MACT,CACF","file":"evm-5323YCLC.js","sourcesContent":["import type { ChainAdapter } from './types';\n\n/**\n * EVM utilities module interface for dynamic imports.\n *\n * @internal\n * @since 1.0.0\n */\ninterface EvmUtilsModule {\n getEvmChains?: (appChains: any) => (string | number)[];\n isEvmChainList?: (chains: (string | number)[]) => boolean;\n}\n\n/**\n * Dynamically imports and checks availability of EVM utilities.\n * This function attempts to load EVM-specific utilities without throwing errors\n * if the EVM package is not installed in the current environment.\n *\n * @internal\n * @returns Promise resolving to EVM utilities module or null if not available\n *\n * @example\n * ```typescript\n * const evmUtils = await getEvmUtils();\n * if (evmUtils?.getEvmChains) {\n * const chains = evmUtils.getEvmChains(appChains);\n * }\n * ```\n *\n * @since 1.0.0\n */\nasync function getEvmUtils(): Promise<EvmUtilsModule | null> {\n try {\n // Dynamic import of EVM utilities - fails gracefully if package not installed\n const evmUtils = await import('../../evm/utils');\n return evmUtils;\n } catch (error) {\n console.warn('EVM utilities not available:', error);\n return null;\n }\n}\n\n/**\n * Creates an EVM chain adapter with dynamic loading and fallback support.\n *\n * This adapter provides EVM-specific functionality while gracefully handling\n * environments where EVM utilities are not available. It uses intelligent\n * fallbacks to ensure basic functionality even without the full EVM package.\n *\n * @returns Promise resolving to a configured EVM ChainAdapter\n *\n * @example\n * ```typescript\n * const adapter = await createEvmAdapter();\n *\n * // Get EVM chain IDs from app configuration\n * const chainIds = adapter.getChains([\n * { id: 1, name: 'Ethereum' },\n * { id: 137, name: 'Polygon' }\n * ]);\n * console.log(chainIds); // [1, 137]\n *\n * // Validate chain list format\n * const isValid = adapter.isChainList([1, 137, 56]);\n * console.log(isValid); // true (numeric IDs are valid for EVM)\n * ```\n *\n * @since 1.0.0\n */\nexport async function createEvmAdapter(): Promise<ChainAdapter> {\n const evmUtils = await getEvmUtils();\n\n return {\n /**\n * Extracts chain IDs from EVM app chain configuration.\n *\n * @param appChains Array of chain configurations or chain identifiers\n * @returns Array of chain IDs (numbers or strings)\n */\n getChains(appChains: any): (string | number)[] {\n // Use imported EVM utilities if available\n if (evmUtils?.getEvmChains) {\n return evmUtils.getEvmChains(appChains);\n }\n\n // Fallback implementation for basic chain extraction\n if (!Array.isArray(appChains) || appChains.length === 0) {\n return [];\n }\n\n return appChains\n .map((chain: any) => {\n // Handle chain objects with id property\n if (typeof chain === 'object' && chain?.id !== undefined) {\n return chain.id;\n }\n // Handle direct chain identifiers\n if (typeof chain === 'number' || typeof chain === 'string') {\n return chain;\n }\n return null;\n })\n .filter((id: any): id is string | number => id !== null && (typeof id === 'string' || typeof id === 'number'));\n },\n\n /**\n * Validates whether the provided chains list conforms to EVM chain format.\n * EVM chains are typically identified by numeric IDs.\n *\n * @param chains Array of chain identifiers to validate\n * @returns True if the chain list is valid for EVM\n */\n isChainList(chains: (string | number)[]): boolean {\n if (evmUtils?.isEvmChainList) {\n return evmUtils.isEvmChainList(chains);\n }\n\n // Fallback validation: EVM chains should be numbers\n return chains.length > 0 && chains.every((chain) => typeof chain === 'number');\n },\n };\n}\n\n/**\n * Checks if the EVM adapter can be created in the current environment.\n * This function verifies that the required EVM utilities are available\n * by attempting to import them.\n *\n * @returns Promise resolving to true if EVM adapter is available\n *\n * @example\n * ```typescript\n * const hasEvm = await isEvmAdapterAvailable();\n * if (hasEvm) {\n * const adapter = await createEvmAdapter();\n * // Use EVM functionality\n * } else {\n * console.log('EVM support not available in this build');\n * }\n * ```\n *\n * @since 1.0.0\n */\nexport async function isEvmAdapterAvailable(): Promise<boolean> {\n try {\n await import('../../evm/utils');\n return true;\n } catch {\n return false;\n }\n}\n"]}
|