@sodax/sdk 0.0.1-rc.16 → 0.0.1-rc.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,6 @@ The Sodax SDK provides a comprehensive interface for interacting with the Sodax
11
11
  - ICON ✅
12
12
  - Solana ✅
13
13
  - Injective ✅
14
- - Havah ❌ Coming soon
15
14
 
16
15
  ### Lend and Borrow (Money Market)
17
16
  - EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic) ✅
@@ -20,7 +19,6 @@ The Sodax SDK provides a comprehensive interface for interacting with the Sodax
20
19
  - ICON ✅
21
20
  - Solana ✅
22
21
  - Injective ✅
23
- - Havah ❌ Coming soon
24
22
 
25
23
 
26
24
  ## Installation
@@ -225,9 +223,8 @@ As part of Sodax suite, xWagmi SDK is also going to be provided as one example w
225
223
  - `ISuiWalletProvider`: Sui ✅
226
224
  - `IIconWalletProvider`: ICON ✅
227
225
  - `IStellarWalletProvider`: Stellar ✅
228
- - Solana ✅
229
- - Injective ✅
230
- - Havah ❌ Coming soon
226
+ - `ISolanaWalletProvider`: Solana ✅
227
+ - `IInjectiveWalletProvider`: Injective ✅
231
228
 
232
229
  ### Initialising Spoke Provider
233
230
 
