@sodax/sdk 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 (57) hide show
  1. package/README.md +8 -60
  2. package/dist/index.cjs +62 -74
  3. package/dist/index.d.cts +22 -110
  4. package/dist/index.d.ts +22 -110
  5. package/dist/index.mjs +39 -49
  6. package/package.json +23 -24
  7. package/ai-exported/AGENTS.md +0 -99
  8. package/ai-exported/integration/README.md +0 -41
  9. package/ai-exported/integration/ai-rules.md +0 -75
  10. package/ai-exported/integration/architecture.md +0 -533
  11. package/ai-exported/integration/chain-specifics.md +0 -189
  12. package/ai-exported/integration/features/README.md +0 -19
  13. package/ai-exported/integration/features/auxiliary-services.md +0 -189
  14. package/ai-exported/integration/features/bridge.md +0 -136
  15. package/ai-exported/integration/features/dex.md +0 -182
  16. package/ai-exported/integration/features/icx-bnusd-baln.md +0 -181
  17. package/ai-exported/integration/features/money-market.md +0 -198
  18. package/ai-exported/integration/features/staking.md +0 -166
  19. package/ai-exported/integration/features/swap.md +0 -207
  20. package/ai-exported/integration/quickstart.md +0 -213
  21. package/ai-exported/integration/recipes/README.md +0 -21
  22. package/ai-exported/integration/recipes/backend-server-init.md +0 -69
  23. package/ai-exported/integration/recipes/chain-key-narrowing.md +0 -65
  24. package/ai-exported/integration/recipes/gas-estimation.md +0 -33
  25. package/ai-exported/integration/recipes/initialize-sodax.md +0 -78
  26. package/ai-exported/integration/recipes/raw-tx-flow.md +0 -71
  27. package/ai-exported/integration/recipes/result-and-errors.md +0 -104
  28. package/ai-exported/integration/recipes/signed-tx-flow.md +0 -46
  29. package/ai-exported/integration/recipes/testing.md +0 -101
  30. package/ai-exported/integration/reference/README.md +0 -18
  31. package/ai-exported/integration/reference/chain-keys.md +0 -67
  32. package/ai-exported/integration/reference/error-codes.md +0 -165
  33. package/ai-exported/integration/reference/glossary.md +0 -32
  34. package/ai-exported/integration/reference/public-api.md +0 -138
  35. package/ai-exported/integration/reference/wallet-providers.md +0 -62
  36. package/ai-exported/migration/README.md +0 -58
  37. package/ai-exported/migration/ai-rules.md +0 -80
  38. package/ai-exported/migration/breaking-changes/architecture.md +0 -344
  39. package/ai-exported/migration/breaking-changes/result-and-errors.md +0 -363
  40. package/ai-exported/migration/breaking-changes/type-system.md +0 -341
  41. package/ai-exported/migration/checklist.md +0 -67
  42. package/ai-exported/migration/features/README.md +0 -35
  43. package/ai-exported/migration/features/auxiliary-services.md +0 -156
  44. package/ai-exported/migration/features/bridge.md +0 -128
  45. package/ai-exported/migration/features/dex.md +0 -143
  46. package/ai-exported/migration/features/icx-bnusd-baln.md +0 -151
  47. package/ai-exported/migration/features/money-market.md +0 -214
  48. package/ai-exported/migration/features/staking.md +0 -138
  49. package/ai-exported/migration/features/swap.md +0 -198
  50. package/ai-exported/migration/recipes.md +0 -350
  51. package/ai-exported/migration/reference/README.md +0 -18
  52. package/ai-exported/migration/reference/deleted-exports.md +0 -127
  53. package/ai-exported/migration/reference/error-code-crosswalk.md +0 -104
  54. package/ai-exported/migration/reference/return-shapes.md +0 -49
  55. package/ai-exported/migration/reference/sodax-config.md +0 -145
  56. package/dist/index.cjs.map +0 -1
  57. package/dist/index.mjs.map +0 -1
package/README.md CHANGED
@@ -98,73 +98,21 @@ How to setup local development
98
98
 
99
99
  ## AI agent docs
100
100
 
