@sodax/wallet-sdk-core 2.0.0-rc.3 → 2.0.0-rc.5

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 +1 -2
  2. package/dist/index.cjs +14 -18
  3. package/dist/index.d.cts +6 -7
  4. package/dist/index.d.ts +6 -7
  5. package/dist/index.mjs +4 -8
  6. package/package.json +19 -14
  7. package/ai-exported/AGENTS.md +0 -139
  8. package/ai-exported/integration/README.md +0 -108
  9. package/ai-exported/integration/ai-rules.md +0 -141
  10. package/ai-exported/integration/architecture.md +0 -212
  11. package/ai-exported/integration/features/README.md +0 -22
  12. package/ai-exported/integration/features/bitcoin.md +0 -103
  13. package/ai-exported/integration/features/evm.md +0 -102
  14. package/ai-exported/integration/features/icon.md +0 -88
  15. package/ai-exported/integration/features/injective.md +0 -92
  16. package/ai-exported/integration/features/near.md +0 -92
  17. package/ai-exported/integration/features/solana.md +0 -104
  18. package/ai-exported/integration/features/stacks.md +0 -91
  19. package/ai-exported/integration/features/stellar.md +0 -95
  20. package/ai-exported/integration/features/sui.md +0 -96
  21. package/ai-exported/integration/quickstart.md +0 -259
  22. package/ai-exported/integration/recipes/README.md +0 -15
  23. package/ai-exported/integration/recipes/bridge-to-sdk.md +0 -145
  24. package/ai-exported/integration/recipes/defaults-and-overrides.md +0 -159
  25. package/ai-exported/integration/recipes/library-exports.md +0 -129
  26. package/ai-exported/integration/recipes/setup-browser-extension.md +0 -137
  27. package/ai-exported/integration/recipes/setup-private-key.md +0 -115
  28. package/ai-exported/integration/recipes/sign-and-broadcast.md +0 -201
  29. package/ai-exported/integration/recipes/testing.md +0 -163
  30. package/ai-exported/integration/reference/README.md +0 -13
  31. package/ai-exported/integration/reference/chain-support.md +0 -65
  32. package/ai-exported/integration/reference/glossary.md +0 -28
  33. package/ai-exported/integration/reference/interfaces.md +0 -131
  34. package/ai-exported/integration/reference/provider-classes.md +0 -54
  35. package/ai-exported/integration/reference/public-api.md +0 -128
  36. package/ai-exported/migration/README.md +0 -84
  37. package/ai-exported/migration/ai-rules.md +0 -139
  38. package/ai-exported/migration/breaking-changes/README.md +0 -14
  39. package/ai-exported/migration/breaking-changes/base-wallet-provider.md +0 -52
  40. package/ai-exported/migration/breaking-changes/defaults-config.md +0 -57
  41. package/ai-exported/migration/breaking-changes/folder-layout.md +0 -99
  42. package/ai-exported/migration/breaking-changes/library-exports.md +0 -58
  43. package/ai-exported/migration/checklist.md +0 -62
  44. package/ai-exported/migration/recipes/README.md +0 -12
  45. package/ai-exported/migration/recipes/adopt-defaults.md +0 -84
  46. package/ai-exported/migration/recipes/adopt-library-exports.md +0 -99
  47. package/ai-exported/migration/reference/README.md +0 -12
  48. package/ai-exported/migration/reference/added-fields.md +0 -71
  49. package/ai-exported/migration/reference/deleted-exports.md +0 -35
  50. package/ai-exported/migration/reference/renamed-symbols.md +0 -31
  51. package/ai-exported/migration/reference/return-shapes.md +0 -23
  52. package/dist/index.cjs.map +0 -1
  53. package/dist/index.mjs.map +0 -1
package/README.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  The Sodax wallet-sdk-core is a core wallet SDK package containing implementations of wallet providers that enable multi-chain wallet connectivity. This package provides TypeScript implementations of wallet providers for various blockchain networks, making them compatible with the Core Sodax SDK (@sodax/sdk).
4
4
 
