@sodax/sdk 2.0.0-rc.4 → 2.0.0-rc.5
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 +35 -36
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.mjs +6 -7
- package/package.json +3 -4
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
|
|
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
|
|
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');
|
|
@@ -3897,7 +3896,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
3897
3896
|
}
|
|
3898
3897
|
|
|
3899
3898
|
// ../types/dist/index.js
|
|
3900
|
-
var CONFIG_VERSION =
|
|
3899
|
+
var CONFIG_VERSION = 203;
|
|
3901
3900
|
function isEvmSpokeChainConfig(value) {
|
|
3902
3901
|
return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
|
|
3903
3902
|
}
|
|
@@ -4107,7 +4106,7 @@ function encodeAddress(spokeChainId, address) {
|
|
|
4107
4106
|
case "STELLAR":
|
|
4108
4107
|
return `0x${stellarSdk.Address.fromString(address).toScVal().toXDR("hex")}`;
|
|
4109
4108
|
case "STACKS":
|
|
4110
|
-
return `0x${
|
|
4109
|
+
return `0x${core.serializeCV(core.Cl.principal(address))}`;
|
|
4111
4110
|
case "BITCOIN":
|
|
4112
4111
|
case "NEAR":
|
|
4113
4112
|
case "INJECTIVE":
|
|
@@ -4151,8 +4150,8 @@ function reverseEncodeAddress(spokeChainId, encoded) {
|
|
|
4151
4150
|
}
|
|
4152
4151
|
case "STACKS": {
|
|
4153
4152
|
const rawHex = encoded.startsWith("0x") ? encoded.slice(2) : encoded;
|
|
4154
|
-
const cv =
|
|
4155
|
-
return
|
|
4153
|
+
const cv = core.deserializeCV(viem.hexToBytes(`0x${rawHex}`));
|
|
4154
|
+
return core.cvToString(cv);
|
|
4156
4155
|
}
|
|
4157
4156
|
case "BITCOIN":
|
|
4158
4157
|
case "NEAR":
|
|
@@ -13454,7 +13453,7 @@ async function waitForStacksTransaction(txid, rpc_url) {
|
|
|
13454
13453
|
return false;
|
|
13455
13454
|
}
|
|
13456
13455
|
function serializeAddressData(address) {
|
|
13457
|
-
return `0x${
|
|
13456
|
+
return `0x${core.serializeCV(core.Cl.principal(address))}`;
|
|
13458
13457
|
}
|
|
13459
13458
|
async function sleep2(s) {
|
|
13460
13459
|
return new Promise((resolve) => {
|
|
@@ -14149,12 +14148,12 @@ var StacksSpokeService = class {
|
|
|
14149
14148
|
constructor(config) {
|
|
14150
14149
|
this.config = config;
|
|
14151
14150
|
const chainConfig = config.getChainConfig(ChainKeys.STACKS_MAINNET);
|
|
14152
|
-
this.network =
|
|
14151
|
+
this.network = core.createNetwork({ network: "mainnet", client: { baseUrl: chainConfig.rpcUrl } });
|
|
14153
14152
|
this.pollingIntervalMs = chainConfig.pollingConfig.pollingIntervalMs;
|
|
14154
14153
|
this.maxTimeoutMs = chainConfig.pollingConfig.maxTimeoutMs;
|
|
14155
14154
|
}
|
|
14156
14155
|
async estimateGas(params) {
|
|
14157
|
-
const [low, medium, high] = await
|
|
14156
|
+
const [low, medium, high] = await core.fetchFeeEstimateTransaction({
|
|
14158
14157
|
payload: params.tx.payload,
|
|
14159
14158
|
estimatedLength: params.tx.estimatedLength,
|
|
14160
14159
|
network: this.network
|
|
@@ -14162,7 +14161,7 @@ var StacksSpokeService = class {
|
|
|
14162
14161
|
return { low, medium, high };
|
|
14163
14162
|
}
|
|
14164
14163
|
async readContract(sender, txParams) {
|
|
14165
|
-
return
|
|
14164
|
+
return core.fetchCallReadOnlyFunction({
|
|
14166
14165
|
contractAddress: txParams.contractAddress,
|
|
14167
14166
|
contractName: txParams.contractName,
|
|
14168
14167
|
functionName: txParams.functionName,
|
|
@@ -14181,19 +14180,19 @@ var StacksSpokeService = class {
|
|
|
14181
14180
|
return BigInt(data.stx.balance);
|
|
14182
14181
|
}
|
|
14183
14182
|
async readTokenBalance(token, address) {
|
|
14184
|
-
const [contractAddress, contractName] =
|
|
14185
|
-
const result = await
|
|
14183
|
+
const [contractAddress, contractName] = core.parseContractId(token);
|
|
14184
|
+
const result = await core.fetchCallReadOnlyFunction({
|
|
14186
14185
|
contractAddress,
|
|
14187
14186
|
contractName,
|
|
14188
14187
|
functionName: "get-balance",
|
|
14189
|
-
functionArgs: [
|
|
14188
|
+
functionArgs: [core.Cl.principal(address)],
|
|
14190
14189
|
network: this.network,
|
|
14191
14190
|
senderAddress: address
|
|
14192
14191
|
});
|
|
14193
14192
|
return result.value.value;
|
|
14194
14193
|
}
|
|
14195
14194
|
async getImplContractAddress(stateContract) {
|
|
14196
|
-
const [contractAddress, contractName] =
|
|
14195
|
+
const [contractAddress, contractName] = core.parseContractId(stateContract);
|
|
14197
14196
|
const txParams = {
|
|
14198
14197
|
contractAddress,
|
|
14199
14198
|
contractName,
|
|
@@ -14212,26 +14211,26 @@ var StacksSpokeService = class {
|
|
|
14212
14211
|
async deposit(params) {
|
|
14213
14212
|
const chainConfig = this.config.getChainConfig(params.srcChainKey);
|
|
14214
14213
|
const assetManagerImpl = await this.getImplContractAddress(chainConfig.addresses.assetManager);
|
|
14215
|
-
const [implAddress, implName] =
|
|
14216
|
-
const [connectionAddress, connectionName] =
|
|
14214
|
+
const [implAddress, implName] = core.parseContractId(assetManagerImpl);
|
|
14215
|
+
const [connectionAddress, connectionName] = core.parseContractId(chainConfig.addresses.connection);
|
|
14217
14216
|
const reqData = {
|
|
14218
14217
|
contractAddress: implAddress,
|
|
14219
14218
|
contractName: implName,
|
|
14220
14219
|
functionName: "transfer",
|
|
14221
14220
|
functionArgs: [
|
|
14222
|
-
isNativeToken(params.srcChainKey, params.token) ?
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14221
|
+
isNativeToken(params.srcChainKey, params.token) ? core.noneCV() : core.someCV(core.Cl.principal(params.token)),
|
|
14222
|
+
core.Cl.bufferFromHex(params.to),
|
|
14223
|
+
core.uintCV(params.amount),
|
|
14224
|
+
core.Cl.bufferFromHex(params.data),
|
|
14225
|
+
core.Cl.contractPrincipal(connectionAddress, connectionName)
|
|
14227
14226
|
],
|
|
14228
|
-
postConditionMode:
|
|
14227
|
+
postConditionMode: core.PostConditionMode.Allow
|
|
14229
14228
|
};
|
|
14230
14229
|
if (params.raw === true) {
|
|
14231
|
-
if (
|
|
14230
|
+
if (core.validateStacksAddress(params.srcAddress)) {
|
|
14232
14231
|
throw new Error('When using raw transactions, the public key must be provided as "from" parameter');
|
|
14233
14232
|
}
|
|
14234
|
-
const tx = await
|
|
14233
|
+
const tx = await core.makeUnsignedContractCall({
|
|
14235
14234
|
...reqData,
|
|
14236
14235
|
publicKey: params.srcAddress,
|
|
14237
14236
|
network: this.network,
|
|
@@ -14240,7 +14239,7 @@ var StacksSpokeService = class {
|
|
|
14240
14239
|
nonce: 0n
|
|
14241
14240
|
});
|
|
14242
14241
|
return {
|
|
14243
|
-
payload:
|
|
14242
|
+
payload: viem.bytesToHex(core.serializePayloadBytes(tx.payload))
|
|
14244
14243
|
};
|
|
14245
14244
|
}
|
|
14246
14245
|
const txId = await params.walletProvider.sendTransaction(reqData);
|
|
@@ -14263,18 +14262,18 @@ var StacksSpokeService = class {
|
|
|
14263
14262
|
*/
|
|
14264
14263
|
async sendMessage(params) {
|
|
14265
14264
|
const dstRelayChainId = getIntentRelayChainId(params.dstChainKey);
|
|
14266
|
-
const [connectionAddress, connectionName] =
|
|
14265
|
+
const [connectionAddress, connectionName] = core.parseContractId(
|
|
14267
14266
|
this.config.getChainConfig(params.srcChainKey).addresses.connection
|
|
14268
14267
|
);
|
|
14269
14268
|
const reqData = {
|
|
14270
14269
|
contractAddress: connectionAddress,
|
|
14271
14270
|
contractName: connectionName,
|
|
14272
14271
|
functionName: "send-message",
|
|
14273
|
-
functionArgs: [
|
|
14274
|
-
postConditionMode:
|
|
14272
|
+
functionArgs: [core.uintCV(dstRelayChainId), core.Cl.bufferFromHex(params.dstAddress), core.Cl.bufferFromHex(params.payload)],
|
|
14273
|
+
postConditionMode: core.PostConditionMode.Allow
|
|
14275
14274
|
};
|
|
14276
14275
|
if (params.raw === true) {
|
|
14277
|
-
const tx = await
|
|
14276
|
+
const tx = await core.makeUnsignedContractCall({
|
|
14278
14277
|
...reqData,
|
|
14279
14278
|
publicKey: params.srcAddress,
|
|
14280
14279
|
network: this.network,
|
|
@@ -14283,7 +14282,7 @@ var StacksSpokeService = class {
|
|
|
14283
14282
|
nonce: 0n
|
|
14284
14283
|
});
|
|
14285
14284
|
return {
|
|
14286
|
-
payload:
|
|
14285
|
+
payload: viem.bytesToHex(core.serializePayloadBytes(tx.payload))
|
|
14287
14286
|
};
|
|
14288
14287
|
}
|
|
14289
14288
|
const txId = await params.walletProvider.sendTransaction(reqData);
|
|
@@ -14366,7 +14365,7 @@ var RadfiProvider = class {
|
|
|
14366
14365
|
if (!publicKey) {
|
|
14367
14366
|
throw new Error("Failed to retrieve public key from wallet. Please unlock your wallet and try again.");
|
|
14368
14367
|
}
|
|
14369
|
-
const message =
|
|
14368
|
+
const message = `${Date.now()}`;
|
|
14370
14369
|
const addressType = detectBitcoinAddressType(address);
|
|
14371
14370
|
const signature = addressType === "P2WPKH" || addressType === "P2TR" ? await walletProvider.signBip322Message(message) : await walletProvider.signEcdsaMessage(message);
|
|
14372
14371
|
const result = await this.authenticate({ message, signature, address, publicKey });
|
|
@@ -21895,7 +21894,7 @@ var SuiSpokeService = class {
|
|
|
21895
21894
|
async deposit(params) {
|
|
21896
21895
|
const { srcAddress: from, srcChainKey, token, to, amount, data = "0x" } = params;
|
|
21897
21896
|
const isNative = isNativeToken(srcChainKey, token);
|
|
21898
|
-
const tx = new transactions
|
|
21897
|
+
const tx = new transactions.Transaction();
|
|
21899
21898
|
const coin = isNative ? await this.getNativeCoin(tx, amount) : await this.getCoin(tx, token, amount, from);
|
|
21900
21899
|
const connection = this.splitAddress(this.config.getChainConfig(srcChainKey).addresses.connection);
|
|
21901
21900
|
const assetManager = this.splitAddress(await this.getAssetManagerAddress(srcChainKey));
|
|
@@ -21929,7 +21928,7 @@ var SuiSpokeService = class {
|
|
|
21929
21928
|
}
|
|
21930
21929
|
async sendMessage(params) {
|
|
21931
21930
|
const { srcAddress: from, srcChainKey, dstChainKey, dstAddress, payload } = params;
|
|
21932
|
-
const txb = new transactions
|
|
21931
|
+
const txb = new transactions.Transaction();
|
|
21933
21932
|
const connection = this.splitAddress(this.config.getChainConfig(srcChainKey).addresses.connection);
|
|
21934
21933
|
const relayId = getIntentRelayChainId(dstChainKey);
|
|
21935
21934
|
txb.moveCall({
|
|
@@ -21963,7 +21962,7 @@ var SuiSpokeService = class {
|
|
|
21963
21962
|
* @returns {Promise<bigint>} The estimated computation cost.
|
|
21964
21963
|
*/
|
|
21965
21964
|
async estimateGas({ tx }) {
|
|
21966
|
-
const txb = transactions
|
|
21965
|
+
const txb = transactions.Transaction.fromKind(tx.data);
|
|
21967
21966
|
const result = await this.publicClient.devInspectTransactionBlock({
|
|
21968
21967
|
sender: tx.from,
|
|
21969
21968
|
transactionBlock: txb
|
|
@@ -21977,7 +21976,7 @@ var SuiSpokeService = class {
|
|
|
21977
21976
|
*/
|
|
21978
21977
|
async getDeposit(params) {
|
|
21979
21978
|
const assetmanager = this.splitAddress(await this.getAssetManagerAddress(params.srcChainKey));
|
|
21980
|
-
const tx = new transactions
|
|
21979
|
+
const tx = new transactions.Transaction();
|
|
21981
21980
|
const result = await this.viewContract(
|
|
21982
21981
|
tx,
|
|
21983
21982
|
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,
|
|
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/
|
|
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,
|
|
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/
|
|
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,
|
|
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/
|
|
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';
|
|
@@ -3869,7 +3868,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
3869
3868
|
}
|
|
3870
3869
|
|
|
3871
3870
|
// ../types/dist/index.js
|
|
3872
|
-
var CONFIG_VERSION =
|
|
3871
|
+
var CONFIG_VERSION = 203;
|
|
3873
3872
|
function isEvmSpokeChainConfig(value) {
|
|
3874
3873
|
return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
|
|
3875
3874
|
}
|
|
@@ -14212,7 +14211,7 @@ var StacksSpokeService = class {
|
|
|
14212
14211
|
nonce: 0n
|
|
14213
14212
|
});
|
|
14214
14213
|
return {
|
|
14215
|
-
payload:
|
|
14214
|
+
payload: bytesToHex(serializePayloadBytes(tx.payload))
|
|
14216
14215
|
};
|
|
14217
14216
|
}
|
|
14218
14217
|
const txId = await params.walletProvider.sendTransaction(reqData);
|
|
@@ -14255,7 +14254,7 @@ var StacksSpokeService = class {
|
|
|
14255
14254
|
nonce: 0n
|
|
14256
14255
|
});
|
|
14257
14256
|
return {
|
|
14258
|
-
payload:
|
|
14257
|
+
payload: bytesToHex(serializePayloadBytes(tx.payload))
|
|
14259
14258
|
};
|
|
14260
14259
|
}
|
|
14261
14260
|
const txId = await params.walletProvider.sendTransaction(reqData);
|
|
@@ -14338,7 +14337,7 @@ var RadfiProvider = class {
|
|
|
14338
14337
|
if (!publicKey) {
|
|
14339
14338
|
throw new Error("Failed to retrieve public key from wallet. Please unlock your wallet and try again.");
|
|
14340
14339
|
}
|
|
14341
|
-
const message =
|
|
14340
|
+
const message = `${Date.now()}`;
|
|
14342
14341
|
const addressType = detectBitcoinAddressType(address);
|
|
14343
14342
|
const signature = addressType === "P2WPKH" || addressType === "P2TR" ? await walletProvider.signBip322Message(message) : await walletProvider.signEcdsaMessage(message);
|
|
14344
14343
|
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.
|
|
7
|
+
"version": "2.0.0-rc.5",
|
|
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/
|
|
68
|
+
"@sodax/libs": "0.0.1-rc.0",
|
|
69
|
+
"@sodax/types": "2.0.0-rc.5"
|
|
71
70
|
},
|
|
72
71
|
"devDependencies": {
|
|
73
72
|
"@arethetypeswrong/cli": "0.17.4",
|