@sodax/wallet-sdk-react 1.5.6-beta → 2.0.0-rc.1
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/README.md +103 -145
- package/ai-exported/AGENTS.md +122 -0
- package/ai-exported/integration/README.md +102 -0
- package/ai-exported/integration/ai-rules.md +136 -0
- package/ai-exported/integration/architecture.md +181 -0
- package/ai-exported/integration/examples/01-minimal-evm.tsx +75 -0
- package/ai-exported/integration/examples/02-multi-chain-modal.tsx +169 -0
- package/ai-exported/integration/examples/03-nextjs-app-router.tsx +99 -0
- package/ai-exported/integration/examples/04-walletconnect-setup.tsx +89 -0
- package/ai-exported/integration/examples/README.md +29 -0
- package/ai-exported/integration/recipes/batch-operations.md +223 -0
- package/ai-exported/integration/recipes/bridge-to-sdk.md +164 -0
- package/ai-exported/integration/recipes/chain-detection.md +254 -0
- package/ai-exported/integration/recipes/connect-button.md +156 -0
- package/ai-exported/integration/recipes/multi-chain-modal.md +199 -0
- package/ai-exported/integration/recipes/setup.md +158 -0
- package/ai-exported/integration/recipes/sign-message.md +137 -0
- package/ai-exported/integration/recipes/sub-path-imports.md +95 -0
- package/ai-exported/integration/recipes/switch-chain.md +141 -0
- package/ai-exported/integration/recipes/walletconnect-setup.md +139 -0
- package/ai-exported/integration/reference/api-surface.md +175 -0
- package/ai-exported/integration/reference/chain-support.md +78 -0
- package/ai-exported/integration/reference/connectors.md +74 -0
- package/ai-exported/integration/reference/hooks.md +204 -0
- package/ai-exported/integration/reference/wallet-brands.md +106 -0
- package/ai-exported/migration/README.md +49 -0
- package/ai-exported/migration/ai-rules.md +144 -0
- package/ai-exported/migration/breaking-changes.md +305 -0
- package/ai-exported/migration/checklist.md +159 -0
- package/ai-exported/migration/recipes/connect-button.md +166 -0
- package/ai-exported/migration/recipes/multi-chain-modal.md +244 -0
- package/ai-exported/migration/recipes/ssr-setup.md +162 -0
- package/ai-exported/migration/recipes/walletconnect-migration.md +168 -0
- package/ai-exported/migration/reference/components.md +73 -0
- package/ai-exported/migration/reference/config.md +307 -0
- package/ai-exported/migration/reference/hooks.md +278 -0
- package/ai-exported/migration/reference/imports.md +157 -0
- package/dist/XConnector-B9YQTVJ4.d.ts +146 -0
- package/dist/chunk-2BOUGCJ7.mjs +150 -0
- package/dist/chunk-2BOUGCJ7.mjs.map +1 -0
- package/dist/chunk-66BAUK56.mjs +202 -0
- package/dist/chunk-66BAUK56.mjs.map +1 -0
- package/dist/chunk-7ULB6DW4.mjs +102 -0
- package/dist/chunk-7ULB6DW4.mjs.map +1 -0
- package/dist/chunk-BKJB527E.mjs +125 -0
- package/dist/chunk-BKJB527E.mjs.map +1 -0
- package/dist/chunk-BXJLBR4G.mjs +88 -0
- package/dist/chunk-BXJLBR4G.mjs.map +1 -0
- package/dist/chunk-E5IAZ7E6.mjs +186 -0
- package/dist/chunk-E5IAZ7E6.mjs.map +1 -0
- package/dist/chunk-MAQ47Q52.mjs +33 -0
- package/dist/chunk-MAQ47Q52.mjs.map +1 -0
- package/dist/chunk-MXZVF5HR.mjs +34 -0
- package/dist/chunk-MXZVF5HR.mjs.map +1 -0
- package/dist/chunk-N5A2TMF6.mjs +33 -0
- package/dist/chunk-N5A2TMF6.mjs.map +1 -0
- package/dist/chunk-NY7U7OJW.mjs +64 -0
- package/dist/chunk-NY7U7OJW.mjs.map +1 -0
- package/dist/chunk-PJLEJVAU.mjs +140 -0
- package/dist/chunk-PJLEJVAU.mjs.map +1 -0
- package/dist/chunk-PLCA4ZDJ.mjs +1585 -0
- package/dist/chunk-PLCA4ZDJ.mjs.map +1 -0
- package/dist/chunk-TZMKDXFA.mjs +3 -0
- package/dist/chunk-TZMKDXFA.mjs.map +1 -0
- package/dist/chunk-X2MHIWXO.mjs +100 -0
- package/dist/chunk-X2MHIWXO.mjs.map +1 -0
- package/dist/chunk-XZ7CHO2S.mjs +41 -0
- package/dist/chunk-XZ7CHO2S.mjs.map +1 -0
- package/dist/config-OlnzyEUE.d.ts +146 -0
- package/dist/index.cjs +2784 -1594
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +768 -1498
- package/dist/index.mjs +463 -2004
- package/dist/index.mjs.map +1 -1
- package/dist/xchains/bitcoin/index.cjs +1927 -0
- package/dist/xchains/bitcoin/index.cjs.map +1 -0
- package/dist/xchains/bitcoin/index.d.ts +125 -0
- package/dist/xchains/bitcoin/index.mjs +16 -0
- package/dist/xchains/bitcoin/index.mjs.map +1 -0
- package/dist/xchains/evm/index.cjs +316 -0
- package/dist/xchains/evm/index.cjs.map +1 -0
- package/dist/xchains/evm/index.d.ts +39 -0
- package/dist/xchains/evm/index.mjs +5 -0
- package/dist/xchains/evm/index.mjs.map +1 -0
- package/dist/xchains/icon/index.cjs +311 -0
- package/dist/xchains/icon/index.cjs.map +1 -0
- package/dist/xchains/icon/index.d.ts +37 -0
- package/dist/xchains/icon/index.mjs +7 -0
- package/dist/xchains/icon/index.mjs.map +1 -0
- package/dist/xchains/injective/index.cjs +223 -0
- package/dist/xchains/injective/index.cjs.map +1 -0
- package/dist/xchains/injective/index.d.ts +35 -0
- package/dist/xchains/injective/index.mjs +5 -0
- package/dist/xchains/injective/index.mjs.map +1 -0
- package/dist/xchains/near/index.cjs +190 -0
- package/dist/xchains/near/index.cjs.map +1 -0
- package/dist/xchains/near/index.d.ts +34 -0
- package/dist/xchains/near/index.mjs +6 -0
- package/dist/xchains/near/index.mjs.map +1 -0
- package/dist/xchains/solana/index.cjs +186 -0
- package/dist/xchains/solana/index.cjs.map +1 -0
- package/dist/xchains/solana/index.d.ts +26 -0
- package/dist/xchains/solana/index.mjs +7 -0
- package/dist/xchains/solana/index.mjs.map +1 -0
- package/dist/xchains/stacks/index.cjs +240 -0
- package/dist/xchains/stacks/index.cjs.map +1 -0
- package/dist/xchains/stacks/index.d.ts +36 -0
- package/dist/xchains/stacks/index.mjs +5 -0
- package/dist/xchains/stacks/index.mjs.map +1 -0
- package/dist/xchains/stellar/index.cjs +322 -0
- package/dist/xchains/stellar/index.cjs.map +1 -0
- package/dist/xchains/stellar/index.d.ts +44 -0
- package/dist/xchains/stellar/index.mjs +6 -0
- package/dist/xchains/stellar/index.mjs.map +1 -0
- package/dist/xchains/sui/index.cjs +248 -0
- package/dist/xchains/sui/index.cjs.map +1 -0
- package/dist/xchains/sui/index.d.ts +37 -0
- package/dist/xchains/sui/index.mjs +7 -0
- package/dist/xchains/sui/index.mjs.map +1 -0
- package/docs/ADDING_A_NEW_CHAIN.md +440 -0
- package/docs/ARCHITECTURE.md +291 -0
- package/docs/BATCH_OPERATIONS.md +267 -0
- package/docs/CHAIN_DETECTION.md +216 -0
- package/docs/CONFIGURE_PROVIDER.md +360 -0
- package/docs/CONNECTORS.md +247 -0
- package/docs/CONNECT_FLOW.md +276 -0
- package/docs/EVM_SWITCH_CHAIN.md +161 -0
- package/docs/SIGN_MESSAGE.md +213 -0
- package/docs/SUB_PATH_EXPORTS.md +246 -0
- package/docs/WALLETCONNECT.md +154 -0
- package/docs/WALLET_MODAL.md +331 -0
- package/docs/WALLET_PROVIDER_BRIDGE.md +226 -0
- package/package.json +34 -9
- package/skills/SKILLS.md +84 -0
- package/skills/bridge-to-sdk.md +148 -0
- package/skills/connect-button.md +116 -0
- package/skills/evm-only-walletconnect.md +111 -0
- package/skills/multi-chain-modal.md +178 -0
- package/skills/setup.md +107 -0
- package/dist/index.d.cts +0 -1579
- package/src/Hydrate.ts +0 -65
- package/src/SodaxWalletProvider.tsx +0 -97
- package/src/actions/getXChainType.ts +0 -8
- package/src/actions/getXService.ts +0 -33
- package/src/actions/index.ts +0 -2
- package/src/assets/wallets/hana.svg +0 -6
- package/src/assets/wallets/havah.svg +0 -76
- package/src/assets/wallets/keplr.svg +0 -30
- package/src/assets/wallets/metamask.svg +0 -60
- package/src/assets/wallets/phantom.svg +0 -4
- package/src/assets/wallets/sui.svg +0 -20
- package/src/core/XConnector.ts +0 -54
- package/src/core/XService.ts +0 -85
- package/src/core/index.ts +0 -2
- package/src/hooks/index.ts +0 -11
- package/src/hooks/useEthereumChainId.ts +0 -44
- package/src/hooks/useEvmSwitchChain.ts +0 -91
- package/src/hooks/useWalletProvider.ts +0 -206
- package/src/hooks/useXAccount.ts +0 -51
- package/src/hooks/useXAccounts.ts +0 -56
- package/src/hooks/useXBalances.ts +0 -65
- package/src/hooks/useXConnect.ts +0 -118
- package/src/hooks/useXConnection.ts +0 -72
- package/src/hooks/useXConnectors.ts +0 -72
- package/src/hooks/useXDisconnect.ts +0 -73
- package/src/hooks/useXService.ts +0 -8
- package/src/hooks/useXSignMessage.ts +0 -82
- package/src/index.ts +0 -19
- package/src/types/index.ts +0 -22
- package/src/useXWagmiStore.ts +0 -116
- package/src/utils/index.ts +0 -21
- package/src/xchains/bitcoin/BitcoinXConnector.ts +0 -34
- package/src/xchains/bitcoin/BitcoinXService.ts +0 -40
- package/src/xchains/bitcoin/OKXXConnector.ts +0 -117
- package/src/xchains/bitcoin/UnisatXConnector.ts +0 -117
- package/src/xchains/bitcoin/XverseXConnector.ts +0 -232
- package/src/xchains/bitcoin/index.ts +0 -7
- package/src/xchains/bitcoin/useBitcoinXConnectors.ts +0 -14
- package/src/xchains/evm/EvmXConnector.ts +0 -27
- package/src/xchains/evm/EvmXService.ts +0 -211
- package/src/xchains/evm/index.ts +0 -3
- package/src/xchains/icon/IconHanaXConnector.ts +0 -39
- package/src/xchains/icon/IconXService.ts +0 -117
- package/src/xchains/icon/actions.ts +0 -28
- package/src/xchains/icon/iconex/index.tsx +0 -46
- package/src/xchains/icon/index.ts +0 -2
- package/src/xchains/injective/InjectiveXConnector.ts +0 -60
- package/src/xchains/injective/InjectiveXService.ts +0 -62
- package/src/xchains/injective/actions.ts +0 -32
- package/src/xchains/injective/index.ts +0 -2
- package/src/xchains/near/NearXConnector.ts +0 -42
- package/src/xchains/near/NearXService.ts +0 -46
- package/src/xchains/near/useNearXConnectors.ts +0 -23
- package/src/xchains/solana/SolanaXConnector.ts +0 -26
- package/src/xchains/solana/SolanaXService.ts +0 -46
- package/src/xchains/solana/index.ts +0 -2
- package/src/xchains/stacks/StacksXConnector.ts +0 -63
- package/src/xchains/stacks/StacksXService.ts +0 -59
- package/src/xchains/stacks/constants.ts +0 -42
- package/src/xchains/stacks/index.ts +0 -4
- package/src/xchains/stacks/useStacksXConnectors.ts +0 -7
- package/src/xchains/stellar/CustomSorobanServer.ts +0 -93
- package/src/xchains/stellar/StellarWalletsKitXConnector.ts +0 -53
- package/src/xchains/stellar/StellarXService.ts +0 -93
- package/src/xchains/stellar/actions.ts +0 -24
- package/src/xchains/stellar/index.tsx +0 -2
- package/src/xchains/stellar/useStellarXConnectors.ts +0 -21
- package/src/xchains/stellar/utils.ts +0 -49
- package/src/xchains/sui/SuiXConnector.ts +0 -28
- package/src/xchains/sui/SuiXService.ts +0 -66
- package/src/xchains/sui/index.ts +0 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isNativeToken } from './chunk-NY7U7OJW.mjs';
|
|
2
|
+
import { XService } from './chunk-X2MHIWXO.mjs';
|
|
3
|
+
import { PublicKey } from '@solana/web3.js';
|
|
4
|
+
import { getAssociatedTokenAddressSync, getAccount } from '@solana/spl-token';
|
|
5
|
+
|
|
6
|
+
var SolanaXService = class _SolanaXService extends XService {
|
|
7
|
+
static instance;
|
|
8
|
+
connection;
|
|
9
|
+
wallet;
|
|
10
|
+
constructor() {
|
|
11
|
+
super("SOLANA");
|
|
12
|
+
}
|
|
13
|
+
static getInstance() {
|
|
14
|
+
if (!_SolanaXService.instance) {
|
|
15
|
+
_SolanaXService.instance = new _SolanaXService();
|
|
16
|
+
}
|
|
17
|
+
return _SolanaXService.instance;
|
|
18
|
+
}
|
|
19
|
+
async getBalance(address, xToken) {
|
|
20
|
+
if (!address) return BigInt(0);
|
|
21
|
+
const connection = this.connection;
|
|
22
|
+
if (!connection) {
|
|
23
|
+
return BigInt(0);
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
if (isNativeToken(xToken)) {
|
|
27
|
+
const newBalance = await connection.getBalance(new PublicKey(address));
|
|
28
|
+
return BigInt(newBalance);
|
|
29
|
+
}
|
|
30
|
+
const tokenAccountPubkey = getAssociatedTokenAddressSync(new PublicKey(xToken.address), new PublicKey(address));
|
|
31
|
+
const tokenAccount = await getAccount(connection, tokenAccountPubkey);
|
|
32
|
+
return BigInt(tokenAccount.amount);
|
|
33
|
+
} catch {
|
|
34
|
+
return BigInt(0);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { SolanaXService };
|
|
40
|
+
//# sourceMappingURL=chunk-XZ7CHO2S.mjs.map
|
|
41
|
+
//# sourceMappingURL=chunk-XZ7CHO2S.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/xchains/solana/SolanaXService.ts"],"names":[],"mappings":";;;;;AAOO,IAAM,cAAA,GAAN,MAAM,eAAA,SAAuB,QAAA,CAAS;AAAA,EAC3C,OAAe,QAAA;AAAA,EAER,UAAA;AAAA,EACA,MAAA;AAAA,EAEC,WAAA,GAAc;AACpB,IAAA,KAAA,CAAM,QAAQ,CAAA;AAAA,EAChB;AAAA,EAEA,OAAc,WAAA,GAA8B;AAC1C,IAAA,IAAI,CAAC,gBAAe,QAAA,EAAU;AAC5B,MAAA,eAAA,CAAe,QAAA,GAAW,IAAI,eAAA,EAAe;AAAA,IAC/C;AACA,IAAA,OAAO,eAAA,CAAe,QAAA;AAAA,EACxB;AAAA,EAEA,MAAe,UAAA,CAAW,OAAA,EAA6B,MAAA,EAAiC;AACtF,IAAA,IAAI,CAAC,OAAA,EAAS,OAAO,MAAA,CAAO,CAAC,CAAA;AAE7B,IAAA,MAAM,aAAa,IAAA,CAAK,UAAA;AACxB,IAAA,IAAI,CAAC,UAAA,EAAY;AACf,MAAA,OAAO,OAAO,CAAC,CAAA;AAAA,IACjB;AAEA,IAAA,IAAI;AACF,MAAA,IAAI,aAAA,CAAc,MAAM,CAAA,EAAG;AACzB,QAAA,MAAM,aAAa,MAAM,UAAA,CAAW,WAAW,IAAI,SAAA,CAAU,OAAO,CAAC,CAAA;AACrE,QAAA,OAAO,OAAO,UAAU,CAAA;AAAA,MAC1B;AAEA,MAAA,MAAM,kBAAA,GAAqB,6BAAA,CAA8B,IAAI,SAAA,CAAU,MAAA,CAAO,OAAO,CAAA,EAAG,IAAI,SAAA,CAAU,OAAO,CAAC,CAAA;AAC9G,MAAA,MAAM,YAAA,GAAe,MAAM,UAAA,CAAW,UAAA,EAAY,kBAAkB,CAAA;AACpE,MAAA,OAAO,MAAA,CAAO,aAAa,MAAM,CAAA;AAAA,IACnC,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,OAAO,CAAC,CAAA;AAAA,IACjB;AAAA,EACF;AACF","file":"chunk-XZ7CHO2S.mjs","sourcesContent":["import { XService } from '@/core/XService.js';\nimport { isNativeToken } from '@/utils/index.js';\nimport type { XToken } from '@sodax/types';\nimport { type Connection, PublicKey } from '@solana/web3.js';\nimport { getAccount, getAssociatedTokenAddressSync } from '@solana/spl-token';\nimport type { WalletContextState } from '@solana/wallet-adapter-react';\n\nexport class SolanaXService extends XService {\n private static instance: SolanaXService;\n\n public connection: Connection | undefined;\n public wallet: WalletContextState | undefined;\n\n private constructor() {\n super('SOLANA');\n }\n\n public static getInstance(): SolanaXService {\n if (!SolanaXService.instance) {\n SolanaXService.instance = new SolanaXService();\n }\n return SolanaXService.instance;\n }\n\n override async getBalance(address: string | undefined, xToken: XToken): Promise<bigint> {\n if (!address) return BigInt(0);\n\n const connection = this.connection;\n if (!connection) {\n return BigInt(0);\n }\n\n try {\n if (isNativeToken(xToken)) {\n const newBalance = await connection.getBalance(new PublicKey(address));\n return BigInt(newBalance);\n }\n\n const tokenAccountPubkey = getAssociatedTokenAddressSync(new PublicKey(xToken.address), new PublicKey(address));\n const tokenAccount = await getAccount(connection, tokenAccountPubkey);\n return BigInt(tokenAccount.amount);\n } catch {\n return BigInt(0);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { ChainType, EvmChainKey, SolanaChainKey, SuiChainKey, IconChainKey, NearChainKey, StellarChainKey, StellarRpcConfig, BitcoinChainKey, BitcoinRpcConfig, InjectiveChainKey, InjectiveRpcConfig, StacksChainKey, StacksNetworkName, StacksNetworkLike, ChainKey, baseChainInfo } from '@sodax/types';
|
|
2
|
+
import { EvmWalletDefaults, SolanaWalletDefaults, SuiWalletDefaults, IconWalletDefaults, NearWalletDefaults, StellarWalletDefaults, BitcoinWalletDefaults, InjectiveWalletDefaults, StacksWalletDefaults } from '@sodax/wallet-sdk-core';
|
|
3
|
+
import { State } from 'wagmi';
|
|
4
|
+
import { WalletConnectParameters } from 'wagmi/connectors';
|
|
5
|
+
import { I as IXConnector } from './XConnector-B9YQTVJ4.js';
|
|
6
|
+
|
|
7
|
+
type SimpleChainEntry<D> = {
|
|
8
|
+
rpcUrl?: string;
|
|
9
|
+
defaults?: D;
|
|
10
|
+
};
|
|
11
|
+
type EvmChainEntry = SimpleChainEntry<EvmWalletDefaults>;
|
|
12
|
+
type SolanaChainEntry = SimpleChainEntry<SolanaWalletDefaults>;
|
|
13
|
+
type SuiChainEntry = SimpleChainEntry<SuiWalletDefaults>;
|
|
14
|
+
type IconChainEntry = SimpleChainEntry<IconWalletDefaults>;
|
|
15
|
+
type NearChainEntry = SimpleChainEntry<NearWalletDefaults>;
|
|
16
|
+
type StellarChainEntry = StellarRpcConfig & {
|
|
17
|
+
defaults?: StellarWalletDefaults;
|
|
18
|
+
};
|
|
19
|
+
type BitcoinChainEntry = BitcoinRpcConfig & {
|
|
20
|
+
defaults?: BitcoinWalletDefaults;
|
|
21
|
+
};
|
|
22
|
+
type InjectiveChainEntry = InjectiveRpcConfig & {
|
|
23
|
+
defaults?: InjectiveWalletDefaults;
|
|
24
|
+
};
|
|
25
|
+
type StacksChainEntry = StacksNetworkName | (StacksNetworkLike & {
|
|
26
|
+
defaults?: StacksWalletDefaults;
|
|
27
|
+
});
|
|
28
|
+
/** Wagmi-config-level settings shared across all configured EVM chains. */
|
|
29
|
+
type EvmAdapterFields = {
|
|
30
|
+
/** Attempt to reconnect previously connected wallets on mount. @default false */
|
|
31
|
+
reconnectOnMount?: boolean;
|
|
32
|
+
/** Enable SSR-safe hydration for Next.js. @default true */
|
|
33
|
+
ssr?: boolean;
|
|
34
|
+
/** Wagmi SSR hydration state — pass `cookieToInitialState()` to avoid disconnect flash on first load (Next.js only). */
|
|
35
|
+
initialState?: State;
|
|
36
|
+
/** WalletConnect configuration. Adds a WalletConnect connector when provided. */
|
|
37
|
+
walletConnect?: WalletConnectParameters;
|
|
38
|
+
};
|
|
39
|
+
/** `@solana/wallet-adapter-react` provider settings. */
|
|
40
|
+
type SolanaAdapterFields = {
|
|
41
|
+
/** Auto-connect previously connected Solana wallet on mount. @default true */
|
|
42
|
+
autoConnect?: boolean;
|
|
43
|
+
};
|
|
44
|
+
/** `@mysten/dapp-kit` provider settings. */
|
|
45
|
+
type SuiAdapterFields = {
|
|
46
|
+
autoConnect?: boolean;
|
|
47
|
+
/** Default network for the SuiClientProvider. @default 'mainnet' */
|
|
48
|
+
network?: 'mainnet' | 'testnet' | 'devnet';
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Per-chain-type metadata — the only place that needs editing when adding a
|
|
52
|
+
* new chain type. Keys must match `ChainType`.
|
|
53
|
+
*/
|
|
54
|
+
type ChainMeta = {
|
|
55
|
+
EVM: {
|
|
56
|
+
keys: EvmChainKey;
|
|
57
|
+
entry: EvmChainEntry;
|
|
58
|
+
defaults: EvmWalletDefaults;
|
|
59
|
+
adapter: EvmAdapterFields;
|
|
60
|
+
};
|
|
61
|
+
SOLANA: {
|
|
62
|
+
keys: SolanaChainKey;
|
|
63
|
+
entry: SolanaChainEntry;
|
|
64
|
+
defaults: SolanaWalletDefaults;
|
|
65
|
+
adapter: SolanaAdapterFields;
|
|
66
|
+
};
|
|
67
|
+
SUI: {
|
|
68
|
+
keys: SuiChainKey;
|
|
69
|
+
entry: SuiChainEntry;
|
|
70
|
+
defaults: SuiWalletDefaults;
|
|
71
|
+
adapter: SuiAdapterFields;
|
|
72
|
+
};
|
|
73
|
+
ICON: {
|
|
74
|
+
keys: IconChainKey;
|
|
75
|
+
entry: IconChainEntry;
|
|
76
|
+
defaults: IconWalletDefaults;
|
|
77
|
+
adapter: {};
|
|
78
|
+
};
|
|
79
|
+
NEAR: {
|
|
80
|
+
keys: NearChainKey;
|
|
81
|
+
entry: NearChainEntry;
|
|
82
|
+
defaults: NearWalletDefaults;
|
|
83
|
+
adapter: {};
|
|
84
|
+
};
|
|
85
|
+
STELLAR: {
|
|
86
|
+
keys: StellarChainKey;
|
|
87
|
+
entry: StellarChainEntry;
|
|
88
|
+
defaults: StellarWalletDefaults;
|
|
89
|
+
adapter: {};
|
|
90
|
+
};
|
|
91
|
+
BITCOIN: {
|
|
92
|
+
keys: BitcoinChainKey;
|
|
93
|
+
entry: BitcoinChainEntry;
|
|
94
|
+
defaults: BitcoinWalletDefaults;
|
|
95
|
+
adapter: {};
|
|
96
|
+
};
|
|
97
|
+
INJECTIVE: {
|
|
98
|
+
keys: InjectiveChainKey;
|
|
99
|
+
entry: InjectiveChainEntry;
|
|
100
|
+
defaults: InjectiveWalletDefaults;
|
|
101
|
+
adapter: {};
|
|
102
|
+
};
|
|
103
|
+
STACKS: {
|
|
104
|
+
keys: StacksChainKey;
|
|
105
|
+
entry: StacksChainEntry;
|
|
106
|
+
defaults: StacksWalletDefaults;
|
|
107
|
+
adapter: {};
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/** Resolves a `ChainKey` to its `ChainType` via the runtime `baseChainInfo` map. */
|
|
111
|
+
type ChainTypeOf<K extends ChainKey> = (typeof baseChainInfo)[K]['type'];
|
|
112
|
+
/**
|
|
113
|
+
* Flatten `A & B` into a single object type so TypeScript runs excess-property
|
|
114
|
+
* checks against the merged shape. Intersection types skip EPC, which lets
|
|
115
|
+
* unknown fields like `rpcUrl` slip into the EVM slot silently — flattening
|
|
116
|
+
* forces the check to fire on object literals.
|
|
117
|
+
*/
|
|
118
|
+
type Merge<A, B> = {
|
|
119
|
+
[K in keyof (A & B)]: (A & B)[K];
|
|
120
|
+
};
|
|
121
|
+
/** Per-chain-type slot shape — adapter fields + nested chain entries map. */
|
|
122
|
+
type ChainTypeConfig<T extends ChainType> = Merge<ChainMeta[T]['adapter'], {
|
|
123
|
+
/** Optional connector overrides. If omitted, uses defaults from chainRegistry. */
|
|
124
|
+
connectors?: IXConnector[];
|
|
125
|
+
/** Per-chain-key entries — chain-specific RPC + wallet provider defaults. */
|
|
126
|
+
chains?: Partial<Record<ChainMeta[T]['keys'], ChainMeta[T]['entry']>>;
|
|
127
|
+
}>;
|
|
128
|
+
/** Per-chain-key entry shape — narrows by chain key via `baseChainInfo` lookup. */
|
|
129
|
+
type ChainEntry<K extends ChainKey = ChainKey> = ChainMeta[ChainTypeOf<K>]['entry'];
|
|
130
|
+
/** Wallet provider defaults shape for a given chain key. */
|
|
131
|
+
type WalletDefaultsByKey<K extends ChainKey> = ChainMeta[ChainTypeOf<K>]['defaults'];
|
|
132
|
+
type EvmTypeConfig = ChainTypeConfig<'EVM'>;
|
|
133
|
+
type SolanaTypeConfig = ChainTypeConfig<'SOLANA'>;
|
|
134
|
+
type SuiTypeConfig = ChainTypeConfig<'SUI'>;
|
|
135
|
+
type BitcoinTypeConfig = ChainTypeConfig<'BITCOIN'>;
|
|
136
|
+
type StellarTypeConfig = ChainTypeConfig<'STELLAR'>;
|
|
137
|
+
type InjectiveTypeConfig = ChainTypeConfig<'INJECTIVE'>;
|
|
138
|
+
type IconTypeConfig = ChainTypeConfig<'ICON'>;
|
|
139
|
+
type NearTypeConfig = ChainTypeConfig<'NEAR'>;
|
|
140
|
+
type StacksTypeConfig = ChainTypeConfig<'STACKS'>;
|
|
141
|
+
/** Top-level config for `<SodaxWalletProvider>`. Omitted chain-type slots are not mounted. */
|
|
142
|
+
type SodaxWalletConfig = {
|
|
143
|
+
[T in ChainType]?: ChainTypeConfig<T>;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export type { BitcoinChainEntry as B, ChainEntry as C, EvmChainEntry as E, IconChainEntry as I, NearChainEntry as N, SodaxWalletConfig as S, WalletDefaultsByKey as W, SolanaChainEntry as a, SuiChainEntry as b, StellarChainEntry as c, InjectiveChainEntry as d, StacksChainEntry as e, EvmAdapterFields as f, SolanaAdapterFields as g, SuiAdapterFields as h, ChainMeta as i, ChainTypeOf as j, ChainTypeConfig as k, EvmTypeConfig as l, SolanaTypeConfig as m, SuiTypeConfig as n, BitcoinTypeConfig as o, StellarTypeConfig as p, InjectiveTypeConfig as q, IconTypeConfig as r, NearTypeConfig as s, StacksTypeConfig as t };
|