@sodax/sdk 1.0.0-rc.7 → 1.0.1-beta-rc1

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.d.ts CHANGED
@@ -1,13 +1,14 @@
1
- import { IIconWalletProvider, IconSpokeChainConfig, HttpUrl, IconAddress, IInjectiveWalletProvider, InjectiveExecuteResponse, StellarSpokeChainConfig, IStellarWalletProvider, StellarRpcConfig, ISuiWalletProvider, SuiSpokeChainConfig, Address, Erc20Token, SpokeChainId, Token, GetMoneyMarketTokensApiResponse, ISolanaWalletProvider, SolanaChainConfig, IEvmWalletProvider, SpokeChainConfig, EvmSpokeChainConfig, SonicSpokeChainConfig, EvmHubChainConfig, EvmChainId, InjectiveSpokeChainConfig, AssetInfo, Hex as Hex$1, TokenInfo, HubAddress, EvmRawTransaction, InjectiveRawTransaction, SolanaBase58PublicKey, SolverConfig, Hash as Hash$1, IntentRelayChainId, StellarRawTransaction, MoneyMarketConfig, spokeChainConfig, ICON_MAINNET_CHAIN_ID, IConfigApi, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, GetSwapTokensByChainIdApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetHubAssetsApiResponse, GetHubAssetsByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, OriginalAssetAddress, HubAssetInfo, HubChainId, XToken, EvmRawTransactionReceipt, HubChainConfig, IconEoaAddress } from '@sodax/types';
1
+ import { IconAddress, IInjectiveWalletProvider, InjectiveExecuteResponse, SolanaChainConfig, SolanaBase58PublicKey, SolanaRpcResponseAndContext, SolanaTokenAmount, SolanaRawTransactionInstruction, WalletAddressProvider, SolanaSerializedTransaction, ISolanaWalletProvider, StellarSpokeChainConfig, StellarRpcConfig, IStellarWalletProvider, SuiSpokeChainConfig, SuiPaginatedCoins, SuiExecutionResult, ISuiWalletProvider, Address, Erc20Token, HttpUrl, SpokeChainId, Token, GetMoneyMarketTokensApiResponse, IconSpokeChainConfig, IIconWalletProvider, EvmHubChainConfig, EvmSpokeChainConfig, IEvmWalletProvider, SpokeChainConfig, SonicSpokeChainConfig, EvmChainId, InjectiveSpokeChainConfig, JsonObject, InjectiveRawTransaction, AssetInfo, Hex as Hex$1, TokenInfo, HubAddress, EvmRawTransaction, SolverConfig, Hash as Hash$1, IntentRelayChainId, StellarRawTransaction, MoneyMarketConfig, spokeChainConfig, ICON_MAINNET_CHAIN_ID, ChainType, BaseSpokeChainConfig, IConfigApi, GetAllConfigApiResponse, GetChainsApiResponse, GetSwapTokensApiResponse, GetSwapTokensByChainIdApiResponse, GetMoneyMarketReserveAssetsApiResponse, GetMoneyMarketTokensByChainIdApiResponse, GetHubAssetsApiResponse, GetHubAssetsByChainIdApiResponse, GetRelayChainIdMapApiResponse, GetSpokeChainConfigApiResponse, OriginalAssetAddress, HubAssetInfo, HubChainId, XToken, EvmRawTransactionReceipt, IconEoaAddress, HubChainConfig } from '@sodax/types';
2
2
  export * from '@sodax/types';
3
3
  import * as viem from 'viem';
4
4
  import { Hex, PublicClient, HttpTransport, Address as Address$1, WalletClient, CustomTransport, Chain, Account as Account$1, Hash, GetLogsReturnType, TransactionReceipt } from 'viem';
5
5
  import { IconService } from 'icon-sdk-js';
6
- import { SorobanRpc, rpc, Transaction, Memo, MemoType, Operation, FeeBumpTransaction, Horizon, Account, xdr } from '@stellar/stellar-sdk';
6
+ import { Connection, TransactionInstruction, PublicKey, Finality } from '@solana/web3.js';
7
7
  import { SuiClient } from '@mysten/sui/client';
8
8
  import { Transaction as Transaction$1, TransactionResult } from '@mysten/sui/transactions';
9
- import { TxGrpcApi } from '@injectivelabs/sdk-ts';
10
- import { PublicKey, Finality } from '@solana/web3.js';
9
+ import { SorobanRpc, rpc, Transaction, Memo, MemoType, Operation, FeeBumpTransaction, Horizon, Contract, Account, xdr } from '@stellar/stellar-sdk';
10
+ import { ChainGrpcWasmApi, TxGrpcApi } from '@injectivelabs/sdk-ts';
11
+ import { NetworkEndpoints } from '@injectivelabs/networks';
11
12
  import BigNumber$1 from 'bignumber.js';
12
13
 