101
- `@sodax/sdk` ships an AI-ready documentation tree at `node_modules/@sodax/sdk/ai-exported/`. It's tool-neutral: any agent that can read files (Claude Code, Cursor, Aider, Copilot Chat, ChatGPT with file context, etc.) can use it without further setup.
101
+ AI-readable docs for `@sodax/sdk` (and the other `@sodax/*` packages) are shipped via [`@sodax/skills`](https://github.com/icon-project/sodax-sdks/tree/main/packages/skills) a separate npm package bundling Claude-Code SKILL.md files and a long-form knowledge tree.
102
102
 
103
- ### Get started
103
+ **Recommended: [`skills` CLI](https://github.com/vercel-labs/skills)** — from your project root:
104
104
 
105
- Point your agent at `node_modules/@sodax/sdk/ai-exported/AGENTS.md` — it routes to the rest. Three sample prompts covering the typical entry points:
106
-
107
- ```
108
- > Read node_modules/@sodax/sdk/ai-exported/AGENTS.md and integrate
109
- > SODAX cross-chain swaps from Arbitrum to Stellar into my Node service.
110
-
111
- > Read node_modules/@sodax/sdk/ai-exported/AGENTS.md. My code uses
112
- > @sodax/sdk v1 — port my call sites to v2.
113
-
114
- > Look up the v2 SodaxError code for a relay timeout in
115
- > node_modules/@sodax/sdk/ai-exported/integration/reference/error-codes.md.
105
+ ```bash
106
+ npx skills@latest add icon-project/sodax-sdks/packages/skills
116
107
  ```
117
108
 
118
- ### What's inside
109
+ **npm + `AGENTS.md` pointer** (fallback for web chats, or when you prefer a devDependency over the CLI):
119
110
 
111
+ ```bash
112
+ pnpm add -D @sodax/skills
120
113
  ```
121
- ai-exported/
122
- ├── AGENTS.md # Tool-neutral entry point — start here
123
- ├── integration/ # Building NEW v2 code
124
- │ ├── README.md, ai-rules.md # Index + DO / DO NOT / workflow for agents
125
- │ ├── quickstart.md # Install + initialize + first-run troubleshooting
126
- │ ├── architecture.md # Type system + design concepts (Result, ChainKeys, …)
127
- │ ├── chain-specifics.md # Non-EVM quirks (Stellar, BTC, Solana, ICON, NEAR)
128
- │ ├── features/ # 7 feature pages: swap, money-market, staking, bridge,
129
- │ │ # dex, icx-bnusd-baln, auxiliary-services
130
- │ ├── recipes/ # 8 copy-pasteable patterns: init, signed-/raw-tx flow,
131
- │ │ # error handling, narrowing, testing, gas, backend init
132
- │ └── reference/ # 5 lookup tables: chain keys, wallet providers,
133
- │ # error codes, public API surface, glossary
134
- └── migration/ # Porting EXISTING v1 code to v2
135
- ├── README.md, ai-rules.md # Index + workflow for porting agents
136
- ├── checklist.md # 17-step cross-cutting checklist
137
- ├── breaking-changes/ # 3 cross-cutting changes: type-system, architecture,
138
- │ # result-and-errors
139
- ├── features/ # 7 per-feature porting playbooks (same names as
140
- │ # integration/features/)
141
- ├── recipes.md # Codemods + error-shape and Result adapters
142
- └── reference/ # 4 reference tables: deleted exports, sodax-config
143
- # reshape, error-code crosswalk, return-shape diffs
144
- ```
145
-
146
- ### Scope
147
-
148
- This tree documents `@sodax/sdk` (the Core SDK) only. It assumes:
149
-
150
- - **TypeScript** — examples are TS; the SDK ships dual ESM/CJS.
151
- - **Runtime-agnostic** — Node.js, browsers, bundled apps. **No React or Next.js content** — the SDK is UI-framework-agnostic and the docs reflect that.
152
- - **`@sodax/types` is re-exported** through `@sodax/sdk`'s barrel; consumers don't add it as a separate dependency.
153
-
154
- `@sodax/wallet-sdk-core` is **mentioned** in a few places as a pointer — it's a separate SODAX package that ships ready-made `I*WalletProvider` implementations for all 9 chain families. Consumers can install it separately or implement the wallet-provider interfaces themselves. React-layer packages (`@sodax/wallet-sdk-react`, `@sodax/dapp-kit`) are **out of scope here** and may have their own `ai-exported/` trees in their respective packages.
155
-
156
- ### Integrity guarantees
157
-
158
- Every release passes four CI checks against `ai-exported/`:
159
-
160
- | Guard | What it catches |
161
- |---|---|
162
- | `check:ai-exported` | Each top-level `sodax.X` reference matches a real public member of the `Sodax` class in `src/shared/entities/Sodax.ts`. (Shallow — `sodax.partners.invented` would still pass.) |
163
- | `check:ai-scope` | No accidental sibling-package, React, or Next.js content leaks in. |
164
- | `check:ai-links` | Every relative link between markdown files resolves. |
165
- | `check:ai-imports` | Every `import … from '@sodax/sdk'` example in the docs typechecks against the SDK source. |
166
114
 
167
- If you're contributing to this repo, run them with `pnpm -C packages/sdk run check:ai-exported` (or `:scope`, `:links`, `:imports`).
115
+ Then point your agent at `node_modules/@sodax/skills/AGENTS.md`. 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.
168
116
 
169
117
  ***
170
118
 
package/dist/index.cjs CHANGED
@@ -4,14 +4,13 @@ var viem = require('viem');
4
4
  var bcs = require('@mysten/sui/bcs');
5
5
  var web3_js = require('@solana/web3.js');
6
6
  var stellarSdk = require('@stellar/stellar-sdk');
7
- var transactions = require('@stacks/transactions');
7
+ var core = require('@sodax/libs/stacks/core');
8
8
  var chains = require('viem/chains');
9
9
  var rlp = require('rlp');
10
- var network = require('@stacks/network');
11
- var bitcoin = require('bitcoinjs-lib');
10
+ var bitcoinjsLib = require('bitcoinjs-lib');
12
11
  var ecc = require('@bitcoinerlab/secp256k1');
13
12
  var infinitySdk = require('@pancakeswap/infinity-sdk');
14
- var transactions$1 = require('@mysten/sui/transactions');
13
+ var transactions = require('@mysten/sui/transactions');
15
14
  var client = require('@mysten/sui/client');
16
15
  var splToken = require('@solana/spl-token');
17
16
  var anchor = require('@coral-xyz/anchor');
@@ -44,9 +43,7 @@ function _interopNamespace(e) {
44
43
  }
45
44
 
46
45
  var rlp__namespace = /*#__PURE__*/_interopNamespace(rlp);
47
- var bitcoin__namespace = /*#__PURE__*/_interopNamespace(bitcoin);
48
46
  var ecc__namespace = /*#__PURE__*/_interopNamespace(ecc);
49
- var anchor__namespace = /*#__PURE__*/_interopNamespace(anchor);
50
47
  var BN__default = /*#__PURE__*/_interopDefault(BN);
51
48
  var IconSdkRaw__namespace = /*#__PURE__*/_interopNamespace(IconSdkRaw);
52
49
  var BigNumber5__default = /*#__PURE__*/_interopDefault(BigNumber5);
@@ -518,7 +515,7 @@ var SodaTokens = {
518
515
  sodaNEAR: {
519
516
  symbol: "sodaNEAR",
520
517
  name: "SODA NEAR",
521
- decimals: 24,
518
+ decimals: 18,
522
519
  address: "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39",
523
520
  chainKey: ChainKeys.SONIC_MAINNET,
524
521
  hubAsset: "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39",
@@ -3233,7 +3230,8 @@ var moneyMarketSupportedTokens = {
3233
3230
  spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.HYPE,
3234
3231
  spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.bnUSD,
3235
3232
  spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.SODA,
3236
- spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.USDT0
3233
+ spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.USDT0,
3234
+ spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.USDC
3237
3235
  ],
3238
3236
  [ChainKeys.LIGHTLINK_MAINNET]: [
3239
3237
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens.ETH,
@@ -3517,7 +3515,6 @@ var swapSupportedTokens = {
3517
3515
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.USDT,
3518
3516
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.wS,
3519
3517
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.SODA,
3520
- spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.bnUSD,
3521
3518
  ...Object.values(SodaTokens)
3522
3519
  ],
3523
3520
  [ChainKeys.AVALANCHE_MAINNET]: [
@@ -3899,7 +3896,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
3899
3896
  }
3900
3897
 
3901
3898
  // ../types/dist/index.js
3902
- var CONFIG_VERSION = 201;
3899
+ var CONFIG_VERSION = 203;
3903
3900
  function isEvmSpokeChainConfig(value) {
3904
3901
  return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
3905
3902
  }
@@ -4109,7 +4106,7 @@ function encodeAddress(spokeChainId, address) {
4109
4106
  case "STELLAR":
4110
4107
  return `0x${stellarSdk.Address.fromString(address).toScVal().toXDR("hex")}`;
4111
4108
  case "STACKS":
4112
- return `0x${transactions.serializeCV(transactions.Cl.principal(address))}`;
4109
+ return `0x${core.serializeCV(core.Cl.principal(address))}`;
4113
4110
  case "BITCOIN":
4114
4111
  case "NEAR":
4115
4112
  case "INJECTIVE":
@@ -4153,8 +4150,8 @@ function reverseEncodeAddress(spokeChainId, encoded) {
4153
4150
  }
4154
4151
  case "STACKS": {
4155
4152
  const rawHex = encoded.startsWith("0x") ? encoded.slice(2) : encoded;
4156
- const cv = transactions.deserializeCV(viem.hexToBytes(`0x${rawHex}`));
4157
- return transactions.cvToString(cv);
4153
+ const cv = core.deserializeCV(viem.hexToBytes(`0x${rawHex}`));
4154
+ return core.cvToString(cv);
4158
4155
  }
4159
4156
  case "BITCOIN":
4160
4157
  case "NEAR":
@@ -13456,7 +13453,7 @@ async function waitForStacksTransaction(txid, rpc_url) {
13456
13453
  return false;
13457
13454
  }
13458
13455
  function serializeAddressData(address) {
13459
- return `0x${transactions.serializeCV(transactions.Cl.principal(address))}`;
13456
+ return `0x${core.serializeCV(core.Cl.principal(address))}`;
13460
13457
  }
13461
13458
  async function sleep2(s) {
13462
13459
  return new Promise((resolve) => {
@@ -14151,12 +14148,12 @@ var StacksSpokeService = class {
14151
14148
  constructor(config) {
14152
14149
  this.config = config;
14153
14150
  const chainConfig = config.getChainConfig(ChainKeys.STACKS_MAINNET);
14154
- this.network = network.createNetwork({ network: "mainnet", client: { baseUrl: chainConfig.rpcUrl } });
14151
+ this.network = core.createNetwork({ network: "mainnet", client: { baseUrl: chainConfig.rpcUrl } });
14155
14152
  this.pollingIntervalMs = chainConfig.pollingConfig.pollingIntervalMs;
14156
14153
  this.maxTimeoutMs = chainConfig.pollingConfig.maxTimeoutMs;
14157
14154
  }
14158
14155
  async estimateGas(params) {
14159
- const [low, medium, high] = await transactions.fetchFeeEstimateTransaction({
14156
+ const [low, medium, high] = await core.fetchFeeEstimateTransaction({
14160
14157
  payload: params.tx.payload,
14161
14158
  estimatedLength: params.tx.estimatedLength,
14162
14159
  network: this.network
@@ -14164,7 +14161,7 @@ var StacksSpokeService = class {
14164
14161
  return { low, medium, high };
14165
14162
  }
14166
14163
  async readContract(sender, txParams) {
14167
- return transactions.fetchCallReadOnlyFunction({
14164
+ return core.fetchCallReadOnlyFunction({
14168
14165
  contractAddress: txParams.contractAddress,
14169
14166
  contractName: txParams.contractName,
14170
14167
  functionName: txParams.functionName,
@@ -14183,19 +14180,19 @@ var StacksSpokeService = class {
14183
14180
  return BigInt(data.stx.balance);
14184
14181
  }
14185
14182
  async readTokenBalance(token, address) {
14186
- const [contractAddress, contractName] = transactions.parseContractId(token);
14187
- const result = await transactions.fetchCallReadOnlyFunction({
14183
+ const [contractAddress, contractName] = core.parseContractId(token);
14184
+ const result = await core.fetchCallReadOnlyFunction({
14188
14185
  contractAddress,
14189
14186
  contractName,
14190
14187
  functionName: "get-balance",
14191
- functionArgs: [transactions.Cl.principal(address)],
14188
+ functionArgs: [core.Cl.principal(address)],
14192
14189
  network: this.network,
14193
14190
  senderAddress: address
14194
14191
  });
14195
14192
  return result.value.value;
14196
14193
  }
14197
14194
  async getImplContractAddress(stateContract) {
14198
- const [contractAddress, contractName] = transactions.parseContractId(stateContract);
14195
+ const [contractAddress, contractName] = core.parseContractId(stateContract);
14199
14196
  const txParams = {
14200
14197
  contractAddress,
14201
14198
  contractName,
@@ -14214,26 +14211,26 @@ var StacksSpokeService = class {
14214
14211
  async deposit(params) {
14215
14212
  const chainConfig = this.config.getChainConfig(params.srcChainKey);
14216
14213
  const assetManagerImpl = await this.getImplContractAddress(chainConfig.addresses.assetManager);
14217
- const [implAddress, implName] = transactions.parseContractId(assetManagerImpl);
14218
- const [connectionAddress, connectionName] = transactions.parseContractId(chainConfig.addresses.connection);
14214
+ const [implAddress, implName] = core.parseContractId(assetManagerImpl);
14215
+ const [connectionAddress, connectionName] = core.parseContractId(chainConfig.addresses.connection);
14219
14216
  const reqData = {
14220
14217
  contractAddress: implAddress,
14221
14218
  contractName: implName,
14222
14219
  functionName: "transfer",
14223
14220
  functionArgs: [
14224
- isNativeToken(params.srcChainKey, params.token) ? transactions.noneCV() : transactions.someCV(transactions.Cl.principal(params.token)),
14225
- transactions.Cl.bufferFromHex(params.to),
14226
- transactions.uintCV(params.amount),
14227
- transactions.Cl.bufferFromHex(params.data),
14228
- transactions.Cl.contractPrincipal(connectionAddress, connectionName)
14221
+ isNativeToken(params.srcChainKey, params.token) ? core.noneCV() : core.someCV(core.Cl.principal(params.token)),
14222
+ core.Cl.bufferFromHex(params.to),
14223
+ core.uintCV(params.amount),
14224
+ core.Cl.bufferFromHex(params.data),
14225
+ core.Cl.contractPrincipal(connectionAddress, connectionName)
14229
14226
  ],
14230
- postConditionMode: transactions.PostConditionMode.Allow
14227
+ postConditionMode: core.PostConditionMode.Allow
14231
14228
  };
14232
14229
  if (params.raw === true) {
14233
- if (transactions.validateStacksAddress(params.srcAddress)) {
14230
+ if (core.validateStacksAddress(params.srcAddress)) {
14234
14231
  throw new Error('When using raw transactions, the public key must be provided as "from" parameter');
14235
14232
  }
14236
- const tx = await transactions.makeUnsignedContractCall({
14233
+ const tx = await core.makeUnsignedContractCall({
14237
14234
  ...reqData,
14238
14235
  publicKey: params.srcAddress,
14239
14236
  network: this.network,
@@ -14242,7 +14239,7 @@ var StacksSpokeService = class {
14242
14239
  nonce: 0n
14243
14240
  });
14244
14241
  return {
14245
- payload: `0x${viem.bytesToHex(transactions.serializePayloadBytes(tx.payload))}`
14242
+ payload: viem.bytesToHex(core.serializePayloadBytes(tx.payload))
14246
14243
  };
14247
14244
  }
14248
14245
  const txId = await params.walletProvider.sendTransaction(reqData);
@@ -14265,18 +14262,18 @@ var StacksSpokeService = class {
14265
14262
  */
14266
14263
  async sendMessage(params) {
14267
14264
  const dstRelayChainId = getIntentRelayChainId(params.dstChainKey);
14268
- const [connectionAddress, connectionName] = transactions.parseContractId(
14265
+ const [connectionAddress, connectionName] = core.parseContractId(
14269
14266
  this.config.getChainConfig(params.srcChainKey).addresses.connection
14270
14267
  );
14271
14268
  const reqData = {
14272
14269
  contractAddress: connectionAddress,
14273
14270
  contractName: connectionName,
14274
14271
  functionName: "send-message",
14275
- functionArgs: [transactions.uintCV(dstRelayChainId), transactions.Cl.bufferFromHex(params.dstAddress), transactions.Cl.bufferFromHex(params.payload)],
14276
- postConditionMode: transactions.PostConditionMode.Allow
14272
+ functionArgs: [core.uintCV(dstRelayChainId), core.Cl.bufferFromHex(params.dstAddress), core.Cl.bufferFromHex(params.payload)],
14273
+ postConditionMode: core.PostConditionMode.Allow
14277
14274
  };
14278
14275
  if (params.raw === true) {
14279
- const tx = await transactions.makeUnsignedContractCall({
14276
+ const tx = await core.makeUnsignedContractCall({
14280
14277
  ...reqData,
14281
14278
  publicKey: params.srcAddress,
14282
14279
  network: this.network,
@@ -14285,7 +14282,7 @@ var StacksSpokeService = class {
14285
14282
  nonce: 0n
14286
14283
  });
14287
14284
  return {
14288
- payload: `0x${viem.bytesToHex(transactions.serializePayloadBytes(tx.payload))}`
14285
+ payload: viem.bytesToHex(core.serializePayloadBytes(tx.payload))
14289
14286
  };
14290
14287
  }
14291
14288
  const txId = await params.walletProvider.sendTransaction(reqData);
@@ -14368,7 +14365,7 @@ var RadfiProvider = class {
14368
14365
  if (!publicKey) {
14369
14366
  throw new Error("Failed to retrieve public key from wallet. Please unlock your wallet and try again.");
14370
14367
  }
14371
- const message = `Login to Radfi via Sodax: ${Date.now()}`;
14368
+ const message = `${Date.now()}`;
14372
14369
  const addressType = detectBitcoinAddressType(address);
14373
14370
  const signature = addressType === "P2WPKH" || addressType === "P2TR" ? await walletProvider.signBip322Message(message) : await walletProvider.signEcdsaMessage(message);
14374
14371
  const result = await this.authenticate({ message, signature, address, publicKey });
@@ -14700,7 +14697,7 @@ function normalizePsbtToBase64(signedPsbt) {
14700
14697
  }
14701
14698
 
14702
14699
  // src/shared/services/spoke/BitcoinSpokeService.ts
14703
- bitcoin__namespace.initEccLib(ecc__namespace);
14700
+ bitcoinjsLib.initEccLib(ecc__namespace);
14704
14701
  var BITCOIN_DEFAULT_FEE_RATE = 3;
14705
14702
  var DUST_THRESHOLD = 546;
14706
14703
  var BitcoinSpokeService = class {
@@ -14720,7 +14717,7 @@ var BitcoinSpokeService = class {
14720
14717
  this.maxTimeoutMs = chainConfig.pollingConfig.maxTimeoutMs;
14721
14718
  }
14722
14719
  getBtcNetwork(chainId) {
14723
- return this.config.getChainConfig(chainId).network === "MAINNET" ? bitcoin__namespace.networks.bitcoin : bitcoin__namespace.networks.testnet;
14720
+ return this.config.getChainConfig(chainId).network === "MAINNET" ? bitcoinjsLib.networks.bitcoin : bitcoinjsLib.networks.testnet;
14724
14721
  }
14725
14722
  async getBalance(tokenAddress, walletAddress) {
14726
14723
  if (!tokenAddress || tokenAddress === "0x" || tokenAddress === "BTC") {
@@ -14732,7 +14729,7 @@ var BitcoinSpokeService = class {
14732
14729
  }
14733
14730
  async fetchScriptPubKey(utxo) {
14734
14731
  const txHex = await this.fetchRawTransaction(utxo.txid);
14735
- const tx = bitcoin__namespace.Transaction.fromHex(txHex);
14732
+ const tx = bitcoinjsLib.Transaction.fromHex(txHex);
14736
14733
  const out = tx.outs[utxo.vout];
14737
14734
  if (!out) {
14738
14735
  throw new Error(`UTXO not found: ${utxo.txid}:${utxo.vout}`);
@@ -14834,7 +14831,7 @@ var BitcoinSpokeService = class {
14834
14831
  * Build a priority Bitcoin transaction with proper fee calculation
14835
14832
  */
14836
14833
  async buildBitcoinTransaction(utxos, outputs, changeAddress, chainId, walletProvider, feeRate) {
14837
- const psbt = new bitcoin__namespace.Psbt({ network: this.getBtcNetwork(chainId) });
14834
+ const psbt = new bitcoinjsLib.Psbt({ network: this.getBtcNetwork(chainId) });
14838
14835
  const effectiveFeeRate = feeRate ?? await this.getFeeRateEstimate();
14839
14836
  const walletAddress = await walletProvider.getWalletAddress();
14840
14837
  const addressType = detectBitcoinAddressType(walletAddress);
@@ -14865,7 +14862,7 @@ var BitcoinSpokeService = class {
14865
14862
  throw new Error("Missing public key for P2SH-P2WPKH input");
14866
14863
  }
14867
14864
  const pubKeyHex = await walletProvider.getPublicKey();
14868
- const redeemScript = bitcoin__namespace.payments.p2wpkh({
14865
+ const redeemScript = bitcoinjsLib.payments.p2wpkh({
14869
14866
  pubkey: Buffer.from(pubKeyHex, "hex"),
14870
14867
  network: this.getBtcNetwork(chainId)
14871
14868
  }).output;
@@ -15022,14 +15019,14 @@ var BitcoinSpokeService = class {
15022
15019
  const psbt = await this.buildBitcoinTransaction(utxos, outputs, walletAddress, srcChainKey, walletProvider);
15023
15020
  const OP_RADFI_SODAX_DATA = 49;
15024
15021
  const payload = Buffer.concat([Buffer.from([OP_RADFI_SODAX_DATA]), Buffer.from(data.slice(2), "hex")]);
15025
- const OP_RETURN = bitcoin__namespace.opcodes.OP_RETURN;
15026
- const OP_12 = bitcoin__namespace.opcodes.OP_12;
15022
+ const OP_RETURN = bitcoinjsLib.opcodes.OP_RETURN;
15023
+ const OP_12 = bitcoinjsLib.opcodes.OP_12;
15027
15024
  if (OP_RETURN === void 0 || OP_12 === void 0) {
15028
15025
  throw new Error("bitcoinjs-lib opcodes OP_RETURN or OP_12 are undefined");
15029
15026
  }
15030
- const script2 = bitcoin__namespace.script.compile([OP_RETURN, OP_12, payload]);
15027
+ const compiledScript = bitcoinjsLib.script.compile([OP_RETURN, OP_12, payload]);
15031
15028
  psbt.addOutput({
15032
- script: script2,
15029
+ script: compiledScript,
15033
15030
  value: 0
15034
15031
  });
15035
15032
  return psbt;
@@ -21631,7 +21628,7 @@ var SonicSpokeService = class {
21631
21628
  }
21632
21629
  /**
21633
21630
  * Deposit tokens to the spoke chain using the Sonic wallet abstraction.
21634
- * @param {SonicSpokeDepositParams<Raw>} params - The parameters for the deposit
21631
+ * @param {DepositParams<SonicChainKey, Raw>} params - The parameters for the deposit
21635
21632
  * @returns {Promise<TxReturnType<SonicChainKey, Raw>>} A promise that resolves to the transaction hash
21636
21633
  */
21637
21634
  async deposit(params) {
@@ -21860,9 +21857,6 @@ var SuiSpokeService = class {
21860
21857
  }
21861
21858
  return coin;
21862
21859
  }
21863
- static getAddressBCSBytes(suiaddress) {
21864
- return viem.toHex(bcs.bcs.Address.serialize(suiaddress).toBytes());
21865
- }
21866
21860
  encodeSimulationParams(token, assetManager) {
21867
21861
  const encoder2 = new TextEncoder();
21868
21862
  return {
@@ -21900,7 +21894,7 @@ var SuiSpokeService = class {
21900
21894
  async deposit(params) {
21901
21895
  const { srcAddress: from, srcChainKey, token, to, amount, data = "0x" } = params;
21902
21896
  const isNative = isNativeToken(srcChainKey, token);
21903
- const tx = new transactions$1.Transaction();
21897
+ const tx = new transactions.Transaction();
21904
21898
  const coin = isNative ? await this.getNativeCoin(tx, amount) : await this.getCoin(tx, token, amount, from);
21905
21899
  const connection = this.splitAddress(this.config.getChainConfig(srcChainKey).addresses.connection);
21906
21900
  const assetManager = this.splitAddress(await this.getAssetManagerAddress(srcChainKey));
@@ -21934,7 +21928,7 @@ var SuiSpokeService = class {
21934
21928
  }
21935
21929
  async sendMessage(params) {
21936
21930
  const { srcAddress: from, srcChainKey, dstChainKey, dstAddress, payload } = params;
21937
- const txb = new transactions$1.Transaction();
21931
+ const txb = new transactions.Transaction();
21938
21932
  const connection = this.splitAddress(this.config.getChainConfig(srcChainKey).addresses.connection);
21939
21933
  const relayId = getIntentRelayChainId(dstChainKey);
21940
21934
  txb.moveCall({
@@ -21968,7 +21962,7 @@ var SuiSpokeService = class {
21968
21962
  * @returns {Promise<bigint>} The estimated computation cost.
21969
21963
  */
21970
21964
  async estimateGas({ tx }) {
21971
- const txb = transactions$1.Transaction.fromKind(tx.data);
21965
+ const txb = transactions.Transaction.fromKind(tx.data);
21972
21966
  const result = await this.publicClient.devInspectTransactionBlock({
21973
21967
  sender: tx.from,
21974
21968
  transactionBlock: txb
@@ -21977,13 +21971,12 @@ var SuiSpokeService = class {
21977
21971
  }
21978
21972
  /**
21979
21973
  * Get the balance of the token in the spoke chain.
21980
- * @param {Address} token - The address of the token to get the balance of.
21981
- * @param {SuiSpokeProvider} spokeProvider - The spoke provider.
21974
+ * @param {GetDepositParams<SuiChainKey>} params - The src chain key, src address, and token address.
21982
21975
  * @returns {Promise<bigint>} The balance of the token.
21983
21976
  */
21984
21977
  async getDeposit(params) {
21985
21978
  const assetmanager = this.splitAddress(await this.getAssetManagerAddress(params.srcChainKey));
21986
- const tx = new transactions$1.Transaction();
21979
+ const tx = new transactions.Transaction();
21987
21980
  const result = await this.viewContract(
21988
21981
  tx,
21989
21982
  assetmanager.packageId,
@@ -22002,7 +21995,7 @@ var SuiSpokeService = class {
22002
21995
  }
22003
21996
  /**
22004
21997
  * Fetch the asset manager config from the spoke chain.
22005
- * @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
21998
+ * @param {SuiChainKey} chainId - The Sui chain key.
22006
21999
  * @returns {Promise<string>} The asset manager config.
22007
22000
  */
22008
22001
  async fetchAssetManagerAddress(chainId) {
@@ -22011,7 +22004,7 @@ var SuiSpokeService = class {
22011
22004
  }
22012
22005
  /**
22013
22006
  * Fetch the latest asset manager package id from the spoke chain.
22014
- * @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
22007
+ * @param {SuiChainKey} chainId - The Sui chain key.
22015
22008
  * @returns {Promise<string>} The latest asset manager package id.
22016
22009
  */
22017
22010
  async fetchLatestAssetManagerPackageId(chainId) {
@@ -22625,11 +22618,11 @@ async function getProvider(base58PublicKey, rpcUrl) {
22625
22618
  signAllTransactions: () => Promise.reject()
22626
22619
  };
22627
22620
  const connection = new web3_js.Connection(rpcUrl);
22628
- return new anchor__namespace.AnchorProvider(connection, wallet, { commitment: "confirmed" });
22621
+ return new anchor.AnchorProvider(connection, wallet, { commitment: "confirmed" });
22629
22622
  }
22630
22623
  async function getAssetManagerIdl(assetManager, provider) {
22631
22624
  try {
22632
- const idl = await anchor__namespace.Program.fetchIdl(new web3_js.PublicKey(assetManager), provider);
22625
+ const idl = await anchor.Program.fetchIdl(new web3_js.PublicKey(assetManager), provider);
22633
22626
  if (!idl) {
22634
22627
  throw new Error("asset manager idl not available");
22635
22628
  }
@@ -22641,7 +22634,7 @@ async function getAssetManagerIdl(assetManager, provider) {
22641
22634
  }
22642
22635
  async function getConnectionIdl(connection, provider) {
22643
22636
  try {
22644
- const idl = await anchor__namespace.Program.fetchIdl(new web3_js.PublicKey(connection), provider);
22637
+ const idl = await anchor.Program.fetchIdl(new web3_js.PublicKey(connection), provider);
22645
22638
  if (!idl) {
22646
22639
  throw new Error("asset manager idl not available");
22647
22640
  }
@@ -22654,12 +22647,12 @@ async function getConnectionIdl(connection, provider) {
22654
22647
  async function getAssetManagerProgram(base58PublicKey, rpcUrl, assetManager) {
22655
22648
  const provider = await getProvider(base58PublicKey, rpcUrl);
22656
22649
  const idl = await getAssetManagerIdl(assetManager, provider);
22657
- return new anchor__namespace.Program(idl, provider);
22650
+ return new anchor.Program(idl, provider);
22658
22651
  }
22659
22652
  async function getConnectionProgram(base58PublicKey, rpcUrl, connection) {
22660
22653
  const provider = await getProvider(base58PublicKey, rpcUrl);
22661
22654
  const idl = await getConnectionIdl(connection, provider);
22662
- return new anchor__namespace.Program(idl, provider);
22655
+ return new anchor.Program(idl, provider);
22663
22656
  }
22664
22657
  function getSolanaAddressBytes(address) {
22665
22658
  return `0x${Buffer.from(address.toBytes()).toString("hex")}`;
@@ -22971,7 +22964,7 @@ var IconSpokeService = class {
22971
22964
  }
22972
22965
  /**
22973
22966
  * Deposit tokens to the spoke chain.
22974
- * @param {IconSpokeDepositParams} params - The parameters for the deposit
22967
+ * @param {DepositParams<IconChainKey, R>} params - The parameters for the deposit
22975
22968
  * @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain
22976
22969
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain
22977
22970
  * @param {boolean} raw - The return type raw or just transaction hash
@@ -28051,7 +28044,7 @@ var MigrationService = class {
28051
28044
  );
28052
28045
  const hubWalletAddress = await this.hubProvider.getUserHubWalletAddress(
28053
28046
  params.srcAddress,
28054
- ChainKeys.SONIC_MAINNET
28047
+ ChainKeys.ICON_MAINNET
28055
28048
  );
28056
28049
  const coreParams = {
28057
28050
  srcChainKey: ChainKeys.ICON_MAINNET,
@@ -29151,11 +29144,7 @@ var BridgeService = class {
29151
29144
  * checking theoretical bridgeability without requiring both chains to be in the active config.
29152
29145
  * @returns `true` if the tokens share the same hub vault; `false` otherwise.
29153
29146
  */
29154
- isBridgeable({
29155
- from,
29156
- to,
29157
- unchecked = false
29158
- }) {
29147
+ isBridgeable({ from, to, unchecked = false }) {
29159
29148
  try {
29160
29149
  if (!unchecked) {
29161
29150
  bridgeInvariant(this.config.isValidSpokeChainKey(from.chainKey), `Invalid spoke chain (${from.chainKey})`, {
@@ -34349,7 +34338,8 @@ var UiPoolDataProviderService = class {
34349
34338
  // The borrow index must also come from the bnUSD debt token.
34350
34339
  // User debt is stored scaled by bnUSD's index, so reading it back requires the same index.
34351
34340
  // Using the vault's index here would inflate the displayed debt amount.
34352
- variableBorrowIndex: bnUSDReserve.variableBorrowIndex
34341
+ variableBorrowIndex: bnUSDReserve.variableBorrowIndex,
34342
+ borrowingEnabled: bnUSDReserve.borrowingEnabled
34353
34343
  };
34354
34344
  return [
34355
34345
  [
@@ -37135,5 +37125,3 @@ exports.waitForTransactionReceipt = waitForTransactionReceipt;
37135
37125
  exports.waitUntilIntentExecuted = waitUntilIntentExecuted;
37136
37126
  exports.walletFactoryAbi = walletFactoryAbi;
37137
37127
  exports.wrappedSonicAbi = wrappedSonicAbi;
37138
- //# sourceMappingURL=index.cjs.map
37139
- //# sourceMappingURL=index.cjs.map