@sodax/sdk 2.0.0-rc.4 → 2.0.0-rc.6

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.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
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');
@@ -3225,6 +3224,7 @@ var moneyMarketSupportedTokens = {
3225
3224
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.bnUSD,
3226
3225
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.SODA,
3227
3226
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.weETH,
3227
+ spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.USDC,
3228
3228
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.USDT
3229
3229
  ],
3230
3230
  [ChainKeys.HYPEREVM_MAINNET]: [
@@ -3240,6 +3240,7 @@ var moneyMarketSupportedTokens = {
3240
3240
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens.USDC,
3241
3241
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["AVAX.LL"],
3242
3242
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["BNB.LL"],
3243
+ spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["BTC.LL"],
3243
3244
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["SOL.LL"],
3244
3245
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["XLM.LL"],
3245
3246
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["INJ.LL"],
@@ -3307,7 +3308,8 @@ var moneyMarketSupportedTokens = {
3307
3308
  spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.weETH,
3308
3309
  spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.wstETH,
3309
3310
  spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.USDT,
3310
- spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.WBTC
3311
+ spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.WBTC,
3312
+ spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.LL
3311
3313
  ],
3312
3314
  [ChainKeys.REDBELLY_MAINNET]: [
3313
3315
  spokeChainConfig[ChainKeys.REDBELLY_MAINNET].supportedTokens.bnUSD,
@@ -3897,7 +3899,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
3897
3899
  }
3898
3900
 
3899
3901
  // ../types/dist/index.js
3900
- var CONFIG_VERSION = 202;
3902
+ var CONFIG_VERSION = 204;
3901
3903
  function isEvmSpokeChainConfig(value) {
3902
3904
  return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
3903
3905
  }
@@ -4107,7 +4109,7 @@ function encodeAddress(spokeChainId, address) {
4107
4109
  case "STELLAR":
4108
4110
  return `0x${stellarSdk.Address.fromString(address).toScVal().toXDR("hex")}`;
4109
4111
  case "STACKS":
4110
- return `0x${transactions.serializeCV(transactions.Cl.principal(address))}`;
4112
+ return `0x${core.serializeCV(core.Cl.principal(address))}`;
4111
4113
  case "BITCOIN":
4112
4114
  case "NEAR":
4113
4115
  case "INJECTIVE":
@@ -4151,8 +4153,8 @@ function reverseEncodeAddress(spokeChainId, encoded) {
4151
4153
  }
4152
4154
  case "STACKS": {
4153
4155
  const rawHex = encoded.startsWith("0x") ? encoded.slice(2) : encoded;
4154
- const cv = transactions.deserializeCV(viem.hexToBytes(`0x${rawHex}`));
4155
- return transactions.cvToString(cv);
4156
+ const cv = core.deserializeCV(viem.hexToBytes(`0x${rawHex}`));
4157
+ return core.cvToString(cv);
4156
4158
  }
4157
4159
  case "BITCOIN":
4158
4160
  case "NEAR":
@@ -13454,7 +13456,7 @@ async function waitForStacksTransaction(txid, rpc_url) {
13454
13456
  return false;
13455
13457
  }
13456
13458
  function serializeAddressData(address) {
13457
- return `0x${transactions.serializeCV(transactions.Cl.principal(address))}`;
13459
+ return `0x${core.serializeCV(core.Cl.principal(address))}`;
13458
13460
  }
13459
13461
  async function sleep2(s) {
13460
13462
  return new Promise((resolve) => {
@@ -14149,12 +14151,12 @@ var StacksSpokeService = class {
14149
14151
  constructor(config) {
14150
14152
  this.config = config;
14151
14153
  const chainConfig = config.getChainConfig(ChainKeys.STACKS_MAINNET);
14152
- this.network = network.createNetwork({ network: "mainnet", client: { baseUrl: chainConfig.rpcUrl } });
14154
+ this.network = core.createNetwork({ network: "mainnet", client: { baseUrl: chainConfig.rpcUrl } });
14153
14155
  this.pollingIntervalMs = chainConfig.pollingConfig.pollingIntervalMs;
14154
14156
  this.maxTimeoutMs = chainConfig.pollingConfig.maxTimeoutMs;
14155
14157
  }
14156
14158
  async estimateGas(params) {
14157
- const [low, medium, high] = await transactions.fetchFeeEstimateTransaction({
14159
+ const [low, medium, high] = await core.fetchFeeEstimateTransaction({
14158
14160
  payload: params.tx.payload,
14159
14161
  estimatedLength: params.tx.estimatedLength,
14160
14162
  network: this.network
@@ -14162,7 +14164,7 @@ var StacksSpokeService = class {
14162
14164
  return { low, medium, high };
14163
14165
  }
14164
14166
  async readContract(sender, txParams) {
14165
- return transactions.fetchCallReadOnlyFunction({
14167
+ return core.fetchCallReadOnlyFunction({
14166
14168
  contractAddress: txParams.contractAddress,
14167
14169
  contractName: txParams.contractName,
14168
14170
  functionName: txParams.functionName,
@@ -14181,19 +14183,19 @@ var StacksSpokeService = class {
14181
14183
  return BigInt(data.stx.balance);
14182
14184
  }
14183
14185
  async readTokenBalance(token, address) {
14184
- const [contractAddress, contractName] = transactions.parseContractId(token);
14185
- const result = await transactions.fetchCallReadOnlyFunction({
14186
+ const [contractAddress, contractName] = core.parseContractId(token);
14187
+ const result = await core.fetchCallReadOnlyFunction({
14186
14188
  contractAddress,
14187
14189
  contractName,
14188
14190
  functionName: "get-balance",
14189
- functionArgs: [transactions.Cl.principal(address)],
14191
+ functionArgs: [core.Cl.principal(address)],
14190
14192
  network: this.network,
14191
14193
  senderAddress: address
14192
14194
  });
14193
14195
  return result.value.value;
14194
14196
  }
14195
14197
  async getImplContractAddress(stateContract) {
14196
- const [contractAddress, contractName] = transactions.parseContractId(stateContract);
14198
+ const [contractAddress, contractName] = core.parseContractId(stateContract);
14197
14199
  const txParams = {
14198
14200
  contractAddress,
14199
14201
  contractName,
@@ -14212,26 +14214,26 @@ var StacksSpokeService = class {
14212
14214
  async deposit(params) {
14213
14215
  const chainConfig = this.config.getChainConfig(params.srcChainKey);
14214
14216
  const assetManagerImpl = await this.getImplContractAddress(chainConfig.addresses.assetManager);
14215
- const [implAddress, implName] = transactions.parseContractId(assetManagerImpl);
14216
- const [connectionAddress, connectionName] = transactions.parseContractId(chainConfig.addresses.connection);
14217
+ const [implAddress, implName] = core.parseContractId(assetManagerImpl);
14218
+ const [connectionAddress, connectionName] = core.parseContractId(chainConfig.addresses.connection);
14217
14219
  const reqData = {
14218
14220
  contractAddress: implAddress,
14219
14221
  contractName: implName,
14220
14222
  functionName: "transfer",
14221
14223
  functionArgs: [
14222
- isNativeToken(params.srcChainKey, params.token) ? transactions.noneCV() : transactions.someCV(transactions.Cl.principal(params.token)),
14223
- transactions.Cl.bufferFromHex(params.to),
14224
- transactions.uintCV(params.amount),
14225
- transactions.Cl.bufferFromHex(params.data),
14226
- transactions.Cl.contractPrincipal(connectionAddress, connectionName)
14224
+ isNativeToken(params.srcChainKey, params.token) ? core.noneCV() : core.someCV(core.Cl.principal(params.token)),
14225
+ core.Cl.bufferFromHex(params.to),
14226
+ core.uintCV(params.amount),
14227
+ core.Cl.bufferFromHex(params.data),
14228
+ core.Cl.contractPrincipal(connectionAddress, connectionName)
14227
14229
  ],
14228
- postConditionMode: transactions.PostConditionMode.Allow
14230
+ postConditionMode: core.PostConditionMode.Allow
14229
14231
  };
14230
14232
  if (params.raw === true) {
14231
- if (transactions.validateStacksAddress(params.srcAddress)) {
14233
+ if (core.validateStacksAddress(params.srcAddress)) {
14232
14234
  throw new Error('When using raw transactions, the public key must be provided as "from" parameter');
14233
14235
  }
14234
- const tx = await transactions.makeUnsignedContractCall({
14236
+ const tx = await core.makeUnsignedContractCall({
14235
14237
  ...reqData,
14236
14238
  publicKey: params.srcAddress,
14237
14239
  network: this.network,
@@ -14240,7 +14242,7 @@ var StacksSpokeService = class {
14240
14242
  nonce: 0n
14241
14243
  });
14242
14244
  return {
14243
- payload: `0x${viem.bytesToHex(transactions.serializePayloadBytes(tx.payload))}`
14245
+ payload: viem.bytesToHex(core.serializePayloadBytes(tx.payload))
14244
14246
  };
14245
14247
  }
14246
14248
  const txId = await params.walletProvider.sendTransaction(reqData);
@@ -14263,18 +14265,18 @@ var StacksSpokeService = class {
14263
14265
  */
14264
14266
  async sendMessage(params) {
14265
14267
  const dstRelayChainId = getIntentRelayChainId(params.dstChainKey);
14266
- const [connectionAddress, connectionName] = transactions.parseContractId(
14268
+ const [connectionAddress, connectionName] = core.parseContractId(
14267
14269
  this.config.getChainConfig(params.srcChainKey).addresses.connection
14268
14270
  );
14269
14271
  const reqData = {
14270
14272
  contractAddress: connectionAddress,
14271
14273
  contractName: connectionName,
14272
14274
  functionName: "send-message",
14273
- functionArgs: [transactions.uintCV(dstRelayChainId), transactions.Cl.bufferFromHex(params.dstAddress), transactions.Cl.bufferFromHex(params.payload)],
14274
- postConditionMode: transactions.PostConditionMode.Allow
14275
+ functionArgs: [core.uintCV(dstRelayChainId), core.Cl.bufferFromHex(params.dstAddress), core.Cl.bufferFromHex(params.payload)],
14276
+ postConditionMode: core.PostConditionMode.Allow
14275
14277
  };
14276
14278
  if (params.raw === true) {
14277
- const tx = await transactions.makeUnsignedContractCall({
14279
+ const tx = await core.makeUnsignedContractCall({
14278
14280
  ...reqData,
14279
14281
  publicKey: params.srcAddress,
14280
14282
  network: this.network,
@@ -14283,7 +14285,7 @@ var StacksSpokeService = class {
14283
14285
  nonce: 0n
14284
14286
  });
14285
14287
  return {
14286
- payload: `0x${viem.bytesToHex(transactions.serializePayloadBytes(tx.payload))}`
14288
+ payload: viem.bytesToHex(core.serializePayloadBytes(tx.payload))
14287
14289
  };
14288
14290
  }
14289
14291
  const txId = await params.walletProvider.sendTransaction(reqData);
@@ -14366,7 +14368,7 @@ var RadfiProvider = class {
14366
14368
  if (!publicKey) {
14367
14369
  throw new Error("Failed to retrieve public key from wallet. Please unlock your wallet and try again.");
14368
14370
  }
14369
- const message = `Login to Radfi via Sodax: ${Date.now()}`;
14371
+ const message = `${Date.now()}`;
14370
14372
  const addressType = detectBitcoinAddressType(address);
14371
14373
  const signature = addressType === "P2WPKH" || addressType === "P2TR" ? await walletProvider.signBip322Message(message) : await walletProvider.signEcdsaMessage(message);
14372
14374
  const result = await this.authenticate({ message, signature, address, publicKey });
@@ -21895,7 +21897,7 @@ var SuiSpokeService = class {
21895
21897
  async deposit(params) {
21896
21898
  const { srcAddress: from, srcChainKey, token, to, amount, data = "0x" } = params;
21897
21899
  const isNative = isNativeToken(srcChainKey, token);
21898
- const tx = new transactions$1.Transaction();
21900
+ const tx = new transactions.Transaction();
21899
21901
  const coin = isNative ? await this.getNativeCoin(tx, amount) : await this.getCoin(tx, token, amount, from);
21900
21902
  const connection = this.splitAddress(this.config.getChainConfig(srcChainKey).addresses.connection);
21901
21903
  const assetManager = this.splitAddress(await this.getAssetManagerAddress(srcChainKey));
@@ -21929,7 +21931,7 @@ var SuiSpokeService = class {
21929
21931
  }
21930
21932
  async sendMessage(params) {
21931
21933
  const { srcAddress: from, srcChainKey, dstChainKey, dstAddress, payload } = params;
21932
- const txb = new transactions$1.Transaction();
21934
+ const txb = new transactions.Transaction();
21933
21935
  const connection = this.splitAddress(this.config.getChainConfig(srcChainKey).addresses.connection);
21934
21936
  const relayId = getIntentRelayChainId(dstChainKey);
21935
21937
  txb.moveCall({
@@ -21963,7 +21965,7 @@ var SuiSpokeService = class {
21963
21965
  * @returns {Promise<bigint>} The estimated computation cost.
21964
21966
  */
21965
21967
  async estimateGas({ tx }) {
21966
- const txb = transactions$1.Transaction.fromKind(tx.data);
21968
+ const txb = transactions.Transaction.fromKind(tx.data);
21967
21969
  const result = await this.publicClient.devInspectTransactionBlock({
21968
21970
  sender: tx.from,
21969
21971
  transactionBlock: txb
@@ -21977,7 +21979,7 @@ var SuiSpokeService = class {
21977
21979
  */
21978
21980
  async getDeposit(params) {
21979
21981
  const assetmanager = this.splitAddress(await this.getAssetManagerAddress(params.srcChainKey));
21980
- const tx = new transactions$1.Transaction();
21982
+ const tx = new transactions.Transaction();
21981
21983
  const result = await this.viewContract(
21982
21984
  tx,
21983
21985
  assetmanager.packageId,
package/dist/index.d.cts CHANGED
@@ -1,9 +1,8 @@
1
- import { IConfigApi, ApiConfig, Result, SubmitSwapTxRequest, SubmitSwapTxResponse, GetSubmitSwapTxStatusParams, SubmitSwapTxStatusResponse, Address, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, SpokeChainKey, GetSwapTokensByChainIdApiResponse, GetMoneyMarketTokensApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, SodaxConfig, XToken, OriginalAssetAddress, IntentRelayChainId, HubChainKey, HubConfig, PoolKey, SpokeChainConfig, RelayConfig, SolverConfig, SwapsConfig, BridgeConfig, MoneyMarketConfig, DexConfig, GetSpokeChainConfigType, EvmContractCall, Hex, IEvmWalletProvider, EvmRawTransactionReceipt, PartnerFee, QuoteType, EvmChainKey, DeepPartial, WalletProviderSlot, TxReturnType, ChainType, GetChainType, SolanaRawTransactionReceipt, StellarSorobanTransactionReceipt, IconTransactionResult, SuiRawTransactionReceipt, InjectiveRawTransactionReceipt, NearRawTransactionReceipt, StacksRawTransactionReceipt, BitcoinRawTransactionReceipt, GetAddressType, HubAddress, GetTokenAddressType, EvmSpokeOnlyChainKey, StellarChainKey, SonicChainKey, AssetInfo, TokenInfo, VaultReserves, StacksChainKey, FeeEstimateTransaction, StacksTransactionParams, RadfiConfig, IBitcoinWalletProvider, RadfiDepositTxResponse, BtcAddressType, BitcoinChainKey, HttpUrl, NearChainKey, FillData, NearRawTransaction, SuiPaginatedCoins, SuiChainKey, SuiExecutionResult, SuiGasEstimate, IStellarWalletProvider, StellarGasEstimate, SolanaChainKey, SolanaGasEstimate, SolanaBase58PublicKey, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaRpcResponseAndContext, SolanaTokenAmount, IconChainKey, IconGasEstimate, InjectiveChainKey, InjectiveGasEstimate, JsonObject, InjectiveRawTransaction, IInjectiveWalletProvider, InjectiveExecuteResponse, GetEstimateGasReturnType, IconAddress, EvmSpokeChainConfig, PartnerFeeAmount, PartnerFeePercentage, IWalletProvider, GetWalletProviderType, SolverIntentQuoteRequest, SolverIntentQuoteResponse, SolverErrorResponse, SolverIntentStatusRequest, SolverIntentStatusResponse, SolverExecutionRequest, SolverExecutionResponse, SpokeExecActionParams, FeeAmount, Hash as Hash$1, IcxTokenType, IconEoaAddress, IconContractAddress, BridgeLimit, UserUnstakeInfo, ConcentratedLiquidityConfig } from '@sodax/types';
1
+ import { IConfigApi, ApiConfig, Result, SubmitSwapTxRequest, SubmitSwapTxResponse, GetSubmitSwapTxStatusParams, SubmitSwapTxStatusResponse, Address, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, SpokeChainKey, GetSwapTokensByChainIdApiResponse, GetMoneyMarketTokensApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, SodaxConfig, XToken, OriginalAssetAddress, IntentRelayChainId, HubChainKey, HubConfig, PoolKey, SpokeChainConfig, RelayConfig, SolverConfig, SwapsConfig, BridgeConfig, MoneyMarketConfig, DexConfig, GetSpokeChainConfigType, EvmContractCall, Hex, IEvmWalletProvider, EvmRawTransactionReceipt, PartnerFee, QuoteType, EvmChainKey, DeepPartial, WalletProviderSlot, TxReturnType, ChainType, GetChainType, SolanaRawTransactionReceipt, StellarSorobanTransactionReceipt, IconTransactionResult, SuiRawTransactionReceipt, InjectiveRawTransactionReceipt, NearRawTransactionReceipt, StacksRawTransactionReceipt, BitcoinRawTransactionReceipt, GetAddressType, HubAddress, GetTokenAddressType, EvmSpokeOnlyChainKey, StellarChainKey, SonicChainKey, AssetInfo, TokenInfo, VaultReserves, StacksChainKey, FeeEstimateTransaction, StacksTransactionParams, RadfiConfig, IBitcoinWalletProvider, RadfiDepositTxResponse, BtcAddressType, BitcoinChainKey, HttpUrl, NearChainKey, FillData, NearRawTransaction, SuiPaginatedCoins, SuiChainKey, SuiExecutionResult, SuiGasEstimate, IStellarWalletProvider, StellarGasEstimate, SolanaChainKey, SolanaGasEstimate, SolanaBase58PublicKey, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaRpcResponseAndContext, SolanaTokenAmount, IconChainKey, IconGasEstimate, InjectiveChainKey, InjectiveGasEstimate, JsonObject, InjectiveRawTransaction, IInjectiveWalletProvider, InjectiveExecuteResponse, GetEstimateGasReturnType, IconAddress, IWalletProvider, EvmSpokeChainConfig, PartnerFeeAmount, PartnerFeePercentage, GetWalletProviderType, SpokeExecActionParams, FeeAmount, Hash as Hash$1, SolverIntentQuoteRequest, SolverIntentQuoteResponse, SolverErrorResponse, SolverIntentStatusRequest, SolverIntentStatusResponse, SolverExecutionRequest, SolverExecutionResponse, IconEoaAddress, IcxTokenType, IconContractAddress, BridgeLimit, UserUnstakeInfo, ConcentratedLiquidityConfig } from '@sodax/types';
2
2
  export * from '@sodax/types';
3
3
  import * as viem from 'viem';
4
4
  import { Hex as Hex$1, Chain, Address as Address$1, PublicClient, HttpTransport, Hash, GetLogsReturnType } from 'viem';
5
- import { ClarityValue } from '@stacks/transactions';
6
- import { StacksNetwork } from '@stacks/network';
5
+ import { StacksNetwork, ClarityValue } from '@sodax/libs/stacks/core';
7
6
  import { networks, Psbt } from 'bitcoinjs-lib';
8
7
  import { JsonRpcProvider } from 'near-api-js';
9
8
  import { Transaction, TransactionResult } from '@mysten/sui/transactions';
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- import { IConfigApi, ApiConfig, Result, SubmitSwapTxRequest, SubmitSwapTxResponse, GetSubmitSwapTxStatusParams, SubmitSwapTxStatusResponse, Address, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, SpokeChainKey, GetSwapTokensByChainIdApiResponse, GetMoneyMarketTokensApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, SodaxConfig, XToken, OriginalAssetAddress, IntentRelayChainId, HubChainKey, HubConfig, PoolKey, SpokeChainConfig, RelayConfig, SolverConfig, SwapsConfig, BridgeConfig, MoneyMarketConfig, DexConfig, GetSpokeChainConfigType, EvmContractCall, Hex, IEvmWalletProvider, EvmRawTransactionReceipt, PartnerFee, QuoteType, EvmChainKey, DeepPartial, WalletProviderSlot, TxReturnType, ChainType, GetChainType, SolanaRawTransactionReceipt, StellarSorobanTransactionReceipt, IconTransactionResult, SuiRawTransactionReceipt, InjectiveRawTransactionReceipt, NearRawTransactionReceipt, StacksRawTransactionReceipt, BitcoinRawTransactionReceipt, GetAddressType, HubAddress, GetTokenAddressType, EvmSpokeOnlyChainKey, StellarChainKey, SonicChainKey, AssetInfo, TokenInfo, VaultReserves, StacksChainKey, FeeEstimateTransaction, StacksTransactionParams, RadfiConfig, IBitcoinWalletProvider, RadfiDepositTxResponse, BtcAddressType, BitcoinChainKey, HttpUrl, NearChainKey, FillData, NearRawTransaction, SuiPaginatedCoins, SuiChainKey, SuiExecutionResult, SuiGasEstimate, IStellarWalletProvider, StellarGasEstimate, SolanaChainKey, SolanaGasEstimate, SolanaBase58PublicKey, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaRpcResponseAndContext, SolanaTokenAmount, IconChainKey, IconGasEstimate, InjectiveChainKey, InjectiveGasEstimate, JsonObject, InjectiveRawTransaction, IInjectiveWalletProvider, InjectiveExecuteResponse, GetEstimateGasReturnType, IconAddress, EvmSpokeChainConfig, PartnerFeeAmount, PartnerFeePercentage, IWalletProvider, GetWalletProviderType, SolverIntentQuoteRequest, SolverIntentQuoteResponse, SolverErrorResponse, SolverIntentStatusRequest, SolverIntentStatusResponse, SolverExecutionRequest, SolverExecutionResponse, SpokeExecActionParams, FeeAmount, Hash as Hash$1, IcxTokenType, IconEoaAddress, IconContractAddress, BridgeLimit, UserUnstakeInfo, ConcentratedLiquidityConfig } from '@sodax/types';
1
+ import { IConfigApi, ApiConfig, Result, SubmitSwapTxRequest, SubmitSwapTxResponse, GetSubmitSwapTxStatusParams, SubmitSwapTxStatusResponse, Address, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, SpokeChainKey, GetSwapTokensByChainIdApiResponse, GetMoneyMarketTokensApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, SodaxConfig, XToken, OriginalAssetAddress, IntentRelayChainId, HubChainKey, HubConfig, PoolKey, SpokeChainConfig, RelayConfig, SolverConfig, SwapsConfig, BridgeConfig, MoneyMarketConfig, DexConfig, GetSpokeChainConfigType, EvmContractCall, Hex, IEvmWalletProvider, EvmRawTransactionReceipt, PartnerFee, QuoteType, EvmChainKey, DeepPartial, WalletProviderSlot, TxReturnType, ChainType, GetChainType, SolanaRawTransactionReceipt, StellarSorobanTransactionReceipt, IconTransactionResult, SuiRawTransactionReceipt, InjectiveRawTransactionReceipt, NearRawTransactionReceipt, StacksRawTransactionReceipt, BitcoinRawTransactionReceipt, GetAddressType, HubAddress, GetTokenAddressType, EvmSpokeOnlyChainKey, StellarChainKey, SonicChainKey, AssetInfo, TokenInfo, VaultReserves, StacksChainKey, FeeEstimateTransaction, StacksTransactionParams, RadfiConfig, IBitcoinWalletProvider, RadfiDepositTxResponse, BtcAddressType, BitcoinChainKey, HttpUrl, NearChainKey, FillData, NearRawTransaction, SuiPaginatedCoins, SuiChainKey, SuiExecutionResult, SuiGasEstimate, IStellarWalletProvider, StellarGasEstimate, SolanaChainKey, SolanaGasEstimate, SolanaBase58PublicKey, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaRpcResponseAndContext, SolanaTokenAmount, IconChainKey, IconGasEstimate, InjectiveChainKey, InjectiveGasEstimate, JsonObject, InjectiveRawTransaction, IInjectiveWalletProvider, InjectiveExecuteResponse, GetEstimateGasReturnType, IconAddress, IWalletProvider, EvmSpokeChainConfig, PartnerFeeAmount, PartnerFeePercentage, GetWalletProviderType, SpokeExecActionParams, FeeAmount, Hash as Hash$1, SolverIntentQuoteRequest, SolverIntentQuoteResponse, SolverErrorResponse, SolverIntentStatusRequest, SolverIntentStatusResponse, SolverExecutionRequest, SolverExecutionResponse, IconEoaAddress, IcxTokenType, IconContractAddress, BridgeLimit, UserUnstakeInfo, ConcentratedLiquidityConfig } from '@sodax/types';
2
2
  export * from '@sodax/types';
3
3
  import * as viem from 'viem';
4
4
  import { Hex as Hex$1, Chain, Address as Address$1, PublicClient, HttpTransport, Hash, GetLogsReturnType } from 'viem';
5
- import { ClarityValue } from '@stacks/transactions';
6
- import { StacksNetwork } from '@stacks/network';
5
+ import { StacksNetwork, ClarityValue } from '@sodax/libs/stacks/core';
7
6
  import { networks, Psbt } from 'bitcoinjs-lib';
8
7
  import { JsonRpcProvider } from 'near-api-js';
9
8
  import { Transaction, TransactionResult } from '@mysten/sui/transactions';
package/dist/index.mjs CHANGED
@@ -1,11 +1,10 @@
1
- import { getAbiItem, defineChain, isAddress, toHex, hexToBytes, encodeAbiParameters, parseAbiParameters, encodeFunctionData, erc20Abi as erc20Abi$1, createPublicClient, http, bytesToHex, keccak256, fromHex, encodePacked, parseEventLogs, decodeAbiParameters, maxUint160, maxUint48 } from 'viem';
1
+ import { getAbiItem, isAddress, toHex, hexToBytes, encodeAbiParameters, parseAbiParameters, defineChain, encodeFunctionData, erc20Abi as erc20Abi$1, createPublicClient, http, bytesToHex, keccak256, fromHex, encodePacked, parseEventLogs, decodeAbiParameters, maxUint160, maxUint48 } from 'viem';
2
2
  import { bcs } from '@mysten/sui/bcs';
3
3
  import { PublicKey, Connection, VersionedTransaction, SystemProgram, ComputeBudgetProgram, TransactionMessage, TransactionInstruction } from '@solana/web3.js';
4
4
  import { rpc, Address, xdr, Account, Horizon, Contract, TransactionBuilder, nativeToScVal, TimeoutInfinite, scValToBigInt, Operation, Asset, FeeBumpTransaction } from '@stellar/stellar-sdk';
5
- import { serializeCV, Cl, deserializeCV, cvToString, fetchFeeEstimateTransaction, fetchCallReadOnlyFunction, parseContractId, PostConditionMode, noneCV, someCV, uintCV, validateStacksAddress, makeUnsignedContractCall, serializePayloadBytes } from '@stacks/transactions';
5
+ import { serializeCV, Cl, deserializeCV, cvToString, createNetwork, fetchFeeEstimateTransaction, fetchCallReadOnlyFunction, parseContractId, PostConditionMode, noneCV, someCV, uintCV, validateStacksAddress, makeUnsignedContractCall, serializePayloadBytes } from '@sodax/libs/stacks/core';
6
6
  import { kaia, redbellyMainnet, mainnet, lightlinkPhoenix, polygon, bsc, optimism, base, arbitrum, avalanche, sonic } from 'viem/chains';
7
7
  import * as rlp from 'rlp';
8
- import { createNetwork } from '@stacks/network';
9
8
  import { initEccLib, networks, Transaction, Psbt, payments, opcodes, script } from 'bitcoinjs-lib';
10
9
  import * as ecc from '@bitcoinerlab/secp256k1';
11
10
  import { CLPositionManagerAbi, encodeCLPositionManagerMintCalldata, encodeCLPositionManagerIncreaseLiquidityCalldata, encodeCLPositionManagerDecreaseLiquidityCalldata, getPoolId, CLPoolManagerAbi, decodePoolKey } from '@pancakeswap/infinity-sdk';
@@ -3197,6 +3196,7 @@ var moneyMarketSupportedTokens = {
3197
3196
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.bnUSD,
3198
3197
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.SODA,
3199
3198
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.weETH,
3199
+ spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.USDC,
3200
3200
  spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.USDT
3201
3201
  ],
3202
3202
  [ChainKeys.HYPEREVM_MAINNET]: [
@@ -3212,6 +3212,7 @@ var moneyMarketSupportedTokens = {
3212
3212
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens.USDC,
3213
3213
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["AVAX.LL"],
3214
3214
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["BNB.LL"],
3215
+ spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["BTC.LL"],
3215
3216
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["SOL.LL"],
3216
3217
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["XLM.LL"],
3217
3218
  spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["INJ.LL"],
@@ -3279,7 +3280,8 @@ var moneyMarketSupportedTokens = {
3279
3280
  spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.weETH,
3280
3281
  spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.wstETH,
3281
3282
  spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.USDT,
3282
- spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.WBTC
3283
+ spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.WBTC,
3284
+ spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.LL
3283
3285
  ],
3284
3286
  [ChainKeys.REDBELLY_MAINNET]: [
3285
3287
  spokeChainConfig[ChainKeys.REDBELLY_MAINNET].supportedTokens.bnUSD,
@@ -3869,7 +3871,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
3869
3871
  }
3870
3872
 
3871
3873
  // ../types/dist/index.js
3872
- var CONFIG_VERSION = 202;
3874
+ var CONFIG_VERSION = 204;
3873
3875
  function isEvmSpokeChainConfig(value) {
3874
3876
  return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
3875
3877
  }
@@ -14212,7 +14214,7 @@ var StacksSpokeService = class {
14212
14214
  nonce: 0n
14213
14215
  });
14214
14216
  return {
14215
- payload: `0x${bytesToHex(serializePayloadBytes(tx.payload))}`
14217
+ payload: bytesToHex(serializePayloadBytes(tx.payload))
14216
14218
  };
14217
14219
  }
14218
14220
  const txId = await params.walletProvider.sendTransaction(reqData);
@@ -14255,7 +14257,7 @@ var StacksSpokeService = class {
14255
14257
  nonce: 0n
14256
14258
  });
14257
14259
  return {
14258
- payload: `0x${bytesToHex(serializePayloadBytes(tx.payload))}`
14260
+ payload: bytesToHex(serializePayloadBytes(tx.payload))
14259
14261
  };
14260
14262
  }
14261
14263
  const txId = await params.walletProvider.sendTransaction(reqData);
@@ -14338,7 +14340,7 @@ var RadfiProvider = class {
14338
14340
  if (!publicKey) {
14339
14341
  throw new Error("Failed to retrieve public key from wallet. Please unlock your wallet and try again.");
14340
14342
  }
14341
- const message = `Login to Radfi via Sodax: ${Date.now()}`;
14343
+ const message = `${Date.now()}`;
14342
14344
  const addressType = detectBitcoinAddressType(address);
14343
14345
  const signature = addressType === "P2WPKH" || addressType === "P2TR" ? await walletProvider.signBip322Message(message) : await walletProvider.signEcdsaMessage(message);
14344
14346
  const result = await this.authenticate({ message, signature, address, publicKey });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.0.0-rc.4",
7
+ "version": "2.0.0-rc.6",
8
8
  "license": "MIT",
9
9
  "description": "Sodax SDK",
10
10
  "keywords": [
@@ -57,8 +57,6 @@
57
57
  "@pancakeswap/v3-sdk": "^3.9.7",
58
58
  "@solana/spl-token": "0.4.9",
59
59
  "@solana/web3.js": "1.98.0",
60
- "@stacks/network": "7.3.1",
61
- "@stacks/transactions": "7.3.1",
62
60
  "@stellar/stellar-sdk": "15.1.0",
63
61
  "bignumber.js": "9.3.1",
64
62
  "bitcoinjs-lib": "^6.1.5",
@@ -67,7 +65,8 @@
67
65
  "near-api-js": "7.2.0",
68
66
  "rlp": "3.0.0",
69
67
  "viem": "2.29.2",
70
- "@sodax/types": "2.0.0-rc.4"
68
+ "@sodax/libs": "0.0.1-rc.0",
69
+ "@sodax/types": "2.0.0-rc.6"
71
70
  },
72
71
  "devDependencies": {
73
72
  "@arethetypeswrong/cli": "0.17.4",
@@ -86,7 +85,7 @@
86
85
  "scripts": {
87
86
  "build": "tsup",
88
87
  "test": "vitest run --exclude ./src/e2e-tests",
89
- "test-e2e": "vitest run ./src/e2e-tests",
88
+ "test:e2e": "vitest run --config vitest.e2e.config.ts",
90
89
  "coverage": "vitest run --coverage",
91
90
  "dev": "tsup --watch",
92
91
  "ci": "pnpm run pretty && pnpm run build && pnpm run test",