@sodax/sdk 2.0.0-rc.1 → 2.0.0-rc.10

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 +320 -109
  3. package/dist/index.d.cts +95 -111
  4. package/dist/index.d.ts +95 -111
  5. package/dist/index.mjs +297 -85
  6. package/package.json +24 -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 -519
  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 -53
  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 -335
  39. package/ai-exported/migration/breaking-changes/result-and-errors.md +0 -363
  40. package/ai-exported/migration/breaking-changes/type-system.md +0 -321
  41. package/ai-exported/migration/checklist.md +0 -61
  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 -125
  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 -288
  51. package/ai-exported/migration/reference/README.md +0 -18
  52. package/ai-exported/migration/reference/deleted-exports.md +0 -100
  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 -52
  56. package/dist/index.cjs.map +0 -1
  57. package/dist/index.mjs.map +0 -1
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);
@@ -313,6 +310,7 @@ var HubVaultSymbols = [
313
310
  "sodaBNB",
314
311
  "sodaETH",
315
312
  "sodaBTC",
313
+ "sodaWBTC",
316
314
  "sodaSUI",
317
315
  "sodaINJ",
318
316
  "sodaXLM",
@@ -371,6 +369,15 @@ var SodaTokens = {
371
369
  hubAsset: "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d",
372
370
  vault: "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d"
373
371
  },
372
+ sodaWBTC: {
373
+ symbol: "sodaWBTC",
374
+ name: "Soda Wrapped BTC",
375
+ decimals: 18,
376
+ address: "0x811C3fCc13f9c2a23AE2Ae2DCadacFAC6eb5f0eB",
377
+ chainKey: ChainKeys.SONIC_MAINNET,
378
+ hubAsset: "0x811C3fCc13f9c2a23AE2Ae2DCadacFAC6eb5f0eB",
379
+ vault: "0x811C3fCc13f9c2a23AE2Ae2DCadacFAC6eb5f0eB"
380
+ },
374
381
  sodaSOL: {
375
382
  symbol: "sodaSOL",
376
383
  name: "Soda SOL",
@@ -518,7 +525,7 @@ var SodaTokens = {
518
525
  sodaNEAR: {
519
526
  symbol: "sodaNEAR",
520
527
  name: "SODA NEAR",
521
- decimals: 24,
528
+ decimals: 18,
522
529
  address: "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39",
523
530
  chainKey: ChainKeys.SONIC_MAINNET,
524
531
  hubAsset: "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39",
@@ -872,6 +879,78 @@ var solanaSupportedTokens = {
872
879
  chainKey: ChainKeys.SOLANA_MAINNET,
873
880
  hubAsset: "0x0076b67235bfc69b649d29dd7cb66e5b92b618aa",
874
881
  vault: "0x0076b67235bfc69b649d29dd7cb66e5b92b618aa"
882
+ },
883
+ CRCLx: {
884
+ symbol: "CRCLx",
885
+ name: "Circle xStock",
886
+ decimals: 8,
887
+ address: "XsueG8BtpquVJX9LVLLEGuViXUungE6WmK5YZ3p3bd1",
888
+ chainKey: ChainKeys.SOLANA_MAINNET,
889
+ hubAsset: "0x64659130a3373b3527146b38fc1fccf017bc0c61",
890
+ vault: "0x64659130a3373b3527146b38fc1fccf017bc0c61"
891
+ },
892
+ TSLAx: {
893
+ symbol: "TSLAx",
894
+ name: "Tesla xStock",
895
+ decimals: 8,
896
+ address: "XsDoVfqeBukxuZHWhdvWHBhgEHjGNst4MLodqsJHzoB",
897
+ chainKey: ChainKeys.SOLANA_MAINNET,
898
+ hubAsset: "0x3cc867f6f4d1817b6230b781125301363fce370c",
899
+ vault: "0x3cc867f6f4d1817b6230b781125301363fce370c"
900
+ },
901
+ SPYx: {
902
+ symbol: "SPYx",
903
+ name: "SP500 xStock",
904
+ decimals: 8,
905
+ address: "XsoCS1TfEyfFhfvj8EtZ528L3CaKBDBRqRapnBbDF2W",
906
+ chainKey: ChainKeys.SOLANA_MAINNET,
907
+ hubAsset: "0xea66dbe82ebcb6c3a55b2db3d722b676be63a26e",
908
+ vault: "0xea66dbe82ebcb6c3a55b2db3d722b676be63a26e"
909
+ },
910
+ NVDAx: {
911
+ symbol: "NVDAx",
912
+ name: "NVIDIA xStock",
913
+ decimals: 8,
914
+ address: "Xsc9qvGR1efVDFGLrVsmkzv3qi45LTBjeUKSPmx9qEh",
915
+ chainKey: ChainKeys.SOLANA_MAINNET,
916
+ hubAsset: "0x48303c90f4136bc3101b308c8b50c55745aaf317",
917
+ vault: "0x48303c90f4136bc3101b308c8b50c55745aaf317"
918
+ },
919
+ QQQx: {
920
+ symbol: "QQQx",
921
+ name: "Nasdaq xStock",
922
+ decimals: 8,
923
+ address: "Xs8S1uUs1zvS2p7iwtsG3b6fkhpvmwz4GYU3gWAmWHZ",
924
+ chainKey: ChainKeys.SOLANA_MAINNET,
925
+ hubAsset: "0x4448b894740198ab76c83c8850d73f7dc8e4b9b3",
926
+ vault: "0x4448b894740198ab76c83c8850d73f7dc8e4b9b3"
927
+ },
928
+ MSTRx: {
929
+ symbol: "MSTRx",
930
+ name: "MicroStrategy xStock",
931
+ decimals: 8,
932
+ address: "XsP7xzNPvEHS1m6qfanPUGjNmdnmsLKEoNAnHjdxxyZ",
933
+ chainKey: ChainKeys.SOLANA_MAINNET,
934
+ hubAsset: "0xc46c34961802355c5223a115568fdf18a51ad6f6",
935
+ vault: "0xc46c34961802355c5223a115568fdf18a51ad6f6"
936
+ },
937
+ COINx: {
938
+ symbol: "COINx",
939
+ name: "Coinbase xStock",
940
+ decimals: 8,
941
+ address: "Xs7ZdzSHLU9ftNJsii5fCeJhoRWSC32SQGzGQtePxNu",
942
+ chainKey: ChainKeys.SOLANA_MAINNET,
943
+ hubAsset: "0xf444586e95166da0754052f03f344cf1152abe7d",
944
+ vault: "0xf444586e95166da0754052f03f344cf1152abe7d"
945
+ },
946
+ GOOGLx: {
947
+ symbol: "GOOGLx",
948
+ name: "Alphabet xStock",
949
+ decimals: 8,
950
+ address: "XsCPL9dNWBMvFtTmwcCA5v3xWPSMEBCszbQdiLLq6aN",
951
+ chainKey: ChainKeys.SOLANA_MAINNET,
952
+ hubAsset: "0x024230dd63b27df90d988d6f37a69d4de627ce89",
953
+ vault: "0x024230dd63b27df90d988d6f37a69d4de627ce89"
875
954
  }
876
955
  };
877
956
  var avalancheSupportedTokens = {
@@ -974,7 +1053,8 @@ var arbitrumSupportedTokens = {
974
1053
  address: "0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40",
975
1054
  chainKey: ChainKeys.ARBITRUM_MAINNET,
976
1055
  hubAsset: "0x96Fc8540736f1598b7E235e6dE8814062b3b5d3B",
977
- vault: SodaTokens.sodaBTC.address
1056
+ vault: SodaTokens.sodaBTC.address,
1057
+ access: "withdrawOnly"
978
1058
  },
979
1059
  WBTC: {
980
1060
  symbol: "WBTC",
@@ -983,7 +1063,17 @@ var arbitrumSupportedTokens = {
983
1063
  address: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
984
1064
  chainKey: ChainKeys.ARBITRUM_MAINNET,
985
1065
  hubAsset: "0xfB0ACB1b2720B620935F50a6dd3F7FEA52b2FCBe",
986
- vault: SodaTokens.sodaBTC.address
1066
+ vault: SodaTokens.sodaWBTC.address
1067
+ },
1068
+ WBTC_LEGACY: {
1069
+ symbol: "WBTC.legacy",
1070
+ name: "Wrapped BTC (Legacy)",
1071
+ decimals: 8,
1072
+ address: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
1073
+ chainKey: ChainKeys.ARBITRUM_MAINNET,
1074
+ hubAsset: "0xfB0ACB1b2720B620935F50a6dd3F7FEA52b2FCBe",
1075
+ vault: SodaTokens.sodaBTC.address,
1076
+ access: "withdrawOnly"
987
1077
  },
988
1078
  USDC: {
989
1079
  symbol: "USDC",
@@ -1138,7 +1228,8 @@ var baseSupportedTokens = {
1138
1228
  address: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
1139
1229
  chainKey: ChainKeys.BASE_MAINNET,
1140
1230
  hubAsset: "0x2803a23a3BA6b09e57D1c71deC0D9eFdBB00A27F",
1141
- vault: SodaTokens.sodaBTC.address
1231
+ vault: SodaTokens.sodaBTC.address,
1232
+ access: "withdrawOnly"
1142
1233
  },
1143
1234
  SODA: {
1144
1235
  symbol: "SODA",
@@ -2181,7 +2272,17 @@ var ethereumSupportedTokens = {
2181
2272
  address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
2182
2273
  chainKey: ChainKeys.ETHEREUM_MAINNET,
2183
2274
  hubAsset: "0x4ccbe4c2cf2aeed19314790622efd71dc0b67acb",
2184
- vault: SodaTokens.sodaBTC.address
2275
+ vault: SodaTokens.sodaWBTC.address
2276
+ },
2277
+ WBTC_LEGACY: {
2278
+ symbol: "WBTC.legacy",
2279
+ name: "Wrapped Bitcoin (Legacy)",
2280
+ decimals: 8,
2281
+ address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
2282
+ chainKey: ChainKeys.ETHEREUM_MAINNET,
2283
+ hubAsset: "0x4ccbe4c2cf2aeed19314790622efd71dc0b67acb",
2284
+ vault: SodaTokens.sodaBTC.address,
2285
+ access: "withdrawOnly"
2185
2286
  },
2186
2287
  sUSDat: {
2187
2288
  symbol: "sUSDat",
@@ -2794,7 +2895,7 @@ var spokeChainConfig = {
2794
2895
  walletAddress: "",
2795
2896
  pollingConfig: {
2796
2897
  pollingIntervalMs: 750,
2797
- maxTimeoutMs: 6e4
2898
+ maxTimeoutMs: 15e3
2798
2899
  // aligns with blockhash expiry timeout.
2799
2900
  }
2800
2901
  },
@@ -3185,6 +3286,7 @@ var moneyMarketSupportedTokens = {
3185
3286
  spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.ETH,
3186
3287
  spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.bnUSD,
3187
3288
  spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.WBTC,
3289
+ spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.WBTC_LEGACY,
3188
3290
  spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.weETH,
3189
3291
  spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.wstETH,
3190
3292
  spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.tBTC,
@@ -3227,13 +3329,15 @@ var moneyMarketSupportedTokens = {
3227
3329
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.bnUSD,
3228
3330
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.SODA,
3229
3331
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.weETH,
3332
+ spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.USDC,
3230
3333
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.USDT
3231
3334
  ],
3232
3335
  [ChainKeys.HYPEREVM_MAINNET]: [
3233
3336
  spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.HYPE,
3234
3337
  spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.bnUSD,
3235
3338
  spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.SODA,
3236
- spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.USDT0
3339
+ spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.USDT0,
3340
+ spokeChainConfig[ChainKeys.HYPEREVM_MAINNET].supportedTokens.USDC
3237
3341
  ],
3238
3342
  [ChainKeys.LIGHTLINK_MAINNET]: [
3239
3343
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens.ETH,
@@ -3241,6 +3345,7 @@ var moneyMarketSupportedTokens = {
3241
3345
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens.USDC,
3242
3346
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["AVAX.LL"],
3243
3347
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["BNB.LL"],
3348
+ spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["BTC.LL"],
3244
3349
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["SOL.LL"],
3245
3350
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["XLM.LL"],
3246
3351
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["INJ.LL"],
@@ -3308,7 +3413,9 @@ var moneyMarketSupportedTokens = {
3308
3413
  spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.weETH,
3309
3414
  spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.wstETH,
3310
3415
  spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.USDT,
3311
- spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.WBTC
3416
+ spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.WBTC,
3417
+ spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.WBTC_LEGACY,
3418
+ spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.LL
3312
3419
  ],
3313
3420
  [ChainKeys.REDBELLY_MAINNET]: [
3314
3421
  spokeChainConfig[ChainKeys.REDBELLY_MAINNET].supportedTokens.bnUSD,
@@ -3517,7 +3624,6 @@ var swapSupportedTokens = {
3517
3624
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.USDT,
3518
3625
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.wS,
3519
3626
  spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.SODA,
3520
- spokeChainConfig[ChainKeys.SONIC_MAINNET].supportedTokens.bnUSD,
3521
3627
  ...Object.values(SodaTokens)
3522
3628
  ],
3523
3629
  [ChainKeys.AVALANCHE_MAINNET]: [
@@ -3639,7 +3745,15 @@ var swapSupportedTokens = {
3639
3745
  spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.RAY,
3640
3746
  spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.PYTH,
3641
3747
  spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.JTO,
3642
- spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.WBTC
3748
+ spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.WBTC,
3749
+ spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.CRCLx,
3750
+ spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.TSLAx,
3751
+ spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.SPYx,
3752
+ spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.NVDAx,
3753
+ spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.QQQx,
3754
+ spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.MSTRx,
3755
+ spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.COINx,
3756
+ spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.GOOGLx
3643
3757
  ],
3644
3758
  [ChainKeys.ICON_MAINNET]: [
3645
3759
  spokeChainConfig[ChainKeys.ICON_MAINNET].supportedTokens.ICX,
@@ -3899,7 +4013,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
3899
4013
  }
3900
4014
 
3901
4015
  // ../types/dist/index.js
3902
- var CONFIG_VERSION = 200;
4016
+ var CONFIG_VERSION = 208;
3903
4017
  function isEvmSpokeChainConfig(value) {
3904
4018
  return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
3905
4019
  }
@@ -4109,7 +4223,7 @@ function encodeAddress(spokeChainId, address) {
4109
4223
  case "STELLAR":
4110
4224
  return `0x${stellarSdk.Address.fromString(address).toScVal().toXDR("hex")}`;
4111
4225
  case "STACKS":
4112
- return `0x${transactions.serializeCV(transactions.Cl.principal(address))}`;
4226
+ return `0x${core.serializeCV(core.Cl.principal(address))}`;
4113
4227
  case "BITCOIN":
4114
4228
  case "NEAR":
4115
4229
  case "INJECTIVE":
@@ -4153,8 +4267,8 @@ function reverseEncodeAddress(spokeChainId, encoded) {
4153
4267
  }
4154
4268
  case "STACKS": {
4155
4269
  const rawHex = encoded.startsWith("0x") ? encoded.slice(2) : encoded;
4156
- const cv = transactions.deserializeCV(viem.hexToBytes(`0x${rawHex}`));
4157
- return transactions.cvToString(cv);
4270
+ const cv = core.deserializeCV(viem.hexToBytes(`0x${rawHex}`));
4271
+ return core.cvToString(cv);
4158
4272
  }
4159
4273
  case "BITCOIN":
4160
4274
  case "NEAR":
@@ -13153,9 +13267,42 @@ var universalRouterAbi = [
13153
13267
  type: "function"
13154
13268
  }
13155
13269
  ];
13270
+
13271
+ // src/shared/utils/deepMerge.ts
13272
+ function deepMerge(target, source) {
13273
+ const result = { ...target };
13274
+ for (const key of Object.keys(source)) {
13275
+ const sourceVal = source[key];
13276
+ const targetVal = target[key];
13277
+ if (sourceVal !== void 0 && typeof sourceVal === "object" && sourceVal !== null && !Array.isArray(sourceVal) && typeof targetVal === "object" && targetVal !== null && !Array.isArray(targetVal)) {
13278
+ result[key] = deepMerge(
13279
+ targetVal,
13280
+ sourceVal
13281
+ );
13282
+ } else if (sourceVal !== void 0) {
13283
+ result[key] = sourceVal;
13284
+ }
13285
+ }
13286
+ return result;
13287
+ }
13288
+
13289
+ // src/shared/config/mergeSodaxConfig.ts
13290
+ function mergeSodaxConfig(base2, override) {
13291
+ const merged = deepMerge(base2, override);
13292
+ if (override.fee !== void 0) {
13293
+ merged.fee = override.fee;
13294
+ }
13295
+ if (override.bridge?.partnerFee !== void 0) {
13296
+ merged.bridge.partnerFee = override.bridge.partnerFee;
13297
+ }
13298
+ return merged;
13299
+ }
13300
+
13301
+ // src/shared/config/ConfigService.ts
13156
13302
  var ConfigService = class {
13157
13303
  sodax;
13158
13304
  api;
13305
+ userConfig;
13159
13306
  initialized = false;
13160
13307
  // data structures for quick lookup
13161
13308
  supportedHubAssetsSet;
@@ -13167,9 +13314,10 @@ var ConfigService = class {
13167
13314
  stakedATokenAddressesSet;
13168
13315
  chainToSupportedTokenAddressMap;
13169
13316
  hubAssetToXTokenMap;
13170
- constructor({ api, config }) {
13317
+ constructor({ api, config, userConfig }) {
13171
13318
  this.api = api;
13172
13319
  this.sodax = config;
13320
+ this.userConfig = userConfig;
13173
13321
  this.loadSodaxConfigDataStructures(config);
13174
13322
  }
13175
13323
  async initialize() {
@@ -13182,8 +13330,9 @@ var ConfigService = class {
13182
13330
  `Dynamic config version is less than the current version, resorting to the default one. Current version: ${CONFIG_VERSION}, response version: ${response.version}`
13183
13331
  );
13184
13332
  } else {
13185
- this.sodax = response.config;
13186
- this.loadSodaxConfigDataStructures(this.sodax);
13333
+ const next = this.userConfig ? mergeSodaxConfig(response.config, this.userConfig) : response.config;
13334
+ this.loadSodaxConfigDataStructures(next);
13335
+ this.sodax = next;
13187
13336
  this.initialized = true;
13188
13337
  }
13189
13338
  return { ok: true, value: void 0 };
@@ -13364,9 +13513,9 @@ var ConfigService = class {
13364
13513
  ])
13365
13514
  );
13366
13515
  this.loadSpokeChainConfigDataStructures(sodaxConfig2);
13367
- this.moneyMarketReserveAssetsSet = new Set(this.moneyMarket.supportedReserveAssets);
13516
+ this.moneyMarketReserveAssetsSet = new Set(sodaxConfig2.moneyMarket.supportedReserveAssets);
13368
13517
  this.stakedATokenAddressesSet = new Set(
13369
- Object.keys(this.dex.statATokenAddresses).map((address) => address.toLowerCase())
13518
+ Object.keys(sodaxConfig2.dex.statATokenAddresses).map((address) => address.toLowerCase())
13370
13519
  );
13371
13520
  }
13372
13521
  loadSpokeChainDataStructures(sodaxConfig2) {
@@ -13456,7 +13605,7 @@ async function waitForStacksTransaction(txid, rpc_url) {
13456
13605
  return false;
13457
13606
  }
13458
13607
  function serializeAddressData(address) {
13459
- return `0x${transactions.serializeCV(transactions.Cl.principal(address))}`;
13608
+ return `0x${core.serializeCV(core.Cl.principal(address))}`;
13460
13609
  }
13461
13610
  async function sleep2(s) {
13462
13611
  return new Promise((resolve) => {
@@ -13520,24 +13669,6 @@ function getEvmViemChain(key) {
13520
13669
  }
13521
13670
  }
13522
13671
  }
13523
-
13524
- // src/shared/utils/deepMerge.ts
13525
- function deepMerge(target, source) {
13526
- const result = { ...target };
13527
- for (const key of Object.keys(source)) {
13528
- const sourceVal = source[key];
13529
- const targetVal = target[key];
13530
- if (sourceVal !== void 0 && typeof sourceVal === "object" && sourceVal !== null && !Array.isArray(sourceVal) && typeof targetVal === "object" && targetVal !== null && !Array.isArray(targetVal)) {
13531
- result[key] = deepMerge(
13532
- targetVal,
13533
- sourceVal
13534
- );
13535
- } else if (sourceVal !== void 0) {
13536
- result[key] = sourceVal;
13537
- }
13538
- }
13539
- return result;
13540
- }
13541
13672
  var EvmVaultTokenService = class {
13542
13673
  constructor() {
13543
13674
  }
@@ -14151,12 +14282,12 @@ var StacksSpokeService = class {
14151
14282
  constructor(config) {
14152
14283
  this.config = config;
14153
14284
  const chainConfig = config.getChainConfig(ChainKeys.STACKS_MAINNET);
14154
- this.network = network.createNetwork({ network: "mainnet", client: { baseUrl: chainConfig.rpcUrl } });
14285
+ this.network = core.createNetwork({ network: "mainnet", client: { baseUrl: chainConfig.rpcUrl } });
14155
14286
  this.pollingIntervalMs = chainConfig.pollingConfig.pollingIntervalMs;
14156
14287
  this.maxTimeoutMs = chainConfig.pollingConfig.maxTimeoutMs;
14157
14288
  }
14158
14289
  async estimateGas(params) {
14159
- const [low, medium, high] = await transactions.fetchFeeEstimateTransaction({
14290
+ const [low, medium, high] = await core.fetchFeeEstimateTransaction({
14160
14291
  payload: params.tx.payload,
14161
14292
  estimatedLength: params.tx.estimatedLength,
14162
14293
  network: this.network
@@ -14164,7 +14295,7 @@ var StacksSpokeService = class {
14164
14295
  return { low, medium, high };
14165
14296
  }
14166
14297
  async readContract(sender, txParams) {
14167
- return transactions.fetchCallReadOnlyFunction({
14298
+ return core.fetchCallReadOnlyFunction({
14168
14299
  contractAddress: txParams.contractAddress,
14169
14300
  contractName: txParams.contractName,
14170
14301
  functionName: txParams.functionName,
@@ -14183,19 +14314,19 @@ var StacksSpokeService = class {
14183
14314
  return BigInt(data.stx.balance);
14184
14315
  }
14185
14316
  async readTokenBalance(token, address) {
14186
- const [contractAddress, contractName] = transactions.parseContractId(token);
14187
- const result = await transactions.fetchCallReadOnlyFunction({
14317
+ const [contractAddress, contractName] = core.parseContractId(token);
14318
+ const result = await core.fetchCallReadOnlyFunction({
14188
14319
  contractAddress,
14189
14320
  contractName,
14190
14321
  functionName: "get-balance",
14191
- functionArgs: [transactions.Cl.principal(address)],
14322
+ functionArgs: [core.Cl.principal(address)],
14192
14323
  network: this.network,
14193
14324
  senderAddress: address
14194
14325
  });
14195
14326
  return result.value.value;
14196
14327
  }
14197
14328
  async getImplContractAddress(stateContract) {
14198
- const [contractAddress, contractName] = transactions.parseContractId(stateContract);
14329
+ const [contractAddress, contractName] = core.parseContractId(stateContract);
14199
14330
  const txParams = {
14200
14331
  contractAddress,
14201
14332
  contractName,
@@ -14214,26 +14345,26 @@ var StacksSpokeService = class {
14214
14345
  async deposit(params) {
14215
14346
  const chainConfig = this.config.getChainConfig(params.srcChainKey);
14216
14347
  const assetManagerImpl = await this.getImplContractAddress(chainConfig.addresses.assetManager);
14217
- const [implAddress, implName] = transactions.parseContractId(assetManagerImpl);
14218
- const [connectionAddress, connectionName] = transactions.parseContractId(chainConfig.addresses.connection);
14348
+ const [implAddress, implName] = core.parseContractId(assetManagerImpl);
14349
+ const [connectionAddress, connectionName] = core.parseContractId(chainConfig.addresses.connection);
14219
14350
  const reqData = {
14220
14351
  contractAddress: implAddress,
14221
14352
  contractName: implName,
14222
14353
  functionName: "transfer",
14223
14354
  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)
14355
+ isNativeToken(params.srcChainKey, params.token) ? core.noneCV() : core.someCV(core.Cl.principal(params.token)),
14356
+ core.Cl.bufferFromHex(params.to),
14357
+ core.uintCV(params.amount),
14358
+ core.Cl.bufferFromHex(params.data),
14359
+ core.Cl.contractPrincipal(connectionAddress, connectionName)
14229
14360
  ],
14230
- postConditionMode: transactions.PostConditionMode.Allow
14361
+ postConditionMode: core.PostConditionMode.Allow
14231
14362
  };
14232
14363
  if (params.raw === true) {
14233
- if (transactions.validateStacksAddress(params.srcAddress)) {
14364
+ if (core.validateStacksAddress(params.srcAddress)) {
14234
14365
  throw new Error('When using raw transactions, the public key must be provided as "from" parameter');
14235
14366
  }
14236
- const tx = await transactions.makeUnsignedContractCall({
14367
+ const tx = await core.makeUnsignedContractCall({
14237
14368
  ...reqData,
14238
14369
  publicKey: params.srcAddress,
14239
14370
  network: this.network,
@@ -14242,7 +14373,7 @@ var StacksSpokeService = class {
14242
14373
  nonce: 0n
14243
14374
  });
14244
14375
  return {
14245
- payload: `0x${viem.bytesToHex(transactions.serializePayloadBytes(tx.payload))}`
14376
+ payload: viem.bytesToHex(core.serializePayloadBytes(tx.payload))
14246
14377
  };
14247
14378
  }
14248
14379
  const txId = await params.walletProvider.sendTransaction(reqData);
@@ -14265,18 +14396,18 @@ var StacksSpokeService = class {
14265
14396
  */
14266
14397
  async sendMessage(params) {
14267
14398
  const dstRelayChainId = getIntentRelayChainId(params.dstChainKey);
14268
- const [connectionAddress, connectionName] = transactions.parseContractId(
14399
+ const [connectionAddress, connectionName] = core.parseContractId(
14269
14400
  this.config.getChainConfig(params.srcChainKey).addresses.connection
14270
14401
  );
14271
14402
  const reqData = {
14272
14403
  contractAddress: connectionAddress,
14273
14404
  contractName: connectionName,
14274
14405
  functionName: "send-message",
14275
- functionArgs: [transactions.uintCV(dstRelayChainId), transactions.Cl.bufferFromHex(params.dstAddress), transactions.Cl.bufferFromHex(params.payload)],
14276
- postConditionMode: transactions.PostConditionMode.Allow
14406
+ functionArgs: [core.uintCV(dstRelayChainId), core.Cl.bufferFromHex(params.dstAddress), core.Cl.bufferFromHex(params.payload)],
14407
+ postConditionMode: core.PostConditionMode.Allow
14277
14408
  };
14278
14409
  if (params.raw === true) {
14279
- const tx = await transactions.makeUnsignedContractCall({
14410
+ const tx = await core.makeUnsignedContractCall({
14280
14411
  ...reqData,
14281
14412
  publicKey: params.srcAddress,
14282
14413
  network: this.network,
@@ -14285,7 +14416,7 @@ var StacksSpokeService = class {
14285
14416
  nonce: 0n
14286
14417
  });
14287
14418
  return {
14288
- payload: `0x${viem.bytesToHex(transactions.serializePayloadBytes(tx.payload))}`
14419
+ payload: viem.bytesToHex(core.serializePayloadBytes(tx.payload))
14289
14420
  };
14290
14421
  }
14291
14422
  const txId = await params.walletProvider.sendTransaction(reqData);
@@ -14368,7 +14499,7 @@ var RadfiProvider = class {
14368
14499
  if (!publicKey) {
14369
14500
  throw new Error("Failed to retrieve public key from wallet. Please unlock your wallet and try again.");
14370
14501
  }
14371
- const message = `Login to Radfi via Sodax: ${Date.now()}`;
14502
+ const message = `${Date.now()}`;
14372
14503
  const addressType = detectBitcoinAddressType(address);
14373
14504
  const signature = addressType === "P2WPKH" || addressType === "P2TR" ? await walletProvider.signBip322Message(message) : await walletProvider.signEcdsaMessage(message);
14374
14505
  const result = await this.authenticate({ message, signature, address, publicKey });
@@ -14700,7 +14831,7 @@ function normalizePsbtToBase64(signedPsbt) {
14700
14831
  }
14701
14832
 
14702
14833
  // src/shared/services/spoke/BitcoinSpokeService.ts
14703
- bitcoin__namespace.initEccLib(ecc__namespace);
14834
+ bitcoinjsLib.initEccLib(ecc__namespace);
14704
14835
  var BITCOIN_DEFAULT_FEE_RATE = 3;
14705
14836
  var DUST_THRESHOLD = 546;
14706
14837
  var BitcoinSpokeService = class {
@@ -14720,7 +14851,7 @@ var BitcoinSpokeService = class {
14720
14851
  this.maxTimeoutMs = chainConfig.pollingConfig.maxTimeoutMs;
14721
14852
  }
14722
14853
  getBtcNetwork(chainId) {
14723
- return this.config.getChainConfig(chainId).network === "MAINNET" ? bitcoin__namespace.networks.bitcoin : bitcoin__namespace.networks.testnet;
14854
+ return this.config.getChainConfig(chainId).network === "MAINNET" ? bitcoinjsLib.networks.bitcoin : bitcoinjsLib.networks.testnet;
14724
14855
  }
14725
14856
  async getBalance(tokenAddress, walletAddress) {
14726
14857
  if (!tokenAddress || tokenAddress === "0x" || tokenAddress === "BTC") {
@@ -14732,7 +14863,7 @@ var BitcoinSpokeService = class {
14732
14863
  }
14733
14864
  async fetchScriptPubKey(utxo) {
14734
14865
  const txHex = await this.fetchRawTransaction(utxo.txid);
14735
- const tx = bitcoin__namespace.Transaction.fromHex(txHex);
14866
+ const tx = bitcoinjsLib.Transaction.fromHex(txHex);
14736
14867
  const out = tx.outs[utxo.vout];
14737
14868
  if (!out) {
14738
14869
  throw new Error(`UTXO not found: ${utxo.txid}:${utxo.vout}`);
@@ -14834,7 +14965,7 @@ var BitcoinSpokeService = class {
14834
14965
  * Build a priority Bitcoin transaction with proper fee calculation
14835
14966
  */
14836
14967
  async buildBitcoinTransaction(utxos, outputs, changeAddress, chainId, walletProvider, feeRate) {
14837
- const psbt = new bitcoin__namespace.Psbt({ network: this.getBtcNetwork(chainId) });
14968
+ const psbt = new bitcoinjsLib.Psbt({ network: this.getBtcNetwork(chainId) });
14838
14969
  const effectiveFeeRate = feeRate ?? await this.getFeeRateEstimate();
14839
14970
  const walletAddress = await walletProvider.getWalletAddress();
14840
14971
  const addressType = detectBitcoinAddressType(walletAddress);
@@ -14865,7 +14996,7 @@ var BitcoinSpokeService = class {
14865
14996
  throw new Error("Missing public key for P2SH-P2WPKH input");
14866
14997
  }
14867
14998
  const pubKeyHex = await walletProvider.getPublicKey();
14868
- const redeemScript = bitcoin__namespace.payments.p2wpkh({
14999
+ const redeemScript = bitcoinjsLib.payments.p2wpkh({
14869
15000
  pubkey: Buffer.from(pubKeyHex, "hex"),
14870
15001
  network: this.getBtcNetwork(chainId)
14871
15002
  }).output;
@@ -15022,14 +15153,14 @@ var BitcoinSpokeService = class {
15022
15153
  const psbt = await this.buildBitcoinTransaction(utxos, outputs, walletAddress, srcChainKey, walletProvider);
15023
15154
  const OP_RADFI_SODAX_DATA = 49;
15024
15155
  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;
15156
+ const OP_RETURN = bitcoinjsLib.opcodes.OP_RETURN;
15157
+ const OP_12 = bitcoinjsLib.opcodes.OP_12;
15027
15158
  if (OP_RETURN === void 0 || OP_12 === void 0) {
15028
15159
  throw new Error("bitcoinjs-lib opcodes OP_RETURN or OP_12 are undefined");
15029
15160
  }
15030
- const script2 = bitcoin__namespace.script.compile([OP_RETURN, OP_12, payload]);
15161
+ const compiledScript = bitcoinjsLib.script.compile([OP_RETURN, OP_12, payload]);
15031
15162
  psbt.addOutput({
15032
- script: script2,
15163
+ script: compiledScript,
15033
15164
  value: 0
15034
15165
  });
15035
15166
  return psbt;
@@ -21379,6 +21510,66 @@ var EvmSolverService = class _EvmSolverService {
21379
21510
  };
21380
21511
  return [viem.encodePacked(["uint8", "bytes"], [intentData.type, intentData.data]), feeAmount];
21381
21512
  }
21513
+ /**
21514
+ * Recovers the partner fee amount embedded in an intent's `data` field.
21515
+ *
21516
+ * Exact inverse of {@link createIntentFeeData}: `'0x'` means no fee (`0n`); otherwise the first
21517
+ * byte is the {@link IntentDataType} tag (from the `encodePacked(['uint8','bytes'], …)` envelope)
21518
+ * and the remainder is the ABI-encoded `(uint256 fee, address receiver)` struct.
21519
+ *
21520
+ * @param data - The intent's `data` field (`'0x'` when no fee was configured).
21521
+ * @returns The fee amount in the input token's smallest unit (`0n` when no fee data is present, or
21522
+ * when the leading type byte is not {@link IntentDataType.FEE} — in which case it logs and degrades to `0n`).
21523
+ */
21524
+ static decodeIntentFeeAmount(data) {
21525
+ if (data === "0x" || data.length <= 2) {
21526
+ return 0n;
21527
+ }
21528
+ const typeByte = Number.parseInt(data.slice(2, 4), 16);
21529
+ if (typeByte !== 1 /* FEE */) {
21530
+ console.error(`[decodeIntentFeeAmount] Unknown IntentData type byte: ${typeByte}. Gracefully returning 0n.`);
21531
+ return 0n;
21532
+ }
21533
+ const [feeAmount] = viem.decodeAbiParameters(
21534
+ [
21535
+ { name: "fee", type: "uint256" },
21536
+ { name: "receiver", type: "address" }
21537
+ ],
21538
+ `0x${data.slice(4)}`
21539
+ );
21540
+ return feeAmount;
21541
+ }
21542
+ /**
21543
+ * Re-derives the byte-identical relay payload that `createIntent` originally produced, from a
21544
+ * fully-populated `Intent` alone.
21545
+ *
21546
+ * Mirrors the two payload shapes built at intent-creation time:
21547
+ * - Hub (Sonic) source — raw `createIntent(intent)` calldata (no approval, no multicall), matching
21548
+ * {@link SonicSpokeService.createSwapIntent}.
21549
+ * - Spoke source — the `[approve(intentsContract, gross), createIntent(intent)]` multicall, matching
21550
+ * {@link constructCreateIntentData}. The gross approval amount is recovered as
21551
+ * `intent.inputAmount + feeAmount`, where `feeAmount` comes from {@link decodeIntentFeeAmount}.
21552
+ *
21553
+ * Byte-identity holds because this reuses the exact encode primitives (`encodeCreateIntent`,
21554
+ * `Erc20Service.encodeApprove`, `encodeContractCalls`) that produced the original — the only
21555
+ * originally-random input, `intentId`, is already carried on the `Intent`.
21556
+ *
21557
+ * @param intent - The fully-populated intent (e.g. from `createIntent` or `getIntent`).
21558
+ * @param intentsContract - The hub-chain intents contract address (`config.solver.intentsContract`).
21559
+ * @param isHubSource - `true` when the intent's source chain is the hub (Sonic).
21560
+ * @returns The byte-identical relay payload `Hex`.
21561
+ */
21562
+ static reconstructCreateIntentData(intent, intentsContract, isHubSource) {
21563
+ const createIntentCall = _EvmSolverService.encodeCreateIntent(intent, intentsContract);
21564
+ if (isHubSource) {
21565
+ return createIntentCall.data;
21566
+ }
21567
+ const grossInputAmount = intent.inputAmount + _EvmSolverService.decodeIntentFeeAmount(intent.data);
21568
+ return encodeContractCalls([
21569
+ Erc20Service.encodeApprove(intent.inputToken, intentsContract, grossInputAmount),
21570
+ createIntentCall
21571
+ ]);
21572
+ }
21382
21573
  /**
21383
21574
  * Reads an `Intent` struct from a hub-chain transaction receipt.
21384
21575
  *
@@ -21631,7 +21822,7 @@ var SonicSpokeService = class {
21631
21822
  }
21632
21823
  /**
21633
21824
  * Deposit tokens to the spoke chain using the Sonic wallet abstraction.
21634
- * @param {SonicSpokeDepositParams<Raw>} params - The parameters for the deposit
21825
+ * @param {DepositParams<SonicChainKey, Raw>} params - The parameters for the deposit
21635
21826
  * @returns {Promise<TxReturnType<SonicChainKey, Raw>>} A promise that resolves to the transaction hash
21636
21827
  */
21637
21828
  async deposit(params) {
@@ -21860,9 +22051,6 @@ var SuiSpokeService = class {
21860
22051
  }
21861
22052
  return coin;
21862
22053
  }
21863
- static getAddressBCSBytes(suiaddress) {
21864
- return viem.toHex(bcs.bcs.Address.serialize(suiaddress).toBytes());
21865
- }
21866
22054
  encodeSimulationParams(token, assetManager) {
21867
22055
  const encoder2 = new TextEncoder();
21868
22056
  return {
@@ -21900,7 +22088,7 @@ var SuiSpokeService = class {
21900
22088
  async deposit(params) {
21901
22089
  const { srcAddress: from, srcChainKey, token, to, amount, data = "0x" } = params;
21902
22090
  const isNative = isNativeToken(srcChainKey, token);
21903
- const tx = new transactions$1.Transaction();
22091
+ const tx = new transactions.Transaction();
21904
22092
  const coin = isNative ? await this.getNativeCoin(tx, amount) : await this.getCoin(tx, token, amount, from);
21905
22093
  const connection = this.splitAddress(this.config.getChainConfig(srcChainKey).addresses.connection);
21906
22094
  const assetManager = this.splitAddress(await this.getAssetManagerAddress(srcChainKey));
@@ -21934,7 +22122,7 @@ var SuiSpokeService = class {
21934
22122
  }
21935
22123
  async sendMessage(params) {
21936
22124
  const { srcAddress: from, srcChainKey, dstChainKey, dstAddress, payload } = params;
21937
- const txb = new transactions$1.Transaction();
22125
+ const txb = new transactions.Transaction();
21938
22126
  const connection = this.splitAddress(this.config.getChainConfig(srcChainKey).addresses.connection);
21939
22127
  const relayId = getIntentRelayChainId(dstChainKey);
21940
22128
  txb.moveCall({
@@ -21968,7 +22156,7 @@ var SuiSpokeService = class {
21968
22156
  * @returns {Promise<bigint>} The estimated computation cost.
21969
22157
  */
21970
22158
  async estimateGas({ tx }) {
21971
- const txb = transactions$1.Transaction.fromKind(tx.data);
22159
+ const txb = transactions.Transaction.fromKind(tx.data);
21972
22160
  const result = await this.publicClient.devInspectTransactionBlock({
21973
22161
  sender: tx.from,
21974
22162
  transactionBlock: txb
@@ -21977,13 +22165,12 @@ var SuiSpokeService = class {
21977
22165
  }
21978
22166
  /**
21979
22167
  * 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.
22168
+ * @param {GetDepositParams<SuiChainKey>} params - The src chain key, src address, and token address.
21982
22169
  * @returns {Promise<bigint>} The balance of the token.
21983
22170
  */
21984
22171
  async getDeposit(params) {
21985
22172
  const assetmanager = this.splitAddress(await this.getAssetManagerAddress(params.srcChainKey));
21986
- const tx = new transactions$1.Transaction();
22173
+ const tx = new transactions.Transaction();
21987
22174
  const result = await this.viewContract(
21988
22175
  tx,
21989
22176
  assetmanager.packageId,
@@ -22002,7 +22189,7 @@ var SuiSpokeService = class {
22002
22189
  }
22003
22190
  /**
22004
22191
  * Fetch the asset manager config from the spoke chain.
22005
- * @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
22192
+ * @param {SuiChainKey} chainId - The Sui chain key.
22006
22193
  * @returns {Promise<string>} The asset manager config.
22007
22194
  */
22008
22195
  async fetchAssetManagerAddress(chainId) {
@@ -22011,7 +22198,7 @@ var SuiSpokeService = class {
22011
22198
  }
22012
22199
  /**
22013
22200
  * Fetch the latest asset manager package id from the spoke chain.
22014
- * @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
22201
+ * @param {SuiChainKey} chainId - The Sui chain key.
22015
22202
  * @returns {Promise<string>} The latest asset manager package id.
22016
22203
  */
22017
22204
  async fetchLatestAssetManagerPackageId(chainId) {
@@ -22625,11 +22812,11 @@ async function getProvider(base58PublicKey, rpcUrl) {
22625
22812
  signAllTransactions: () => Promise.reject()
22626
22813
  };
22627
22814
  const connection = new web3_js.Connection(rpcUrl);
22628
- return new anchor__namespace.AnchorProvider(connection, wallet, { commitment: "confirmed" });
22815
+ return new anchor.AnchorProvider(connection, wallet, { commitment: "confirmed" });
22629
22816
  }
22630
22817
  async function getAssetManagerIdl(assetManager, provider) {
22631
22818
  try {
22632
- const idl = await anchor__namespace.Program.fetchIdl(new web3_js.PublicKey(assetManager), provider);
22819
+ const idl = await anchor.Program.fetchIdl(new web3_js.PublicKey(assetManager), provider);
22633
22820
  if (!idl) {
22634
22821
  throw new Error("asset manager idl not available");
22635
22822
  }
@@ -22641,7 +22828,7 @@ async function getAssetManagerIdl(assetManager, provider) {
22641
22828
  }
22642
22829
  async function getConnectionIdl(connection, provider) {
22643
22830
  try {
22644
- const idl = await anchor__namespace.Program.fetchIdl(new web3_js.PublicKey(connection), provider);
22831
+ const idl = await anchor.Program.fetchIdl(new web3_js.PublicKey(connection), provider);
22645
22832
  if (!idl) {
22646
22833
  throw new Error("asset manager idl not available");
22647
22834
  }
@@ -22654,12 +22841,12 @@ async function getConnectionIdl(connection, provider) {
22654
22841
  async function getAssetManagerProgram(base58PublicKey, rpcUrl, assetManager) {
22655
22842
  const provider = await getProvider(base58PublicKey, rpcUrl);
22656
22843
  const idl = await getAssetManagerIdl(assetManager, provider);
22657
- return new anchor__namespace.Program(idl, provider);
22844
+ return new anchor.Program(idl, provider);
22658
22845
  }
22659
22846
  async function getConnectionProgram(base58PublicKey, rpcUrl, connection) {
22660
22847
  const provider = await getProvider(base58PublicKey, rpcUrl);
22661
22848
  const idl = await getConnectionIdl(connection, provider);
22662
- return new anchor__namespace.Program(idl, provider);
22849
+ return new anchor.Program(idl, provider);
22663
22850
  }
22664
22851
  function getSolanaAddressBytes(address) {
22665
22852
  return `0x${Buffer.from(address.toBytes()).toString("hex")}`;
@@ -22876,7 +23063,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
22876
23063
  while (Date.now() < deadline) {
22877
23064
  try {
22878
23065
  const tx = await this.connection.getTransaction(txHash, {
22879
- commitment: "finalized",
23066
+ commitment: "confirmed",
22880
23067
  maxSupportedTransactionVersion: 0
22881
23068
  });
22882
23069
  if (tx) {
@@ -22893,7 +23080,7 @@ var SolanaSpokeService = class _SolanaSpokeService {
22893
23080
  ok: true,
22894
23081
  value: {
22895
23082
  status: "timeout",
22896
- error: new Error(`Timed out after ${maxTimeoutMs}ms waiting for finalized confirmation for ${txHash}`)
23083
+ error: new Error(`Timed out after ${maxTimeoutMs}ms waiting for confirmation for ${txHash}`)
22897
23084
  }
22898
23085
  };
22899
23086
  }
@@ -22971,7 +23158,7 @@ var IconSpokeService = class {
22971
23158
  }
22972
23159
  /**
22973
23160
  * Deposit tokens to the spoke chain.
22974
- * @param {IconSpokeDepositParams} params - The parameters for the deposit
23161
+ * @param {DepositParams<IconChainKey, R>} params - The parameters for the deposit
22975
23162
  * @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain
22976
23163
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain
22977
23164
  * @param {boolean} raw - The return type raw or just transaction hash
@@ -26067,6 +26254,34 @@ var SwapService = class {
26067
26254
  return { ok: false, error };
26068
26255
  }
26069
26256
  }
26257
+ /**
26258
+ * Re-derives the byte-identical relay extra data (`{ address, payload }`) for a swap intent from a
26259
+ * fully-populated `Intent` alone — no on-chain call, no original `createIntent` return value needed.
26260
+ *
26261
+ * The `payload` matches exactly what `createIntent` relayed when the intent was first created:
26262
+ * - Sonic-hub source — raw `createIntent(intent)` calldata.
26263
+ * - Any spoke source — the `[approve, createIntent]` multicall (uniform across all spokes).
26264
+ *
26265
+ * Byte-identity is possible because the only originally-random field, `intentId`, is already
26266
+ * carried on the `Intent`; everything else in the payload is a pure function of the intent and
26267
+ * the configured intents contract. Use this to rebuild relay submission data for a manual relay
26268
+ * step when the runtime `relayData` from `createIntent` is no longer available.
26269
+ *
26270
+ * @param intent - A fully-populated intent (e.g. from `getIntent(txHash)` or the `intent` field
26271
+ * returned by `createIntent`).
26272
+ * @returns A `Result` containing `RelayExtraData`: `{ address: Hex; payload: Hex }`.
26273
+ */
26274
+ reconstructRelayData(intent) {
26275
+ try {
26276
+ invariant(this.config.isValidIntentRelayChainId(intent.srcChain), `Invalid intent.srcChain: ${intent.srcChain}`);
26277
+ invariant(this.config.isValidIntentRelayChainId(intent.dstChain), `Invalid intent.dstChain: ${intent.dstChain}`);
26278
+ const isHubSource = intent.srcChain === getIntentRelayChainId(HUB_CHAIN_KEY);
26279
+ const payload = EvmSolverService.reconstructCreateIntentData(intent, this.solver.intentsContract, isHubSource);
26280
+ return { ok: true, value: { address: intent.creator, payload } };
26281
+ } catch (error) {
26282
+ return { ok: false, error };
26283
+ }
26284
+ }
26070
26285
  /**
26071
26286
  * Fetches a previously created `Intent` from the hub chain by its transaction hash.
26072
26287
  *
@@ -28051,7 +28266,7 @@ var MigrationService = class {
28051
28266
  );
28052
28267
  const hubWalletAddress = await this.hubProvider.getUserHubWalletAddress(
28053
28268
  params.srcAddress,
28054
- ChainKeys.SONIC_MAINNET
28269
+ ChainKeys.ICON_MAINNET
28055
28270
  );
28056
28271
  const coreParams = {
28057
28272
  srcChainKey: ChainKeys.ICON_MAINNET,
@@ -29151,11 +29366,7 @@ var BridgeService = class {
29151
29366
  * checking theoretical bridgeability without requiring both chains to be in the active config.
29152
29367
  * @returns `true` if the tokens share the same hub vault; `false` otherwise.
29153
29368
  */
29154
- isBridgeable({
29155
- from,
29156
- to,
29157
- unchecked = false
29158
- }) {
29369
+ isBridgeable({ from, to, unchecked = false }) {
29159
29370
  try {
29160
29371
  if (!unchecked) {
29161
29372
  bridgeInvariant(this.config.isValidSpokeChainKey(from.chainKey), `Invalid spoke chain (${from.chainKey})`, {
@@ -31361,7 +31572,7 @@ var AssetService = class {
31361
31572
  calls.push(Erc4626Service.encodeRedeem(dexToken, amount, userAddress, userAddress));
31362
31573
  }
31363
31574
  calls.push(EvmVaultTokenService.encodeWithdraw(assetConfig.vault, assetConfig.hubAsset, vaultAmount));
31364
- const translatedAmount = EvmVaultTokenService.translateIncomingDecimals(assetConfig.decimals, vaultAmount);
31575
+ const translatedAmount = EvmVaultTokenService.translateOutgoingDecimals(assetConfig.decimals, vaultAmount);
31365
31576
  if (dstChainKey === this.hubProvider.chainConfig.chain.key) {
31366
31577
  if (assetConfig.hubAsset.toLowerCase() === this.config.spokeChainConfig[dstChainKey].addresses.wrappedSonic.toLowerCase()) {
31367
31578
  const withdrawToCall = {
@@ -34349,7 +34560,8 @@ var UiPoolDataProviderService = class {
34349
34560
  // The borrow index must also come from the bnUSD debt token.
34350
34561
  // User debt is stored scaled by bnUSD's index, so reading it back requires the same index.
34351
34562
  // Using the vault's index here would inflate the displayed debt amount.
34352
- variableBorrowIndex: bnUSDReserve.variableBorrowIndex
34563
+ variableBorrowIndex: bnUSDReserve.variableBorrowIndex,
34564
+ borrowingEnabled: bnUSDReserve.borrowingEnabled
34353
34565
  };
34354
34566
  return [
34355
34567
  [
@@ -36659,9 +36871,9 @@ var Sodax = class {
36659
36871
  spoke;
36660
36872
  // spoke service enabling spoke chain operations
36661
36873
  constructor(config) {
36662
- this.instanceConfig = config ? deepMerge(sodaxConfig, config) : sodaxConfig;
36874
+ this.instanceConfig = config ? mergeSodaxConfig(sodaxConfig, config) : sodaxConfig;
36663
36875
  this.backendApi = new BackendApiService(this.instanceConfig.api);
36664
- this.config = new ConfigService({ api: this.backendApi, config: this.instanceConfig });
36876
+ this.config = new ConfigService({ api: this.backendApi, config: this.instanceConfig, userConfig: config });
36665
36877
  this.hubProvider = new EvmHubProvider({ config: this.config });
36666
36878
  this.spoke = new SpokeService({ config: this.config, hubProvider: this.hubProvider });
36667
36879
  this.swaps = new SwapService({
@@ -37056,6 +37268,7 @@ exports.kaiaSupportedTokens = kaiaSupportedTokens;
37056
37268
  exports.lightlinkSupportedTokens = lightlinkSupportedTokens;
37057
37269
  exports.lookupFailed = lookupFailed;
37058
37270
  exports.mapRelayFailure = mapRelayFailure;
37271
+ exports.mergeSodaxConfig = mergeSodaxConfig;
37059
37272
  exports.messageOf = messageOf;
37060
37273
  exports.migrationInvariant = migrationInvariant;
37061
37274
  exports.mintPositionParamsAbi = mintPositionParamsAbi;
@@ -37135,5 +37348,3 @@ exports.waitForTransactionReceipt = waitForTransactionReceipt;
37135
37348
  exports.waitUntilIntentExecuted = waitUntilIntentExecuted;
37136
37349
  exports.walletFactoryAbi = walletFactoryAbi;
37137
37350
  exports.wrappedSonicAbi = wrappedSonicAbi;
37138
- //# sourceMappingURL=index.cjs.map
37139
- //# sourceMappingURL=index.cjs.map