package/dist/index.cjs CHANGED
@@ -6241,8 +6241,8 @@ var spokeChainConfig = {
6241
6241
  nativeToken: "0x0000000000000000000000000000000000000000",
6242
6242
  bnUSD: "0x6958a4CBFe11406E2a1c1d3a71A1971aD8B3b92F",
6243
6243
  supportedTokens: {
6244
- Sonic: {
6245
- symbol: "Sonic",
6244
+ S: {
6245
+ symbol: "S",
6246
6246
  name: "Sonic",
6247
6247
  decimals: 18,
6248
6248
  address: "0x0000000000000000000000000000000000000000"
@@ -6265,8 +6265,8 @@ var spokeChainConfig = {
6265
6265
  decimals: 6,
6266
6266
  address: "0x6047828dc181963ba44974801FF68e538dA5eaF9"
6267
6267
  },
6268
- wSonic: {
6269
- symbol: "wSonic",
6268
+ wS: {
6269
+ symbol: "wS",
6270
6270
  name: "Wrapped Sonic",
6271
6271
  decimals: 18,
6272
6272
  address: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38"
@@ -7030,42 +7030,42 @@ var hubVaults = {
7030
7030
  var hubAssets = {
7031
7031
  [types.SONIC_MAINNET_CHAIN_ID]: {
7032
7032
  [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].nativeToken]: {
7033
- asset: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",
7033
+ asset: spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wS.address,
7034
7034
  decimal: 18,
7035
7035
  symbol: "S",
7036
7036
  name: "Sonic",
7037
7037
  vault: hubVaults.sodaS.address
7038
7038
  },
7039
- [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wSonic.address]: {
7040
- asset: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",
7039
+ [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wS.address]: {
7040
+ asset: spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wS.address,
7041
7041
  decimal: 18,
7042
- symbol: "wSonic",
7042
+ symbol: "wS",
7043
7043
  name: "Sonic",
7044
7044
  vault: hubVaults.sodaS.address
7045
7045
  },
7046
7046
  [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH.address]: {
7047
- asset: "0x50c42dEAcD8Fc9773493ED674b675bE577f2634b",
7047
+ asset: spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH.address,
7048
7048
  decimal: 18,
7049
7049
  symbol: "WETH",
7050
7050
  name: "Wrapped Ethereum",
7051
7051
  vault: hubVaults.sodaETH.address
7052
7052
  },
7053
7053
  [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
7054
- asset: "0x29219dd400f2Bf60E5a23d13Be72B486D4038894",
7054
+ asset: spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC.address,
7055
7055
  decimal: 6,
7056
7056
  symbol: "USDC ",
7057
7057
  name: "USD Coin",
7058
7058
  vault: hubVaults.sodaUSDC.address
7059
7059
  },
7060
7060
  [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT.address]: {
7061
- asset: "0x6047828dc181963ba44974801ff68e538da5eaf9",
7061
+ asset: spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT.address,
7062
7062
  decimal: 6,
7063
7063
  symbol: "USDT",
7064
7064
  name: "Tether USD",
7065
7065
  vault: hubVaults.sodaUSDT.address
7066
7066
  },
7067
7067
  [spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
7068
- asset: "0x7c7d53EEcda37a87ce0D5bf8E0b24512A48dC963",
7068
+ asset: spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.SODA.address,
7069
7069
  decimal: 18,
7070
7070
  symbol: "SODA",
7071
7071
  name: "SODA",
@@ -7527,10 +7527,11 @@ var solverConfig = {
7527
7527
  var getSolverConfig = (chainId) => solverConfig[chainId];
7528
7528
  var solverSupportedTokens = {
7529
7529
  [types.SONIC_MAINNET_CHAIN_ID]: [
7530
- // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH, // NOTE: Planned for next release (1 - 2 weeks)
7531
- // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC, // NOTE: Planned for next release (1 - 2 weeks)
7532
- // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT, // NOTE: Planned for next release (1 - 2 weeks)
7533
- // spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.wSonic, // NOTE: Planned for next release (1 - 2 weeks)
7530
+ spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.S,
7531
+ spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH,
7532
+ spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC,
7533
+ spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT,
7534
+ spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wS
7534
7535
  ],
7535
7536
  [types.AVALANCHE_MAINNET_CHAIN_ID]: [
7536
7537
  spokeChainConfig[types.AVALANCHE_MAINNET_CHAIN_ID].supportedTokens.AVAX,
@@ -7697,11 +7698,11 @@ var moneyMarketSupportedTokens = {
7697
7698
  ],
7698
7699
  [types.NIBIRU_MAINNET_CHAIN_ID]: [],
7699
7700
  [types.SONIC_MAINNET_CHAIN_ID]: [
7700
- spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.Sonic,
7701
+ spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.S,
7701
7702
  spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH,
7702
7703
  spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC,
7703
7704
  spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT,
7704
- spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wSonic
7705
+ spokeChainConfig[types.SONIC_MAINNET_CHAIN_ID].supportedTokens.wS
7705
7706
  ]
7706
7707
  };
7707
7708
  var migrationConfig = {
@@ -9052,16 +9053,28 @@ var EvmWalletAbstraction = class {
9052
9053
  var WalletAbstractionService = class {
9053
9054
  constructor() {
9054
9055
  }
9055
- static async getUserHubWalletAddress(chainId, address, hubProvider, spokeProvider) {
9056
- if (chainId === hubProvider.chainConfig.chain.id) {
9056
+ /**
9057
+ * Gets the hub wallet address for a user based on their spoke chain address.
9058
+ * @param address - The user's address on the spoke chain
9059
+ * @param spokeProvider - The provider for interacting with the spoke chain
9060
+ * @param hubProvider - The provider for interacting with the hub chain
9061
+ * @returns The user's hub wallet address
9062
+ */
9063
+ static async getUserHubWalletAddress(address, spokeProvider, hubProvider) {
9064
+ const encodedAddress = encodeAddress(spokeProvider.chainConfig.chain.id, address);
9065
+ if (spokeProvider.chainConfig.chain.id === hubProvider.chainConfig.chain.id) {
9057
9066
  if (spokeProvider instanceof SonicSpokeProvider) {
9058
- return SonicSpokeService.getUserRouter(address, spokeProvider);
9067
+ return SonicSpokeService.getUserRouter(encodedAddress, spokeProvider);
9059
9068
  }
9060
9069
  throw new Error(
9061
9070
  "[WalletAbstractionService.getUserHubWalletAddress] Invalid spoke provider. Sonic spoke provider is required."
9062
9071
  );
9063
9072
  }
9064
- return EvmWalletAbstraction.getUserHubWalletAddress(chainId, address, hubProvider);
9073
+ return EvmWalletAbstraction.getUserHubWalletAddress(
9074
+ spokeProvider.chainConfig.chain.id,
9075
+ encodedAddress,
9076
+ hubProvider
9077
+ );
9065
9078
  }
9066
9079
  };
9067
9080
  async function retry(action, retryCount = DEFAULT_MAX_RETRY, delayMs = DEFAULT_RETRY_DELAY_MS) {
@@ -9439,26 +9452,32 @@ var MoneyMarketService = class _MoneyMarketService {
9439
9452
  if (!txResult.ok) {
9440
9453
  return txResult;
9441
9454
  }
9442
- const packetResult = await relayTxAndWaitPacket(
9443
- txResult.value,
9444
- spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
9445
- spokeProvider,
9446
- this.config.relayerApiEndpoint,
9447
- timeout
9448
- );
9449
- if (!packetResult.ok) {
9450
- return {
9451
- ok: false,
9452
- error: {
9453
- code: packetResult.error.code,
9454
- data: {
9455
- error: packetResult.error,
9456
- payload: txResult.value
9455
+ let intentTxHash = null;
9456
+ if (spokeProvider.chainConfig.chain.id !== types.SONIC_MAINNET_CHAIN_ID) {
9457
+ const packetResult = await relayTxAndWaitPacket(
9458
+ txResult.value,
9459
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
9460
+ spokeProvider,
9461
+ this.config.relayerApiEndpoint,
9462
+ timeout
9463
+ );
9464
+ if (!packetResult.ok) {
9465
+ return {
9466
+ ok: false,
9467
+ error: {
9468
+ code: packetResult.error.code,
9469
+ data: {
9470
+ error: packetResult.error,
9471
+ payload: txResult.value
9472
+ }
9457
9473
  }
9458
- }
9459
- };
9474
+ };
9475
+ }
9476
+ intentTxHash = packetResult.value.dst_tx_hash;
9477
+ } else {
9478
+ intentTxHash = txResult.value;
9460
9479
  }
9461
- return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
9480
+ return { ok: true, value: [txResult.value, intentTxHash] };
9462
9481
  } catch (error) {
9463
9482
  return {
9464
9483
  ok: false,
@@ -9513,12 +9532,11 @@ var MoneyMarketService = class _MoneyMarketService {
9513
9532
  isMoneyMarketSupportedToken(spokeProvider.chainConfig.chain.id, params.token),
9514
9533
  `Unsupported spoke chain (${spokeProvider.chainConfig.chain.id}) token: ${params.token}`
9515
9534
  );
9516
- const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
9535
+ const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
9517
9536
  const hubWallet = await WalletAbstractionService.getUserHubWalletAddress(
9518
- spokeProvider.chainConfig.chain.id,
9519
- walletAddressBytes,
9520
- this.hubProvider,
9521
- spokeProvider
9537
+ walletAddress,
9538
+ spokeProvider,
9539
+ this.hubProvider
9522
9540
  );
9523
9541
  const data = this.buildSupplyData(
9524
9542
  params.token,
@@ -9526,7 +9544,6 @@ var MoneyMarketService = class _MoneyMarketService {
9526
9544
  params.amount,
9527
9545
  spokeProvider.chainConfig.chain.id
9528
9546
  );
9529
- const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
9530
9547
  const txResult = await SpokeService.deposit(
9531
9548
  {
9532
9549
  from: walletAddress,
@@ -9593,26 +9610,32 @@ var MoneyMarketService = class _MoneyMarketService {
9593
9610
  if (!txResult.ok) {
9594
9611
  return txResult;
9595
9612
  }
9596
- const packetResult = await relayTxAndWaitPacket(
9597
- txResult.value,
9598
- spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
9599
- spokeProvider,
9600
- this.config.relayerApiEndpoint,
9601
- timeout
9602
- );
9603
- if (!packetResult.ok) {
9604
- return {
9605
- ok: false,
9606
- error: {
9607
- code: packetResult.error.code,
9608
- data: {
9609
- error: packetResult.error,
9610
- payload: txResult.value
9613
+ let intentTxHash = null;
9614
+ if (spokeProvider.chainConfig.chain.id !== types.SONIC_MAINNET_CHAIN_ID) {
9615
+ const packetResult = await relayTxAndWaitPacket(
9616
+ txResult.value,
9617
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
9618
+ spokeProvider,
9619
+ this.config.relayerApiEndpoint,
9620
+ timeout
9621
+ );
9622
+ if (!packetResult.ok) {
9623
+ return {
9624
+ ok: false,
9625
+ error: {
9626
+ code: packetResult.error.code,
9627
+ data: {
9628
+ error: packetResult.error,
9629
+ payload: txResult.value
9630
+ }
9611
9631
  }
9612
- }
9613
- };
9632
+ };
9633
+ }
9634
+ intentTxHash = packetResult.value.dst_tx_hash;
9635
+ } else {
9636
+ intentTxHash = txResult.value;
9614
9637
  }
9615
- return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
9638
+ return { ok: true, value: [txResult.value, intentTxHash] };
9616
9639
  } catch (error) {
9617
9640
  return {
9618
9641
  ok: false,
@@ -9664,16 +9687,16 @@ var MoneyMarketService = class _MoneyMarketService {
9664
9687
  isMoneyMarketSupportedToken(spokeProvider.chainConfig.chain.id, params.token),
9665
9688
  `Unsupported spoke chain (${spokeProvider.chainConfig.chain.id}) token: ${params.token}`
9666
9689
  );
9667
- const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
9690
+ const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
9691
+ const encodedAddress = encodeAddress(spokeProvider.chainConfig.chain.id, walletAddress);
9668
9692
  const hubWallet = await WalletAbstractionService.getUserHubWalletAddress(
9669
- spokeProvider.chainConfig.chain.id,
9670
- walletAddressBytes,
9671
- this.hubProvider,
9672
- spokeProvider
9693
+ walletAddress,
9694
+ spokeProvider,
9695
+ this.hubProvider
9673
9696
  );
9674
9697
  const data = this.buildBorrowData(
9675
9698
  hubWallet,
9676
- walletAddressBytes,
9699
+ encodedAddress,
9677
9700
  params.token,
9678
9701
  params.amount,
9679
9702
  spokeProvider.chainConfig.chain.id
@@ -9722,26 +9745,32 @@ var MoneyMarketService = class _MoneyMarketService {
9722
9745
  if (!txResult.ok) {
9723
9746
  return txResult;
9724
9747
  }
9725
- const packetResult = await relayTxAndWaitPacket(
9726
- txResult.value,
9727
- spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
9728
- spokeProvider,
9729
- this.config.relayerApiEndpoint,
9730
- timeout
9731
- );
9732
- if (!packetResult.ok) {
9733
- return {
9734
- ok: false,
9735
- error: {
9736
- code: packetResult.error.code,
9737
- data: {
9738
- error: packetResult.error,
9739
- payload: txResult.value
9748
+ let intentTxHash = null;
9749
+ if (spokeProvider.chainConfig.chain.id !== types.SONIC_MAINNET_CHAIN_ID) {
9750
+ const packetResult = await relayTxAndWaitPacket(
9751
+ txResult.value,
9752
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
9753
+ spokeProvider,
9754
+ this.config.relayerApiEndpoint,
9755
+ timeout
9756
+ );
9757
+ if (!packetResult.ok) {
9758
+ return {
9759
+ ok: false,
9760
+ error: {
9761
+ code: packetResult.error.code,
9762
+ data: {
9763
+ error: packetResult.error,
9764
+ payload: txResult.value
9765
+ }
9740
9766
  }
9741
- }
9742
- };
9767
+ };
9768
+ }
9769
+ intentTxHash = packetResult.value.dst_tx_hash;
9770
+ } else {
9771
+ intentTxHash = txResult.value;
9743
9772
  }
9744
- return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
9773
+ return { ok: true, value: [txResult.value, intentTxHash] };
9745
9774
  } catch (error) {
9746
9775
  return {
9747
9776
  ok: false,
@@ -9793,16 +9822,16 @@ var MoneyMarketService = class _MoneyMarketService {
9793
9822
  isMoneyMarketSupportedToken(spokeProvider.chainConfig.chain.id, params.token),
9794
9823
  `Unsupported spoke chain (${spokeProvider.chainConfig.chain.id}) token: ${params.token}`
9795
9824
  );
9796
- const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
9825
+ const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
9826
+ const encodedAddress = encodeAddress(spokeProvider.chainConfig.chain.id, walletAddress);
9797
9827
  const hubWallet = await WalletAbstractionService.getUserHubWalletAddress(
9798
- spokeProvider.chainConfig.chain.id,
9799
- walletAddressBytes,
9800
- this.hubProvider,
9801
- spokeProvider
9828
+ walletAddress,
9829
+ spokeProvider,
9830
+ this.hubProvider
9802
9831
  );
9803
9832
  const data = this.buildWithdrawData(
9804
9833
  hubWallet,
9805
- walletAddressBytes,
9834
+ encodedAddress,
9806
9835
  params.token,
9807
9836
  params.amount,
9808
9837
  spokeProvider.chainConfig.chain.id
@@ -9851,26 +9880,32 @@ var MoneyMarketService = class _MoneyMarketService {
9851
9880
  if (!txResult.ok) {
9852
9881
  return txResult;
9853
9882
  }
9854
- const packetResult = await relayTxAndWaitPacket(
9855
- txResult.value,
9856
- spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
9857
- spokeProvider,
9858
- this.config.relayerApiEndpoint,
9859
- timeout
9860
- );
9861
- if (!packetResult.ok) {
9862
- return {
9863
- ok: false,
9864
- error: {
9865
- code: packetResult.error.code,
9866
- data: {
9867
- error: packetResult.error,
9868
- payload: txResult.value
9883
+ let intentTxHash = null;
9884
+ if (spokeProvider.chainConfig.chain.id !== types.SONIC_MAINNET_CHAIN_ID) {
9885
+ const packetResult = await relayTxAndWaitPacket(
9886
+ txResult.value,
9887
+ spokeProvider instanceof SolanaSpokeProvider ? txResult.data : void 0,
9888
+ spokeProvider,
9889
+ this.config.relayerApiEndpoint,
9890
+ timeout
9891
+ );
9892
+ if (!packetResult.ok) {
9893
+ return {
9894
+ ok: false,
9895
+ error: {
9896
+ code: packetResult.error.code,
9897
+ data: {
9898
+ error: packetResult.error,
9899
+ payload: txResult.value
9900
+ }
9869
9901
  }
9870
- }
9871
- };
9902
+ };
9903
+ }
9904
+ intentTxHash = packetResult.value.dst_tx_hash;
9905
+ } else {
9906
+ intentTxHash = txResult.value;
9872
9907
  }
9873
- return { ok: true, value: [txResult.value, packetResult.value.dst_tx_hash] };
9908
+ return { ok: true, value: [txResult.value, intentTxHash] };
9874
9909
  } catch (error) {
9875
9910
  return {
9876
9911
  ok: false,
@@ -9924,15 +9959,13 @@ var MoneyMarketService = class _MoneyMarketService {
9924
9959
  isMoneyMarketSupportedToken(spokeProvider.chainConfig.chain.id, params.token),
9925
9960
  `Unsupported spoke chain (${spokeProvider.chainConfig.chain.id}) token: ${params.token}`
9926
9961
  );
9927
- const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
9962
+ const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
9928
9963
  const hubWallet = await WalletAbstractionService.getUserHubWalletAddress(
9929
- spokeProvider.chainConfig.chain.id,
9930
- walletAddressBytes,
9931
- this.hubProvider,
9932
- spokeProvider
9964
+ walletAddress,
9965
+ spokeProvider,
9966
+ this.hubProvider
9933
9967
  );
9934
9968
  const data = this.buildRepayData(params.token, hubWallet, params.amount, spokeProvider.chainConfig.chain.id);
9935
- const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
9936
9969
  const txResult = await SpokeService.deposit(
9937
9970
  {
9938
9971
  from: walletAddress,
@@ -12531,7 +12564,7 @@ var SolverService = class {
12531
12564
  * @param {CreateIntentParams} payload - The intent to create
12532
12565
  * @param {ISpokeProvider} spokeProvider - The spoke provider
12533
12566
  * @param {number} timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
12534
- * @returns {Promise<Result<[SolverExecutionResponse, Intent, PacketData], IntentError<IntentErrorCode>>>} The solver execution response, intent, and packet data
12567
+ * @returns {Promise<Result<[SolverExecutionResponse, Intent, Hex], IntentError<IntentErrorCode>>>} The solver execution response, intent, and packet data
12535
12568
  *
12536
12569
  * @example
12537
12570
  * const payload = {
@@ -12567,42 +12600,48 @@ var SolverService = class {
12567
12600
  return createIntentResult;
12568
12601
  }
12569
12602
  const [spokeTxHash, intent, data] = createIntentResult.value;
12570
- const intentRelayChainId = getIntentRelayChainId(payload.srcChain).toString();
12571
- const submitPayload = payload.srcChain === types.SOLANA_MAINNET_CHAIN_ID && data ? {
12572
- action: "submit",
12573
- params: {
12574
- chain_id: intentRelayChainId,
12575
- tx_hash: spokeTxHash,
12576
- data: {
12577
- address: intent.creator,
12578
- payload: data
12603
+ let intentTxHash = null;
12604
+ if (spokeProvider.chainConfig.chain.id !== types.SONIC_MAINNET_CHAIN_ID) {
12605
+ const intentRelayChainId = getIntentRelayChainId(payload.srcChain).toString();
12606
+ const submitPayload = payload.srcChain === types.SOLANA_MAINNET_CHAIN_ID && data ? {
12607
+ action: "submit",
12608
+ params: {
12609
+ chain_id: intentRelayChainId,
12610
+ tx_hash: spokeTxHash,
12611
+ data: {
12612
+ address: intent.creator,
12613
+ payload: data
12614
+ }
12579
12615
  }
12616
+ } : {
12617
+ action: "submit",
12618
+ params: {
12619
+ chain_id: intentRelayChainId,
12620
+ tx_hash: spokeTxHash
12621
+ }
12622
+ };
12623
+ const submitResult = await this.submitIntent(submitPayload);
12624
+ if (!submitResult.ok) {
12625
+ return submitResult;
12580
12626
  }
12581
- } : {
12582
- action: "submit",
12583
- params: {
12584
- chain_id: intentRelayChainId,
12585
- tx_hash: spokeTxHash
12627
+ const packet = await waitUntilIntentExecuted({
12628
+ intentRelayChainId,
12629
+ spokeTxHash,
12630
+ timeout,
12631
+ apiUrl: this.config.relayerApiEndpoint
12632
+ });
12633
+ if (!packet.ok) {
12634
+ return {
12635
+ ok: false,
12636
+ error: packet.error
12637
+ };
12586
12638
  }
12587
- };
12588
- const submitResult = await this.submitIntent(submitPayload);
12589
- if (!submitResult.ok) {
12590
- return submitResult;
12591
- }
12592
- const packet = await waitUntilIntentExecuted({
12593
- intentRelayChainId,
12594
- spokeTxHash,
12595
- timeout,
12596
- apiUrl: this.config.relayerApiEndpoint
12597
- });
12598
- if (!packet.ok) {
12599
- return {
12600
- ok: false,
12601
- error: packet.error
12602
- };
12639
+ intentTxHash = packet.value.dst_tx_hash;
12640
+ } else {
12641
+ intentTxHash = spokeTxHash;
12603
12642
  }
12604
12643
  const result = await this.postExecution({
12605
- intent_tx_hash: packet.value.dst_tx_hash
12644
+ intent_tx_hash: intentTxHash
12606
12645
  });
12607
12646
  if (!result.ok) {
12608
12647
  return {
@@ -12615,7 +12654,7 @@ var SolverService = class {
12615
12654
  }
12616
12655
  return {
12617
12656
  ok: true,
12618
- value: [result.value, intent, packet.value]
12657
+ value: [result.value, intent, intentTxHash]
12619
12658
  };
12620
12659
  } catch (error) {
12621
12660
  return {
@@ -12785,12 +12824,7 @@ var SolverService = class {
12785
12824
  "srcAddress must be the same as wallet address"
12786
12825
  );
12787
12826
  const walletAddressBytes = encodeAddress(params.srcChain, walletAddress);
12788
- const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(
12789
- params.srcChain,
12790
- walletAddressBytes,
12791
- this.hubProvider,
12792
- spokeProvider
12793
- );
12827
+ const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(walletAddress, spokeProvider, this.hubProvider);
12794
12828
  const [data, intent, feeAmount] = EvmSolverService.constructCreateIntentData(
12795
12829
  {
12796
12830
  ...params,
@@ -12840,13 +12874,9 @@ var SolverService = class {
12840
12874
  try {
12841
12875
  invariant2__default.default(isValidIntentRelayChainId(intent.srcChain), `Invalid intent.srcChain: ${intent.srcChain}`);
12842
12876
  invariant2__default.default(isValidIntentRelayChainId(intent.dstChain), `Invalid intent.dstChain: ${intent.dstChain}`);
12843
- const walletAddressBytes = await spokeProvider.walletProvider.getWalletAddressBytes();
12844
- const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(
12845
- spokeProvider.chainConfig.chain.id,
12846
- walletAddressBytes,
12847
- this.hubProvider,
12848
- spokeProvider
12849
- );
12877
+ const walletAddress = await spokeProvider.walletProvider.getWalletAddress();
12878
+ const walletAddressBytes = encodeAddress(spokeProvider.chainConfig.chain.id, walletAddress);
12879
+ const creatorHubWalletAddress = spokeProvider.chainConfig.chain.id === this.hubProvider.chainConfig.chain.id ? walletAddressBytes : await WalletAbstractionService.getUserHubWalletAddress(walletAddress, spokeProvider, this.hubProvider);
12850
12880
  const calls = [];
12851
12881
  const intentsContract = this.config.intentsContract;
12852
12882
  calls.push(EvmSolverService.encodeCancelIntent(intent, intentsContract));
@@ -14568,6 +14598,7 @@ var SolverIntentErrorCode = /* @__PURE__ */ ((SolverIntentErrorCode2) => {
14568
14598
  exports.BalnSwapService = BalnSwapService;
14569
14599
  exports.BigIntToHex = BigIntToHex;
14570
14600
  exports.BnUSDMigrationService = BnUSDMigrationService;
14601
+ exports.ChainIdToIntentRelayChainId = ChainIdToIntentRelayChainId;
14571
14602
  exports.DEFAULT_MAX_RETRY = DEFAULT_MAX_RETRY;
14572
14603
  exports.DEFAULT_RELAYER_API_ENDPOINT = DEFAULT_RELAYER_API_ENDPOINT;
14573
14604
  exports.DEFAULT_RELAY_TX_TIMEOUT = DEFAULT_RELAY_TX_TIMEOUT;