@sodax/wallet-sdk-core 1.5.7-beta → 2.0.0-rc.2

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.
Files changed (53) hide show
  1. package/README.md +231 -1
  2. package/ai-exported/AGENTS.md +139 -0
  3. package/ai-exported/integration/README.md +108 -0
  4. package/ai-exported/integration/ai-rules.md +141 -0
  5. package/ai-exported/integration/architecture.md +212 -0
  6. package/ai-exported/integration/features/README.md +22 -0
  7. package/ai-exported/integration/features/bitcoin.md +103 -0
  8. package/ai-exported/integration/features/evm.md +102 -0
  9. package/ai-exported/integration/features/icon.md +88 -0
  10. package/ai-exported/integration/features/injective.md +92 -0
  11. package/ai-exported/integration/features/near.md +92 -0
  12. package/ai-exported/integration/features/solana.md +104 -0
  13. package/ai-exported/integration/features/stacks.md +91 -0
  14. package/ai-exported/integration/features/stellar.md +95 -0
  15. package/ai-exported/integration/features/sui.md +96 -0
  16. package/ai-exported/integration/quickstart.md +259 -0
  17. package/ai-exported/integration/recipes/README.md +15 -0
  18. package/ai-exported/integration/recipes/bridge-to-sdk.md +145 -0
  19. package/ai-exported/integration/recipes/defaults-and-overrides.md +159 -0
  20. package/ai-exported/integration/recipes/library-exports.md +129 -0
  21. package/ai-exported/integration/recipes/setup-browser-extension.md +137 -0
  22. package/ai-exported/integration/recipes/setup-private-key.md +115 -0
  23. package/ai-exported/integration/recipes/sign-and-broadcast.md +201 -0
  24. package/ai-exported/integration/recipes/testing.md +163 -0
  25. package/ai-exported/integration/reference/README.md +13 -0
  26. package/ai-exported/integration/reference/chain-support.md +65 -0
  27. package/ai-exported/integration/reference/glossary.md +28 -0
  28. package/ai-exported/integration/reference/interfaces.md +131 -0
  29. package/ai-exported/integration/reference/provider-classes.md +54 -0
  30. package/ai-exported/integration/reference/public-api.md +128 -0
  31. package/ai-exported/migration/README.md +84 -0
  32. package/ai-exported/migration/ai-rules.md +139 -0
  33. package/ai-exported/migration/breaking-changes/README.md +14 -0
  34. package/ai-exported/migration/breaking-changes/base-wallet-provider.md +52 -0
  35. package/ai-exported/migration/breaking-changes/defaults-config.md +57 -0
  36. package/ai-exported/migration/breaking-changes/folder-layout.md +99 -0
  37. package/ai-exported/migration/breaking-changes/library-exports.md +58 -0
  38. package/ai-exported/migration/checklist.md +62 -0
  39. package/ai-exported/migration/recipes/README.md +12 -0
  40. package/ai-exported/migration/recipes/adopt-defaults.md +84 -0
  41. package/ai-exported/migration/recipes/adopt-library-exports.md +99 -0
  42. package/ai-exported/migration/reference/README.md +12 -0
  43. package/ai-exported/migration/reference/added-fields.md +71 -0
  44. package/ai-exported/migration/reference/deleted-exports.md +35 -0
  45. package/ai-exported/migration/reference/renamed-symbols.md +31 -0
  46. package/ai-exported/migration/reference/return-shapes.md +23 -0
  47. package/dist/index.cjs +3200 -2392
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.cts +415 -128
  50. package/dist/index.d.ts +415 -128
  51. package/dist/index.mjs +3197 -2395
  52. package/dist/index.mjs.map +1 -1
  53. package/package.json +10 -8
