@sodax/sdk 0.0.1-rc.13 → 0.0.1-rc.14
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 +80 -0
- package/dist/index.cjs +286 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -12
- package/dist/index.d.ts +119 -12
- package/dist/index.mjs +288 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Address, Hex, PublicClient, HttpTransport, Hash, GetLogsReturnType, TransactionReceipt, WalletClient, CustomTransport, Chain, Account } from 'viem';
|
|
2
|
-
import { IInjectiveWalletProvider, InjectiveExecuteResponse, SpokeChainId, Hex as Hex$1, IEvmWalletProvider, Address as Address$1, Token, HubAddress, Hash as Hash$1, IconEoaAddress, IIconWalletProvider, ISolanaWalletProvider, SolanaBase58PublicKey, IStellarWalletProvider, ISuiWalletProvider, ChainType, InjectiveNetworkEnv, InjectiveRawTransaction,
|
|
2
|
+
import { IInjectiveWalletProvider, InjectiveExecuteResponse, SpokeChainId, Hex as Hex$1, IEvmWalletProvider, Address as Address$1, Token, HubAddress, EvmRawTransaction, Hash as Hash$1, IconEoaAddress, IIconWalletProvider, ISolanaWalletProvider, SolanaBase58PublicKey, IStellarWalletProvider, ISuiWalletProvider, ChainType, InjectiveNetworkEnv, InjectiveRawTransaction, StellarRawTransaction, HubChainId, ICON_MAINNET_CHAIN_ID, EvmRawTransactionReceipt, ChainId, OriginalAssetAddress } from '@sodax/types';
|
|
3
3
|
export * from '@sodax/types';
|
|
4
|
-
import {
|
|
4
|
+
import { TxGrpcClient } from '@injectivelabs/sdk-ts';
|
|
5
|
+
import { Horizon, SorobanRpc, Transaction, Memo, MemoType, Operation, FeeBumpTransaction } from '@stellar/stellar-sdk';
|
|
6
|
+
import { Api } from '@stellar/stellar-sdk/rpc';
|
|
7
|
+
import { SuiClient } from '@mysten/sui/client';
|
|
8
|
+
import { Transaction as Transaction$1, TransactionResult } from '@mysten/sui/transactions';
|
|
5
9
|
import { IconService } from 'icon-sdk-js';
|
|
6
10
|
import { PublicKey } from '@solana/web3.js';
|
|
7
11
|
|
|
@@ -4101,7 +4105,8 @@ interface State {
|
|
|
4101
4105
|
}
|
|
4102
4106
|
declare class InjectiveSpokeProvider implements ISpokeProvider {
|
|
4103
4107
|
readonly walletProvider: IInjectiveWalletProvider;
|
|
4104
|
-
chainConfig: InjectiveSpokeChainConfig;
|
|
4108
|
+
readonly chainConfig: InjectiveSpokeChainConfig;
|
|
4109
|
+
readonly txClient: TxGrpcClient;
|
|
4105
4110
|
constructor(conf: InjectiveSpokeChainConfig, walletProvider: IInjectiveWalletProvider);
|
|
4106
4111
|
getState(): Promise<State>;
|
|
4107
4112
|
getBalance(token: String): Promise<number>;
|
|
@@ -4441,6 +4446,13 @@ declare class MoneyMarketService {
|
|
|
4441
4446
|
readonly config: MoneyMarketServiceConfig;
|
|
4442
4447
|
private readonly hubProvider;
|
|
4443
4448
|
constructor(config: MoneyMarketConfigParams | undefined, hubProvider: EvmHubProvider, relayerApiEndpoint?: HttpUrl);
|
|
4449
|
+
/**
|
|
4450
|
+
* Estimate the gas for a raw transaction.
|
|
4451
|
+
* @param {TxReturnType<T, true>} params - The parameters for the raw transaction.
|
|
4452
|
+
* @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
4453
|
+
* @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
|
|
4454
|
+
*/
|
|
4455
|
+
static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
|
|
4444
4456
|
/**
|
|
4445
4457
|
* Check if allowance is sufficient for actions on the money market pool
|
|
4446
4458
|
* @param {MoneyMarketParams} params - Money market params containing token address and amount
|
|
@@ -4946,6 +4958,30 @@ type EvmSpokeDepositParams = {
|
|
|
4946
4958
|
};
|
|
4947
4959
|
declare class EvmSpokeService {
|
|
4948
4960
|
private constructor();
|
|
4961
|
+
/**
|
|
4962
|
+
* Estimates the gas necessary to complete a transaction without submitting it to the network.
|
|
4963
|
+
*
|
|
4964
|
+
* - Docs: https://viem.sh/docs/actions/public/estimateGas
|
|
4965
|
+
* - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
|
|
4966
|
+
*
|
|
4967
|
+
* @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
|
|
4968
|
+
* @param {EvmSpokeProvider} spokeProvider - The EVM spoke provider.
|
|
4969
|
+
* @returns {Promise<bigint>} Estimated gas for the transaction.
|
|
4970
|
+
*
|
|
4971
|
+
* @example
|
|
4972
|
+
*
|
|
4973
|
+
* const rawTx: EvmRawTransaction = {
|
|
4974
|
+
* from: '0x1234...abcd', // sender address
|
|
4975
|
+
* to: '0xabcd...1234', // recipient address
|
|
4976
|
+
* value: 1000000000000000000n, // 1 ETH in wei
|
|
4977
|
+
* data: '0x', // no calldata
|
|
4978
|
+
* };
|
|
4979
|
+
*
|
|
4980
|
+
* // Assume spokeProvider is an initialized EvmSpokeProvider
|
|
4981
|
+
* const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
|
|
4982
|
+
* console.log(`Estimated gas: ${estimatedGas}`);
|
|
4983
|
+
*/
|
|
4984
|
+
static estimateGas(rawTx: EvmRawTransaction, spokeProvider: EvmSpokeProvider): Promise<bigint>;
|
|
4949
4985
|
/**
|
|
4950
4986
|
* Deposit tokens to the spoke chain.
|
|
4951
4987
|
* @param {EvmSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
@@ -5001,6 +5037,13 @@ declare class EvmSpokeService {
|
|
|
5001
5037
|
*/
|
|
5002
5038
|
declare class SpokeService {
|
|
5003
5039
|
private constructor();
|
|
5040
|
+
/**
|
|
5041
|
+
* Estimate the gas for a raw transaction.
|
|
5042
|
+
* @param {TxReturnType<T, true>} params - The parameters for the raw transaction.
|
|
5043
|
+
* @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
5044
|
+
* @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
|
|
5045
|
+
*/
|
|
5046
|
+
static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
|
|
5004
5047
|
/**
|
|
5005
5048
|
* Deposit tokens to the spoke chain.
|
|
5006
5049
|
* @param {GetSpokeDepositParamsType<T extends SpokeProvider>} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
@@ -5046,6 +5089,31 @@ type BorrowInfo = {
|
|
|
5046
5089
|
};
|
|
5047
5090
|
declare class SonicSpokeService {
|
|
5048
5091
|
private constructor();
|
|
5092
|
+
/**
|
|
5093
|
+
/**
|
|
5094
|
+
* Estimates the gas necessary to complete a transaction without submitting it to the network.
|
|
5095
|
+
*
|
|
5096
|
+
* - Docs: https://viem.sh/docs/actions/public/estimateGas
|
|
5097
|
+
* - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
|
|
5098
|
+
*
|
|
5099
|
+
* @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
|
|
5100
|
+
* @param {SonicSpokeProvider} spokeProvider - The EVM spoke provider.
|
|
5101
|
+
* @returns {Promise<bigint>} Estimated gas for the transaction.
|
|
5102
|
+
*
|
|
5103
|
+
* @example
|
|
5104
|
+
*
|
|
5105
|
+
* const rawTx: EvmRawTransaction = {
|
|
5106
|
+
* from: '0x1234...abcd', // sender address
|
|
5107
|
+
* to: '0xabcd...1234', // recipient address
|
|
5108
|
+
* value: 1000000000000000000n, // 1 ETH in wei
|
|
5109
|
+
* data: '0x', // no calldata
|
|
5110
|
+
* };
|
|
5111
|
+
*
|
|
5112
|
+
* // Assume spokeProvider is an initialized EvmSpokeProvider
|
|
5113
|
+
* const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
|
|
5114
|
+
* console.log(`Estimated gas: ${estimatedGas}`);
|
|
5115
|
+
*/
|
|
5116
|
+
static estimateGas(rawTx: EvmRawTransaction, spokeProvider: SonicSpokeProvider): Promise<bigint>;
|
|
5049
5117
|
/**
|
|
5050
5118
|
* Get the derived address of a contract deployed with CREATE3.
|
|
5051
5119
|
* @param address - User's address on the specified chain as hex
|
|
@@ -5192,6 +5260,13 @@ declare class SolverService {
|
|
|
5192
5260
|
private readonly config;
|
|
5193
5261
|
private readonly hubProvider;
|
|
5194
5262
|
constructor(config: SolverConfigParams | undefined, hubProvider: EvmHubProvider, relayerApiEndpoint?: HttpUrl);
|
|
5263
|
+
/**
|
|
5264
|
+
* Estimate the gas for a raw transaction.
|
|
5265
|
+
* @param {TxReturnType<T, true>} params - The parameters for the raw transaction.
|
|
5266
|
+
* @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
5267
|
+
* @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
|
|
5268
|
+
*/
|
|
5269
|
+
static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
|
|
5195
5270
|
/**
|
|
5196
5271
|
* Request a quote from the solver API
|
|
5197
5272
|
* @param {SolverIntentQuoteRequest} payload - The solver intent quote request
|
|
@@ -5976,7 +6051,9 @@ declare class IconSpokeProvider {
|
|
|
5976
6051
|
readonly walletProvider: IIconWalletProvider;
|
|
5977
6052
|
readonly chainConfig: IconSpokeChainConfig;
|
|
5978
6053
|
readonly iconService: IconService;
|
|
5979
|
-
|
|
6054
|
+
readonly debugRpcUrl: HttpUrl;
|
|
6055
|
+
constructor(walletProvider: IIconWalletProvider, chainConfig: IconSpokeChainConfig, rpcUrl?: HttpUrl, // default to mainnet
|
|
6056
|
+
debugRpcUrl?: HttpUrl);
|
|
5980
6057
|
}
|
|
5981
6058
|
|
|
5982
6059
|
type IconSpokeDepositParams = {
|
|
@@ -6001,13 +6078,21 @@ type SolanaSpokeDepositParams = {
|
|
|
6001
6078
|
data: Hex;
|
|
6002
6079
|
};
|
|
6003
6080
|
|
|
6081
|
+
declare class CustomSorobanServer extends SorobanRpc.Server {
|
|
6082
|
+
private customHeaders;
|
|
6083
|
+
constructor(serverUrl: string, customHeaders: Record<string, string>);
|
|
6084
|
+
getNetwork(): Promise<Api.GetNetworkResponse>;
|
|
6085
|
+
simulateTransaction(tx: Transaction<Memo<MemoType>, Operation[]>): Promise<SorobanRpc.Api.SimulateTransactionResponse>;
|
|
6086
|
+
sendTransaction(tx: Transaction | FeeBumpTransaction): Promise<SorobanRpc.Api.SendTransactionResponse>;
|
|
6087
|
+
getTransaction(hash: string): Promise<SorobanRpc.Api.GetTransactionResponse>;
|
|
6088
|
+
}
|
|
6004
6089
|
type StellarRpcConfig = {
|
|
6005
6090
|
horizonRpcUrl?: HttpUrl;
|
|
6006
6091
|
sorobanRpcUrl?: HttpUrl;
|
|
6007
6092
|
};
|
|
6008
6093
|
declare class StellarSpokeProvider implements ISpokeProvider {
|
|
6009
|
-
|
|
6010
|
-
|
|
6094
|
+
readonly server: Horizon.Server;
|
|
6095
|
+
readonly sorobanServer: CustomSorobanServer;
|
|
6011
6096
|
private readonly contract;
|
|
6012
6097
|
readonly chainConfig: StellarSpokeChainConfig;
|
|
6013
6098
|
readonly walletProvider: IStellarWalletProvider;
|
|
@@ -6047,11 +6132,12 @@ type SuiTxObject = {
|
|
|
6047
6132
|
declare class SuiSpokeProvider implements ISpokeProvider {
|
|
6048
6133
|
readonly walletProvider: ISuiWalletProvider;
|
|
6049
6134
|
chainConfig: SuiSpokeChainConfig;
|
|
6135
|
+
readonly publicClient: SuiClient;
|
|
6050
6136
|
constructor(config: SuiSpokeChainConfig, wallet_provider: ISuiWalletProvider);
|
|
6051
6137
|
getBalance(token: string): Promise<bigint>;
|
|
6052
6138
|
transfer<R extends boolean = false>(token: string, amount: bigint, to: Uint8Array, data: Uint8Array, raw?: R): PromiseSuiTxReturnType<R>;
|
|
6053
|
-
getNativeCoin(tx: Transaction, amount: bigint): Promise<SuiNativeCoinResult>;
|
|
6054
|
-
getCoin(tx: Transaction, coin: string, amount: bigint, address: string): Promise<TransactionResult | SuiTxObject>;
|
|
6139
|
+
getNativeCoin(tx: Transaction$1, amount: bigint): Promise<SuiNativeCoinResult>;
|
|
6140
|
+
getCoin(tx: Transaction$1, coin: string, amount: bigint, address: string): Promise<TransactionResult | SuiTxObject>;
|
|
6055
6141
|
splitAddress(address: string): {
|
|
6056
6142
|
packageId: string;
|
|
6057
6143
|
moduleId: string;
|
|
@@ -6402,15 +6488,15 @@ type StellarReturnType<Raw extends boolean> = Raw extends true ? StellarRawTrans
|
|
|
6402
6488
|
type IconReturnType<Raw extends boolean> = Raw extends true ? IconRawTransaction : Hex$1;
|
|
6403
6489
|
type SuiReturnType<Raw extends boolean> = Raw extends true ? SuiRawTransaction : Hex$1;
|
|
6404
6490
|
type InjectiveReturnType<Raw extends boolean> = Raw extends true ? InjectiveRawTransaction : Hex$1;
|
|
6405
|
-
type
|
|
6491
|
+
type HashTxReturnType = EvmReturnType<false> | SolanaReturnType<false> | IconReturnType<false> | SuiReturnType<false> | InjectiveReturnType<false> | StellarReturnType<false>;
|
|
6492
|
+
type RawTxReturnType = EvmRawTransaction | SolanaRawTransaction | InjectiveRawTransaction | IconRawTransaction | SuiRawTransaction | StellarRawTransaction;
|
|
6493
|
+
type TxReturnType<T extends SpokeProvider, Raw extends boolean> = T['chainConfig']['chain']['type'] extends 'EVM' ? EvmReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'SOLANA' ? SolanaReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'STELLAR' ? StellarReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'ICON' ? IconReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'SUI' ? SuiReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? InjectiveReturnType<Raw> : Raw extends true ? RawTxReturnType : HashTxReturnType;
|
|
6406
6494
|
type PromiseEvmTxReturnType<Raw extends boolean> = Promise<TxReturnType<EvmSpokeProvider, Raw>>;
|
|
6407
6495
|
type PromiseSolanaTxReturnType<Raw extends boolean> = Promise<TxReturnType<SolanaSpokeProvider, Raw>>;
|
|
6408
6496
|
type PromiseStellarTxReturnType<Raw extends boolean> = Promise<TxReturnType<StellarSpokeProvider, Raw>>;
|
|
6409
6497
|
type PromiseIconTxReturnType<Raw extends boolean> = Promise<TxReturnType<IconSpokeProvider, Raw>>;
|
|
6410
6498
|
type PromiseSuiTxReturnType<Raw extends boolean> = Promise<TxReturnType<SuiSpokeProvider, Raw>>;
|
|
6411
6499
|
type PromiseInjectiveTxReturnType<Raw extends boolean> = Promise<TxReturnType<InjectiveSpokeProvider, Raw>>;
|
|
6412
|
-
type RawTxReturnType = EvmRawTransaction | SolanaRawTransaction | InjectiveRawTransaction | IconRawTransaction | SuiRawTransaction;
|
|
6413
|
-
type GetRawTxReturnType<T extends ChainType> = T extends 'EVM' ? PromiseEvmTxReturnType<boolean> : never;
|
|
6414
6500
|
type PromiseTxReturnType<T extends ISpokeProvider, Raw extends boolean> = T['chainConfig']['chain']['type'] extends 'EVM' ? PromiseEvmTxReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'SOLANA' ? PromiseSolanaTxReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'STELLAR' ? PromiseStellarTxReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'ICON' ? PromiseIconTxReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'SUI' ? PromiseSuiTxReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? PromiseInjectiveTxReturnType<Raw> : never;
|
|
6415
6501
|
type VaultType = {
|
|
6416
6502
|
address: Address$1;
|
|
@@ -6424,6 +6510,22 @@ type ExtractKeys<T> = T extends unknown ? keyof T : never;
|
|
|
6424
6510
|
type SpokeTokenSymbols = ExtractKeys<(typeof spokeChainConfig)[SpokeChainId]['supportedTokens']>;
|
|
6425
6511
|
type SpokeTxHash = string;
|
|
6426
6512
|
type HubTxHash = string;
|
|
6513
|
+
type SolanaGasEstimate = number | undefined;
|
|
6514
|
+
type EvmGasEstimate = bigint;
|
|
6515
|
+
type StellarGasEstimate = bigint;
|
|
6516
|
+
type IconGasEstimate = bigint;
|
|
6517
|
+
type SuiGasEstimate = {
|
|
6518
|
+
computationCost: string;
|
|
6519
|
+
nonRefundableStorageFee: string;
|
|
6520
|
+
storageCost: string;
|
|
6521
|
+
storageRebate: string;
|
|
6522
|
+
};
|
|
6523
|
+
type InjectiveGasEstimate = {
|
|
6524
|
+
gasWanted: number;
|
|
6525
|
+
gasUsed: number;
|
|
6526
|
+
};
|
|
6527
|
+
type GasEstimateType = EvmGasEstimate | SolanaGasEstimate | StellarGasEstimate | IconGasEstimate | SuiGasEstimate | InjectiveGasEstimate;
|
|
6528
|
+
type GetEstimateGasReturnType<T extends SpokeProvider> = T['chainConfig']['chain']['type'] extends 'EVM' ? EvmGasEstimate : T['chainConfig']['chain']['type'] extends 'SOLANA' ? SolanaGasEstimate : T['chainConfig']['chain']['type'] extends 'STELLAR' ? StellarGasEstimate : T['chainConfig']['chain']['type'] extends 'ICON' ? IconGasEstimate : T['chainConfig']['chain']['type'] extends 'SUI' ? SuiGasEstimate : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? InjectiveGasEstimate : GasEstimateType;
|
|
6427
6529
|
|
|
6428
6530
|
declare function getIconAddressBytes(address: string): Hex;
|
|
6429
6531
|
|
|
@@ -6560,6 +6662,11 @@ declare function calculatePercentageFeeAmount(amount: bigint, percentage: number
|
|
|
6560
6662
|
declare function calculateFeeAmount(inputAmount: bigint, fee: PartnerFee | undefined): bigint;
|
|
6561
6663
|
declare function BigIntToHex(value: bigint): Hex$1;
|
|
6562
6664
|
declare function encodeAddress(spokeChainId: SpokeChainId, address: string): Hex$1;
|
|
6665
|
+
/**
|
|
6666
|
+
* Convert a valid hexadecimal string (with or without "0x") to BigInt.
|
|
6667
|
+
* Throws on invalid hex.
|
|
6668
|
+
*/
|
|
6669
|
+
declare function hexToBigInt(hex: string): bigint;
|
|
6563
6670
|
|
|
6564
6671
|
declare const DEFAULT_MAX_RETRY = 3;
|
|
6565
6672
|
declare const DEFAULT_RELAY_TX_TIMEOUT = 60000;
|
|
@@ -7551,4 +7658,4 @@ declare function isMoneyMarketBorrowUnknownError(error: unknown): error is Money
|
|
|
7551
7658
|
declare function isMoneyMarketWithdrawUnknownError(error: unknown): error is MoneyMarketUnknownError<'WITHDRAW_UNKNOWN_ERROR'>;
|
|
7552
7659
|
declare function isMoneyMarketRepayUnknownError(error: unknown): error is MoneyMarketUnknownError<'REPAY_UNKNOWN_ERROR'>;
|
|
7553
7660
|
|
|
7554
|
-
export { type AggregatedReserveData, type AssetInfo, type BaseCurrencyInfo, type BaseHubChainConfig, type BaseSpokeChainConfig, type BaseSpokeChainInfo, BigIntToHex, type BorrowInfo, type CreateIntentParams, type CustomProvider, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, type Default, EVM_CHAIN_IDS, EVM_SPOKE_CHAIN_IDS, Erc20Service, EvmAssetManagerService, type EvmChainId, type EvmContractCall, type EvmDepositToDataParams, type EvmHubChainConfig, EvmHubProvider, type EvmHubProviderConfig, type EvmInitializedConfig, type EvmReturnType, EvmSolverService, type EvmSpokeChainConfig, type EvmSpokeChainId, type EvmSpokeDepositParams, EvmSpokeProvider, EvmSpokeService, type EvmTransferParams, type EvmTransferToHubParams, type EvmTxReturnType, type EvmUninitializedBrowserConfig, type EvmUninitializedConfig, type EvmUninitializedPrivateKeyConfig, EvmVaultTokenService, EvmWalletAbstraction, type EvmWithdrawAssetDataParams, FEE_PERCENTAGE_SCALE, type FeeAmount, type FeeData, type GetAddressType, type GetMigrateParams, type GetMigrationFailedPayload, type GetMoneyMarketError, type GetMoneyMarketParams, type GetPacketParams, type GetPacketResponse, type
|
|
7661
|
+
export { type AggregatedReserveData, type AssetInfo, type BaseCurrencyInfo, type BaseHubChainConfig, type BaseSpokeChainConfig, type BaseSpokeChainInfo, BigIntToHex, type BorrowInfo, type CreateIntentParams, type CustomProvider, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, type Default, EVM_CHAIN_IDS, EVM_SPOKE_CHAIN_IDS, Erc20Service, EvmAssetManagerService, type EvmChainId, type EvmContractCall, type EvmDepositToDataParams, type EvmGasEstimate, type EvmHubChainConfig, EvmHubProvider, type EvmHubProviderConfig, type EvmInitializedConfig, type EvmReturnType, EvmSolverService, type EvmSpokeChainConfig, type EvmSpokeChainId, type EvmSpokeDepositParams, EvmSpokeProvider, EvmSpokeService, type EvmTransferParams, type EvmTransferToHubParams, type EvmTxReturnType, type EvmUninitializedBrowserConfig, type EvmUninitializedConfig, type EvmUninitializedPrivateKeyConfig, EvmVaultTokenService, EvmWalletAbstraction, type EvmWithdrawAssetDataParams, FEE_PERCENTAGE_SCALE, type FeeAmount, type FeeData, type GasEstimateType, type GetAddressType, type GetEstimateGasReturnType, type GetMigrateParams, type GetMigrationFailedPayload, type GetMoneyMarketError, type GetMoneyMarketParams, type GetPacketParams, type GetPacketResponse, type GetRelayRequestParamType, type GetRelayResponse, type GetRevertMigrationParams, type GetSpokeChainIdType, type GetSpokeDepositParamsType, type GetTransactionPacketsParams, type GetTransactionPacketsResponse, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type HashTxReturnType, type HttpPrefixedUrl, type HttpUrl, type HubAssetInfo, type HubChainConfig, type HubChainInfo, type HubTxHash, type HubVaultSymbol, HubVaultSymbols, ICON_TX_RESULT_WAIT_MAX_RETRY, INTENT_RELAY_CHAIN_IDS, type ISpokeProvider, type IWalletProvider, type IconAddress, type IconGasEstimate, type IconJsonRpcVersion, type IconRawTransaction, type IconReturnType, type IconSpokeChainConfig, IconSpokeProvider, type IcxCreateRevertMigrationParams, type IcxMigrateParams, IcxMigrationService, type IcxRawTransaction, type IcxRevertMigrationParams, type IcxTokenType, type InjectiveGasEstimate, type InjectiveReturnType, type InjectiveSpokeChainConfig, InjectiveSpokeProvider, type Intent, IntentCreatedEventAbi, type IntentCreatedEventLog, type IntentCreationFailedErrorData, type IntentData, IntentDataType, type IntentError, type IntentErrorCode, type IntentErrorData, type IntentRelayChainId, type IntentRelayRequest, type IntentRelayRequestParams, type IntentState, type IntentSubmitTxFailedErrorData, type IntentWaitUntilIntentExecutedFailedErrorData, IntentsAbi, type JsonRpcPayloadResponse, MAX_UINT256, type MigrationAction, type MigrationError, type MigrationErrorCode, type MigrationErrorData, type MigrationFailedErrorData, type MigrationParams, MigrationService, type MigrationServiceConfig, type MigrationTokens, type MoneyMarketAction, type MoneyMarketBorrowFailedError, type MoneyMarketBorrowParams, type MoneyMarketConfig, type MoneyMarketConfigParams, type MoneyMarketEncodeBorrowParams, type MoneyMarketEncodeRepayParams, type MoneyMarketEncodeRepayWithATokensParams, type MoneyMarketEncodeSupplyParams, type MoneyMarketEncodeWithdrawParams, type MoneyMarketError, type MoneyMarketErrorCode, type MoneyMarketExtraData, type MoneyMarketOptionalExtraData, type MoneyMarketParams, type MoneyMarketRepayFailedError, type MoneyMarketRepayParams, MoneyMarketService, type MoneyMarketServiceConfig, type MoneyMarketSubmitTxFailedError, type MoneyMarketSupplyFailedError, type MoneyMarketSupplyParams, type MoneyMarketUnknownError, type MoneyMarketUnknownErrorCode, type MoneyMarketWithdrawFailedError, type MoneyMarketWithdrawParams, type Optional, type PacketData, type PartnerFee, type PartnerFeeAmount, type PartnerFeeConfig, type PartnerFeePercentage, type Prettify, type PromiseEvmTxReturnType, type PromiseIconTxReturnType, type PromiseInjectiveTxReturnType, type PromiseSolanaTxReturnType, type PromiseStellarTxReturnType, type PromiseSuiTxReturnType, type PromiseTxReturnType, type QuoteType, type RawTxReturnType, type RelayAction, type RelayError, type RelayErrorCode, type RelayRequestDetail, type RelayRequestSigning, type RelayTxStatus, type RelayerApiConfig, type ReserveDataLegacy, type ResponseAddressType, type ResponseSigningType, type Result, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, Sodax, type SodaxConfig, type SolanaChainConfig, type SolanaGasEstimate, type SolanaRawTransaction, type SolanaReturnType, SolanaSpokeProvider, type SolverConfig, type SolverConfigParams, type SolverErrorResponse, type SolverExecutionRequest, type SolverExecutionResponse, SolverIntentErrorCode, type SolverIntentQuoteRequest, type SolverIntentQuoteResponse, type SolverIntentQuoteResponseRaw, SolverIntentStatusCode, type SolverIntentStatusRequest, type SolverIntentStatusResponse, SolverService, type SolverServiceConfig, type SonicSpokeChainConfig, type SonicSpokeDepositParams, SonicSpokeProvider, SonicSpokeService, type SpokeChainConfig, type SpokeChainInfo, type SpokeDepositParams, type SpokeProvider, SpokeService, type SpokeTokenSymbols, type SpokeTxHash, type StellarGasEstimate, type StellarReturnType, type StellarRpcConfig, type StellarSpokeChainConfig, StellarSpokeProvider, type SubmitTxParams, type SubmitTxResponse, type SuiGasEstimate, type SuiRawTransaction, type SuiReturnType, type SuiSpokeChainConfig, SuiSpokeProvider, type TokenInfo, type TxReturnType, type UserReserveData, VAULT_TOKEN_DECIMALS, type VaultReserves, type VaultType, type WaitUntilIntentExecutedPayload, WalletAbstractionService, type WithdrawInfo, assetManagerAbi, calculateFeeAmount, calculatePercentageFeeAmount, chainIdToHubAssetsMap, connectionAbi, encodeAddress, encodeContractCalls, erc20Abi, getEvmViemChain, getHubAssetInfo, getHubChainConfig, getIconAddressBytes, getIntentRelayChainId, getMoneyMarketConfig, getOriginalAssetAddress, getPacket, getRandomBytes, getSolanaAddressBytes, getSolverConfig, getSpokeChainIdFromIntentRelayChainId, getSupportedMoneyMarketTokens, getSupportedSolverTokens, getTransactionPackets, hexToBigInt, hubAssetToOriginalAssetMap, hubAssets, hubVaults, hubVaultsAddressSet, intentRelayChainIdToSpokeChainIdMap, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconSpokeProvider, isInjectiveSpokeProvider, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketReserveAsset, isMoneyMarketReserveHubAsset, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketSupportedToken, isMoneyMarketWithdrawUnknownError, isNativeToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSolanaSpokeProvider, isSolverSupportedToken, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isValidChainHubAsset, isValidHubAsset, isValidIntentRelayChainId, isValidOriginalAssetAddress, isValidSpokeChainId, isWaitUntilIntentExecutedFailed, moneyMarketReserveAssets, moneyMarketReserveHubAssetsSet, moneyMarketSupportedTokens, originalAssetTohubAssetMap, poolAbi, randomUint256, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainIdsSet, submitTransaction, supportedHubAssets, supportedHubChains, supportedSpokeChains, supportedTokensPerChain, uiPoolDataAbi, variableDebtTokenAbi, vaultTokenAbi, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Address, Hex, PublicClient, HttpTransport, Hash, GetLogsReturnType, TransactionReceipt, WalletClient, CustomTransport, Chain, Account } from 'viem';
|
|
2
|
-
import { IInjectiveWalletProvider, InjectiveExecuteResponse, SpokeChainId, Hex as Hex$1, IEvmWalletProvider, Address as Address$1, Token, HubAddress, Hash as Hash$1, IconEoaAddress, IIconWalletProvider, ISolanaWalletProvider, SolanaBase58PublicKey, IStellarWalletProvider, ISuiWalletProvider, ChainType, InjectiveNetworkEnv, InjectiveRawTransaction,
|
|
2
|
+
import { IInjectiveWalletProvider, InjectiveExecuteResponse, SpokeChainId, Hex as Hex$1, IEvmWalletProvider, Address as Address$1, Token, HubAddress, EvmRawTransaction, Hash as Hash$1, IconEoaAddress, IIconWalletProvider, ISolanaWalletProvider, SolanaBase58PublicKey, IStellarWalletProvider, ISuiWalletProvider, ChainType, InjectiveNetworkEnv, InjectiveRawTransaction, StellarRawTransaction, HubChainId, ICON_MAINNET_CHAIN_ID, EvmRawTransactionReceipt, ChainId, OriginalAssetAddress } from '@sodax/types';
|
|
3
3
|
export * from '@sodax/types';
|
|
4
|
-
import {
|
|
4
|
+
import { TxGrpcClient } from '@injectivelabs/sdk-ts';
|
|
5
|
+
import { Horizon, SorobanRpc, Transaction, Memo, MemoType, Operation, FeeBumpTransaction } from '@stellar/stellar-sdk';
|
|
6
|
+
import { Api } from '@stellar/stellar-sdk/rpc';
|
|
7
|
+
import { SuiClient } from '@mysten/sui/client';
|
|
8
|
+
import { Transaction as Transaction$1, TransactionResult } from '@mysten/sui/transactions';
|
|
5
9
|
import { IconService } from 'icon-sdk-js';
|
|
6
10
|
import { PublicKey } from '@solana/web3.js';
|
|
7
11
|
|
|
@@ -4101,7 +4105,8 @@ interface State {
|
|
|
4101
4105
|
}
|
|
4102
4106
|
declare class InjectiveSpokeProvider implements ISpokeProvider {
|
|
4103
4107
|
readonly walletProvider: IInjectiveWalletProvider;
|
|
4104
|
-
chainConfig: InjectiveSpokeChainConfig;
|
|
4108
|
+
readonly chainConfig: InjectiveSpokeChainConfig;
|
|
4109
|
+
readonly txClient: TxGrpcClient;
|
|
4105
4110
|
constructor(conf: InjectiveSpokeChainConfig, walletProvider: IInjectiveWalletProvider);
|
|
4106
4111
|
getState(): Promise<State>;
|
|
4107
4112
|
getBalance(token: String): Promise<number>;
|
|
@@ -4441,6 +4446,13 @@ declare class MoneyMarketService {
|
|
|
4441
4446
|
readonly config: MoneyMarketServiceConfig;
|
|
4442
4447
|
private readonly hubProvider;
|
|
4443
4448
|
constructor(config: MoneyMarketConfigParams | undefined, hubProvider: EvmHubProvider, relayerApiEndpoint?: HttpUrl);
|
|
4449
|
+
/**
|
|
4450
|
+
* Estimate the gas for a raw transaction.
|
|
4451
|
+
* @param {TxReturnType<T, true>} params - The parameters for the raw transaction.
|
|
4452
|
+
* @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
4453
|
+
* @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
|
|
4454
|
+
*/
|
|
4455
|
+
static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
|
|
4444
4456
|
/**
|
|
4445
4457
|
* Check if allowance is sufficient for actions on the money market pool
|
|
4446
4458
|
* @param {MoneyMarketParams} params - Money market params containing token address and amount
|
|
@@ -4946,6 +4958,30 @@ type EvmSpokeDepositParams = {
|
|
|
4946
4958
|
};
|
|
4947
4959
|
declare class EvmSpokeService {
|
|
4948
4960
|
private constructor();
|
|
4961
|
+
/**
|
|
4962
|
+
* Estimates the gas necessary to complete a transaction without submitting it to the network.
|
|
4963
|
+
*
|
|
4964
|
+
* - Docs: https://viem.sh/docs/actions/public/estimateGas
|
|
4965
|
+
* - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
|
|
4966
|
+
*
|
|
4967
|
+
* @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
|
|
4968
|
+
* @param {EvmSpokeProvider} spokeProvider - The EVM spoke provider.
|
|
4969
|
+
* @returns {Promise<bigint>} Estimated gas for the transaction.
|
|
4970
|
+
*
|
|
4971
|
+
* @example
|
|
4972
|
+
*
|
|
4973
|
+
* const rawTx: EvmRawTransaction = {
|
|
4974
|
+
* from: '0x1234...abcd', // sender address
|
|
4975
|
+
* to: '0xabcd...1234', // recipient address
|
|
4976
|
+
* value: 1000000000000000000n, // 1 ETH in wei
|
|
4977
|
+
* data: '0x', // no calldata
|
|
4978
|
+
* };
|
|
4979
|
+
*
|
|
4980
|
+
* // Assume spokeProvider is an initialized EvmSpokeProvider
|
|
4981
|
+
* const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
|
|
4982
|
+
* console.log(`Estimated gas: ${estimatedGas}`);
|
|
4983
|
+
*/
|
|
4984
|
+
static estimateGas(rawTx: EvmRawTransaction, spokeProvider: EvmSpokeProvider): Promise<bigint>;
|
|
4949
4985
|
/**
|
|
4950
4986
|
* Deposit tokens to the spoke chain.
|
|
4951
4987
|
* @param {EvmSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
@@ -5001,6 +5037,13 @@ declare class EvmSpokeService {
|
|
|
5001
5037
|
*/
|
|
5002
5038
|
declare class SpokeService {
|
|
5003
5039
|
private constructor();
|
|
5040
|
+
/**
|
|
5041
|
+
* Estimate the gas for a raw transaction.
|
|
5042
|
+
* @param {TxReturnType<T, true>} params - The parameters for the raw transaction.
|
|
5043
|
+
* @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
5044
|
+
* @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
|
|
5045
|
+
*/
|
|
5046
|
+
static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
|
|
5004
5047
|
/**
|
|
5005
5048
|
* Deposit tokens to the spoke chain.
|
|
5006
5049
|
* @param {GetSpokeDepositParamsType<T extends SpokeProvider>} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
|
|
@@ -5046,6 +5089,31 @@ type BorrowInfo = {
|
|
|
5046
5089
|
};
|
|
5047
5090
|
declare class SonicSpokeService {
|
|
5048
5091
|
private constructor();
|
|
5092
|
+
/**
|
|
5093
|
+
/**
|
|
5094
|
+
* Estimates the gas necessary to complete a transaction without submitting it to the network.
|
|
5095
|
+
*
|
|
5096
|
+
* - Docs: https://viem.sh/docs/actions/public/estimateGas
|
|
5097
|
+
* - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
|
|
5098
|
+
*
|
|
5099
|
+
* @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
|
|
5100
|
+
* @param {SonicSpokeProvider} spokeProvider - The EVM spoke provider.
|
|
5101
|
+
* @returns {Promise<bigint>} Estimated gas for the transaction.
|
|
5102
|
+
*
|
|
5103
|
+
* @example
|
|
5104
|
+
*
|
|
5105
|
+
* const rawTx: EvmRawTransaction = {
|
|
5106
|
+
* from: '0x1234...abcd', // sender address
|
|
5107
|
+
* to: '0xabcd...1234', // recipient address
|
|
5108
|
+
* value: 1000000000000000000n, // 1 ETH in wei
|
|
5109
|
+
* data: '0x', // no calldata
|
|
5110
|
+
* };
|
|
5111
|
+
*
|
|
5112
|
+
* // Assume spokeProvider is an initialized EvmSpokeProvider
|
|
5113
|
+
* const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
|
|
5114
|
+
* console.log(`Estimated gas: ${estimatedGas}`);
|
|
5115
|
+
*/
|
|
5116
|
+
static estimateGas(rawTx: EvmRawTransaction, spokeProvider: SonicSpokeProvider): Promise<bigint>;
|
|
5049
5117
|
/**
|
|
5050
5118
|
* Get the derived address of a contract deployed with CREATE3.
|
|
5051
5119
|
* @param address - User's address on the specified chain as hex
|
|
@@ -5192,6 +5260,13 @@ declare class SolverService {
|
|
|
5192
5260
|
private readonly config;
|
|
5193
5261
|
private readonly hubProvider;
|
|
5194
5262
|
constructor(config: SolverConfigParams | undefined, hubProvider: EvmHubProvider, relayerApiEndpoint?: HttpUrl);
|
|
5263
|
+
/**
|
|
5264
|
+
* Estimate the gas for a raw transaction.
|
|
5265
|
+
* @param {TxReturnType<T, true>} params - The parameters for the raw transaction.
|
|
5266
|
+
* @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
|
|
5267
|
+
* @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
|
|
5268
|
+
*/
|
|
5269
|
+
static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
|
|
5195
5270
|
/**
|
|
5196
5271
|
* Request a quote from the solver API
|
|
5197
5272
|
* @param {SolverIntentQuoteRequest} payload - The solver intent quote request
|
|
@@ -5976,7 +6051,9 @@ declare class IconSpokeProvider {
|
|
|
5976
6051
|
readonly walletProvider: IIconWalletProvider;
|
|
5977
6052
|
readonly chainConfig: IconSpokeChainConfig;
|
|
5978
6053
|
readonly iconService: IconService;
|
|
5979
|
-
|
|
6054
|
+
readonly debugRpcUrl: HttpUrl;
|
|
6055
|
+
constructor(walletProvider: IIconWalletProvider, chainConfig: IconSpokeChainConfig, rpcUrl?: HttpUrl, // default to mainnet
|
|
6056
|
+
debugRpcUrl?: HttpUrl);
|
|
5980
6057
|
}
|
|
5981
6058
|
|
|
5982
6059
|
type IconSpokeDepositParams = {
|
|
@@ -6001,13 +6078,21 @@ type SolanaSpokeDepositParams = {
|
|
|
6001
6078
|
data: Hex;
|
|
6002
6079
|
};
|
|
6003
6080
|
|
|
6081
|
+
declare class CustomSorobanServer extends SorobanRpc.Server {
|
|
6082
|
+
private customHeaders;
|
|
6083
|
+
constructor(serverUrl: string, customHeaders: Record<string, string>);
|
|
6084
|
+
getNetwork(): Promise<Api.GetNetworkResponse>;
|
|
6085
|
+
simulateTransaction(tx: Transaction<Memo<MemoType>, Operation[]>): Promise<SorobanRpc.Api.SimulateTransactionResponse>;
|
|
6086
|
+
sendTransaction(tx: Transaction | FeeBumpTransaction): Promise<SorobanRpc.Api.SendTransactionResponse>;
|
|
6087
|
+
getTransaction(hash: string): Promise<SorobanRpc.Api.GetTransactionResponse>;
|
|
6088
|
+
}
|
|
6004
6089
|
type StellarRpcConfig = {
|
|
6005
6090
|
horizonRpcUrl?: HttpUrl;
|
|
6006
6091
|
sorobanRpcUrl?: HttpUrl;
|
|
6007
6092
|
};
|
|
6008
6093
|
declare class StellarSpokeProvider implements ISpokeProvider {
|
|
6009
|
-
|
|
6010
|
-
|
|
6094
|
+
readonly server: Horizon.Server;
|
|
6095
|
+
readonly sorobanServer: CustomSorobanServer;
|
|
6011
6096
|
private readonly contract;
|
|
6012
6097
|
readonly chainConfig: StellarSpokeChainConfig;
|
|
6013
6098
|
readonly walletProvider: IStellarWalletProvider;
|
|
@@ -6047,11 +6132,12 @@ type SuiTxObject = {
|
|
|
6047
6132
|
declare class SuiSpokeProvider implements ISpokeProvider {
|
|
6048
6133
|
readonly walletProvider: ISuiWalletProvider;
|
|
6049
6134
|
chainConfig: SuiSpokeChainConfig;
|
|
6135
|
+
readonly publicClient: SuiClient;
|
|
6050
6136
|
constructor(config: SuiSpokeChainConfig, wallet_provider: ISuiWalletProvider);
|
|
6051
6137
|
getBalance(token: string): Promise<bigint>;
|
|
6052
6138
|
transfer<R extends boolean = false>(token: string, amount: bigint, to: Uint8Array, data: Uint8Array, raw?: R): PromiseSuiTxReturnType<R>;
|
|
6053
|
-
getNativeCoin(tx: Transaction, amount: bigint): Promise<SuiNativeCoinResult>;
|
|
6054
|
-
getCoin(tx: Transaction, coin: string, amount: bigint, address: string): Promise<TransactionResult | SuiTxObject>;
|
|
6139
|
+
getNativeCoin(tx: Transaction$1, amount: bigint): Promise<SuiNativeCoinResult>;
|
|
6140
|
+
getCoin(tx: Transaction$1, coin: string, amount: bigint, address: string): Promise<TransactionResult | SuiTxObject>;
|
|
6055
6141
|
splitAddress(address: string): {
|
|
6056
6142
|
packageId: string;
|
|
6057
6143
|
moduleId: string;
|
|
@@ -6402,15 +6488,15 @@ type StellarReturnType<Raw extends boolean> = Raw extends true ? StellarRawTrans
|
|
|
6402
6488
|
type IconReturnType<Raw extends boolean> = Raw extends true ? IconRawTransaction : Hex$1;
|
|
6403
6489
|
type SuiReturnType<Raw extends boolean> = Raw extends true ? SuiRawTransaction : Hex$1;
|
|
6404
6490
|
type InjectiveReturnType<Raw extends boolean> = Raw extends true ? InjectiveRawTransaction : Hex$1;
|
|
6405
|
-
type
|
|
6491
|
+
type HashTxReturnType = EvmReturnType<false> | SolanaReturnType<false> | IconReturnType<false> | SuiReturnType<false> | InjectiveReturnType<false> | StellarReturnType<false>;
|
|
6492
|
+
type RawTxReturnType = EvmRawTransaction | SolanaRawTransaction | InjectiveRawTransaction | IconRawTransaction | SuiRawTransaction | StellarRawTransaction;
|
|
6493
|
+
type TxReturnType<T extends SpokeProvider, Raw extends boolean> = T['chainConfig']['chain']['type'] extends 'EVM' ? EvmReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'SOLANA' ? SolanaReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'STELLAR' ? StellarReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'ICON' ? IconReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'SUI' ? SuiReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? InjectiveReturnType<Raw> : Raw extends true ? RawTxReturnType : HashTxReturnType;
|
|
6406
6494
|
type PromiseEvmTxReturnType<Raw extends boolean> = Promise<TxReturnType<EvmSpokeProvider, Raw>>;
|
|
6407
6495
|
type PromiseSolanaTxReturnType<Raw extends boolean> = Promise<TxReturnType<SolanaSpokeProvider, Raw>>;
|
|
6408
6496
|
type PromiseStellarTxReturnType<Raw extends boolean> = Promise<TxReturnType<StellarSpokeProvider, Raw>>;
|
|
6409
6497
|
type PromiseIconTxReturnType<Raw extends boolean> = Promise<TxReturnType<IconSpokeProvider, Raw>>;
|
|
6410
6498
|
type PromiseSuiTxReturnType<Raw extends boolean> = Promise<TxReturnType<SuiSpokeProvider, Raw>>;
|
|
6411
6499
|
type PromiseInjectiveTxReturnType<Raw extends boolean> = Promise<TxReturnType<InjectiveSpokeProvider, Raw>>;
|
|
6412
|
-
type RawTxReturnType = EvmRawTransaction | SolanaRawTransaction | InjectiveRawTransaction | IconRawTransaction | SuiRawTransaction;
|
|
6413
|
-
type GetRawTxReturnType<T extends ChainType> = T extends 'EVM' ? PromiseEvmTxReturnType<boolean> : never;
|
|
6414
6500
|
type PromiseTxReturnType<T extends ISpokeProvider, Raw extends boolean> = T['chainConfig']['chain']['type'] extends 'EVM' ? PromiseEvmTxReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'SOLANA' ? PromiseSolanaTxReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'STELLAR' ? PromiseStellarTxReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'ICON' ? PromiseIconTxReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'SUI' ? PromiseSuiTxReturnType<Raw> : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? PromiseInjectiveTxReturnType<Raw> : never;
|
|
6415
6501
|
type VaultType = {
|
|
6416
6502
|
address: Address$1;
|
|
@@ -6424,6 +6510,22 @@ type ExtractKeys<T> = T extends unknown ? keyof T : never;
|
|
|
6424
6510
|
type SpokeTokenSymbols = ExtractKeys<(typeof spokeChainConfig)[SpokeChainId]['supportedTokens']>;
|
|
6425
6511
|
type SpokeTxHash = string;
|
|
6426
6512
|
type HubTxHash = string;
|
|
6513
|
+
type SolanaGasEstimate = number | undefined;
|
|
6514
|
+
type EvmGasEstimate = bigint;
|
|
6515
|
+
type StellarGasEstimate = bigint;
|
|
6516
|
+
type IconGasEstimate = bigint;
|
|
6517
|
+
type SuiGasEstimate = {
|
|
6518
|
+
computationCost: string;
|
|
6519
|
+
nonRefundableStorageFee: string;
|
|
6520
|
+
storageCost: string;
|
|
6521
|
+
storageRebate: string;
|
|
6522
|
+
};
|
|
6523
|
+
type InjectiveGasEstimate = {
|
|
6524
|
+
gasWanted: number;
|
|
6525
|
+
gasUsed: number;
|
|
6526
|
+
};
|
|
6527
|
+
type GasEstimateType = EvmGasEstimate | SolanaGasEstimate | StellarGasEstimate | IconGasEstimate | SuiGasEstimate | InjectiveGasEstimate;
|
|
6528
|
+
type GetEstimateGasReturnType<T extends SpokeProvider> = T['chainConfig']['chain']['type'] extends 'EVM' ? EvmGasEstimate : T['chainConfig']['chain']['type'] extends 'SOLANA' ? SolanaGasEstimate : T['chainConfig']['chain']['type'] extends 'STELLAR' ? StellarGasEstimate : T['chainConfig']['chain']['type'] extends 'ICON' ? IconGasEstimate : T['chainConfig']['chain']['type'] extends 'SUI' ? SuiGasEstimate : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? InjectiveGasEstimate : GasEstimateType;
|
|
6427
6529
|
|
|
6428
6530
|
declare function getIconAddressBytes(address: string): Hex;
|
|
6429
6531
|
|
|
@@ -6560,6 +6662,11 @@ declare function calculatePercentageFeeAmount(amount: bigint, percentage: number
|
|
|
6560
6662
|
declare function calculateFeeAmount(inputAmount: bigint, fee: PartnerFee | undefined): bigint;
|
|
6561
6663
|
declare function BigIntToHex(value: bigint): Hex$1;
|
|
6562
6664
|
declare function encodeAddress(spokeChainId: SpokeChainId, address: string): Hex$1;
|
|
6665
|
+
/**
|
|
6666
|
+
* Convert a valid hexadecimal string (with or without "0x") to BigInt.
|
|
6667
|
+
* Throws on invalid hex.
|
|
6668
|
+
*/
|
|
6669
|
+
declare function hexToBigInt(hex: string): bigint;
|
|
6563
6670
|
|
|
6564
6671
|
declare const DEFAULT_MAX_RETRY = 3;
|
|
6565
6672
|
declare const DEFAULT_RELAY_TX_TIMEOUT = 60000;
|
|
@@ -7551,4 +7658,4 @@ declare function isMoneyMarketBorrowUnknownError(error: unknown): error is Money
|
|
|
7551
7658
|
declare function isMoneyMarketWithdrawUnknownError(error: unknown): error is MoneyMarketUnknownError<'WITHDRAW_UNKNOWN_ERROR'>;
|
|
7552
7659
|
declare function isMoneyMarketRepayUnknownError(error: unknown): error is MoneyMarketUnknownError<'REPAY_UNKNOWN_ERROR'>;
|
|
7553
7660
|
|
|
7554
|
-
export { type AggregatedReserveData, type AssetInfo, type BaseCurrencyInfo, type BaseHubChainConfig, type BaseSpokeChainConfig, type BaseSpokeChainInfo, BigIntToHex, type BorrowInfo, type CreateIntentParams, type CustomProvider, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, type Default, EVM_CHAIN_IDS, EVM_SPOKE_CHAIN_IDS, Erc20Service, EvmAssetManagerService, type EvmChainId, type EvmContractCall, type EvmDepositToDataParams, type EvmHubChainConfig, EvmHubProvider, type EvmHubProviderConfig, type EvmInitializedConfig, type EvmReturnType, EvmSolverService, type EvmSpokeChainConfig, type EvmSpokeChainId, type EvmSpokeDepositParams, EvmSpokeProvider, EvmSpokeService, type EvmTransferParams, type EvmTransferToHubParams, type EvmTxReturnType, type EvmUninitializedBrowserConfig, type EvmUninitializedConfig, type EvmUninitializedPrivateKeyConfig, EvmVaultTokenService, EvmWalletAbstraction, type EvmWithdrawAssetDataParams, FEE_PERCENTAGE_SCALE, type FeeAmount, type FeeData, type GetAddressType, type GetMigrateParams, type GetMigrationFailedPayload, type GetMoneyMarketError, type GetMoneyMarketParams, type GetPacketParams, type GetPacketResponse, type
|
|
7661
|
+
export { type AggregatedReserveData, type AssetInfo, type BaseCurrencyInfo, type BaseHubChainConfig, type BaseSpokeChainConfig, type BaseSpokeChainInfo, BigIntToHex, type BorrowInfo, type CreateIntentParams, type CustomProvider, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, type Default, EVM_CHAIN_IDS, EVM_SPOKE_CHAIN_IDS, Erc20Service, EvmAssetManagerService, type EvmChainId, type EvmContractCall, type EvmDepositToDataParams, type EvmGasEstimate, type EvmHubChainConfig, EvmHubProvider, type EvmHubProviderConfig, type EvmInitializedConfig, type EvmReturnType, EvmSolverService, type EvmSpokeChainConfig, type EvmSpokeChainId, type EvmSpokeDepositParams, EvmSpokeProvider, EvmSpokeService, type EvmTransferParams, type EvmTransferToHubParams, type EvmTxReturnType, type EvmUninitializedBrowserConfig, type EvmUninitializedConfig, type EvmUninitializedPrivateKeyConfig, EvmVaultTokenService, EvmWalletAbstraction, type EvmWithdrawAssetDataParams, FEE_PERCENTAGE_SCALE, type FeeAmount, type FeeData, type GasEstimateType, type GetAddressType, type GetEstimateGasReturnType, type GetMigrateParams, type GetMigrationFailedPayload, type GetMoneyMarketError, type GetMoneyMarketParams, type GetPacketParams, type GetPacketResponse, type GetRelayRequestParamType, type GetRelayResponse, type GetRevertMigrationParams, type GetSpokeChainIdType, type GetSpokeDepositParamsType, type GetTransactionPacketsParams, type GetTransactionPacketsResponse, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type HashTxReturnType, type HttpPrefixedUrl, type HttpUrl, type HubAssetInfo, type HubChainConfig, type HubChainInfo, type HubTxHash, type HubVaultSymbol, HubVaultSymbols, ICON_TX_RESULT_WAIT_MAX_RETRY, INTENT_RELAY_CHAIN_IDS, type ISpokeProvider, type IWalletProvider, type IconAddress, type IconGasEstimate, type IconJsonRpcVersion, type IconRawTransaction, type IconReturnType, type IconSpokeChainConfig, IconSpokeProvider, type IcxCreateRevertMigrationParams, type IcxMigrateParams, IcxMigrationService, type IcxRawTransaction, type IcxRevertMigrationParams, type IcxTokenType, type InjectiveGasEstimate, type InjectiveReturnType, type InjectiveSpokeChainConfig, InjectiveSpokeProvider, type Intent, IntentCreatedEventAbi, type IntentCreatedEventLog, type IntentCreationFailedErrorData, type IntentData, IntentDataType, type IntentError, type IntentErrorCode, type IntentErrorData, type IntentRelayChainId, type IntentRelayRequest, type IntentRelayRequestParams, type IntentState, type IntentSubmitTxFailedErrorData, type IntentWaitUntilIntentExecutedFailedErrorData, IntentsAbi, type JsonRpcPayloadResponse, MAX_UINT256, type MigrationAction, type MigrationError, type MigrationErrorCode, type MigrationErrorData, type MigrationFailedErrorData, type MigrationParams, MigrationService, type MigrationServiceConfig, type MigrationTokens, type MoneyMarketAction, type MoneyMarketBorrowFailedError, type MoneyMarketBorrowParams, type MoneyMarketConfig, type MoneyMarketConfigParams, type MoneyMarketEncodeBorrowParams, type MoneyMarketEncodeRepayParams, type MoneyMarketEncodeRepayWithATokensParams, type MoneyMarketEncodeSupplyParams, type MoneyMarketEncodeWithdrawParams, type MoneyMarketError, type MoneyMarketErrorCode, type MoneyMarketExtraData, type MoneyMarketOptionalExtraData, type MoneyMarketParams, type MoneyMarketRepayFailedError, type MoneyMarketRepayParams, MoneyMarketService, type MoneyMarketServiceConfig, type MoneyMarketSubmitTxFailedError, type MoneyMarketSupplyFailedError, type MoneyMarketSupplyParams, type MoneyMarketUnknownError, type MoneyMarketUnknownErrorCode, type MoneyMarketWithdrawFailedError, type MoneyMarketWithdrawParams, type Optional, type PacketData, type PartnerFee, type PartnerFeeAmount, type PartnerFeeConfig, type PartnerFeePercentage, type Prettify, type PromiseEvmTxReturnType, type PromiseIconTxReturnType, type PromiseInjectiveTxReturnType, type PromiseSolanaTxReturnType, type PromiseStellarTxReturnType, type PromiseSuiTxReturnType, type PromiseTxReturnType, type QuoteType, type RawTxReturnType, type RelayAction, type RelayError, type RelayErrorCode, type RelayRequestDetail, type RelayRequestSigning, type RelayTxStatus, type RelayerApiConfig, type ReserveDataLegacy, type ResponseAddressType, type ResponseSigningType, type Result, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, Sodax, type SodaxConfig, type SolanaChainConfig, type SolanaGasEstimate, type SolanaRawTransaction, type SolanaReturnType, SolanaSpokeProvider, type SolverConfig, type SolverConfigParams, type SolverErrorResponse, type SolverExecutionRequest, type SolverExecutionResponse, SolverIntentErrorCode, type SolverIntentQuoteRequest, type SolverIntentQuoteResponse, type SolverIntentQuoteResponseRaw, SolverIntentStatusCode, type SolverIntentStatusRequest, type SolverIntentStatusResponse, SolverService, type SolverServiceConfig, type SonicSpokeChainConfig, type SonicSpokeDepositParams, SonicSpokeProvider, SonicSpokeService, type SpokeChainConfig, type SpokeChainInfo, type SpokeDepositParams, type SpokeProvider, SpokeService, type SpokeTokenSymbols, type SpokeTxHash, type StellarGasEstimate, type StellarReturnType, type StellarRpcConfig, type StellarSpokeChainConfig, StellarSpokeProvider, type SubmitTxParams, type SubmitTxResponse, type SuiGasEstimate, type SuiRawTransaction, type SuiReturnType, type SuiSpokeChainConfig, SuiSpokeProvider, type TokenInfo, type TxReturnType, type UserReserveData, VAULT_TOKEN_DECIMALS, type VaultReserves, type VaultType, type WaitUntilIntentExecutedPayload, WalletAbstractionService, type WithdrawInfo, assetManagerAbi, calculateFeeAmount, calculatePercentageFeeAmount, chainIdToHubAssetsMap, connectionAbi, encodeAddress, encodeContractCalls, erc20Abi, getEvmViemChain, getHubAssetInfo, getHubChainConfig, getIconAddressBytes, getIntentRelayChainId, getMoneyMarketConfig, getOriginalAssetAddress, getPacket, getRandomBytes, getSolanaAddressBytes, getSolverConfig, getSpokeChainIdFromIntentRelayChainId, getSupportedMoneyMarketTokens, getSupportedSolverTokens, getTransactionPackets, hexToBigInt, hubAssetToOriginalAssetMap, hubAssets, hubVaults, hubVaultsAddressSet, intentRelayChainIdToSpokeChainIdMap, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconSpokeProvider, isInjectiveSpokeProvider, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketReserveAsset, isMoneyMarketReserveHubAsset, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketSupportedToken, isMoneyMarketWithdrawUnknownError, isNativeToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSolanaSpokeProvider, isSolverSupportedToken, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isValidChainHubAsset, isValidHubAsset, isValidIntentRelayChainId, isValidOriginalAssetAddress, isValidSpokeChainId, isWaitUntilIntentExecutedFailed, moneyMarketReserveAssets, moneyMarketReserveHubAssetsSet, moneyMarketSupportedTokens, originalAssetTohubAssetMap, poolAbi, randomUint256, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainIdsSet, submitTransaction, supportedHubAssets, supportedHubChains, supportedSpokeChains, supportedTokensPerChain, uiPoolDataAbi, variableDebtTokenAbi, vaultTokenAbi, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|