5
- > **AI-friendly docs:** see [`ai-exported/AGENTS.md`](./ai-exported/AGENTS.md) for the agent-readable integration & migration guide.
6
- > Entry points: [`ai-exported/integration/`](./ai-exported/integration/) (new setup), [`ai-exported/migration/`](./ai-exported/migration/) (upgrading from older RCs).
5
+ > **AI-friendly docs:** shipped via [`@sodax/skills`](https://github.com/icon-project/sodax-sdks/tree/main/packages/skills) — [`skills` CLI](https://github.com/vercel-labs/skills) recommended; npm + `AGENTS.md` pointer as fallback. See [docs/ai-integration-guide.md](https://github.com/icon-project/sodax-sdks/blob/main/docs/ai-integration-guide.md) for all install modes and per-tool wiring.
7
6
 
8
7
  ## Installation
9
8
 
package/dist/index.cjs CHANGED
@@ -5,16 +5,15 @@ var viem = require('viem');
5
5
  var chains = require('viem/chains');
6
6
  var client = require('@mysten/sui/client');
7
7
  var ed25519$1 = require('@mysten/sui/keypairs/ed25519');
8
- var transactions$1 = require('@mysten/sui/transactions');
8
+ var transactions = require('@mysten/sui/transactions');
9
9
  var walletStandard = require('@mysten/wallet-standard');
10
10
  var IconSdkRaw = require('icon-sdk-js');
11
11
  var sdkTs = require('@injectivelabs/sdk-ts');
12
12
  var splToken = require('@solana/spl-token');
13
13
  var web3_js = require('@solana/web3.js');
14
14
  var stellarSdk = require('@stellar/stellar-sdk');
15
- var network = require('@stacks/network');
16
- var transactions = require('@stacks/transactions');
17
- var connect = require('@stacks/connect');
15
+ var core = require('@sodax/libs/stacks/core');
16
+ var connect = require('@sodax/libs/stacks/connect');
18
17
  var bitcoin = require('bitcoinjs-lib');
19
18
  var ecc = require('@bitcoinerlab/secp256k1');
20
19
  var ecpair = require('ecpair');
@@ -327,7 +326,7 @@ var SodaTokens = {
327
326
  sodaNEAR: {
328
327
  symbol: "sodaNEAR",
329
328
  name: "SODA NEAR",
330
- decimals: 24,
329
+ decimals: 18,
331
330
  address: "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39",
332
331
  chainKey: ChainKeys.SONIC_MAINNET,
333
332
  hubAsset: "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39",
@@ -2918,7 +2917,6 @@ var hubConfig = {
2918
2917
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.USDT,
2919
2918
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.wS,
2920
2919
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.SODA,
2921
- spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.bnUSD,
2922
2920
  ...Object.values(SodaTokens)
2923
2921
  ]});
2924
2922
 
@@ -3076,8 +3074,8 @@ function isBrowserExtensionSuiWallet(wallet) {
3076
3074
  return "wallet" in wallet && "account" in wallet;
3077
3075
  }
3078
3076
  async function toMystenTransaction(txn) {
3079
- if (txn instanceof transactions$1.Transaction) return txn;
3080
- return transactions$1.Transaction.from(await txn.toJSON());
3077
+ if (txn instanceof transactions.Transaction) return txn;
3078
+ return transactions.Transaction.from(await txn.toJSON());
3081
3079
  }
3082
3080
  var SuiWalletProvider = class extends BaseWalletProvider {
3083
3081
  chainType = "SUI";
@@ -3729,10 +3727,10 @@ function isStacksPkWallet(wallet) {
3729
3727
  }
3730
3728
  function toPostConditionModeName(mode) {
3731
3729
  if (mode === void 0) return void 0;
3732
- return mode === transactions.PostConditionMode.Allow ? "allow" : "deny";
3730
+ return mode === core.PostConditionMode.Allow ? "allow" : "deny";
3733
3731
  }
3734
3732
  function resolveNetwork(selector, endpoint) {
3735
- const base2 = network.networkFrom(selector ?? "mainnet");
3733
+ const base2 = core.networkFrom(selector ?? "mainnet");
3736
3734
  return endpoint ? { ...base2, client: { ...base2.client, baseUrl: endpoint } } : base2;
3737
3735
  }
3738
3736
  var StacksWalletProvider = class extends BaseWalletProvider {
@@ -3761,7 +3759,7 @@ var StacksWalletProvider = class extends BaseWalletProvider {
3761
3759
  return this.sendTransactionWithAdapter(finalParams, this.wallet);
3762
3760
  }
3763
3761
  async sendTransactionWithPrivateKey(txParams, wallet) {
3764
- const transaction = await transactions.makeContractCall({
3762
+ const transaction = await core.makeContractCall({
3765
3763
  contractAddress: txParams.contractAddress,
3766
3764
  contractName: txParams.contractName,
3767
3765
  functionName: txParams.functionName,
@@ -3771,7 +3769,7 @@ var StacksWalletProvider = class extends BaseWalletProvider {
3771
3769
  postConditionMode: txParams.postConditionMode,
3772
3770
  postConditions: txParams.postConditions
3773
3771
  });
3774
- const result = await transactions.broadcastTransaction({ network: this.network, transaction });
3772
+ const result = await core.broadcastTransaction({ network: this.network, transaction });
3775
3773
  return result.txid;
3776
3774
  }
3777
3775
  async sendTransactionWithAdapter(txParams, wallet) {
@@ -3791,7 +3789,7 @@ var StacksWalletProvider = class extends BaseWalletProvider {
3791
3789
  return result.txid;
3792
3790
  }
3793
3791
  async readContract(txParams) {
3794
- return transactions.fetchCallReadOnlyFunction({
3792
+ return core.fetchCallReadOnlyFunction({
3795
3793
  contractAddress: txParams.contractAddress,
3796
3794
  contractName: txParams.contractName,
3797
3795
  functionName: txParams.functionName,
@@ -3802,13 +3800,13 @@ var StacksWalletProvider = class extends BaseWalletProvider {
3802
3800
  }
3803
3801
  async getWalletAddress() {
3804
3802
  if (isStacksPkWallet(this.wallet)) {
3805
- return transactions.getAddressFromPrivateKey(this.wallet.privateKey, this.network);
3803
+ return core.getAddressFromPrivateKey(this.wallet.privateKey, this.network);
3806
3804
  }
3807
3805
  return this.wallet.address;
3808
3806
  }
3809
3807
  async getPublicKey() {
3810
3808
  if (isStacksPkWallet(this.wallet)) {
3811
- return transactions.publicKeyToHex(transactions.privateKeyToPublic(this.wallet.privateKey));
3809
+ return core.publicKeyToHex(core.privateKeyToPublic(this.wallet.privateKey));
3812
3810
  }
3813
3811
  throw new Error("getPublicKey is only supported for private key wallet configuration");
3814
3812
  }
@@ -11637,7 +11635,7 @@ Object.defineProperty(exports, "Networks", {
11637
11635
  });
11638
11636
  Object.defineProperty(exports, "PostConditionMode", {
11639
11637
  enumerable: true,
11640
- get: function () { return transactions.PostConditionMode; }
11638
+ get: function () { return core.PostConditionMode; }
11641
11639
  });
11642
11640
  exports.BaseWalletProvider = BaseWalletProvider;
11643
11641
  exports.BigNumberToBigInt = BigNumberToBigInt;
@@ -11682,5 +11680,3 @@ exports.isValidStellarPrivateKey = isValidStellarPrivateKey;
11682
11680
  exports.requestAddress = requestAddress;
11683
11681
  exports.requestJsonRpc = requestJsonRpc;
11684
11682
  exports.requestSigning = requestSigning;
11685
- //# sourceMappingURL=index.cjs.map
11686
- //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { EvmRawTransaction, EvmChainKey, IEvmWalletProvider, EvmRawTransactionReceipt, ISuiWalletProvider, SuiTransaction, SuiExecutionResult, SuiPaginatedCoins, IIconWalletProvider, IcxCallTransaction, IconTransactionResult, InjectiveCoin, IInjectiveWalletProvider, JsonObject, InjectiveRawTransaction, InjectiveEoaAddress, InjectiveExecuteResponse, ISolanaWalletProvider, SolanaRpcResponseAndContext, SolanaSignatureResult, TransactionSignature, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaBase58PublicKey, XDR, Hex as Hex$1, IStellarWalletProvider, StellarRawTransactionReceipt, IStacksWalletProvider, StacksTransactionParams, INearWalletProvider, CallContractParams, NearRawTransaction, BtcAddressType, IBitcoinWalletProvider } from '@sodax/types';
2
2
  import * as viem from 'viem';
3
- import { SendTransactionParameters, WaitForTransactionReceiptParameters, PublicClientConfig, WalletClientConfig, HttpTransportConfig, WalletClient, Transport, Chain, Account, PublicClient, Address, Hash as Hash$1 } from 'viem';
3
+ import { WalletClient, Transport, Chain, Account, PublicClient, PublicClientConfig, WalletClientConfig, HttpTransportConfig, SendTransactionParameters, WaitForTransactionReceiptParameters, Address, Hash as Hash$1 } from 'viem';
4
4
  export { Account, Address, Chain, HttpTransportConfig, PublicClient, PublicClientConfig, SendTransactionParameters, TransactionReceipt, Transport, WaitForTransactionReceiptParameters, WalletClient, WalletClientConfig } from 'viem';
5
- import { SuiTransactionBlockResponseOptions, SuiClient } from '@mysten/sui/client';
5
+ import { SuiClient, SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
6
6
  export { SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
7
7
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
8
8
  import { WalletWithFeatures, SuiWalletFeatures, WalletAccount } from '@mysten/wallet-standard';
@@ -22,17 +22,16 @@ export { Commitment, ConnectionConfig, SendOptions } from '@solana/web3.js';
22
22
  import { SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
23
23
  import { Keypair } from '@stellar/stellar-sdk';
24
24
  export { Networks } from '@stellar/stellar-sdk';
25
- import { PostConditionMode, ClarityValue } from '@stacks/transactions';
26
- export { ClarityValue, PostConditionMode, PostConditionModeName } from '@stacks/transactions';
27
- import { StacksProvider } from '@stacks/connect';
28
- export { StacksProvider } from '@stacks/connect';
25
+ import { PostConditionMode, ClarityValue } from '@sodax/libs/stacks/core';
26
+ export { ClarityValue, PostConditionMode, PostConditionModeName, StacksNetwork } from '@sodax/libs/stacks/core';
27
+ import { StacksProvider } from '@sodax/libs/stacks/connect';
28
+ export { StacksProvider } from '@sodax/libs/stacks/connect';
29
29
  import { NearConnector } from '@hot-labs/near-connect';
30
30
  export { NearConnector } from '@hot-labs/near-connect';
31
31
  import { Account as Account$1, JsonRpcProvider } from 'near-api-js';
32
32
  export { KeyPairString } from 'near-api-js';
33
33
  import { ECPairInterface } from 'ecpair';
34
34
  import * as bitcoin from 'bitcoinjs-lib';
35
- export { StacksNetwork } from '@stacks/network';
36
35
  export { Network as BitcoinJsNetwork } from 'bitcoinjs-lib/src/networks.js';
37
36
 
38
37
  /**
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { EvmRawTransaction, EvmChainKey, IEvmWalletProvider, EvmRawTransactionReceipt, ISuiWalletProvider, SuiTransaction, SuiExecutionResult, SuiPaginatedCoins, IIconWalletProvider, IcxCallTransaction, IconTransactionResult, InjectiveCoin, IInjectiveWalletProvider, JsonObject, InjectiveRawTransaction, InjectiveEoaAddress, InjectiveExecuteResponse, ISolanaWalletProvider, SolanaRpcResponseAndContext, SolanaSignatureResult, TransactionSignature, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaBase58PublicKey, XDR, Hex as Hex$1, IStellarWalletProvider, StellarRawTransactionReceipt, IStacksWalletProvider, StacksTransactionParams, INearWalletProvider, CallContractParams, NearRawTransaction, BtcAddressType, IBitcoinWalletProvider } from '@sodax/types';
2
2
  import * as viem from 'viem';
3
- import { SendTransactionParameters, WaitForTransactionReceiptParameters, PublicClientConfig, WalletClientConfig, HttpTransportConfig, WalletClient, Transport, Chain, Account, PublicClient, Address, Hash as Hash$1 } from 'viem';
3
+ import { WalletClient, Transport, Chain, Account, PublicClient, PublicClientConfig, WalletClientConfig, HttpTransportConfig, SendTransactionParameters, WaitForTransactionReceiptParameters, Address, Hash as Hash$1 } from 'viem';
4
4
  export { Account, Address, Chain, HttpTransportConfig, PublicClient, PublicClientConfig, SendTransactionParameters, TransactionReceipt, Transport, WaitForTransactionReceiptParameters, WalletClient, WalletClientConfig } from 'viem';
5
- import { SuiTransactionBlockResponseOptions, SuiClient } from '@mysten/sui/client';
5
+ import { SuiClient, SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
6
6
  export { SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
7
7
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
8
8
  import { WalletWithFeatures, SuiWalletFeatures, WalletAccount } from '@mysten/wallet-standard';
@@ -22,17 +22,16 @@ export { Commitment, ConnectionConfig, SendOptions } from '@solana/web3.js';
22
22
  import { SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
23
23
  import { Keypair } from '@stellar/stellar-sdk';
24
24
  export { Networks } from '@stellar/stellar-sdk';
25
- import { PostConditionMode, ClarityValue } from '@stacks/transactions';
26
- export { ClarityValue, PostConditionMode, PostConditionModeName } from '@stacks/transactions';
27
- import { StacksProvider } from '@stacks/connect';
28
- export { StacksProvider } from '@stacks/connect';
25
+ import { PostConditionMode, ClarityValue } from '@sodax/libs/stacks/core';
26
+ export { ClarityValue, PostConditionMode, PostConditionModeName, StacksNetwork } from '@sodax/libs/stacks/core';
27
+ import { StacksProvider } from '@sodax/libs/stacks/connect';
28
+ export { StacksProvider } from '@sodax/libs/stacks/connect';
29
29
  import { NearConnector } from '@hot-labs/near-connect';
30
30
  export { NearConnector } from '@hot-labs/near-connect';
31
31
  import { Account as Account$1, JsonRpcProvider } from 'near-api-js';
32
32
  export { KeyPairString } from 'near-api-js';
33
33
  import { ECPairInterface } from 'ecpair';
34
34
  import * as bitcoin from 'bitcoinjs-lib';
35
- export { StacksNetwork } from '@stacks/network';
36
35
  export { Network as BitcoinJsNetwork } from 'bitcoinjs-lib/src/networks.js';
37
36
 
38
37
  /**
package/dist/index.mjs CHANGED
@@ -11,10 +11,9 @@ import { getAssociatedTokenAddress } from '@solana/spl-token';
11
11
  import { Keypair, Connection, TransactionMessage, VersionedTransaction, PublicKey, TransactionInstruction } from '@solana/web3.js';
12
12
  import { Networks, Keypair as Keypair$1, Horizon, Transaction } from '@stellar/stellar-sdk';
13
13
  export { Networks } from '@stellar/stellar-sdk';
14
- import { networkFrom } from '@stacks/network';
15
- import { makeContractCall, broadcastTransaction, fetchCallReadOnlyFunction, getAddressFromPrivateKey, publicKeyToHex, privateKeyToPublic, PostConditionMode } from '@stacks/transactions';
16
- export { PostConditionMode } from '@stacks/transactions';
17
- import { request } from '@stacks/connect';
14
+ import { makeContractCall, broadcastTransaction, fetchCallReadOnlyFunction, getAddressFromPrivateKey, publicKeyToHex, privateKeyToPublic, networkFrom, PostConditionMode } from '@sodax/libs/stacks/core';
15
+ export { PostConditionMode } from '@sodax/libs/stacks/core';
16
+ import { request } from '@sodax/libs/stacks/connect';
18
17
  import * as bitcoin from 'bitcoinjs-lib';
19
18
  import * as ecc from '@bitcoinerlab/secp256k1';
20
19
  import { ECPairFactory } from 'ecpair';
@@ -301,7 +300,7 @@ var SodaTokens = {
301
300
  sodaNEAR: {
302
301
  symbol: "sodaNEAR",
303
302
  name: "SODA NEAR",
304
- decimals: 24,
303
+ decimals: 18,
305
304
  address: "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39",
306
305
  chainKey: ChainKeys.SONIC_MAINNET,
307
306
  hubAsset: "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39",
@@ -2892,7 +2891,6 @@ var hubConfig = {
2892
2891
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.USDT,
2893
2892
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.wS,
2894
2893
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.SODA,
2895
- spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.bnUSD,
2896
2894
  ...Object.values(SodaTokens)
2897
2895
  ]});
2898
2896
 
@@ -11606,5 +11604,3 @@ var BitcoinWalletProvider = class extends BaseWalletProvider {
11606
11604
  */
11607
11605
 
11608
11606
  export { BaseWalletProvider, BigNumberToBigInt, BitcoinWalletError, BitcoinWalletProvider, EvmWalletProvider, IconWalletProvider, InjectiveWalletProvider, NearWalletProvider, SolanaWalletProvider, StacksWalletProvider, StellarWalletError, StellarWalletProvider, SuiWalletProvider, getEvmViemChain, hyper, isBrowserExtensionEvmWalletConfig, isBrowserExtensionIconWalletConfig, isBrowserExtensionInjectiveWalletConfig, isBrowserExtensionNearWalletConfig, isBrowserExtensionStacksWalletConfig, isBrowserExtensionStellarWalletConfig, isBrowserExtensionSuiWallet, isIconAddress, isIconBrowserExtensionWallet, isIconEoaAddress, isIconPkWallet, isJsonRpcPayloadResponse, isPkSuiWallet, isPrivateKeyEvmWalletConfig, isPrivateKeyIconWalletConfig, isPrivateKeyNearWalletConfig, isPrivateKeyStacksWalletConfig, isPrivateKeyStellarWalletConfig, isResponseAddressType, isResponseSigningType, isSecretInjectiveWalletConfig, isStellarBrowserExtensionWallet, isStellarPkWallet, isValidStellarNetwork, isValidStellarPrivateKey, requestAddress, requestJsonRpc, requestSigning };
11609
- //# sourceMappingURL=index.mjs.map
11610
- //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.0.0-rc.3",
7
+ "version": "2.0.0-rc.5",
8
8
  "license": "MIT",
9
9
  "description": "Sodax Wallet SDK Core",
10
10
  "keywords": [
@@ -28,18 +28,24 @@
28
28
  "types": "./dist/index.d.ts",
29
29
  "exports": {
30
30
  ".": {
31
- "types": "./dist/index.d.ts",
32
- "import": "./dist/index.mjs",
33
- "require": "./dist/index.cjs"
31
+ "import": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.mjs"
34
+ },
35
+ "require": {
36
+ "types": "./dist/index.d.cts",
37
+ "default": "./dist/index.cjs"
38
+ }
34
39
  }
35
40
  },
36
41
  "engines": {
37
- "node": ">=20.0.0"
42
+ "node": ">=20.12.0"
38
43
  },
39
44
  "files": [
40
45
  "dist",
41
- "ai-exported"
46
+ "!dist/**/*.map"
42
47
  ],
48
+ "sideEffects": false,
43
49
  "dependencies": {
44
50
  "@bitcoinerlab/secp256k1": "^1.2.0",
45
51
  "@hot-labs/near-connect": "0.10.0",
@@ -53,9 +59,6 @@
53
59
  "@solana/wallet-adapter-base": "0.9.26",
54
60
  "@solana/web3.js": "1.98.0",
55
61
  "@stellar/stellar-sdk": "15.1.0",
56
- "@stacks/connect": "8.2.6",
57
- "@stacks/transactions": "7.3.1",
58
- "@stacks/network": "7.3.1",
59
62
  "bip322-js": "^3.0.0",
60
63
  "bitcoinjs-lib": "^6.1.5",
61
64
  "ecpair": "^2.0.1",
@@ -63,17 +66,19 @@
63
66
  "near-api-js": "7.2.0",
64
67
  "secp256k1": "^5.0.1",
65
68
  "viem": "2.29.2",
66
- "@sodax/types": "2.0.0-rc.3"
69
+ "@sodax/types": "2.0.0-rc.5",
70
+ "@sodax/libs": "0.0.1-rc.0"
67
71
  },
68
72
  "devDependencies": {
69
73
  "@arethetypeswrong/cli": "0.17.4",
70
74
  "@changesets/cli": "2.29.7",
71
75
  "@types/node": "22.18.1",
72
76
  "@types/secp256k1": "^4.0.7",
73
- "@vitest/coverage-v8": "2.1.9",
77
+ "@vitest/coverage-v8": "3.2.4",
78
+ "knip": "5.30.5",
74
79
  "tsup": "8.5.0",
75
80
  "typescript": "5.5.4",
76
- "vitest": "2.1.9"
81
+ "vitest": "3.2.4"
77
82
  },
78
83
  "scripts": {
79
84
  "build": "tsup",
@@ -85,8 +90,8 @@
85
90
  "checkTs": "tsc --noEmit",
86
91
  "pretty": "biome format . --write",
87
92
  "lint": "biome lint . --write",
88
- "check-exports": "attw $(pnpm pack) --ignore-rules=cjs-resolves-to-esm",
89
- "check-ai-exported": "bash scripts/check-ai-exported.sh",
93
+ "check-exports": "attw --pack",
94
+ "check:knip": "knip",
90
95
  "local-release": "changeset version && changeset publish",
91
96
  "clean": "rm -rf node_modules && rm -rf dist && rm -rf .turbo"
92
97
  }
@@ -1,139 +0,0 @@
1
- # AGENTS.md — `@sodax/wallet-sdk-core` AI Export
2
-
3
- You are a coding agent helping a developer **integrate** or **migrate** the `@sodax/wallet-sdk-core` package. This document is your entry point. Read this first, then route to the right sub-folder.
4
-
5
- The files in this `ai-exported/` directory are designed for AI consumption: short, table-heavy, self-contained recipes, and machine-checkable checklists. Human-readable narrative lives in each folder's `README.md`.
6
-
7
- ---
8
-
9
- ## What this package is
10
-
11
- `@sodax/wallet-sdk-core` is the **low-level** wallet layer of the SODAX stack — one provider class per chain family (9 in total: EVM, Solana, Sui, Bitcoin, Stellar, ICON, Injective, NEAR, Stacks). Each class accepts either a **private-key** config (server-side scripts, CI, Node) or a **browser-extension** config (consumer dApps with pre-built clients/wallet kits), signs transactions, and broadcasts them.
12
-
13
- It is **not** a React layer (that is `@sodax/wallet-sdk-react`) and **not** a hooks layer (that is `@sodax/dapp-kit`). Most React consumers never touch this package directly — they get a typed `IXxxWalletProvider` via `useWalletProvider(...)` and hand it to `@sodax/sdk` calls. Direct usage of `wallet-sdk-core` is the right choice for:
14
-
15
- - Backend / Node scripts (CI tests, indexers, bots).
16
- - Custom browser flows that don't use React.
17
- - Tests that need to sign with a deterministic key.
18
-
19
- ---
20
-
21
- ## Step 1 — Identify the task
22
-
23
- | User says... | Path | Start at |
24
- |---|---|---|
25
- | "sign a tx from a script", "instantiate `EvmWalletProvider`", "first time using this lib" | **integration** | `integration/ai-rules.md` |
26
- | "configure default gas", "set up `defaults`", "shallow merge surprised me" | **integration** | `integration/recipes/defaults-and-overrides.md` |
27
- | "where do I import `WalletClient` / `SuiClient` from", "avoid direct viem dep" | **integration** | `integration/recipes/library-exports.md` |
28
- | "upgrade from v1 / sodax-frontend", "bump from older RC" | **migration** | `migration/ai-rules.md` |
29
- | Deep import from `@sodax/wallet-sdk-core/wallet-providers/EvmWalletProvider` broke | **migration** | `migration/breaking-changes/folder-layout.md` |
30
- | Looking up a provider class or its config shape | direct | `integration/reference/provider-classes.md` |
31
- | Looking up the discriminated union shape per chain | direct | `integration/features/<chain>.md` |
32
-
33
- The package name **did not change** across versions — both v1 and v2 publish as `@sodax/wallet-sdk-core`. **All v1→v2 surface changes are additive** — class names, config-type names, and config shapes are identical. The only mechanical migration is replacing deep imports from v1's flat `wallet-providers/*.ts` layout with barrel imports.
34
-
35
- If a project does anything more than that at the wallet-sdk-core surface, you are almost certainly looking at an `@sodax/sdk` / `@sodax/types` migration, not this one. Route accordingly.
36
-
37
- ---
38
-
39
- ## Step 2 — Load the right context
40
-
41
- **For integration tasks:**
42
-
43
- 1. `integration/ai-rules.md` — DO/DON'T + workflow + stop conditions
44
- 2. `integration/architecture.md` — mental model (BaseWalletProvider, discriminants, defaults merge)
45
- 3. `integration/quickstart.md` — copy-paste minimal example for the chain you need
46
- 4. `integration/features/<chain>.md` — per-chain config table, methods, gotchas
47
- 5. `integration/recipes/<task>.md` — task-specific guide (setup-private-key, bridge-to-sdk, …)
48
- 6. `integration/reference/*.md` — full barrel exports, interfaces, chain support
49
-
50
- **For migration tasks:**
51
-
52
- 1. `migration/ai-rules.md` — DO/DON'T + workflow. The headline: **v1 code drops in unchanged.** No mandatory edits at the wallet-sdk-core surface.
53
- 2. `migration/README.md` — what (additively) changed, read order, TL;DR
54
- 3. `migration/breaking-changes/*.md` — narrative WHY behind each additive shift (folder layout, base-class, defaults, library-exports)
55
- 4. `migration/reference/*.md` — confirm no renames / no deletions exist
56
- 5. `migration/recipes/<task>.md` — paired before/after for **optional** cleanup (adopt-defaults, adopt-library-exports)
57
- 6. `migration/checklist.md` — verification loop
58
-
59
- ---
60
-
61
- ## Step 3 — Honor flow-specific stop conditions
62
-
63
- Each flow has its own list of conditions that **HARD STOP** code generation and require asking the user:
64
-
65
- - Migration stops → [`migration/ai-rules.md`](./migration/ai-rules.md) § "Stop conditions"
66
- - Integration stops → [`integration/ai-rules.md`](./integration/ai-rules.md) § "Stop conditions"
67
-
68
- Read the relevant list **before** applying any change. When stopping, quote the offending file/line and present the user with concrete options. Do **not** guess.
69
-
70
- Cross-flow signals (true regardless of flow):
71
-
72
- - User asks for a chain family not in [`integration/reference/chain-support.md`](./integration/reference/chain-support.md). Adding a new chain is a maintainer task, not user-app integration.
73
- - User wants to extend `BaseWalletProvider` directly. That is a maintainer-only path — confirm scope before writing code.
74
-
75
- ---
76
-
77
- ## Step 4 — Verification protocol
78
-
79
- After **every** code change you make:
80
-
81
- 1. Run `pnpm checkTs` from the user's app root (or the package the change touched).
82
- 2. If errors mention `@sodax/wallet-sdk-core`, look up the symbol in `integration/reference/` or `migration/reference/`.
83
- 3. If a symbol isn't in any reference file, **stop and ask**. Do not invent migrations.
84
- 4. After all errors resolve, mark the relevant items in `migration/checklist.md` (for migrations) or move to the next recipe.
85
-
86
- You are **done** when:
87
- - `pnpm checkTs` exits clean for the user's project.
88
- - All items in `migration/checklist.md` are checked (migration only).
89
- - The user has confirmed the changed flow works in their dev / test environment.
90
-
91
- ---
92
-
93
- ## Conventions in this directory
94
-
95
- - **Recipes are self-contained.** A recipe file in `recipes/` contains everything needed to apply the change — before/after code, steps, verification. Do not jump between files.
96
- - **Reference files are tables.** `reference/*.md` contains markdown tables and paired code blocks. Treat them as lookup, not narrative.
97
- - **Token budget**: Each file is sized to fit comfortably in your context. If you find yourself loading more than 3 files for a single task, you are probably doing it wrong — re-route via the table above.
98
- - **Single source of truth**: Behavioral / breaking-change *explanations* live only in `migration/breaking-changes/*.md`. Other files reference them but do not duplicate the prose.
99
-
100
- ---
101
-
102
- ## Quick symbol lookup
103
-
104
- If the user mentions a symbol you don't recognize, grep these files in order:
105
-
106
- ```
107
- integration/reference/public-api.md — every named export from the package
108
- integration/reference/provider-classes.md — provider class + config + interface mapping
109
- integration/reference/interfaces.md — IXxxWalletProvider method signatures
110
- integration/reference/chain-support.md — chain family → provider + dependencies
111
- migration/reference/renamed-symbols.md — confirms zero renames between v1 and v2
112
- migration/reference/deleted-exports.md — confirms zero deletions between v1 and v2
113
- migration/reference/added-fields.md — additive `defaults` / `*WalletDefaults` / `*Policy` types
114
- ```
115
-
116
- If still not found: the symbol may be **internal** (not exported from the package root) or **removed**. Ask the user to share the source file/line so you can decide.
117
-
118
- ---
119
-
120
- ## Package context
121
-
122
- - **Name**: `@sodax/wallet-sdk-core`
123
- - **Version target**: latest RC / stable on npm.
124
- - **Peer deps**: none — chain SDKs are direct dependencies and consumers can re-import types via `library-exports`.
125
- - **Install**: `pnpm add @sodax/wallet-sdk-core`
126
- - **Runtime**: Node ≥ 18 + browser (tsup `platform: 'neutral'`).
127
- - **Audience**: backend engineers, script authors, and React-layer authors building higher-level wrappers (`@sodax/wallet-sdk-react`).
128
-
129
- ---
130
-
131
- ## Pointers
132
-
133
- - [`integration/README.md`](./integration/README.md) — start here for new integrations: file index, recommended reading order, install snippet, dual-config overview.
134
- - [`migration/README.md`](./migration/README.md) — start here for upgrades: file index, reading order, cross-cutting checklist pointer.
135
- - [`integration/quickstart.md`](./integration/quickstart.md) — minimal end-to-end example per chain.
136
- - [`integration/architecture.md`](./integration/architecture.md) — mental model: `BaseWalletProvider`, defaults shallow merge, dual-config discriminants, `library-exports`.
137
- - [`integration/features/`](./integration/features/) — per-chain config table, methods, gotchas (one file per chain).
138
- - [`integration/reference/`](./integration/reference/) — public API, provider classes, interfaces, chain support, glossary.
139
- - [`migration/breaking-changes/`](./migration/breaking-changes/) — narrative WHY behind each version-to-version shift.
@@ -1,108 +0,0 @@
1
- # Integration: First-time setup (Human-readable overview)
2
-
3
- This folder helps you integrate `@sodax/wallet-sdk-core` into a fresh project — most commonly a Node script, a backend service, or a custom non-React frontend. It is the **human-facing** entry point for new integrations. If you are a coding agent, read [`ai-rules.md`](./ai-rules.md) first.
4
-
5
- If you are upgrading from an older version of the package instead, see `../migration/`.
6
-
7
- ---
8
-
9
- ## What this package does
10
-
11
- `@sodax/wallet-sdk-core` is a **low-level multi-chain wallet provider layer**. For each of the 9 chain families that SODAX supports it ships **one provider class** that:
12
-
13
- - Accepts a **discriminated union config** — `PrivateKey*WalletConfig | BrowserExtension*WalletConfig`.
14
- - Extends a small `BaseWalletProvider` to merge per-call options over a typed `defaults` shape.
15
- - Implements the chain-specific `IXxxWalletProvider` interface from `@sodax/types`, so it can be passed straight into `@sodax/sdk` calls.
16
-
17
- It is intentionally framework-agnostic — Node ≥ 18, browser, edge runtimes are all supported (tsup `platform: 'neutral'`).
18
-
19
- | Chain family | Provider class | Underlying chain SDK |
20
- |---|---|---|
21
- | EVM (12 chains) | `EvmWalletProvider` | `viem` |
22
- | Solana | `SolanaWalletProvider` | `@solana/web3.js` |
23
- | Sui | `SuiWalletProvider` | `@mysten/sui` + `@mysten/wallet-standard` |
24
- | Bitcoin | `BitcoinWalletProvider` | `bitcoinjs-lib` (+ `ecpair`, `secp256k1`) |
25
- | Stellar | `StellarWalletProvider` | `@stellar/stellar-sdk` |
26
- | ICON | `IconWalletProvider` | `icon-sdk-js` |
27
- | Injective | `InjectiveWalletProvider` | `@injectivelabs/sdk-ts` + `@injectivelabs/wallet-core` |
28
- | NEAR | `NearWalletProvider` | `near-api-js` + `@hot-labs/near-connect` |
29
- | Stacks | `StacksWalletProvider` | `@stacks/transactions` + `@stacks/connect` |
30
-
31
- ---
32
-
33
- ## Recommended path (in order)
34
-
35
- If this is your first time using the package:
36
-
37
- 1. [`architecture.md`](./architecture.md) — read once before any recipe. Explains `BaseWalletProvider`, the `defaults` shallow-merge model, dual-config discriminants, and the `library-exports` indirection. Picking the wrong config variant is the most common mistake — the mental model prevents it.
38
- 2. [`quickstart.md`](./quickstart.md) — minimal end-to-end example for the chain you need. Copy, edit, run.
39
- 3. [`features/<chain>.md`](./features/) — chain-specific config table, methods, and gotchas (one file per chain).
40
- 4. Pick the right recipes:
41
- - [`recipes/setup-private-key.md`](./recipes/setup-private-key.md) — server-side / CI flow.
42
- - [`recipes/setup-browser-extension.md`](./recipes/setup-browser-extension.md) — consumer dApp flow.
43
- - [`recipes/bridge-to-sdk.md`](./recipes/bridge-to-sdk.md) — hand off the provider to `@sodax/sdk` calls.
44
- - [`recipes/defaults-and-overrides.md`](./recipes/defaults-and-overrides.md) — merge semantics for the `defaults` config.
45
- - [`recipes/library-exports.md`](./recipes/library-exports.md) — re-importing upstream chain-SDK types without a direct dep.
46
- - [`recipes/sign-and-broadcast.md`](./recipes/sign-and-broadcast.md) — typical send-transaction flow per chain.
47
- - [`recipes/testing.md`](./recipes/testing.md) — mocking providers in unit tests.
48
- 5. Reference docs (lookup as needed):
49
- - [`reference/public-api.md`](./reference/public-api.md) — every named export from the package root.
50
- - [`reference/provider-classes.md`](./reference/provider-classes.md) — provider × config × interface table.
51
- - [`reference/interfaces.md`](./reference/interfaces.md) — `IXxxWalletProvider` method signatures.
52
- - [`reference/chain-support.md`](./reference/chain-support.md) — chain family → spoke chain keys.
53
- - [`reference/glossary.md`](./reference/glossary.md) — terms used across the docs.
54
-
55
- ---
56
-
57
- ## Install
58
-
59
- ```bash
60
- pnpm add @sodax/wallet-sdk-core @sodax/types
61
- ```
62
-
63
- Most consumers will also need `@sodax/sdk` (for the hub/spoke services that accept the wallet provider) and one or more chain SDKs (for browser-extension wallet objects). Re-export the types you need via `library-exports` — see [`recipes/library-exports.md`](./recipes/library-exports.md).
64
-
65
- ---
66
-
67
- ## Two configuration modes
68
-
69
- Every provider class supports **two** construction modes. Picking the wrong one is the most common integration mistake.
70
-
71
- | Mode | When to use | Discriminant style |
72
- |---|---|---|
73
- | **Private-key** | Node scripts, CI tests, indexers, bots — anywhere you possess the raw key | Either field presence (EVM, Solana, Sui, ICON, Injective, NEAR, Stacks) OR `type: 'PRIVATE_KEY'` (Bitcoin, Stellar) |
74
- | **Browser-extension** | Consumer dApps where a wallet extension provides a pre-built client / signer | Either field presence (different fields from PK variant) OR `type: 'BROWSER_EXTENSION'` (Bitcoin, Stellar) |
75
-
76
- For a chain-by-chain breakdown of the exact discriminant shape, see [`features/`](./features/) and [`architecture.md`](./architecture.md) § "Discriminant variants".
77
-
78
- ---
79
-
80
- ## Pair with `@sodax/sdk` and `@sodax/wallet-sdk-react`
81
-
82
- The most common stack:
83
-
84
- ```
85
- @sodax/sdk ← business logic (swaps, lending, staking, …)
86
- @sodax/wallet-sdk-react ← React layer that surfaces a typed IXxxWalletProvider via hooks
87
- @sodax/wallet-sdk-core ← this package — concrete provider classes
88
- @sodax/types ← shared type definitions
89
- ```
90
-
91
- In a React dApp you usually consume this package **indirectly** — `useWalletProvider({ xChainId })` (from `@sodax/wallet-sdk-react`) returns a typed `IXxxWalletProvider` that comes from a `wallet-sdk-core` instance under the hood. You only construct provider classes from `wallet-sdk-core` directly when running scripts, tests, or non-React clients.
92
-
93
- ---
94
-
95
- ## Conventions worth knowing
96
-
97
- - **`defaults` is optional but powerful.** Every provider accepts a `defaults` config slice; per-call options shallow-merge over it. Use it to encode env-level fixed choices (RPC commitment, default gas, default memo) once.
98
- - **Shallow merge, not deep.** Nested objects in `defaults` are **replaced wholesale** by per-call options of the same key. See `src/utils/merge.ts` and [`recipes/defaults-and-overrides.md`](./recipes/defaults-and-overrides.md).
99
- - **`library-exports` removes upstream deps.** You can `import type { WalletClient } from '@sodax/wallet-sdk-core'` instead of taking a direct dep on `viem`. See [`recipes/library-exports.md`](./recipes/library-exports.md).
100
- - **The barrel is the source of truth.** Internal utilities (`shallowMerge`, helper functions) are **not** exported. If something isn't on `@sodax/wallet-sdk-core`'s root, do not deep-import it.
101
- - **No `as unknown as` casts.** The discriminated unions are precise — if TypeScript complains, your config is wrong, not the type.
102
-
103
- ---
104
-
105
- ## Getting help
106
-
107
- - API surface lookup: [`reference/`](./reference/).
108
- - Bug or missing feature: [open an issue](https://github.com/icon-project/sodax-sdks/issues).