@sodax/sdk 1.1.0-beta-rc2 → 1.1.0-beta

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
@@ -7,21 +7,21 @@ The Sodax SDK provides a comprehensive interface for interacting with the Sodax
7
7
  ### Features
8
8
 
9
9
  - [Swaps (Solver / Intents)](./docs/SWAPS.md) - Cross-chain intent-based swaps
10
- - EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, Lightlink, Kaia) ✅
10
+ - EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, Lightlink, Ethereum, Redbelly, Kaia) ✅
11
11
  - Sui ✅
12
12
  - Stellar ✅
13
13
  - ICON ✅
14
14
  - Solana ✅
15
15
  - Injective ✅
16
16
  - [Money Market](./docs/MONEY_MARKET.md) - Cross-chain lending and borrowing
17
- - EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, Lightlink, Kaia) ✅
17
+ - EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, Lightlink, Ethereum, Redbelly, Kaia) ✅
18
18
  - Sui ✅
19
19
  - Stellar ✅
20
20
  - ICON ✅
21
21
  - Solana ✅
22
22
  - Injective ✅
23
23
  - [Bridge](./docs/BRIDGE.md) - Cross-chain token bridging
24
- - EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, Lightlink, Kaia) ✅
24
+ - EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, Lightlink, Ethereum, Redbelly, Kaia) ✅
25
25
  - Sui ✅
26
26
  - Stellar ✅
27
27
  - ICON ✅
@@ -29,7 +29,7 @@ The Sodax SDK provides a comprehensive interface for interacting with the Sodax
29
29
  - Injective ✅
30
30
  - [Migration](./docs/MIGRATION.md) - Token migration (ICX, bnUSD, BALN)
31
31
  - [Staking](./docs/STAKING.md) - SODA token staking
32
- - EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, Lightlink, Kaia) ✅
32
+ - EVM (Arbitrum, Avalanche, Base, BSC, Optimism, Polygon, Sonic, HyperEVM, Lightlink, Ethereum, Redbelly, Kaia) ✅
33
33
  - Sui ✅
34
34
  - Stellar ✅
35
35
  - ICON ✅
package/dist/index.cjs CHANGED
@@ -6826,6 +6826,8 @@ function getEvmViemChain(id) {
6826
6826
  return chains.lightlinkPhoenix;
6827
6827
  case types.ETHEREUM_MAINNET_CHAIN_ID:
6828
6828
  return chains.mainnet;
6829
+ case types.REDBELLY_MAINNET_CHAIN_ID:
6830
+ return chains.redbellyMainnet;
6829
6831
  case types.KAIA_MAINNET_CHAIN_ID:
6830
6832
  return chains.kaia;
6831
6833
  default:
@@ -13423,6 +13425,27 @@ var SwapService = class {
13423
13425
  };
13424
13426
  }
13425
13427
  }
13428
+ /**
13429
+ * Gets the submit tx extra data for an intent
13430
+ * NOTE: Currently this is only required when source chain is Solana
13431
+ * @param {GetIntentSubmitTxExtraDataParams} params - The txHash or intent parameters
13432
+ * @param {Hash} params.txHash - The transaction hash on Hub chain
13433
+ * @param {Intent} params.intent - The intent
13434
+ * @returns {Promise<SubmitTxExtraData>} The submit tx extra data
13435
+ */
13436
+ async getIntentSubmitTxExtraData(params) {
13437
+ let intent;
13438
+ if ("txHash" in params) {
13439
+ intent = await this.getIntent(params.txHash);
13440
+ } else {
13441
+ intent = params.intent;
13442
+ }
13443
+ const txData = EvmSolverService.encodeCreateIntent(intent, this.config.intentsContract);
13444
+ return {
13445
+ address: intent.creator,
13446
+ payload: txData.data
13447
+ };
13448
+ }
13426
13449
  /**
13427
13450
  * Gets an intent from a transaction hash (on Hub chain)
13428
13451
  * @param {Hash} txHash - The transaction hash on Hub chain
@@ -15764,7 +15787,7 @@ function isSolanaRawSpokeProvider(value) {
15764
15787
  return isRawSpokeProvider(value) && value.chainConfig.chain.type === "SOLANA";
15765
15788
  }
15766
15789
  function isStellarRawSpokeProvider(value) {
15767
- return isRawSpokeProvider(value) && value.chainConfig.chain.type === "STELLAR" && "baseProvider" in value;
15790
+ return isRawSpokeProvider(value) && value.chainConfig.chain.type === "STELLAR";
15768
15791
  }
15769
15792
  function isIconRawSpokeProvider(value) {
15770
15793
  return isRawSpokeProvider(value) && value.chainConfig.chain.type === "ICON";
@@ -15834,13 +15857,10 @@ function calculateFeeAmount(inputAmount, fee) {
15834
15857
  }
15835
15858
  function adjustAmountByFee(amount, fee, quoteType) {
15836
15859
  invariant6__default.default(amount > 0n, "Amount must be greater than 0");
15837
- invariant6__default.default(quoteType === "exact_input" || quoteType === "exact_output", "Invalid quote type");
15860
+ invariant6__default.default(quoteType === "exact_input", "Invalid quote type");
15838
15861
  if (quoteType === "exact_input") {
15839
15862
  return amount - calculateFeeAmount(amount, fee);
15840
15863
  }
15841
- if (quoteType === "exact_output") {
15842
- return amount + calculateFeeAmount(amount, fee);
15843
- }
15844
15864
  throw new Error("Invalid quote type");
15845
15865
  }
15846
15866
  function BigIntToHex(value) {