@sodax/sdk 0.0.1-rc.12 → 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 +328 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +150 -43
- package/dist/index.d.ts +150 -43
- package/dist/index.mjs +328 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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 {
|
|
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
|
|
|
@@ -4099,22 +4103,23 @@ interface State {
|
|
|
4099
4103
|
hub_chain_id: string;
|
|
4100
4104
|
owner: string;
|
|
4101
4105
|
}
|
|
4102
|
-
declare class
|
|
4103
|
-
readonly walletProvider:
|
|
4104
|
-
chainConfig:
|
|
4105
|
-
|
|
4106
|
+
declare class InjectiveSpokeProvider implements ISpokeProvider {
|
|
4107
|
+
readonly walletProvider: IInjectiveWalletProvider;
|
|
4108
|
+
readonly chainConfig: InjectiveSpokeChainConfig;
|
|
4109
|
+
readonly txClient: TxGrpcClient;
|
|
4110
|
+
constructor(conf: InjectiveSpokeChainConfig, walletProvider: IInjectiveWalletProvider);
|
|
4106
4111
|
getState(): Promise<State>;
|
|
4107
4112
|
getBalance(token: String): Promise<number>;
|
|
4108
4113
|
private transfer;
|
|
4109
|
-
depositToken<R extends boolean = false>(sender: string, tokenAddress: string, to: Uint8Array, amount: string, data?: Uint8Array, raw?: R): Promise<
|
|
4110
|
-
static deposit<R extends boolean = false>(sender: string, token_address: string, to: Address, amount: string, data: Hex | undefined, provider:
|
|
4111
|
-
depositNative<R extends boolean = false>(sender: string, token: string, to: Uint8Array, amount: string, data?: Uint8Array, raw?: R): Promise<
|
|
4114
|
+
depositToken<R extends boolean = false>(sender: string, tokenAddress: string, to: Uint8Array, amount: string, data?: Uint8Array, raw?: R): Promise<InjectiveReturnType<R>>;
|
|
4115
|
+
static deposit<R extends boolean = false>(sender: string, token_address: string, to: Address, amount: string, data: Hex | undefined, provider: InjectiveSpokeProvider, raw?: R): PromiseInjectiveTxReturnType<R>;
|
|
4116
|
+
depositNative<R extends boolean = false>(sender: string, token: string, to: Uint8Array, amount: string, data?: Uint8Array, raw?: R): Promise<InjectiveReturnType<R>>;
|
|
4112
4117
|
isNative(token: string): Promise<boolean>;
|
|
4113
|
-
receiveMessage(senderAddress: string, srcChainId: string, srcAddress: Uint8Array, connSn: string, payload: Uint8Array, signatures: Uint8Array[]): Promise<
|
|
4114
|
-
setRateLimit(senderAddress: string, rateLimit: string): Promise<
|
|
4115
|
-
setConnection(senderAddress: string, connection: string): Promise<
|
|
4116
|
-
setOwner(senderAddress: string, owner: string): Promise<
|
|
4117
|
-
send_message<R extends boolean = false>(sender: string, dst_chain_id: string, dst_address: Hex, payload: Hex, raw?: R):
|
|
4118
|
+
receiveMessage(senderAddress: string, srcChainId: string, srcAddress: Uint8Array, connSn: string, payload: Uint8Array, signatures: Uint8Array[]): Promise<InjectiveExecuteResponse>;
|
|
4119
|
+
setRateLimit(senderAddress: string, rateLimit: string): Promise<InjectiveExecuteResponse>;
|
|
4120
|
+
setConnection(senderAddress: string, connection: string): Promise<InjectiveExecuteResponse>;
|
|
4121
|
+
setOwner(senderAddress: string, owner: string): Promise<InjectiveExecuteResponse>;
|
|
4122
|
+
send_message<R extends boolean = false>(sender: string, dst_chain_id: string, dst_address: Hex, payload: Hex, raw?: R): PromiseInjectiveTxReturnType<R>;
|
|
4118
4123
|
static stringToUint8Array(str: string): Uint8Array;
|
|
4119
4124
|
static uint8ArrayToString(arr: Uint8Array): string;
|
|
4120
4125
|
static toBigIntString(num: number | bigint): string;
|
|
@@ -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
|
|
@@ -5972,19 +6047,13 @@ declare class MigrationService {
|
|
|
5972
6047
|
createRevertMigrationIntent<R extends boolean = false>(params: IcxCreateRevertMigrationParams, spokeProvider: SonicSpokeProvider, raw?: R): Promise<Result<TxReturnType<SonicSpokeProvider, R>, MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'>>>;
|
|
5973
6048
|
}
|
|
5974
6049
|
|
|
5975
|
-
type CWSpokeDepositParams = {
|
|
5976
|
-
from: string;
|
|
5977
|
-
to?: HubAddress;
|
|
5978
|
-
token: string;
|
|
5979
|
-
amount: bigint;
|
|
5980
|
-
data: Hex;
|
|
5981
|
-
};
|
|
5982
|
-
|
|
5983
6050
|
declare class IconSpokeProvider {
|
|
5984
6051
|
readonly walletProvider: IIconWalletProvider;
|
|
5985
6052
|
readonly chainConfig: IconSpokeChainConfig;
|
|
5986
6053
|
readonly iconService: IconService;
|
|
5987
|
-
|
|
6054
|
+
readonly debugRpcUrl: HttpUrl;
|
|
6055
|
+
constructor(walletProvider: IIconWalletProvider, chainConfig: IconSpokeChainConfig, rpcUrl?: HttpUrl, // default to mainnet
|
|
6056
|
+
debugRpcUrl?: HttpUrl);
|
|
5988
6057
|
}
|
|
5989
6058
|
|
|
5990
6059
|
type IconSpokeDepositParams = {
|
|
@@ -6009,13 +6078,21 @@ type SolanaSpokeDepositParams = {
|
|
|
6009
6078
|
data: Hex;
|
|
6010
6079
|
};
|
|
6011
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
|
+
}
|
|
6012
6089
|
type StellarRpcConfig = {
|
|
6013
6090
|
horizonRpcUrl?: HttpUrl;
|
|
6014
6091
|
sorobanRpcUrl?: HttpUrl;
|
|
6015
6092
|
};
|
|
6016
6093
|
declare class StellarSpokeProvider implements ISpokeProvider {
|
|
6017
|
-
|
|
6018
|
-
|
|
6094
|
+
readonly server: Horizon.Server;
|
|
6095
|
+
readonly sorobanServer: CustomSorobanServer;
|
|
6019
6096
|
private readonly contract;
|
|
6020
6097
|
readonly chainConfig: StellarSpokeChainConfig;
|
|
6021
6098
|
readonly walletProvider: IStellarWalletProvider;
|
|
@@ -6055,11 +6132,12 @@ type SuiTxObject = {
|
|
|
6055
6132
|
declare class SuiSpokeProvider implements ISpokeProvider {
|
|
6056
6133
|
readonly walletProvider: ISuiWalletProvider;
|
|
6057
6134
|
chainConfig: SuiSpokeChainConfig;
|
|
6135
|
+
readonly publicClient: SuiClient;
|
|
6058
6136
|
constructor(config: SuiSpokeChainConfig, wallet_provider: ISuiWalletProvider);
|
|
6059
6137
|
getBalance(token: string): Promise<bigint>;
|
|
6060
6138
|
transfer<R extends boolean = false>(token: string, amount: bigint, to: Uint8Array, data: Uint8Array, raw?: R): PromiseSuiTxReturnType<R>;
|
|
6061
|
-
getNativeCoin(tx: Transaction, amount: bigint): Promise<SuiNativeCoinResult>;
|
|
6062
|
-
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>;
|
|
6063
6141
|
splitAddress(address: string): {
|
|
6064
6142
|
packageId: string;
|
|
6065
6143
|
moduleId: string;
|
|
@@ -6080,6 +6158,14 @@ type SuiSpokeDepositParams = {
|
|
|
6080
6158
|
data: Hex;
|
|
6081
6159
|
};
|
|
6082
6160
|
|
|
6161
|
+
type InjectiveSpokeDepositParams = {
|
|
6162
|
+
from: string;
|
|
6163
|
+
to?: HubAddress;
|
|
6164
|
+
token: string;
|
|
6165
|
+
amount: bigint;
|
|
6166
|
+
data: Hex;
|
|
6167
|
+
};
|
|
6168
|
+
|
|
6083
6169
|
type IntentRelayChainId = (typeof INTENT_RELAY_CHAIN_IDS)[keyof typeof INTENT_RELAY_CHAIN_IDS];
|
|
6084
6170
|
type EvmChainId = (typeof EVM_CHAIN_IDS)[number];
|
|
6085
6171
|
type EvmSpokeChainId = (typeof EVM_SPOKE_CHAIN_IDS)[number];
|
|
@@ -6172,7 +6258,7 @@ type SuiSpokeChainConfig = BaseSpokeChainConfig<'SUI'> & {
|
|
|
6172
6258
|
};
|
|
6173
6259
|
rpc_url: string;
|
|
6174
6260
|
};
|
|
6175
|
-
type
|
|
6261
|
+
type InjectiveSpokeChainConfig = BaseSpokeChainConfig<'INJECTIVE'> & {
|
|
6176
6262
|
rpcUrl: string;
|
|
6177
6263
|
walletAddress: string;
|
|
6178
6264
|
addresses: {
|
|
@@ -6187,7 +6273,7 @@ type CosmosSpokeChainConfig = BaseSpokeChainConfig<'INJECTIVE'> & {
|
|
|
6187
6273
|
gasPrice: string;
|
|
6188
6274
|
isBrowser: boolean;
|
|
6189
6275
|
networkId: string;
|
|
6190
|
-
network:
|
|
6276
|
+
network: InjectiveNetworkEnv;
|
|
6191
6277
|
};
|
|
6192
6278
|
type StellarSpokeChainConfig = BaseSpokeChainConfig<'STELLAR'> & {
|
|
6193
6279
|
addresses: {
|
|
@@ -6225,7 +6311,7 @@ type SolanaChainConfig = BaseSpokeChainConfig<'SOLANA'> & {
|
|
|
6225
6311
|
gasPrice: string;
|
|
6226
6312
|
};
|
|
6227
6313
|
type HubChainConfig = EvmHubChainConfig;
|
|
6228
|
-
type SpokeChainConfig = EvmSpokeChainConfig | SonicSpokeChainConfig |
|
|
6314
|
+
type SpokeChainConfig = EvmSpokeChainConfig | SonicSpokeChainConfig | InjectiveSpokeChainConfig | IconSpokeChainConfig | SuiSpokeChainConfig | StellarSpokeChainConfig | SolanaChainConfig;
|
|
6229
6315
|
type EvmContractCall = {
|
|
6230
6316
|
address: Address$1;
|
|
6231
6317
|
value: bigint;
|
|
@@ -6298,9 +6384,9 @@ type Result<T, E = Error | unknown> = {
|
|
|
6298
6384
|
error: E;
|
|
6299
6385
|
};
|
|
6300
6386
|
type HttpPrefixedUrl = `http${string}`;
|
|
6301
|
-
type SpokeDepositParams = EvmSpokeDepositParams |
|
|
6302
|
-
type GetSpokeDepositParamsType<T extends SpokeProvider> = T extends EvmSpokeProvider ? EvmSpokeDepositParams : T extends
|
|
6303
|
-
type GetAddressType<T extends SpokeProvider> = T extends EvmSpokeProvider ? Address$1 : T extends
|
|
6387
|
+
type SpokeDepositParams = EvmSpokeDepositParams | InjectiveSpokeDepositParams | IconSpokeDepositParams;
|
|
6388
|
+
type GetSpokeDepositParamsType<T extends SpokeProvider> = T extends EvmSpokeProvider ? EvmSpokeDepositParams : T extends InjectiveSpokeProvider ? InjectiveSpokeDepositParams : T extends SuiSpokeProvider ? SuiSpokeDepositParams : T extends IconSpokeProvider ? IconSpokeDepositParams : T extends StellarSpokeProvider ? StellarSpokeDepositParams : T extends SolanaSpokeProvider ? SolanaSpokeDepositParams : T extends SonicSpokeProvider ? SonicSpokeDepositParams : never;
|
|
6389
|
+
type GetAddressType<T extends SpokeProvider> = T extends EvmSpokeProvider ? Address$1 : T extends InjectiveSpokeProvider ? string : T extends StellarSpokeProvider ? Hex$1 : T extends IconSpokeProvider ? IconAddress : T extends SuiSpokeProvider ? Hex$1 : T extends SolanaSpokeProvider ? Hex$1 : T extends SonicSpokeProvider ? Address$1 : never;
|
|
6304
6390
|
type HttpUrl = `http://${string}` | `https://${string}`;
|
|
6305
6391
|
type SolverConfig = {
|
|
6306
6392
|
intentsContract: Address$1;
|
|
@@ -6401,17 +6487,17 @@ type SolanaReturnType<Raw extends boolean> = Raw extends true ? SolanaRawTransac
|
|
|
6401
6487
|
type StellarReturnType<Raw extends boolean> = Raw extends true ? StellarRawTransaction : string;
|
|
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
|
-
type
|
|
6405
|
-
type
|
|
6490
|
+
type InjectiveReturnType<Raw extends boolean> = Raw extends true ? InjectiveRawTransaction : Hex$1;
|
|
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
|
-
type
|
|
6412
|
-
type
|
|
6413
|
-
type GetRawTxReturnType<T extends ChainType> = T extends 'EVM' ? PromiseEvmTxReturnType<boolean> : never;
|
|
6414
|
-
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' ? PromiseCWTxReturnType<Raw> : never;
|
|
6499
|
+
type PromiseInjectiveTxReturnType<Raw extends boolean> = Promise<TxReturnType<InjectiveSpokeProvider, Raw>>;
|
|
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;
|
|
6417
6503
|
reserves: 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
|
|
|
@@ -6471,8 +6573,8 @@ declare class EvmSpokeProvider implements ISpokeProvider {
|
|
|
6471
6573
|
constructor(walletProvider: IEvmWalletProvider, chainConfig: EvmSpokeChainConfig, rpcUrl?: string);
|
|
6472
6574
|
}
|
|
6473
6575
|
|
|
6474
|
-
type IWalletProvider = IEvmWalletProvider |
|
|
6475
|
-
type SpokeProvider = (EvmSpokeProvider |
|
|
6576
|
+
type IWalletProvider = IEvmWalletProvider | IInjectiveWalletProvider | IStellarWalletProvider | ISuiWalletProvider | IIconWalletProvider | IInjectiveWalletProvider | ISolanaWalletProvider;
|
|
6577
|
+
type SpokeProvider = (EvmSpokeProvider | InjectiveSpokeProvider | IconSpokeProvider | SuiSpokeProvider | StellarSpokeProvider | SolanaSpokeProvider | SonicSpokeProvider) & ISpokeProvider;
|
|
6476
6578
|
|
|
6477
6579
|
declare function getSolanaAddressBytes(address: PublicKey): Hex;
|
|
6478
6580
|
|
|
@@ -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;
|
|
@@ -7530,7 +7637,7 @@ declare function isEvmSpokeProvider(value: SpokeProvider): value is EvmSpokeProv
|
|
|
7530
7637
|
declare function isSonicSpokeProvider(value: SpokeProvider): value is SonicSpokeProvider;
|
|
7531
7638
|
declare function isSolanaSpokeProvider(value: SpokeProvider): value is SolanaSpokeProvider;
|
|
7532
7639
|
declare function isStellarSpokeProvider(value: SpokeProvider): value is StellarSpokeProvider;
|
|
7533
|
-
declare function
|
|
7640
|
+
declare function isInjectiveSpokeProvider(value: SpokeProvider): value is InjectiveSpokeProvider;
|
|
7534
7641
|
declare function isIconSpokeProvider(value: SpokeProvider): value is IconSpokeProvider;
|
|
7535
7642
|
declare function isSuiSpokeProvider(value: SpokeProvider): value is SuiSpokeProvider;
|
|
7536
7643
|
declare function isConfiguredSolverConfig(value: SolverConfigParams): value is Prettify<SolverConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
|
|
@@ -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
|
|
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 };
|