@@ -0,0 +1,99 @@
1
+ # Recipe: Adopt `library-exports` (optional cleanup)
2
+
3
+ Re-import types from `@sodax/wallet-sdk-core` instead of upstream chain SDKs. Optionally drop direct chain-SDK deps from `package.json`.
4
+
5
+ **Apply when:** the user imports type names like `WalletClient`, `PublicClient`, `Networks`, `PostConditionMode`, `NearConnector`, etc. directly from their upstream packages.
6
+
7
+ For the full list of re-exported types, see [`../../integration/recipes/library-exports.md`](../../integration/recipes/library-exports.md).
8
+
9
+ ---
10
+
11
+ ## Before
12
+
13
+ ```ts
14
+ import type { WalletClient, PublicClient, TransactionReceipt } from 'viem';
15
+ import { Networks } from '@stellar/stellar-sdk';
16
+ import { PostConditionMode } from '@stacks/transactions';
17
+ import type { WalletAccount, WalletWithFeatures, SuiWalletFeatures } from '@mysten/wallet-standard';
18
+ import type { Commitment, ConnectionConfig, SendOptions } from '@solana/web3.js';
19
+ ```
20
+
21
+ ## After
22
+
23
+ ```ts
24
+ import type {
25
+ WalletClient,
26
+ PublicClient,
27
+ TransactionReceipt,
28
+ WalletAccount,
29
+ WalletWithFeatures,
30
+ SuiWalletFeatures,
31
+ Commitment,
32
+ ConnectionConfig,
33
+ SendOptions,
34
+ } from '@sodax/wallet-sdk-core';
35
+
36
+ import { Networks, PostConditionMode } from '@sodax/wallet-sdk-core';
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Steps
42
+
43
+ 1. **Identify candidate imports.** Run the grep below to find type imports from upstream chain SDKs:
44
+ ```bash
45
+ grep -rn "from 'viem'" <user-src> | grep -E "WalletClient|PublicClient|TransactionReceipt|SendTransactionParameters|WaitForTransactionReceiptParameters"
46
+ grep -rn "from '@stellar/stellar-sdk'" <user-src> | grep "Networks"
47
+ grep -rn "from '@stacks/transactions'" <user-src> | grep -E "PostConditionMode|ClarityValue|PostConditionModeName"
48
+ # …see ../../integration/recipes/library-exports.md for the full grep list
49
+ ```
50
+
51
+ 2. **Replace one import statement at a time.** Switch the `from` clause to `@sodax/wallet-sdk-core`. Re-run `pnpm checkTs` after each file.
52
+
53
+ 3. **Check whether the upstream package is still needed for runtime.** If the consumer's only remaining import from `viem` (etc.) is one of the re-exported types, you can drop the dep from `package.json`. If they also import `createPublicClient`, `Connection`, `Transaction`, etc. — keep the dep.
54
+
55
+ ```bash
56
+ grep -rn "from 'viem'" <user-src> # confirm nothing remains
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Trade-offs
62
+
63
+ | Switch | Trade-off |
64
+ |---|---|
65
+ | Type imports | Lossless. Same symbol, different module. |
66
+ | Dep removal (after switching all imports) | Smaller `node_modules`, faster installs. But you re-add the dep if you later need a runtime helper. |
67
+ | Version pinning | After dep removal, you no longer control the chain-SDK version directly — it's locked to whatever SODAX uses. Acceptable for most apps. |
68
+
69
+ ---
70
+
71
+ ## When NOT to adopt
72
+
73
+ | Scenario | Why skip |
74
+ |---|---|
75
+ | The user is pinned to a specific chain-SDK version different from SODAX's | Adopting library-exports forces SODAX's version. Keep direct imports. |
76
+ | The user imports many runtime symbols (`createPublicClient`, etc.) not in library-exports | Migration churn for limited benefit — they still need the dep. |
77
+ | The user is mid-migration to another chain SDK and library-exports doesn't cover the new one | Wait until library-exports catches up, or just keep the direct dep. |
78
+
79
+ ---
80
+
81
+ ## Verification
82
+
83
+ ```bash
84
+ # 1. Type check
85
+ pnpm checkTs
86
+
87
+ # 2. No remaining direct upstream-SDK type imports
88
+ grep -rn "from 'viem'" <user-src> | grep -E "WalletClient|PublicClient|TransactionReceipt"
89
+ # expect empty (or kept on purpose with justification)
90
+
91
+ # 3. Optional: confirm the upstream dep was actually removed
92
+ cat <user>/package.json | jq -r '.dependencies | keys[]'
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Why
98
+
99
+ See [`../breaking-changes/library-exports.md`](../breaking-changes/library-exports.md) for the motivation.
@@ -0,0 +1,12 @@
1
+ # Migration reference
2
+
3
+ Lookup tables. Use these to answer "what was renamed / added / removed" without reading the breaking-change narratives.
4
+
5
+ | File | Use for |
6
+ |---|---|
7
+ | [`renamed-symbols.md`](./renamed-symbols.md) | Old name → new name. |
8
+ | [`deleted-exports.md`](./deleted-exports.md) | Symbols removed; what to use instead. |
9
+ | [`added-fields.md`](./added-fields.md) | New optional fields you can adopt. |
10
+ | [`return-shapes.md`](./return-shapes.md) | Method return shapes that changed (none currently — placeholder for future). |
11
+
12
+ For narrative WHY behind each change, see [`../breaking-changes/`](../breaking-changes/).
@@ -0,0 +1,71 @@
1
+ # Added fields and types
2
+
3
+ Additive changes that older code does not use. All optional — no migration required.
4
+
5
+ ---
6
+
7
+ ## New types
8
+
9
+ | Type | Chain(s) | Purpose |
10
+ |---|---|---|
11
+ | `EvmWalletDefaults` | EVM | `defaults` slice shape |
12
+ | `EvmSendTransactionPolicy` | EVM | Per-call options shape for `sendTransaction` |
13
+ | `EvmWaitForTransactionReceiptPolicy` | EVM | Per-call options shape for `waitForTransactionReceipt` |
14
+ | `SolanaWalletDefaults` | Solana | `defaults` slice shape |
15
+ | `SuiWalletDefaults` | Sui | `defaults` slice shape |
16
+ | `SuiSignAndExecutePolicy` | Sui | Per-call options for `signAndExecuteTxn` |
17
+ | `SuiGetCoinsPolicy` | Sui | Per-call options for `getCoins` |
18
+ | `BitcoinWalletDefaults` | Bitcoin | `defaults` slice shape |
19
+ | `StellarWalletDefaults` | Stellar | `defaults` slice shape |
20
+ | `IconWalletDefaults` | ICON | `defaults` slice shape |
21
+ | `InjectiveWalletDefaults` | Injective | `defaults` slice shape |
22
+ | `NearWalletDefaults` | NEAR | `defaults` slice shape |
23
+ | `NearTxExecutionStatus` | NEAR | Status union for `waitUntil` default |
24
+ | `StacksWalletDefaults` | Stacks | `defaults` slice shape |
25
+ | `BaseWalletProvider<TDefaults>` | all | Abstract base class (consumers do not subclass) |
26
+
27
+ ---
28
+
29
+ ## New optional fields on existing configs
30
+
31
+ | Config | Field | Default if omitted |
32
+ |---|---|---|
33
+ | `PrivateKeyEvmWalletConfig` | `defaults?: EvmWalletDefaults` | `{}` |
34
+ | `BrowserExtensionEvmWalletConfig` | `defaults?: EvmWalletDefaults` | `{}` (note: transport/clients in defaults are no-ops here) |
35
+ | `PrivateKeySolanaWalletConfig` | `defaults?: SolanaWalletDefaults` | `{}` |
36
+ | `BrowserExtensionSolanaWalletConfig` | `defaults?: SolanaWalletDefaults` | `{}` |
37
+ | `PrivateKeySuiWalletConfig` | `defaults?: SuiWalletDefaults` | `{}` |
38
+ | `BrowserExtensionSuiWalletConfig` | `defaults?: SuiWalletDefaults` | `{}` |
39
+ | `PrivateKeyBitcoinWalletConfig` | `defaults?: BitcoinWalletDefaults` | `{}` |
40
+ | `BrowserExtensionBitcoinWalletConfig` | `defaults?: BitcoinWalletDefaults` | `{}` |
41
+ | `PrivateKeyStellarWalletConfig` | `defaults?: StellarWalletDefaults` | `{}` |
42
+ | `BrowserExtensionStellarWalletConfig` | `defaults?: StellarWalletDefaults` | `{}` |
43
+ | `PrivateKeyIconWalletConfig` | `defaults?: IconWalletDefaults` | `{}` |
44
+ | `BrowserExtensionIconWalletConfig` | `defaults?: IconWalletDefaults` | `{}` |
45
+ | `SecretInjectiveWalletConfig` | `defaults?: InjectiveWalletDefaults` | `{}` |
46
+ | `BrowserExtensionInjectiveWalletConfig` | `defaults?: InjectiveWalletDefaults` | `{}` |
47
+ | `PrivateKeyNearWalletConfig` | `defaults?: NearWalletDefaults` | `{}` |
48
+ | `BrowserExtensionNearWalletConfig` | `defaults?: NearWalletDefaults` | `{}` |
49
+ | `PrivateKeyStacksWalletConfig` | `defaults?: StacksWalletDefaults` | `{}` |
50
+ | `BrowserExtensionStacksWalletConfig` | `defaults?: StacksWalletDefaults` | `{}` |
51
+
52
+ ---
53
+
54
+ ## New library-exports re-exports
55
+
56
+ See [`../../integration/recipes/library-exports.md`](../../integration/recipes/library-exports.md) for the full table. Re-exporting these means consumers can drop direct deps on upstream chain SDKs for type-only usage.
57
+
58
+ Summary:
59
+
60
+ - **viem** — `Account`, `Address`, `Chain`, `Transport`, `PublicClient`, `WalletClient`, `HttpTransportConfig`, `PublicClientConfig`, `WalletClientConfig`, `SendTransactionParameters`, `WaitForTransactionReceiptParameters`, `TransactionReceipt`
61
+ - **@mysten/sui** — `SuiTransactionBlockResponseOptions`, `Transaction`, `TransactionArgument`
62
+ - **@mysten/wallet-standard** — `SuiWalletFeatures`, `WalletAccount`, `WalletWithFeatures`
63
+ - **@solana/web3.js** — `Commitment`, `ConnectionConfig`, `SendOptions`
64
+ - **@injectivelabs/*** — `Network`, `ChainId`, `EvmChainId`, `MsgBroadcaster`
65
+ - **@stellar/stellar-sdk** — `Networks` (runtime value)
66
+ - **@stacks/transactions** — `PostConditionMode` (runtime enum), `ClarityValue`, `PostConditionModeName`
67
+ - **@stacks/network** — `StacksNetwork`
68
+ - **@stacks/connect** — `StacksProvider`
69
+ - **near-api-js** — `KeyPairString`
70
+ - **@hot-labs/near-connect** — `NearConnector`
71
+ - **bitcoinjs-lib** — `Network as BitcoinJsNetwork`
@@ -0,0 +1,35 @@
1
+ # Deleted exports
2
+
3
+ **No symbols were deleted from the public surface between v1 and v2.** Every v1 named export is still available on v2's barrel.
4
+
5
+ If a v1 import does not compile against v2, the cause is most likely:
6
+
7
+ | Symptom | Likely cause |
8
+ |---|---|
9
+ | `Cannot find module '@sodax/wallet-sdk-core/wallet-providers/EvmWalletProvider'` | Deep import from v1's flat layout. Replace with barrel: `from '@sodax/wallet-sdk-core'`. See [`../breaking-changes/folder-layout.md`](../breaking-changes/folder-layout.md). |
10
+ | `'X' has no exported member 'Y'` against `@sodax/sdk` or `@sodax/types` | Not this package. See the corresponding package's migration docs. |
11
+ | Symbol `shallowMerge` not found | Internal in both v1 and v2 (v1 didn't even have it). Use `defaults` config + per-call options. |
12
+
13
+ ---
14
+
15
+ ## Internal symbols (never publicly exported, in any version)
16
+
17
+ | Symbol | Where it lives | Replacement |
18
+ |---|---|---|
19
+ | `shallowMerge` | `src/utils/merge.ts` (v2 only — did not exist in v1) | Use the `defaults` config + per-call options. Merge is automatic. |
20
+ | `serializeReceipt` | private static on `EvmWalletProvider` | `waitForTransactionReceipt` already returns the serialised shape. |
21
+ | Anything under `src/utils/` | — | Internal. |
22
+
23
+ If user code deep-imports one of these, it must be replaced with a public API call.
24
+
25
+ ---
26
+
27
+ ## How to verify
28
+
29
+ ```bash
30
+ grep -rn "shallowMerge" <user-src>
31
+ # expect empty
32
+
33
+ grep -rn "@sodax/wallet-sdk-core/" <user-src> | grep -v "from '@sodax/wallet-sdk-core'"
34
+ # expect empty
35
+ ```
@@ -0,0 +1,31 @@
1
+ # Renamed symbols
2
+
3
+ **None.** No symbol exported from `@sodax/wallet-sdk-core` was renamed between v1 and v2.
4
+
5
+ This file exists so AI agents and humans can look up "what was renamed" and get a definitive **nothing**. If you suspect a rename, you are almost certainly looking at the wrong package:
6
+
7
+ - `@sodax/sdk` — has real v1→v2 renames (e.g. `EvmSpokeProvider` → `EvmSpokeService`).
8
+ - `@sodax/types` — has real v1→v2 renames (e.g. `SONIC_MAINNET_CHAIN_ID` removed in favor of `ChainKeys.SONIC_MAINNET`).
9
+ - `@sodax/wallet-sdk-react` — has real v1→v2 renames (e.g. `useXWagmiStore` removed; `rpcConfig` prop → `config`).
10
+
11
+ For wallet-sdk-core itself, v1 and v2 share **identical** public type names:
12
+
13
+ - `EvmWalletConfig`, `PrivateKeyEvmWalletConfig`, `BrowserExtensionEvmWalletConfig`
14
+ - `SolanaWalletConfig`, `PrivateKeySolanaWalletConfig`, `BrowserExtensionSolanaWalletConfig`
15
+ - `SuiWalletConfig`, `PrivateKeySuiWalletConfig`, `BrowserExtensionSuiWalletConfig`
16
+ - `BitcoinWalletConfig`, `PrivateKeyBitcoinWalletConfig`, `BrowserExtensionBitcoinWalletConfig`
17
+ - `StellarWalletConfig`, `PrivateKeyStellarWalletConfig`, `BrowserExtensionStellarWalletConfig`
18
+ - `IconWalletConfig`, `PrivateKeyIconWalletConfig`, `BrowserExtensionIconWalletConfig`
19
+ - `InjectiveWalletConfig`, **`SecretInjectiveWalletConfig`** (note: not `PrivateKey*` — same in v1), `BrowserExtensionInjectiveWalletConfig`
20
+ - `NearWalletConfig`, `PrivateKeyNearWalletConfig`, `BrowserExtensionNearWalletConfig`
21
+ - `StacksWalletConfig`, `PrivateKeyStacksWalletConfig`, `BrowserExtensionStacksWalletConfig`
22
+
23
+ …and the corresponding provider class names (`EvmWalletProvider`, …).
24
+
25
+ If a v1 codebase compiles against v2 with no symbol-not-found errors, that is the expected outcome.
26
+
27
+ ---
28
+
29
+ ## What WAS added
30
+
31
+ See [`added-fields.md`](./added-fields.md) for new types (`*WalletDefaults`, `*Policy` types, `BaseWalletProvider`) and new optional fields (`defaults?`, Stellar's `rpcUrl?`).
@@ -0,0 +1,23 @@
1
+ # Return shapes
2
+
3
+ Method return shapes that changed between RC versions.
4
+
5
+ ---
6
+
7
+ ## Currently: no breaking return-shape changes
8
+
9
+ All provider method return types are stable across the RC series. This file is a placeholder — future return-shape changes will be documented here in the same format used by `@sodax/sdk`'s migration docs (paired before/after shapes per method).
10
+
11
+ ---
12
+
13
+ ## What to check anyway
14
+
15
+ If you suspect a return shape issue:
16
+
17
+ ```bash
18
+ pnpm checkTs
19
+ ```
20
+
21
+ Any TypeScript error mentioning a `@sodax/wallet-sdk-core` method's return type is most likely (a) propagated from `@sodax/sdk` / `@sodax/types` (which **did** change between v1 and v2), or (b) the consumer is reading a method that **never had** the shape they expect.
22
+
23
+ For (a), open an issue with the version delta — we'll add it to this file. For (b), see [`../../integration/reference/interfaces.md`](../../integration/reference/interfaces.md) for the authoritative current shape.