@sodax/skills 2.0.0-rc.9 → 2.0.0
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/.claude-plugin/plugin.json +1 -9
- package/AGENTS.md +119 -14
- package/README.md +5 -2
- package/package.json +1 -1
- package/skills/sodax-build/SKILL.md +90 -0
- package/skills/sodax-build/knowledge/README.md +35 -0
- package/skills/sodax-build/knowledge/brief-template.md +41 -0
- package/skills/sodax-build/knowledge/chains-and-assets.md +26 -0
- package/skills/sodax-build/knowledge/example-sessions.md +84 -0
- package/skills/sodax-build/knowledge/feature-catalog.md +51 -0
- package/skills/sodax-build/knowledge/glossary.md +35 -0
- package/skills/sodax-build/knowledge/handoff.md +60 -0
- package/skills/sodax-build/knowledge/interview-guide.md +66 -0
- package/skills/sodax-build/knowledge/monetization.md +37 -0
- package/skills/sodax-build/knowledge/use-case-gallery.md +32 -0
- package/skills/sodax-dapp-kit/SKILL.md +6 -2
- package/skills/sodax-dapp-kit/auxiliary-services/SKILL.md +65 -0
- package/skills/sodax-dapp-kit/bitcoin/SKILL.md +57 -0
- package/skills/sodax-dapp-kit/bridge/SKILL.md +59 -0
- package/skills/sodax-dapp-kit/dex/SKILL.md +60 -0
- package/skills/sodax-dapp-kit/integration/knowledge/README.md +1 -1
- package/skills/sodax-dapp-kit/integration/knowledge/features/README.md +3 -2
- package/skills/sodax-dapp-kit/integration/knowledge/features/auxiliary-services.md +71 -11
- package/skills/sodax-dapp-kit/integration/knowledge/features/bitcoin.md +10 -6
- package/skills/sodax-dapp-kit/integration/knowledge/features/dex.md +2 -2
- package/skills/sodax-dapp-kit/integration/knowledge/features/leverage-yield.md +112 -0
- package/skills/sodax-dapp-kit/integration/knowledge/features/money-market.md +6 -1
- package/skills/sodax-dapp-kit/integration/knowledge/features/swap.md +1 -1
- package/skills/sodax-dapp-kit/integration/knowledge/quickstart.md +2 -2
- package/skills/sodax-dapp-kit/integration/knowledge/recipes/README.md +1 -0
- package/skills/sodax-dapp-kit/integration/knowledge/recipes/backend-queries.md +23 -8
- package/skills/sodax-dapp-kit/integration/knowledge/recipes/bitcoin.md +8 -8
- package/skills/sodax-dapp-kit/integration/knowledge/recipes/leverage-yield.md +168 -0
- package/skills/sodax-dapp-kit/integration/knowledge/recipes/migration.md +1 -1
- package/skills/sodax-dapp-kit/integration/knowledge/recipes/setup.md +4 -4
- package/skills/sodax-dapp-kit/integration/knowledge/recipes/swap.md +1 -1
- package/skills/sodax-dapp-kit/integration/knowledge/recipes/wallet-connectivity.md +3 -0
- package/skills/sodax-dapp-kit/integration/knowledge/reference/glossary.md +1 -1
- package/skills/sodax-dapp-kit/integration/knowledge/reference/hooks-index.md +67 -6
- package/skills/sodax-dapp-kit/integration/knowledge/reference/querykey-conventions.md +49 -0
- package/skills/sodax-dapp-kit/leverage-yield/SKILL.md +54 -0
- package/skills/sodax-dapp-kit/migration/SKILL.md +64 -0
- package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/breaking-changes/hook-signatures.md +1 -1
- package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/breaking-changes/sdk-leakage.md +2 -2
- package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/checklist.md +1 -1
- package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/README.md +1 -1
- package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/auxiliary-services.md +19 -10
- package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/bitcoin.md +2 -2
- package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/bridge.md +1 -1
- package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/features/dex.md +1 -1
- package/skills/sodax-dapp-kit/migration-v1-to-v2/knowledge/reference/renamed-hooks.md +3 -3
- package/skills/sodax-dapp-kit/money-market/SKILL.md +61 -0
- package/skills/sodax-dapp-kit/staking/SKILL.md +60 -0
- package/skills/sodax-dapp-kit/swap/SKILL.md +64 -0
- package/skills/sodax-sdk/SKILL.md +11 -6
- package/skills/sodax-sdk/backend-api/SKILL.md +21 -15
- package/skills/sodax-sdk/bridge/SKILL.md +4 -0
- package/skills/sodax-sdk/dex/SKILL.md +5 -1
- package/skills/sodax-sdk/integration/knowledge/README.md +1 -1
- package/skills/sodax-sdk/integration/knowledge/ai-rules.md +1 -1
- package/skills/sodax-sdk/integration/knowledge/architecture.md +24 -21
- package/skills/sodax-sdk/integration/knowledge/chain-specifics.md +57 -10
- package/skills/sodax-sdk/integration/knowledge/features/README.md +2 -1
- package/skills/sodax-sdk/integration/knowledge/features/backend-api.md +27 -16
- package/skills/sodax-sdk/integration/knowledge/features/bridge.md +15 -14
- package/skills/sodax-sdk/integration/knowledge/features/dex.md +7 -7
- package/skills/sodax-sdk/integration/knowledge/features/leverage-yield.md +175 -0
- package/skills/sodax-sdk/integration/knowledge/features/migration.md +73 -28
- package/skills/sodax-sdk/integration/knowledge/features/money-market.md +20 -25
- package/skills/sodax-sdk/integration/knowledge/features/partner.md +27 -4
- package/skills/sodax-sdk/integration/knowledge/features/recovery.md +5 -4
- package/skills/sodax-sdk/integration/knowledge/features/staking.md +2 -2
- package/skills/sodax-sdk/integration/knowledge/features/swap.md +42 -24
- package/skills/sodax-sdk/integration/knowledge/features/swaps-api.md +171 -0
- package/skills/sodax-sdk/integration/knowledge/quickstart.md +1 -1
- package/skills/sodax-sdk/integration/knowledge/recipes/README.md +1 -0
- package/skills/sodax-sdk/integration/knowledge/recipes/backend-server-init.md +3 -3
- package/skills/sodax-sdk/integration/knowledge/recipes/gas-estimation.md +8 -4
- package/skills/sodax-sdk/integration/knowledge/recipes/initialize-sodax.md +34 -2
- package/skills/sodax-sdk/integration/knowledge/recipes/logging.md +102 -0
- package/skills/sodax-sdk/integration/knowledge/recipes/raw-tx-flow.md +28 -4
- package/skills/sodax-sdk/integration/knowledge/recipes/result-and-errors.md +1 -1
- package/skills/sodax-sdk/integration/knowledge/recipes/testing.md +7 -11
- package/skills/sodax-sdk/integration/knowledge/reference/README.md +1 -1
- package/skills/sodax-sdk/integration/knowledge/reference/chain-keys.md +40 -4
- package/skills/sodax-sdk/integration/knowledge/reference/error-codes.md +32 -9
- package/skills/sodax-sdk/integration/knowledge/reference/glossary.md +2 -2
- package/skills/sodax-sdk/integration/knowledge/reference/public-api.md +37 -4
- package/skills/sodax-sdk/leverage-yield/SKILL.md +50 -0
- package/skills/sodax-sdk/migration/SKILL.md +5 -1
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/README.md +1 -1
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/ai-rules.md +1 -1
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/breaking-changes/architecture.md +2 -2
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/breaking-changes/result-and-errors.md +3 -3
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/breaking-changes/type-system.md +6 -5
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/checklist.md +1 -1
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/backend-api.md +23 -23
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/bridge.md +5 -5
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/dex.md +2 -4
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/migration.md +29 -27
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/money-market.md +2 -2
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/partner.md +10 -5
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/recovery.md +2 -2
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/staking.md +2 -2
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/features/swap.md +22 -18
- package/skills/sodax-sdk/migration-v1-to-v2/knowledge/reference/sodax-config.md +18 -16
- package/skills/sodax-sdk/money-market/SKILL.md +7 -3
- package/skills/sodax-sdk/partner/SKILL.md +4 -0
- package/skills/sodax-sdk/recovery/SKILL.md +5 -1
- package/skills/sodax-sdk/staking/SKILL.md +4 -0
- package/skills/sodax-sdk/swap/SKILL.md +8 -3
- package/skills/sodax-sdk/swaps-api/SKILL.md +62 -0
- package/skills/sodax-wallet-sdk-core/SKILL.md +7 -3
- package/skills/sodax-wallet-sdk-core/bitcoin/SKILL.md +54 -0
- package/skills/sodax-wallet-sdk-core/evm/SKILL.md +54 -0
- package/skills/sodax-wallet-sdk-core/icon/SKILL.md +54 -0
- package/skills/sodax-wallet-sdk-core/injective/SKILL.md +54 -0
- package/skills/sodax-wallet-sdk-core/integration/knowledge/README.md +1 -1
- package/skills/sodax-wallet-sdk-core/integration/knowledge/ai-rules.md +2 -2
- package/skills/sodax-wallet-sdk-core/integration/knowledge/architecture.md +5 -5
- package/skills/sodax-wallet-sdk-core/integration/knowledge/features/bitcoin.md +2 -2
- package/skills/sodax-wallet-sdk-core/integration/knowledge/features/evm.md +2 -2
- package/skills/sodax-wallet-sdk-core/integration/knowledge/features/icon.md +5 -5
- package/skills/sodax-wallet-sdk-core/integration/knowledge/features/injective.md +4 -2
- package/skills/sodax-wallet-sdk-core/integration/knowledge/features/near.md +1 -1
- package/skills/sodax-wallet-sdk-core/integration/knowledge/features/solana.md +2 -2
- package/skills/sodax-wallet-sdk-core/integration/knowledge/features/stacks.md +2 -2
- package/skills/sodax-wallet-sdk-core/integration/knowledge/features/stellar.md +2 -2
- package/skills/sodax-wallet-sdk-core/integration/knowledge/features/sui.md +1 -1
- package/skills/sodax-wallet-sdk-core/integration/knowledge/quickstart.md +1 -1
- package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/setup-private-key.md +2 -2
- package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/sign-and-broadcast.md +1 -0
- package/skills/sodax-wallet-sdk-core/integration/knowledge/recipes/testing.md +1 -1
- package/skills/sodax-wallet-sdk-core/integration/knowledge/reference/chain-support.md +3 -2
- package/skills/sodax-wallet-sdk-core/integration/knowledge/reference/interfaces.md +7 -5
- package/skills/sodax-wallet-sdk-core/integration/knowledge/reference/provider-classes.md +2 -2
- package/skills/sodax-wallet-sdk-core/migration-v1-to-v2/knowledge/README.md +1 -1
- package/skills/sodax-wallet-sdk-core/near/SKILL.md +54 -0
- package/skills/sodax-wallet-sdk-core/solana/SKILL.md +54 -0
- package/skills/sodax-wallet-sdk-core/stacks/SKILL.md +53 -0
- package/skills/sodax-wallet-sdk-core/stellar/SKILL.md +54 -0
- package/skills/sodax-wallet-sdk-core/sui/SKILL.md +53 -0
- package/skills/sodax-wallet-sdk-react/SKILL.md +5 -3
- package/skills/sodax-wallet-sdk-react/bridge-to-sdk/SKILL.md +56 -0
- package/skills/sodax-wallet-sdk-react/connect/SKILL.md +59 -0
- package/skills/sodax-wallet-sdk-react/integration/knowledge/architecture.md +3 -3
- package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/chain-detection.md +1 -1
- package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/connect-button.md +1 -1
- package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/sign-message.md +10 -10
- package/skills/sodax-wallet-sdk-react/integration/knowledge/recipes/switch-chain.md +1 -1
- package/skills/sodax-wallet-sdk-react/integration/knowledge/reference/api-surface.md +4 -4
- package/skills/sodax-wallet-sdk-react/integration/knowledge/reference/chain-support.md +4 -4
- package/skills/sodax-wallet-sdk-react/integration/knowledge/reference/connectors.md +1 -1
- package/skills/sodax-wallet-sdk-react/integration/knowledge/reference/hooks.md +5 -4
- package/skills/sodax-wallet-sdk-react/integration/knowledge/reference/wallet-brands.md +1 -1
- package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/ai-rules.md +1 -1
- package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/recipes/multi-chain-modal.md +57 -31
- package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/recipes/ssr-setup.md +24 -19
- package/skills/sodax-wallet-sdk-react/migration-v1-to-v2/knowledge/reference/config.md +1 -1
- package/skills/sodax-wallet-sdk-react/sign-message/SKILL.md +51 -0
- package/skills/sodax-wallet-sdk-react/switch-chain/SKILL.md +51 -0
- package/skills/sodax-wallet-sdk-react/wallet-modal/SKILL.md +54 -0
- package/skills/sodax-wallet-sdk-react/walletconnect/SKILL.md +52 -0
|
@@ -129,7 +129,7 @@ describe.skipIf(!PK)('e2e — EVM testnet', () => {
|
|
|
129
129
|
});
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
Apply the same pattern in your own test suite — construct the provider with a deterministic private key, then assert on the returned address / tx hash.
|
|
133
133
|
|
|
134
134
|
---
|
|
135
135
|
|
|
@@ -4,7 +4,7 @@ Chain families and spoke chain keys this package can sign for. Keys live in `@so
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
## EVM (one provider,
|
|
7
|
+
## EVM (one provider, 13 chains)
|
|
8
8
|
|
|
9
9
|
`EvmWalletProvider` covers every EVM spoke chain via `getEvmViemChain()`. The provider is exhaustive — adding a new `EvmChainKey` to `@sodax/types` requires updating `getEvmViemChain` (caught at compile time via a `never` assertion in the default branch).
|
|
10
10
|
|
|
@@ -22,6 +22,7 @@ Chain families and spoke chain keys this package can sign for. Keys live in `@so
|
|
|
22
22
|
| `ChainKeys.LIGHTLINK_MAINNET` | `lightlinkPhoenix` |
|
|
23
23
|
| `ChainKeys.REDBELLY_MAINNET` | `redbellyMainnet` |
|
|
24
24
|
| `ChainKeys.KAIA_MAINNET` | `kaia` |
|
|
25
|
+
| `ChainKeys.HEDERA_MAINNET` | `hedera` |
|
|
25
26
|
|
|
26
27
|
---
|
|
27
28
|
|
|
@@ -38,7 +39,7 @@ Chain families and spoke chain keys this package can sign for. Keys live in `@so
|
|
|
38
39
|
| NEAR | `NearWalletProvider` | `ChainKeys.NEAR_MAINNET` |
|
|
39
40
|
| Stacks | `StacksWalletProvider` | `ChainKeys.STACKS_MAINNET` |
|
|
40
41
|
|
|
41
|
-
>
|
|
42
|
+
> 21 spoke chains total = 13 EVM + 8 non-EVM. The hub chain (Sonic) is counted with EVM.
|
|
42
43
|
|
|
43
44
|
---
|
|
44
45
|
|
|
@@ -68,7 +68,7 @@ Plus public field: `connection: Connection`.
|
|
|
68
68
|
|---|---|
|
|
69
69
|
| `getWalletAddress` | `() => Promise<string>` |
|
|
70
70
|
| `signTransaction` | `(tx: XDR) => Promise<XDR>` |
|
|
71
|
-
| `waitForTransactionReceipt` | `(hash: string, opts?:
|
|
71
|
+
| `waitForTransactionReceipt` | `(hash: string, opts?: Pick<StellarWalletDefaults, 'pollInterval' | 'pollTimeout'>) => Promise<…>` |
|
|
72
72
|
|
|
73
73
|
---
|
|
74
74
|
|
|
@@ -89,9 +89,11 @@ Plus public field: `iconService: IconService`.
|
|
|
89
89
|
| Method | Signature (abridged) |
|
|
90
90
|
|---|---|
|
|
91
91
|
| `getWalletAddress` | `() => Promise<InjectiveEoaAddress>` |
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
92
|
+
| `execute` | `(…) => Promise<InjectiveExecuteResponse>` |
|
|
93
|
+
| `sendTransaction?` | `(signedTxRaw: Uint8Array) => Promise<string>` |
|
|
94
|
+
| `signAndSendTransaction?` | `(tx: InjectiveRawTransaction) => Promise<string>` — the SDK / Swaps-API handoff path |
|
|
95
|
+
| `getWalletPubKey` *(class-only, not on interface)* | `() => Promise<string>` |
|
|
96
|
+
| `getRawTransaction` *(class-only, not on interface)* | `(…) => Promise<InjectiveRawTransaction>` |
|
|
95
97
|
|
|
96
98
|
Plus public field: `wallet: InjectiveWallet`.
|
|
97
99
|
|
|
@@ -103,7 +105,7 @@ Plus public field: `wallet: InjectiveWallet`.
|
|
|
103
105
|
|---|---|
|
|
104
106
|
| `getWalletAddress` | `() => Promise<string>` |
|
|
105
107
|
| `getRawTransaction` | `(params: CallContractParams) => Promise<NearRawTransaction>` |
|
|
106
|
-
| `signAndSubmitTxn` | `(tx: NearRawTransaction
|
|
108
|
+
| `signAndSubmitTxn` | `(tx: NearRawTransaction) => Promise<string>` *(the concrete class adds an optional `opts?: NearWalletDefaults`)* |
|
|
107
109
|
|
|
108
110
|
Plus public fields (PK mode only): `account?: Account`, `rpcProvider?: JsonRpcProvider`.
|
|
109
111
|
|
|
@@ -5,7 +5,7 @@ One row per chain. Use this when you know the chain and need to look up everythi
|
|
|
5
5
|
| Chain | Class | Config union | Interface (`@sodax/types`) | Default merge helper | Discriminant |
|
|
6
6
|
|---|---|---|---|---|---|
|
|
7
7
|
| EVM | `EvmWalletProvider` | `EvmWalletConfig` | `IEvmWalletProvider` | `mergePolicy` (per-method) | Field presence (no `type`) |
|
|
8
|
-
| Solana | `SolanaWalletProvider` | `SolanaWalletConfig` | `ISolanaWalletProvider` |
|
|
8
|
+
| Solana | `SolanaWalletProvider` | `SolanaWalletConfig` | `ISolanaWalletProvider` | flat (read directly) | Field presence (no `type`) |
|
|
9
9
|
| Sui | `SuiWalletProvider` | `SuiWalletConfig` | `ISuiWalletProvider` | `mergePolicy` (per-method) | Field presence — uses `mnemonics` |
|
|
10
10
|
| Bitcoin | `BitcoinWalletProvider` | `BitcoinWalletConfig` | `IBitcoinWalletProvider` | `mergeDefaults` (flat) | **`type` field** (`'PRIVATE_KEY' \| 'BROWSER_EXTENSION'`) |
|
|
11
11
|
| Stellar | `StellarWalletProvider` | `StellarWalletConfig` | `IStellarWalletProvider` | `mergeDefaults` (flat) | **`type` field** |
|
|
@@ -14,7 +14,7 @@ One row per chain. Use this when you know the chain and need to look up everythi
|
|
|
14
14
|
| NEAR | `NearWalletProvider` | `NearWalletConfig` | `INearWalletProvider` | `mergeDefaults` (flat) | Field presence (no `type`) |
|
|
15
15
|
| Stacks | `StacksWalletProvider` | `StacksWalletConfig` | `IStacksWalletProvider` | `mergeDefaults` (flat) | Field presence (no `type`) |
|
|
16
16
|
|
|
17
|
-
> EVM
|
|
17
|
+
> EVM and Sui group their `defaults` per method (e.g. `defaults.sendTransaction`, `defaults.signAndExecuteTxn`) via `mergePolicy`. Every other chain (incl. Solana) has a flat `defaults` object. See [`../architecture.md`](../architecture.md) § `BaseWalletProvider`.
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -65,7 +65,7 @@ pnpm exec tsc --noEmit | grep -iE "wallet-sdk-core|WalletProvider|WalletConfig"
|
|
|
65
65
|
|
|
66
66
|
## Tip: typecheck-driven verification
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
Running `pnpm exec tsc --noEmit` across your codebase reveals breaking changes — but for wallet-sdk-core specifically, **none of those errors come from this package**. If you see `wallet-sdk-core` in the error output, it's most likely:
|
|
69
69
|
|
|
70
70
|
- A deep import from `src/...` (never supported; the v2 source layout differs).
|
|
71
71
|
- Indirect — a broken `@sodax/sdk` / `@sodax/types` signature that includes a wallet-provider type.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sodax-wallet-sdk-core-near
|
|
3
|
+
description: 'Granular skill for the @sodax/wallet-sdk-core v2 NEAR wallet provider only — `NearWalletProvider` (backed by near-api-js for PK signing + @hot-labs/near-connect for browser flows). Use when a backend / Node script / CI / bot / non-React browser flow needs to instantiate a NEAR provider directly and sign + submit — e.g. "instantiate NearWalletProvider", "NEAR private-key signing in Node", "signAndSubmitTxn", "getRawTransaction for inspection". Covers BOTH integration (write new v2 code) and migration (port v1 — almost a no-op at this surface: deep-import → barrel). Picks via Step 1. Links into the parent sodax-wallet-sdk-core knowledge tree. For React dapps use the sodax-wallet-sdk-react skill instead (get the typed provider via useWalletProvider).'
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: '0.0.1'
|
|
7
|
+
author: sodax
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# NEAR (`wallet-sdk-core` granular skill)
|
|
11
|
+
|
|
12
|
+
Granular skill for `NearWalletProvider` — the low-level NEAR wallet for backend / Node / non-React flows. Source-of-truth reference lives in the parent broad skill's knowledge tree; this file is the focused workflow only.
|
|
13
|
+
|
|
14
|
+
## Step 1 — Clarify with user before coding
|
|
15
|
+
|
|
16
|
+
1. **New code or v1 → v2 port?** New → § Integration. Port v1 → § Migration (almost always a no-op here).
|
|
17
|
+
2. **Private-key or browser-extension config?** NEAR discriminates by **field presence** (no `type`): PK = `{ rpcUrl, accountId, privateKey }` where `privateKey` is the full `'ed25519:…'` string; browser-extension = `{ wallet: NearConnector }` (from `@hot-labs/near-connect`). Mutually exclusive — pick one.
|
|
18
|
+
3. **Finality vs speed?** `defaults.waitUntil` is `'FINAL'` by default — lower (`'EXECUTED'`) for faster scripts with the usual revert caveats.
|
|
19
|
+
|
|
20
|
+
## Integration workflow (new v2 code)
|
|
21
|
+
|
|
22
|
+
1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DON'T (read first).
|
|
23
|
+
2. [`../integration/knowledge/architecture.md`](../integration/knowledge/architecture.md) — `BaseWalletProvider`, dual-config discriminants, shallow `defaults` merge, library-exports.
|
|
24
|
+
3. [`../integration/knowledge/features/near.md`](../integration/knowledge/features/near.md) — full config union, `NearWalletDefaults`, methods (`getRawTransaction` / `signAndSubmitTxn`), gotchas.
|
|
25
|
+
4. Setup recipe → [`../integration/knowledge/recipes/setup-private-key.md`](../integration/knowledge/recipes/setup-private-key.md) or [`../integration/knowledge/recipes/setup-browser-extension.md`](../integration/knowledge/recipes/setup-browser-extension.md); then [`../integration/knowledge/recipes/sign-and-broadcast.md`](../integration/knowledge/recipes/sign-and-broadcast.md), [`../integration/knowledge/recipes/defaults-and-overrides.md`](../integration/knowledge/recipes/defaults-and-overrides.md).
|
|
26
|
+
5. Lookups → [`../integration/knowledge/reference/provider-classes.md`](../integration/knowledge/reference/provider-classes.md), [`interfaces.md`](../integration/knowledge/reference/interfaces.md), [`chain-support.md`](../integration/knowledge/reference/chain-support.md).
|
|
27
|
+
|
|
28
|
+
### NEAR-specific anti-patterns
|
|
29
|
+
|
|
30
|
+
- **Passing only the key bytes.** `privateKey` is the full `'ed25519:…'` string (NEAR stores the algorithm prefix).
|
|
31
|
+
- **Omitting `accountId` in PK mode.** NEAR keys don't determine the account — accounts hold multiple keys, so both are required.
|
|
32
|
+
- **Passing a low-level wallet object in browser-extension mode.** Pass the `@hot-labs/near-connect` `NearConnector` — it already abstracts over Meteor / MyNearWallet / etc.
|
|
33
|
+
- **Reading `account` / `rpcProvider` in browser-extension mode.** Those public fields are PK-mode only.
|
|
34
|
+
- **Mixing PK + browser-extension fields.** Discriminated union — don't `as`.
|
|
35
|
+
|
|
36
|
+
## Migration workflow (port v1 → v2)
|
|
37
|
+
|
|
38
|
+
1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — headline: **v1 code drops in unchanged at this surface**.
|
|
39
|
+
2. Only mechanical change: deep-import → barrel ([`../migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md`](../migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md)). Optionally adopt `defaults` ([`defaults-config.md`](../migration-v1-to-v2/knowledge/breaking-changes/defaults-config.md)) / re-imported library types ([`library-exports.md`](../migration-v1-to-v2/knowledge/breaking-changes/library-exports.md)).
|
|
40
|
+
3. Compile errors on `@sodax/sdk` / `@sodax/types` symbols → not this migration; load the `sodax-sdk` skill (migration mode).
|
|
41
|
+
|
|
42
|
+
## Verification
|
|
43
|
+
|
|
44
|
+
1. `pnpm tsc --noEmit` exits clean.
|
|
45
|
+
2. PK config carries `accountId` + the prefixed `ed25519:` key; config uses exactly one variant.
|
|
46
|
+
3. No v1 deep imports from `@sodax/wallet-sdk-core/wallet-providers/` (migration only).
|
|
47
|
+
|
|
48
|
+
## Related skills (same family)
|
|
49
|
+
|
|
50
|
+
Sibling chain skills follow the same shape — evm, solana, sui, bitcoin, stellar, icon, injective, stacks. For multi-chain or undecided work, load the broad [`sodax-wallet-sdk-core` skill](../SKILL.md).
|
|
51
|
+
|
|
52
|
+
## Passing the provider into the SDK (different package family)
|
|
53
|
+
|
|
54
|
+
This skill *builds* the provider. For the concrete handoff, see [`../integration/knowledge/recipes/bridge-to-sdk.md`](../integration/knowledge/recipes/bridge-to-sdk.md). To execute SODAX operations, **also load the `sodax-sdk` skill (integration mode)** and pass it as `{ raw: false, walletProvider }`. React dapps get the provider via `useWalletProvider(...)` — **load the `sodax-wallet-sdk-react` skill** instead.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sodax-wallet-sdk-core-solana
|
|
3
|
+
description: 'Granular skill for the @sodax/wallet-sdk-core v2 Solana wallet provider only — `SolanaWalletProvider` (backed by @solana/web3.js + wallet-adapter interfaces). Use when a backend / Node script / CI / bot / non-React browser flow needs to instantiate a Solana provider directly and sign + broadcast — e.g. "instantiate SolanaWalletProvider", "private-key Solana signing in Node", "build a v0 transaction", "sendTransactionWithConfirmation". Covers BOTH integration (write new v2 code) and migration (port v1 — almost a no-op at this surface: deep-import → barrel). Picks via Step 1. Links into the parent sodax-wallet-sdk-core knowledge tree. For React dapps use the sodax-wallet-sdk-react skill instead (get the typed provider via useWalletProvider).'
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: '0.0.1'
|
|
7
|
+
author: sodax
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Solana (`wallet-sdk-core` granular skill)
|
|
11
|
+
|
|
12
|
+
Granular skill for `SolanaWalletProvider` — the low-level Solana wallet for backend / Node / non-React flows. Source-of-truth reference lives in the parent broad skill's knowledge tree; this file is the focused workflow only.
|
|
13
|
+
|
|
14
|
+
## Step 1 — Clarify with user before coding
|
|
15
|
+
|
|
16
|
+
1. **New code or v1 → v2 port?** New → § Integration. Port v1 → § Migration (almost always a no-op here).
|
|
17
|
+
2. **Private-key or browser-extension config?** Solana discriminates by **field presence** (no `type`): PK = `{ privateKey: Uint8Array, endpoint }` (Node / CI / bots); browser-extension = `{ wallet: WalletContextState, endpoint }`. Mutually exclusive — pick one.
|
|
18
|
+
3. **Need confirmation?** `sendTransaction` fires-and-returns the signature; `sendTransactionWithConfirmation` waits (default `confirmCommitment: 'finalized'`).
|
|
19
|
+
|
|
20
|
+
## Integration workflow (new v2 code)
|
|
21
|
+
|
|
22
|
+
1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DON'T (read first).
|
|
23
|
+
2. [`../integration/knowledge/architecture.md`](../integration/knowledge/architecture.md) — `BaseWalletProvider`, dual-config discriminants, shallow `defaults` merge, library-exports.
|
|
24
|
+
3. [`../integration/knowledge/features/solana.md`](../integration/knowledge/features/solana.md) — full config union, `SolanaWalletDefaults`, methods (`buildV0Txn` / `sendTransaction` / `sendTransactionWithConfirmation` / `getAssociatedTokenAddress`), gotchas.
|
|
25
|
+
4. Setup recipe → [`../integration/knowledge/recipes/setup-private-key.md`](../integration/knowledge/recipes/setup-private-key.md) or [`../integration/knowledge/recipes/setup-browser-extension.md`](../integration/knowledge/recipes/setup-browser-extension.md); then [`../integration/knowledge/recipes/sign-and-broadcast.md`](../integration/knowledge/recipes/sign-and-broadcast.md), [`../integration/knowledge/recipes/defaults-and-overrides.md`](../integration/knowledge/recipes/defaults-and-overrides.md).
|
|
26
|
+
5. Lookups → [`../integration/knowledge/reference/provider-classes.md`](../integration/knowledge/reference/provider-classes.md), [`interfaces.md`](../integration/knowledge/reference/interfaces.md), [`chain-support.md`](../integration/knowledge/reference/chain-support.md).
|
|
27
|
+
|
|
28
|
+
### Solana-specific anti-patterns
|
|
29
|
+
|
|
30
|
+
- **Mixing PK + browser-extension fields.** Discriminated union — don't `as` across variants.
|
|
31
|
+
- **Constructing transactions yourself.** `buildV0Txn` is the canonical path — it picks the keypair-vs-adapter signing route internally based on construction mode.
|
|
32
|
+
- **Forgetting `endpoint`.** It's required in both modes — unlike EVM there is **no public-RPC fallback**.
|
|
33
|
+
- **Assuming `WalletContextState.signTransaction` exists.** It may be `undefined` (mirrors wallet-adapter); the provider throws at signing time if missing.
|
|
34
|
+
- **Expecting `defaults` to deep-merge.** Shallow; and `connectionConfig` overrides `connectionCommitment` if both set.
|
|
35
|
+
|
|
36
|
+
## Migration workflow (port v1 → v2)
|
|
37
|
+
|
|
38
|
+
1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — headline: **v1 code drops in unchanged at this surface**.
|
|
39
|
+
2. Only mechanical change: deep-import → barrel ([`../migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md`](../migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md)). Optionally adopt `defaults` ([`defaults-config.md`](../migration-v1-to-v2/knowledge/breaking-changes/defaults-config.md)) / re-imported library types ([`library-exports.md`](../migration-v1-to-v2/knowledge/breaking-changes/library-exports.md)).
|
|
40
|
+
3. Compile errors on `@sodax/sdk` / `@sodax/types` symbols → not this migration; load the `sodax-sdk` skill (migration mode).
|
|
41
|
+
|
|
42
|
+
## Verification
|
|
43
|
+
|
|
44
|
+
1. `pnpm tsc --noEmit` exits clean.
|
|
45
|
+
2. Config uses exactly one discriminant variant.
|
|
46
|
+
3. No v1 deep imports from `@sodax/wallet-sdk-core/wallet-providers/` (migration only).
|
|
47
|
+
|
|
48
|
+
## Related skills (same family)
|
|
49
|
+
|
|
50
|
+
Sibling chain skills follow the same shape — evm, sui, bitcoin, stellar, icon, injective, near, stacks. For multi-chain or undecided work, load the broad [`sodax-wallet-sdk-core` skill](../SKILL.md).
|
|
51
|
+
|
|
52
|
+
## Passing the provider into the SDK (different package family)
|
|
53
|
+
|
|
54
|
+
This skill *builds* the provider. For the concrete handoff, see [`../integration/knowledge/recipes/bridge-to-sdk.md`](../integration/knowledge/recipes/bridge-to-sdk.md). To execute SODAX operations, **also load the `sodax-sdk` skill (integration mode)** and pass it as `{ raw: false, walletProvider }`. React dapps get the provider via `useWalletProvider(...)` — **load the `sodax-wallet-sdk-react` skill** instead.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sodax-wallet-sdk-core-stacks
|
|
3
|
+
description: 'Granular skill for the @sodax/wallet-sdk-core v2 Stacks wallet provider only — `StacksWalletProvider` (backed by @stacks/transactions + @stacks/connect). Use when a backend / Node script / CI / bot / non-React browser flow needs to instantiate a Stacks provider directly and sign + broadcast — e.g. "instantiate StacksWalletProvider", "Stacks private-key signing in Node", "sendTransaction with post-conditions", "readContract Clarity value". Covers BOTH integration (write new v2 code) and migration (port v1 — almost a no-op at this surface: deep-import → barrel). Picks via Step 1. Links into the parent sodax-wallet-sdk-core knowledge tree. For React dapps use the sodax-wallet-sdk-react skill instead (get the typed provider via useWalletProvider).'
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: '0.0.1'
|
|
7
|
+
author: sodax
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Stacks (`wallet-sdk-core` granular skill)
|
|
11
|
+
|
|
12
|
+
Granular skill for `StacksWalletProvider` — the low-level Stacks wallet for backend / Node / non-React flows. Source-of-truth reference lives in the parent broad skill's knowledge tree; this file is the focused workflow only.
|
|
13
|
+
|
|
14
|
+
## Step 1 — Clarify with user before coding
|
|
15
|
+
|
|
16
|
+
1. **New code or v1 → v2 port?** New → § Integration. Port v1 → § Migration (almost always a no-op here).
|
|
17
|
+
2. **Private-key or browser-extension config?** Stacks discriminates by **field presence** (no `type`): PK = `{ privateKey, endpoint? }`; browser-extension = `{ address, endpoint?, provider? }` (Leather / Xverse / Asigna). Mutually exclusive — pick one.
|
|
18
|
+
3. **Network?** `defaults.network` is `'mainnet' | 'testnet'` (default `'mainnet'`); addresses are environment-specific (`SP…` vs `ST…`).
|
|
19
|
+
|
|
20
|
+
## Integration workflow (new v2 code)
|
|
21
|
+
|
|
22
|
+
1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DON'T (read first).
|
|
23
|
+
2. [`../integration/knowledge/architecture.md`](../integration/knowledge/architecture.md) — `BaseWalletProvider`, dual-config discriminants, shallow `defaults` merge, library-exports.
|
|
24
|
+
3. [`../integration/knowledge/features/stacks.md`](../integration/knowledge/features/stacks.md) — full config union, `StacksWalletDefaults`, methods (`sendTransaction` / `readContract` / `getBalance`), `PostConditionMode` enum, gotchas.
|
|
25
|
+
4. Setup recipe → [`../integration/knowledge/recipes/setup-private-key.md`](../integration/knowledge/recipes/setup-private-key.md) or [`../integration/knowledge/recipes/setup-browser-extension.md`](../integration/knowledge/recipes/setup-browser-extension.md); then [`../integration/knowledge/recipes/sign-and-broadcast.md`](../integration/knowledge/recipes/sign-and-broadcast.md), [`../integration/knowledge/recipes/library-exports.md`](../integration/knowledge/recipes/library-exports.md) (`PostConditionMode`), [`../integration/knowledge/recipes/defaults-and-overrides.md`](../integration/knowledge/recipes/defaults-and-overrides.md).
|
|
26
|
+
5. Lookups → [`../integration/knowledge/reference/provider-classes.md`](../integration/knowledge/reference/provider-classes.md), [`interfaces.md`](../integration/knowledge/reference/interfaces.md), [`chain-support.md`](../integration/knowledge/reference/chain-support.md).
|
|
27
|
+
|
|
28
|
+
### Stacks-specific anti-patterns
|
|
29
|
+
|
|
30
|
+
- **Adding `@stacks/transactions` as a direct dep for `PostConditionMode`.** It's re-exported as a runtime value from `@sodax/wallet-sdk-core` — import it from the barrel.
|
|
31
|
+
- **Crossing mainnet/testnet addresses.** `network: 'mainnet'` → `STACKS_MAINNET` (`SP…`); `'testnet'` → `STACKS_TESTNET` (`ST…`). Cross-environment addresses reject.
|
|
32
|
+
- **Assuming a `provider` is required in browser-extension mode.** It's optional — omitted, the provider falls back to the globally-injected `window` provider; pass it explicitly for tests / non-injected envs.
|
|
33
|
+
- **Mixing PK + browser-extension fields.** Discriminated union — don't `as`.
|
|
34
|
+
|
|
35
|
+
## Migration workflow (port v1 → v2)
|
|
36
|
+
|
|
37
|
+
1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — headline: **v1 code drops in unchanged at this surface**.
|
|
38
|
+
2. Only mechanical change: deep-import → barrel ([`../migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md`](../migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md)). Optionally adopt `defaults` ([`defaults-config.md`](../migration-v1-to-v2/knowledge/breaking-changes/defaults-config.md)) / re-imported library types ([`library-exports.md`](../migration-v1-to-v2/knowledge/breaking-changes/library-exports.md)).
|
|
39
|
+
3. Compile errors on `@sodax/sdk` / `@sodax/types` symbols → not this migration; load the `sodax-sdk` skill (migration mode).
|
|
40
|
+
|
|
41
|
+
## Verification
|
|
42
|
+
|
|
43
|
+
1. `pnpm tsc --noEmit` exits clean.
|
|
44
|
+
2. `PostConditionMode` imported from `@sodax/wallet-sdk-core`; config uses exactly one variant.
|
|
45
|
+
3. No v1 deep imports from `@sodax/wallet-sdk-core/wallet-providers/` (migration only).
|
|
46
|
+
|
|
47
|
+
## Related skills (same family)
|
|
48
|
+
|
|
49
|
+
Sibling chain skills follow the same shape — evm, solana, sui, bitcoin, stellar, icon, injective, near. For multi-chain or undecided work, load the broad [`sodax-wallet-sdk-core` skill](../SKILL.md).
|
|
50
|
+
|
|
51
|
+
## Passing the provider into the SDK (different package family)
|
|
52
|
+
|
|
53
|
+
This skill *builds* the provider. For the concrete handoff, see [`../integration/knowledge/recipes/bridge-to-sdk.md`](../integration/knowledge/recipes/bridge-to-sdk.md). To execute SODAX operations, **also load the `sodax-sdk` skill (integration mode)** and pass it as `{ raw: false, walletProvider }`. React dapps get the provider via `useWalletProvider(...)` — **load the `sodax-wallet-sdk-react` skill** instead.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sodax-wallet-sdk-core-stellar
|
|
3
|
+
description: 'Granular skill for the @sodax/wallet-sdk-core v2 Stellar wallet provider only — `StellarWalletProvider` (backed by @stellar/stellar-sdk: Horizon only — classic Transaction signing + Horizon.Server polling). Use when a backend / Node script / CI / bot / non-React browser flow needs to instantiate a Stellar provider directly and sign XDR transactions — e.g. "instantiate StellarWalletProvider", "sign XDR in Node", "Stellar private-key signing", "waitForTransactionReceipt poll tuning". Covers BOTH integration (write new v2 code) and migration (port v1 — almost a no-op at this surface: deep-import → barrel). Picks via Step 1. Links into the parent sodax-wallet-sdk-core knowledge tree. For React dapps use the sodax-wallet-sdk-react skill instead (get the typed provider via useWalletProvider).'
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: '0.0.1'
|
|
7
|
+
author: sodax
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Stellar (`wallet-sdk-core` granular skill)
|
|
11
|
+
|
|
12
|
+
Granular skill for `StellarWalletProvider` — the low-level Stellar wallet for backend / Node / non-React flows. Source-of-truth reference lives in the parent broad skill's knowledge tree; this file is the focused workflow only.
|
|
13
|
+
|
|
14
|
+
## Step 1 — Clarify with user before coding
|
|
15
|
+
|
|
16
|
+
1. **New code or v1 → v2 port?** New → § Integration. Port v1 → § Migration (almost always a no-op here).
|
|
17
|
+
2. **Private-key or browser-extension config?** Stellar discriminates by an **explicit uppercase `type`** (`'PRIVATE_KEY'` | `'BROWSER_EXTENSION'`). PK = `{ type: 'PRIVATE_KEY', privateKey, network, rpcUrl? }`; browser-extension = `{ type: 'BROWSER_EXTENSION', walletsKit, network }` (Freighter / xBull / Lobstr). `network` is `'TESTNET' | 'PUBLIC'`.
|
|
18
|
+
3. **Mainnet confirmation?** Tune `defaults.pollInterval` / `pollTimeout` — keep `pollTimeout` ≥ 30 000 ms on mainnet.
|
|
19
|
+
|
|
20
|
+
## Integration workflow (new v2 code)
|
|
21
|
+
|
|
22
|
+
1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DON'T (read first).
|
|
23
|
+
2. [`../integration/knowledge/architecture.md`](../integration/knowledge/architecture.md) — `BaseWalletProvider`, dual-config discriminants, shallow `defaults` merge, library-exports.
|
|
24
|
+
3. [`../integration/knowledge/features/stellar.md`](../integration/knowledge/features/stellar.md) — full config union, `StellarWalletDefaults`, `StellarWalletsKit` shape, methods (`signTransaction` / `waitForTransactionReceipt`), gotchas.
|
|
25
|
+
4. Setup recipe → [`../integration/knowledge/recipes/setup-private-key.md`](../integration/knowledge/recipes/setup-private-key.md) or [`../integration/knowledge/recipes/setup-browser-extension.md`](../integration/knowledge/recipes/setup-browser-extension.md); then [`../integration/knowledge/recipes/sign-and-broadcast.md`](../integration/knowledge/recipes/sign-and-broadcast.md), [`../integration/knowledge/recipes/defaults-and-overrides.md`](../integration/knowledge/recipes/defaults-and-overrides.md).
|
|
26
|
+
5. Lookups → [`../integration/knowledge/reference/provider-classes.md`](../integration/knowledge/reference/provider-classes.md), [`interfaces.md`](../integration/knowledge/reference/interfaces.md), [`chain-support.md`](../integration/knowledge/reference/chain-support.md).
|
|
27
|
+
|
|
28
|
+
### Stellar-specific anti-patterns
|
|
29
|
+
|
|
30
|
+
- **Forgetting the `type` discriminant.** Stellar and Bitcoin use an **uppercase `type` field** — every other chain uses field presence.
|
|
31
|
+
- **Mutating `networkPassphrase` directly.** It's derived from `network` and is private — override only via `defaults.networkPassphrase` (FUTURENET / private nets).
|
|
32
|
+
- **Setting `pollTimeout` too low on mainnet.** Confirmation typically takes 5–30 s; a low timeout surfaces false negatives.
|
|
33
|
+
- **Treating XDR as anything but a string.** Both tx input and signed output are `XDR` strings (alias from `@sodax/types`).
|
|
34
|
+
- **Mixing PK + browser-extension fields.** Discriminated union — don't `as`.
|
|
35
|
+
|
|
36
|
+
## Migration workflow (port v1 → v2)
|
|
37
|
+
|
|
38
|
+
1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — headline: **v1 code drops in unchanged at this surface**.
|
|
39
|
+
2. Only mechanical change: deep-import → barrel ([`../migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md`](../migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md)). Optionally adopt `defaults` ([`defaults-config.md`](../migration-v1-to-v2/knowledge/breaking-changes/defaults-config.md)) / re-imported library types ([`library-exports.md`](../migration-v1-to-v2/knowledge/breaking-changes/library-exports.md)).
|
|
40
|
+
3. Compile errors on `@sodax/sdk` / `@sodax/types` symbols → not this migration; load the `sodax-sdk` skill (migration mode).
|
|
41
|
+
|
|
42
|
+
## Verification
|
|
43
|
+
|
|
44
|
+
1. `pnpm tsc --noEmit` exits clean.
|
|
45
|
+
2. Config sets `type` and uses exactly one variant.
|
|
46
|
+
3. No v1 deep imports from `@sodax/wallet-sdk-core/wallet-providers/` (migration only).
|
|
47
|
+
|
|
48
|
+
## Related skills (same family)
|
|
49
|
+
|
|
50
|
+
Sibling chain skills follow the same shape — evm, solana, sui, bitcoin, icon, injective, near, stacks. For multi-chain or undecided work, load the broad [`sodax-wallet-sdk-core` skill](../SKILL.md).
|
|
51
|
+
|
|
52
|
+
## Passing the provider into the SDK (different package family)
|
|
53
|
+
|
|
54
|
+
This skill *builds* the provider. For the concrete handoff, see [`../integration/knowledge/recipes/bridge-to-sdk.md`](../integration/knowledge/recipes/bridge-to-sdk.md). To execute SODAX operations, **also load the `sodax-sdk` skill (integration mode)** and pass it as `{ raw: false, walletProvider }`. React dapps get the provider via `useWalletProvider(...)` — **load the `sodax-wallet-sdk-react` skill** instead.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sodax-wallet-sdk-core-sui
|
|
3
|
+
description: 'Granular skill for the @sodax/wallet-sdk-core v2 Sui wallet provider only — `SuiWalletProvider` (backed by @mysten/sui + @mysten/wallet-standard). Use when a backend / Node script / CI / bot / non-React browser flow needs to instantiate a Sui provider directly and sign + execute — e.g. "instantiate SuiWalletProvider", "Sui signing from a mnemonic in Node", "signAndExecuteTxn with dry-run". Covers BOTH integration (write new v2 code) and migration (port v1 — almost a no-op at this surface: deep-import → barrel). Picks via Step 1. Links into the parent sodax-wallet-sdk-core knowledge tree. For React dapps use the sodax-wallet-sdk-react skill instead (get the typed provider via useWalletProvider).'
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: '0.0.1'
|
|
7
|
+
author: sodax
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Sui (`wallet-sdk-core` granular skill)
|
|
11
|
+
|
|
12
|
+
Granular skill for `SuiWalletProvider` — the low-level Sui wallet for backend / Node / non-React flows. Source-of-truth reference lives in the parent broad skill's knowledge tree; this file is the focused workflow only.
|
|
13
|
+
|
|
14
|
+
## Step 1 — Clarify with user before coding
|
|
15
|
+
|
|
16
|
+
1. **New code or v1 → v2 port?** New → § Integration. Port v1 → § Migration (almost always a no-op here).
|
|
17
|
+
2. **Private-key or browser-extension config?** Sui discriminates by **field presence** (no `type`) but the PK credential is a **`mnemonics`** string (BIP-39), not a raw key: PK = `{ rpcUrl, mnemonics }`; browser-extension = `{ client, wallet, account }` (all THREE required). Mutually exclusive — pick one.
|
|
18
|
+
3. **Dry-run?** `signAndExecuteTxn` runs a pre-flight dry-run **on by default**; disable only when paying gas for a doomed tx is acceptable.
|
|
19
|
+
|
|
20
|
+
## Integration workflow (new v2 code)
|
|
21
|
+
|
|
22
|
+
1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DON'T (read first).
|
|
23
|
+
2. [`../integration/knowledge/architecture.md`](../integration/knowledge/architecture.md) — `BaseWalletProvider`, dual-config discriminants, shallow `defaults` merge, library-exports.
|
|
24
|
+
3. [`../integration/knowledge/features/sui.md`](../integration/knowledge/features/sui.md) — full config union, `SuiWalletDefaults`, methods (`signAndExecuteTxn` / `viewContract` / `getCoins`), gotchas.
|
|
25
|
+
4. Setup recipe → [`../integration/knowledge/recipes/setup-private-key.md`](../integration/knowledge/recipes/setup-private-key.md) or [`../integration/knowledge/recipes/setup-browser-extension.md`](../integration/knowledge/recipes/setup-browser-extension.md); then [`../integration/knowledge/recipes/sign-and-broadcast.md`](../integration/knowledge/recipes/sign-and-broadcast.md), [`../integration/knowledge/recipes/defaults-and-overrides.md`](../integration/knowledge/recipes/defaults-and-overrides.md).
|
|
26
|
+
5. Lookups → [`../integration/knowledge/reference/provider-classes.md`](../integration/knowledge/reference/provider-classes.md), [`interfaces.md`](../integration/knowledge/reference/interfaces.md), [`chain-support.md`](../integration/knowledge/reference/chain-support.md).
|
|
27
|
+
|
|
28
|
+
### Sui-specific anti-patterns
|
|
29
|
+
|
|
30
|
+
- **Passing a raw private key.** The PK variant accepts only a `mnemonics` phrase — the library derives the Ed25519 keypair. There is no raw-secret-key constructor.
|
|
31
|
+
- **Forgetting the active `account` in browser-extension mode.** It needs all three of `client` + `wallet` + `account`; many adapters expose the first two but not the active account (fetch via `wallet.accounts[0]`).
|
|
32
|
+
- **Disabling dry-run by default.** It's on for safety — production scripts almost never want `{ dryRun: { enabled: false } }`.
|
|
33
|
+
- **Mixing PK + browser-extension fields.** Discriminated union — don't `as`.
|
|
34
|
+
|
|
35
|
+
## Migration workflow (port v1 → v2)
|
|
36
|
+
|
|
37
|
+
1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — headline: **v1 code drops in unchanged at this surface**.
|
|
38
|
+
2. Only mechanical change: deep-import → barrel ([`../migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md`](../migration-v1-to-v2/knowledge/breaking-changes/folder-layout.md)). Optionally adopt `defaults` ([`defaults-config.md`](../migration-v1-to-v2/knowledge/breaking-changes/defaults-config.md)) / re-imported library types ([`library-exports.md`](../migration-v1-to-v2/knowledge/breaking-changes/library-exports.md)).
|
|
39
|
+
3. Compile errors on `@sodax/sdk` / `@sodax/types` symbols → not this migration; load the `sodax-sdk` skill (migration mode).
|
|
40
|
+
|
|
41
|
+
## Verification
|
|
42
|
+
|
|
43
|
+
1. `pnpm tsc --noEmit` exits clean.
|
|
44
|
+
2. Config uses exactly one discriminant variant; browser-extension passes all three objects.
|
|
45
|
+
3. No v1 deep imports from `@sodax/wallet-sdk-core/wallet-providers/` (migration only).
|
|
46
|
+
|
|
47
|
+
## Related skills (same family)
|
|
48
|
+
|
|
49
|
+
Sibling chain skills follow the same shape — evm, solana, bitcoin, stellar, icon, injective, near, stacks. For multi-chain or undecided work, load the broad [`sodax-wallet-sdk-core` skill](../SKILL.md).
|
|
50
|
+
|
|
51
|
+
## Passing the provider into the SDK (different package family)
|
|
52
|
+
|
|
53
|
+
This skill *builds* the provider. For the concrete handoff, see [`../integration/knowledge/recipes/bridge-to-sdk.md`](../integration/knowledge/recipes/bridge-to-sdk.md). To execute SODAX operations, **also load the `sodax-sdk` skill (integration mode)** and pass it as `{ raw: false, walletProvider }`. React dapps get the provider via `useWalletProvider(...)` — **load the `sodax-wallet-sdk-react` skill** instead.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sodax-wallet-sdk-react
|
|
3
|
-
description: '
|
|
3
|
+
description: 'Add SODAX multi-chain wallet connectivity to a React dapp with @sodax/wallet-sdk-react — connect/disconnect, account & signing hooks, a headless wallet modal, WalletConnect, and bridging the connected wallet into @sodax/sdk. INTEGRATION (write NEW code) — the React wallet connectivity layer for multi-chain dapps. Covers `SodaxWalletProvider` setup, hook-based connect/disconnect/account/signing UX across 9 chain types (EVM, Solana, Sui, Bitcoin, Stellar, ICON, Injective, NEAR, Stacks), headless wallet-modal primitives, WalletConnect for non-injected wallets (Fireblocks/Ledger/mobile), and `useWalletProvider` for bridging the connected wallet into `@sodax/sdk` calls. Use whenever a React dapp needs SODAX wallet connectivity. Triggers on "add wallet connect", "set up SodaxWalletProvider", "useXConnect", "useXAccount", "useWalletProvider", "useWalletModal", "wallet modal", "connect button", "multi-chain wallet UI", "WalletConnect for Fireblocks". Peer deps: `react >= 19`, `@tanstack/react-query 5.x`. MIGRATION (port v1 → v2) — the v2 reshape removed `useXWagmiStore` from the public API (each selector must be replaced with a public hook like `useXServices` / `useXService({ xChainType })` / `useXConnections` / `useXConnection({ xChainType })`; do NOT rename to `useXWalletStore` — the v2 barrel does not export it), unified hook signatures to single-object params, reshaped `SodaxWalletProvider` props (removed `rpcConfig` / `options` / `initialState` in favor of `config: SodaxWalletConfig`), and flattened the chain-slot wrapper (`chains: { EVM, SOLANA, ... }` → top-level slots on `SodaxWalletConfig`). Triggers on "useXWagmiStore is gone", "SodaxWalletProvider props broke", "old wallet-sdk-react hooks", "upgrade @sodax/wallet-sdk-react". Load this skill if EITHER applies; the body gates by mode.'
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: '0.0.1'
|
|
7
|
+
author: sodax
|
|
4
8
|
---
|
|
5
9
|
|
|
6
10
|
# When to use this skill
|
|
@@ -61,8 +65,6 @@ Headless building blocks (render-agnostic, wallet-agnostic):
|
|
|
61
65
|
| `useIsWalletInstalled({ connectors?, chainType? })` | Cross-chain install check; filters AND. |
|
|
62
66
|
| `sortConnectors(xs, { preferred })` | Preferred first, then installed, then original. |
|
|
63
67
|
|
|
64
|
-
Reference app: `apps/wallet-modal-example` in the SODAX monorepo.
|
|
65
|
-
|
|
66
68
|
### Top traps to avoid (integration)
|
|
67
69
|
|
|
68
70
|
1. **Passing both `xChainId` and `xChainType`** to `useXAccount` / `useWalletProvider`. They're mutually exclusive.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sodax-wallet-sdk-react-bridge-to-sdk
|
|
3
|
+
description: 'Granular skill for the @sodax/wallet-sdk-react v2 wallet-provider bridge only — useWalletProvider, which turns the connected wallet into a typed IXxxWalletProvider to pass into @sodax/sdk (or @sodax/dapp-kit hooks) for signing. Use when a React dapp has wallet connectivity working and now needs to execute a SODAX operation — e.g. "useWalletProvider", "pass the connected wallet into a Sodax swap", "get IEvmWalletProvider in React", "sign a Sodax tx from React", "feed walletProvider to a dapp-kit mutation". Covers BOTH integration (write new v2 code) and migration (port v1 — single-object params; the deleted useSpokeProvider). Picks via Step 1. Links into the parent sodax-wallet-sdk-react knowledge tree. The consuming side (raw SDK calls / dapp-kit hooks) lives in the sodax-sdk and sodax-dapp-kit skills.'
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: '0.0.1'
|
|
7
|
+
author: sodax
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Bridge to SDK (`wallet-sdk-react` granular skill)
|
|
11
|
+
|
|
12
|
+
Granular skill for `useWalletProvider` — the single hook that bridges a connected wallet into `@sodax/sdk` / `@sodax/dapp-kit` calls. Source-of-truth reference lives in the parent broad skill's knowledge tree; this file is the focused workflow only.
|
|
13
|
+
|
|
14
|
+
## Step 1 — Clarify with user before coding
|
|
15
|
+
|
|
16
|
+
1. **New code or v1 → v2 port?** New → § Integration. Port v1 → § Migration.
|
|
17
|
+
2. **Consuming via raw `@sodax/sdk` or `@sodax/dapp-kit` hooks?** Either way `useWalletProvider` returns the same typed provider; the call-shape on the other side differs (load the sibling-package skill — prose pointer below).
|
|
18
|
+
3. **Which chain narrowing?** Pass `xChainId` (a chain key) for the narrowest type (`IEvmWalletProvider`, …); `xChainType` for family-level; no arg for the broad `IWalletProvider`.
|
|
19
|
+
|
|
20
|
+
## Integration workflow (new v2 code)
|
|
21
|
+
|
|
22
|
+
1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DON'T (read first).
|
|
23
|
+
2. [`../integration/knowledge/recipes/setup.md`](../integration/knowledge/recipes/setup.md) — prerequisite: provider mounted, chain slots declared.
|
|
24
|
+
3. [`../integration/knowledge/recipes/bridge-to-sdk.md`](../integration/knowledge/recipes/bridge-to-sdk.md) — the full pattern: narrow with `useWalletProvider({ xChainId })`, pass into the SDK call with `raw: false`.
|
|
25
|
+
4. Lookups → [`../integration/knowledge/reference/hooks.md`](../integration/knowledge/reference/hooks.md) (wallet-provider bridge section).
|
|
26
|
+
|
|
27
|
+
### Bridge-specific anti-patterns
|
|
28
|
+
|
|
29
|
+
- **Casting the return of `useWalletProvider`.** Use the chain-key narrowing pattern (pass a specific `xChainId`) to get the typed `IXxxWalletProvider` without `as` — the hook's broad-union return is intentional.
|
|
30
|
+
- **Passing both `xChainId` and `xChainType`.** Mutually exclusive.
|
|
31
|
+
- **Reaching for the deleted v1 `useSpokeProvider`.** Gone — pass the `useWalletProvider(...)` result directly into the SDK / dapp-kit call (`{ raw: false, walletProvider }`).
|
|
32
|
+
- **Forgetting the `undefined` case.** `useWalletProvider` returns `undefined` when the chain is disabled or no wallet is connected — guard before passing it on.
|
|
33
|
+
|
|
34
|
+
## Migration workflow (port v1 → v2)
|
|
35
|
+
|
|
36
|
+
1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — DO / DON'T (read first).
|
|
37
|
+
2. [`../migration-v1-to-v2/knowledge/breaking-changes.md`](../migration-v1-to-v2/knowledge/breaking-changes.md) — single-object hook params; the deleted store/spoke-provider patterns.
|
|
38
|
+
3. Symbol lookups → [`../migration-v1-to-v2/knowledge/reference/hooks.md`](../migration-v1-to-v2/knowledge/reference/hooks.md).
|
|
39
|
+
|
|
40
|
+
## Verification
|
|
41
|
+
|
|
42
|
+
1. `pnpm tsc --noEmit` exits clean.
|
|
43
|
+
2. `useWalletProvider` is narrowed via `xChainId` (no `as` cast on its return).
|
|
44
|
+
3. The provider's `undefined` case is guarded before the SDK call.
|
|
45
|
+
4. No `useSpokeProvider` references (migration only).
|
|
46
|
+
|
|
47
|
+
## Related skills (same family)
|
|
48
|
+
|
|
49
|
+
- [`../connect/SKILL.md`](../connect/SKILL.md) — get the wallet connected first.
|
|
50
|
+
- [`../switch-chain/SKILL.md`](../switch-chain/SKILL.md) — ensure the EVM wallet is on the right network before signing.
|
|
51
|
+
|
|
52
|
+
For multi-feature work, load the broad [`sodax-wallet-sdk-react` skill](../SKILL.md).
|
|
53
|
+
|
|
54
|
+
## The consuming side (different package family)
|
|
55
|
+
|
|
56
|
+
This skill produces the `walletProvider`; it does **not** make the SODAX call. For the raw SDK call shape (`{ raw: false, walletProvider }`), **also load the `sodax-sdk` skill (integration mode)**. For React Query hooks that take `walletProvider` through `mutate(vars)`, **also load the `sodax-dapp-kit` skill (integration mode)**.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sodax-wallet-sdk-react-connect
|
|
3
|
+
description: 'Granular skill for the @sodax/wallet-sdk-react v2 core connect surface only — connect / disconnect, reading account + connection state, and connector discovery across 9 chain types: useXConnect, useXDisconnect, useXAccount(s), useXConnection(s), useXConnectors, useXConnectorsByChain, useIsWalletInstalled, useEnabledChains. Use when a React dapp needs a connect/disconnect button, to read the connected address per chain, gate UI on connection, or list available wallets — e.g. "add a wallet connect button", "useXConnect", "useXAccount per chain", "is the wallet connected", "list connectors for EVM". Covers BOTH integration (write new v2 code) and migration (port v1 — single-object hook params, useXWagmiStore removed). Picks via Step 1. Links into the parent sodax-wallet-sdk-react knowledge tree. For the full multi-chain modal use the sibling wallet-modal skill; to feed the wallet into @sodax/sdk use the bridge-to-sdk skill.'
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: '0.0.1'
|
|
7
|
+
author: sodax
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Connect (`wallet-sdk-react` granular skill)
|
|
11
|
+
|
|
12
|
+
Granular skill for the everyday connect / disconnect + account-state + connector-discovery hooks of `@sodax/wallet-sdk-react` v2. React-only — backend wallets use `@sodax/wallet-sdk-core` directly. Source-of-truth reference lives in the parent broad skill's knowledge tree; this file is the focused workflow only.
|
|
13
|
+
|
|
14
|
+
## Step 1 — Clarify with user before coding
|
|
15
|
+
|
|
16
|
+
1. **New code or v1 → v2 port?** New → § Integration. Port v1 → § Migration.
|
|
17
|
+
2. **Which task?** A connect/disconnect button (`useXConnect` / `useXDisconnect`), reading the account (`useXAccount` / `useXAccounts`), connection metadata (`useXConnection` / `useXConnections`), or listing wallets (`useXConnectors` / `useIsWalletInstalled`). Advanced: per-chain service access + `getXConnectorById` via `useXService` / `useXServices`.
|
|
18
|
+
3. **Single chain or per-family?** `useXAccount` takes **either** `xChainId` (chain key, narrowest typing) **or** `xChainType` (family) — never both.
|
|
19
|
+
|
|
20
|
+
## Integration workflow (new v2 code)
|
|
21
|
+
|
|
22
|
+
1. [`../integration/knowledge/ai-rules.md`](../integration/knowledge/ai-rules.md) — DO / DON'T (read first).
|
|
23
|
+
2. [`../integration/knowledge/recipes/setup.md`](../integration/knowledge/recipes/setup.md) — prerequisite: mount `SodaxWalletProvider`, declare chain-type slots, wire React Query.
|
|
24
|
+
3. [`../integration/knowledge/architecture.md`](../integration/knowledge/architecture.md) — provider mount tree, frozen config, `xChainType` vs `xChainId`, persist hydration.
|
|
25
|
+
4. [`../integration/knowledge/recipes/connect-button.md`](../integration/knowledge/recipes/connect-button.md) and [`../integration/knowledge/recipes/chain-detection.md`](../integration/knowledge/recipes/chain-detection.md).
|
|
26
|
+
5. Lookups → [`../integration/knowledge/reference/hooks.md`](../integration/knowledge/reference/hooks.md) (incl. the service-level `useXService` / `useXServices`), [`connectors.md`](../integration/knowledge/reference/connectors.md), [`wallet-brands.md`](../integration/knowledge/reference/wallet-brands.md).
|
|
27
|
+
|
|
28
|
+
### Connect-specific anti-patterns
|
|
29
|
+
|
|
30
|
+
- **Passing both `xChainId` and `xChainType`** to `useXAccount` — mutually exclusive (throws).
|
|
31
|
+
- **Reading `useXConnect`'s resolved value for the account.** For provider-managed chains (EVM/Solana/Sui) it resolves `undefined` — read the account via `useXAccount` *after* the mutation lands.
|
|
32
|
+
- **Importing concrete connector classes from the barrel.** `EvmXService`, `XverseXConnector`, etc. are deep-import only (`@sodax/wallet-sdk-react/xchains/<chain>`) — see [`../integration/knowledge/recipes/sub-path-imports.md`](../integration/knowledge/recipes/sub-path-imports.md).
|
|
33
|
+
- **Calling hooks on a slot not in `walletConfig`.** Read-hooks degrade to empty (`useXConnectors` returns `[]` + a one-time warn). `useXConnect` *throws* (`Chain "<X>" is not enabled or ChainActions not registered`); `useXDisconnect` does not — it warns and resolves silently. Safe to call unconditionally, but branch on the return.
|
|
34
|
+
|
|
35
|
+
## Migration workflow (port v1 → v2)
|
|
36
|
+
|
|
37
|
+
1. [`../migration-v1-to-v2/knowledge/ai-rules.md`](../migration-v1-to-v2/knowledge/ai-rules.md) — DO / DON'T (read first).
|
|
38
|
+
2. [`../migration-v1-to-v2/knowledge/breaking-changes.md`](../migration-v1-to-v2/knowledge/breaking-changes.md) — `useXWagmiStore` removed from the public API (replace each selector with a public hook); single-object hook params.
|
|
39
|
+
3. [`../migration-v1-to-v2/knowledge/recipes/connect-button.md`](../migration-v1-to-v2/knowledge/recipes/connect-button.md) — v1 positional-args button → v2.
|
|
40
|
+
4. Symbol lookups → [`../migration-v1-to-v2/knowledge/reference/imports.md`](../migration-v1-to-v2/knowledge/reference/imports.md) (store-hook field-to-hook map), [`hooks.md`](../migration-v1-to-v2/knowledge/reference/hooks.md).
|
|
41
|
+
|
|
42
|
+
## Verification
|
|
43
|
+
|
|
44
|
+
1. `pnpm tsc --noEmit` exits clean.
|
|
45
|
+
2. No `useXAccount` / `useWalletProvider` call passes both `xChainId` and `xChainType`.
|
|
46
|
+
3. `grep -rE 'useXWagmiStore|useXWalletStore' src/` is empty (migration only — v2 exports neither).
|
|
47
|
+
4. Account is read after connect lands, not from `useXConnect`'s resolved value.
|
|
48
|
+
|
|
49
|
+
## Related skills (same family)
|
|
50
|
+
|
|
51
|
+
- [`../wallet-modal/SKILL.md`](../wallet-modal/SKILL.md) — the full headless multi-chain modal + batch connect.
|
|
52
|
+
- [`../bridge-to-sdk/SKILL.md`](../bridge-to-sdk/SKILL.md) — feed the connected wallet into `@sodax/sdk` calls.
|
|
53
|
+
- [`../switch-chain/SKILL.md`](../switch-chain/SKILL.md) — EVM wrong-network handling.
|
|
54
|
+
|
|
55
|
+
For multi-feature work, load the broad [`sodax-wallet-sdk-react` skill](../SKILL.md).
|
|
56
|
+
|
|
57
|
+
## Wiring into dapp-kit (different package family)
|
|
58
|
+
|
|
59
|
+
The `xService` from `useXService` is what `@sodax/dapp-kit`'s balance hook (`useXBalances`) consumes, and the `useWalletProvider` result — see the [`bridge-to-sdk`](../bridge-to-sdk/SKILL.md) sibling skill — feeds dapp-kit's mutation hooks. For that consuming side and its exact param shapes, **also load the `sodax-dapp-kit` skill (integration mode)**.
|
|
@@ -71,7 +71,7 @@ The package keeps connection state in a Zustand store keyed by `ChainType`. The
|
|
|
71
71
|
// @ai-snippets-skip
|
|
72
72
|
// internal shape — do NOT import
|
|
73
73
|
{
|
|
74
|
-
xServices: Partial<Record<ChainType,
|
|
74
|
+
xServices: Partial<Record<ChainType, XService>>,
|
|
75
75
|
xConnections: Partial<Record<ChainType, XConnection>>,
|
|
76
76
|
// …plus internal mutations
|
|
77
77
|
}
|
|
@@ -90,7 +90,7 @@ You should **not** read the store directly. Use the public hooks. The store hook
|
|
|
90
90
|
|
|
91
91
|
For EVM, available wallets are discovered via [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) — browser extensions broadcast their metadata and `useXConnectors({ xChainType: 'EVM' })` builds the list at runtime. No hardcoded wallet registry; new wallets installed by the user appear without an SDK update.
|
|
92
92
|
|
|
93
|
-
Other chains ship a curated connector list (Bitcoin: Xverse / Unisat / OKX, Sui: dapp-kit's standard connectors, Solana: wallet-adapter's standard connectors, etc.). For each connector, `isInstalled` reflects whether the underlying extension/wallet is detected. `sortConnectors(list, { preferred })` puts installed connectors first — call it once in your render path; the result is stable per render.
|
|
93
|
+
Other chains ship a curated connector list (Bitcoin: Xverse / Unisat / OKX / Hana, Sui: dapp-kit's standard connectors, Solana: wallet-adapter's standard connectors, etc.). For each connector, `isInstalled` reflects whether the underlying extension/wallet is detected. `sortConnectors(list, { preferred })` puts installed connectors first — call it once in your render path; the result is stable per render.
|
|
94
94
|
|
|
95
95
|
---
|
|
96
96
|
|
|
@@ -99,7 +99,7 @@ Other chains ship a curated connector list (Bitcoin: Xverse / Unisat / OKX, Sui:
|
|
|
99
99
|
Two parallel addressing schemes:
|
|
100
100
|
|
|
101
101
|
- **`xChainType: ChainType`** — family-level (`'EVM'`, `'SOLANA'`, `'BITCOIN'`, …). 9 values total.
|
|
102
|
-
- **`xChainId: SpokeChainKey`** — chain-specific key from `@sodax/types` (`ChainKeys.ETHEREUM_MAINNET`, `ChainKeys.BSC_MAINNET`, …).
|
|
102
|
+
- **`xChainId: SpokeChainKey`** — chain-specific key from `@sodax/types` (`ChainKeys.ETHEREUM_MAINNET`, `ChainKeys.BSC_MAINNET`, …). Inspect `@sodax/types` for the current set.
|
|
103
103
|
|
|
104
104
|
Hooks that accept both enforce **exactly one** at runtime *and* at the type level. Passing both, neither, or `undefined` for both throws.
|
|
105
105
|
|
|
@@ -72,7 +72,7 @@ export function ChainPicker({ onPick }: { onPick: (c: ChainType) => void }) {
|
|
|
72
72
|
| Field | Type | Source |
|
|
73
73
|
|-------|------|--------|
|
|
74
74
|
| `chainType` | `ChainType` | The slot key (`'EVM'`, `'SOLANA'`, …) |
|
|
75
|
-
| `chainIds` | `readonly SpokeChainKey[]` | All chain keys sharing this `chainType` (e.g.
|
|
75
|
+
| `chainIds` | `readonly SpokeChainKey[]` | All chain keys sharing this `chainType` (e.g. every `ChainKeys.*` whose chain type is EVM, for `'EVM'`) |
|
|
76
76
|
| `displayName` | `string` | Default per-chain display name |
|
|
77
77
|
| `iconUrl` | `string \| undefined` | `undefined` = SDK doesn't ship one — provide your own |
|
|
78
78
|
| `isConnected` | `boolean` | `true` when an account is connected for this chain |
|
|
@@ -13,7 +13,7 @@ Single-chain connect/disconnect button — pick a connector, connect, read the a
|
|
|
13
13
|
| `useXConnectors({ xChainType })` | List available connectors for the chain family |
|
|
14
14
|
| `useXConnect()` | React Query mutation — `mutate(connector)` |
|
|
15
15
|
| `useXAccount({ xChainType })` | Read connected account (always returns object — `address` is `undefined` when disconnected) |
|
|
16
|
-
| `useXDisconnect()` | Returns `(xChainType) => Promise<void>` |
|
|
16
|
+
| `useXDisconnect()` | Returns `(args: { xChainType: ChainType }) => Promise<void>` |
|
|
17
17
|
| `sortConnectors(list, { preferred })` | Optional — rank installed/preferred wallets first |
|
|
18
18
|
|
|
19
19
|
---
|