@sodax/sdk 0.0.1-rc.40 → 0.0.1-rc.42

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/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { SONIC_MAINNET_CHAIN_ID, CHAIN_IDS, ICON_MAINNET_CHAIN_ID, SUI_MAINNET_C
4
4
  export * from '@sodax/types';
5
5
  import { ChainGrpcWasmApi, TxGrpcApi, toBase64, fromBase64 } from '@injectivelabs/sdk-ts';
6
6
  import { getNetworkEndpoints, Network } from '@injectivelabs/networks';
7
- import { IconService, CallBuilder, Converter, CallTransactionBuilder } from 'icon-sdk-js';
7
+ import * as IconSdkRaw from 'icon-sdk-js';
8
8
  import { SorobanRpc, Account, Horizon, Contract, TransactionBuilder, BASE_FEE, nativeToScVal, TimeoutInfinite, rpc, scValToBigInt, Operation, Address, Asset, FeeBumpTransaction } from '@stellar/stellar-sdk';
9
9
  import { bcs } from '@mysten/sui/bcs';
10
10
  import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
@@ -8713,6 +8713,7 @@ var InjectiveSpokeProvider = class {
8713
8713
  return num.toString();
8714
8714
  }
8715
8715
  };
8716
+ var IconSdk = "default" in IconSdkRaw.default ? IconSdkRaw.default : IconSdkRaw;
8716
8717
  var IconSpokeProvider = class {
8717
8718
  walletProvider;
8718
8719
  chainConfig;
@@ -8721,7 +8722,7 @@ var IconSpokeProvider = class {
8721
8722
  constructor(walletProvider, chainConfig, rpcUrl = "https://ctz.solidwallet.io/api/v3", debugRpcUrl = "https://ctz.solidwallet.io/api/v3d") {
8722
8723
  this.walletProvider = walletProvider;
8723
8724
  this.chainConfig = chainConfig;
8724
- this.iconService = new IconService(new IconService.HttpProvider(rpcUrl));
8725
+ this.iconService = new IconSdk.IconService(new IconSdk.IconService.HttpProvider(rpcUrl));
8725
8726
  this.debugRpcUrl = debugRpcUrl;
8726
8727
  }
8727
8728
  };
@@ -8979,12 +8980,8 @@ var StellarSpokeProvider = class {
8979
8980
  }
8980
8981
  handleSendTransactionError(response) {
8981
8982
  if (response.status === "ERROR") {
8982
- throw new Error(
8983
- `Transaction failed: status: ${response.status}, hash: ${response.hash}, errorResult: ${JSON.stringify({
8984
- name: response?.errorResult?.result()?.switch()?.name ?? "unknown",
8985
- value: response?.errorResult?.result()?.switch()?.value ?? "unknown"
8986
- })}, diagnosticEvents: ${JSON.stringify(response?.diagnosticEvents ?? "{}")}`
8987
- );
8983
+ console.error(JSON.stringify(response, null, 2));
8984
+ throw new Error(JSON.stringify(response, null, 2));
8988
8985
  }
8989
8986
  return response;
8990
8987
  }
@@ -9100,13 +9097,14 @@ var StellarSpokeProvider = class {
9100
9097
  const accountResponse = await this.server.loadAccount(walletAddress);
9101
9098
  const stellarAccount = new CustomStellarAccount(accountResponse);
9102
9099
  const sendMessageCall = this.buildSendMessageCall(walletAddress, dst_chain_id, dst_address, payload);
9103
- const [priorityTx, simulation] = await this.buildPriorityStellarTransaction(
9100
+ const [rawPriorityTx, simulation] = await this.buildPriorityStellarTransaction(
9104
9101
  stellarAccount,
9105
9102
  network,
9106
9103
  sendMessageCall
9107
9104
  );
9105
+ const assembledPriorityTx = SorobanRpc.assembleTransaction(rawPriorityTx, simulation).build();
9108
9106
  if (raw) {
9109
- const transactionXdr = priorityTx.toXDR();
9107
+ const transactionXdr = rawPriorityTx.toXDR();
9110
9108
  return {
9111
9109
  from: walletAddress,
9112
9110
  to: this.chainConfig.addresses.assetManager,
@@ -9114,7 +9112,13 @@ var StellarSpokeProvider = class {
9114
9112
  data: transactionXdr
9115
9113
  };
9116
9114
  }
9117
- const hash = await this.submitOrRestoreAndRetry(stellarAccount, network, priorityTx, sendMessageCall, simulation);
9115
+ const hash = await this.submitOrRestoreAndRetry(
9116
+ stellarAccount,
9117
+ network,
9118
+ assembledPriorityTx,
9119
+ sendMessageCall,
9120
+ simulation
9121
+ );
9118
9122
  return `${hash}`;
9119
9123
  } catch (error) {
9120
9124
  console.error("Error during sendMessage:", error);
@@ -10316,6 +10320,8 @@ async function estimateStepCost(rawTx, debugRpcUrl) {
10316
10320
  }
10317
10321
 
10318
10322
  // src/services/spoke/IconSpokeService.ts
10323
+ var IconSdk2 = "default" in IconSdkRaw.default ? IconSdkRaw.default : IconSdkRaw;
10324
+ var { Converter, CallTransactionBuilder, CallBuilder } = IconSdk2;
10319
10325
  var IconSpokeService = class _IconSpokeService {
10320
10326
  constructor() {
10321
10327
  }
@@ -11775,7 +11781,7 @@ var SpokeService = class _SpokeService {
11775
11781
  }
11776
11782
  if (isEvmSpokeProvider(spokeProvider)) {
11777
11783
  await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
11778
- return await EvmSpokeService.callWallet(from, payload, spokeProvider, hubProvider);
11784
+ return await EvmSpokeService.callWallet(from, payload, spokeProvider, hubProvider, raw);
11779
11785
  }
11780
11786
  if (isInjectiveSpokeProvider(spokeProvider)) {
11781
11787
  await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
@@ -11807,7 +11813,13 @@ var SpokeService = class _SpokeService {
11807
11813
  }
11808
11814
  if (isStellarSpokeProvider(spokeProvider)) {
11809
11815
  await _SpokeService.verifySimulation(from, payload, spokeProvider, hubProvider, skipSimulation);
11810
- return await StellarSpokeService.callWallet(from, payload, spokeProvider, hubProvider);
11816
+ return await StellarSpokeService.callWallet(
11817
+ from,
11818
+ payload,
11819
+ spokeProvider,
11820
+ hubProvider,
11821
+ raw
11822
+ );
11811
11823
  }
11812
11824
  throw new Error("Invalid spoke provider");
11813
11825
  }