13
14
  declare const assetManagerAbi: readonly [{
@@ -5363,15 +5364,6 @@ declare const stakingRouterAbi: readonly [{
5363
5364
  readonly type: "function";
5364
5365
  }];
5365
5366
 
5366
- declare class IconSpokeProvider {
5367
- readonly walletProvider: IIconWalletProvider;
5368
- readonly chainConfig: IconSpokeChainConfig;
5369
- readonly iconService: IconService;
5370
- readonly debugRpcUrl: HttpUrl;
5371
- constructor(walletProvider: IIconWalletProvider, chainConfig: IconSpokeChainConfig, rpcUrl?: HttpUrl, // default to mainnet
5372
- debugRpcUrl?: HttpUrl);
5373
- }
5374
-
5375
5367
  declare function getIconAddressBytes(address: string): Hex;
5376
5368
 
5377
5369
  type IconJsonRpcVersion = '2.0';
@@ -5448,7 +5440,44 @@ declare class Injective20Token {
5448
5440
  transferFrom(senderAddress: string, ownerAddress: string, recipientAddress: string, amount: string): Promise<InjectiveExecuteResponse>;
5449
5441
  }
5450
5442
 
5443
+ declare class SolanaBaseSpokeProvider {
5444
+ readonly chainConfig: SolanaChainConfig;
5445
+ constructor(chainConfig: SolanaChainConfig);
5446
+ static getBalance(connection: Connection, publicKey: SolanaBase58PublicKey): Promise<number>;
5447
+ static getTokenAccountBalance(connection: Connection, publicKey: SolanaBase58PublicKey): Promise<SolanaRpcResponseAndContext<SolanaTokenAmount>>;
5448
+ static getAssociatedTokenAddress(mint: SolanaBase58PublicKey, walletAddress: SolanaBase58PublicKey): Promise<SolanaBase58PublicKey>;
5449
+ static buildTransactionInstruction(rawInstructions: SolanaRawTransactionInstruction[]): TransactionInstruction[];
5450
+ }
5451
+ declare class SolanaSpokeProvider extends SolanaBaseSpokeProvider implements ISpokeProvider {
5452
+ readonly walletProvider: ISolanaWalletProvider;
5453
+ constructor(walletProvider: ISolanaWalletProvider, chainConfig: SolanaChainConfig);
5454
+ }
5455
+ type SolanaRawSpokeProviderConfig = {
5456
+ connection: {
5457
+ connection: Connection;
5458
+ } | {
5459
+ rpcUrl: string;
5460
+ };
5461
+ walletAddress: SolanaBase58PublicKey;
5462
+ chainConfig: SolanaChainConfig;
5463
+ };
5464
+ declare class SolanaRawSpokeProvider extends SolanaBaseSpokeProvider implements IRawSpokeProvider {
5465
+ readonly walletProvider: WalletAddressProvider & {
5466
+ buildV0Txn: (instructions: SolanaRawTransactionInstruction[]) => Promise<SolanaSerializedTransaction>;
5467
+ getBalance: (publicKey: SolanaBase58PublicKey) => Promise<number>;
5468
+ getTokenAccountBalance: (publicKey: SolanaBase58PublicKey) => Promise<SolanaRpcResponseAndContext<SolanaTokenAmount>>;
5469
+ getAssociatedTokenAddress: (mint: SolanaBase58PublicKey) => Promise<SolanaBase58PublicKey>;
5470
+ };
5471
+ readonly raw = true;
5472
+ readonly connection: Connection;
5473
+ constructor({ connection, walletAddress, chainConfig }: SolanaRawSpokeProviderConfig);
5474
+ buildV0Txn(rawInstructions: SolanaRawTransactionInstruction[]): Promise<SolanaSerializedTransaction>;
5475
+ }
5476
+
5451
5477
  declare function getSolanaAddressBytes(address: PublicKey): Hex;
5478
+ declare function hexToSolanaAddress(hex: Hex): PublicKey;
5479
+ declare function isSolanaNativeToken(address: PublicKey): boolean;
5480
+ declare function convertTransactionInstructionToRaw(instruction: TransactionInstruction): SolanaRawTransactionInstruction;
5452
5481
 
5453
5482
  declare class CustomSorobanServer extends SorobanRpc.Server {
5454
5483
  private customHeaders;
@@ -5475,24 +5504,32 @@ declare class CustomStellarAccount {
5475
5504
  decrementSequenceNumber(): void;
5476
5505
  resetSequenceNumber(): void;
5477
5506
  }
5478
- declare class StellarSpokeProvider implements ISpokeProvider {
5507
+ declare class StellarBaseSpokeProvider {
5479
5508
  readonly server: Horizon.Server;
5480
5509
  readonly sorobanServer: CustomSorobanServer;
5481
- private readonly contract;
5510
+ readonly contract: Contract;
5482
5511
  readonly chainConfig: StellarSpokeChainConfig;
5512
+ constructor(config: StellarSpokeChainConfig, rpcConfig?: StellarRpcConfig);
5513
+ static getBalance(tokenAddress: string, provider: StellarSpokeProviderType): Promise<number>;
5514
+ static buildPriorityStellarTransaction(account: CustomStellarAccount, network: rpc.Api.GetNetworkResponse, operation: xdr.Operation<Operation.InvokeHostFunction>, provider: StellarSpokeProviderType): Promise<[Transaction, rpc.Api.SimulateTransactionResponse]>;
5515
+ static deposit<S extends StellarSpokeProviderType, R extends boolean = false>(token: string, amount: string, recipient: Uint8Array, data: Uint8Array, provider: S, raw?: R): Promise<TxReturnType<S, R>>;
5516
+ static buildDepositCall(walletAddress: string, token: string, amount: string, recipient: Uint8Array, data: Uint8Array, provider: StellarSpokeProviderType): xdr.Operation<Operation.InvokeHostFunction>;
5517
+ static sendMessage<S extends StellarSpokeProviderType, R extends boolean = false>(dst_chain_id: string, dst_address: Uint8Array, payload: Uint8Array, provider: S, raw?: R): Promise<TxReturnType<S, R>>;
5518
+ static buildSendMessageCall(walletAddress: string, dst_chain_id: string, dst_address: Uint8Array, payload: Uint8Array, provider: StellarSpokeProviderType): xdr.Operation<Operation.InvokeHostFunction>;
5519
+ }
5520
+ declare class StellarRawSpokeProvider extends StellarBaseSpokeProvider implements IRawSpokeProvider {
5521
+ readonly walletProvider: WalletAddressProvider;
5522
+ readonly raw = true;
5523
+ constructor(walletAddress: string, chainConfig: StellarSpokeChainConfig, rpcConfig?: StellarRpcConfig);
5524
+ }
5525
+ declare class StellarSpokeProvider extends StellarBaseSpokeProvider implements ISpokeProvider {
5483
5526
  readonly walletProvider: IStellarWalletProvider;
5484
5527
  constructor(walletProvider: IStellarWalletProvider, config: StellarSpokeChainConfig, rpcConfig?: StellarRpcConfig);
5485
- getBalance(tokenAddress: string): Promise<number>;
5486
- buildPriorityStellarTransaction(account: CustomStellarAccount, network: rpc.Api.GetNetworkResponse, operation: xdr.Operation<Operation.InvokeHostFunction>): Promise<[Transaction, rpc.Api.SimulateTransactionResponse]>;
5487
5528
  private handleSendTransactionError;
5488
5529
  signAndSendTransaction(tx: Transaction | FeeBumpTransaction, waitForTransaction?: boolean): Promise<string>;
5489
5530
  private waitForTransaction;
5490
5531
  submitOrRestoreAndRetry(account: CustomStellarAccount, network: rpc.Api.GetNetworkResponse, tx: Transaction, operation: xdr.Operation<Operation.InvokeHostFunction>, simulation?: rpc.Api.SimulateTransactionResponse): Promise<string>;
5491
5532
  private handleSimulationRestore;
5492
- deposit<R extends boolean = false>(token: string, amount: string, recipient: Uint8Array, data: Uint8Array, raw?: R): PromiseStellarTxReturnType<R>;
5493
- sendMessage<R extends boolean = false>(dst_chain_id: string, dst_address: Uint8Array, payload: Uint8Array, raw?: R): PromiseStellarTxReturnType<R>;
5494
- private buildDepositCall;
5495
- private buildSendMessageCall;
5496
5533
  static getAddressBCSBytes(stellaraddress: string): Hex;
5497
5534
  static getTsWalletBytes(stellaraddress: string): Hex;
5498
5535
  }
@@ -5506,26 +5543,36 @@ type SuiTxObject = {
5506
5543
  Input: number;
5507
5544
  type?: 'object' | undefined;
5508
5545
  };
5509
- declare class SuiSpokeProvider implements ISpokeProvider {
5510
- readonly walletProvider: ISuiWalletProvider;
5546
+ declare class SuiBaseSpokeProvider {
5511
5547
  chainConfig: SuiSpokeChainConfig;
5512
5548
  readonly publicClient: SuiClient;
5513
- private assetManagerAddress;
5514
- constructor(config: SuiSpokeChainConfig, wallet_provider: ISuiWalletProvider);
5515
- getBalance(token: string): Promise<bigint>;
5516
- transfer<R extends boolean = false>(token: string, amount: bigint, to: Uint8Array, data: Uint8Array, raw?: R): PromiseSuiTxReturnType<R>;
5517
- getNativeCoin(tx: Transaction$1, amount: bigint): Promise<SuiNativeCoinResult>;
5549
+ assetManagerAddress: string | undefined;
5550
+ constructor(config: SuiSpokeChainConfig);
5551
+ getCoins(address: string, token: string): Promise<SuiPaginatedCoins>;
5518
5552
  getCoin(tx: Transaction$1, coin: string, amount: bigint, address: string): Promise<TransactionResult | SuiTxObject>;
5519
5553
  splitAddress(address: string): {
5520
5554
  packageId: string;
5521
5555
  moduleId: string;
5522
5556
  stateId: string;
5523
5557
  };
5524
- sendMessage<R extends boolean = false>(dst_chain_id: bigint, dst_address: Uint8Array, data: Uint8Array, raw?: R): PromiseSuiTxReturnType<R>;
5525
- configureAssetManagerHub(hubNetworkId: number, hubAssetManager: Uint8Array): Promise<string>;
5526
- getWalletAddress(): Promise<string>;
5558
+ getNativeCoin(tx: Transaction$1, amount: bigint): Promise<SuiNativeCoinResult>;
5527
5559
  static getAddressBCSBytes(suiaddress: string): Hex;
5528
5560
  getAssetManagerAddress(): Promise<string>;
5561
+ viewContract(tx: Transaction$1, packageId: string, module: string, functionName: string, args: unknown[], typeArgs: string[] | undefined, sender: string): Promise<SuiExecutionResult>;
5562
+ getBalance(walletAddress: string, token: string): Promise<bigint>;
5563
+ transfer<S extends SuiSpokeProviderType, R extends boolean = false>(token: string, amount: bigint, to: Uint8Array, data: Uint8Array, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
5564
+ sendMessage<S extends SuiSpokeProviderType, R extends boolean = false>(dst_chain_id: bigint, dst_address: Uint8Array, data: Uint8Array, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
5565
+ }
5566
+ declare class SuiRawSpokeProvider extends SuiBaseSpokeProvider implements IRawSpokeProvider {
5567
+ readonly walletProvider: WalletAddressProvider;
5568
+ readonly raw = true;
5569
+ constructor(chainConfig: SuiSpokeChainConfig, walletAddress: string);
5570
+ }
5571
+ declare class SuiSpokeProvider extends SuiBaseSpokeProvider implements ISpokeProvider {
5572
+ readonly walletProvider: ISuiWalletProvider;
5573
+ constructor(config: SuiSpokeChainConfig, wallet_provider: ISuiWalletProvider);
5574
+ configureAssetManagerHub(hubNetworkId: number, hubAssetManager: Uint8Array): Promise<string>;
5575
+ getWalletAddress(): Promise<string>;
5529
5576
  }
5530
5577
 
5531
5578
  type PoolBaseCurrencyHumanized = {
@@ -5989,6 +6036,7 @@ interface ReserveData {
5989
6036
  liquidityRate: string;
5990
6037
  totalScaledVariableDebt: string;
5991
6038
  lastUpdateTimestamp: number;
6039
+ aTokenAddress: string;
5992
6040
  borrowCap: string;
5993
6041
  supplyCap: string;
5994
6042
  debtCeiling: string;
@@ -6255,7 +6303,7 @@ declare class MoneyMarketDataService {
6255
6303
  /**
6256
6304
  * @description Util function to build the request for the formatReserves function
6257
6305
  */
6258
- buildReserveDataWithPrice(reserves: ReservesDataHumanized): FormatReservesUSDRequest<ReserveDataWithPrice>;
6306
+ buildReserveDataWithPrice(reserves: ReservesDataHumanized): FormatReservesUSDRequest<ReserveDataHumanized>;
6259
6307
  /**
6260
6308
  * @description Util function to build the request for the formatReserves function
6261
6309
  */
@@ -6274,9 +6322,7 @@ declare class MoneyMarketDataService {
6274
6322
  * @param {FormatReservesUSDRequest<ReserveDataWithPrice>} - the request parameters
6275
6323
  * @returns {FormatReserveUSDResponse<FormatReservesUSDRequest>} - an array of formatted configuration and live usage data for each reserve in a Sodax market
6276
6324
  */
6277
- formatReservesUSD(params: FormatReservesUSDRequest<ReserveDataWithPrice>): (ReserveData & {
6278
- priceInMarketReferenceCurrency: string;
6279
- } & FormatReserveUSDResponse)[];
6325
+ formatReservesUSD<T extends ReserveDataWithPrice>(params: FormatReservesUSDRequest<T>): FormatReserveUSDResponse[];
6280
6326
  /**
6281
6327
  * @description computes additional fields and normalizes numbers into human readable decimals
6282
6328
  * In addition to that it also converts the numbers to USD
@@ -6325,25 +6371,77 @@ type MoneyMarketEncodeRepayWithATokensParams = {
6325
6371
  interestRateMode: bigint;
6326
6372
  };
6327
6373
  type MoneyMarketAction = 'supply' | 'borrow' | 'withdraw' | 'repay';
6374
+ /**
6375
+ * Parameters for a Money Market supply operation.
6376
+ *
6377
+ * @property token - The source chain token address to supply.
6378
+ * @property amount - The amount of the asset to supply.
6379
+ * @property action - The action type ('supply').
6380
+ * @property toChainId - (Optional) Target spoke chain ID to receive the supplied assets.
6381
+ * Note: If omitted, assets are supplied to the sender's default spoke account.
6382
+ * @property toAddress - (Optional) The address on the target chain that will receive the supplied assets.
6383
+ * Note: If omitted, assets are supplied to the sender's default spoke account.
6384
+ */
6328
6385
  type MoneyMarketSupplyParams = {
6329
6386
  token: string;
6330
6387
  amount: bigint;
6331
6388
  action: 'supply';
6389
+ toChainId?: SpokeChainId;
6390
+ toAddress?: Address;
6332
6391
  };
6392
+ /**
6393
+ * Parameters for a Money Market borrow operation.
6394
+ *
6395
+ * @property token - The target chain token address to borrow.
6396
+ * @property amount - The amount of the asset to borrow.
6397
+ * @property action - Action type ('borrow').
6398
+ * @property toChainId - (Optional) Target chain ID to receive the borrowed assets.
6399
+ * Note: If omitted, borrowed assets are sent to the sender's default spoke account.
6400
+ * @property toAddress - (Optional) Target address on the taret chain to receive the borrowed assets.
6401
+ * Note: If omitted, borrowed assets are sent to the sender's default spoke account.
6402
+ */
6333
6403
  type MoneyMarketBorrowParams = {
6334
6404
  token: string;
6335
6405
  amount: bigint;
6336
6406
  action: 'borrow';
6407
+ toChainId?: SpokeChainId;
6408
+ toAddress?: Address;
6337
6409
  };
6410
+ /**
6411
+ * Parameters for a Money Market withdraw operation.
6412
+ *
6413
+ * @property token - The target chain token address to withdraw.
6414
+ * @property amount - The amount of the asset to withdraw.
6415
+ * @property action - The action type ('withdraw').
6416
+ * @property toChainId - (Optional) Target spoke chain ID to receive the withdrawn assets.
6417
+ * Note: If omitted, assets are sent to the sender's default spoke account.
6418
+ * @property toAddress - (Optional) Target address on the spoke chain to receive the withdrawn assets.
6419
+ * Note:If omitted, assets are sent to the sender's default spoke account.
6420
+ */
6338
6421
  type MoneyMarketWithdrawParams = {
6339
6422
  token: string;
6340
6423
  amount: bigint;
6341
6424
  action: 'withdraw';
6425
+ toChainId?: SpokeChainId;
6426
+ toAddress?: Address;
6342
6427
  };
6428
+ /**
6429
+ * Parameters for a Money Market repay operation.
6430
+ *
6431
+ * @property token - The source chain token address to repay.
6432
+ * @property amount - The amount of the asset to repay.
6433
+ * @property action - The action type ('repay').
6434
+ * @property toChainId - (Optional) Target spoke chain ID to receive the repaid assets.
6435
+ * Note: If omitted, assets are repaid to the sender's default spoke account.
6436
+ * @property toAddress - (Optional) Target address on the spoke chain to receive the repaid assets.
6437
+ * Note: If omitted, assets are repaid to the sender's default spoke account.
6438
+ */
6343
6439
  type MoneyMarketRepayParams = {
6344
6440
  token: string;
6345
6441
  amount: bigint;
6346
6442
  action: 'repay';
6443
+ toChainId?: SpokeChainId;
6444
+ toAddress?: Address;
6347
6445
  };
6348
6446
  type MoneyMarketParams = MoneyMarketSupplyParams | MoneyMarketBorrowParams | MoneyMarketWithdrawParams | MoneyMarketRepayParams;
6349
6447
  type MoneyMarketUnknownErrorCode = 'SUPPLY_UNKNOWN_ERROR' | 'BORROW_UNKNOWN_ERROR' | 'WITHDRAW_UNKNOWN_ERROR' | 'REPAY_UNKNOWN_ERROR';
@@ -6710,42 +6808,42 @@ declare class MoneyMarketService {
6710
6808
  createRepayIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketRepayParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketError<'CREATE_REPAY_INTENT_FAILED'>> & MoneyMarketOptionalExtraData>;
6711
6809
  /**
6712
6810
  * Build transaction data for supplying to the money market pool
6713
- * @param token - The address of the token on spoke chain
6714
- * @param to - The user wallet address on the hub chain
6811
+ * @param fromChainId - The chain ID of the source chain
6812
+ * @param fromToken - The address of the token on source chain
6715
6813
  * @param amount - The amount to deposit
6716
- * @param spokeChainId - The chain ID of the spoke chain
6814
+ * @param toHubAddress - The user wallet address on the hub chain
6717
6815
  * @returns {Hex} The transaction data.
6718
6816
  */
6719
- buildSupplyData(token: string, to: Address, amount: bigint, spokeChainId: SpokeChainId): Hex;
6817
+ buildSupplyData(fromChainId: SpokeChainId, fromToken: string, amount: bigint, toHubAddress: Address): Hex;
6720
6818
  /**
6721
6819
  * Build transaction data for borrowing from the money market pool
6722
- * @param from - The user wallet address on the hub chain
6723
- * @param to - The user wallet address on the spoke chain
6724
- * @param token - The address of the token to borrow
6820
+ * @param fromHubAddress - The hub address of the user to borrow from
6821
+ * @param toAddress - The user wallet address on the target chain
6822
+ * @param toToken - The address of the token on the target chain
6725
6823
  * @param amount - The amount to borrow in hub chain decimals
6726
- * @param spokeChainId - The chain ID of the spoke chain
6824
+ * @param toChainId - The chain ID of the target chain
6727
6825
  * @returns {Hex} The transaction data.
6728
6826
  */
6729
- buildBorrowData(from: Address, to: Address | Hex, token: string, amount: bigint, spokeChainId: SpokeChainId): Hex;
6827
+ buildBorrowData(fromHubAddress: Address, toAddress: Address, toToken: string, amount: bigint, toChainId: SpokeChainId): Hex;
6730
6828
  /**
6731
6829
  * Build transaction data for withdrawing from the money market pool
6732
- * @param from - The user wallet address on the hub chain
6733
- * @param to - The user wallet address on the spoke chain
6734
- * @param token - The address of the token to borrow
6735
- * @param amount - The amount to borrow in hub chain decimals
6736
- * @param spokeChainId - The chain ID of the spoke chain
6830
+ * @param fromHubAddress - The hub address of the user to withdraw from
6831
+ * @param toAddress - The user wallet address on the target chain
6832
+ * @param toToken - The address of the token on the target chain
6833
+ * @param amount - The amount to withdraw in hub chain decimals
6834
+ * @param toChainId - The chain ID of the target chain
6737
6835
  * @returns {Hex} The transaction data.
6738
6836
  */
6739
- buildWithdrawData(from: Address, to: Address, token: string, amount: bigint, spokeChainId: SpokeChainId): Hex;
6837
+ buildWithdrawData(fromHubAddress: Address, toAddress: Address, toToken: string, amount: bigint, toChainId: SpokeChainId): Hex;
6740
6838
  /**
6741
6839
  * Build transaction data for repaying to the money market pool
6742
- * @param token - The address of the token to repay
6743
- * @param to - The user wallet address on the hub chain
6840
+ * @param fromChainId - The chain ID of the source chain
6841
+ * @param fromToken - The address of the token on the source chain
6744
6842
  * @param amount - The amount to repay
6745
- * @param spokeChainId - The chain ID of the spoke chain
6843
+ * @param toHubAddress - The hub address of the user to repay to
6746
6844
  * @returns {Hex} The transaction data.
6747
6845
  */
6748
- buildRepayData(token: string, to: Address, amount: bigint, spokeChainId: SpokeChainId): Hex;
6846
+ buildRepayData(fromChainId: SpokeChainId, fromToken: string, amount: bigint, toHubAddress: Address): Hex;
6749
6847
  /**
6750
6848
  * Calculate aToken amount from actual amount using liquidityIndex
6751
6849
  * @param amount - The actual amount
@@ -6823,7 +6921,7 @@ declare class MoneyMarketService {
6823
6921
  }
6824
6922
 
6825
6923
  type SodaxConfig = {
6826
- swap?: SolverConfigParams;
6924
+ swaps?: SolverConfigParams;
6827
6925
  moneyMarket?: MoneyMarketConfigParams;
6828
6926
  migration?: MigrationServiceConfig;
6829
6927
  bridge?: BridgeServiceConfig;
@@ -6838,7 +6936,7 @@ type SodaxConfig = {
6838
6936
  */
6839
6937
  declare class Sodax {
6840
6938
  readonly instanceConfig?: SodaxConfig;
6841
- readonly swap: SwapService;
6939
+ readonly swaps: SwapService;
6842
6940
  readonly moneyMarket: MoneyMarketService;
6843
6941
  readonly migration: MigrationService;
6844
6942
  readonly backendApi: BackendApiService;
@@ -6857,10 +6955,22 @@ declare class Sodax {
6857
6955
  initialize(): Promise<Result<void>>;
6858
6956
  }
6859
6957
 
6860
- declare class SolanaSpokeProvider implements ISpokeProvider {
6861
- readonly walletProvider: ISolanaWalletProvider;
6862
- readonly chainConfig: SolanaChainConfig;
6863
- constructor(walletProvider: ISolanaWalletProvider, chainConfig: SolanaChainConfig);
6958
+ declare class IconBaseSpokeProvider {
6959
+ readonly chainConfig: IconSpokeChainConfig;
6960
+ readonly iconService: IconService;
6961
+ readonly debugRpcUrl: HttpUrl;
6962
+ constructor(chainConfig: IconSpokeChainConfig, rpcUrl?: HttpUrl, // default to mainnet
6963
+ debugRpcUrl?: HttpUrl);
6964
+ }
6965
+ declare class IconSpokeProvider extends IconBaseSpokeProvider implements ISpokeProvider {
6966
+ readonly walletProvider: IIconWalletProvider;
6967
+ constructor(walletProvider: IIconWalletProvider, chainConfig: IconSpokeChainConfig, rpcUrl?: HttpUrl, // default to mainnet
6968
+ debugRpcUrl?: HttpUrl);
6969
+ }
6970
+ declare class IconRawSpokeProvider extends IconBaseSpokeProvider implements IRawSpokeProvider {
6971
+ readonly walletProvider: WalletAddressProvider;
6972
+ readonly raw = true;
6973
+ constructor(chainConfig: IconSpokeChainConfig, walletAddress: string);
6864
6974
  }
6865
6975
 
6866
6976
  type CustomProvider = {
@@ -6870,6 +6980,11 @@ interface ISpokeProvider {
6870
6980
  readonly walletProvider: IWalletProvider;
6871
6981
  readonly chainConfig: SpokeChainConfig;
6872
6982
  }
6983
+ interface IRawSpokeProvider {
6984
+ readonly walletProvider: WalletAddressProvider;
6985
+ readonly chainConfig: SpokeChainConfig;
6986
+ readonly raw: true;
6987
+ }
6873
6988
  type EvmUninitializedBrowserConfig = {
6874
6989
  userAddress: Address$1;
6875
6990
  chain: EvmChainId;
@@ -6899,21 +7014,38 @@ declare class EvmHubProvider {
6899
7014
  readonly configService: ConfigService;
6900
7015
  constructor({ config, configService }: EvmHubProviderConstructorParams);
6901
7016
  }
6902
- declare class SonicSpokeProvider implements ISpokeProvider {
6903
- readonly walletProvider: IEvmWalletProvider;
6904
- readonly chainConfig: SonicSpokeChainConfig;
7017
+ declare class SonicBaseSpokeProvider {
6905
7018
  readonly publicClient: PublicClient<HttpTransport>;
6906
- constructor(walletProvider: IEvmWalletProvider, chainConfig: SonicSpokeChainConfig, rpcUrl?: string);
7019
+ readonly chainConfig: SonicSpokeChainConfig;
7020
+ constructor(chainConfig: SonicSpokeChainConfig, rpcUrl?: string);
6907
7021
  }
6908
- declare class EvmSpokeProvider implements ISpokeProvider {
7022
+ declare class SonicSpokeProvider extends SonicBaseSpokeProvider implements ISpokeProvider {
6909
7023
  readonly walletProvider: IEvmWalletProvider;
6910
- readonly chainConfig: EvmSpokeChainConfig;
7024
+ constructor(walletProvider: IEvmWalletProvider, chainConfig: SonicSpokeChainConfig, rpcUrl?: string);
7025
+ }
7026
+ declare class SonicRawSpokeProvider extends SonicBaseSpokeProvider implements IRawSpokeProvider {
7027
+ readonly walletProvider: WalletAddressProvider;
7028
+ readonly raw = true;
7029
+ constructor(walletAddress: Address$1, chainConfig: SonicSpokeChainConfig, rpcUrl?: string);
7030
+ }
7031
+ declare class EvmBaseSpokeProvider {
6911
7032
  readonly publicClient: PublicClient<HttpTransport>;
7033
+ readonly chainConfig: EvmSpokeChainConfig;
7034
+ constructor(chainConfig: EvmSpokeChainConfig, rpcUrl?: string);
7035
+ }
7036
+ declare class EvmSpokeProvider extends EvmBaseSpokeProvider implements ISpokeProvider {
7037
+ readonly walletProvider: IEvmWalletProvider;
6912
7038
  constructor(walletProvider: IEvmWalletProvider, chainConfig: EvmSpokeChainConfig, rpcUrl?: string);
6913
7039
  }
6914
-
7040
+ declare class EvmRawSpokeProvider extends EvmBaseSpokeProvider implements IRawSpokeProvider {
7041
+ readonly walletProvider: WalletAddressProvider;
7042
+ readonly raw = true;
7043
+ constructor(walletAddress: Address$1, chainConfig: EvmSpokeChainConfig, rpcUrl?: string);
7044
+ }
6915
7045
  type IWalletProvider = IEvmWalletProvider | IInjectiveWalletProvider | IStellarWalletProvider | ISuiWalletProvider | IIconWalletProvider | IInjectiveWalletProvider | ISolanaWalletProvider;
6916
7046
  type SpokeProvider = (EvmSpokeProvider | InjectiveSpokeProvider | IconSpokeProvider | SuiSpokeProvider | StellarSpokeProvider | SolanaSpokeProvider | SonicSpokeProvider) & ISpokeProvider;
7047
+ type RawSpokeProvider = (EvmRawSpokeProvider | InjectiveRawSpokeProvider | IconRawSpokeProvider | SuiRawSpokeProvider | StellarRawSpokeProvider | SolanaRawSpokeProvider | SonicRawSpokeProvider) & IRawSpokeProvider;
7048
+ type SpokeProviderType = SpokeProvider | RawSpokeProvider;
6917
7049
 
6918
7050
  interface InstantiateMsg {
6919
7051
  connection: string;
@@ -6962,28 +7094,204 @@ interface State {
6962
7094
  hub_chain_id: string;
6963
7095
  owner: string;
6964
7096
  }
6965
- declare class InjectiveSpokeProvider implements ISpokeProvider {
6966
- readonly walletProvider: IInjectiveWalletProvider;
7097
+ declare class InjectiveBaseSpokeProvider {
6967
7098
  readonly chainConfig: InjectiveSpokeChainConfig;
6968
- private chainGrpcWasmApi;
7099
+ readonly chainGrpcWasmApi: ChainGrpcWasmApi;
6969
7100
  readonly txClient: TxGrpcApi;
6970
- constructor(conf: InjectiveSpokeChainConfig, walletProvider: IInjectiveWalletProvider);
7101
+ readonly endpoints: NetworkEndpoints;
7102
+ constructor(chainConfig: InjectiveSpokeChainConfig);
6971
7103
  getState(): Promise<State>;
6972
7104
  getBalance(token: String): Promise<number>;
7105
+ getRawTransaction(chainId: string, _: string, senderAddress: string, contractAddress: string, msg: JsonObject, memo?: string): Promise<InjectiveRawTransaction>;
7106
+ send_message<S extends InjectiveSpokeProviderType, R extends boolean = false>(sender: string, dst_chain_id: string, dst_address: Hex, payload: Hex, spokeProvider: S, raw?: R): Promise<TxReturnType<InjectiveSpokeProviderType, R>>;
7107
+ }
7108
+ declare class InjectiveRawSpokeProvider extends InjectiveBaseSpokeProvider implements IRawSpokeProvider {
7109
+ readonly walletProvider: WalletAddressProvider;
7110
+ readonly raw = true;
7111
+ constructor(chainConfig: InjectiveSpokeChainConfig, walletAddress: string);
7112
+ }
7113
+ declare class InjectiveSpokeProvider extends InjectiveBaseSpokeProvider implements ISpokeProvider {
7114
+ readonly walletProvider: IInjectiveWalletProvider;
7115
+ constructor(conf: InjectiveSpokeChainConfig, walletProvider: IInjectiveWalletProvider);
6973
7116
  /**
6974
7117
  * Deposit tokens including native token to Injective Asset Manager.
6975
7118
  **/
6976
- static deposit<R extends boolean = false>(sender: string, token_address: string, to: Address$1, amount: string, data: Hex | undefined, spokeProvider: InjectiveSpokeProvider, raw?: R): PromiseInjectiveTxReturnType<R>;
7119
+ static deposit<S extends InjectiveSpokeProviderType, R extends boolean = false>(sender: string, token_address: string, to: Address$1, amount: string, data: Hex | undefined, spokeProvider: S, raw?: R): Promise<TxReturnType<InjectiveSpokeProviderType, R>>;
6977
7120
  receiveMessage(senderAddress: string, srcChainId: string, srcAddress: Uint8Array, connSn: string, payload: Uint8Array, signatures: Uint8Array[]): Promise<InjectiveExecuteResponse>;
6978
7121
  setRateLimit(senderAddress: string, rateLimit: string): Promise<InjectiveExecuteResponse>;
6979
7122
  setConnection(senderAddress: string, connection: string): Promise<InjectiveExecuteResponse>;
6980
7123
  setOwner(senderAddress: string, owner: string): Promise<InjectiveExecuteResponse>;
6981
- send_message<R extends boolean = false>(sender: string, dst_chain_id: string, dst_address: Hex, payload: Hex, raw?: R): PromiseInjectiveTxReturnType<R>;
6982
7124
  static stringToUint8Array(str: string): Uint8Array;
6983
7125
  static uint8ArrayToString(arr: Uint8Array): string;
6984
7126
  static toBigIntString(num: number | bigint): string;
6985
7127
  }
6986
7128
 
7129
+ declare const DEFAULT_MAX_RETRY = 3;
7130
+ declare const DEFAULT_RELAY_TX_TIMEOUT = 120000;
7131
+ declare const DEFAULT_RETRY_DELAY_MS = 2000;
7132
+ declare const ICON_TX_RESULT_WAIT_MAX_RETRY = 10;
7133
+ declare const MAX_UINT256: bigint;
7134
+ declare const FEE_PERCENTAGE_SCALE = 10000n;
7135
+ declare const STELLAR_PRIORITY_FEE = "10000";
7136
+ declare const STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = 100;
7137
+ declare const DEFAULT_DEADLINE_OFFSET = 300n;
7138
+ declare const DEFAULT_BACKEND_API_ENDPOINT = "https://api.sodax.com/v1/be";
7139
+ declare const DEFAULT_BACKEND_API_TIMEOUT = 30000;
7140
+ declare const DEFAULT_BACKEND_API_HEADERS: {
7141
+ 'Content-Type': string;
7142
+ Accept: string;
7143
+ };
7144
+ declare const DEFAULT_RELAYER_API_ENDPOINT = "https://xcall-relay.nw.iconblockchain.xyz";
7145
+ declare const VAULT_TOKEN_DECIMALS = 18;
7146
+ declare const hyper: {
7147
+ blockExplorers: {
7148
+ readonly default: {
7149
+ readonly name: "HyperEVMScan";
7150
+ readonly url: "https://hyperevmscan.io/";
7151
+ };
7152
+ };
7153
+ contracts: {
7154
+ readonly multicall3: {
7155
+ readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
7156
+ readonly blockCreated: 13051;
7157
+ };
7158
+ };
7159
+ ensTlds?: readonly string[] | undefined;
7160
+ id: 999;
7161
+ name: "HyperEVM";
7162
+ nativeCurrency: {
7163
+ readonly decimals: 18;
7164
+ readonly name: "HYPE";
7165
+ readonly symbol: "HYPE";
7166
+ };
7167
+ rpcUrls: {
7168
+ readonly default: {
7169
+ readonly http: readonly ["https://rpc.hyperliquid.xyz/evm"];
7170
+ };
7171
+ };
7172
+ sourceId?: number | undefined;
7173
+ testnet?: boolean | undefined;
7174
+ custom?: Record<string, unknown> | undefined;
7175
+ fees?: viem.ChainFees<undefined> | undefined;
7176
+ formatters?: undefined;
7177
+ serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
7178
+ };
7179
+ declare function getEvmViemChain(id: EvmChainId): Chain;
7180
+ declare const bnUSDLegacySpokeChainIds: readonly ["0x1.icon", "sui", "stellar"];
7181
+ declare const newbnUSDSpokeChainIds: ("0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "sonic" | "0xa.optimism" | "0x89.polygon" | "hyper" | "lightlink" | "ethereum" | "sui" | "stellar" | "injective-1" | "solana")[];
7182
+ declare const bnUSDLegacyTokens: readonly [{
7183
+ readonly symbol: "bnUSD (legacy)";
7184
+ readonly name: "bnUSD";
7185
+ readonly decimals: 18;
7186
+ readonly address: "cx88fd7df7ddff82f7cc735c871dc519838cb235bb";
7187
+ readonly xChainId: "0x1.icon";
7188
+ }, {
7189
+ readonly symbol: "bnUSD (legacy)";
7190
+ readonly name: "legacybnUSD";
7191
+ readonly decimals: 9;
7192
+ readonly address: "0x03917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR";
7193
+ readonly xChainId: "sui";
7194
+ }, {
7195
+ readonly symbol: "bnUSD (legacy)";
7196
+ readonly name: "legacybnUSD";
7197
+ readonly decimals: 18;
7198
+ readonly address: "CCT4ZYIYZ3TUO2AWQFEOFGBZ6HQP3GW5TA37CK7CRZVFRDXYTHTYX7KP";
7199
+ readonly xChainId: "stellar";
7200
+ }];
7201
+ declare const bnUSDNewTokens: ({
7202
+ readonly symbol: "bnUSD";
7203
+ readonly name: "bnUSD";
7204
+ readonly decimals: 9;
7205
+ readonly address: "0xff4de2b2b57dd7611d2812d231a467d007b702a101fd5c7ad3b278257cddb507::bnusd::BNUSD";
7206
+ readonly xChainId: "sui";
7207
+ } | {
7208
+ readonly symbol: "bnUSD";
7209
+ readonly name: "bnUSD";
7210
+ readonly decimals: 7;
7211
+ readonly address: "CD6YBFFWMU2UJHX2NGRJ7RN76IJVTCC7MRA46DUBXNB7E6W7H7JRJ2CX";
7212
+ readonly xChainId: "stellar";
7213
+ } | {
7214
+ readonly symbol: "bnUSD";
7215
+ readonly name: "bnUSD";
7216
+ readonly decimals: 18;
7217
+ readonly address: "0x6958a4CBFe11406E2a1c1d3a71A1971aD8B3b92F";
7218
+ readonly xChainId: "0xa86a.avax";
7219
+ } | {
7220
+ readonly symbol: "bnUSD";
7221
+ readonly name: "bnUSD";
7222
+ readonly decimals: 18;
7223
+ readonly address: "0xA256dd181C3f6E5eC68C6869f5D50a712d47212e";
7224
+ readonly xChainId: "0xa4b1.arbitrum";
7225
+ } | {
7226
+ readonly symbol: "bnUSD";
7227
+ readonly name: "bnUSD";
7228
+ readonly decimals: 18;
7229
+ readonly address: "0xAcfab3F31C0a18559D78556BBf297EC29c6cf8aa";
7230
+ readonly xChainId: "0x2105.base";
7231
+ } | {
7232
+ readonly symbol: "bnUSD";
7233
+ readonly name: "bnUSD";
7234
+ readonly decimals: 18;
7235
+ readonly address: "0x8428FedC020737a5A2291F46cB1B80613eD71638";
7236
+ readonly xChainId: "0x38.bsc";
7237
+ } | {
7238
+ readonly symbol: "bnUSD";
7239
+ readonly name: "Balanced Dollar";
7240
+ readonly decimals: 18;
7241
+ readonly address: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131";
7242
+ readonly xChainId: "sonic";
7243
+ } | {
7244
+ readonly symbol: "bnUSD";
7245
+ readonly name: "bnUSD";
7246
+ readonly decimals: 18;
7247
+ readonly address: "0xF4f7dC27c17470a26d0de9039Cf0EA5045F100E8";
7248
+ readonly xChainId: "0xa.optimism";
7249
+ } | {
7250
+ readonly symbol: "bnUSD";
7251
+ readonly name: "bnUSD";
7252
+ readonly decimals: 18;
7253
+ readonly address: "0x39E77f86C1B1f3fbAb362A82b49D2E86C09659B4";
7254
+ readonly xChainId: "0x89.polygon";
7255
+ } | {
7256
+ readonly symbol: "bnUSD";
7257
+ readonly name: "bnUSD";
7258
+ readonly decimals: 18;
7259
+ readonly address: "0x506Ba7C8d91dAdf7a91eE677a205D9687b751579";
7260
+ readonly xChainId: "hyper";
7261
+ } | {
7262
+ readonly symbol: "bnUSD";
7263
+ readonly name: "bnUSD";
7264
+ readonly decimals: 18;
7265
+ readonly address: "0x36134A03dcD03Bbe858B8F7ED28a71AAC608F9E7";
7266
+ readonly xChainId: "lightlink";
7267
+ } | {
7268
+ readonly symbol: "bnUSD";
7269
+ readonly name: "bnUSD";
7270
+ readonly decimals: 18;
7271
+ readonly address: "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13";
7272
+ readonly xChainId: "ethereum";
7273
+ } | {
7274
+ readonly symbol: "bnUSD";
7275
+ readonly name: "bnUSD";
7276
+ readonly decimals: 18;
7277
+ readonly address: "factory/inj1d036ftaatxpkqsu9hja8r24rv3v33chz3appxp/bnUSD";
7278
+ readonly xChainId: "injective-1";
7279
+ } | {
7280
+ readonly symbol: "bnUSD";
7281
+ readonly name: "bnUSD";
7282
+ readonly decimals: 9;
7283
+ readonly address: "3rSPCLNEF7Quw4wX8S1NyKivELoyij8eYA2gJwBgt4V5";
7284
+ readonly xChainId: "solana";
7285
+ })[];
7286
+ declare const isLegacybnUSDChainId: (chainId: SpokeChainId) => boolean;
7287
+ declare const isNewbnUSDChainId: (chainId: SpokeChainId) => boolean;
7288
+ declare const isLegacybnUSDToken: (token: Token | string) => boolean;
7289
+ declare const isNewbnUSDToken: (token: Token | string) => boolean;
7290
+ declare const getAllLegacybnUSDTokens: () => {
7291
+ token: LegacybnUSDToken;
7292
+ chainId: LegacybnUSDChainId;
7293
+ }[];
7294
+
6987
7295
  type EvmDepositToDataParams = {
6988
7296
  token: Hex | string;
6989
7297
  to: Address$1;
@@ -7142,7 +7450,7 @@ declare class WalletAbstractionService {
7142
7450
  * @param hubProvider - The provider for interacting with the hub chain
7143
7451
  * @returns The user's hub wallet address
7144
7452
  */
7145
- static getUserAbstractedWalletAddress(address: string, spokeProvider: SpokeProvider, hubProvider: EvmHubProvider): Promise<Address>;
7453
+ static getUserAbstractedWalletAddress(address: string, spokeProvider: SpokeProviderType, hubProvider: EvmHubProvider): Promise<Address>;
7146
7454
  }
7147
7455
 
7148
7456
  type EvmSpokeDepositParams = {
@@ -7161,7 +7469,7 @@ declare class EvmSpokeService {
7161
7469
  * - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
7162
7470
  *
7163
7471
  * @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
7164
- * @param {EvmSpokeProvider} spokeProvider - The EVM spoke provider.
7472
+ * @param {EvmSpokeProviderType} spokeProvider - The EVM spoke provider.
7165
7473
  * @returns {Promise<bigint>} Estimated gas for the transaction.
7166
7474
  *
7167
7475
  * @example
@@ -7177,40 +7485,40 @@ declare class EvmSpokeService {
7177
7485
  * const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
7178
7486
  * console.log(`Estimated gas: ${estimatedGas}`);
7179
7487
  */
7180
- static estimateGas(rawTx: EvmRawTransaction, spokeProvider: EvmSpokeProvider): Promise<bigint>;
7488
+ static estimateGas(rawTx: EvmRawTransaction, spokeProvider: EvmSpokeProviderType): Promise<bigint>;
7181
7489
  /**
7182
7490
  * Deposit tokens to the spoke chain.
7183
7491
  * @param {EvmSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
7184
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
7492
+ * @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
7185
7493
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7186
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
7494
+ * @returns {Promise<TxReturnType<EvmSpokeProviderType, R>>} A promise that resolves to the transaction hash.
7187
7495
  */
7188
- static deposit<R extends boolean = false>(params: EvmSpokeDepositParams, spokeProvider: EvmSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseEvmTxReturnType<R>;
7496
+ static deposit<R extends boolean = false>(params: EvmSpokeDepositParams, spokeProvider: EvmSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<EvmSpokeProviderType, R>>;
7189
7497
  /**
7190
7498
  * Get the balance of the token in the spoke chain.
7191
7499
  * @param {Address} token - The address of the token to get the balance of.
7192
- * @param {EvmSpokeProvider} spokeProvider - The spoke provider.
7500
+ * @param {EvmSpokeProviderType} spokeProvider - The spoke provider.
7193
7501
  * @returns {Promise<bigint>} The balance of the token.
7194
7502
  */
7195
- static getDeposit(token: Address$1, spokeProvider: EvmSpokeProvider): Promise<bigint>;
7503
+ static getDeposit(token: Address$1, spokeProvider: EvmSpokeProviderType): Promise<bigint>;
7196
7504
  /**
7197
7505
  * Generate simulation parameters for deposit from EvmSpokeDepositParams.
7198
7506
  * @param {EvmSpokeDepositParams} params - The deposit parameters.
7199
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
7507
+ * @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
7200
7508
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7201
7509
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
7202
7510
  */
7203
- static getSimulateDepositParams(params: EvmSpokeDepositParams, spokeProvider: EvmSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7511
+ static getSimulateDepositParams(params: EvmSpokeDepositParams, spokeProvider: EvmSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7204
7512
  /**
7205
7513
  * Calls a contract on the spoke chain using the user's wallet.
7206
7514
  * @param {HubAddress} from - The address of the user on the hub chain.
7207
7515
  * @param {Hex} payload - The payload to send to the contract.
7208
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
7516
+ * @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
7209
7517
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7210
7518
  * @param {boolean} raw - The return type raw or just transaction hash
7211
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
7519
+ * @returns {Promise<TxReturnType<EvmSpokeProviderType, R>>} A promise that resolves to the transaction hash.
7212
7520
  */
7213
- static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider: EvmSpokeProvider, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<EvmSpokeProvider, R>>;
7521
+ static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider: EvmSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<EvmSpokeProviderType, R>>;
7214
7522
  /**
7215
7523
  * Transfers tokens to the hub chain.
7216
7524
  * @param {EvmTransferToHubParams} params - The parameters for the transfer, including:
@@ -7218,9 +7526,9 @@ declare class EvmSpokeService {
7218
7526
  * - {Address} recipient: The recipient address on the hub chain.
7219
7527
  * - {bigint} amount: The amount to transfer.
7220
7528
  * - {Hex} [data="0x"]: Additional data for the transfer.
7221
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
7529
+ * @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
7222
7530
  * @param {boolean} raw - The return type raw or just transaction hash
7223
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
7531
+ * @returns {Promise<TxReturnType<EvmSpokeProviderType, R>>} A promise that resolves to the transaction hash.
7224
7532
  */
7225
7533
  private static transfer;
7226
7534
  /**
@@ -7228,9 +7536,9 @@ declare class EvmSpokeService {
7228
7536
  * @param {bigint} dstChainId - The chain ID of the hub chain.
7229
7537
  * @param {Address} dstAddress - The address on the hub chain.
7230
7538
  * @param {Hex} payload - The payload to send.
7231
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
7539
+ * @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
7232
7540
  * @param {boolean} raw - The return type raw or just transaction hash
7233
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
7541
+ * @returns {Promise<TxReturnType<EvmSpokeProviderType, R>>} A promise that resolves to the transaction hash.
7234
7542
  */
7235
7543
  private static call;
7236
7544
  }
@@ -7247,7 +7555,7 @@ declare class SpokeService {
7247
7555
  * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
7248
7556
  * @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
7249
7557
  */
7250
- static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
7558
+ static estimateGas<T extends SpokeProviderType>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
7251
7559
  /**
7252
7560
 
7253
7561
  * Encodes transfer data using RLP encoding to match Solidity Transfer struct.
@@ -7283,28 +7591,28 @@ declare class SpokeService {
7283
7591
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7284
7592
  * @param {boolean} raw - Whether to return raw transaction data.
7285
7593
  * @param {boolean} skipSimulation - Whether to skip deposit simulation (optional, defaults to false).
7286
- * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
7594
+ * @returns {Promise<TxReturnType<T, R>>} A promise that resolves to the transaction hash.
7287
7595
  */
7288
- static deposit<T extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: GetSpokeDepositParamsType<T>, spokeProvider: T, hubProvider: EvmHubProvider, raw?: R, skipSimulation?: boolean): Promise<PromiseTxReturnType<T, R>>;
7289
- static getSimulateDepositParams<S extends SpokeProvider>(params: GetSpokeDepositParamsType<S>, spokeProvider: S, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7290
- static verifyDepositSimulation<S extends SpokeProvider>(params: GetSpokeDepositParamsType<S>, spokeProvider: S, hubProvider: EvmHubProvider, skipSimulation: boolean): Promise<void>;
7596
+ static deposit<S extends SpokeProviderType, R extends boolean = false>(params: GetSpokeDepositParamsType<S>, spokeProvider: S, hubProvider: EvmHubProvider, raw?: R, skipSimulation?: boolean): Promise<TxReturnType<S, R>>;
7597
+ static getSimulateDepositParams<S extends SpokeProviderType>(params: GetSpokeDepositParamsType<S>, spokeProvider: S, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7598
+ static verifyDepositSimulation<S extends SpokeProviderType>(params: GetSpokeDepositParamsType<S>, spokeProvider: S, hubProvider: EvmHubProvider, skipSimulation: boolean): Promise<void>;
7291
7599
  /**
7292
7600
  * Get the balance of the token in the spoke chain.
7293
7601
  * @param {Address} token - The address of the token to get the balance of.
7294
- * @param {SpokeProvider} spokeProvider - The spoke provider.
7602
+ * @param {SpokeProviderType} spokeProvider - The spoke provider.
7295
7603
  * @returns {Promise<bigint>} The balance of the token.
7296
7604
  */
7297
- static getDeposit(token: Address, spokeProvider: SpokeProvider): Promise<bigint>;
7605
+ static getDeposit(token: Address, spokeProvider: SpokeProviderType): Promise<bigint>;
7298
7606
  /**
7299
- * Calls a contract on the spoke chain using the user's wallet.
7607
+ * Calls the connection contract on the spoke chain to send a message to the hub wallet, which then executes the message's payload.
7300
7608
  * @param {HubAddress} from - The address of the user on the hub chain.
7301
7609
  * @param {Hex} payload - The payload to send to the contract.
7302
- * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
7610
+ * @param {SpokeProviderType} spokeProvider - The provider for the spoke chain.
7303
7611
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7304
7612
  * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
7305
7613
  */
7306
- static callWallet<T extends SpokeProvider = SpokeProvider, R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider: T, hubProvider: EvmHubProvider, raw?: R, skipSimulation?: boolean): Promise<TxReturnType<T, R>>;
7307
- static verifySimulation(from: HubAddress, payload: Hex$1, spokeProvider: SpokeProvider, hubProvider: EvmHubProvider, skipSimulation: boolean): Promise<void>;
7614
+ static callWallet<T extends SpokeProviderType, R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider: T, hubProvider: EvmHubProvider, raw?: R, skipSimulation?: boolean): Promise<TxReturnType<T, R>>;
7615
+ static verifySimulation(from: HubAddress, payload: Hex$1, spokeProvider: SpokeProviderType, hubProvider: EvmHubProvider, skipSimulation: boolean): Promise<void>;
7308
7616
  /**
7309
7617
  * Verifies the transaction hash for the spoke chain to exist on chain.
7310
7618
  * Only stellar and solana need to be verified. For other chains, we assume the transaction exists on chain.
@@ -7330,41 +7638,41 @@ type IconTransferToHubParams = {
7330
7638
  };
7331
7639
  declare class IconSpokeService {
7332
7640
  private constructor();
7333
- static estimateGas(rawTx: IconRawTransaction, spokeProvider: IconSpokeProvider): Promise<IconGasEstimate>;
7641
+ static estimateGas(rawTx: IconRawTransaction, spokeProvider: IconSpokeProviderType): Promise<IconGasEstimate>;
7334
7642
  /**
7335
7643
  * Deposit tokens to the spoke chain.
7336
7644
  * @param {IconSpokeDepositParams} params - The parameters for the deposit
7337
- * @param {IconWalletProvider} spokeProvider - The provider for the spoke chain
7645
+ * @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain
7338
7646
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain
7339
7647
  * @param {boolean} raw - The return type raw or just transaction hash
7340
7648
  * @returns {Promise<Result<string>>} A promise that resolves to the transaction hash
7341
7649
  */
7342
- static deposit<R extends boolean = false>(params: IconSpokeDepositParams, spokeProvider: IconSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseIconTxReturnType<R>;
7650
+ static deposit<R extends boolean = false>(params: IconSpokeDepositParams, spokeProvider: IconSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<IconSpokeProviderType, R>>;
7343
7651
  /**
7344
7652
  * Get the balance of the token in the spoke chain.
7345
7653
  * @param {string} token - The address of the token to get the balance of
7346
- * @param {IconWalletProvider} spokeProvider - The spoke provider
7654
+ * @param {IconSpokeProviderType} spokeProvider - The spoke provider
7347
7655
  * @returns {Promise<bigint>} The balance of the token
7348
7656
  */
7349
- static getDeposit(token: string, spokeProvider: IconSpokeProvider): Promise<bigint>;
7657
+ static getDeposit(token: string, spokeProvider: IconSpokeProviderType): Promise<bigint>;
7350
7658
  /**
7351
7659
  * Calls a contract on the spoke chain using the user's wallet.
7352
7660
  * @param {HubAddress} from - The address of the user on the hub chain
7353
7661
  * @param {Hex} payload - The payload to send to the contract
7354
- * @param {IconWalletProvider} spokeProvider - The provider for the spoke chain
7662
+ * @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain
7355
7663
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain
7356
7664
  * @param {boolean} raw - The return type raw or just transaction hash
7357
7665
  * @returns {Promise<Result<string>>} A promise that resolves to the transaction hash
7358
7666
  */
7359
- static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: IconSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseIconTxReturnType<R>;
7667
+ static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: IconSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<IconSpokeProviderType, R>>;
7360
7668
  /**
7361
7669
  * Generate simulation parameters for deposit from IconSpokeDepositParams.
7362
7670
  * @param {IconSpokeDepositParams} params - The deposit parameters.
7363
- * @param {IconSpokeProvider} spokeProvider - The provider for the spoke chain.
7671
+ * @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain.
7364
7672
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7365
7673
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
7366
7674
  */
7367
- static getSimulateDepositParams(params: IconSpokeDepositParams, spokeProvider: IconSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7675
+ static getSimulateDepositParams(params: IconSpokeDepositParams, spokeProvider: IconSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7368
7676
  /**
7369
7677
  * Transfers tokens to the hub chain.
7370
7678
  */
@@ -7401,43 +7709,43 @@ declare class InjectiveSpokeService {
7401
7709
  /**
7402
7710
  * Estimate the gas for a transaction.
7403
7711
  * @param {InjectiveRawTransaction} rawTx - The raw transaction to estimate the gas for.
7404
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7712
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7405
7713
  * @returns {Promise<InjectiveGasEstimate>} The estimated gas for the transaction.
7406
7714
  */
7407
- static estimateGas(rawTx: InjectiveRawTransaction, spokeProvider: InjectiveSpokeProvider): Promise<InjectiveGasEstimate>;
7715
+ static estimateGas(rawTx: InjectiveRawTransaction, spokeProvider: InjectiveSpokeProviderType): Promise<InjectiveGasEstimate>;
7408
7716
  /**
7409
7717
  * Deposit tokens to the spoke chain.
7410
7718
  * @param {InjectiveSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
7411
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7719
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7412
7720
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7413
7721
  * @param {boolean} raw - The return type raw or just transaction hash
7414
- * @returns {PromiseInjectiveTxReturnType<R>} A promise that resolves to the transaction hash.
7722
+ * @returns {Promise<TxReturnType<InjectiveSpokeProviderType, R>>} A promise that resolves to the transaction hash.
7415
7723
  */
7416
- static deposit<R extends boolean = false>(params: InjectiveSpokeDepositParams, spokeProvider: InjectiveSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseInjectiveTxReturnType<R>;
7724
+ static deposit<R extends boolean = false>(params: InjectiveSpokeDepositParams, spokeProvider: InjectiveSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<InjectiveSpokeProviderType, R>>;
7417
7725
  /**
7418
7726
  * Generate simulation parameters for deposit from InjectiveSpokeDepositParams.
7419
7727
  * @param {InjectiveSpokeDepositParams} params - The deposit parameters.
7420
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7728
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7421
7729
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7422
7730
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
7423
7731
  */
7424
- static getSimulateDepositParams(params: InjectiveSpokeDepositParams, spokeProvider: InjectiveSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7732
+ static getSimulateDepositParams(params: InjectiveSpokeDepositParams, spokeProvider: InjectiveSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7425
7733
  /**
7426
7734
  * Get the balance of the token that deposited in the spoke chain Asset Manager.
7427
7735
  * @param {Address} token - The address of the token to get the balance of.
7428
- * @param {InjectiveSpokeProvider} spokeProvider - The spoke provider.
7736
+ * @param {InjectiveSpokeProviderType} spokeProvider - The spoke provider.
7429
7737
  * @returns {Promise<bigint>} The balance of the token.
7430
7738
  */
7431
- static getDeposit(token: String, spokeProvider: InjectiveSpokeProvider): Promise<bigint>;
7739
+ static getDeposit(token: String, spokeProvider: InjectiveSpokeProviderType): Promise<bigint>;
7432
7740
  /**
7433
7741
  * Calls a contract on the spoke chain using the user's wallet.
7434
7742
  * @param {HubAddress} from - The address of the user on the hub chain.
7435
7743
  * @param {Hex} payload - The payload to send to the contract.
7436
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7744
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7437
7745
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7438
- * @returns {PromiseInjectiveTxReturnType<R>} A promise that resolves to the transaction hash.
7746
+ * @returns {Promise<TxReturnType<InjectiveSpokeProviderType, R>>} A promise that resolves to the transaction hash.
7439
7747
  */
7440
- static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: InjectiveSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseInjectiveTxReturnType<R>;
7748
+ static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: InjectiveSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<InjectiveSpokeProviderType, R>>;
7441
7749
  /**
7442
7750
  * Transfers tokens to the hub chain.
7443
7751
  * @param {InjectiveTransferToHubParams} params - The parameters for the transfer, including:
@@ -7445,9 +7753,9 @@ declare class InjectiveSpokeService {
7445
7753
  * - {Uint8Array} recipient: The recipient address on the hub chain.
7446
7754
  * - {string} amount: The amount to transfer.
7447
7755
  * - {Uint8Array} [data=new Uint8Array([])]: Additional data for the transfer.
7448
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7756
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7449
7757
  * @param {boolean} raw - The return type raw or just transaction hash
7450
- * @returns {PromiseInjectiveTxReturnType<R>} A promise that resolves to the transaction hash.
7758
+ * @returns {Promise<TxReturnType<InjectiveSpokeProviderType, R>>} A promise that resolves to the transaction hash.
7451
7759
  */
7452
7760
  private static transfer;
7453
7761
  /**
@@ -7455,8 +7763,8 @@ declare class InjectiveSpokeService {
7455
7763
  * @param {bigint} dstChainId - The chain ID of the hub chain.
7456
7764
  * @param {Address} dstAddress - The address on the hub chain.
7457
7765
  * @param {Hex} payload - The payload to send.
7458
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7459
- * @returns {PromiseInjectiveTxReturnType<R>} A promise that resolves to the transaction hash.
7766
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7767
+ * @returns {Promise<TxReturnType<InjectiveSpokeProviderType, R>>} A promise that resolves to the transaction hash.
7460
7768
  */
7461
7769
  private static call;
7462
7770
  }
@@ -7479,12 +7787,12 @@ declare class SolanaSpokeService {
7479
7787
  /**
7480
7788
  * Estimate the gas for a transaction.
7481
7789
  * @param {SolanaRawTransaction} rawTx - The raw transaction to estimate the gas for.
7482
- * @param {SolanaSpokeProvider} spokeProvider - The provider for the spoke chain.
7790
+ * @param {SolanaSpokeProviderType} spokeProvider - The provider for the spoke chain.
7483
7791
  * @returns {Promise<number | undefined>} The units consumed for the transaction.
7484
7792
  */
7485
- static estimateGas(rawTx: SolanaRawTransaction, spokeProvider: SolanaSpokeProvider): Promise<SolanaGasEstimate>;
7486
- static deposit<R extends boolean = false>(params: SolanaSpokeDepositParams, spokeProvider: SolanaSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseSolanaTxReturnType<R>;
7487
- static getDeposit(token: string, spokeProvider: SolanaSpokeProvider): Promise<bigint>;
7793
+ static estimateGas(rawTx: SolanaRawTransaction, spokeProvider: SolanaSpokeProviderType): Promise<SolanaGasEstimate>;
7794
+ static deposit<R extends boolean = false>(params: SolanaSpokeDepositParams, spokeProvider: SolanaSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<SolanaSpokeProviderType, R>>;
7795
+ static getDeposit(token: string, spokeProvider: SolanaSpokeProviderType): Promise<bigint>;
7488
7796
  /**
7489
7797
  * Calls a contract on the spoke chain using the user's wallet.
7490
7798
  * @param from - The address of the user on the hub chain.
@@ -7494,15 +7802,15 @@ declare class SolanaSpokeService {
7494
7802
  * @param raw - Whether to return the raw transaction data.
7495
7803
  * @returns The transaction result.
7496
7804
  */
7497
- static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: SolanaSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseSolanaTxReturnType<R>;
7805
+ static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: SolanaSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<SolanaSpokeProviderType, R>>;
7498
7806
  /**
7499
7807
  * Generate simulation parameters for deposit from SolanaSpokeDepositParams.
7500
7808
  * @param {SolanaSpokeDepositParams} params - The deposit parameters.
7501
- * @param {SolanaSpokeProvider} spokeProvider - The provider for the spoke chain.
7809
+ * @param {SolanaSpokeProviderType} spokeProvider - The provider for the spoke chain.
7502
7810
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7503
7811
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
7504
7812
  */
7505
- static getSimulateDepositParams(params: SolanaSpokeDepositParams, spokeProvider: SolanaSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7813
+ static getSimulateDepositParams(params: SolanaSpokeDepositParams, spokeProvider: SolanaSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7506
7814
  private static transfer;
7507
7815
  /**
7508
7816
  * Sends a message to the hub chain.
@@ -7720,7 +8028,133 @@ declare class SolverApiService {
7720
8028
  static getStatus(request: SolverIntentStatusRequest, config: SolverConfig): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
7721
8029
  }
7722
8030
 
7723
- type CreateIntentParams = {
8031
+ /**
8032
+ * The action type for the intent relay service.
8033
+ * submit - submit a transaction to the intent relay service
8034
+ * get_transaction_packets - get transaction packets from the intent relay service
8035
+ * get_packet - get a packet from the intent relay service
8036
+ */
8037
+ type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
8038
+ /**
8039
+ * The status of the relay transaction.
8040
+ * pending - no signatures
8041
+ * validating - not enough signatures
8042
+ * executing - enough signatures,no confirmed txn-hash
8043
+ * executed - has confirmed transaction-hash
8044
+ */
8045
+ type RelayTxStatus = 'pending' | 'validating' | 'executing' | 'executed';
8046
+ type RelayErrorCode = 'SUBMIT_TX_FAILED' | 'RELAY_TIMEOUT';
8047
+ type RelayError = {
8048
+ code: RelayErrorCode;
8049
+ error: unknown;
8050
+ };
8051
+ type SubmitTxParams = {
8052
+ chain_id: string;
8053
+ tx_hash: string;
8054
+ data?: {
8055
+ address: Hex;
8056
+ payload: Hex;
8057
+ };
8058
+ };
8059
+ type GetTransactionPacketsParams = {
8060
+ chain_id: string;
8061
+ tx_hash: string;
8062
+ };
8063
+ type GetPacketParams = {
8064
+ chain_id: string;
8065
+ tx_hash: string;
8066
+ conn_sn: string;
8067
+ };
8068
+ type SubmitTxResponse = {
8069
+ success: boolean;
8070
+ message: string;
8071
+ };
8072
+ type PacketData = {
8073
+ src_chain_id: number;
8074
+ src_tx_hash: string;
8075
+ src_address: string;
8076
+ status: RelayTxStatus;
8077
+ dst_chain_id: number;
8078
+ conn_sn: number;
8079
+ dst_address: string;
8080
+ dst_tx_hash: string;
8081
+ signatures: string[];
8082
+ payload: string;
8083
+ };
8084
+ type IntentDeliveryInfo = {
8085
+ srcChainId: SpokeChainId;
8086
+ srcTxHash: string;
8087
+ srcAddress: string;
8088
+ dstChainId: SpokeChainId;
8089
+ dstTxHash: string;
8090
+ dstAddress: string;
8091
+ };
8092
+ type GetTransactionPacketsResponse = {
8093
+ success: boolean;
8094
+ data: PacketData[];
8095
+ };
8096
+ type GetPacketResponse = {
8097
+ success: true;
8098
+ data: PacketData;
8099
+ } | {
8100
+ success: false;
8101
+ message: string;
8102
+ };
8103
+ type GetRelayRequestParamType<T extends RelayAction> = T extends 'submit' ? SubmitTxParams : T extends 'get_transaction_packets' ? GetTransactionPacketsParams : T extends 'get_packet' ? GetPacketParams : never;
8104
+ type GetRelayResponse<T extends RelayAction> = T extends 'submit' ? SubmitTxResponse : T extends 'get_transaction_packets' ? GetTransactionPacketsResponse : T extends 'get_packet' ? GetPacketResponse : never;
8105
+ type IntentRelayRequestParams = SubmitTxParams | GetTransactionPacketsParams | GetPacketParams;
8106
+ type WaitUntilIntentExecutedPayload = {
8107
+ intentRelayChainId: string;
8108
+ spokeTxHash: string;
8109
+ timeout: number;
8110
+ apiUrl: HttpUrl;
8111
+ };
8112
+ /**
8113
+ * Represents the request payload for submitting a transaction to the intent relay service.
8114
+ * Contains the action type and parameters including chain ID and transaction hash.
8115
+ */
8116
+ type IntentRelayRequest<T extends RelayAction> = {
8117
+ action: T;
8118
+ params: GetRelayRequestParamType<T>;
8119
+ };
8120
+ /**
8121
+ * Submits a transaction to the intent relay service.
8122
+ * @param payload - The request payload containing the 'submit' action type and parameters.
8123
+ * @param apiUrl - The URL of the intent relay service.
8124
+ * @returns The response from the intent relay service.
8125
+ */
8126
+ declare function submitTransaction(payload: IntentRelayRequest<'submit'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'submit'>>;
8127
+ /**
8128
+ * Retrieves transaction packets from the intent relay service.
8129
+ * @param payload - The request payload containing the 'get_transaction_packets' action type and parameters.
8130
+ * @param apiUrl - The URL of the intent relay service.
8131
+ * @returns The response from the intent relay service.
8132
+ */
8133
+ declare function getTransactionPackets(payload: IntentRelayRequest<'get_transaction_packets'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'get_transaction_packets'>>;
8134
+ /**
8135
+ * Retrieves a packet from the intent relay service.
8136
+ * @param payload - The request payload containing the 'get_packet' action type and parameters.
8137
+ * @param apiUrl - The URL of the intent relay service.
8138
+ * @returns The response from the intent relay service.
8139
+ */
8140
+ declare function getPacket(payload: IntentRelayRequest<'get_packet'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'get_packet'>>;
8141
+ declare function waitUntilIntentExecuted(payload: WaitUntilIntentExecutedPayload): Promise<Result<PacketData, IntentError<'RELAY_TIMEOUT'>>>;
8142
+ /**
8143
+ * Submit the transaction to the Solver API and wait for it to be executed
8144
+ * @param spokeTxHash - The transaction hash to submit.
8145
+ * @param data - The additional data to submit when relaying the transaction on Solana. Due to Solana's 1232 byte transaction
8146
+ * size limit, Solana transactions are split: the on-chain tx contains only a verification hash, while the full
8147
+ * data is submitted off-chain via the relayer. Contains the to address on Hub chain and instruction data.
8148
+ * @param spokeProvider - The spoke provider.
8149
+ * @param timeout - The timeout in milliseconds for the transaction. Default is 20 seconds.
8150
+ * @returns The transaction hash.
8151
+ */
8152
+ declare function relayTxAndWaitPacket<S extends SpokeProvider>(spokeTxHash: string, data: {
8153
+ address: Hex;
8154
+ payload: Hex;
8155
+ } | undefined, spokeProvider: S, relayerApiEndpoint: HttpUrl, timeout?: number): Promise<Result<PacketData, RelayError>>;
8156
+
8157
+ type CreateIntentParams = {
7724
8158
  inputToken: string;
7725
8159
  outputToken: string;
7726
8160
  inputAmount: bigint;
@@ -7789,7 +8223,7 @@ type IntentError<T extends IntentErrorCode = IntentErrorCode> = {
7789
8223
  code: T;
7790
8224
  data: IntentErrorData<T>;
7791
8225
  };
7792
- type SwapParams<S extends SpokeProvider> = Prettify<{
8226
+ type SwapParams<S extends SpokeProviderType> = Prettify<{
7793
8227
  intentParams: CreateIntentParams;
7794
8228
  spokeProvider: S;
7795
8229
  skipSimulation?: boolean;
@@ -8036,7 +8470,7 @@ declare class SwapService {
8036
8470
  * data: '0x', // Additional arbitrary data
8037
8471
  * } satisfies CreateIntentParams;
8038
8472
  *
8039
- * const isAllowanceValid = await sodax.swap.isAllowanceValid({
8473
+ * const isAllowanceValid = await sodax.swaps.isAllowanceValid({
8040
8474
  * intentParams: createIntentParams,
8041
8475
  * spokeProvider: bscSpokeProvider,
8042
8476
  * });
@@ -8049,7 +8483,7 @@ declare class SwapService {
8049
8483
  * console.log('Approval required');
8050
8484
  * }
8051
8485
  */
8052
- isAllowanceValid<S extends SpokeProvider>({ intentParams: params, spokeProvider, }: SwapParams<S>): Promise<Result<boolean>>;
8486
+ isAllowanceValid<S extends SpokeProviderType>({ intentParams: params, spokeProvider, }: SwapParams<S>): Promise<Result<boolean>>;
8053
8487
  /**
8054
8488
  * Approve the Asset Manager contract to spend tokens on behalf of the user (required for EVM chains)
8055
8489
  * @param {Prettify<SwapParams<S> & OptionalRaw<R>>} params - Object containing:
@@ -8074,7 +8508,7 @@ declare class SwapService {
8074
8508
  * data: '0x', // Additional arbitrary data
8075
8509
  * } satisfies CreateIntentParams;
8076
8510
  *
8077
- * const approveResult = await sodax.swap.approve({
8511
+ * const approveResult = await sodax.swaps.approve({
8078
8512
  * intentParams: createIntentParams,
8079
8513
  * spokeProvider: bscSpokeProvider,
8080
8514
  * });
@@ -8088,7 +8522,7 @@ declare class SwapService {
8088
8522
  * console.log('Approval transaction:', txHash);
8089
8523
  * }
8090
8524
  */
8091
- approve<S extends SpokeProvider, R extends boolean = false>({ intentParams: params, spokeProvider, raw, }: Prettify<SwapParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>>>;
8525
+ approve<S extends SpokeProviderType, R extends boolean = false>({ intentParams: params, spokeProvider, raw, }: Prettify<SwapParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>>>;
8092
8526
  /**
8093
8527
  * Creates an intent by handling token approval and intent creation
8094
8528
  * NOTE: This method does not submit the intent to the Solver API
@@ -8132,15 +8566,15 @@ declare class SwapService {
8132
8566
  * // handle error
8133
8567
  * }
8134
8568
  */
8135
- createIntent<S extends SpokeProvider, R extends boolean = false>({ intentParams: params, spokeProvider, fee, raw, }: Prettify<SwapParams<S> & OptionalRaw<R>>): Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount, Hex$1], IntentError<'CREATION_FAILED'>>>;
8569
+ createIntent<S extends SpokeProviderType, R extends boolean = false>({ intentParams: params, spokeProvider, fee, raw, }: Prettify<SwapParams<S> & OptionalRaw<R>>): Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount, Hex$1], IntentError<'CREATION_FAILED'>>>;
8136
8570
  /**
8137
8571
  * Cancels an intent
8138
8572
  * @param {Intent} intent - The intent to cancel
8139
- * @param {ISpokeProvider} spokeProvider - The spoke provider
8573
+ * @param {SpokeProviderType} spokeProvider - The spoke provider
8140
8574
  * @param {boolean} raw - Whether to return the raw transaction
8141
8575
  * @returns {Promise<TxReturnType<S, R>>} The encoded contract call
8142
8576
  */
8143
- cancelIntent<S extends SpokeProvider, R extends boolean = false>(intent: Intent, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>>>;
8577
+ cancelIntent<S extends SpokeProviderType, R extends boolean = false>(intent: Intent, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>>>;
8144
8578
  /**
8145
8579
  * Gets an intent from a transaction hash (on Hub chain)
8146
8580
  * @param {Hash} txHash - The transaction hash on Hub chain
@@ -8205,7 +8639,7 @@ declare class SonicSpokeService {
8205
8639
  * - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
8206
8640
  *
8207
8641
  * @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
8208
- * @param {SonicSpokeProvider} spokeProvider - The EVM spoke provider.
8642
+ * @param {SonicSpokeProviderType} spokeProvider - The Sonic spoke provider.
8209
8643
  * @returns {Promise<bigint>} Estimated gas for the transaction.
8210
8644
  *
8211
8645
  * @example
@@ -8221,46 +8655,46 @@ declare class SonicSpokeService {
8221
8655
  * const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
8222
8656
  * console.log(`Estimated gas: ${estimatedGas}`);
8223
8657
  */
8224
- static estimateGas(rawTx: EvmRawTransaction, spokeProvider: SonicSpokeProvider): Promise<bigint>;
8658
+ static estimateGas(rawTx: EvmRawTransaction, spokeProvider: SonicSpokeProviderType): Promise<bigint>;
8225
8659
  /**
8226
8660
  * Get the derived address of a contract deployed with CREATE3.
8227
8661
  * @param address - User's address on the specified chain as hex
8228
8662
  * @param provider - Sonic Spoke provider
8229
8663
  * @returns {HubAddress} The computed contract address as a EVM address (hex) string
8230
8664
  */
8231
- static getUserRouter(address: Address$1, provider: SonicSpokeProvider): Promise<HubAddress>;
8665
+ static getUserRouter(address: Address$1, provider: SonicSpokeProviderType): Promise<HubAddress>;
8232
8666
  /**
8233
8667
  * Deposit tokens to the spoke chain using the Sonic wallet abstraction.
8234
8668
  * @param {SonicSpokeDepositParams} params - The parameters for the deposit
8235
- * @param {SonicSpokeProvider} spokeProvider - The provider for the spoke chain
8236
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash
8669
+ * @param {SonicSpokeProviderType} spokeProvider - The provider for the spoke chain
8670
+ * @returns {Promise<TxReturnType<S, R>>} A promise that resolves to the transaction hash
8237
8671
  */
8238
- static deposit<S extends SpokeProvider, R extends boolean = false>(params: SonicSpokeDepositParams, spokeProvider: S, raw?: R): PromiseEvmTxReturnType<R>;
8239
- static createSwapIntent<R extends boolean = false>(createIntentParams: CreateIntentParams, creatorHubWalletAddress: Address$1, solverConfig: SolverConfig, fee: PartnerFee | undefined, spokeProvider: SonicSpokeProvider, hubProvider: EvmHubProvider, raw?: R): Promise<[TxReturnType<SonicSpokeProvider, R>, Intent, bigint, Hex$1]>;
8672
+ static deposit<S extends SonicSpokeProviderType, R extends boolean = false>(params: SonicSpokeDepositParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
8673
+ static createSwapIntent<S extends SonicSpokeProviderType, R extends boolean = false>(createIntentParams: CreateIntentParams, creatorHubWalletAddress: Address$1, solverConfig: SolverConfig, fee: PartnerFee | undefined, spokeProvider: S, hubProvider: EvmHubProvider, raw?: R): Promise<[TxReturnType<S, R>, Intent, bigint, Hex$1]>;
8240
8674
  /**
8241
8675
  * Get the balance of the token in the spoke chain.
8242
8676
  * @param {Address} token - The address of the token to get the balance of.
8243
- * @param {SonicSpokeProvider} spokeProvider - The spoke provider.
8677
+ * @param {SonicSpokeProviderType} spokeProvider - The spoke provider.
8244
8678
  * @returns {Promise<bigint>} The balance of the token.
8245
8679
  */
8246
- static getDeposit(token: Address$1, spokeProvider: SonicSpokeProvider): Promise<bigint>;
8680
+ static getDeposit(token: Address$1, spokeProvider: SonicSpokeProviderType): Promise<bigint>;
8247
8681
  /**
8248
8682
  * Execute a batch of contract calls through the Sonic wallet contract.
8249
8683
  * @param {Hex} payload - The encoded payload containing the calls array
8250
- * @param {SonicSpokeProvider} spokeProvider - The provider for the spoke chain
8251
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash
8684
+ * @param {SonicSpokeProviderType} spokeProvider - The provider for the spoke chain
8685
+ * @returns {Promise<TxReturnType<S, R>>} A promise that resolves to the transaction hash
8252
8686
  */
8253
- static callWallet<S extends SpokeProvider, R extends boolean>(payload: Hex$1, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
8687
+ static callWallet<S extends SonicSpokeProviderType, R extends boolean>(payload: Hex$1, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
8254
8688
  /**
8255
8689
  * Get withdraw information for a given token
8256
8690
  * @param token - The address of the underlying token
8257
8691
  * @param amount - The amount to withdraw
8258
- * @param spokeProvider - The spoke provider
8692
+ * @param chainId - The chain ID of the underlying token
8259
8693
  * @param moneyMarketService - The money market service
8260
8694
  * @param configService - The config service
8261
8695
  * @returns {WithdrawInfo} WithdrawInfo containing aToken address, amount and vault address
8262
8696
  */
8263
- static getWithdrawInfo(token: Address$1, amount: bigint, spokeProvider: SonicSpokeProvider, dataService: MoneyMarketDataService, configService: ConfigService): Promise<WithdrawInfo>;
8697
+ static getWithdrawInfo(token: Address$1, amount: bigint, chainId: SpokeChainId, dataService: MoneyMarketDataService, configService: ConfigService): Promise<WithdrawInfo>;
8264
8698
  /**
8265
8699
  * Get borrow information for a given token
8266
8700
  * @param token - The address of the underlying token
@@ -8279,16 +8713,16 @@ declare class SonicSpokeService {
8279
8713
  * @param spender - The address of the spender
8280
8714
  * @returns {Promise<Result<boolean>>} A promise that resolves to the result of the approval check
8281
8715
  */
8282
- static isWithdrawApproved(from: Address$1, withdrawInfo: WithdrawInfo, spokeProvider: SonicSpokeProvider, spender?: HubAddress): Promise<Result<boolean>>;
8716
+ static isWithdrawApproved(from: Address$1, withdrawInfo: WithdrawInfo, spokeProvider: SonicSpokeProviderType, spender?: HubAddress): Promise<Result<boolean>>;
8283
8717
  /**
8284
8718
  * Approve the withdrawal of tokens from the spoke chain using the Sonic wallet abstraction.
8285
8719
  * @param from - The address of the user on the spoke chain
8286
8720
  * @param withdrawInfo - The information about the withdrawal
8287
8721
  * @param spokeProvider - The spoke provider
8288
8722
  * @param raw - Whether to return the raw transaction data
8289
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash
8723
+ * @returns {PromiseEvmTxReturnType<SonicSpokeProviderType, R>} A promise that resolves to the transaction hash
8290
8724
  */
8291
- static approveWithdraw<R extends boolean = false>(from: Address$1, withdrawInfo: WithdrawInfo, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
8725
+ static approveWithdraw<S extends SonicSpokeProviderType, R extends boolean = false>(from: Address$1, withdrawInfo: WithdrawInfo, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
8292
8726
  /**
8293
8727
  * Check if the user has approved the borrowing of tokens from the spoke chain using the Sonic wallet abstraction.
8294
8728
  * @param from - The address of the user on the spoke chain
@@ -8297,9 +8731,9 @@ declare class SonicSpokeService {
8297
8731
  * @param spender - The address of the spender
8298
8732
  * @returns {Promise<Result<boolean>>} A promise that resolves to the result of the approval check
8299
8733
  */
8300
- static isBorrowApproved(from: Address$1, borrowInfo: BorrowInfo, spokeProvider: SonicSpokeProvider, spender?: HubAddress): Promise<Result<boolean>>;
8301
- static approveBorrow<R extends boolean = false>(from: Address$1, borrowInfo: BorrowInfo, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
8302
- static buildWithdrawData(from: Address$1, withdrawInfo: WithdrawInfo, amount: bigint, spokeProvider: SonicSpokeProvider, moneyMarketService: MoneyMarketService): Promise<Hex$1>;
8734
+ static isBorrowApproved(from: Address$1, borrowInfo: BorrowInfo, spokeProvider: SonicSpokeProviderType, spender?: HubAddress): Promise<Result<boolean>>;
8735
+ static approveBorrow<S extends SonicSpokeProviderType, R extends boolean = false>(from: Address$1, borrowInfo: BorrowInfo, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
8736
+ static buildWithdrawData(from: Address$1, withdrawInfo: WithdrawInfo, amount: bigint, toAddress: Address$1, toChainId: SpokeChainId, spokeProvider: SonicSpokeProviderType, moneyMarketService: MoneyMarketService): Promise<Hex$1>;
8303
8737
  }
8304
8738
 
8305
8739
  type StellarSpokeDepositParams = {
@@ -8324,7 +8758,7 @@ declare class StellarSpokeService {
8324
8758
  * @param spokeProvider - The Stellar spoke provider.
8325
8759
  * @returns True if the user has sufficent trustline established for the token, false otherwise.
8326
8760
  */
8327
- static hasSufficientTrustline(token: string, amount: bigint, spokeProvider: StellarSpokeProvider): Promise<boolean>;
8761
+ static hasSufficientTrustline(token: string, amount: bigint, spokeProvider: StellarSpokeProviderType): Promise<boolean>;
8328
8762
  /**
8329
8763
  * Request a trustline for a given token and amount.
8330
8764
  * @param token - The token address to request the trustline for.
@@ -8333,30 +8767,30 @@ declare class StellarSpokeService {
8333
8767
  * @param raw - Whether to return the raw transaction data.
8334
8768
  * @returns The transaction result.
8335
8769
  */
8336
- static requestTrustline<R extends boolean = false>(token: string, amount: bigint, spokeProvider: StellarSpokeProvider, raw?: R): PromiseStellarTxReturnType<R>;
8770
+ static requestTrustline<S extends StellarSpokeProviderType, R extends boolean = false>(token: string, amount: bigint, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
8337
8771
  /**
8338
8772
  * Estimate the gas for a transaction.
8339
8773
  * @param rawTx - The raw transaction to estimate the gas for.
8340
8774
  * @param spokeProvider - The spoke provider.
8341
8775
  * @returns The estimated gas (minResourceFee) for the transaction.
8342
8776
  */
8343
- static estimateGas(rawTx: StellarRawTransaction, spokeProvider: StellarSpokeProvider): Promise<StellarGasEstimate>;
8344
- static deposit<R extends boolean = false>(params: StellarSpokeDepositParams, spokeProvider: StellarSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseStellarTxReturnType<R>;
8777
+ static estimateGas(rawTx: StellarRawTransaction, spokeProvider: StellarSpokeProviderType): Promise<StellarGasEstimate>;
8778
+ static deposit<S extends StellarSpokeProviderType, R extends boolean = false>(params: StellarSpokeDepositParams, spokeProvider: S, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<S, R>>;
8345
8779
  /**
8346
8780
  * Get the balance of the token in the spoke chain asset manager.
8347
8781
  * @param token - The address of the token to get the balance of.
8348
8782
  * @param spokeProvider - The spoke provider.
8349
8783
  * @returns The balance of the token.
8350
8784
  */
8351
- static getDeposit(token: string, spokeProvider: StellarSpokeProvider): Promise<bigint>;
8785
+ static getDeposit(token: string, spokeProvider: StellarSpokeProviderType): Promise<bigint>;
8352
8786
  /**
8353
8787
  * Generate simulation parameters for deposit from StellarSpokeDepositParams.
8354
8788
  * @param {StellarSpokeDepositParams} params - The deposit parameters.
8355
- * @param {StellarSpokeProvider} spokeProvider - The provider for the spoke chain.
8789
+ * @param {StellarSpokeProviderType} spokeProvider - The provider for the spoke chain.
8356
8790
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
8357
8791
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
8358
8792
  */
8359
- static getSimulateDepositParams(params: StellarSpokeDepositParams, spokeProvider: StellarSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
8793
+ static getSimulateDepositParams(params: StellarSpokeDepositParams, spokeProvider: StellarSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
8360
8794
  /**
8361
8795
  * Calls a contract on the spoke chain using the user's wallet.
8362
8796
  * @param from - The address of the user on the hub chain.
@@ -8366,7 +8800,7 @@ declare class StellarSpokeService {
8366
8800
  * @param raw - Whether to return the raw transaction data.
8367
8801
  * @returns The transaction result.
8368
8802
  */
8369
- static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: StellarSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseStellarTxReturnType<R>;
8803
+ static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: StellarSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<StellarSpokeProviderType, R>>;
8370
8804
  private static transfer;
8371
8805
  private static call;
8372
8806
  static waitForTransaction(spokeProvider: StellarSpokeProvider, txHash: string, pollingTimeout?: number, maxAttempts?: number): Promise<Result<boolean, Error>>;
@@ -8393,53 +8827,53 @@ declare class SuiSpokeService {
8393
8827
  * @param {SuiSpokeProvider} spokeProvider - The spoke provider.
8394
8828
  * @returns {Promise<bigint>} The estimated computation cost.
8395
8829
  */
8396
- static estimateGas(rawTx: SuiRawTransaction, spokeProvider: SuiSpokeProvider): Promise<SuiGasEstimate>;
8830
+ static estimateGas(rawTx: SuiRawTransaction, spokeProvider: SuiSpokeProviderType): Promise<SuiGasEstimate>;
8397
8831
  /**
8398
8832
  * Deposit tokens to the spoke chain.
8399
8833
  * @param {InjectiveSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
8400
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
8834
+ * @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
8401
8835
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
8402
8836
  * @param {boolean} raw - The return type raw or just transaction hash
8403
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
8837
+ * @returns {Promise<TxReturnType<SuiSpokeProviderType, R>>} A promise that resolves to the transaction hash or raw transaction base64 string.
8404
8838
  */
8405
- static deposit<R extends boolean = false>(params: SuiSpokeDepositParams, spokeProvider: SuiSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseSuiTxReturnType<R>;
8839
+ static deposit<R extends boolean = false>(params: SuiSpokeDepositParams, spokeProvider: SuiSpokeProviderType, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<SuiSpokeProviderType, R>>;
8406
8840
  /**
8407
8841
  * Get the balance of the token in the spoke chain.
8408
8842
  * @param {Address} token - The address of the token to get the balance of.
8409
8843
  * @param {SuiSpokeProvider} spokeProvider - The spoke provider.
8410
8844
  * @returns {Promise<bigint>} The balance of the token.
8411
8845
  */
8412
- static getDeposit(token: string, spokeProvider: SuiSpokeProvider): Promise<bigint>;
8846
+ static getDeposit(token: string, spokeProvider: SuiSpokeProviderType): Promise<bigint>;
8413
8847
  /**
8414
8848
  * Generate simulation parameters for deposit from SuiSpokeDepositParams.
8415
8849
  * @param {SuiSpokeDepositParams} params - The deposit parameters.
8416
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
8850
+ * @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
8417
8851
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
8418
8852
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
8419
8853
  */
8420
- static getSimulateDepositParams(params: SuiSpokeDepositParams, spokeProvider: SuiSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
8854
+ static getSimulateDepositParams(params: SuiSpokeDepositParams, spokeProvider: SuiSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
8421
8855
  /**
8422
8856
  * Calls a contract on the spoke chain using the user's wallet.
8423
8857
  * @param {HubAddress} from - The address of the user on the spoke chain.
8424
8858
  * @param {Hex} payload - The payload to send to the contract.
8425
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
8859
+ * @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
8426
8860
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
8427
8861
  * @param {boolean} raw - The return type raw or just transaction hash
8428
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
8862
+ * @returns {Promise<TxReturnType<SuiSpokeProviderType, R>>} A promise that resolves to the transaction hash or raw transaction base64 string.
8429
8863
  */
8430
- static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: SuiSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseSuiTxReturnType<R>;
8864
+ static callWallet<S extends SuiSpokeProviderType, R extends boolean = false>(from: HubAddress, payload: Hex, spokeProvider: S, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<S, R>>;
8431
8865
  /**
8432
8866
  * Fetch the asset manager config from the spoke chain.
8433
- * @param {SuiSpokeProvider} suiSpokeProvider - The spoke provider.
8867
+ * @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
8434
8868
  * @returns {Promise<string>} The asset manager config.
8435
8869
  */
8436
- static fetchAssetManagerAddress(suiSpokeProvider: SuiSpokeProvider): Promise<string>;
8870
+ static fetchAssetManagerAddress(suiSpokeProvider: SuiBaseSpokeProvider): Promise<string>;
8437
8871
  /**
8438
8872
  * Fetch the latest asset manager package id from the spoke chain.
8439
- * @param {SuiSpokeProvider} suiSpokeProvider - The spoke provider.
8873
+ * @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
8440
8874
  * @returns {Promise<string>} The latest asset manager package id.
8441
8875
  */
8442
- static fetchLatestAssetManagerPackageId(suiSpokeProvider: SuiSpokeProvider): Promise<string>;
8876
+ static fetchLatestAssetManagerPackageId(provider: SuiBaseSpokeProvider): Promise<string>;
8443
8877
  /**
8444
8878
  * Transfers tokens to the hub chain.
8445
8879
  * @param {SuiTransferToHubParams} params - The parameters for the transfer, including:
@@ -8447,9 +8881,9 @@ declare class SuiSpokeService {
8447
8881
  * - {Uint8Array} recipient: The recipient address on the hub chain.
8448
8882
  * - {string} amount: The amount to transfer.
8449
8883
  * - {Uint8Array} [data=new Uint8Array([])]: Additional data for the transfer.
8450
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
8884
+ * @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
8451
8885
  * @param {boolean} raw - The return type raw or just transaction hash
8452
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
8886
+ * @returns {Promise<TxReturnType<SuiSpokeProviderType, R>>} A promise that resolves to the transaction hash or raw transaction base64 string.
8453
8887
  */
8454
8888
  private static transfer;
8455
8889
  /**
@@ -8457,139 +8891,13 @@ declare class SuiSpokeService {
8457
8891
  * @param {bigint} dstChainId - The chain ID of the hub chain.
8458
8892
  * @param {HubAddress} dstAddress - The address on the hub chain.
8459
8893
  * @param {Hex} payload - The payload to send.
8460
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
8894
+ * @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
8461
8895
  * @param {boolean} raw - The return type raw or just transaction hash
8462
- * @returns {PromiseSuiTxReturnType<R>} A promise that resolves to the transaction hash or raw transaction base64 string.
8896
+ * @returns {Promise<TxReturnType<SuiSpokeProviderType, R>>} A promise that resolves to the transaction hash or raw transaction base64 string.
8463
8897
  */
8464
8898
  private static call;
8465
8899
  }
8466
8900
 
8467
- /**
8468
- * The action type for the intent relay service.
8469
- * submit - submit a transaction to the intent relay service
8470
- * get_transaction_packets - get transaction packets from the intent relay service
8471
- * get_packet - get a packet from the intent relay service
8472
- */
8473
- type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
8474
- /**
8475
- * The status of the relay transaction.
8476
- * pending - no signatures
8477
- * validating - not enough signatures
8478
- * executing - enough signatures,no confirmed txn-hash
8479
- * executed - has confirmed transaction-hash
8480
- */
8481
- type RelayTxStatus = 'pending' | 'validating' | 'executing' | 'executed';
8482
- type RelayErrorCode = 'SUBMIT_TX_FAILED' | 'RELAY_TIMEOUT';
8483
- type RelayError = {
8484
- code: RelayErrorCode;
8485
- error: unknown;
8486
- };
8487
- type SubmitTxParams = {
8488
- chain_id: string;
8489
- tx_hash: string;
8490
- data?: {
8491
- address: Hex;
8492
- payload: Hex;
8493
- };
8494
- };
8495
- type GetTransactionPacketsParams = {
8496
- chain_id: string;
8497
- tx_hash: string;
8498
- };
8499
- type GetPacketParams = {
8500
- chain_id: string;
8501
- tx_hash: string;
8502
- conn_sn: string;
8503
- };
8504
- type SubmitTxResponse = {
8505
- success: boolean;
8506
- message: string;
8507
- };
8508
- type PacketData = {
8509
- src_chain_id: number;
8510
- src_tx_hash: string;
8511
- src_address: string;
8512
- status: RelayTxStatus;
8513
- dst_chain_id: number;
8514
- conn_sn: number;
8515
- dst_address: string;
8516
- dst_tx_hash: string;
8517
- signatures: string[];
8518
- payload: string;
8519
- };
8520
- type IntentDeliveryInfo = {
8521
- srcChainId: SpokeChainId;
8522
- srcTxHash: string;
8523
- srcAddress: string;
8524
- dstChainId: SpokeChainId;
8525
- dstTxHash: string;
8526
- dstAddress: string;
8527
- };
8528
- type GetTransactionPacketsResponse = {
8529
- success: boolean;
8530
- data: PacketData[];
8531
- };
8532
- type GetPacketResponse = {
8533
- success: true;
8534
- data: PacketData;
8535
- } | {
8536
- success: false;
8537
- message: string;
8538
- };
8539
- type GetRelayRequestParamType<T extends RelayAction> = T extends 'submit' ? SubmitTxParams : T extends 'get_transaction_packets' ? GetTransactionPacketsParams : T extends 'get_packet' ? GetPacketParams : never;
8540
- type GetRelayResponse<T extends RelayAction> = T extends 'submit' ? SubmitTxResponse : T extends 'get_transaction_packets' ? GetTransactionPacketsResponse : T extends 'get_packet' ? GetPacketResponse : never;
8541
- type IntentRelayRequestParams = SubmitTxParams | GetTransactionPacketsParams | GetPacketParams;
8542
- type WaitUntilIntentExecutedPayload = {
8543
- intentRelayChainId: string;
8544
- spokeTxHash: string;
8545
- timeout: number;
8546
- apiUrl: HttpUrl;
8547
- };
8548
- /**
8549
- * Represents the request payload for submitting a transaction to the intent relay service.
8550
- * Contains the action type and parameters including chain ID and transaction hash.
8551
- */
8552
- type IntentRelayRequest<T extends RelayAction> = {
8553
- action: T;
8554
- params: GetRelayRequestParamType<T>;
8555
- };
8556
- /**
8557
- * Submits a transaction to the intent relay service.
8558
- * @param payload - The request payload containing the 'submit' action type and parameters.
8559
- * @param apiUrl - The URL of the intent relay service.
8560
- * @returns The response from the intent relay service.
8561
- */
8562
- declare function submitTransaction(payload: IntentRelayRequest<'submit'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'submit'>>;
8563
- /**
8564
- * Retrieves transaction packets from the intent relay service.
8565
- * @param payload - The request payload containing the 'get_transaction_packets' action type and parameters.
8566
- * @param apiUrl - The URL of the intent relay service.
8567
- * @returns The response from the intent relay service.
8568
- */
8569
- declare function getTransactionPackets(payload: IntentRelayRequest<'get_transaction_packets'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'get_transaction_packets'>>;
8570
- /**
8571
- * Retrieves a packet from the intent relay service.
8572
- * @param payload - The request payload containing the 'get_packet' action type and parameters.
8573
- * @param apiUrl - The URL of the intent relay service.
8574
- * @returns The response from the intent relay service.
8575
- */
8576
- declare function getPacket(payload: IntentRelayRequest<'get_packet'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'get_packet'>>;
8577
- declare function waitUntilIntentExecuted(payload: WaitUntilIntentExecutedPayload): Promise<Result<PacketData, IntentError<'RELAY_TIMEOUT'>>>;
8578
- /**
8579
- * Submit the transaction to the Solver API and wait for it to be executed
8580
- * @param spokeTxHash - The transaction hash to submit.
8581
- * @param data - The additional data to submit when relaying the transaction on Solana. Due to Solana's 1232 byte transaction
8582
- * size limit, Solana transactions are split: the on-chain tx contains only a verification hash, while the full
8583
- * data is submitted off-chain via the relayer. Contains the to address on Hub chain and instruction data.
8584
- * @param spokeProvider - The spoke provider.
8585
- * @param timeout - The timeout in milliseconds for the transaction. Default is 20 seconds.
8586
- * @returns The transaction hash.
8587
- */
8588
- declare function relayTxAndWaitPacket<S extends SpokeProvider>(spokeTxHash: string, data: {
8589
- address: Hex;
8590
- payload: Hex;
8591
- } | undefined, spokeProvider: S, relayerApiEndpoint: HttpUrl, timeout?: number): Promise<Result<PacketData, RelayError>>;
8592
-
8593
8901
  declare class Erc20Service {
8594
8902
  private constructor();
8595
8903
  static getErc20Token(token: Address$1, publicClient: PublicClient): Promise<Erc20Token>;
@@ -8602,7 +8910,7 @@ declare class Erc20Service {
8602
8910
  * @param spokeProvider - EVM Spoke provider
8603
8911
  * @return - True if spender is allowed to spend amount on behalf of owner
8604
8912
  */
8605
- static isAllowanceValid(token: Address$1, amount: bigint, owner: Address$1, spender: Address$1, spokeProvider: EvmSpokeProvider | SonicSpokeProvider): Promise<Result<boolean>>;
8913
+ static isAllowanceValid(token: Address$1, amount: bigint, owner: Address$1, spender: Address$1, spokeProvider: EvmSpokeProviderType | SonicSpokeProviderType): Promise<Result<boolean>>;
8606
8914
  /**
8607
8915
  * Approve ERC20 amount spending
8608
8916
  * @param token - ERC20 token address
@@ -8610,7 +8918,7 @@ declare class Erc20Service {
8610
8918
  * @param spender - Spender address
8611
8919
  * @param provider - EVM Provider
8612
8920
  */
8613
- static approve<R extends boolean = false>(token: Address$1, amount: bigint, spender: Address$1, spokeProvider: EvmSpokeProvider | SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
8921
+ static approve<R extends boolean = false>(token: Address$1, amount: bigint, spender: Address$1, spokeProvider: EvmSpokeProviderType | SonicSpokeProviderType, raw?: R): Promise<TxReturnType<EvmSpokeProviderType | SonicSpokeProviderType, R>>;
8614
8922
  /**
8615
8923
  * Encodes a transfer transaction for a token.
8616
8924
  * @param token - The address of the token.
@@ -8750,8 +9058,8 @@ type Result<T, E = Error | unknown> = {
8750
9058
  error: E;
8751
9059
  };
8752
9060
  type SpokeDepositParams = EvmSpokeDepositParams | InjectiveSpokeDepositParams | IconSpokeDepositParams;
8753
- 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;
8754
- type GetAddressType<T extends SpokeProvider> = T extends EvmSpokeProvider ? Address : 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 : never;
9061
+ type GetSpokeDepositParamsType<T extends SpokeProviderType> = T extends EvmSpokeProvider ? EvmSpokeDepositParams : T extends EvmRawSpokeProvider ? EvmSpokeDepositParams : T extends InjectiveSpokeProvider ? InjectiveSpokeDepositParams : T extends InjectiveRawSpokeProvider ? InjectiveSpokeDepositParams : T extends SuiSpokeProvider ? SuiSpokeDepositParams : T extends SuiRawSpokeProvider ? SuiSpokeDepositParams : T extends IconSpokeProvider ? IconSpokeDepositParams : T extends IconRawSpokeProvider ? IconSpokeDepositParams : T extends StellarSpokeProvider ? StellarSpokeDepositParams : T extends StellarRawSpokeProvider ? StellarSpokeDepositParams : T extends SolanaSpokeProvider ? SolanaSpokeDepositParams : T extends SolanaRawSpokeProvider ? SolanaSpokeDepositParams : T extends SonicSpokeProvider ? SonicSpokeDepositParams : T extends SonicRawSpokeProvider ? SonicSpokeDepositParams : never;
9062
+ type GetAddressType<T extends SpokeProviderType> = T extends EvmSpokeProvider ? Address : T extends EvmRawSpokeProvider ? Address : T extends InjectiveSpokeProvider ? string : T extends InjectiveRawSpokeProvider ? string : T extends StellarSpokeProvider ? Hex$1 : T extends StellarRawSpokeProvider ? Hex$1 : T extends IconSpokeProvider ? IconAddress : T extends IconRawSpokeProvider ? IconAddress : T extends SuiSpokeProvider ? Hex$1 : T extends SuiRawSpokeProvider ? Hex$1 : T extends SolanaSpokeProvider ? Hex$1 : T extends SolanaRawSpokeProvider ? Hex$1 : T extends SonicSpokeProvider ? Address : T extends SonicRawSpokeProvider ? Address : never;
8755
9063
  type SolverConfigParams = Prettify<SolverConfig & Optional<PartnerFeeConfig, 'partnerFee'>> | Optional<PartnerFeeConfig, 'partnerFee'>;
8756
9064
  type QuoteType = 'exact_input' | 'exact_output';
8757
9065
  type SolverIntentQuoteRequest = {
@@ -8844,21 +9152,33 @@ type SuiRawTransaction = {
8844
9152
  data: Base64String;
8845
9153
  };
8846
9154
  type EvmReturnType<Raw extends boolean> = Raw extends true ? EvmRawTransaction : Hex$1;
8847
- type SolanaReturnType<Raw extends boolean> = Raw extends true ? SolanaRawTransaction : Hex$1;
9155
+ type SolanaReturnType<Raw extends boolean> = Raw extends true ? SolanaRawTransaction : string;
8848
9156
  type StellarReturnType<Raw extends boolean> = Raw extends true ? StellarRawTransaction : string;
8849
9157
  type IconReturnType<Raw extends boolean> = Raw extends true ? IconRawTransaction : Hex$1;
8850
- type SuiReturnType<Raw extends boolean> = Raw extends true ? SuiRawTransaction : Hex$1;
8851
- type InjectiveReturnType<Raw extends boolean> = Raw extends true ? InjectiveRawTransaction : Hex$1;
9158
+ type SuiReturnType<Raw extends boolean> = Raw extends true ? SuiRawTransaction : string;
9159
+ type InjectiveReturnType<Raw extends boolean> = Raw extends true ? InjectiveRawTransaction : string;
8852
9160
  type HashTxReturnType = EvmReturnType<false> | SolanaReturnType<false> | IconReturnType<false> | SuiReturnType<false> | InjectiveReturnType<false> | StellarReturnType<false>;
8853
9161
  type RawTxReturnType = EvmRawTransaction | SolanaRawTransaction | InjectiveRawTransaction | IconRawTransaction | SuiRawTransaction | StellarRawTransaction;
8854
- 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;
8855
- type PromiseEvmTxReturnType<Raw extends boolean> = Promise<TxReturnType<EvmSpokeProvider, Raw>>;
9162
+ /**
9163
+ * Return type for a transaction based on the given SpokeProvider or RawSpokeProvider.
9164
+ * - If T extends RawSpokeProvider, Raw is forced to `true` (always returns raw tx type).
9165
+ * - Otherwise, Raw parameter determines output type.
9166
+ */
9167
+ type TxReturnType<T extends SpokeProviderType, Raw extends boolean> = T extends RawSpokeProvider ? T['chainConfig']['chain']['type'] extends 'EVM' ? EvmReturnType<true> : T['chainConfig']['chain']['type'] extends 'SOLANA' ? SolanaReturnType<true> : T['chainConfig']['chain']['type'] extends 'STELLAR' ? StellarReturnType<true> : T['chainConfig']['chain']['type'] extends 'ICON' ? IconReturnType<true> : T['chainConfig']['chain']['type'] extends 'SUI' ? SuiReturnType<true> : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? InjectiveReturnType<true> : RawTxReturnType : T extends SpokeProvider ? 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 : Raw extends true ? RawTxReturnType : HashTxReturnType;
9168
+ type PromiseEvmTxReturnType<Raw extends boolean> = Promise<TxReturnType<EvmSpokeProvider, Raw>>;
8856
9169
  type PromiseSolanaTxReturnType<Raw extends boolean> = Promise<TxReturnType<SolanaSpokeProvider, Raw>>;
8857
9170
  type PromiseStellarTxReturnType<Raw extends boolean> = Promise<TxReturnType<StellarSpokeProvider, Raw>>;
8858
9171
  type PromiseIconTxReturnType<Raw extends boolean> = Promise<TxReturnType<IconSpokeProvider, Raw>>;
8859
9172
  type PromiseSuiTxReturnType<Raw extends boolean> = Promise<TxReturnType<SuiSpokeProvider, Raw>>;
8860
9173
  type PromiseInjectiveTxReturnType<Raw extends boolean> = Promise<TxReturnType<InjectiveSpokeProvider, Raw>>;
8861
- 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;
9174
+ type PromiseTxReturnType<T extends SpokeProvider, Raw extends boolean> = T['chainConfig']['chain']['type'] extends 'EVM' ? Promise<TxReturnType<EvmSpokeProviderType, Raw>> : T['chainConfig']['chain']['type'] extends 'SOLANA' ? Promise<TxReturnType<SolanaSpokeProviderType, Raw>> : T['chainConfig']['chain']['type'] extends 'STELLAR' ? Promise<TxReturnType<StellarSpokeProviderType, Raw>> : T['chainConfig']['chain']['type'] extends 'ICON' ? Promise<TxReturnType<IconSpokeProviderType, Raw>> : T['chainConfig']['chain']['type'] extends 'SUI' ? Promise<TxReturnType<SuiSpokeProviderType, Raw>> : T['chainConfig']['chain']['type'] extends 'INJECTIVE' ? Promise<TxReturnType<InjectiveSpokeProviderType, Raw>> : never;
9175
+ type EvmSpokeProviderType = EvmSpokeProvider | EvmRawSpokeProvider;
9176
+ type SolanaSpokeProviderType = SolanaSpokeProvider | SolanaRawSpokeProvider;
9177
+ type StellarSpokeProviderType = StellarSpokeProvider | StellarRawSpokeProvider;
9178
+ type IconSpokeProviderType = IconSpokeProvider | IconRawSpokeProvider;
9179
+ type SuiSpokeProviderType = SuiSpokeProvider | SuiRawSpokeProvider;
9180
+ type InjectiveSpokeProviderType = InjectiveSpokeProvider | InjectiveRawSpokeProvider;
9181
+ type SonicSpokeProviderType = SonicSpokeProvider | SonicRawSpokeProvider;
8862
9182
  type Prettify<T> = {
8863
9183
  [K in keyof T]: T[K];
8864
9184
  } & {};
@@ -8882,7 +9202,7 @@ type InjectiveGasEstimate = {
8882
9202
  gasUsed: number;
8883
9203
  };
8884
9204
  type GasEstimateType = EvmGasEstimate | SolanaGasEstimate | StellarGasEstimate | IconGasEstimate | SuiGasEstimate | InjectiveGasEstimate;
8885
- 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;
9205
+ type GetEstimateGasReturnType<T extends SpokeProviderType> = 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;
8886
9206
  type OptionalRaw<R extends boolean = false> = {
8887
9207
  raw?: R;
8888
9208
  };
@@ -8896,6 +9216,7 @@ type RelayExtraData = {
8896
9216
  type RelayOptionalExtraData = {
8897
9217
  data?: RelayExtraData;
8898
9218
  };
9219
+ type GetChainConfigType<T extends ChainType> = T extends 'EVM' ? EvmSpokeChainConfig : T extends 'SOLANA' ? SolanaChainConfig : T extends 'STELLAR' ? StellarSpokeChainConfig : T extends 'ICON' ? IconSpokeChainConfig : T extends 'SUI' ? SuiSpokeChainConfig : T extends 'INJECTIVE' ? InjectiveSpokeChainConfig : BaseSpokeChainConfig<T>;
8899
9220
 
8900
9221
  /**
8901
9222
  * BackendApiService - Proxy service for Sodax Backend API
@@ -9287,1008 +9608,1127 @@ declare function encodeAddress(spokeChainId: SpokeChainId, address: string): Hex
9287
9608
  */
9288
9609
  declare function hexToBigInt(hex: string): bigint;
9289
9610
  /**
9290
- * Derive user hub abstracted wallet address. Original address is used if spoke equals hub chain.
9291
- * @param spokeProvider - Spoke provider instance for origin chain
9292
- * @param hubProvider - Hub spoke provider
9293
- * @param walletAddress - user original address on spoke chain
9611
+ * Derive user hub wallet address based on the spoke chain id and address.
9612
+ * @param hubProvider - Hub provider instance
9613
+ * @param spokeChainId - Spoke chain id
9614
+ * @param spokeAddress - Spoke address
9294
9615
  * @returns Abstracted user wallet address for spoke chains with different chain id than hub or original
9295
9616
  */
9296
- declare function deriveUserWalletAddress(spokeProvider: SpokeProvider, hubProvider: EvmHubProvider, walletAddress?: string): Promise<Address>;
9617
+ declare function deriveUserWalletAddress(hubProvider: EvmHubProvider, spokeChainId: SpokeChainId, spokeAddress: string): Promise<Address>;
9297
9618
  declare function parseToStroops(amount: string): bigint;
9298
9619
  declare function sleep(ms: number): Promise<void>;
9299
9620
 
9300
- declare const DEFAULT_MAX_RETRY = 3;
9301
- declare const DEFAULT_RELAY_TX_TIMEOUT = 120000;
9302
- declare const DEFAULT_RETRY_DELAY_MS = 2000;
9303
- declare const ICON_TX_RESULT_WAIT_MAX_RETRY = 10;
9304
- declare const MAX_UINT256: bigint;
9305
- declare const FEE_PERCENTAGE_SCALE = 10000n;
9306
- declare const STELLAR_PRIORITY_FEE = "10000";
9307
- declare const STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = 100;
9308
- declare const DEFAULT_DEADLINE_OFFSET = 300n;
9309
- declare const DEFAULT_BACKEND_API_ENDPOINT = "https://api.sodax.com/v1/be";
9310
- declare const DEFAULT_BACKEND_API_TIMEOUT = 30000;
9311
- declare const DEFAULT_BACKEND_API_HEADERS: {
9312
- 'Content-Type': string;
9313
- Accept: string;
9314
- };
9315
- declare const DEFAULT_RELAYER_API_ENDPOINT = "https://xcall-relay.nw.iconblockchain.xyz";
9316
- declare const VAULT_TOKEN_DECIMALS = 18;
9317
- declare const hyper: {
9318
- blockExplorers: {
9319
- readonly default: {
9320
- readonly name: "HyperEVMScan";
9321
- readonly url: "https://hyperevmscan.io/";
9322
- };
9323
- };
9324
- contracts: {
9325
- readonly multicall3: {
9326
- readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
9327
- readonly blockCreated: 13051;
9328
- };
9329
- };
9330
- ensTlds?: readonly string[] | undefined;
9331
- id: 999;
9332
- name: "HyperEVM";
9333
- nativeCurrency: {
9334
- readonly decimals: 18;
9335
- readonly name: "HYPE";
9336
- readonly symbol: "HYPE";
9337
- };
9338
- rpcUrls: {
9339
- readonly default: {
9340
- readonly http: readonly ["https://rpc.hyperliquid.xyz/evm"];
9341
- };
9342
- };
9343
- sourceId?: number | undefined;
9344
- testnet?: boolean | undefined;
9345
- custom?: Record<string, unknown> | undefined;
9346
- fees?: viem.ChainFees<undefined> | undefined;
9347
- formatters?: undefined;
9348
- serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
9349
- };
9350
- declare function getEvmViemChain(id: EvmChainId): Chain;
9351
- declare const bnUSDLegacySpokeChainIds: readonly ["0x1.icon", "sui", "stellar"];
9352
- declare const newbnUSDSpokeChainIds: ("0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "sonic" | "0xa.optimism" | "0x89.polygon" | "hyper" | "lightlink" | "ethereum" | "sui" | "stellar" | "injective-1" | "solana")[];
9353
- declare const bnUSDLegacyTokens: readonly [{
9354
- readonly symbol: "bnUSD (legacy)";
9355
- readonly name: "bnUSD";
9356
- readonly decimals: 18;
9357
- readonly address: "cx88fd7df7ddff82f7cc735c871dc519838cb235bb";
9358
- readonly xChainId: "0x1.icon";
9359
- }, {
9360
- readonly symbol: "bnUSD (legacy)";
9361
- readonly name: "legacybnUSD";
9362
- readonly decimals: 9;
9363
- readonly address: "0x03917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR";
9364
- readonly xChainId: "sui";
9365
- }, {
9366
- readonly symbol: "bnUSD (legacy)";
9367
- readonly name: "legacybnUSD";
9368
- readonly decimals: 18;
9369
- readonly address: "CCT4ZYIYZ3TUO2AWQFEOFGBZ6HQP3GW5TA37CK7CRZVFRDXYTHTYX7KP";
9370
- readonly xChainId: "stellar";
9371
- }];
9372
- declare const bnUSDNewTokens: ({
9373
- readonly symbol: "bnUSD";
9374
- readonly name: "bnUSD";
9375
- readonly decimals: 9;
9376
- readonly address: "0xff4de2b2b57dd7611d2812d231a467d007b702a101fd5c7ad3b278257cddb507::bnusd::BNUSD";
9377
- readonly xChainId: "sui";
9378
- } | {
9379
- readonly symbol: "bnUSD";
9380
- readonly name: "bnUSD";
9381
- readonly decimals: 7;
9382
- readonly address: "CD6YBFFWMU2UJHX2NGRJ7RN76IJVTCC7MRA46DUBXNB7E6W7H7JRJ2CX";
9383
- readonly xChainId: "stellar";
9384
- } | {
9385
- readonly symbol: "bnUSD";
9386
- readonly name: "bnUSD";
9387
- readonly decimals: 18;
9388
- readonly address: "0x6958a4CBFe11406E2a1c1d3a71A1971aD8B3b92F";
9389
- readonly xChainId: "0xa86a.avax";
9390
- } | {
9391
- readonly symbol: "bnUSD";
9392
- readonly name: "bnUSD";
9393
- readonly decimals: 18;
9394
- readonly address: "0xA256dd181C3f6E5eC68C6869f5D50a712d47212e";
9395
- readonly xChainId: "0xa4b1.arbitrum";
9396
- } | {
9397
- readonly symbol: "bnUSD";
9398
- readonly name: "bnUSD";
9399
- readonly decimals: 18;
9400
- readonly address: "0xAcfab3F31C0a18559D78556BBf297EC29c6cf8aa";
9401
- readonly xChainId: "0x2105.base";
9402
- } | {
9403
- readonly symbol: "bnUSD";
9404
- readonly name: "bnUSD";
9405
- readonly decimals: 18;
9406
- readonly address: "0x8428FedC020737a5A2291F46cB1B80613eD71638";
9407
- readonly xChainId: "0x38.bsc";
9408
- } | {
9409
- readonly symbol: "bnUSD";
9410
- readonly name: "Balanced Dollar";
9411
- readonly decimals: 18;
9412
- readonly address: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131";
9413
- readonly xChainId: "sonic";
9414
- } | {
9415
- readonly symbol: "bnUSD";
9416
- readonly name: "bnUSD";
9417
- readonly decimals: 18;
9418
- readonly address: "0xF4f7dC27c17470a26d0de9039Cf0EA5045F100E8";
9419
- readonly xChainId: "0xa.optimism";
9420
- } | {
9421
- readonly symbol: "bnUSD";
9422
- readonly name: "bnUSD";
9423
- readonly decimals: 18;
9424
- readonly address: "0x39E77f86C1B1f3fbAb362A82b49D2E86C09659B4";
9425
- readonly xChainId: "0x89.polygon";
9426
- } | {
9427
- readonly symbol: "bnUSD";
9428
- readonly name: "bnUSD";
9429
- readonly decimals: 18;
9430
- readonly address: "0x506Ba7C8d91dAdf7a91eE677a205D9687b751579";
9431
- readonly xChainId: "hyper";
9432
- } | {
9433
- readonly symbol: "bnUSD";
9434
- readonly name: "bnUSD";
9435
- readonly decimals: 18;
9436
- readonly address: "0x36134A03dcD03Bbe858B8F7ED28a71AAC608F9E7";
9437
- readonly xChainId: "lightlink";
9438
- } | {
9439
- readonly symbol: "bnUSD";
9440
- readonly name: "bnUSD";
9441
- readonly decimals: 18;
9442
- readonly address: "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13";
9443
- readonly xChainId: "ethereum";
9444
- } | {
9445
- readonly symbol: "bnUSD";
9446
- readonly name: "bnUSD";
9447
- readonly decimals: 18;
9448
- readonly address: "factory/inj1d036ftaatxpkqsu9hja8r24rv3v33chz3appxp/bnUSD";
9449
- readonly xChainId: "injective-1";
9450
- } | {
9451
- readonly symbol: "bnUSD";
9452
- readonly name: "bnUSD";
9453
- readonly decimals: 9;
9454
- readonly address: "3rSPCLNEF7Quw4wX8S1NyKivELoyij8eYA2gJwBgt4V5";
9455
- readonly xChainId: "solana";
9456
- })[];
9457
- declare const isLegacybnUSDChainId: (chainId: SpokeChainId) => boolean;
9458
- declare const isNewbnUSDChainId: (chainId: SpokeChainId) => boolean;
9459
- declare const isLegacybnUSDToken: (token: Token | string) => boolean;
9460
- declare const isNewbnUSDToken: (token: Token | string) => boolean;
9461
- declare const getAllLegacybnUSDTokens: () => {
9462
- token: LegacybnUSDToken;
9463
- chainId: LegacybnUSDChainId;
9464
- }[];
9465
-
9466
- declare function isEvmHubChainConfig(value: HubChainConfig): value is EvmHubChainConfig;
9467
- declare function isEvmSpokeChainConfig(value: SpokeChainConfig): value is EvmSpokeChainConfig;
9468
- declare function isEvmUninitializedConfig(value: EvmUninitializedConfig | EvmInitializedConfig): value is EvmUninitializedConfig;
9469
- declare function isEvmInitializedConfig(value: EvmUninitializedConfig | EvmInitializedConfig): value is EvmInitializedConfig;
9470
- declare function isEvmUninitializedBrowserConfig(value: EvmUninitializedConfig): value is EvmUninitializedBrowserConfig;
9471
- declare function isEvmUninitializedPrivateKeyConfig(value: EvmUninitializedConfig): value is EvmUninitializedPrivateKeyConfig;
9472
- declare function isIconAddress(value: unknown): value is IconAddress;
9473
- declare function isResponseAddressType(value: unknown): value is ResponseAddressType;
9474
- declare function isResponseSigningType(value: unknown): value is ResponseSigningType;
9475
- declare function isJsonRpcPayloadResponse(value: unknown): value is JsonRpcPayloadResponse;
9476
- declare function isIntentRelayChainId(value: bigint): value is IntentRelayChainId;
9477
- declare function isPartnerFeeAmount(value: unknown): value is PartnerFeeAmount;
9478
- declare function isPartnerFeePercentage(value: unknown): value is PartnerFeePercentage;
9479
- declare function isEvmSpokeProvider(value: SpokeProvider): value is EvmSpokeProvider;
9480
- declare function isSonicSpokeProvider(value: SpokeProvider): value is SonicSpokeProvider;
9481
- declare function isSolanaSpokeProvider(value: SpokeProvider): value is SolanaSpokeProvider;
9482
- declare function isStellarSpokeProvider(value: SpokeProvider): value is StellarSpokeProvider;
9483
- declare function isInjectiveSpokeProvider(value: SpokeProvider): value is InjectiveSpokeProvider;
9484
- declare function isIconSpokeProvider(value: SpokeProvider): value is IconSpokeProvider;
9485
- declare function isSuiSpokeProvider(value: SpokeProvider): value is SuiSpokeProvider;
9486
- declare function isConfiguredSolverConfig(value: SolverConfigParams): value is Prettify<SolverConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
9487
- declare function isConfiguredMoneyMarketConfig(value: MoneyMarketConfigParams): value is Prettify<MoneyMarketConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
9488
- declare function isIntentCreationFailedError(error: unknown): error is IntentError<'CREATION_FAILED'>;
9489
- declare function isIntentSubmitTxFailedError(error: unknown): error is IntentError<'SUBMIT_TX_FAILED'>;
9490
- declare function isIntentPostExecutionFailedError(error: unknown): error is IntentError<'POST_EXECUTION_FAILED'>;
9491
- declare function isWaitUntilIntentExecutedFailed(error: unknown): error is IntentError<'RELAY_TIMEOUT'>;
9492
- declare function isIntentCreationUnknownError(error: unknown): error is IntentError<'UNKNOWN'>;
9493
- declare function isMoneyMarketSubmitTxFailedError(error: unknown): error is MoneyMarketError<'SUBMIT_TX_FAILED'>;
9494
- declare function isMoneyMarketRelayTimeoutError(error: unknown): error is MoneyMarketError<'RELAY_TIMEOUT'>;
9495
- declare function isMoneyMarketCreateSupplyIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED'>;
9496
- declare function isMoneyMarketCreateBorrowIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_BORROW_INTENT_FAILED'>;
9497
- declare function isMoneyMarketCreateWithdrawIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED'>;
9498
- declare function isMoneyMarketCreateRepayIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_REPAY_INTENT_FAILED'>;
9499
- declare function isMoneyMarketSupplyUnknownError(error: unknown): error is MoneyMarketUnknownError<'SUPPLY_UNKNOWN_ERROR'>;
9500
- declare function isMoneyMarketBorrowUnknownError(error: unknown): error is MoneyMarketUnknownError<'BORROW_UNKNOWN_ERROR'>;
9501
- declare function isMoneyMarketWithdrawUnknownError(error: unknown): error is MoneyMarketUnknownError<'WITHDRAW_UNKNOWN_ERROR'>;
9502
- declare function isMoneyMarketRepayUnknownError(error: unknown): error is MoneyMarketUnknownError<'REPAY_UNKNOWN_ERROR'>;
9503
- declare function isIcxMigrateParams(value: unknown): value is IcxMigrateParams;
9504
- declare function isUnifiedBnUSDMigrateParams(value: unknown): value is UnifiedBnUSDMigrateParams;
9505
- declare function isBalnMigrateParams(value: unknown): value is BalnMigrateParams;
9506
- declare function isIcxCreateRevertMigrationParams(value: unknown): value is IcxCreateRevertMigrationParams;
9507
-
9508
- type CreateBridgeIntentParams = {
9509
- srcChainId: SpokeChainId;
9510
- srcAsset: string;
9621
+ type IcxMigrateParams = {
9622
+ address: IcxTokenType;
9511
9623
  amount: bigint;
9512
- dstChainId: SpokeChainId;
9513
- dstAsset: string;
9514
- recipient: string;
9515
- };
9516
- type BridgeParams<S extends SpokeProvider> = Prettify<{
9517
- params: CreateBridgeIntentParams;
9518
- spokeProvider: S;
9519
- skipSimulation?: boolean;
9520
- } & OptionalFee>;
9521
- type BridgeErrorCode = 'ALLOWANCE_CHECK_FAILED' | 'APPROVAL_FAILED' | 'CREATE_BRIDGE_INTENT_FAILED' | 'BRIDGE_FAILED' | RelayErrorCode;
9522
- type BridgeError<T extends BridgeErrorCode> = {
9523
- code: T;
9524
- error: unknown;
9624
+ to: Address$1;
9525
9625
  };
9526
- type BridgeExtraData = {
9527
- address: Hex$1;
9528
- payload: Hex$1;
9626
+ type IcxCreateRevertMigrationParams = {
9627
+ amount: bigint;
9628
+ to: IconEoaAddress;
9529
9629
  };
9530
- type BridgeOptionalExtraData = {
9531
- data?: BridgeExtraData;
9630
+ type IcxRevertMigrationParams = {
9631
+ wICX: IconAddress;
9632
+ amount: bigint;
9633
+ userWallet: Address$1;
9634
+ to: Hex;
9532
9635
  };
9533
- type BridgeServiceConstructorParams = {
9636
+ type IcxMigrationServiceConstructorParams = {
9534
9637
  hubProvider: EvmHubProvider;
9535
- relayerApiEndpoint: HttpUrl;
9536
- config: BridgeServiceConfig | undefined;
9537
9638
  configService: ConfigService;
9538
9639
  };
9539
9640
  /**
9540
- * BridgeService is a service that allows you to bridge tokens between chains
9541
- * Birdge action can be between to spokes chains but can also be used to withdraw and deposit into soda tokens on the HUB.
9542
- * By using soda tokens as src or destinatin address.
9543
- * @param hubProvider - The hub provider
9544
- * @param relayerApiEndpoint - The relayer API endpoint
9641
+ * Service for handling ICX migration operations on the hub chain.
9642
+ * Provides functionality to migrate wICX tokens from ICON to the hub chain.
9545
9643
  */
9546
- declare class BridgeService {
9547
- readonly hubProvider: EvmHubProvider;
9548
- readonly relayerApiEndpoint: HttpUrl;
9549
- readonly config: BridgeServiceConfig;
9550
- readonly configService: ConfigService;
9551
- constructor({ hubProvider, relayerApiEndpoint, config, configService }: BridgeServiceConstructorParams);
9552
- /**
9553
- * Get the fee for a given input amount
9554
- * @param {bigint} inputAmount - The amount of input tokens
9555
- * @returns {Promise<bigint>} The fee amount (denominated in input tokens)
9556
- *
9557
- * @example
9558
- * const fee: bigint = await sodax.bridge.getFee(1000000000000000n);
9559
- * console.log('Fee:', fee);
9560
- */
9561
- getFee(inputAmount: bigint): bigint;
9562
- /**
9563
- * Check if allowance is valid for the bridge transaction
9564
- * @param params - The bridge parameters
9565
- * @param spokeProvider - The spoke provider
9566
- * @returns {Promise<Result<boolean, BridgeError<'ALLOWANCE_CHECK_FAILED'>>>}
9567
- */
9568
- isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }: BridgeParams<S>): Promise<Result<boolean, BridgeError<'ALLOWANCE_CHECK_FAILED'>>>;
9569
- /**
9570
- * Approve token spending for the bridge transaction
9571
- * @param params - The bridge parameters
9572
- * @param spokeProvider - The spoke provider
9573
- * @param raw - Whether to return raw transaction data
9574
- * @returns Promise<Result<TxReturnType<S, R>, BridgeError<'APPROVAL_FAILED'>>>
9575
- */
9576
- approve<S extends SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<BridgeParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>, BridgeError<'APPROVAL_FAILED'>>>;
9644
+ declare class IcxMigrationService {
9645
+ private readonly hubProvider;
9646
+ private readonly configService;
9647
+ constructor({ hubProvider, configService }: IcxMigrationServiceConstructorParams);
9577
9648
  /**
9578
- * Execute a bridge transaction to transfer tokens from one chain to another
9579
- * @param params - The bridge parameters including source/destination chains, assets, and recipient
9580
- * @param spokeProvider - The spoke provider for the source chain
9581
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
9582
- * @returns {Promise<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>>} - Returns the transaction hashes for both spoke and hub chains or error
9583
- *
9584
- * @example
9585
- * const result = await sodax.bridge.bridge(
9586
- * {
9587
- * srcChainId: '0x2105.base',
9588
- * srcAsset: '0x...', // Address of the source token
9589
- * amount: 1000n, // Amount to bridge (in token decimals)
9590
- * dstChainId: '0x89.polygon',
9591
- * dstAsset: '0x...', // Address of the destination token
9592
- * recipient: '0x...', // Recipient address on destination chain
9593
- * partnerFee: { address: '0x...', percentage: 0.1 } // Optional partner fee. Partner fees and denominated in vault token decimals (18)
9594
- * },
9595
- * spokeProvider,
9596
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
9597
- * );
9598
- *
9599
- * if (!result.ok) {
9600
- * // Handle error
9601
- * }
9649
+ * Retrieves the available amount of SODA tokens in the ICX migration contract.
9650
+ * This represents the amount of tokens available for migration.
9602
9651
  *
9603
- * const [
9604
- * spokeTxHash, // transaction hash on the source chain
9605
- * hubTxHash, // transaction hash on the hub chain
9606
- * ] = result.value;
9607
- * console.log('Bridge transaction hashes:', { spokeTxHash, hubTxHash });
9652
+ * @returns The available balance of SODA tokens in the migration contract
9608
9653
  */
9609
- bridge<S extends SpokeProvider>({ params, spokeProvider, fee, timeout, }: Prettify<BridgeParams<S> & OptionalTimeout>): Promise<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>>;
9654
+ getAvailableAmount(): Promise<bigint>;
9610
9655
  /**
9611
- * Create bridge intent only (without relaying to hub)
9612
- * NOTE: This method only executes the transaction on the spoke chain and creates the bridge intent
9613
- * In order to successfully bridge tokens, you need to:
9614
- * 1. Check if the allowance is sufficient using isAllowanceValid
9615
- * 2. Approve the appropriate contract to spend the tokens using approve
9616
- * 3. Create the bridge intent using this method
9617
- * 4. Relay the transaction to the hub and await completion using the bridge method
9618
- *
9619
- * @param params - The bridge parameters including source/destination chains, assets, and recipient
9620
- * @param spokeProvider - The spoke provider for the source chain
9621
- * @param raw - Whether to return the raw transaction data
9622
- * @returns {Promise<Result<TxReturnType<S, R>, BridgeError<BridgeErrorCode>>>} - Returns the transaction result
9623
- *
9624
- * @example
9625
- * const bridgeService = new BridgeService(hubProvider, relayerApiEndpoint);
9626
- * const result = await sodax.bridge.createBridgeIntent(
9627
- * {
9628
- * srcChainId: 'ethereum',
9629
- * srcAsset: "0x123...", // source token address
9630
- * amount: 1000000000000000000n, // 1 token in wei
9631
- * dstChainId: 'polygon',
9632
- * dstAsset: "0x456...", // destination token address
9633
- * recipient: "0x789..." // recipient address
9634
- * },
9635
- * spokeProvider,
9636
- * raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
9637
- * );
9656
+ * Generates transaction data for migrating wICX tokens from ICON to the hub chain.
9657
+ * This method creates the necessary contract calls to:
9658
+ * 1. Approve the migration contract to spend the wICX tokens
9659
+ * 2. Execute the migration swap
9638
9660
  *
9639
- * if (result.ok) {
9640
- * const txHash = result.value;
9641
- * console.log('Bridge intent transaction hash:', txHash);
9642
- * } else {
9643
- * console.error('Bridge intent creation failed:', result.error);
9644
- * }
9661
+ * @param params - The migration parameters including token address, amount, and recipient
9662
+ * @returns Encoded transaction data for the migration operation
9663
+ * @throws Will throw an error if the hub asset configuration is not found
9645
9664
  */
9646
- createBridgeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, fee, raw, }: Prettify<BridgeParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>, BridgeError<'CREATE_BRIDGE_INTENT_FAILED'>> & BridgeOptionalExtraData>;
9665
+ migrateData(params: IcxMigrateParams): Hex;
9647
9666
  /**
9648
- * Build the bridge transaction data for executing the bridge operation on the hub
9649
- * @param params - The create bridge intent parameters
9650
- * @param srcAssetInfo - The source asset information
9651
- * @param dstAssetInfo - The destination asset information
9652
- * @returns Hex - The encoded contract calls for the bridge operation
9667
+ * Generates transaction data for migrating back tokens to the ICON chain.
9668
+ * @param params - The migration parameters including token address, amount, and recipient
9669
+ * @returns Encoded transaction data for the migration operation
9670
+ * @throws Will throw an error if the hub asset configuration is not found
9653
9671
  */
9654
- buildBridgeData(params: CreateBridgeIntentParams, srcAssetInfo: HubAssetInfo, dstAssetInfo: HubAssetInfo, partnerFee: PartnerFee | undefined): Hex$1;
9672
+ revertMigration(params: IcxRevertMigrationParams): Hex;
9655
9673
  /**
9656
- * Retrieves the deposited token balance held by the asset manager on a spoke chain.
9657
- * This balance represents the available liquidity for bridging operations and is used to verify
9658
- * that the target chain has sufficient funds to complete a bridge transaction.
9674
+ * Encodes a migration transaction for the ICX swap contract.
9675
+ * This creates the contract call data for swapping wICX tokens to SODA tokens.
9659
9676
  *
9660
- * @param spokeProvider - The spoke provider instance
9661
- * @param token - The token address to query the balance for
9662
- * @returns {Promise<bigint>} - The token balance as a bigint value
9663
- */
9664
- getBridgeableAmount(from: XToken, to: XToken): Promise<Result<bigint, unknown>>;
9665
- /**
9666
- * Check if two assets on different chains are bridgeable
9667
- * Two assets are bridgeable if they share the same vault on the hub chain
9668
- * @param from - The source X token
9669
- * @param to - The destination X token
9670
- * @param unchecked - Whether to skip the chain ID validation
9671
- * @returns boolean - true if assets are bridgeable, false otherwise
9677
+ * @param amount - The amount of wICX tokens to migrate
9678
+ * @param to - The address that will receive the migrated SODA tokens
9679
+ * @returns The encoded contract call for the migration operation
9672
9680
  */
9673
- isBridgeable({ from, to, unchecked, }: {
9674
- from: XToken;
9675
- to: XToken;
9676
- unchecked?: boolean;
9677
- }): boolean;
9681
+ encodeMigrate(amount: bigint, to: Address$1): EvmContractCall;
9678
9682
  /**
9679
- * Get all bridgeable tokens from a source token to a destination chain
9680
- * @param from - The source chain ID
9681
- * @param to - The destination chain ID
9682
- * @param token - The source token address
9683
- * @returns XToken[] - Array of bridgeable tokens on the destination chain
9683
+ * Encodes a revert migration transaction for the ICX swap contract.
9684
+ * This creates the contract call data for swapping SODA tokens to wICX tokens.
9685
+ *
9686
+ * @param amount - The amount of wICX tokens to migrate
9687
+ * @param to - The address that will receive the migrated SODA tokens
9688
+ * @returns The encoded contract call for the migration operation
9684
9689
  */
9685
- getBridgeableTokens(from: SpokeChainId, to: SpokeChainId, token: string): Result<XToken[]>;
9686
- filterTokensWithSameVault(tokens: Record<string, XToken>, to: SpokeChainId, srcAssetInfo: HubAssetInfo | undefined): XToken[];
9690
+ encodeRevertMigration(amount: bigint, to: Address$1): EvmContractCall;
9687
9691
  }
9688
9692
 
9689
- declare class StakingLogic {
9690
- private constructor();
9691
- /**
9692
- * Retrieves all unstake requests for a specific user.
9693
- * @param stakedSoda - The address of the StakedSoda contract.
9694
- * @param user - The address of the user.
9695
- * @param publicClient - PublicClient<HttpTransport>
9696
- * @returns Array of user unstake info for the user.
9697
- */
9698
- static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient<HttpTransport>): Promise<readonly UserUnstakeInfo[]>;
9699
- /**
9700
- * Encodes the depositFor transaction data.
9701
- * @param stakedSoda - The address of the StakedSoda contract.
9702
- * @param account - The address of the account to deposit for.
9703
- * @param amount - The amount of tokens to deposit.
9704
- * @returns The encoded contract call data.
9705
- */
9706
- static encodeDepositFor(stakedSoda: Address$1, account: Address$1, amount: bigint): EvmContractCall;
9707
- /**
9708
- * Encodes the withdrawTo transaction data.
9709
- * @param stakedSoda - The address of the StakedSoda contract.
9710
- * @param account - The address of the account to withdraw to.
9711
- * @param value - The amount of tokens to withdraw.
9712
- * @returns The encoded contract call data.
9713
- */
9714
- static encodeWithdrawTo(stakedSoda: Address$1, account: Address$1, value: bigint): EvmContractCall;
9715
- /**
9716
- * Encodes the unstake transaction data.
9717
- * @param stakedSoda - The address of the StakedSoda contract.
9718
- * @param account - The address of the account to unstake for.
9719
- * @param value - The amount of tokens to unstake.
9720
- * @returns The encoded contract call data.
9721
- */
9722
- static encodeUnstake(stakedSoda: Address$1, account: Address$1, value: bigint): EvmContractCall;
9693
+ type UnifiedBnUSDMigrateParams = {
9694
+ srcChainId: SpokeChainId;
9695
+ srcbnUSD: string;
9696
+ dstChainId: SpokeChainId;
9697
+ dstbnUSD: string;
9698
+ amount: bigint;
9699
+ to: string;
9700
+ };
9701
+ type FormattedBnUSDMigrateParams = {
9702
+ srcChainId: SpokeChainId;
9703
+ legacybnUSD: string;
9704
+ newbnUSD: string;
9705
+ amount: bigint;
9706
+ to: Hex;
9707
+ dstChainId: SpokeChainId;
9708
+ };
9709
+ type BnUSDRevertMigrationParams = {
9710
+ srcChainId: SpokeChainId;
9711
+ legacybnUSD: string;
9712
+ newbnUSD: string;
9713
+ amount: bigint;
9714
+ to: Hex;
9715
+ dstChainId: SpokeChainId;
9716
+ };
9717
+ type BnUSDMigrationServiceConstructorParams = {
9718
+ hubProvider: EvmHubProvider;
9719
+ configService: ConfigService;
9720
+ };
9721
+ /**
9722
+ * Service for handling bnUSD migration operations on the hub chain.
9723
+ * Provides functionality to migrate between legacy and new bnUSD tokens.
9724
+ */
9725
+ declare class BnUSDMigrationService {
9726
+ private readonly hubProvider;
9727
+ private readonly configService;
9728
+ constructor({ hubProvider, configService }: BnUSDMigrationServiceConstructorParams);
9723
9729
  /**
9724
- * Encodes the cancelUnstakeSodaRequest transaction data.
9725
- * @param stakedSoda - The address of the StakedSoda contract.
9726
- * @param requestId - The ID of the unstake request to cancel.
9727
- * @returns The encoded contract call data.
9730
+ * Generates transaction data for migrating legacy bnUSD tokens to new bnUSD tokens.
9731
+ * This method creates the necessary contract calls to:
9732
+ * 1. Wrap legacy bnUSD into vault tokens
9733
+ * 2. Migrate to new bnUSD vault
9734
+ * 3. Withdraw to new bnUSD tokens
9735
+ *
9736
+ * @param params - The migration parameters including token addresses, amount, and recipient
9737
+ * @returns Encoded transaction data for the migration operation
9738
+ * @throws Will throw an error if the hub asset configuration is not found
9728
9739
  */
9729
- static encodeCancelUnstakeSodaRequest(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
9740
+ migrateData(params: FormattedBnUSDMigrateParams): Hex;
9730
9741
  /**
9731
- * Encodes the cancelUnstakeRequest transaction data (alias for encodeCancelUnstakeSodaRequest).
9732
- * @param stakedSoda - The address of the StakedSoda contract.
9733
- * @param requestId - The ID of the unstake request to cancel.
9734
- * @returns The encoded contract call data.
9742
+ * Generates transaction data for migrating new bnUSD tokens back to legacy bnUSD tokens.
9743
+ * This method creates the necessary contract calls to:
9744
+ * 1. Wrap new bnUSD into vault tokens
9745
+ * 2. Migrate to legacy bnUSD vault
9746
+ * 3. Withdraw to legacy bnUSD tokens
9747
+ *
9748
+ * @param params - The migration parameters including token addresses, amount, and recipient
9749
+ * @returns Encoded transaction data for the migration operation
9750
+ * @throws Will throw an error if the hub asset configuration is not found
9735
9751
  */
9736
- static encodeCancelUnstakeRequest(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
9737
- /**
9738
- * Encodes the claim transaction data.
9739
- * @param stakedSoda - The address of the StakedSoda contract.
9740
- * @param requestId - The ID of the unstake request to claim.
9741
- * @returns The encoded contract call data.
9742
- */
9743
- static encodeClaim(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
9752
+ revertMigrationData(params: BnUSDRevertMigrationParams): Hex;
9753
+ }
9754
+
9755
+ /**
9756
+ * Lockup periods in seconds
9757
+ */
9758
+ declare enum LockupPeriod {
9759
+ NO_LOCKUP = 0,
9760
+ SIX_MONTHS = 15552000,// 6 months
9761
+ TWELVE_MONTHS = 31104000,// 12 months
9762
+ EIGHTEEN_MONTHS = 46656000,// 18 months
9763
+ TWENTY_FOUR_MONTHS = 62208000
9764
+ }
9765
+ /**
9766
+ * Reward multipliers (in basis points, 10000 = 1.0)
9767
+ */
9768
+ declare enum LockupMultiplier {
9769
+ NO_LOCKUP_MULTIPLIER = 5000,// 0.5x
9770
+ SIX_MONTHS_MULTIPLIER = 7500,// 0.75x
9771
+ TWELVE_MONTHS_MULTIPLIER = 10000,// 1.0x
9772
+ EIGHTEEN_MONTHS_MULTIPLIER = 12500,// 1.25x
9773
+ TWENTY_FOUR_MONTHS_MULTIPLIER = 15000
9774
+ }
9775
+ /**
9776
+ * Unstake request information from the staked SODA contract.
9777
+ */
9778
+ type UnstakeRequest = {
9779
+ /** The amount being unstaked */
9780
+ amount: bigint;
9781
+ /** The start time of the unstake request */
9782
+ startTime: bigint;
9783
+ /** The address to receive the unstaked tokens */
9784
+ to: Address$1;
9785
+ };
9786
+ /**
9787
+ * Detailed lock information structure returned by the BALN swap contract.
9788
+ */
9789
+ type DetailedLock = {
9790
+ /** The amount of BALN tokens in the lock */
9791
+ balnAmount: bigint;
9792
+ /** The amount of SODA tokens in the lock */
9793
+ sodaAmount: bigint;
9794
+ /** The unlock time for the lock */
9795
+ unlockTime: bigint;
9796
+ /** The amount of xSODA tokens in the lock */
9797
+ xSodaAmount: bigint;
9798
+ /** The unstaking ID for the lock */
9799
+ unstakingId: bigint;
9800
+ /** The unstake request information */
9801
+ unstakeRequest: UnstakeRequest;
9802
+ /** The amount of staked SODA tokens */
9803
+ stakedSodaAmount: bigint;
9804
+ };
9805
+ /**
9806
+ * Parameters for BALN swap operations.
9807
+ */
9808
+ type BalnMigrateParams = {
9809
+ /** The amount of BALN tokens to swap */
9810
+ amount: bigint;
9811
+ /** The lockup period for the swap */
9812
+ lockupPeriod: LockupPeriod;
9813
+ /** The address that will receive the swapped SODA tokens */
9814
+ to: Address$1;
9815
+ /** Whether to stake the SODA tokens */
9816
+ stake: boolean;
9817
+ };
9818
+ /**
9819
+ * Parameters for BALN lock operations.
9820
+ */
9821
+ type BalnLockParams = {
9822
+ /** The lock ID to operate on */
9823
+ lockId: bigint;
9824
+ };
9825
+ type BalnSwapServiceConstructorParams = {
9826
+ hubProvider: EvmHubProvider;
9827
+ };
9828
+ /**
9829
+ * Service for handling BALN swap operations on the hub chain.
9830
+ * Provides functionality to interact directly with the BALN swap contract.
9831
+ */
9832
+ declare class BalnSwapService {
9833
+ private readonly hubProvider;
9834
+ constructor({ hubProvider }: BalnSwapServiceConstructorParams);
9744
9835
  /**
9745
- * Returns the total amount of SODA assets held by the xSoda vault.
9746
- * @param xSoda - The address of the xSoda token contract.
9747
- * @param publicClient - PublicClient<HttpTransport>
9748
- * @returns The total amount of SODA assets.
9836
+ * Gets the multiplier for a given lockup period.
9837
+ * @param lockupPeriod - The lockup period
9838
+ * @returns The multiplier in basis points
9749
9839
  */
9750
- static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9840
+ getMultiplierForPeriod(lockupPeriod: LockupPeriod): bigint;
9751
9841
  /**
9752
- * Calculates the number of xSoda shares equivalent to a given amount of SODA assets.
9753
- * @param xSoda - The address of the xSoda token contract.
9754
- * @param assets - The amount of SODA assets to convert.
9755
- * @param publicClient - PublicClient<HttpTransport>
9756
- * @returns The number of xSoda shares.
9842
+ * Calculates the SODA amount for a given BALN amount and lockup period without calling the contract.
9843
+ * @param balnAmount - The amount of BALN tokens
9844
+ * @param lockupPeriod - The lockup period
9845
+ * @returns The calculated SODA amount
9757
9846
  */
9758
- static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9847
+ calculateSodaAmount(balnAmount: bigint, lockupPeriod: LockupPeriod): bigint;
9759
9848
  /**
9760
- * Calculates the amount of SODA assets corresponding to a specific number of xSoda shares.
9761
- * @param xSoda - The address of the xSoda token contract.
9762
- * @param shares - The number of xSoda shares to convert.
9763
- * @param publicClient - PublicClient<HttpTransport>
9764
- * @returns The amount of SODA assets.
9849
+ * Generates transaction data for swapping BALN tokens to SODA tokens.
9850
+ * This method creates the necessary contract calls to:
9851
+ * 1. Approve the BALN swap contract to spend the BALN tokens
9852
+ * 2. Execute the BALN swap with lockup period
9853
+ *
9854
+ * @param balnToken - The address of the BALN token
9855
+ * @param params - The BALN swap parameters including amount, lockup period, and recipient
9856
+ * @param configService - The config service
9857
+ * @returns Encoded transaction data for the BALN swap operation
9765
9858
  */
9766
- static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9859
+ swapData(balnToken: IconContractAddress, params: BalnMigrateParams, configService: ConfigService): Hex;
9767
9860
  /**
9768
- * Simulates the effects of depositing SODA into xSoda without executing it.
9769
- * @param xSoda - The address of the xSoda token contract.
9770
- * @param assets - The amount of SODA assets to deposit.
9771
- * @param publicClient - PublicClient<HttpTransport>
9772
- * @returns The number of xSoda shares that would be minted.
9861
+ * Executes a claim operation directly through the wallet provider.
9862
+ * @param params - The lock parameters including lock ID
9863
+ * @param spokeProvider - The Sonic spoke provider
9864
+ * @param raw - Whether to return raw transaction data
9865
+ * @returns The transaction hash or raw transaction data
9773
9866
  */
9774
- static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9867
+ claim<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
9775
9868
  /**
9776
- * Simulates the effects of minting xSoda shares without executing it.
9777
- * @param xSoda - The address of the xSoda token contract.
9778
- * @param shares - The number of xSoda shares to mint.
9779
- * @param publicClient - PublicClient<HttpTransport>
9780
- * @returns The amount of SODA assets that would be deposited.
9869
+ * Executes a claim unstaked operation directly through the wallet provider.
9870
+ * @param params - The lock parameters including lock ID
9871
+ * @param spokeProvider - The Sonic spoke provider
9872
+ * @param raw - Whether to return raw transaction data
9873
+ * @returns The transaction hash or raw transaction data
9781
9874
  */
9782
- static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9875
+ claimUnstaked<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
9783
9876
  /**
9784
- * Simulates the effects of withdrawing SODA from xSoda without executing it.
9785
- * @param xSoda - The address of the xSoda token contract.
9786
- * @param assets - The amount of SODA assets to withdraw.
9787
- * @param publicClient - PublicClient<HttpTransport>
9788
- * @returns The number of xSoda shares that would be burned.
9877
+ * Executes a stake operation directly through the wallet provider.
9878
+ * @param params - The lock parameters including lock ID
9879
+ * @param spokeProvider - The Sonic spoke provider
9880
+ * @param raw - Whether to return raw transaction data
9881
+ * @returns The transaction hash or raw transaction data
9789
9882
  */
9790
- static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9883
+ stake<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
9791
9884
  /**
9792
- * Simulates the effects of redeeming xSoda shares without executing it.
9793
- * @param xSoda - The address of the xSoda token contract.
9794
- * @param shares - The number of xSoda shares to redeem.
9795
- * @param publicClient - PublicClient<HttpTransport>
9796
- * @returns The amount of SODA assets that would be withdrawn.
9885
+ * Executes an unstake operation directly through the wallet provider.
9886
+ * @param params - The lock parameters including lock ID
9887
+ * @param spokeProvider - The Sonic spoke provider
9888
+ * @param raw - Whether to return raw transaction data
9889
+ * @returns The transaction hash or raw transaction data
9797
9890
  */
9798
- static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9891
+ unstake<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
9799
9892
  /**
9800
- * Encodes the xSoda deposit transaction data (deposit SODA to get xSoda shares).
9801
- * @param xSoda - The address of the xSoda token contract.
9802
- * @param assets - The amount of SODA assets to deposit.
9803
- * @param receiver - The address of the receiver.
9804
- * @returns The encoded contract call data.
9893
+ * Executes a cancel unstake operation directly through the wallet provider.
9894
+ * @param params - The lock parameters including lock ID
9895
+ * @param spokeProvider - The Sonic spoke provider
9896
+ * @param raw - Whether to return raw transaction data
9897
+ * @returns The transaction hash or raw transaction data
9805
9898
  */
9806
- static encodeXSodaDeposit(xSoda: Address$1, assets: bigint, receiver: Address$1): EvmContractCall;
9899
+ cancelUnstake<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
9807
9900
  /**
9808
- * Encodes the xSoda mint transaction data (mint xSoda shares by depositing SODA).
9809
- * @param xSoda - The address of the xSoda token contract.
9810
- * @param shares - The number of xSoda shares to mint.
9811
- * @param receiver - The address of the receiver.
9812
- * @returns The encoded contract call data.
9901
+ * Gets detailed locks for a specific user including unstake requests and staked amounts.
9902
+ *
9903
+ * @param publicClient - The public client for reading contract state
9904
+ * @param user - The user address
9905
+ * @returns Array of detailed lock information for the user
9813
9906
  */
9814
- static encodeXSodaMint(xSoda: Address$1, shares: bigint, receiver: Address$1): EvmContractCall;
9907
+ getDetailedUserLocks(publicClient: PublicClient<HttpTransport>, user: Address$1): Promise<readonly DetailedLock[]>;
9815
9908
  /**
9816
- * Encodes the xSoda withdraw transaction data (withdraw SODA by burning xSoda shares).
9817
- * @param xSoda - The address of the xSoda token contract.
9818
- * @param assets - The amount of SODA assets to withdraw.
9819
- * @param receiver - The address of the receiver.
9820
- * @param owner - The address of the owner.
9821
- * @returns The encoded contract call data.
9909
+ * Encodes a swap transaction for the BALN swap contract.
9910
+ *
9911
+ * @param amount - The amount of BALN tokens to swap
9912
+ * @param lockupPeriod - The lockup period for the swap
9913
+ * @param to - The address that will receive the swapped SODA tokens
9914
+ * @param stake - Whether to stake the SODA tokens
9915
+ * @returns The encoded contract call for the swap operation
9822
9916
  */
9823
- static encodeXSodaWithdraw(xSoda: Address$1, assets: bigint, receiver: Address$1, owner: Address$1): EvmContractCall;
9917
+ encodeSwap(amount: bigint, lockupPeriod: LockupPeriod, to: Address$1, stake: boolean): EvmContractCall;
9824
9918
  /**
9825
- * Encodes the xSoda redeem transaction data (redeem xSoda shares to get SODA).
9826
- * @param xSoda - The address of the xSoda token contract.
9827
- * @param shares - The number of xSoda shares to redeem.
9828
- * @param receiver - The address of the receiver.
9829
- * @param owner - The address of the owner.
9830
- * @returns The encoded contract call data.
9919
+ * Encodes a claim transaction for the BALN swap contract.
9920
+ *
9921
+ * @param lockId - The lock ID to claim from
9922
+ * @returns The encoded contract call for the claim operation
9831
9923
  */
9832
- static encodeXSodaRedeem(xSoda: Address$1, shares: bigint, receiver: Address$1, owner: Address$1): EvmContractCall;
9924
+ encodeClaim(lockId: bigint): EvmContractCall;
9833
9925
  /**
9834
- * Encodes the StakingRouter stake transaction data.
9835
- * @param stakingRouter - The address of the StakingRouter contract.
9836
- * @param amount - The amount of SODA to stake.
9837
- * @param to - The address to receive the staked tokens.
9838
- * @param minReceive - The minimum amount to receive.
9839
- * @returns The encoded contract call data.
9926
+ * Encodes a claim unstaked transaction for the BALN swap contract.
9927
+ *
9928
+ * @param lockId - The lock ID to claim unstaked tokens from
9929
+ * @returns The encoded contract call for the claim unstaked operation
9840
9930
  */
9841
- static encodeStakingRouterStake(stakingRouter: Address$1, amount: bigint, to: Address$1, minReceive: bigint): EvmContractCall;
9931
+ encodeClaimUnstaked(lockId: bigint): EvmContractCall;
9842
9932
  /**
9843
- * Encodes the StakingRouter unstake transaction data.
9844
- * @param stakingRouter - The address of the StakingRouter contract.
9845
- * @param amount - The amount of xSoda to unstake.
9846
- * @param minAmount - The minimum amount of SODA to receive.
9847
- * @param asset - The asset address to receive.
9848
- * @param chainID - The destination chain ID.
9849
- * @param to - The destination address as bytes.
9850
- * @returns The encoded contract call data.
9933
+ * Encodes a stake transaction for the BALN swap contract.
9934
+ *
9935
+ * @param lockId - The lock ID to stake
9936
+ * @returns The encoded contract call for the stake operation
9851
9937
  */
9852
- static encodeStakingRouterUnstake(stakingRouter: Address$1, amount: bigint, minAmount: bigint, asset: Address$1, chainID: bigint, to: Hex): EvmContractCall;
9938
+ encodeStake(lockId: bigint): EvmContractCall;
9853
9939
  /**
9854
- * Estimates the xSoda amount and preview deposit for a given SODA amount.
9855
- * @param stakingRouter - The address of the StakingRouter contract.
9856
- * @param amount - The amount of SODA to estimate.
9857
- * @param publicClient - PublicClient<HttpTransport>
9858
- * @returns Tuple containing [xSodaAmount, previewDepositAmount].
9940
+ * Encodes an unstake transaction for the BALN swap contract.
9941
+ *
9942
+ * @param lockId - The lock ID to unstake
9943
+ * @returns The encoded contract call for the unstake operation
9859
9944
  */
9860
- static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<readonly [bigint, bigint]>;
9945
+ encodeUnstake(lockId: bigint): EvmContractCall;
9861
9946
  /**
9862
- * Estimates the instant unstake amount for a given xSoda amount.
9863
- * @param stakingRouter - The address of the StakingRouter contract.
9864
- * @param amount - The amount of xSoda to estimate unstake for.
9865
- * @param publicClient - PublicClient<HttpTransport>
9866
- * @returns The estimated SODA amount from instant unstake.
9947
+ * Encodes a cancel unstake transaction for the BALN swap contract.
9948
+ *
9949
+ * @param lockId - The lock ID to cancel unstake for
9950
+ * @returns The encoded contract call for the cancel unstake operation
9867
9951
  */
9868
- static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9952
+ encodeCancelUnstake(lockId: bigint): EvmContractCall;
9953
+ /**
9954
+ * Executes a contract call through the Sonic wallet provider.
9955
+ * @param spokeProvider - The Sonic spoke provider
9956
+ * @param rawTx - The raw contract call to execute
9957
+ * @param raw - Whether to return raw transaction data
9958
+ * @returns The transaction hash or raw transaction data
9959
+ */
9960
+ call<S extends SonicSpokeProviderType, R extends boolean = false>(spokeProvider: S, rawTx: EvmContractCall, raw?: R): Promise<TxReturnType<S, R>>;
9869
9961
  }
9870
9962
 
9871
- type StakeParams = {
9872
- amount: bigint;
9873
- minReceive: bigint;
9874
- account: Address$1;
9875
- action: 'stake';
9876
- };
9877
- type UnstakeParams = {
9878
- amount: bigint;
9879
- account: Address$1;
9880
- action: 'unstake';
9881
- };
9882
- type ClaimParams = {
9883
- requestId: bigint;
9884
- amount: bigint;
9885
- action: 'claim';
9886
- };
9887
- type CancelUnstakeParams = {
9888
- requestId: bigint;
9889
- action: 'cancelUnstake';
9890
- };
9891
- type InstantUnstakeParams = {
9963
+ declare function isEvmHubChainConfig(value: HubChainConfig): value is EvmHubChainConfig;
9964
+ declare function isEvmSpokeChainConfig(value: SpokeChainConfig): value is EvmSpokeChainConfig;
9965
+ declare function isEvmUninitializedConfig(value: EvmUninitializedConfig | EvmInitializedConfig): value is EvmUninitializedConfig;
9966
+ declare function isEvmInitializedConfig(value: EvmUninitializedConfig | EvmInitializedConfig): value is EvmInitializedConfig;
9967
+ declare function isEvmUninitializedBrowserConfig(value: EvmUninitializedConfig): value is EvmUninitializedBrowserConfig;
9968
+ declare function isEvmUninitializedPrivateKeyConfig(value: EvmUninitializedConfig): value is EvmUninitializedPrivateKeyConfig;
9969
+ declare function isIconAddress(value: unknown): value is IconAddress;
9970
+ declare function isResponseAddressType(value: unknown): value is ResponseAddressType;
9971
+ declare function isResponseSigningType(value: unknown): value is ResponseSigningType;
9972
+ declare function isJsonRpcPayloadResponse(value: unknown): value is JsonRpcPayloadResponse;
9973
+ declare function isIntentRelayChainId(value: bigint): value is IntentRelayChainId;
9974
+ declare function isPartnerFeeAmount(value: unknown): value is PartnerFeeAmount;
9975
+ declare function isPartnerFeePercentage(value: unknown): value is PartnerFeePercentage;
9976
+ declare function isEvmSpokeProviderType(value: SpokeProviderType): value is EvmSpokeProviderType;
9977
+ declare function isEvmSpokeProvider(value: SpokeProviderType): value is EvmSpokeProvider;
9978
+ declare function isSonicSpokeProviderType(value: SpokeProviderType): value is SonicSpokeProviderType;
9979
+ declare function isSonicSpokeProvider(value: SpokeProviderType): value is SonicSpokeProvider;
9980
+ declare function isSolanaSpokeProviderType(value: SpokeProviderType): value is SolanaSpokeProviderType;
9981
+ declare function isSolanaSpokeProvider(value: SpokeProviderType): value is SolanaSpokeProvider;
9982
+ declare function isStellarSpokeProviderType(value: SpokeProviderType): value is StellarSpokeProviderType;
9983
+ declare function isStellarSpokeProvider(value: SpokeProviderType): value is StellarSpokeProvider;
9984
+ declare function isInjectiveSpokeProviderType(value: SpokeProviderType): value is InjectiveSpokeProviderType;
9985
+ declare function isInjectiveSpokeProvider(value: SpokeProviderType): value is InjectiveSpokeProvider;
9986
+ declare function isIconSpokeProviderType(value: SpokeProviderType): value is IconSpokeProviderType;
9987
+ declare function isIconSpokeProvider(value: SpokeProviderType): value is IconSpokeProvider;
9988
+ declare function isSuiSpokeProviderType(value: SpokeProviderType): value is SuiSpokeProviderType;
9989
+ declare function isSuiSpokeProvider(value: SpokeProviderType): value is SuiSpokeProvider;
9990
+ declare function isConfiguredSolverConfig(value: SolverConfigParams): value is Prettify<SolverConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
9991
+ declare function isConfiguredMoneyMarketConfig(value: MoneyMarketConfigParams): value is Prettify<MoneyMarketConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
9992
+ declare function isIntentCreationFailedError(error: unknown): error is IntentError<'CREATION_FAILED'>;
9993
+ declare function isIntentSubmitTxFailedError(error: unknown): error is IntentError<'SUBMIT_TX_FAILED'>;
9994
+ declare function isIntentPostExecutionFailedError(error: unknown): error is IntentError<'POST_EXECUTION_FAILED'>;
9995
+ declare function isWaitUntilIntentExecutedFailed(error: unknown): error is IntentError<'RELAY_TIMEOUT'>;
9996
+ declare function isIntentCreationUnknownError(error: unknown): error is IntentError<'UNKNOWN'>;
9997
+ declare function isMoneyMarketSubmitTxFailedError(error: unknown): error is MoneyMarketError<'SUBMIT_TX_FAILED'>;
9998
+ declare function isMoneyMarketRelayTimeoutError(error: unknown): error is MoneyMarketError<'RELAY_TIMEOUT'>;
9999
+ declare function isMoneyMarketCreateSupplyIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED'>;
10000
+ declare function isMoneyMarketCreateBorrowIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_BORROW_INTENT_FAILED'>;
10001
+ declare function isMoneyMarketCreateWithdrawIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED'>;
10002
+ declare function isMoneyMarketCreateRepayIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_REPAY_INTENT_FAILED'>;
10003
+ declare function isMoneyMarketSupplyUnknownError(error: unknown): error is MoneyMarketUnknownError<'SUPPLY_UNKNOWN_ERROR'>;
10004
+ declare function isMoneyMarketBorrowUnknownError(error: unknown): error is MoneyMarketUnknownError<'BORROW_UNKNOWN_ERROR'>;
10005
+ declare function isMoneyMarketWithdrawUnknownError(error: unknown): error is MoneyMarketUnknownError<'WITHDRAW_UNKNOWN_ERROR'>;
10006
+ declare function isMoneyMarketRepayUnknownError(error: unknown): error is MoneyMarketUnknownError<'REPAY_UNKNOWN_ERROR'>;
10007
+ declare function isIcxMigrateParams(value: unknown): value is IcxMigrateParams;
10008
+ declare function isUnifiedBnUSDMigrateParams(value: unknown): value is UnifiedBnUSDMigrateParams;
10009
+ declare function isBalnMigrateParams(value: unknown): value is BalnMigrateParams;
10010
+ declare function isIcxCreateRevertMigrationParams(value: unknown): value is IcxCreateRevertMigrationParams;
10011
+ declare function isRawSpokeProvider(value: unknown): value is RawSpokeProvider;
10012
+ declare function isEvmRawSpokeProvider(value: unknown): value is EvmRawSpokeProvider;
10013
+ declare function isSolanaRawSpokeProvider(value: unknown): value is SolanaRawSpokeProvider;
10014
+ declare function isStellarRawSpokeProvider(value: unknown): value is StellarRawSpokeProvider;
10015
+ declare function isIconRawSpokeProvider(value: unknown): value is IconRawSpokeProvider;
10016
+ declare function isSuiRawSpokeProvider(value: unknown): value is SuiRawSpokeProvider;
10017
+ declare function isInjectiveRawSpokeProvider(value: unknown): value is InjectiveRawSpokeProvider;
10018
+ declare function isSonicRawSpokeProvider(value: unknown): value is SonicRawSpokeProvider;
10019
+
10020
+ type CreateBridgeIntentParams = {
10021
+ srcChainId: SpokeChainId;
10022
+ srcAsset: string;
9892
10023
  amount: bigint;
9893
- minAmount: bigint;
9894
- account: Address$1;
9895
- action: 'instantUnstake';
9896
- };
9897
- type StakingAction = 'stake' | 'unstake' | 'claim' | 'cancelUnstake' | 'instantUnstake';
9898
- type StakingParams = StakeParams | UnstakeParams | ClaimParams | CancelUnstakeParams | InstantUnstakeParams;
9899
- type StakingInfo = {
9900
- totalStaked: bigint;
9901
- totalUnderlying: bigint;
9902
- userXSodaBalance: bigint;
9903
- userXSodaValue: bigint;
9904
- userUnderlying: bigint;
9905
- };
9906
- type UnstakingInfo = {
9907
- userUnstakeSodaRequests: readonly UserUnstakeInfo[];
9908
- totalUnstaking: bigint;
9909
- };
9910
- type UnstakeRequestWithPenalty = UserUnstakeInfo & {
9911
- penalty: bigint;
9912
- penaltyPercentage: number;
9913
- claimableAmount: bigint;
9914
- };
9915
- type StakingConfig = {
9916
- unstakingPeriod: bigint;
9917
- minUnstakingPeriod: bigint;
9918
- maxPenalty: bigint;
10024
+ dstChainId: SpokeChainId;
10025
+ dstAsset: string;
10026
+ recipient: string;
9919
10027
  };
9920
- type StakingErrorCode = 'STAKE_FAILED' | 'UNSTAKE_FAILED' | 'INSTANT_UNSTAKE_FAILED' | 'CLAIM_FAILED' | 'CANCEL_UNSTAKE_FAILED' | 'INFO_FETCH_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'APPROVAL_FAILED';
9921
- type StakingError<T extends StakingErrorCode> = {
10028
+ type BridgeParams<S extends SpokeProvider> = Prettify<{
10029
+ params: CreateBridgeIntentParams;
10030
+ spokeProvider: S;
10031
+ skipSimulation?: boolean;
10032
+ } & OptionalFee>;
10033
+ type BridgeErrorCode = 'ALLOWANCE_CHECK_FAILED' | 'APPROVAL_FAILED' | 'CREATE_BRIDGE_INTENT_FAILED' | 'BRIDGE_FAILED' | RelayErrorCode;
10034
+ type BridgeError<T extends BridgeErrorCode> = {
9922
10035
  code: T;
9923
10036
  error: unknown;
9924
10037
  };
9925
- type StakingServiceConstructorParams = {
10038
+ type BridgeExtraData = {
10039
+ address: Hex$1;
10040
+ payload: Hex$1;
10041
+ };
10042
+ type BridgeOptionalExtraData = {
10043
+ data?: BridgeExtraData;
10044
+ };
10045
+ type BridgeServiceConstructorParams = {
9926
10046
  hubProvider: EvmHubProvider;
9927
10047
  relayerApiEndpoint: HttpUrl;
10048
+ config: BridgeServiceConfig | undefined;
9928
10049
  configService: ConfigService;
9929
10050
  };
9930
10051
  /**
9931
- * StakingService provides a high-level interface for staking operations
9932
- * including staking SODA tokens, unstaking, claiming rewards, and retrieving staking information.
9933
- * All transaction methods return encoded contract calls that can be sent via a wallet provider.
10052
+ * BridgeService is a service that allows you to bridge tokens between chains
10053
+ * Birdge action can be between to spokes chains but can also be used to withdraw and deposit into soda tokens on the HUB.
10054
+ * By using soda tokens as src or destinatin address.
10055
+ * @param hubProvider - The hub provider
10056
+ * @param relayerApiEndpoint - The relayer API endpoint
9934
10057
  */
9935
- declare class StakingService {
9936
- private readonly hubProvider;
9937
- private readonly relayerApiEndpoint;
9938
- private readonly configService;
9939
- constructor({ hubProvider, relayerApiEndpoint, configService }: StakingServiceConstructorParams);
10058
+ declare class BridgeService {
10059
+ readonly hubProvider: EvmHubProvider;
10060
+ readonly relayerApiEndpoint: HttpUrl;
10061
+ readonly config: BridgeServiceConfig;
10062
+ readonly configService: ConfigService;
10063
+ constructor({ hubProvider, relayerApiEndpoint, config, configService }: BridgeServiceConstructorParams);
9940
10064
  /**
9941
- * Check if allowance is valid for the staking operations
9942
- * @param params - The staking parameters
10065
+ * Get the fee for a given input amount
10066
+ * @param {bigint} inputAmount - The amount of input tokens
10067
+ * @returns {Promise<bigint>} The fee amount (denominated in input tokens)
10068
+ *
10069
+ * @example
10070
+ * const fee: bigint = await sodax.bridge.getFee(1000000000000000n);
10071
+ * console.log('Fee:', fee);
10072
+ */
10073
+ getFee(inputAmount: bigint): bigint;
10074
+ /**
10075
+ * Check if allowance is valid for the bridge transaction
10076
+ * @param params - The bridge parameters
9943
10077
  * @param spokeProvider - The spoke provider
9944
- * @returns {Promise<Result<boolean, StakingError<'ALLOWANCE_CHECK_FAILED'>>>}
10078
+ * @returns {Promise<Result<boolean, BridgeError<'ALLOWANCE_CHECK_FAILED'>>>}
9945
10079
  */
9946
- isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }: Prettify<{
9947
- params: StakingParams;
9948
- spokeProvider: S;
9949
- }>): Promise<Result<boolean, StakingError<'ALLOWANCE_CHECK_FAILED'>>>;
10080
+ isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }: BridgeParams<S>): Promise<Result<boolean, BridgeError<'ALLOWANCE_CHECK_FAILED'>>>;
9950
10081
  /**
9951
- * Approve token spending for the staking operations
9952
- * @param params - The staking parameters
10082
+ * Approve token spending for the bridge transaction
10083
+ * @param params - The bridge parameters
9953
10084
  * @param spokeProvider - The spoke provider
9954
10085
  * @param raw - Whether to return raw transaction data
9955
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'APPROVAL_FAILED'>>>
10086
+ * @returns Promise<Result<TxReturnType<S, R>, BridgeError<'APPROVAL_FAILED'>>>
9956
10087
  */
9957
- approve<S extends SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
9958
- params: StakingParams;
9959
- spokeProvider: S;
9960
- raw?: R;
9961
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'APPROVAL_FAILED'>>>;
10088
+ approve<S extends SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<BridgeParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>, BridgeError<'APPROVAL_FAILED'>>>;
9962
10089
  /**
9963
- * Execute stake transaction for staking SODA tokens to receive xSoda shares
9964
- * NOTE: For EVM chains, you may need to approve token spending first using the approve method
9965
- * @param params - The staking parameters
9966
- * @param spokeProvider - The spoke provider
9967
- * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
9968
- * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'STAKE_FAILED'> | RelayError>>
10090
+ * Execute a bridge transaction to transfer tokens from one chain to another
10091
+ * @param params - The bridge parameters including source/destination chains, assets, and recipient
10092
+ * @param spokeProvider - The spoke provider for the source chain
10093
+ * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10094
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>>} - Returns the transaction hashes for both spoke and hub chains or error
10095
+ *
10096
+ * @example
10097
+ * const result = await sodax.bridge.bridge(
10098
+ * {
10099
+ * srcChainId: '0x2105.base',
10100
+ * srcAsset: '0x...', // Address of the source token
10101
+ * amount: 1000n, // Amount to bridge (in token decimals)
10102
+ * dstChainId: '0x89.polygon',
10103
+ * dstAsset: '0x...', // Address of the destination token
10104
+ * recipient: '0x...', // Recipient address on destination chain
10105
+ * partnerFee: { address: '0x...', percentage: 0.1 } // Optional partner fee. Partner fees and denominated in vault token decimals (18)
10106
+ * },
10107
+ * spokeProvider,
10108
+ * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
10109
+ * );
10110
+ *
10111
+ * if (!result.ok) {
10112
+ * // Handle error
10113
+ * }
10114
+ *
10115
+ * const [
10116
+ * spokeTxHash, // transaction hash on the source chain
10117
+ * hubTxHash, // transaction hash on the hub chain
10118
+ * ] = result.value;
10119
+ * console.log('Bridge transaction hashes:', { spokeTxHash, hubTxHash });
9969
10120
  */
9970
- stake(params: StakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'STAKE_FAILED'> | RelayError>>;
10121
+ bridge<S extends SpokeProvider>({ params, spokeProvider, fee, timeout, }: Prettify<BridgeParams<S> & OptionalTimeout>): Promise<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>>;
9971
10122
  /**
9972
- * Create stake intent only (without relaying to hub)
9973
- * NOTE: This method only executes the transaction on the spoke chain and creates the stake intent
9974
- * In order to successfully stake tokens, you need to:
10123
+ * Create bridge intent only (without relaying to hub)
10124
+ * NOTE: This method only executes the transaction on the spoke chain and creates the bridge intent
10125
+ * In order to successfully bridge tokens, you need to:
9975
10126
  * 1. Check if the allowance is sufficient using isAllowanceValid
9976
10127
  * 2. Approve the appropriate contract to spend the tokens using approve
9977
- * 3. Create the stake intent using this method
9978
- * 4. Relay the transaction to the hub and await completion using the stake method
10128
+ * 3. Create the bridge intent using this method
10129
+ * 4. Relay the transaction to the hub and await completion using the bridge method
9979
10130
  *
9980
- * @param params - The stake parameters including amount and account
10131
+ * @param params - The bridge parameters including source/destination chains, assets, and recipient
9981
10132
  * @param spokeProvider - The spoke provider for the source chain
9982
- * @param raw - Whether to return the raw transaction data (default: false)
9983
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'STAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
10133
+ * @param raw - Whether to return the raw transaction data
10134
+ * @returns {Promise<Result<TxReturnType<S, R>, BridgeError<BridgeErrorCode>>>} - Returns the transaction result
10135
+ *
10136
+ * @example
10137
+ * const bridgeService = new BridgeService(hubProvider, relayerApiEndpoint);
10138
+ * const result = await sodax.bridge.createBridgeIntent(
10139
+ * {
10140
+ * srcChainId: 'ethereum',
10141
+ * srcAsset: "0x123...", // source token address
10142
+ * amount: 1000000000000000000n, // 1 token in wei
10143
+ * dstChainId: 'polygon',
10144
+ * dstAsset: "0x456...", // destination token address
10145
+ * recipient: "0x789..." // recipient address
10146
+ * },
10147
+ * spokeProvider,
10148
+ * raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
10149
+ * );
10150
+ *
10151
+ * if (result.ok) {
10152
+ * const txHash = result.value;
10153
+ * console.log('Bridge intent transaction hash:', txHash);
10154
+ * } else {
10155
+ * console.error('Bridge intent creation failed:', result.error);
10156
+ * }
9984
10157
  */
9985
- createStakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
9986
- params: StakeParams;
9987
- spokeProvider: S;
9988
- raw?: R;
9989
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'STAKE_FAILED'>> & {
9990
- data?: {
9991
- address: string;
9992
- payload: Hex;
9993
- };
9994
- }>;
9995
- /**
9996
- * Build stake data using StakingRouter (simplified flow)
9997
- * @param sodaAsset - The SODA asset information
9998
- * @param to - The destination address
9999
- * @param params - The staking parameters
10000
- * @returns The encoded contract call data
10001
- */
10002
- buildStakeData(sodaAsset: HubAssetInfo, to: Address$1, params: StakeParams): Hex;
10158
+ createBridgeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, fee, raw, }: Prettify<BridgeParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>, BridgeError<'CREATE_BRIDGE_INTENT_FAILED'>> & BridgeOptionalExtraData>;
10003
10159
  /**
10004
- * Execute unstake transaction for unstaking xSoda shares
10005
- * @param params - The unstaking parameters
10006
- * @param spokeProvider - The spoke provider
10007
- * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10008
- * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'UNSTAKE_FAILED'> | RelayError>>
10160
+ * Build the bridge transaction data for executing the bridge operation on the hub
10161
+ * @param params - The create bridge intent parameters
10162
+ * @param srcAssetInfo - The source asset information
10163
+ * @param dstAssetInfo - The destination asset information
10164
+ * @returns Hex - The encoded contract calls for the bridge operation
10009
10165
  */
10010
- unstake(params: UnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'UNSTAKE_FAILED'> | RelayError>>;
10166
+ buildBridgeData(params: CreateBridgeIntentParams, srcAssetInfo: HubAssetInfo, dstAssetInfo: HubAssetInfo, partnerFee: PartnerFee | undefined): Hex$1;
10011
10167
  /**
10012
- * Create unstake intent only (without relaying to hub)
10013
- * NOTE: This method only executes the transaction on the spoke chain and creates the unstake intent
10014
- * In order to successfully unstake tokens, you need to:
10015
- * 1. Check if the allowance is sufficient using isAllowanceValid
10016
- * 2. Approve the appropriate contract to spend the tokens using approve
10017
- * 3. Create the unstake intent using this method
10018
- * 4. Relay the transaction to the hub and await completion using the unstake method
10168
+ * Retrieves the deposited token balance held by the asset manager on a spoke chain.
10169
+ * This balance represents the available liquidity for bridging operations and is used to verify
10170
+ * that the target chain has sufficient funds to complete a bridge transaction.
10019
10171
  *
10020
- * @param params - The unstake parameters including amount and account
10021
- * @param spokeProvider - The spoke provider for the source chain
10022
- * @param raw - Whether to return the raw transaction data (default: false)
10023
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
10024
- */
10025
- createUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10026
- params: UnstakeParams;
10027
- spokeProvider: S;
10028
- raw?: R;
10029
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'UNSTAKE_FAILED'>> & {
10030
- data?: {
10031
- address: string;
10032
- payload: Hex;
10033
- };
10034
- }>;
10035
- /**
10036
- * Build unstake data for unstaking xSoda shares
10037
- * @param hubWallet - The hub wallet address
10038
- * @param params - The unstake parameters
10039
- * @returns The encoded contract call data
10172
+ * @param spokeProvider - The spoke provider instance
10173
+ * @param token - The token address to query the balance for
10174
+ * @returns {Promise<bigint>} - The token balance as a bigint value
10040
10175
  */
10041
- buildUnstakeData(hubWallet: Address$1, params: UnstakeParams): Hex;
10176
+ getBridgeableAmount(from: XToken, to: XToken): Promise<Result<bigint, unknown>>;
10042
10177
  /**
10043
- * Execute instant unstake transaction for instantly unstaking xSoda shares
10044
- * @param params - The instant unstaking parameters
10045
- * @param spokeProvider - The spoke provider
10046
- * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10047
- * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'INSTANT_UNSTAKE_FAILED'> | RelayError>>
10178
+ * Check if two assets on different chains are bridgeable
10179
+ * Two assets are bridgeable if they share the same vault on the hub chain
10180
+ * @param from - The source X token
10181
+ * @param to - The destination X token
10182
+ * @param unchecked - Whether to skip the chain ID validation
10183
+ * @returns boolean - true if assets are bridgeable, false otherwise
10048
10184
  */
10049
- instantUnstake(params: InstantUnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'INSTANT_UNSTAKE_FAILED'> | RelayError>>;
10185
+ isBridgeable({ from, to, unchecked, }: {
10186
+ from: XToken;
10187
+ to: XToken;
10188
+ unchecked?: boolean;
10189
+ }): boolean;
10050
10190
  /**
10051
- * Create instant unstake intent only (without relaying to hub)
10052
- * NOTE: This method only executes the transaction on the spoke chain and creates the instant unstake intent
10053
- * In order to successfully instant unstake tokens, you need to:
10054
- * 1. Create the instant unstake intent using this method
10055
- * 2. Relay the transaction to the hub and await completion using the instantUnstake method
10056
- *
10057
- * @param params - The instant unstake parameters including amount, minAmount and account
10058
- * @param spokeProvider - The spoke provider for the source chain
10059
- * @param raw - Whether to return the raw transaction data (default: false)
10060
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'INSTANT_UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
10191
+ * Get all bridgeable tokens from a source token to a destination chain
10192
+ * @param from - The source chain ID
10193
+ * @param to - The destination chain ID
10194
+ * @param token - The source token address
10195
+ * @returns XToken[] - Array of bridgeable tokens on the destination chain
10061
10196
  */
10062
- createInstantUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10063
- params: InstantUnstakeParams;
10064
- spokeProvider: S;
10065
- raw?: R;
10066
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'INSTANT_UNSTAKE_FAILED'>> & {
10067
- data?: {
10068
- address: string;
10069
- payload: Hex;
10070
- };
10071
- }>;
10197
+ getBridgeableTokens(from: SpokeChainId, to: SpokeChainId, token: string): Result<XToken[]>;
10198
+ filterTokensWithSameVault(tokens: Record<string, XToken>, to: SpokeChainId, srcAssetInfo: HubAssetInfo | undefined): XToken[];
10199
+ }
10200
+
10201
+ declare class StakingLogic {
10202
+ private constructor();
10072
10203
  /**
10073
- * Build instant unstake data for instantly unstaking xSoda shares
10074
- * @param sodaAsset - The SODA asset information
10075
- * @param dstChainId - The destination chain ID
10076
- * @param dstWallet - The destination wallet address
10077
- * @param params - The instant unstake parameters
10078
- * @returns The encoded contract call data
10204
+ * Retrieves all unstake requests for a specific user.
10205
+ * @param stakedSoda - The address of the StakedSoda contract.
10206
+ * @param user - The address of the user.
10207
+ * @param publicClient - PublicClient<HttpTransport>
10208
+ * @returns Array of user unstake info for the user.
10079
10209
  */
10080
- buildInstantUnstakeData(sodaAsset: HubAssetInfo, dstChainId: SpokeChainId, dstWallet: Hex, params: InstantUnstakeParams): Hex;
10210
+ static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient<HttpTransport>): Promise<readonly UserUnstakeInfo[]>;
10081
10211
  /**
10082
- * Execute claim transaction for claiming unstaked tokens after the unstaking period
10083
- * @param params - The claim parameters
10084
- * @param spokeProvider - The spoke provider
10085
- * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10086
- * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'CLAIM_FAILED'> | RelayError>>
10212
+ * Encodes the depositFor transaction data.
10213
+ * @param stakedSoda - The address of the StakedSoda contract.
10214
+ * @param account - The address of the account to deposit for.
10215
+ * @param amount - The amount of tokens to deposit.
10216
+ * @returns The encoded contract call data.
10087
10217
  */
10088
- claim(params: ClaimParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'CLAIM_FAILED'> | RelayError>>;
10218
+ static encodeDepositFor(stakedSoda: Address$1, account: Address$1, amount: bigint): EvmContractCall;
10089
10219
  /**
10090
- * Create claim intent only (without relaying to hub)
10091
- * NOTE: This method only executes the transaction on the spoke chain and creates the claim intent
10092
- * In order to successfully claim tokens, you need to:
10093
- * 1. Create the claim intent using this method
10094
- * 2. Relay the transaction to the hub and await completion using the claim method
10095
- *
10096
- * @param params - The claim parameters including requestId
10097
- * @param spokeProvider - The spoke provider for the source chain
10098
- * @param raw - Whether to return the raw transaction data (default: false)
10099
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'CLAIM_FAILED'>> & { data?: { address: string; payload: Hex } }>
10220
+ * Encodes the withdrawTo transaction data.
10221
+ * @param stakedSoda - The address of the StakedSoda contract.
10222
+ * @param account - The address of the account to withdraw to.
10223
+ * @param value - The amount of tokens to withdraw.
10224
+ * @returns The encoded contract call data.
10100
10225
  */
10101
- createClaimIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10102
- params: ClaimParams;
10103
- spokeProvider: S;
10104
- raw?: R;
10105
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'CLAIM_FAILED'>> & {
10106
- data?: {
10107
- address: string;
10108
- payload: Hex;
10109
- };
10110
- }>;
10226
+ static encodeWithdrawTo(stakedSoda: Address$1, account: Address$1, value: bigint): EvmContractCall;
10111
10227
  /**
10112
- * Build claim data for claiming unstaked tokens
10113
- * @param sodaAsset - The SODA asset information
10114
- * @param dstChainId - The destination chain ID
10115
- * @param dstWallet - The destination wallet address
10116
- * @param params - The claim parameters
10117
- * @returns The encoded contract call data
10228
+ * Encodes the unstake transaction data.
10229
+ * @param stakedSoda - The address of the StakedSoda contract.
10230
+ * @param account - The address of the account to unstake for.
10231
+ * @param value - The amount of tokens to unstake.
10232
+ * @returns The encoded contract call data.
10118
10233
  */
10119
- buildClaimData(sodaAsset: HubAssetInfo, dstChainId: SpokeChainId, dstWallet: Hex, params: ClaimParams): Hex;
10234
+ static encodeUnstake(stakedSoda: Address$1, account: Address$1, value: bigint): EvmContractCall;
10120
10235
  /**
10121
- * Execute cancel unstake transaction for cancelling an unstake request
10122
- * @param params - The cancel unstake parameters
10123
- * @param spokeProvider - The spoke provider
10124
- * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10125
- * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'CANCEL_UNSTAKE_FAILED'> | RelayError>>
10236
+ * Encodes the cancelUnstakeSodaRequest transaction data.
10237
+ * @param stakedSoda - The address of the StakedSoda contract.
10238
+ * @param requestId - The ID of the unstake request to cancel.
10239
+ * @returns The encoded contract call data.
10126
10240
  */
10127
- cancelUnstake(params: CancelUnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'CANCEL_UNSTAKE_FAILED'> | RelayError>>;
10241
+ static encodeCancelUnstakeSodaRequest(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
10128
10242
  /**
10129
- * Create cancel unstake intent only (without relaying to hub)
10130
- * NOTE: This method only executes the transaction on the spoke chain and creates the cancel unstake intent
10131
- * In order to successfully cancel an unstake request, you need to:
10132
- * 1. Create the cancel unstake intent using this method
10133
- * 2. Relay the transaction to the hub and await completion using the cancelUnstake method
10134
- *
10135
- * @param params - The cancel unstake parameters including requestId
10136
- * @param spokeProvider - The spoke provider for the source chain
10137
- * @param raw - Whether to return the raw transaction data (default: false)
10138
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'CANCEL_UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
10243
+ * Encodes the cancelUnstakeRequest transaction data (alias for encodeCancelUnstakeSodaRequest).
10244
+ * @param stakedSoda - The address of the StakedSoda contract.
10245
+ * @param requestId - The ID of the unstake request to cancel.
10246
+ * @returns The encoded contract call data.
10139
10247
  */
10140
- createCancelUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10141
- params: CancelUnstakeParams;
10142
- spokeProvider: S;
10143
- raw?: R;
10144
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'CANCEL_UNSTAKE_FAILED'>> & {
10145
- data?: {
10146
- address: string;
10147
- payload: Hex;
10148
- };
10149
- }>;
10248
+ static encodeCancelUnstakeRequest(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
10150
10249
  /**
10151
- * Build cancel unstake data for cancelling an unstake request
10152
- * @param params - The cancel unstake parameters
10153
- * @param hubWallet - The hub wallet address
10154
- * @returns Promise<Hex> - The encoded contract call data
10250
+ * Encodes the claim transaction data.
10251
+ * @param stakedSoda - The address of the StakedSoda contract.
10252
+ * @param requestId - The ID of the unstake request to claim.
10253
+ * @returns The encoded contract call data.
10155
10254
  */
10156
- buildCancelUnstakeData(params: CancelUnstakeParams, hubWallet: Address$1): Promise<Hex>;
10255
+ static encodeClaim(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
10157
10256
  /**
10158
- * Get comprehensive staking information for a user using spoke provider
10159
- * @param spokeProvider - The spoke provider
10160
- * @returns Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>
10257
+ * Returns the total amount of SODA assets held by the xSoda vault.
10258
+ * @param xSoda - The address of the xSoda token contract.
10259
+ * @param publicClient - PublicClient<HttpTransport>
10260
+ * @returns The total amount of SODA assets.
10161
10261
  */
10162
- getStakingInfoFromSpoke(spokeProvider: SpokeProvider): Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
10262
+ static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10163
10263
  /**
10164
- * Get comprehensive staking information for a user
10165
- * @param userAddress - The user's address
10166
- * @returns Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>
10264
+ * Calculates the number of xSoda shares equivalent to a given amount of SODA assets.
10265
+ * @param xSoda - The address of the xSoda token contract.
10266
+ * @param assets - The amount of SODA assets to convert.
10267
+ * @param publicClient - PublicClient<HttpTransport>
10268
+ * @returns The number of xSoda shares.
10167
10269
  */
10168
- getStakingInfo(userAddress: Address$1): Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
10270
+ static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10169
10271
  /**
10170
- * Get unstaking information for a user
10171
- * @param param - The user's address or spoke provider
10172
- * @returns Promise<Result<UnstakingInfo, StakingError<'INFO_FETCH_FAILED'>>>
10272
+ * Calculates the amount of SODA assets corresponding to a specific number of xSoda shares.
10273
+ * @param xSoda - The address of the xSoda token contract.
10274
+ * @param shares - The number of xSoda shares to convert.
10275
+ * @param publicClient - PublicClient<HttpTransport>
10276
+ * @returns The amount of SODA assets.
10173
10277
  */
10174
- getUnstakingInfo(param: SpokeProvider | Address$1): Promise<Result<UnstakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
10278
+ static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10175
10279
  /**
10176
- * Get staking configuration from the stakedSoda contract
10177
- * @returns Promise<Result<StakingConfig, StakingError<'INFO_FETCH_FAILED'>>>
10280
+ * Simulates the effects of depositing SODA into xSoda without executing it.
10281
+ * @param xSoda - The address of the xSoda token contract.
10282
+ * @param assets - The amount of SODA assets to deposit.
10283
+ * @param publicClient - PublicClient<HttpTransport>
10284
+ * @returns The number of xSoda shares that would be minted.
10178
10285
  */
10179
- getStakingConfig(): Promise<Result<StakingConfig, StakingError<'INFO_FETCH_FAILED'>>>;
10286
+ static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10180
10287
  /**
10181
- * Calculate penalty for an unstake request based on the contract logic
10182
- * @param startTime - The start time of the unstake request
10183
- * @param config - The staking configuration
10184
- * @returns The penalty amount and percentage
10288
+ * Simulates the effects of minting xSoda shares without executing it.
10289
+ * @param xSoda - The address of the xSoda token contract.
10290
+ * @param shares - The number of xSoda shares to mint.
10291
+ * @param publicClient - PublicClient<HttpTransport>
10292
+ * @returns The amount of SODA assets that would be deposited.
10185
10293
  */
10186
- private calculatePenalty;
10294
+ static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10187
10295
  /**
10188
- * Get unstaking information with penalty calculations
10189
- * @param param - The user's address or spoke provider
10190
- * @returns Promise<Result<UnstakingInfo & { requestsWithPenalty: UnstakeRequestWithPenalty[] }, StakingError<'INFO_FETCH_FAILED'>>>
10296
+ * Simulates the effects of withdrawing SODA from xSoda without executing it.
10297
+ * @param xSoda - The address of the xSoda token contract.
10298
+ * @param assets - The amount of SODA assets to withdraw.
10299
+ * @param publicClient - PublicClient<HttpTransport>
10300
+ * @returns The number of xSoda shares that would be burned.
10191
10301
  */
10192
- getUnstakingInfoWithPenalty(param: SpokeProvider | Address$1): Promise<Result<UnstakingInfo & {
10193
- requestsWithPenalty: UnstakeRequestWithPenalty[];
10194
- }, StakingError<'INFO_FETCH_FAILED'>>>;
10302
+ static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10195
10303
  /**
10196
- * Get instant unstake ratio for a given amount
10197
- * @param amount - The amount of xSoda to estimate instant unstake for
10198
- * @returns Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>
10304
+ * Simulates the effects of redeeming xSoda shares without executing it.
10305
+ * @param xSoda - The address of the xSoda token contract.
10306
+ * @param shares - The number of xSoda shares to redeem.
10307
+ * @param publicClient - PublicClient<HttpTransport>
10308
+ * @returns The amount of SODA assets that would be withdrawn.
10199
10309
  */
10200
- getInstantUnstakeRatio(amount: bigint): Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>;
10310
+ static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10201
10311
  /**
10202
- * Get converted assets amount for xSODA shares
10203
- * @param amount - The amount of xSoda shares to convert
10204
- * @returns Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>
10312
+ * Encodes the xSoda deposit transaction data (deposit SODA to get xSoda shares).
10313
+ * @param xSoda - The address of the xSoda token contract.
10314
+ * @param assets - The amount of SODA assets to deposit.
10315
+ * @param receiver - The address of the receiver.
10316
+ * @returns The encoded contract call data.
10205
10317
  */
10206
- getConvertedAssets(amount: bigint): Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>;
10318
+ static encodeXSodaDeposit(xSoda: Address$1, assets: bigint, receiver: Address$1): EvmContractCall;
10207
10319
  /**
10208
- * Get stake ratio for a given amount (xSoda amount and preview deposit)
10209
- * @param amount - The amount of SODA to estimate stake for
10210
- * @returns Promise<Result<[bigint, bigint], StakingError<'INFO_FETCH_FAILED'>>>
10320
+ * Encodes the xSoda mint transaction data (mint xSoda shares by depositing SODA).
10321
+ * @param xSoda - The address of the xSoda token contract.
10322
+ * @param shares - The number of xSoda shares to mint.
10323
+ * @param receiver - The address of the receiver.
10324
+ * @returns The encoded contract call data.
10211
10325
  */
10212
- getStakeRatio(amount: bigint): Promise<Result<[bigint, bigint], StakingError<'INFO_FETCH_FAILED'>>>;
10326
+ static encodeXSodaMint(xSoda: Address$1, shares: bigint, receiver: Address$1): EvmContractCall;
10213
10327
  /**
10214
- * Helper method to get xSoda balance for a user
10215
- * @param xSoda - The xSoda token contract address
10216
- * @param userAddress - The user's address
10217
- * @returns Promise<bigint>
10328
+ * Encodes the xSoda withdraw transaction data (withdraw SODA by burning xSoda shares).
10329
+ * @param xSoda - The address of the xSoda token contract.
10330
+ * @param assets - The amount of SODA assets to withdraw.
10331
+ * @param receiver - The address of the receiver.
10332
+ * @param owner - The address of the owner.
10333
+ * @returns The encoded contract call data.
10218
10334
  */
10219
- private getXSodaBalance;
10335
+ static encodeXSodaWithdraw(xSoda: Address$1, assets: bigint, receiver: Address$1, owner: Address$1): EvmContractCall;
10336
+ /**
10337
+ * Encodes the xSoda redeem transaction data (redeem xSoda shares to get SODA).
10338
+ * @param xSoda - The address of the xSoda token contract.
10339
+ * @param shares - The number of xSoda shares to redeem.
10340
+ * @param receiver - The address of the receiver.
10341
+ * @param owner - The address of the owner.
10342
+ * @returns The encoded contract call data.
10343
+ */
10344
+ static encodeXSodaRedeem(xSoda: Address$1, shares: bigint, receiver: Address$1, owner: Address$1): EvmContractCall;
10345
+ /**
10346
+ * Encodes the StakingRouter stake transaction data.
10347
+ * @param stakingRouter - The address of the StakingRouter contract.
10348
+ * @param amount - The amount of SODA to stake.
10349
+ * @param to - The address to receive the staked tokens.
10350
+ * @param minReceive - The minimum amount to receive.
10351
+ * @returns The encoded contract call data.
10352
+ */
10353
+ static encodeStakingRouterStake(stakingRouter: Address$1, amount: bigint, to: Address$1, minReceive: bigint): EvmContractCall;
10354
+ /**
10355
+ * Encodes the StakingRouter unstake transaction data.
10356
+ * @param stakingRouter - The address of the StakingRouter contract.
10357
+ * @param amount - The amount of xSoda to unstake.
10358
+ * @param minAmount - The minimum amount of SODA to receive.
10359
+ * @param asset - The asset address to receive.
10360
+ * @param chainID - The destination chain ID.
10361
+ * @param to - The destination address as bytes.
10362
+ * @returns The encoded contract call data.
10363
+ */
10364
+ static encodeStakingRouterUnstake(stakingRouter: Address$1, amount: bigint, minAmount: bigint, asset: Address$1, chainID: bigint, to: Hex): EvmContractCall;
10365
+ /**
10366
+ * Estimates the xSoda amount and preview deposit for a given SODA amount.
10367
+ * @param stakingRouter - The address of the StakingRouter contract.
10368
+ * @param amount - The amount of SODA to estimate.
10369
+ * @param publicClient - PublicClient<HttpTransport>
10370
+ * @returns Tuple containing [xSodaAmount, previewDepositAmount].
10371
+ */
10372
+ static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<readonly [bigint, bigint]>;
10373
+ /**
10374
+ * Estimates the instant unstake amount for a given xSoda amount.
10375
+ * @param stakingRouter - The address of the StakingRouter contract.
10376
+ * @param amount - The amount of xSoda to estimate unstake for.
10377
+ * @param publicClient - PublicClient<HttpTransport>
10378
+ * @returns The estimated SODA amount from instant unstake.
10379
+ */
10380
+ static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10220
10381
  }
10221
10382
 
10222
- type IcxMigrateParams = {
10223
- address: IcxTokenType;
10383
+ type StakeParams = {
10224
10384
  amount: bigint;
10225
- to: Address$1;
10385
+ minReceive: bigint;
10386
+ account: Address$1;
10387
+ action: 'stake';
10226
10388
  };
10227
- type IcxCreateRevertMigrationParams = {
10389
+ type UnstakeParams = {
10228
10390
  amount: bigint;
10229
- to: IconEoaAddress;
10391
+ account: Address$1;
10392
+ action: 'unstake';
10230
10393
  };
10231
- type IcxRevertMigrationParams = {
10232
- wICX: IconAddress;
10394
+ type ClaimParams = {
10395
+ requestId: bigint;
10233
10396
  amount: bigint;
10234
- userWallet: Address$1;
10235
- to: Hex;
10397
+ action: 'claim';
10236
10398
  };
10237
- type IcxMigrationServiceConstructorParams = {
10399
+ type CancelUnstakeParams = {
10400
+ requestId: bigint;
10401
+ action: 'cancelUnstake';
10402
+ };
10403
+ type InstantUnstakeParams = {
10404
+ amount: bigint;
10405
+ minAmount: bigint;
10406
+ account: Address$1;
10407
+ action: 'instantUnstake';
10408
+ };
10409
+ type StakingAction = 'stake' | 'unstake' | 'claim' | 'cancelUnstake' | 'instantUnstake';
10410
+ type StakingParams = StakeParams | UnstakeParams | ClaimParams | CancelUnstakeParams | InstantUnstakeParams;
10411
+ type StakingInfo = {
10412
+ totalStaked: bigint;
10413
+ totalUnderlying: bigint;
10414
+ userXSodaBalance: bigint;
10415
+ userXSodaValue: bigint;
10416
+ userUnderlying: bigint;
10417
+ };
10418
+ type UnstakingInfo = {
10419
+ userUnstakeSodaRequests: readonly UserUnstakeInfo[];
10420
+ totalUnstaking: bigint;
10421
+ };
10422
+ type UnstakeRequestWithPenalty = UserUnstakeInfo & {
10423
+ penalty: bigint;
10424
+ penaltyPercentage: number;
10425
+ claimableAmount: bigint;
10426
+ };
10427
+ type StakingConfig = {
10428
+ unstakingPeriod: bigint;
10429
+ minUnstakingPeriod: bigint;
10430
+ maxPenalty: bigint;
10431
+ };
10432
+ type StakingErrorCode = 'STAKE_FAILED' | 'UNSTAKE_FAILED' | 'INSTANT_UNSTAKE_FAILED' | 'CLAIM_FAILED' | 'CANCEL_UNSTAKE_FAILED' | 'INFO_FETCH_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'APPROVAL_FAILED';
10433
+ type StakingError<T extends StakingErrorCode> = {
10434
+ code: T;
10435
+ error: unknown;
10436
+ };
10437
+ type StakingServiceConstructorParams = {
10238
10438
  hubProvider: EvmHubProvider;
10439
+ relayerApiEndpoint: HttpUrl;
10239
10440
  configService: ConfigService;
10240
10441
  };
10241
10442
  /**
10242
- * Service for handling ICX migration operations on the hub chain.
10243
- * Provides functionality to migrate wICX tokens from ICON to the hub chain.
10443
+ * StakingService provides a high-level interface for staking operations
10444
+ * including staking SODA tokens, unstaking, claiming rewards, and retrieving staking information.
10445
+ * All transaction methods return encoded contract calls that can be sent via a wallet provider.
10244
10446
  */
10245
- declare class IcxMigrationService {
10447
+ declare class StakingService {
10246
10448
  private readonly hubProvider;
10449
+ private readonly relayerApiEndpoint;
10247
10450
  private readonly configService;
10248
- constructor({ hubProvider, configService }: IcxMigrationServiceConstructorParams);
10451
+ constructor({ hubProvider, relayerApiEndpoint, configService }: StakingServiceConstructorParams);
10249
10452
  /**
10250
- * Retrieves the available amount of SODA tokens in the ICX migration contract.
10251
- * This represents the amount of tokens available for migration.
10252
- *
10253
- * @returns The available balance of SODA tokens in the migration contract
10453
+ * Check if allowance is valid for the staking operations
10454
+ * @param params - The staking parameters
10455
+ * @param spokeProvider - The spoke provider
10456
+ * @returns {Promise<Result<boolean, StakingError<'ALLOWANCE_CHECK_FAILED'>>>}
10254
10457
  */
10255
- getAvailableAmount(): Promise<bigint>;
10458
+ isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }: Prettify<{
10459
+ params: StakingParams;
10460
+ spokeProvider: S;
10461
+ }>): Promise<Result<boolean, StakingError<'ALLOWANCE_CHECK_FAILED'>>>;
10256
10462
  /**
10257
- * Generates transaction data for migrating wICX tokens from ICON to the hub chain.
10258
- * This method creates the necessary contract calls to:
10259
- * 1. Approve the migration contract to spend the wICX tokens
10260
- * 2. Execute the migration swap
10261
- *
10262
- * @param params - The migration parameters including token address, amount, and recipient
10263
- * @returns Encoded transaction data for the migration operation
10264
- * @throws Will throw an error if the hub asset configuration is not found
10463
+ * Approve token spending for the staking operations
10464
+ * @param params - The staking parameters
10465
+ * @param spokeProvider - The spoke provider
10466
+ * @param raw - Whether to return raw transaction data
10467
+ * @returns Promise<Result<TxReturnType<S, R>, StakingError<'APPROVAL_FAILED'>>>
10265
10468
  */
10266
- migrateData(params: IcxMigrateParams): Hex;
10469
+ approve<S extends SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10470
+ params: StakingParams;
10471
+ spokeProvider: S;
10472
+ raw?: R;
10473
+ }>): Promise<Result<TxReturnType<S, R>, StakingError<'APPROVAL_FAILED'>>>;
10267
10474
  /**
10268
- * Generates transaction data for migrating back tokens to the ICON chain.
10269
- * @param params - The migration parameters including token address, amount, and recipient
10270
- * @returns Encoded transaction data for the migration operation
10271
- * @throws Will throw an error if the hub asset configuration is not found
10475
+ * Execute stake transaction for staking SODA tokens to receive xSoda shares
10476
+ * NOTE: For EVM chains, you may need to approve token spending first using the approve method
10477
+ * @param params - The staking parameters
10478
+ * @param spokeProvider - The spoke provider
10479
+ * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10480
+ * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'STAKE_FAILED'> | RelayError>>
10272
10481
  */
10273
- revertMigration(params: IcxRevertMigrationParams): Hex;
10482
+ stake(params: StakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'STAKE_FAILED'> | RelayError>>;
10274
10483
  /**
10275
- * Encodes a migration transaction for the ICX swap contract.
10276
- * This creates the contract call data for swapping wICX tokens to SODA tokens.
10484
+ * Create stake intent only (without relaying to hub)
10485
+ * NOTE: This method only executes the transaction on the spoke chain and creates the stake intent
10486
+ * In order to successfully stake tokens, you need to:
10487
+ * 1. Check if the allowance is sufficient using isAllowanceValid
10488
+ * 2. Approve the appropriate contract to spend the tokens using approve
10489
+ * 3. Create the stake intent using this method
10490
+ * 4. Relay the transaction to the hub and await completion using the stake method
10277
10491
  *
10278
- * @param amount - The amount of wICX tokens to migrate
10279
- * @param to - The address that will receive the migrated SODA tokens
10280
- * @returns The encoded contract call for the migration operation
10492
+ * @param params - The stake parameters including amount and account
10493
+ * @param spokeProvider - The spoke provider for the source chain
10494
+ * @param raw - Whether to return the raw transaction data (default: false)
10495
+ * @returns Promise<Result<TxReturnType<S, R>, StakingError<'STAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
10281
10496
  */
10282
- encodeMigrate(amount: bigint, to: Address$1): EvmContractCall;
10497
+ createStakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10498
+ params: StakeParams;
10499
+ spokeProvider: S;
10500
+ raw?: R;
10501
+ }>): Promise<Result<TxReturnType<S, R>, StakingError<'STAKE_FAILED'>> & {
10502
+ data?: {
10503
+ address: string;
10504
+ payload: Hex;
10505
+ };
10506
+ }>;
10283
10507
  /**
10284
- * Encodes a revert migration transaction for the ICX swap contract.
10285
- * This creates the contract call data for swapping SODA tokens to wICX tokens.
10286
- *
10287
- * @param amount - The amount of wICX tokens to migrate
10288
- * @param to - The address that will receive the migrated SODA tokens
10289
- * @returns The encoded contract call for the migration operation
10508
+ * Build stake data using StakingRouter (simplified flow)
10509
+ * @param sodaAsset - The SODA asset information
10510
+ * @param to - The destination address
10511
+ * @param params - The staking parameters
10512
+ * @returns The encoded contract call data
10290
10513
  */
10291
- encodeRevertMigration(amount: bigint, to: Address$1): EvmContractCall;
10514
+ buildStakeData(sodaAsset: HubAssetInfo, to: Address$1, params: StakeParams): Hex;
10515
+ /**
10516
+ * Execute unstake transaction for unstaking xSoda shares
10517
+ * @param params - The unstaking parameters
10518
+ * @param spokeProvider - The spoke provider
10519
+ * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10520
+ * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'UNSTAKE_FAILED'> | RelayError>>
10521
+ */
10522
+ unstake(params: UnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'UNSTAKE_FAILED'> | RelayError>>;
10523
+ /**
10524
+ * Create unstake intent only (without relaying to hub)
10525
+ * NOTE: This method only executes the transaction on the spoke chain and creates the unstake intent
10526
+ * In order to successfully unstake tokens, you need to:
10527
+ * 1. Check if the allowance is sufficient using isAllowanceValid
10528
+ * 2. Approve the appropriate contract to spend the tokens using approve
10529
+ * 3. Create the unstake intent using this method
10530
+ * 4. Relay the transaction to the hub and await completion using the unstake method
10531
+ *
10532
+ * @param params - The unstake parameters including amount and account
10533
+ * @param spokeProvider - The spoke provider for the source chain
10534
+ * @param raw - Whether to return the raw transaction data (default: false)
10535
+ * @returns Promise<Result<TxReturnType<S, R>, StakingError<'UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
10536
+ */
10537
+ createUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10538
+ params: UnstakeParams;
10539
+ spokeProvider: S;
10540
+ raw?: R;
10541
+ }>): Promise<Result<TxReturnType<S, R>, StakingError<'UNSTAKE_FAILED'>> & {
10542
+ data?: {
10543
+ address: string;
10544
+ payload: Hex;
10545
+ };
10546
+ }>;
10547
+ /**
10548
+ * Build unstake data for unstaking xSoda shares
10549
+ * @param hubWallet - The hub wallet address
10550
+ * @param params - The unstake parameters
10551
+ * @returns The encoded contract call data
10552
+ */
10553
+ buildUnstakeData(hubWallet: Address$1, params: UnstakeParams): Hex;
10554
+ /**
10555
+ * Execute instant unstake transaction for instantly unstaking xSoda shares
10556
+ * @param params - The instant unstaking parameters
10557
+ * @param spokeProvider - The spoke provider
10558
+ * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10559
+ * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'INSTANT_UNSTAKE_FAILED'> | RelayError>>
10560
+ */
10561
+ instantUnstake(params: InstantUnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'INSTANT_UNSTAKE_FAILED'> | RelayError>>;
10562
+ /**
10563
+ * Create instant unstake intent only (without relaying to hub)
10564
+ * NOTE: This method only executes the transaction on the spoke chain and creates the instant unstake intent
10565
+ * In order to successfully instant unstake tokens, you need to:
10566
+ * 1. Create the instant unstake intent using this method
10567
+ * 2. Relay the transaction to the hub and await completion using the instantUnstake method
10568
+ *
10569
+ * @param params - The instant unstake parameters including amount, minAmount and account
10570
+ * @param spokeProvider - The spoke provider for the source chain
10571
+ * @param raw - Whether to return the raw transaction data (default: false)
10572
+ * @returns Promise<Result<TxReturnType<S, R>, StakingError<'INSTANT_UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
10573
+ */
10574
+ createInstantUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10575
+ params: InstantUnstakeParams;
10576
+ spokeProvider: S;
10577
+ raw?: R;
10578
+ }>): Promise<Result<TxReturnType<S, R>, StakingError<'INSTANT_UNSTAKE_FAILED'>> & {
10579
+ data?: {
10580
+ address: string;
10581
+ payload: Hex;
10582
+ };
10583
+ }>;
10584
+ /**
10585
+ * Build instant unstake data for instantly unstaking xSoda shares
10586
+ * @param sodaAsset - The SODA asset information
10587
+ * @param dstChainId - The destination chain ID
10588
+ * @param dstWallet - The destination wallet address
10589
+ * @param params - The instant unstake parameters
10590
+ * @returns The encoded contract call data
10591
+ */
10592
+ buildInstantUnstakeData(sodaAsset: HubAssetInfo, dstChainId: SpokeChainId, dstWallet: Hex, params: InstantUnstakeParams): Hex;
10593
+ /**
10594
+ * Execute claim transaction for claiming unstaked tokens after the unstaking period
10595
+ * @param params - The claim parameters
10596
+ * @param spokeProvider - The spoke provider
10597
+ * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10598
+ * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'CLAIM_FAILED'> | RelayError>>
10599
+ */
10600
+ claim(params: ClaimParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'CLAIM_FAILED'> | RelayError>>;
10601
+ /**
10602
+ * Create claim intent only (without relaying to hub)
10603
+ * NOTE: This method only executes the transaction on the spoke chain and creates the claim intent
10604
+ * In order to successfully claim tokens, you need to:
10605
+ * 1. Create the claim intent using this method
10606
+ * 2. Relay the transaction to the hub and await completion using the claim method
10607
+ *
10608
+ * @param params - The claim parameters including requestId
10609
+ * @param spokeProvider - The spoke provider for the source chain
10610
+ * @param raw - Whether to return the raw transaction data (default: false)
10611
+ * @returns Promise<Result<TxReturnType<S, R>, StakingError<'CLAIM_FAILED'>> & { data?: { address: string; payload: Hex } }>
10612
+ */
10613
+ createClaimIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10614
+ params: ClaimParams;
10615
+ spokeProvider: S;
10616
+ raw?: R;
10617
+ }>): Promise<Result<TxReturnType<S, R>, StakingError<'CLAIM_FAILED'>> & {
10618
+ data?: {
10619
+ address: string;
10620
+ payload: Hex;
10621
+ };
10622
+ }>;
10623
+ /**
10624
+ * Build claim data for claiming unstaked tokens
10625
+ * @param sodaAsset - The SODA asset information
10626
+ * @param dstChainId - The destination chain ID
10627
+ * @param dstWallet - The destination wallet address
10628
+ * @param params - The claim parameters
10629
+ * @returns The encoded contract call data
10630
+ */
10631
+ buildClaimData(sodaAsset: HubAssetInfo, dstChainId: SpokeChainId, dstWallet: Hex, params: ClaimParams): Hex;
10632
+ /**
10633
+ * Execute cancel unstake transaction for cancelling an unstake request
10634
+ * @param params - The cancel unstake parameters
10635
+ * @param spokeProvider - The spoke provider
10636
+ * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10637
+ * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'CANCEL_UNSTAKE_FAILED'> | RelayError>>
10638
+ */
10639
+ cancelUnstake(params: CancelUnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'CANCEL_UNSTAKE_FAILED'> | RelayError>>;
10640
+ /**
10641
+ * Create cancel unstake intent only (without relaying to hub)
10642
+ * NOTE: This method only executes the transaction on the spoke chain and creates the cancel unstake intent
10643
+ * In order to successfully cancel an unstake request, you need to:
10644
+ * 1. Create the cancel unstake intent using this method
10645
+ * 2. Relay the transaction to the hub and await completion using the cancelUnstake method
10646
+ *
10647
+ * @param params - The cancel unstake parameters including requestId
10648
+ * @param spokeProvider - The spoke provider for the source chain
10649
+ * @param raw - Whether to return the raw transaction data (default: false)
10650
+ * @returns Promise<Result<TxReturnType<S, R>, StakingError<'CANCEL_UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
10651
+ */
10652
+ createCancelUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10653
+ params: CancelUnstakeParams;
10654
+ spokeProvider: S;
10655
+ raw?: R;
10656
+ }>): Promise<Result<TxReturnType<S, R>, StakingError<'CANCEL_UNSTAKE_FAILED'>> & {
10657
+ data?: {
10658
+ address: string;
10659
+ payload: Hex;
10660
+ };
10661
+ }>;
10662
+ /**
10663
+ * Build cancel unstake data for cancelling an unstake request
10664
+ * @param params - The cancel unstake parameters
10665
+ * @param hubWallet - The hub wallet address
10666
+ * @returns Promise<Hex> - The encoded contract call data
10667
+ */
10668
+ buildCancelUnstakeData(params: CancelUnstakeParams, hubWallet: Address$1): Promise<Hex>;
10669
+ /**
10670
+ * Get comprehensive staking information for a user using spoke provider
10671
+ * @param spokeProvider - The spoke provider
10672
+ * @returns Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>
10673
+ */
10674
+ getStakingInfoFromSpoke(spokeProvider: SpokeProvider): Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
10675
+ /**
10676
+ * Get comprehensive staking information for a user
10677
+ * @param userAddress - The user's address
10678
+ * @returns Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>
10679
+ */
10680
+ getStakingInfo(userAddress: Address$1): Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
10681
+ /**
10682
+ * Get unstaking information for a user
10683
+ * @param param - The user's address or spoke provider
10684
+ * @returns Promise<Result<UnstakingInfo, StakingError<'INFO_FETCH_FAILED'>>>
10685
+ */
10686
+ getUnstakingInfo(param: SpokeProvider | Address$1): Promise<Result<UnstakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
10687
+ /**
10688
+ * Get staking configuration from the stakedSoda contract
10689
+ * @returns Promise<Result<StakingConfig, StakingError<'INFO_FETCH_FAILED'>>>
10690
+ */
10691
+ getStakingConfig(): Promise<Result<StakingConfig, StakingError<'INFO_FETCH_FAILED'>>>;
10692
+ /**
10693
+ * Calculate penalty for an unstake request based on the contract logic
10694
+ * @param startTime - The start time of the unstake request
10695
+ * @param config - The staking configuration
10696
+ * @returns The penalty amount and percentage
10697
+ */
10698
+ private calculatePenalty;
10699
+ /**
10700
+ * Get unstaking information with penalty calculations
10701
+ * @param param - The user's address or spoke provider
10702
+ * @returns Promise<Result<UnstakingInfo & { requestsWithPenalty: UnstakeRequestWithPenalty[] }, StakingError<'INFO_FETCH_FAILED'>>>
10703
+ */
10704
+ getUnstakingInfoWithPenalty(param: SpokeProvider | Address$1): Promise<Result<UnstakingInfo & {
10705
+ requestsWithPenalty: UnstakeRequestWithPenalty[];
10706
+ }, StakingError<'INFO_FETCH_FAILED'>>>;
10707
+ /**
10708
+ * Get instant unstake ratio for a given amount
10709
+ * @param amount - The amount of xSoda to estimate instant unstake for
10710
+ * @returns Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>
10711
+ */
10712
+ getInstantUnstakeRatio(amount: bigint): Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>;
10713
+ /**
10714
+ * Get converted assets amount for xSODA shares
10715
+ * @param amount - The amount of xSoda shares to convert
10716
+ * @returns Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>
10717
+ */
10718
+ getConvertedAssets(amount: bigint): Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>;
10719
+ /**
10720
+ * Get stake ratio for a given amount (xSoda amount and preview deposit)
10721
+ * @param amount - The amount of SODA to estimate stake for
10722
+ * @returns Promise<Result<[bigint, bigint], StakingError<'INFO_FETCH_FAILED'>>>
10723
+ */
10724
+ getStakeRatio(amount: bigint): Promise<Result<[bigint, bigint], StakingError<'INFO_FETCH_FAILED'>>>;
10725
+ /**
10726
+ * Helper method to get xSoda balance for a user
10727
+ * @param xSoda - The xSoda token contract address
10728
+ * @param userAddress - The user's address
10729
+ * @returns Promise<bigint>
10730
+ */
10731
+ private getXSodaBalance;
10292
10732
  }
10293
10733
 
10294
10734
  type GetMigrationFailedPayload<T extends MigrationErrorCode> = T extends 'CREATE_MIGRATION_INTENT_FAILED' ? IcxMigrateParams | UnifiedBnUSDMigrateParams | BalnMigrateParams : T extends 'CREATE_REVERT_MIGRATION_INTENT_FAILED' ? IcxCreateRevertMigrationParams : T extends 'REVERT_MIGRATION_FAILED' ? IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams : T extends 'MIGRATION_FAILED' ? IcxMigrateParams | UnifiedBnUSDMigrateParams | BalnMigrateParams : never;
@@ -10327,576 +10767,306 @@ declare class MigrationService {
10327
10767
  * @returns {Promise<Result<boolean>>} - Returns the result of the allowance check or error
10328
10768
  *
10329
10769
  * @example
10330
- * const result = await migrationService.isAllowanceValid(
10331
- * {
10332
- * token: 'ICX', // Token to migrate
10333
- * icx: 'cx...', // Address of the ICX or wICX token to migrate
10334
- * amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
10335
- * to: '0x...', // Address to receive the migrated SODA tokens
10336
- * },
10337
- * 'migrate',
10338
- * spokeProvider, // IconSpokeProvider instance
10339
- * );
10340
- *
10341
- */
10342
- isAllowanceValid<S extends SpokeProvider>(params: MigrationParams | MigrationRevertParams, action: MigrationAction, spokeProvider: S): Promise<Result<boolean>>;
10343
- /**
10344
- * Approves the amount spending for the revert migration transaction.
10345
- * @param params - The parameters for the revert migration transaction.
10346
- * @param spokeProvider - The spoke provider.
10347
- * @param raw - Whether to return the raw transaction hash instead of the transaction receipt
10348
- * @returns {Promise<Result<TxReturnType<S, R>>>} - Returns the raw transaction payload or transaction hash
10349
- *
10350
- * @example
10351
- * const result = await migrationService.approve(
10352
- * {
10353
- * amount: 1000n, // Amount of SODA tokens to revert
10354
- * to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
10355
- * },
10356
- * 'revert',
10357
- * spokeProvider, // SonicSpokeProvider instance
10358
- * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
10359
- * );
10360
- *
10361
- */
10362
- approve<S extends SpokeProvider, R extends boolean = false>(params: IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams, action: MigrationAction, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>>>;
10363
- /**
10364
- * Migrates bnUSD tokens between legacy and new formats across supported spoke chains via the hub chain (sonic).
10365
- * Handles both legacy-to-new and new-to-legacy bnUSD migrations, enforcing validation and relaying the transaction.
10366
- *
10367
- * @param params - Migration parameters, including source/destination chain IDs, token addresses, amount, and recipient.
10368
- * @param spokeProvider - The SpokeProvider instance for the source chain.
10369
- * @param timeout - Optional timeout in milliseconds for the relay operation (default: 60 seconds).
10370
- * @param unchecked - Optional flag to skip validation checks (default: false).
10371
- * @returns {Promise<Result<[string, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
10372
- * Result containing a tuple: [spokeTxHash, hubTxHash] if successful, or an error describing the failure.
10373
- *
10374
- * @example
10375
- * // Migrate legacy bnUSD to new bnUSD
10376
- * const result = await sodax.migration.migratebnUSD({
10377
- * srcChainId: '0x1.icon', // Source chain ID (legacy)
10378
- * dstChainId: 'sonic', // Destination chain ID (new)
10379
- * srcbnUSD: 'cx...', // Legacy bnUSD token address
10380
- * dstbnUSD: '0x...', // New bnUSD token address
10381
- * amount: 1000n, // Amount to migrate
10382
- * to: '0x...', // Recipient address on destination chain
10383
- * }, iconSpokeProvider);
10384
- *
10385
- * // Reverse migration: new bnUSD to legacy bnUSD
10386
- * const result = await sodax.migration.migratebnUSD({
10387
- * srcChainId: 'sonic', // Source chain ID (new)
10388
- * dstChainId: '0x1.icon', // Destination chain ID (legacy)
10389
- * srcbnUSD: '0x...', // New bnUSD token address
10390
- * dstbnUSD: 'cx...', // Legacy bnUSD token address
10391
- * amount: 1000n, // Amount to migrate
10392
- * to: 'hx...', // Recipient address on destination chain
10393
- * }, sonicSpokeProvider);
10394
- *
10395
- * if (result.ok) {
10396
- * // result.value is a tuple: [spokeTxHash, hubTxHash]
10397
- * const [spokeTxHash, hubTxHash] = result.value;
10398
- * console.log('[migrateBnUSD] hubTxHash', hubTxHash);
10399
- * console.log('[migrateBnUSD] spokeTxHash', spokeTxHash);
10400
- * } else {
10401
- * // Handle migration error
10402
- * console.error('[migrateBnUSD] error', result.error);
10403
- * }
10404
- */
10405
- migratebnUSD(params: UnifiedBnUSDMigrateParams, spokeProvider: SpokeProvider, timeout?: number, unchecked?: boolean): Promise<Result<[
10406
- string,
10407
- Hex$1
10408
- ], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
10409
- /**
10410
- * Migrates ICX tokens to SODA tokens on the hub chain (sonic).
10411
- * This function handles the migration of ICX tokens to SODA tokens.
10412
- *
10413
- * @param params - The parameters for the migration transaction.
10414
- * @param spokeProvider - The spoke provider.
10415
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10416
- * @returns {Promise<Result<[Hex, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
10417
- * Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
10418
- * or an error describing why the migration or relay failed.
10419
- *
10420
- * @example
10421
- * const result = await migrationService.migrateIcxToSoda(
10422
- * {
10423
- * address: 'cx...', // Address of the ICX or wICX token to migrate
10424
- * amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
10425
- * to: '0x...', // Address to receive the migrated SODA tokens (i.e. the hub chain address)
10426
- * },
10427
- * spokeProvider, // IconSpokeProvider instance
10428
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
10429
- * );
10430
- *
10431
- * if (!result.ok) {
10432
- * // Handle error
10433
- * }
10434
- *
10435
- * const [
10436
- * spokeTxHash, // transaction hash on the spoke chain
10437
- * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
10438
- * ] = result.value;
10439
- * console.log('Migration transaction hashes:', { spokeTxHash, hubTxHash });
10440
- */
10441
- migrateIcxToSoda(params: IcxMigrateParams, spokeProvider: IconSpokeProvider, timeout?: number): Promise<Result<[
10442
- Hex$1,
10443
- Hex$1
10444
- ], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
10445
- /**
10446
- * Creates a revert migration (SODA to ICX) intent and submits (relays) it to the spoke chain.
10447
- * @param params - The parameters for the revert migration transaction.
10448
- * @param spokeProvider - The SonicSpokeProvider instance.
10449
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10450
- *
10451
- * @returns {Promise<Result<[Hex, Hex], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>}
10452
- * Returns a Result containing a tuple of [hubTxHash, spokeTxHash] if successful,
10453
- * or an error describing why the revert migration or relay failed.
10454
- *
10455
- *
10456
- * @example
10457
- * const result = await migrationService.revertMigrateSodaToIcx(
10458
- * {
10459
- * amount: 1000n, // Amount of SODA tokens to revert
10460
- * to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
10461
- * },
10462
- * spokeProvider, // SonicSpokeProvider instance
10463
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
10464
- * );
10465
- *
10466
- * if (!result.ok) {
10467
- * // Handle error
10468
- * }
10469
- *
10470
- * const [
10471
- * hubTxHash, // transaction hash on the hub chain
10472
- * spokeTxHash, // transaction hash on the spoke chain (i.e. the transaction that was relayed to the spoke)
10473
- * ] = result.value;
10474
- * console.log('Revert migration transaction hashes:', { hubTxHash, spokeTxHash });
10475
- */
10476
- revertMigrateSodaToIcx(params: Omit<IcxCreateRevertMigrationParams, 'wICX'>, spokeProvider: SonicSpokeProvider, timeout?: number): Promise<Result<[
10477
- Hex$1,
10478
- Hex$1
10479
- ], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>;
10480
- /**
10481
- * Migrates BALN tokens to SODA tokens on the hub chain (sonic).
10482
- * This function handles the migration of BALN tokens to SODA tokens.
10483
- *
10484
- * @param params - The parameters for the migration transaction.
10485
- * @param spokeProvider - The spoke provider.
10486
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10487
- * @returns {Promise<Result<[Hex, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
10488
- * Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
10489
- * or an error describing why the migration or relay failed.
10490
- *
10491
- * @example
10492
- * const result = await migrationService.migrateBaln(
10493
- * {
10494
- * amount: 1000n, // The amount of BALN tokens to swap
10495
- * lockupPeriod: SIX_MONTHS, // The lockup period for the swap (see LockupPeriod type)
10496
- * to: '0x...', // The hub (sonic) chain address that will receive the swapped BALN tokens
10497
- * stake: true, // Whether to stake the BALN tokens
10498
- * },
10499
- * spokeProvider, // IconSpokeProvider instance
10500
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
10501
- * );
10502
- *
10503
- * if (!result.ok) {
10504
- * // Handle error
10505
- * }
10506
- *
10507
- * const [
10508
- * spokeTxHash, // transaction hash on the spoke chain
10509
- * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
10510
- * ] = result.value;
10511
- * console.log('Migration transaction hashes:', { spokeTxHash, hubTxHash });
10512
- */
10513
- migrateBaln(params: BalnMigrateParams, spokeProvider: IconSpokeProvider, timeout?: number): Promise<Result<[
10514
- Hex$1,
10515
- Hex$1
10516
- ], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
10517
- /**
10518
- * Creates a BALN migration intent on spoke chain (icon).
10519
- *
10520
- * @param params - The parameters for the BALN migration transaction.
10521
- * @param spokeProvider - The spoke provider.
10522
- * @param raw - Whether to return the raw transaction hash instead of the transaction receipt
10523
- * @returns {Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>> } - Returns the raw transaction payload or transaction hash
10524
- *
10525
- * @example
10526
- * const result = await migrationService.createMigrateBalnIntent(
10527
- * {
10528
- * amount: 1000n, // The amount of BALN tokens to swap
10529
- * lockupPeriod: SIX_MONTHS, // The lockup period for the swap (see LockupPeriod type)
10530
- * to: '0x...', // The hub (sonic) chain address that will receive the swapped BALN tokens
10531
- * stake: true, // Whether to stake the BALN tokens
10532
- * },
10533
- * spokeProvider, // IconSpokeProvider instance
10534
- * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
10535
- * );
10536
- *
10537
- */
10538
- createMigrateBalnIntent<R extends boolean = false>(params: BalnMigrateParams, spokeProvider: IconSpokeProvider, raw?: R): Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>;
10539
- /**
10540
- * Creates a bnUSD migration or reverse migration (legacy bnUSD to new bnUSD or vice versa) intent on a spoke chain.
10541
- *
10542
- * This function prepares the transaction data for migrating legacy bnUSD to new bnUSD,
10543
- * or for reverting (migrating new bnUSD back to legacy bnUSD), depending on the provided parameters.
10544
- * It performs validation on chain IDs and token addresses unless `unchecked` is set to true.
10545
- *
10546
- * @param params - The parameters for the bnUSD migration or reverse migration transaction.
10547
- * @param spokeProvider - The spoke provider instance for the source chain.
10548
- * @param unchecked - If true, skips input validation (use with caution).
10549
- * @param raw - If true, returns the raw transaction hash instead of the transaction receipt.
10550
- * @returns {Promise<Result<TxReturnType<S, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>}
10551
- * Returns a Result containing the transaction payload or hash, or an error if creation failed.
10552
- *
10553
- * @example
10554
- * // Migrate legacy bnUSD to new bnUSD
10555
- * const result = await migrationService.createMigratebnUSDIntent(
10556
- * {
10557
- * srcChainId: '0x1.icon', // Source chain ID (legacy bnUSD chain)
10558
- * dstChainId: 'sonic', // Destination chain ID (new bnUSD chain)
10559
- * srcbnUSD: 'cx...', // Legacy bnUSD token address
10560
- * dstbnUSD: '0x...', // New bnUSD token address
10561
- * amount: 1000n, // Amount to migrate
10562
- * to: '0x...', // Recipient address on destination chain
10563
- * } satisfies UnifiedBnUSDMigrateParams,
10564
- * spokeProvider, // SpokeProvider instance
10565
- * false, // Optional unchecked flag (validation is skipped)
10566
- * true // Optional raw flag
10567
- * );
10568
- *
10569
- * // Reverse migration: new bnUSD to legacy bnUSD
10570
- * const result = await migrationService.createMigratebnUSDIntent(
10571
- * {
10572
- * srcChainId: 'sonic', // Source chain ID (new bnUSD chain)
10573
- * dstChainId: '0x1.icon', // Destination chain ID (legacy bnUSD chain)
10574
- * srcbnUSD: '0x...', // New bnUSD token address
10575
- * dstbnUSD: 'cx...', // Legacy bnUSD token address
10576
- * amount: 1000n, // Amount to migrate
10577
- * to: 'hx...', // Recipient address on destination chain
10578
- * } satisfies UnifiedBnUSDMigrateParams,
10579
- * spokeProvider
10580
- * );
10581
- */
10582
- createMigratebnUSDIntent<S extends SpokeProvider, R extends boolean = false>(params: UnifiedBnUSDMigrateParams, spokeProvider: S, unchecked?: boolean, raw?: R): Promise<Result<[TxReturnType<S, R>, RelayExtraData], MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>;
10583
- /**
10584
- * Creates a migration of ICX to SODA intent on spoke chain (icon).
10585
- * This function handles the migration of ICX or wICX tokens to SODA tokens on the hub chain.
10586
- * Note: This function does not relay the transaction to the spoke chain.
10587
- * You should call the `isAllowanceValid` function before calling this function to check if the allowance is valid.
10588
- * You should call the `relayTxAndWaitPacket` function after calling this function to relay the transaction to the spoke chain.
10589
- *
10590
- * @param {MigrationParams} params - The parameters for the migration transaction.
10591
- * @param {IconSpokeProvider} spokeProvider - The spoke provider.
10592
- * @param {boolean} raw - Whether to return the raw transaction hash instead of the transaction receipt
10593
- * @returns {Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>} - Returns the raw transaction payload or transaction hash
10594
- *
10595
- * @example
10596
- * const result = await migrationService.createMigrateIcxToSodaIntent(
10770
+ * const result = await migrationService.isAllowanceValid(
10597
10771
  * {
10772
+ * token: 'ICX', // Token to migrate
10598
10773
  * icx: 'cx...', // Address of the ICX or wICX token to migrate
10599
10774
  * amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
10600
10775
  * to: '0x...', // Address to receive the migrated SODA tokens
10601
10776
  * },
10777
+ * 'migrate',
10602
10778
  * spokeProvider, // IconSpokeProvider instance
10603
- * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
10604
10779
  * );
10605
10780
  *
10606
- * if (!result.ok) {
10607
- * // Handle error
10608
- * }
10609
10781
  */
10610
- createMigrateIcxToSodaIntent<R extends boolean = false>(params: IcxMigrateParams, spokeProvider: IconSpokeProvider, raw?: R): Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>;
10782
+ isAllowanceValid<S extends SpokeProvider>(params: MigrationParams | MigrationRevertParams, action: MigrationAction, spokeProvider: S): Promise<Result<boolean>>;
10611
10783
  /**
10612
- * Creates a revert migration intent transaction on the hub chain.
10613
- * Note: This function does not relay the transaction to the spoke chain.
10614
- * You should call the `isAllowanceValid` function before calling this function to check if the allowance is valid.
10615
- * You should call the `relayTxAndWaitPacket` function after calling this function to relay the transaction to the spoke chain.
10616
- * @param {IcxCreateRevertMigrationParams} - The parameters for the revert migration transaction.
10617
- * @param {SonicSpokeProvider} spokeProvider - The spoke provider.
10618
- * @param {boolean} raw - Whether to return the raw transaction hash instead of the transaction receipt
10619
- * @returns {Promise<Result<TxReturnType<SonicSpokeProvider, R>, MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'>>>} - Returns the transaction hash or error
10784
+ * Approves the amount spending for the revert migration transaction.
10785
+ * @param params - The parameters for the revert migration transaction.
10786
+ * @param spokeProvider - The spoke provider.
10787
+ * @param raw - Whether to return the raw transaction hash instead of the transaction receipt
10788
+ * @returns {Promise<Result<TxReturnType<S, R>>>} - Returns the raw transaction payload or transaction hash
10620
10789
  *
10621
10790
  * @example
10622
- * const result = await migrationService.createRevertSodaToIcxMigrationIntent(
10791
+ * const result = await migrationService.approve(
10623
10792
  * {
10624
10793
  * amount: 1000n, // Amount of SODA tokens to revert
10625
10794
  * to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
10626
- * action: 'revert',
10627
10795
  * },
10628
- */
10629
- createRevertSodaToIcxMigrationIntent<R extends boolean = false>(params: Omit<IcxCreateRevertMigrationParams, 'wICX'>, spokeProvider: SonicSpokeProvider, raw?: R): Promise<Result<TxReturnType<SonicSpokeProvider, R>, MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'>>>;
10630
- }
10631
-
10632
- type UnifiedBnUSDMigrateParams = {
10633
- srcChainId: SpokeChainId;
10634
- srcbnUSD: string;
10635
- dstChainId: SpokeChainId;
10636
- dstbnUSD: string;
10637
- amount: bigint;
10638
- to: string;
10639
- };
10640
- type FormattedBnUSDMigrateParams = {
10641
- srcChainId: SpokeChainId;
10642
- legacybnUSD: string;
10643
- newbnUSD: string;
10644
- amount: bigint;
10645
- to: Hex;
10646
- dstChainId: SpokeChainId;
10647
- };
10648
- type BnUSDRevertMigrationParams = {
10649
- srcChainId: SpokeChainId;
10650
- legacybnUSD: string;
10651
- newbnUSD: string;
10652
- amount: bigint;
10653
- to: Hex;
10654
- dstChainId: SpokeChainId;
10655
- };
10656
- type BnUSDMigrationServiceConstructorParams = {
10657
- hubProvider: EvmHubProvider;
10658
- configService: ConfigService;
10659
- };
10660
- /**
10661
- * Service for handling bnUSD migration operations on the hub chain.
10662
- * Provides functionality to migrate between legacy and new bnUSD tokens.
10663
- */
10664
- declare class BnUSDMigrationService {
10665
- private readonly hubProvider;
10666
- private readonly configService;
10667
- constructor({ hubProvider, configService }: BnUSDMigrationServiceConstructorParams);
10668
- /**
10669
- * Generates transaction data for migrating legacy bnUSD tokens to new bnUSD tokens.
10670
- * This method creates the necessary contract calls to:
10671
- * 1. Wrap legacy bnUSD into vault tokens
10672
- * 2. Migrate to new bnUSD vault
10673
- * 3. Withdraw to new bnUSD tokens
10796
+ * 'revert',
10797
+ * spokeProvider, // SonicSpokeProvider instance
10798
+ * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
10799
+ * );
10674
10800
  *
10675
- * @param params - The migration parameters including token addresses, amount, and recipient
10676
- * @returns Encoded transaction data for the migration operation
10677
- * @throws Will throw an error if the hub asset configuration is not found
10678
10801
  */
10679
- migrateData(params: FormattedBnUSDMigrateParams): Hex;
10802
+ approve<S extends SpokeProvider, R extends boolean = false>(params: IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams, action: MigrationAction, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>>>;
10680
10803
  /**
10681
- * Generates transaction data for migrating new bnUSD tokens back to legacy bnUSD tokens.
10682
- * This method creates the necessary contract calls to:
10683
- * 1. Wrap new bnUSD into vault tokens
10684
- * 2. Migrate to legacy bnUSD vault
10685
- * 3. Withdraw to legacy bnUSD tokens
10804
+ * Migrates bnUSD tokens between legacy and new formats across supported spoke chains via the hub chain (sonic).
10805
+ * Handles both legacy-to-new and new-to-legacy bnUSD migrations, enforcing validation and relaying the transaction.
10686
10806
  *
10687
- * @param params - The migration parameters including token addresses, amount, and recipient
10688
- * @returns Encoded transaction data for the migration operation
10689
- * @throws Will throw an error if the hub asset configuration is not found
10690
- */
10691
- revertMigrationData(params: BnUSDRevertMigrationParams): Hex;
10692
- }
10693
-
10694
- /**
10695
- * Lockup periods in seconds
10696
- */
10697
- declare enum LockupPeriod {
10698
- NO_LOCKUP = 0,
10699
- SIX_MONTHS = 15552000,// 6 months
10700
- TWELVE_MONTHS = 31104000,// 12 months
10701
- EIGHTEEN_MONTHS = 46656000,// 18 months
10702
- TWENTY_FOUR_MONTHS = 62208000
10703
- }
10704
- /**
10705
- * Reward multipliers (in basis points, 10000 = 1.0)
10706
- */
10707
- declare enum LockupMultiplier {
10708
- NO_LOCKUP_MULTIPLIER = 5000,// 0.5x
10709
- SIX_MONTHS_MULTIPLIER = 7500,// 0.75x
10710
- TWELVE_MONTHS_MULTIPLIER = 10000,// 1.0x
10711
- EIGHTEEN_MONTHS_MULTIPLIER = 12500,// 1.25x
10712
- TWENTY_FOUR_MONTHS_MULTIPLIER = 15000
10713
- }
10714
- /**
10715
- * Unstake request information from the staked SODA contract.
10716
- */
10717
- type UnstakeRequest = {
10718
- /** The amount being unstaked */
10719
- amount: bigint;
10720
- /** The start time of the unstake request */
10721
- startTime: bigint;
10722
- /** The address to receive the unstaked tokens */
10723
- to: Address$1;
10724
- };
10725
- /**
10726
- * Detailed lock information structure returned by the BALN swap contract.
10727
- */
10728
- type DetailedLock = {
10729
- /** The amount of BALN tokens in the lock */
10730
- balnAmount: bigint;
10731
- /** The amount of SODA tokens in the lock */
10732
- sodaAmount: bigint;
10733
- /** The unlock time for the lock */
10734
- unlockTime: bigint;
10735
- /** The amount of xSODA tokens in the lock */
10736
- xSodaAmount: bigint;
10737
- /** The unstaking ID for the lock */
10738
- unstakingId: bigint;
10739
- /** The unstake request information */
10740
- unstakeRequest: UnstakeRequest;
10741
- /** The amount of staked SODA tokens */
10742
- stakedSodaAmount: bigint;
10743
- };
10744
- /**
10745
- * Parameters for BALN swap operations.
10746
- */
10747
- type BalnMigrateParams = {
10748
- /** The amount of BALN tokens to swap */
10749
- amount: bigint;
10750
- /** The lockup period for the swap */
10751
- lockupPeriod: LockupPeriod;
10752
- /** The address that will receive the swapped SODA tokens */
10753
- to: Address$1;
10754
- /** Whether to stake the SODA tokens */
10755
- stake: boolean;
10756
- };
10757
- /**
10758
- * Parameters for BALN lock operations.
10759
- */
10760
- type BalnLockParams = {
10761
- /** The lock ID to operate on */
10762
- lockId: bigint;
10763
- };
10764
- type BalnSwapServiceConstructorParams = {
10765
- hubProvider: EvmHubProvider;
10766
- };
10767
- /**
10768
- * Service for handling BALN swap operations on the hub chain.
10769
- * Provides functionality to interact directly with the BALN swap contract.
10770
- */
10771
- declare class BalnSwapService {
10772
- private readonly hubProvider;
10773
- constructor({ hubProvider }: BalnSwapServiceConstructorParams);
10774
- /**
10775
- * Gets the multiplier for a given lockup period.
10776
- * @param lockupPeriod - The lockup period
10777
- * @returns The multiplier in basis points
10778
- */
10779
- getMultiplierForPeriod(lockupPeriod: LockupPeriod): bigint;
10780
- /**
10781
- * Calculates the SODA amount for a given BALN amount and lockup period without calling the contract.
10782
- * @param balnAmount - The amount of BALN tokens
10783
- * @param lockupPeriod - The lockup period
10784
- * @returns The calculated SODA amount
10785
- */
10786
- calculateSodaAmount(balnAmount: bigint, lockupPeriod: LockupPeriod): bigint;
10787
- /**
10788
- * Generates transaction data for swapping BALN tokens to SODA tokens.
10789
- * This method creates the necessary contract calls to:
10790
- * 1. Approve the BALN swap contract to spend the BALN tokens
10791
- * 2. Execute the BALN swap with lockup period
10807
+ * @param params - Migration parameters, including source/destination chain IDs, token addresses, amount, and recipient.
10808
+ * @param spokeProvider - The SpokeProvider instance for the source chain.
10809
+ * @param timeout - Optional timeout in milliseconds for the relay operation (default: 60 seconds).
10810
+ * @param unchecked - Optional flag to skip validation checks (default: false).
10811
+ * @returns {Promise<Result<[string, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
10812
+ * Result containing a tuple: [spokeTxHash, hubTxHash] if successful, or an error describing the failure.
10792
10813
  *
10793
- * @param balnToken - The address of the BALN token
10794
- * @param params - The BALN swap parameters including amount, lockup period, and recipient
10795
- * @param configService - The config service
10796
- * @returns Encoded transaction data for the BALN swap operation
10797
- */
10798
- swapData(balnToken: IconContractAddress, params: BalnMigrateParams, configService: ConfigService): Hex;
10799
- /**
10800
- * Executes a claim operation directly through the wallet provider.
10801
- * @param params - The lock parameters including lock ID
10802
- * @param spokeProvider - The Sonic spoke provider
10803
- * @param raw - Whether to return raw transaction data
10804
- * @returns The transaction hash or raw transaction data
10805
- */
10806
- claim<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
10807
- /**
10808
- * Executes a claim unstaked operation directly through the wallet provider.
10809
- * @param params - The lock parameters including lock ID
10810
- * @param spokeProvider - The Sonic spoke provider
10811
- * @param raw - Whether to return raw transaction data
10812
- * @returns The transaction hash or raw transaction data
10813
- */
10814
- claimUnstaked<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
10815
- /**
10816
- * Executes a stake operation directly through the wallet provider.
10817
- * @param params - The lock parameters including lock ID
10818
- * @param spokeProvider - The Sonic spoke provider
10819
- * @param raw - Whether to return raw transaction data
10820
- * @returns The transaction hash or raw transaction data
10821
- */
10822
- stake<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
10823
- /**
10824
- * Executes an unstake operation directly through the wallet provider.
10825
- * @param params - The lock parameters including lock ID
10826
- * @param spokeProvider - The Sonic spoke provider
10827
- * @param raw - Whether to return raw transaction data
10828
- * @returns The transaction hash or raw transaction data
10829
- */
10830
- unstake<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
10831
- /**
10832
- * Executes a cancel unstake operation directly through the wallet provider.
10833
- * @param params - The lock parameters including lock ID
10834
- * @param spokeProvider - The Sonic spoke provider
10835
- * @param raw - Whether to return raw transaction data
10836
- * @returns The transaction hash or raw transaction data
10837
- */
10838
- cancelUnstake<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
10839
- /**
10840
- * Gets detailed locks for a specific user including unstake requests and staked amounts.
10814
+ * @example
10815
+ * // Migrate legacy bnUSD to new bnUSD
10816
+ * const result = await sodax.migration.migratebnUSD({
10817
+ * srcChainId: '0x1.icon', // Source chain ID (legacy)
10818
+ * dstChainId: 'sonic', // Destination chain ID (new)
10819
+ * srcbnUSD: 'cx...', // Legacy bnUSD token address
10820
+ * dstbnUSD: '0x...', // New bnUSD token address
10821
+ * amount: 1000n, // Amount to migrate
10822
+ * to: '0x...', // Recipient address on destination chain
10823
+ * }, iconSpokeProvider);
10824
+ *
10825
+ * // Reverse migration: new bnUSD to legacy bnUSD
10826
+ * const result = await sodax.migration.migratebnUSD({
10827
+ * srcChainId: 'sonic', // Source chain ID (new)
10828
+ * dstChainId: '0x1.icon', // Destination chain ID (legacy)
10829
+ * srcbnUSD: '0x...', // New bnUSD token address
10830
+ * dstbnUSD: 'cx...', // Legacy bnUSD token address
10831
+ * amount: 1000n, // Amount to migrate
10832
+ * to: 'hx...', // Recipient address on destination chain
10833
+ * }, sonicSpokeProvider);
10841
10834
  *
10842
- * @param publicClient - The public client for reading contract state
10843
- * @param user - The user address
10844
- * @returns Array of detailed lock information for the user
10835
+ * if (result.ok) {
10836
+ * // result.value is a tuple: [spokeTxHash, hubTxHash]
10837
+ * const [spokeTxHash, hubTxHash] = result.value;
10838
+ * console.log('[migrateBnUSD] hubTxHash', hubTxHash);
10839
+ * console.log('[migrateBnUSD] spokeTxHash', spokeTxHash);
10840
+ * } else {
10841
+ * // Handle migration error
10842
+ * console.error('[migrateBnUSD] error', result.error);
10843
+ * }
10845
10844
  */
10846
- getDetailedUserLocks(publicClient: PublicClient<HttpTransport>, user: Address$1): Promise<readonly DetailedLock[]>;
10845
+ migratebnUSD(params: UnifiedBnUSDMigrateParams, spokeProvider: SpokeProvider, timeout?: number, unchecked?: boolean): Promise<Result<[
10846
+ string,
10847
+ Hex$1
10848
+ ], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
10847
10849
  /**
10848
- * Encodes a swap transaction for the BALN swap contract.
10850
+ * Migrates ICX tokens to SODA tokens on the hub chain (sonic).
10851
+ * This function handles the migration of ICX tokens to SODA tokens.
10849
10852
  *
10850
- * @param amount - The amount of BALN tokens to swap
10851
- * @param lockupPeriod - The lockup period for the swap
10852
- * @param to - The address that will receive the swapped SODA tokens
10853
- * @param stake - Whether to stake the SODA tokens
10854
- * @returns The encoded contract call for the swap operation
10853
+ * @param params - The parameters for the migration transaction.
10854
+ * @param spokeProvider - The spoke provider.
10855
+ * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10856
+ * @returns {Promise<Result<[Hex, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
10857
+ * Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
10858
+ * or an error describing why the migration or relay failed.
10859
+ *
10860
+ * @example
10861
+ * const result = await migrationService.migrateIcxToSoda(
10862
+ * {
10863
+ * address: 'cx...', // Address of the ICX or wICX token to migrate
10864
+ * amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
10865
+ * to: '0x...', // Address to receive the migrated SODA tokens (i.e. the hub chain address)
10866
+ * },
10867
+ * spokeProvider, // IconSpokeProvider instance
10868
+ * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
10869
+ * );
10870
+ *
10871
+ * if (!result.ok) {
10872
+ * // Handle error
10873
+ * }
10874
+ *
10875
+ * const [
10876
+ * spokeTxHash, // transaction hash on the spoke chain
10877
+ * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
10878
+ * ] = result.value;
10879
+ * console.log('Migration transaction hashes:', { spokeTxHash, hubTxHash });
10855
10880
  */
10856
- encodeSwap(amount: bigint, lockupPeriod: LockupPeriod, to: Address$1, stake: boolean): EvmContractCall;
10881
+ migrateIcxToSoda(params: IcxMigrateParams, spokeProvider: IconSpokeProvider, timeout?: number): Promise<Result<[
10882
+ Hex$1,
10883
+ Hex$1
10884
+ ], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
10857
10885
  /**
10858
- * Encodes a claim transaction for the BALN swap contract.
10886
+ * Creates a revert migration (SODA to ICX) intent and submits (relays) it to the spoke chain.
10887
+ * @param params - The parameters for the revert migration transaction.
10888
+ * @param spokeProvider - The SonicSpokeProvider instance.
10889
+ * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10859
10890
  *
10860
- * @param lockId - The lock ID to claim from
10861
- * @returns The encoded contract call for the claim operation
10891
+ * @returns {Promise<Result<[Hex, Hex], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>}
10892
+ * Returns a Result containing a tuple of [hubTxHash, spokeTxHash] if successful,
10893
+ * or an error describing why the revert migration or relay failed.
10894
+ *
10895
+ *
10896
+ * @example
10897
+ * const result = await migrationService.revertMigrateSodaToIcx(
10898
+ * {
10899
+ * amount: 1000n, // Amount of SODA tokens to revert
10900
+ * to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
10901
+ * },
10902
+ * spokeProvider, // SonicSpokeProvider instance
10903
+ * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
10904
+ * );
10905
+ *
10906
+ * if (!result.ok) {
10907
+ * // Handle error
10908
+ * }
10909
+ *
10910
+ * const [
10911
+ * hubTxHash, // transaction hash on the hub chain
10912
+ * spokeTxHash, // transaction hash on the spoke chain (i.e. the transaction that was relayed to the spoke)
10913
+ * ] = result.value;
10914
+ * console.log('Revert migration transaction hashes:', { hubTxHash, spokeTxHash });
10862
10915
  */
10863
- encodeClaim(lockId: bigint): EvmContractCall;
10916
+ revertMigrateSodaToIcx(params: Omit<IcxCreateRevertMigrationParams, 'wICX'>, spokeProvider: SonicSpokeProvider, timeout?: number): Promise<Result<[
10917
+ Hex$1,
10918
+ Hex$1
10919
+ ], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>;
10864
10920
  /**
10865
- * Encodes a claim unstaked transaction for the BALN swap contract.
10921
+ * Migrates BALN tokens to SODA tokens on the hub chain (sonic).
10922
+ * This function handles the migration of BALN tokens to SODA tokens.
10866
10923
  *
10867
- * @param lockId - The lock ID to claim unstaked tokens from
10868
- * @returns The encoded contract call for the claim unstaked operation
10924
+ * @param params - The parameters for the migration transaction.
10925
+ * @param spokeProvider - The spoke provider.
10926
+ * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10927
+ * @returns {Promise<Result<[Hex, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
10928
+ * Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
10929
+ * or an error describing why the migration or relay failed.
10930
+ *
10931
+ * @example
10932
+ * const result = await migrationService.migrateBaln(
10933
+ * {
10934
+ * amount: 1000n, // The amount of BALN tokens to swap
10935
+ * lockupPeriod: SIX_MONTHS, // The lockup period for the swap (see LockupPeriod type)
10936
+ * to: '0x...', // The hub (sonic) chain address that will receive the swapped BALN tokens
10937
+ * stake: true, // Whether to stake the BALN tokens
10938
+ * },
10939
+ * spokeProvider, // IconSpokeProvider instance
10940
+ * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
10941
+ * );
10942
+ *
10943
+ * if (!result.ok) {
10944
+ * // Handle error
10945
+ * }
10946
+ *
10947
+ * const [
10948
+ * spokeTxHash, // transaction hash on the spoke chain
10949
+ * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
10950
+ * ] = result.value;
10951
+ * console.log('Migration transaction hashes:', { spokeTxHash, hubTxHash });
10869
10952
  */
10870
- encodeClaimUnstaked(lockId: bigint): EvmContractCall;
10953
+ migrateBaln(params: BalnMigrateParams, spokeProvider: IconSpokeProvider, timeout?: number): Promise<Result<[
10954
+ Hex$1,
10955
+ Hex$1
10956
+ ], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
10871
10957
  /**
10872
- * Encodes a stake transaction for the BALN swap contract.
10958
+ * Creates a BALN migration intent on spoke chain (icon).
10959
+ *
10960
+ * @param params - The parameters for the BALN migration transaction.
10961
+ * @param spokeProvider - The spoke provider.
10962
+ * @param raw - Whether to return the raw transaction hash instead of the transaction receipt
10963
+ * @returns {Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>> } - Returns the raw transaction payload or transaction hash
10964
+ *
10965
+ * @example
10966
+ * const result = await migrationService.createMigrateBalnIntent(
10967
+ * {
10968
+ * amount: 1000n, // The amount of BALN tokens to swap
10969
+ * lockupPeriod: SIX_MONTHS, // The lockup period for the swap (see LockupPeriod type)
10970
+ * to: '0x...', // The hub (sonic) chain address that will receive the swapped BALN tokens
10971
+ * stake: true, // Whether to stake the BALN tokens
10972
+ * },
10973
+ * spokeProvider, // IconSpokeProvider instance
10974
+ * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
10975
+ * );
10873
10976
  *
10874
- * @param lockId - The lock ID to stake
10875
- * @returns The encoded contract call for the stake operation
10876
10977
  */
10877
- encodeStake(lockId: bigint): EvmContractCall;
10978
+ createMigrateBalnIntent<R extends boolean = false>(params: BalnMigrateParams, spokeProvider: IconSpokeProvider, raw?: R): Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>;
10878
10979
  /**
10879
- * Encodes an unstake transaction for the BALN swap contract.
10980
+ * Creates a bnUSD migration or reverse migration (legacy bnUSD to new bnUSD or vice versa) intent on a spoke chain.
10880
10981
  *
10881
- * @param lockId - The lock ID to unstake
10882
- * @returns The encoded contract call for the unstake operation
10982
+ * This function prepares the transaction data for migrating legacy bnUSD to new bnUSD,
10983
+ * or for reverting (migrating new bnUSD back to legacy bnUSD), depending on the provided parameters.
10984
+ * It performs validation on chain IDs and token addresses unless `unchecked` is set to true.
10985
+ *
10986
+ * @param params - The parameters for the bnUSD migration or reverse migration transaction.
10987
+ * @param spokeProvider - The spoke provider instance for the source chain.
10988
+ * @param unchecked - If true, skips input validation (use with caution).
10989
+ * @param raw - If true, returns the raw transaction hash instead of the transaction receipt.
10990
+ * @returns {Promise<Result<TxReturnType<S, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>}
10991
+ * Returns a Result containing the transaction payload or hash, or an error if creation failed.
10992
+ *
10993
+ * @example
10994
+ * // Migrate legacy bnUSD to new bnUSD
10995
+ * const result = await migrationService.createMigratebnUSDIntent(
10996
+ * {
10997
+ * srcChainId: '0x1.icon', // Source chain ID (legacy bnUSD chain)
10998
+ * dstChainId: 'sonic', // Destination chain ID (new bnUSD chain)
10999
+ * srcbnUSD: 'cx...', // Legacy bnUSD token address
11000
+ * dstbnUSD: '0x...', // New bnUSD token address
11001
+ * amount: 1000n, // Amount to migrate
11002
+ * to: '0x...', // Recipient address on destination chain
11003
+ * } satisfies UnifiedBnUSDMigrateParams,
11004
+ * spokeProvider, // SpokeProvider instance
11005
+ * false, // Optional unchecked flag (validation is skipped)
11006
+ * true // Optional raw flag
11007
+ * );
11008
+ *
11009
+ * // Reverse migration: new bnUSD to legacy bnUSD
11010
+ * const result = await migrationService.createMigratebnUSDIntent(
11011
+ * {
11012
+ * srcChainId: 'sonic', // Source chain ID (new bnUSD chain)
11013
+ * dstChainId: '0x1.icon', // Destination chain ID (legacy bnUSD chain)
11014
+ * srcbnUSD: '0x...', // New bnUSD token address
11015
+ * dstbnUSD: 'cx...', // Legacy bnUSD token address
11016
+ * amount: 1000n, // Amount to migrate
11017
+ * to: 'hx...', // Recipient address on destination chain
11018
+ * } satisfies UnifiedBnUSDMigrateParams,
11019
+ * spokeProvider
11020
+ * );
10883
11021
  */
10884
- encodeUnstake(lockId: bigint): EvmContractCall;
11022
+ createMigratebnUSDIntent<S extends SpokeProvider, R extends boolean = false>(params: UnifiedBnUSDMigrateParams, spokeProvider: S, unchecked?: boolean, raw?: R): Promise<Result<[TxReturnType<S, R>, RelayExtraData], MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>;
10885
11023
  /**
10886
- * Encodes a cancel unstake transaction for the BALN swap contract.
11024
+ * Creates a migration of ICX to SODA intent on spoke chain (icon).
11025
+ * This function handles the migration of ICX or wICX tokens to SODA tokens on the hub chain.
11026
+ * Note: This function does not relay the transaction to the spoke chain.
11027
+ * You should call the `isAllowanceValid` function before calling this function to check if the allowance is valid.
11028
+ * You should call the `relayTxAndWaitPacket` function after calling this function to relay the transaction to the spoke chain.
10887
11029
  *
10888
- * @param lockId - The lock ID to cancel unstake for
10889
- * @returns The encoded contract call for the cancel unstake operation
11030
+ * @param {MigrationParams} params - The parameters for the migration transaction.
11031
+ * @param {IconSpokeProvider} spokeProvider - The spoke provider.
11032
+ * @param {boolean} raw - Whether to return the raw transaction hash instead of the transaction receipt
11033
+ * @returns {Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>} - Returns the raw transaction payload or transaction hash
11034
+ *
11035
+ * @example
11036
+ * const result = await migrationService.createMigrateIcxToSodaIntent(
11037
+ * {
11038
+ * icx: 'cx...', // Address of the ICX or wICX token to migrate
11039
+ * amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
11040
+ * to: '0x...', // Address to receive the migrated SODA tokens
11041
+ * },
11042
+ * spokeProvider, // IconSpokeProvider instance
11043
+ * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
11044
+ * );
11045
+ *
11046
+ * if (!result.ok) {
11047
+ * // Handle error
11048
+ * }
10890
11049
  */
10891
- encodeCancelUnstake(lockId: bigint): EvmContractCall;
11050
+ createMigrateIcxToSodaIntent<R extends boolean = false>(params: IcxMigrateParams, spokeProvider: IconSpokeProvider, raw?: R): Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>;
10892
11051
  /**
10893
- * Executes a contract call through the Sonic wallet provider.
10894
- * @param spokeProvider - The Sonic spoke provider
10895
- * @param rawTx - The raw contract call to execute
10896
- * @param raw - Whether to return raw transaction data
10897
- * @returns The transaction hash or raw transaction data
11052
+ * Creates a revert migration intent transaction on the hub chain.
11053
+ * Note: This function does not relay the transaction to the spoke chain.
11054
+ * You should call the `isAllowanceValid` function before calling this function to check if the allowance is valid.
11055
+ * You should call the `relayTxAndWaitPacket` function after calling this function to relay the transaction to the spoke chain.
11056
+ * @param {IcxCreateRevertMigrationParams} - The parameters for the revert migration transaction.
11057
+ * @param {SonicSpokeProvider} spokeProvider - The spoke provider.
11058
+ * @param {boolean} raw - Whether to return the raw transaction hash instead of the transaction receipt
11059
+ * @returns {Promise<Result<TxReturnType<SonicSpokeProvider, R>, MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'>>>} - Returns the transaction hash or error
11060
+ *
11061
+ * @example
11062
+ * const result = await migrationService.createRevertSodaToIcxMigrationIntent(
11063
+ * {
11064
+ * amount: 1000n, // Amount of SODA tokens to revert
11065
+ * to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
11066
+ * action: 'revert',
11067
+ * },
10898
11068
  */
10899
- call<R extends boolean = false>(spokeProvider: SonicSpokeProvider, rawTx: EvmContractCall, raw?: R): PromiseEvmTxReturnType<R>;
11069
+ createRevertSodaToIcxMigrationIntent<R extends boolean = false>(params: Omit<IcxCreateRevertMigrationParams, 'wICX'>, spokeProvider: SonicSpokeProvider, raw?: R): Promise<Result<TxReturnType<SonicSpokeProvider, R>, MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'>>>;
10900
11070
  }
10901
11071
 
10902
- export { type AggregatedReserveData, type AllowanceResponse, type ApiResponse, type BackendApiConfig, BackendApiService, type Balance, type BalnLockParams, type BalnMigrateParams, type BalnSwapAbi, BalnSwapService, type BalnSwapServiceConstructorParams, type BaseCurrencyInfo, BigIntToHex, type BigNumberValue, BigNumberZeroDecimal, BnUSDMigrationService, type BnUSDMigrationServiceConstructorParams, type BnUSDRevertMigrationParams, type BorrowInfo, type BridgeError, type BridgeErrorCode, type BridgeExtraData, type BridgeOptionalExtraData, type BridgeParams, BridgeService, type BridgeServiceConfig, type BridgeServiceConstructorParams, type CalculateAllReserveIncentivesRequest, type CalculateAllUserIncentivesRequest, type CalculateCompoundedRateRequest, type CancelUnstakeParams, type ClaimParams, type CombinedReserveData, type ComputedUserReserve, ConfigService, type ConfigServiceConfig, type ConfigServiceConstructorParams, type ConnMsg, type CreateBridgeIntentParams, type CreateIntentParams, type CustomProvider, CustomSorobanServer, CustomStellarAccount, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, type Default, type DepositSimulationParams, type DetailedLock, type EModeCategory, type EModeCategoryHumanized, type EModeData, type EModeDataString, type EmodeDataHumanized, Erc20Service, EvmAssetManagerService, type EvmContractCall, type EvmDepositToDataParams, type EvmGasEstimate, EvmHubProvider, type EvmHubProviderConfig, type EvmHubProviderConstructorParams, type EvmInitializedConfig, type EvmReturnType, EvmSolverService, type EvmSpokeDepositParams, EvmSpokeProvider, EvmSpokeService, type EvmTransferParams, type EvmTransferToHubParams, type EvmTxReturnType, type EvmUninitializedBrowserConfig, type EvmUninitializedConfig, type EvmUninitializedPrivateKeyConfig, EvmVaultTokenService, EvmWalletAbstraction, type EvmWithdrawAssetDataParams, type ExecuteMsg, FEE_PERCENTAGE_SCALE, type FeeAmount, type FeeData, type FormatReserveRequest, type FormatReserveResponse, type FormatReserveUSDRequest, type FormatReserveUSDResponse, type FormatReservesAndIncentivesUSDRequest, type FormatReservesUSDRequest, type FormatUserSummaryAndIncentivesRequest, type FormatUserSummaryAndIncentivesResponse, type FormatUserSummaryRequest, type FormatUserSummaryResponse, type FormattedReserveEMode, type GasEstimateType, type GetAddressType, type GetEstimateGasReturnType, type GetMigrationFailedPayload, type GetMoneyMarketError, type GetMoneyMarketParams, type GetPacketParams, type GetPacketResponse, type GetRelayRequestParamType, type GetRelayResponse, type GetSpokeDepositParamsType, type GetTransactionPacketsParams, type GetTransactionPacketsResponse, HALF_RAY, HALF_WAD, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type HashTxReturnType, type HubTxHash, ICON_TX_RESULT_WAIT_MAX_RETRY, type ISpokeProvider, type IWalletProvider, type IconContractAddress, type IconGasEstimate, type IconJsonRpcVersion, type IconRawTransaction, type IconReturnType, type IconSpokeDepositParams, IconSpokeProvider, IconSpokeService, type IconTransferToHubParams, type IcxCreateRevertMigrationParams, type IcxMigrateParams, IcxMigrationService, type IcxMigrationServiceConstructorParams, type IcxRawTransaction, type IcxRevertMigrationParams, type IcxTokenType, type IncentiveDataHumanized, type InjTokenInfo, Injective20Token, type InjectiveGasEstimate, type InjectiveReturnType, type InjectiveSpokeDepositParams, InjectiveSpokeProvider, InjectiveSpokeService, type InjectiveTransferToHubParams, type InstantUnstakeParams, type InstantiateMsg, type Intent, IntentCreatedEventAbi, type IntentCreatedEventLog, type IntentCreationFailedErrorData, type IntentData, IntentDataType, type IntentDeliveryInfo, type IntentError, type IntentErrorCode, type IntentErrorData, IntentFilledEventAbi, type IntentFilledEventLog, type IntentPostExecutionFailedErrorData, type IntentRelayRequest, type IntentRelayRequestParams, type IntentResponse, type IntentState, type IntentSubmitTxFailedErrorData, type IntentWaitUntilIntentExecutedFailedErrorData, IntentsAbi, type JsonRpcPayloadResponse, LTV_PRECISION, type LegacybnUSDChainId, type LegacybnUSDToken, type LegacybnUSDTokenAddress, LendingPoolService, LockupMultiplier, LockupPeriod, MAX_UINT256, type MigrationAction, type MigrationError, type MigrationErrorCode, type MigrationErrorData, type MigrationFailedErrorData, type MigrationParams, type MigrationRevertParams, MigrationService, type MigrationServiceConfig, type MigrationServiceConstructorParams, type MigrationTokens, type MoneyMarketAction, type MoneyMarketAsset, type MoneyMarketAssetBorrowers, type MoneyMarketAssetSuppliers, type MoneyMarketBorrowFailedError, type MoneyMarketBorrowParams, type MoneyMarketBorrowers, type MoneyMarketConfigParams, MoneyMarketDataService, type MoneyMarketEncodeBorrowParams, type MoneyMarketEncodeRepayParams, type MoneyMarketEncodeRepayWithATokensParams, type MoneyMarketEncodeSupplyParams, type MoneyMarketEncodeWithdrawParams, type MoneyMarketError, type MoneyMarketErrorCode, type MoneyMarketExtraData, type MoneyMarketOptionalExtraData, type MoneyMarketParams, type MoneyMarketPosition, type MoneyMarketRepayFailedError, type MoneyMarketRepayParams, MoneyMarketService, type MoneyMarketServiceConfig, type MoneyMarketServiceConstructorParams, type MoneyMarketSubmitTxFailedError, type MoneyMarketSupplyFailedError, type MoneyMarketSupplyParams, type MoneyMarketUnknownError, type MoneyMarketUnknownErrorCode, type MoneyMarketWithdrawFailedError, type MoneyMarketWithdrawParams, type NewbnUSDChainId, type Optional, type OptionalFee, type OptionalRaw, type OptionalTimeout, type OrderbookResponse, type PacketData, type PartnerFee, type PartnerFeeAmount, type PartnerFeeConfig, type PartnerFeePercentage, type PoolBaseCurrencyHumanized, type Prettify, type PromiseEvmTxReturnType, type PromiseIconTxReturnType, type PromiseInjectiveTxReturnType, type PromiseSolanaTxReturnType, type PromiseStellarTxReturnType, type PromiseSuiTxReturnType, type PromiseTxReturnType, type QueryMsg, type QuoteType, RAY, RAY_DECIMALS, type RawTxReturnType, type RelayAction, type RelayError, type RelayErrorCode, type RelayExtraData, type RelayOptionalExtraData, type RelayRequestDetail, type RelayRequestSigning, type RelayTxStatus, type RelayerApiConfig, type RequestConfig, type ReserveCalculationData, type ReserveData, type ReserveDataHumanized, type ReserveDataLegacy, type ReserveDataWithPrice, type ReserveEMode, type ReserveIncentiveDict, type ReservesDataHumanized, type ReservesIncentiveDataHumanized, type ResponseAddressType, type ResponseSigningType, type Result, type RewardInfoHumanized, SECONDS_PER_YEAR, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, Sodax, type SodaxConfig, type SolanaGasEstimate, type SolanaRawTransaction, type SolanaReturnType, type SolanaSpokeDepositParams, SolanaSpokeProvider, SolanaSpokeService, type SolanaTransferToHubParams, SolverApiService, type SolverConfigParams, type SolverErrorResponse, type SolverExecutionRequest, type SolverExecutionResponse, SolverIntentErrorCode, type SolverIntentQuoteRequest, type SolverIntentQuoteResponse, type SolverIntentQuoteResponseRaw, SolverIntentStatusCode, type SolverIntentStatusRequest, type SolverIntentStatusResponse, type SonicSpokeDepositParams, SonicSpokeProvider, SonicSpokeService, type SpokeDepositParams, type SpokeProvider, SpokeService, type SpokeTokenSymbols, type SpokeTxHash, type StakeParams, type StakingAction, type StakingConfig, type StakingError, type StakingErrorCode, type StakingInfo, StakingLogic, type StakingParams, StakingService, type StakingServiceConstructorParams, type State, type StellarGasEstimate, type StellarReturnType, type StellarSpokeDepositParams, StellarSpokeProvider, StellarSpokeService, type StellarTransferToHubParams, type SubmitTxParams, type SubmitTxResponse, type SuiGasEstimate, type SuiRawTransaction, type SuiReturnType, type SuiSpokeDepositParams, SuiSpokeProvider, SuiSpokeService, type SuiTransferToHubParams, SupportedMigrationTokens, type SwapParams, SwapService, type SwapServiceConfig, type SwapServiceConstructorParams, type TxReturnType, USD_DECIMALS, type UiPoolDataProviderInterface, UiPoolDataProviderService, type UnifiedBnUSDMigrateParams, type UnstakeParams, type UnstakeRequest, type UnstakeRequestWithPenalty, type UnstakeSodaRequest, type UnstakingInfo, type UserIncentiveData, type UserIncentiveDataHumanized, type UserIncentiveDict, type UserReserveCalculationData, type UserReserveData, type UserReserveDataHumanized, type UserReserveDataString, type UserReservesIncentivesDataHumanized, type UserRewardInfoHumanized, type UserUnstakeInfo, VAULT_TOKEN_DECIMALS, type VaultReserves, WAD, WAD_RAY_RATIO, WEI_DECIMALS, type WaitUntilIntentExecutedPayload, WalletAbstractionService, type WalletSimulationParams, type WithdrawInfo, adjustAmountByFee, assetManagerAbi, balnSwapAbi, binomialApproximatedRayPow, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, connectionAbi, deriveUserWalletAddress, encodeAddress, encodeContractCalls, erc20Abi, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getCompoundedBalance, getEvmViemChain, getHubChainConfig, getIconAddressBytes, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getTransactionPackets, hexToBigInt, hyper, isBalnMigrateParams, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconSpokeProvider, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveSpokeProvider, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketWithdrawUnknownError, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSolanaSpokeProvider, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isUnifiedBnUSDMigrateParams, isWaitUntilIntentExecutedFailed, nativeToUSD, newbnUSDSpokeChainIds, normalize, normalizeBN, normalizedToUsd, parseToStroops, parseTokenArrayFromJson, poolAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sleep, sonicWalletFactoryAbi, spokeAssetManagerAbi, stakedSodaAbi, stakingRouterAbi, submitTransaction, uiPoolDataAbi, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, wadToRay, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
11072
+ export { type AggregatedReserveData, type AllowanceResponse, type ApiResponse, type BackendApiConfig, BackendApiService, type Balance, type BalnLockParams, type BalnMigrateParams, type BalnSwapAbi, BalnSwapService, type BalnSwapServiceConstructorParams, type BaseCurrencyInfo, BigIntToHex, type BigNumberValue, BigNumberZeroDecimal, BnUSDMigrationService, type BnUSDMigrationServiceConstructorParams, type BnUSDRevertMigrationParams, type BorrowInfo, type BridgeError, type BridgeErrorCode, type BridgeExtraData, type BridgeOptionalExtraData, type BridgeParams, BridgeService, type BridgeServiceConfig, type BridgeServiceConstructorParams, type CalculateAllReserveIncentivesRequest, type CalculateAllUserIncentivesRequest, type CalculateCompoundedRateRequest, type CancelUnstakeParams, type ClaimParams, type CombinedReserveData, type ComputedUserReserve, ConfigService, type ConfigServiceConfig, type ConfigServiceConstructorParams, type ConnMsg, type CreateBridgeIntentParams, type CreateIntentParams, type CustomProvider, CustomSorobanServer, CustomStellarAccount, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, type Default, type DepositSimulationParams, type DetailedLock, type EModeCategory, type EModeCategoryHumanized, type EModeData, type EModeDataString, type EmodeDataHumanized, Erc20Service, EvmAssetManagerService, EvmBaseSpokeProvider, type EvmContractCall, type EvmDepositToDataParams, type EvmGasEstimate, EvmHubProvider, type EvmHubProviderConfig, type EvmHubProviderConstructorParams, type EvmInitializedConfig, EvmRawSpokeProvider, type EvmReturnType, EvmSolverService, type EvmSpokeDepositParams, EvmSpokeProvider, type EvmSpokeProviderType, EvmSpokeService, type EvmTransferParams, type EvmTransferToHubParams, type EvmTxReturnType, type EvmUninitializedBrowserConfig, type EvmUninitializedConfig, type EvmUninitializedPrivateKeyConfig, EvmVaultTokenService, EvmWalletAbstraction, type EvmWithdrawAssetDataParams, type ExecuteMsg, FEE_PERCENTAGE_SCALE, type FeeAmount, type FeeData, type FormatReserveRequest, type FormatReserveResponse, type FormatReserveUSDRequest, type FormatReserveUSDResponse, type FormatReservesAndIncentivesUSDRequest, type FormatReservesUSDRequest, type FormatUserSummaryAndIncentivesRequest, type FormatUserSummaryAndIncentivesResponse, type FormatUserSummaryRequest, type FormatUserSummaryResponse, type FormattedReserveEMode, type GasEstimateType, type GetAddressType, type GetChainConfigType, type GetEstimateGasReturnType, type GetMigrationFailedPayload, type GetMoneyMarketError, type GetMoneyMarketParams, type GetPacketParams, type GetPacketResponse, type GetRelayRequestParamType, type GetRelayResponse, type GetSpokeDepositParamsType, type GetTransactionPacketsParams, type GetTransactionPacketsResponse, HALF_RAY, HALF_WAD, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type HashTxReturnType, type HubTxHash, ICON_TX_RESULT_WAIT_MAX_RETRY, type IRawSpokeProvider, type ISpokeProvider, type IWalletProvider, IconBaseSpokeProvider, type IconContractAddress, type IconGasEstimate, type IconJsonRpcVersion, IconRawSpokeProvider, type IconRawTransaction, type IconReturnType, type IconSpokeDepositParams, IconSpokeProvider, type IconSpokeProviderType, IconSpokeService, type IconTransferToHubParams, type IcxCreateRevertMigrationParams, type IcxMigrateParams, IcxMigrationService, type IcxMigrationServiceConstructorParams, type IcxRawTransaction, type IcxRevertMigrationParams, type IcxTokenType, type IncentiveDataHumanized, type InjTokenInfo, Injective20Token, InjectiveBaseSpokeProvider, type InjectiveGasEstimate, InjectiveRawSpokeProvider, type InjectiveReturnType, type InjectiveSpokeDepositParams, InjectiveSpokeProvider, type InjectiveSpokeProviderType, InjectiveSpokeService, type InjectiveTransferToHubParams, type InstantUnstakeParams, type InstantiateMsg, type Intent, IntentCreatedEventAbi, type IntentCreatedEventLog, type IntentCreationFailedErrorData, type IntentData, IntentDataType, type IntentDeliveryInfo, type IntentError, type IntentErrorCode, type IntentErrorData, IntentFilledEventAbi, type IntentFilledEventLog, type IntentPostExecutionFailedErrorData, type IntentRelayRequest, type IntentRelayRequestParams, type IntentResponse, type IntentState, type IntentSubmitTxFailedErrorData, type IntentWaitUntilIntentExecutedFailedErrorData, IntentsAbi, type JsonRpcPayloadResponse, LTV_PRECISION, type LegacybnUSDChainId, type LegacybnUSDToken, type LegacybnUSDTokenAddress, LendingPoolService, LockupMultiplier, LockupPeriod, MAX_UINT256, type MigrationAction, type MigrationError, type MigrationErrorCode, type MigrationErrorData, type MigrationFailedErrorData, type MigrationParams, type MigrationRevertParams, MigrationService, type MigrationServiceConfig, type MigrationServiceConstructorParams, type MigrationTokens, type MoneyMarketAction, type MoneyMarketAsset, type MoneyMarketAssetBorrowers, type MoneyMarketAssetSuppliers, type MoneyMarketBorrowFailedError, type MoneyMarketBorrowParams, type MoneyMarketBorrowers, type MoneyMarketConfigParams, MoneyMarketDataService, type MoneyMarketEncodeBorrowParams, type MoneyMarketEncodeRepayParams, type MoneyMarketEncodeRepayWithATokensParams, type MoneyMarketEncodeSupplyParams, type MoneyMarketEncodeWithdrawParams, type MoneyMarketError, type MoneyMarketErrorCode, type MoneyMarketExtraData, type MoneyMarketOptionalExtraData, type MoneyMarketParams, type MoneyMarketPosition, type MoneyMarketRepayFailedError, type MoneyMarketRepayParams, MoneyMarketService, type MoneyMarketServiceConfig, type MoneyMarketServiceConstructorParams, type MoneyMarketSubmitTxFailedError, type MoneyMarketSupplyFailedError, type MoneyMarketSupplyParams, type MoneyMarketUnknownError, type MoneyMarketUnknownErrorCode, type MoneyMarketWithdrawFailedError, type MoneyMarketWithdrawParams, type NewbnUSDChainId, type Optional, type OptionalFee, type OptionalRaw, type OptionalTimeout, type OrderbookResponse, type PacketData, type PartnerFee, type PartnerFeeAmount, type PartnerFeeConfig, type PartnerFeePercentage, type PoolBaseCurrencyHumanized, type Prettify, type PromiseEvmTxReturnType, type PromiseIconTxReturnType, type PromiseInjectiveTxReturnType, type PromiseSolanaTxReturnType, type PromiseStellarTxReturnType, type PromiseSuiTxReturnType, type PromiseTxReturnType, type QueryMsg, type QuoteType, RAY, RAY_DECIMALS, type RawSpokeProvider, type RawTxReturnType, type RelayAction, type RelayError, type RelayErrorCode, type RelayExtraData, type RelayOptionalExtraData, type RelayRequestDetail, type RelayRequestSigning, type RelayTxStatus, type RelayerApiConfig, type RequestConfig, type ReserveCalculationData, type ReserveData, type ReserveDataHumanized, type ReserveDataLegacy, type ReserveDataWithPrice, type ReserveEMode, type ReserveIncentiveDict, type ReservesDataHumanized, type ReservesIncentiveDataHumanized, type ResponseAddressType, type ResponseSigningType, type Result, type RewardInfoHumanized, SECONDS_PER_YEAR, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, Sodax, type SodaxConfig, SolanaBaseSpokeProvider, type SolanaGasEstimate, SolanaRawSpokeProvider, type SolanaRawSpokeProviderConfig, type SolanaRawTransaction, type SolanaReturnType, type SolanaSpokeDepositParams, SolanaSpokeProvider, type SolanaSpokeProviderType, SolanaSpokeService, type SolanaTransferToHubParams, SolverApiService, type SolverConfigParams, type SolverErrorResponse, type SolverExecutionRequest, type SolverExecutionResponse, SolverIntentErrorCode, type SolverIntentQuoteRequest, type SolverIntentQuoteResponse, type SolverIntentQuoteResponseRaw, SolverIntentStatusCode, type SolverIntentStatusRequest, type SolverIntentStatusResponse, SonicBaseSpokeProvider, SonicRawSpokeProvider, type SonicSpokeDepositParams, SonicSpokeProvider, type SonicSpokeProviderType, SonicSpokeService, type SpokeDepositParams, type SpokeProvider, type SpokeProviderType, SpokeService, type SpokeTokenSymbols, type SpokeTxHash, type StakeParams, type StakingAction, type StakingConfig, type StakingError, type StakingErrorCode, type StakingInfo, StakingLogic, type StakingParams, StakingService, type StakingServiceConstructorParams, type State, StellarBaseSpokeProvider, type StellarGasEstimate, StellarRawSpokeProvider, type StellarReturnType, type StellarSpokeDepositParams, StellarSpokeProvider, type StellarSpokeProviderType, StellarSpokeService, type StellarTransferToHubParams, type SubmitTxParams, type SubmitTxResponse, SuiBaseSpokeProvider, type SuiGasEstimate, SuiRawSpokeProvider, type SuiRawTransaction, type SuiReturnType, type SuiSpokeDepositParams, SuiSpokeProvider, type SuiSpokeProviderType, SuiSpokeService, type SuiTransferToHubParams, SupportedMigrationTokens, type SwapParams, SwapService, type SwapServiceConfig, type SwapServiceConstructorParams, type TxReturnType, USD_DECIMALS, type UiPoolDataProviderInterface, UiPoolDataProviderService, type UnifiedBnUSDMigrateParams, type UnstakeParams, type UnstakeRequest, type UnstakeRequestWithPenalty, type UnstakeSodaRequest, type UnstakingInfo, type UserIncentiveData, type UserIncentiveDataHumanized, type UserIncentiveDict, type UserReserveCalculationData, type UserReserveData, type UserReserveDataHumanized, type UserReserveDataString, type UserReservesIncentivesDataHumanized, type UserRewardInfoHumanized, type UserUnstakeInfo, VAULT_TOKEN_DECIMALS, type VaultReserves, WAD, WAD_RAY_RATIO, WEI_DECIMALS, type WaitUntilIntentExecutedPayload, WalletAbstractionService, type WalletSimulationParams, type WithdrawInfo, adjustAmountByFee, assetManagerAbi, balnSwapAbi, binomialApproximatedRayPow, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, connectionAbi, convertTransactionInstructionToRaw, deriveUserWalletAddress, encodeAddress, encodeContractCalls, erc20Abi, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getCompoundedBalance, getEvmViemChain, getHubChainConfig, getIconAddressBytes, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getTransactionPackets, hexToBigInt, hexToSolanaAddress, hyper, isBalnMigrateParams, isConfiguredMoneyMarketConfig, isConfiguredSolverConfig, isEvmHubChainConfig, isEvmInitializedConfig, isEvmRawSpokeProvider, isEvmSpokeChainConfig, isEvmSpokeProvider, isEvmSpokeProviderType, isEvmUninitializedBrowserConfig, isEvmUninitializedConfig, isEvmUninitializedPrivateKeyConfig, isIconAddress, isIconRawSpokeProvider, isIconSpokeProvider, isIconSpokeProviderType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveRawSpokeProvider, isInjectiveSpokeProvider, isInjectiveSpokeProviderType, isIntentCreationFailedError, isIntentCreationUnknownError, isIntentPostExecutionFailedError, isIntentRelayChainId, isIntentSubmitTxFailedError, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isMoneyMarketBorrowUnknownError, isMoneyMarketCreateBorrowIntentFailedError, isMoneyMarketCreateRepayIntentFailedError, isMoneyMarketCreateSupplyIntentFailedError, isMoneyMarketCreateWithdrawIntentFailedError, isMoneyMarketRelayTimeoutError, isMoneyMarketRepayUnknownError, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketWithdrawUnknownError, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isRawSpokeProvider, isResponseAddressType, isResponseSigningType, isSolanaNativeToken, isSolanaRawSpokeProvider, isSolanaSpokeProvider, isSolanaSpokeProviderType, isSonicRawSpokeProvider, isSonicSpokeProvider, isSonicSpokeProviderType, isStellarRawSpokeProvider, isStellarSpokeProvider, isStellarSpokeProviderType, isSuiRawSpokeProvider, isSuiSpokeProvider, isSuiSpokeProviderType, isUnifiedBnUSDMigrateParams, isWaitUntilIntentExecutedFailed, nativeToUSD, newbnUSDSpokeChainIds, normalize, normalizeBN, normalizedToUsd, parseToStroops, parseTokenArrayFromJson, poolAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sleep, sonicWalletFactoryAbi, spokeAssetManagerAbi, stakedSodaAbi, stakingRouterAbi, submitTransaction, uiPoolDataAbi, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, wadToRay, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };