@sodax/sdk 1.0.0-rc.8 → 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 = {
@@ -6324,25 +6371,77 @@ type MoneyMarketEncodeRepayWithATokensParams = {
6324
6371
  interestRateMode: bigint;
6325
6372
  };
6326
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
+ */
6327
6385
  type MoneyMarketSupplyParams = {
6328
6386
  token: string;
6329
6387
  amount: bigint;
6330
6388
  action: 'supply';
6389
+ toChainId?: SpokeChainId;
6390
+ toAddress?: Address;
6331
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
+ */
6332
6403
  type MoneyMarketBorrowParams = {
6333
6404
  token: string;
6334
6405
  amount: bigint;
6335
6406
  action: 'borrow';
6407
+ toChainId?: SpokeChainId;
6408
+ toAddress?: Address;
6336
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
+ */
6337
6421
  type MoneyMarketWithdrawParams = {
6338
6422
  token: string;
6339
6423
  amount: bigint;
6340
6424
  action: 'withdraw';
6425
+ toChainId?: SpokeChainId;
6426
+ toAddress?: Address;
6341
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
+ */
6342
6439
  type MoneyMarketRepayParams = {
6343
6440
  token: string;
6344
6441
  amount: bigint;
6345
6442
  action: 'repay';
6443
+ toChainId?: SpokeChainId;
6444
+ toAddress?: Address;
6346
6445
  };
6347
6446
  type MoneyMarketParams = MoneyMarketSupplyParams | MoneyMarketBorrowParams | MoneyMarketWithdrawParams | MoneyMarketRepayParams;
6348
6447
  type MoneyMarketUnknownErrorCode = 'SUPPLY_UNKNOWN_ERROR' | 'BORROW_UNKNOWN_ERROR' | 'WITHDRAW_UNKNOWN_ERROR' | 'REPAY_UNKNOWN_ERROR';
@@ -6709,42 +6808,42 @@ declare class MoneyMarketService {
6709
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>;
6710
6809
  /**
6711
6810
  * Build transaction data for supplying to the money market pool
6712
- * @param token - The address of the token on spoke chain
6713
- * @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
6714
6813
  * @param amount - The amount to deposit
6715
- * @param spokeChainId - The chain ID of the spoke chain
6814
+ * @param toHubAddress - The user wallet address on the hub chain
6716
6815
  * @returns {Hex} The transaction data.
6717
6816
  */
6718
- buildSupplyData(token: string, to: Address, amount: bigint, spokeChainId: SpokeChainId): Hex;
6817
+ buildSupplyData(fromChainId: SpokeChainId, fromToken: string, amount: bigint, toHubAddress: Address): Hex;
6719
6818
  /**
6720
6819
  * Build transaction data for borrowing from the money market pool
6721
- * @param from - The user wallet address on the hub chain
6722
- * @param to - The user wallet address on the spoke chain
6723
- * @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
6724
6823
  * @param amount - The amount to borrow in hub chain decimals
6725
- * @param spokeChainId - The chain ID of the spoke chain
6824
+ * @param toChainId - The chain ID of the target chain
6726
6825
  * @returns {Hex} The transaction data.
6727
6826
  */
6728
- 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;
6729
6828
  /**
6730
6829
  * Build transaction data for withdrawing from the money market pool
6731
- * @param from - The user wallet address on the hub chain
6732
- * @param to - The user wallet address on the spoke chain
6733
- * @param token - The address of the token to borrow
6734
- * @param amount - The amount to borrow in hub chain decimals
6735
- * @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
6736
6835
  * @returns {Hex} The transaction data.
6737
6836
  */
6738
- 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;
6739
6838
  /**
6740
6839
  * Build transaction data for repaying to the money market pool
6741
- * @param token - The address of the token to repay
6742
- * @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
6743
6842
  * @param amount - The amount to repay
6744
- * @param spokeChainId - The chain ID of the spoke chain
6843
+ * @param toHubAddress - The hub address of the user to repay to
6745
6844
  * @returns {Hex} The transaction data.
6746
6845
  */
6747
- buildRepayData(token: string, to: Address, amount: bigint, spokeChainId: SpokeChainId): Hex;
6846
+ buildRepayData(fromChainId: SpokeChainId, fromToken: string, amount: bigint, toHubAddress: Address): Hex;
6748
6847
  /**
6749
6848
  * Calculate aToken amount from actual amount using liquidityIndex
6750
6849
  * @param amount - The actual amount
@@ -6822,7 +6921,7 @@ declare class MoneyMarketService {
6822
6921
  }
6823
6922
 
6824
6923
  type SodaxConfig = {
6825
- swap?: SolverConfigParams;
6924
+ swaps?: SolverConfigParams;
6826
6925
  moneyMarket?: MoneyMarketConfigParams;
6827
6926
  migration?: MigrationServiceConfig;
6828
6927
  bridge?: BridgeServiceConfig;
@@ -6837,7 +6936,7 @@ type SodaxConfig = {
6837
6936
  */
6838
6937
  declare class Sodax {
6839
6938
  readonly instanceConfig?: SodaxConfig;
6840
- readonly swap: SwapService;
6939
+ readonly swaps: SwapService;
6841
6940
  readonly moneyMarket: MoneyMarketService;
6842
6941
  readonly migration: MigrationService;
6843
6942
  readonly backendApi: BackendApiService;
@@ -6856,10 +6955,22 @@ declare class Sodax {
6856
6955
  initialize(): Promise<Result<void>>;
6857
6956
  }
6858
6957
 
6859
- declare class SolanaSpokeProvider implements ISpokeProvider {
6860
- readonly walletProvider: ISolanaWalletProvider;
6861
- readonly chainConfig: SolanaChainConfig;
6862
- 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);
6863
6974
  }
6864
6975
 
6865
6976
  type CustomProvider = {
@@ -6869,6 +6980,11 @@ interface ISpokeProvider {
6869
6980
  readonly walletProvider: IWalletProvider;
6870
6981
  readonly chainConfig: SpokeChainConfig;
6871
6982
  }
6983
+ interface IRawSpokeProvider {
6984
+ readonly walletProvider: WalletAddressProvider;
6985
+ readonly chainConfig: SpokeChainConfig;
6986
+ readonly raw: true;
6987
+ }
6872
6988
  type EvmUninitializedBrowserConfig = {
6873
6989
  userAddress: Address$1;
6874
6990
  chain: EvmChainId;
@@ -6898,21 +7014,38 @@ declare class EvmHubProvider {
6898
7014
  readonly configService: ConfigService;
6899
7015
  constructor({ config, configService }: EvmHubProviderConstructorParams);
6900
7016
  }
6901
- declare class SonicSpokeProvider implements ISpokeProvider {
6902
- readonly walletProvider: IEvmWalletProvider;
6903
- readonly chainConfig: SonicSpokeChainConfig;
7017
+ declare class SonicBaseSpokeProvider {
6904
7018
  readonly publicClient: PublicClient<HttpTransport>;
6905
- constructor(walletProvider: IEvmWalletProvider, chainConfig: SonicSpokeChainConfig, rpcUrl?: string);
7019
+ readonly chainConfig: SonicSpokeChainConfig;
7020
+ constructor(chainConfig: SonicSpokeChainConfig, rpcUrl?: string);
6906
7021
  }
6907
- declare class EvmSpokeProvider implements ISpokeProvider {
7022
+ declare class SonicSpokeProvider extends SonicBaseSpokeProvider implements ISpokeProvider {
6908
7023
  readonly walletProvider: IEvmWalletProvider;
6909
- 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 {
6910
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;
6911
7038
  constructor(walletProvider: IEvmWalletProvider, chainConfig: EvmSpokeChainConfig, rpcUrl?: string);
6912
7039
  }
6913
-
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
+ }
6914
7045
  type IWalletProvider = IEvmWalletProvider | IInjectiveWalletProvider | IStellarWalletProvider | ISuiWalletProvider | IIconWalletProvider | IInjectiveWalletProvider | ISolanaWalletProvider;
6915
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;
6916
7049
 
6917
7050
  interface InstantiateMsg {
6918
7051
  connection: string;
@@ -6961,28 +7094,204 @@ interface State {
6961
7094
  hub_chain_id: string;
6962
7095
  owner: string;
6963
7096
  }
6964
- declare class InjectiveSpokeProvider implements ISpokeProvider {
6965
- readonly walletProvider: IInjectiveWalletProvider;
7097
+ declare class InjectiveBaseSpokeProvider {
6966
7098
  readonly chainConfig: InjectiveSpokeChainConfig;
6967
- private chainGrpcWasmApi;
7099
+ readonly chainGrpcWasmApi: ChainGrpcWasmApi;
6968
7100
  readonly txClient: TxGrpcApi;
6969
- constructor(conf: InjectiveSpokeChainConfig, walletProvider: IInjectiveWalletProvider);
7101
+ readonly endpoints: NetworkEndpoints;
7102
+ constructor(chainConfig: InjectiveSpokeChainConfig);
6970
7103
  getState(): Promise<State>;
6971
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);
6972
7116
  /**
6973
7117
  * Deposit tokens including native token to Injective Asset Manager.
6974
7118
  **/
6975
- 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>>;
6976
7120
  receiveMessage(senderAddress: string, srcChainId: string, srcAddress: Uint8Array, connSn: string, payload: Uint8Array, signatures: Uint8Array[]): Promise<InjectiveExecuteResponse>;
6977
7121
  setRateLimit(senderAddress: string, rateLimit: string): Promise<InjectiveExecuteResponse>;
6978
7122
  setConnection(senderAddress: string, connection: string): Promise<InjectiveExecuteResponse>;
6979
7123
  setOwner(senderAddress: string, owner: string): Promise<InjectiveExecuteResponse>;
6980
- send_message<R extends boolean = false>(sender: string, dst_chain_id: string, dst_address: Hex, payload: Hex, raw?: R): PromiseInjectiveTxReturnType<R>;
6981
7124
  static stringToUint8Array(str: string): Uint8Array;
6982
7125
  static uint8ArrayToString(arr: Uint8Array): string;
6983
7126
  static toBigIntString(num: number | bigint): string;
6984
7127
  }
6985
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
+
6986
7295
  type EvmDepositToDataParams = {
6987
7296
  token: Hex | string;
6988
7297
  to: Address$1;
@@ -7141,7 +7450,7 @@ declare class WalletAbstractionService {
7141
7450
  * @param hubProvider - The provider for interacting with the hub chain
7142
7451
  * @returns The user's hub wallet address
7143
7452
  */
7144
- static getUserAbstractedWalletAddress(address: string, spokeProvider: SpokeProvider, hubProvider: EvmHubProvider): Promise<Address>;
7453
+ static getUserAbstractedWalletAddress(address: string, spokeProvider: SpokeProviderType, hubProvider: EvmHubProvider): Promise<Address>;
7145
7454
  }
7146
7455
 
7147
7456
  type EvmSpokeDepositParams = {
@@ -7160,7 +7469,7 @@ declare class EvmSpokeService {
7160
7469
  * - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
7161
7470
  *
7162
7471
  * @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
7163
- * @param {EvmSpokeProvider} spokeProvider - The EVM spoke provider.
7472
+ * @param {EvmSpokeProviderType} spokeProvider - The EVM spoke provider.
7164
7473
  * @returns {Promise<bigint>} Estimated gas for the transaction.
7165
7474
  *
7166
7475
  * @example
@@ -7176,40 +7485,40 @@ declare class EvmSpokeService {
7176
7485
  * const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
7177
7486
  * console.log(`Estimated gas: ${estimatedGas}`);
7178
7487
  */
7179
- static estimateGas(rawTx: EvmRawTransaction, spokeProvider: EvmSpokeProvider): Promise<bigint>;
7488
+ static estimateGas(rawTx: EvmRawTransaction, spokeProvider: EvmSpokeProviderType): Promise<bigint>;
7180
7489
  /**
7181
7490
  * Deposit tokens to the spoke chain.
7182
7491
  * @param {EvmSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
7183
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
7492
+ * @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
7184
7493
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7185
- * @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.
7186
7495
  */
7187
- 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>>;
7188
7497
  /**
7189
7498
  * Get the balance of the token in the spoke chain.
7190
7499
  * @param {Address} token - The address of the token to get the balance of.
7191
- * @param {EvmSpokeProvider} spokeProvider - The spoke provider.
7500
+ * @param {EvmSpokeProviderType} spokeProvider - The spoke provider.
7192
7501
  * @returns {Promise<bigint>} The balance of the token.
7193
7502
  */
7194
- static getDeposit(token: Address$1, spokeProvider: EvmSpokeProvider): Promise<bigint>;
7503
+ static getDeposit(token: Address$1, spokeProvider: EvmSpokeProviderType): Promise<bigint>;
7195
7504
  /**
7196
7505
  * Generate simulation parameters for deposit from EvmSpokeDepositParams.
7197
7506
  * @param {EvmSpokeDepositParams} params - The deposit parameters.
7198
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
7507
+ * @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
7199
7508
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7200
7509
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
7201
7510
  */
7202
- static getSimulateDepositParams(params: EvmSpokeDepositParams, spokeProvider: EvmSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7511
+ static getSimulateDepositParams(params: EvmSpokeDepositParams, spokeProvider: EvmSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7203
7512
  /**
7204
7513
  * Calls a contract on the spoke chain using the user's wallet.
7205
7514
  * @param {HubAddress} from - The address of the user on the hub chain.
7206
7515
  * @param {Hex} payload - The payload to send to the contract.
7207
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
7516
+ * @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
7208
7517
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7209
7518
  * @param {boolean} raw - The return type raw or just transaction hash
7210
- * @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.
7211
7520
  */
7212
- 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>>;
7213
7522
  /**
7214
7523
  * Transfers tokens to the hub chain.
7215
7524
  * @param {EvmTransferToHubParams} params - The parameters for the transfer, including:
@@ -7217,9 +7526,9 @@ declare class EvmSpokeService {
7217
7526
  * - {Address} recipient: The recipient address on the hub chain.
7218
7527
  * - {bigint} amount: The amount to transfer.
7219
7528
  * - {Hex} [data="0x"]: Additional data for the transfer.
7220
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
7529
+ * @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
7221
7530
  * @param {boolean} raw - The return type raw or just transaction hash
7222
- * @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.
7223
7532
  */
7224
7533
  private static transfer;
7225
7534
  /**
@@ -7227,9 +7536,9 @@ declare class EvmSpokeService {
7227
7536
  * @param {bigint} dstChainId - The chain ID of the hub chain.
7228
7537
  * @param {Address} dstAddress - The address on the hub chain.
7229
7538
  * @param {Hex} payload - The payload to send.
7230
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
7539
+ * @param {EvmSpokeProviderType} spokeProvider - The provider for the spoke chain.
7231
7540
  * @param {boolean} raw - The return type raw or just transaction hash
7232
- * @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.
7233
7542
  */
7234
7543
  private static call;
7235
7544
  }
@@ -7246,7 +7555,7 @@ declare class SpokeService {
7246
7555
  * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
7247
7556
  * @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
7248
7557
  */
7249
- 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>>;
7250
7559
  /**
7251
7560
 
7252
7561
  * Encodes transfer data using RLP encoding to match Solidity Transfer struct.
@@ -7282,28 +7591,28 @@ declare class SpokeService {
7282
7591
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7283
7592
  * @param {boolean} raw - Whether to return raw transaction data.
7284
7593
  * @param {boolean} skipSimulation - Whether to skip deposit simulation (optional, defaults to false).
7285
- * @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.
7286
7595
  */
7287
- 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>>;
7288
- static getSimulateDepositParams<S extends SpokeProvider>(params: GetSpokeDepositParamsType<S>, spokeProvider: S, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7289
- 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>;
7290
7599
  /**
7291
7600
  * Get the balance of the token in the spoke chain.
7292
7601
  * @param {Address} token - The address of the token to get the balance of.
7293
- * @param {SpokeProvider} spokeProvider - The spoke provider.
7602
+ * @param {SpokeProviderType} spokeProvider - The spoke provider.
7294
7603
  * @returns {Promise<bigint>} The balance of the token.
7295
7604
  */
7296
- static getDeposit(token: Address, spokeProvider: SpokeProvider): Promise<bigint>;
7605
+ static getDeposit(token: Address, spokeProvider: SpokeProviderType): Promise<bigint>;
7297
7606
  /**
7298
- * 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.
7299
7608
  * @param {HubAddress} from - The address of the user on the hub chain.
7300
7609
  * @param {Hex} payload - The payload to send to the contract.
7301
- * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
7610
+ * @param {SpokeProviderType} spokeProvider - The provider for the spoke chain.
7302
7611
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7303
7612
  * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
7304
7613
  */
7305
- 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>>;
7306
- 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>;
7307
7616
  /**
7308
7617
  * Verifies the transaction hash for the spoke chain to exist on chain.
7309
7618
  * Only stellar and solana need to be verified. For other chains, we assume the transaction exists on chain.
@@ -7329,41 +7638,41 @@ type IconTransferToHubParams = {
7329
7638
  };
7330
7639
  declare class IconSpokeService {
7331
7640
  private constructor();
7332
- static estimateGas(rawTx: IconRawTransaction, spokeProvider: IconSpokeProvider): Promise<IconGasEstimate>;
7641
+ static estimateGas(rawTx: IconRawTransaction, spokeProvider: IconSpokeProviderType): Promise<IconGasEstimate>;
7333
7642
  /**
7334
7643
  * Deposit tokens to the spoke chain.
7335
7644
  * @param {IconSpokeDepositParams} params - The parameters for the deposit
7336
- * @param {IconWalletProvider} spokeProvider - The provider for the spoke chain
7645
+ * @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain
7337
7646
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain
7338
7647
  * @param {boolean} raw - The return type raw or just transaction hash
7339
7648
  * @returns {Promise<Result<string>>} A promise that resolves to the transaction hash
7340
7649
  */
7341
- 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>>;
7342
7651
  /**
7343
7652
  * Get the balance of the token in the spoke chain.
7344
7653
  * @param {string} token - The address of the token to get the balance of
7345
- * @param {IconWalletProvider} spokeProvider - The spoke provider
7654
+ * @param {IconSpokeProviderType} spokeProvider - The spoke provider
7346
7655
  * @returns {Promise<bigint>} The balance of the token
7347
7656
  */
7348
- static getDeposit(token: string, spokeProvider: IconSpokeProvider): Promise<bigint>;
7657
+ static getDeposit(token: string, spokeProvider: IconSpokeProviderType): Promise<bigint>;
7349
7658
  /**
7350
7659
  * Calls a contract on the spoke chain using the user's wallet.
7351
7660
  * @param {HubAddress} from - The address of the user on the hub chain
7352
7661
  * @param {Hex} payload - The payload to send to the contract
7353
- * @param {IconWalletProvider} spokeProvider - The provider for the spoke chain
7662
+ * @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain
7354
7663
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain
7355
7664
  * @param {boolean} raw - The return type raw or just transaction hash
7356
7665
  * @returns {Promise<Result<string>>} A promise that resolves to the transaction hash
7357
7666
  */
7358
- 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>>;
7359
7668
  /**
7360
7669
  * Generate simulation parameters for deposit from IconSpokeDepositParams.
7361
7670
  * @param {IconSpokeDepositParams} params - The deposit parameters.
7362
- * @param {IconSpokeProvider} spokeProvider - The provider for the spoke chain.
7671
+ * @param {IconSpokeProviderType} spokeProvider - The provider for the spoke chain.
7363
7672
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7364
7673
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
7365
7674
  */
7366
- static getSimulateDepositParams(params: IconSpokeDepositParams, spokeProvider: IconSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7675
+ static getSimulateDepositParams(params: IconSpokeDepositParams, spokeProvider: IconSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7367
7676
  /**
7368
7677
  * Transfers tokens to the hub chain.
7369
7678
  */
@@ -7400,43 +7709,43 @@ declare class InjectiveSpokeService {
7400
7709
  /**
7401
7710
  * Estimate the gas for a transaction.
7402
7711
  * @param {InjectiveRawTransaction} rawTx - The raw transaction to estimate the gas for.
7403
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7712
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7404
7713
  * @returns {Promise<InjectiveGasEstimate>} The estimated gas for the transaction.
7405
7714
  */
7406
- static estimateGas(rawTx: InjectiveRawTransaction, spokeProvider: InjectiveSpokeProvider): Promise<InjectiveGasEstimate>;
7715
+ static estimateGas(rawTx: InjectiveRawTransaction, spokeProvider: InjectiveSpokeProviderType): Promise<InjectiveGasEstimate>;
7407
7716
  /**
7408
7717
  * Deposit tokens to the spoke chain.
7409
7718
  * @param {InjectiveSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
7410
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7719
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7411
7720
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7412
7721
  * @param {boolean} raw - The return type raw or just transaction hash
7413
- * @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.
7414
7723
  */
7415
- 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>>;
7416
7725
  /**
7417
7726
  * Generate simulation parameters for deposit from InjectiveSpokeDepositParams.
7418
7727
  * @param {InjectiveSpokeDepositParams} params - The deposit parameters.
7419
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7728
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7420
7729
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7421
7730
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
7422
7731
  */
7423
- static getSimulateDepositParams(params: InjectiveSpokeDepositParams, spokeProvider: InjectiveSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7732
+ static getSimulateDepositParams(params: InjectiveSpokeDepositParams, spokeProvider: InjectiveSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7424
7733
  /**
7425
7734
  * Get the balance of the token that deposited in the spoke chain Asset Manager.
7426
7735
  * @param {Address} token - The address of the token to get the balance of.
7427
- * @param {InjectiveSpokeProvider} spokeProvider - The spoke provider.
7736
+ * @param {InjectiveSpokeProviderType} spokeProvider - The spoke provider.
7428
7737
  * @returns {Promise<bigint>} The balance of the token.
7429
7738
  */
7430
- static getDeposit(token: String, spokeProvider: InjectiveSpokeProvider): Promise<bigint>;
7739
+ static getDeposit(token: String, spokeProvider: InjectiveSpokeProviderType): Promise<bigint>;
7431
7740
  /**
7432
7741
  * Calls a contract on the spoke chain using the user's wallet.
7433
7742
  * @param {HubAddress} from - The address of the user on the hub chain.
7434
7743
  * @param {Hex} payload - The payload to send to the contract.
7435
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7744
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7436
7745
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7437
- * @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.
7438
7747
  */
7439
- 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>>;
7440
7749
  /**
7441
7750
  * Transfers tokens to the hub chain.
7442
7751
  * @param {InjectiveTransferToHubParams} params - The parameters for the transfer, including:
@@ -7444,9 +7753,9 @@ declare class InjectiveSpokeService {
7444
7753
  * - {Uint8Array} recipient: The recipient address on the hub chain.
7445
7754
  * - {string} amount: The amount to transfer.
7446
7755
  * - {Uint8Array} [data=new Uint8Array([])]: Additional data for the transfer.
7447
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7756
+ * @param {InjectiveSpokeProviderType} spokeProvider - The provider for the spoke chain.
7448
7757
  * @param {boolean} raw - The return type raw or just transaction hash
7449
- * @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.
7450
7759
  */
7451
7760
  private static transfer;
7452
7761
  /**
@@ -7454,8 +7763,8 @@ declare class InjectiveSpokeService {
7454
7763
  * @param {bigint} dstChainId - The chain ID of the hub chain.
7455
7764
  * @param {Address} dstAddress - The address on the hub chain.
7456
7765
  * @param {Hex} payload - The payload to send.
7457
- * @param {InjectiveSpokeProvider} spokeProvider - The provider for the spoke chain.
7458
- * @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.
7459
7768
  */
7460
7769
  private static call;
7461
7770
  }
@@ -7478,12 +7787,12 @@ declare class SolanaSpokeService {
7478
7787
  /**
7479
7788
  * Estimate the gas for a transaction.
7480
7789
  * @param {SolanaRawTransaction} rawTx - The raw transaction to estimate the gas for.
7481
- * @param {SolanaSpokeProvider} spokeProvider - The provider for the spoke chain.
7790
+ * @param {SolanaSpokeProviderType} spokeProvider - The provider for the spoke chain.
7482
7791
  * @returns {Promise<number | undefined>} The units consumed for the transaction.
7483
7792
  */
7484
- static estimateGas(rawTx: SolanaRawTransaction, spokeProvider: SolanaSpokeProvider): Promise<SolanaGasEstimate>;
7485
- static deposit<R extends boolean = false>(params: SolanaSpokeDepositParams, spokeProvider: SolanaSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseSolanaTxReturnType<R>;
7486
- 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>;
7487
7796
  /**
7488
7797
  * Calls a contract on the spoke chain using the user's wallet.
7489
7798
  * @param from - The address of the user on the hub chain.
@@ -7493,15 +7802,15 @@ declare class SolanaSpokeService {
7493
7802
  * @param raw - Whether to return the raw transaction data.
7494
7803
  * @returns The transaction result.
7495
7804
  */
7496
- 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>>;
7497
7806
  /**
7498
7807
  * Generate simulation parameters for deposit from SolanaSpokeDepositParams.
7499
7808
  * @param {SolanaSpokeDepositParams} params - The deposit parameters.
7500
- * @param {SolanaSpokeProvider} spokeProvider - The provider for the spoke chain.
7809
+ * @param {SolanaSpokeProviderType} spokeProvider - The provider for the spoke chain.
7501
7810
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
7502
7811
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
7503
7812
  */
7504
- static getSimulateDepositParams(params: SolanaSpokeDepositParams, spokeProvider: SolanaSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7813
+ static getSimulateDepositParams(params: SolanaSpokeDepositParams, spokeProvider: SolanaSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
7505
7814
  private static transfer;
7506
7815
  /**
7507
7816
  * Sends a message to the hub chain.
@@ -7719,9 +8028,135 @@ declare class SolverApiService {
7719
8028
  static getStatus(request: SolverIntentStatusRequest, config: SolverConfig): Promise<Result<SolverIntentStatusResponse, SolverErrorResponse>>;
7720
8029
  }
7721
8030
 
7722
- type CreateIntentParams = {
7723
- inputToken: string;
7724
- outputToken: string;
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 = {
8158
+ inputToken: string;
8159
+ outputToken: string;
7725
8160
  inputAmount: bigint;
7726
8161
  minOutputAmount: bigint;
7727
8162
  deadline: bigint;
@@ -7788,7 +8223,7 @@ type IntentError<T extends IntentErrorCode = IntentErrorCode> = {
7788
8223
  code: T;
7789
8224
  data: IntentErrorData<T>;
7790
8225
  };
7791
- type SwapParams<S extends SpokeProvider> = Prettify<{
8226
+ type SwapParams<S extends SpokeProviderType> = Prettify<{
7792
8227
  intentParams: CreateIntentParams;
7793
8228
  spokeProvider: S;
7794
8229
  skipSimulation?: boolean;
@@ -8035,7 +8470,7 @@ declare class SwapService {
8035
8470
  * data: '0x', // Additional arbitrary data
8036
8471
  * } satisfies CreateIntentParams;
8037
8472
  *
8038
- * const isAllowanceValid = await sodax.swap.isAllowanceValid({
8473
+ * const isAllowanceValid = await sodax.swaps.isAllowanceValid({
8039
8474
  * intentParams: createIntentParams,
8040
8475
  * spokeProvider: bscSpokeProvider,
8041
8476
  * });
@@ -8048,7 +8483,7 @@ declare class SwapService {
8048
8483
  * console.log('Approval required');
8049
8484
  * }
8050
8485
  */
8051
- 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>>;
8052
8487
  /**
8053
8488
  * Approve the Asset Manager contract to spend tokens on behalf of the user (required for EVM chains)
8054
8489
  * @param {Prettify<SwapParams<S> & OptionalRaw<R>>} params - Object containing:
@@ -8073,7 +8508,7 @@ declare class SwapService {
8073
8508
  * data: '0x', // Additional arbitrary data
8074
8509
  * } satisfies CreateIntentParams;
8075
8510
  *
8076
- * const approveResult = await sodax.swap.approve({
8511
+ * const approveResult = await sodax.swaps.approve({
8077
8512
  * intentParams: createIntentParams,
8078
8513
  * spokeProvider: bscSpokeProvider,
8079
8514
  * });
@@ -8087,7 +8522,7 @@ declare class SwapService {
8087
8522
  * console.log('Approval transaction:', txHash);
8088
8523
  * }
8089
8524
  */
8090
- 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>>>;
8091
8526
  /**
8092
8527
  * Creates an intent by handling token approval and intent creation
8093
8528
  * NOTE: This method does not submit the intent to the Solver API
@@ -8131,15 +8566,15 @@ declare class SwapService {
8131
8566
  * // handle error
8132
8567
  * }
8133
8568
  */
8134
- 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'>>>;
8135
8570
  /**
8136
8571
  * Cancels an intent
8137
8572
  * @param {Intent} intent - The intent to cancel
8138
- * @param {ISpokeProvider} spokeProvider - The spoke provider
8573
+ * @param {SpokeProviderType} spokeProvider - The spoke provider
8139
8574
  * @param {boolean} raw - Whether to return the raw transaction
8140
8575
  * @returns {Promise<TxReturnType<S, R>>} The encoded contract call
8141
8576
  */
8142
- 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>>>;
8143
8578
  /**
8144
8579
  * Gets an intent from a transaction hash (on Hub chain)
8145
8580
  * @param {Hash} txHash - The transaction hash on Hub chain
@@ -8204,7 +8639,7 @@ declare class SonicSpokeService {
8204
8639
  * - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
8205
8640
  *
8206
8641
  * @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
8207
- * @param {SonicSpokeProvider} spokeProvider - The EVM spoke provider.
8642
+ * @param {SonicSpokeProviderType} spokeProvider - The Sonic spoke provider.
8208
8643
  * @returns {Promise<bigint>} Estimated gas for the transaction.
8209
8644
  *
8210
8645
  * @example
@@ -8220,46 +8655,46 @@ declare class SonicSpokeService {
8220
8655
  * const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
8221
8656
  * console.log(`Estimated gas: ${estimatedGas}`);
8222
8657
  */
8223
- static estimateGas(rawTx: EvmRawTransaction, spokeProvider: SonicSpokeProvider): Promise<bigint>;
8658
+ static estimateGas(rawTx: EvmRawTransaction, spokeProvider: SonicSpokeProviderType): Promise<bigint>;
8224
8659
  /**
8225
8660
  * Get the derived address of a contract deployed with CREATE3.
8226
8661
  * @param address - User's address on the specified chain as hex
8227
8662
  * @param provider - Sonic Spoke provider
8228
8663
  * @returns {HubAddress} The computed contract address as a EVM address (hex) string
8229
8664
  */
8230
- static getUserRouter(address: Address$1, provider: SonicSpokeProvider): Promise<HubAddress>;
8665
+ static getUserRouter(address: Address$1, provider: SonicSpokeProviderType): Promise<HubAddress>;
8231
8666
  /**
8232
8667
  * Deposit tokens to the spoke chain using the Sonic wallet abstraction.
8233
8668
  * @param {SonicSpokeDepositParams} params - The parameters for the deposit
8234
- * @param {SonicSpokeProvider} spokeProvider - The provider for the spoke chain
8235
- * @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
8236
8671
  */
8237
- static deposit<S extends SpokeProvider, R extends boolean = false>(params: SonicSpokeDepositParams, spokeProvider: S, raw?: R): PromiseEvmTxReturnType<R>;
8238
- 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]>;
8239
8674
  /**
8240
8675
  * Get the balance of the token in the spoke chain.
8241
8676
  * @param {Address} token - The address of the token to get the balance of.
8242
- * @param {SonicSpokeProvider} spokeProvider - The spoke provider.
8677
+ * @param {SonicSpokeProviderType} spokeProvider - The spoke provider.
8243
8678
  * @returns {Promise<bigint>} The balance of the token.
8244
8679
  */
8245
- static getDeposit(token: Address$1, spokeProvider: SonicSpokeProvider): Promise<bigint>;
8680
+ static getDeposit(token: Address$1, spokeProvider: SonicSpokeProviderType): Promise<bigint>;
8246
8681
  /**
8247
8682
  * Execute a batch of contract calls through the Sonic wallet contract.
8248
8683
  * @param {Hex} payload - The encoded payload containing the calls array
8249
- * @param {SonicSpokeProvider} spokeProvider - The provider for the spoke chain
8250
- * @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
8251
8686
  */
8252
- 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>>;
8253
8688
  /**
8254
8689
  * Get withdraw information for a given token
8255
8690
  * @param token - The address of the underlying token
8256
8691
  * @param amount - The amount to withdraw
8257
- * @param spokeProvider - The spoke provider
8692
+ * @param chainId - The chain ID of the underlying token
8258
8693
  * @param moneyMarketService - The money market service
8259
8694
  * @param configService - The config service
8260
8695
  * @returns {WithdrawInfo} WithdrawInfo containing aToken address, amount and vault address
8261
8696
  */
8262
- 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>;
8263
8698
  /**
8264
8699
  * Get borrow information for a given token
8265
8700
  * @param token - The address of the underlying token
@@ -8278,16 +8713,16 @@ declare class SonicSpokeService {
8278
8713
  * @param spender - The address of the spender
8279
8714
  * @returns {Promise<Result<boolean>>} A promise that resolves to the result of the approval check
8280
8715
  */
8281
- 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>>;
8282
8717
  /**
8283
8718
  * Approve the withdrawal of tokens from the spoke chain using the Sonic wallet abstraction.
8284
8719
  * @param from - The address of the user on the spoke chain
8285
8720
  * @param withdrawInfo - The information about the withdrawal
8286
8721
  * @param spokeProvider - The spoke provider
8287
8722
  * @param raw - Whether to return the raw transaction data
8288
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash
8723
+ * @returns {PromiseEvmTxReturnType<SonicSpokeProviderType, R>} A promise that resolves to the transaction hash
8289
8724
  */
8290
- 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>>;
8291
8726
  /**
8292
8727
  * Check if the user has approved the borrowing of tokens from the spoke chain using the Sonic wallet abstraction.
8293
8728
  * @param from - The address of the user on the spoke chain
@@ -8296,9 +8731,9 @@ declare class SonicSpokeService {
8296
8731
  * @param spender - The address of the spender
8297
8732
  * @returns {Promise<Result<boolean>>} A promise that resolves to the result of the approval check
8298
8733
  */
8299
- static isBorrowApproved(from: Address$1, borrowInfo: BorrowInfo, spokeProvider: SonicSpokeProvider, spender?: HubAddress): Promise<Result<boolean>>;
8300
- static approveBorrow<R extends boolean = false>(from: Address$1, borrowInfo: BorrowInfo, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
8301
- 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>;
8302
8737
  }
8303
8738
 
8304
8739
  type StellarSpokeDepositParams = {
@@ -8323,7 +8758,7 @@ declare class StellarSpokeService {
8323
8758
  * @param spokeProvider - The Stellar spoke provider.
8324
8759
  * @returns True if the user has sufficent trustline established for the token, false otherwise.
8325
8760
  */
8326
- static hasSufficientTrustline(token: string, amount: bigint, spokeProvider: StellarSpokeProvider): Promise<boolean>;
8761
+ static hasSufficientTrustline(token: string, amount: bigint, spokeProvider: StellarSpokeProviderType): Promise<boolean>;
8327
8762
  /**
8328
8763
  * Request a trustline for a given token and amount.
8329
8764
  * @param token - The token address to request the trustline for.
@@ -8332,30 +8767,30 @@ declare class StellarSpokeService {
8332
8767
  * @param raw - Whether to return the raw transaction data.
8333
8768
  * @returns The transaction result.
8334
8769
  */
8335
- 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>>;
8336
8771
  /**
8337
8772
  * Estimate the gas for a transaction.
8338
8773
  * @param rawTx - The raw transaction to estimate the gas for.
8339
8774
  * @param spokeProvider - The spoke provider.
8340
8775
  * @returns The estimated gas (minResourceFee) for the transaction.
8341
8776
  */
8342
- static estimateGas(rawTx: StellarRawTransaction, spokeProvider: StellarSpokeProvider): Promise<StellarGasEstimate>;
8343
- 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>>;
8344
8779
  /**
8345
8780
  * Get the balance of the token in the spoke chain asset manager.
8346
8781
  * @param token - The address of the token to get the balance of.
8347
8782
  * @param spokeProvider - The spoke provider.
8348
8783
  * @returns The balance of the token.
8349
8784
  */
8350
- static getDeposit(token: string, spokeProvider: StellarSpokeProvider): Promise<bigint>;
8785
+ static getDeposit(token: string, spokeProvider: StellarSpokeProviderType): Promise<bigint>;
8351
8786
  /**
8352
8787
  * Generate simulation parameters for deposit from StellarSpokeDepositParams.
8353
8788
  * @param {StellarSpokeDepositParams} params - The deposit parameters.
8354
- * @param {StellarSpokeProvider} spokeProvider - The provider for the spoke chain.
8789
+ * @param {StellarSpokeProviderType} spokeProvider - The provider for the spoke chain.
8355
8790
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
8356
8791
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
8357
8792
  */
8358
- static getSimulateDepositParams(params: StellarSpokeDepositParams, spokeProvider: StellarSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
8793
+ static getSimulateDepositParams(params: StellarSpokeDepositParams, spokeProvider: StellarSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
8359
8794
  /**
8360
8795
  * Calls a contract on the spoke chain using the user's wallet.
8361
8796
  * @param from - The address of the user on the hub chain.
@@ -8365,7 +8800,7 @@ declare class StellarSpokeService {
8365
8800
  * @param raw - Whether to return the raw transaction data.
8366
8801
  * @returns The transaction result.
8367
8802
  */
8368
- 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>>;
8369
8804
  private static transfer;
8370
8805
  private static call;
8371
8806
  static waitForTransaction(spokeProvider: StellarSpokeProvider, txHash: string, pollingTimeout?: number, maxAttempts?: number): Promise<Result<boolean, Error>>;
@@ -8392,53 +8827,53 @@ declare class SuiSpokeService {
8392
8827
  * @param {SuiSpokeProvider} spokeProvider - The spoke provider.
8393
8828
  * @returns {Promise<bigint>} The estimated computation cost.
8394
8829
  */
8395
- static estimateGas(rawTx: SuiRawTransaction, spokeProvider: SuiSpokeProvider): Promise<SuiGasEstimate>;
8830
+ static estimateGas(rawTx: SuiRawTransaction, spokeProvider: SuiSpokeProviderType): Promise<SuiGasEstimate>;
8396
8831
  /**
8397
8832
  * Deposit tokens to the spoke chain.
8398
8833
  * @param {InjectiveSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
8399
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
8834
+ * @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
8400
8835
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
8401
8836
  * @param {boolean} raw - The return type raw or just transaction hash
8402
- * @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.
8403
8838
  */
8404
- 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>>;
8405
8840
  /**
8406
8841
  * Get the balance of the token in the spoke chain.
8407
8842
  * @param {Address} token - The address of the token to get the balance of.
8408
8843
  * @param {SuiSpokeProvider} spokeProvider - The spoke provider.
8409
8844
  * @returns {Promise<bigint>} The balance of the token.
8410
8845
  */
8411
- static getDeposit(token: string, spokeProvider: SuiSpokeProvider): Promise<bigint>;
8846
+ static getDeposit(token: string, spokeProvider: SuiSpokeProviderType): Promise<bigint>;
8412
8847
  /**
8413
8848
  * Generate simulation parameters for deposit from SuiSpokeDepositParams.
8414
8849
  * @param {SuiSpokeDepositParams} params - The deposit parameters.
8415
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
8850
+ * @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
8416
8851
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
8417
8852
  * @returns {Promise<DepositSimulationParams>} The simulation parameters.
8418
8853
  */
8419
- static getSimulateDepositParams(params: SuiSpokeDepositParams, spokeProvider: SuiSpokeProvider, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
8854
+ static getSimulateDepositParams(params: SuiSpokeDepositParams, spokeProvider: SuiSpokeProviderType, hubProvider: EvmHubProvider): Promise<DepositSimulationParams>;
8420
8855
  /**
8421
8856
  * Calls a contract on the spoke chain using the user's wallet.
8422
8857
  * @param {HubAddress} from - The address of the user on the spoke chain.
8423
8858
  * @param {Hex} payload - The payload to send to the contract.
8424
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
8859
+ * @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
8425
8860
  * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
8426
8861
  * @param {boolean} raw - The return type raw or just transaction hash
8427
- * @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.
8428
8863
  */
8429
- 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>>;
8430
8865
  /**
8431
8866
  * Fetch the asset manager config from the spoke chain.
8432
- * @param {SuiSpokeProvider} suiSpokeProvider - The spoke provider.
8867
+ * @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
8433
8868
  * @returns {Promise<string>} The asset manager config.
8434
8869
  */
8435
- static fetchAssetManagerAddress(suiSpokeProvider: SuiSpokeProvider): Promise<string>;
8870
+ static fetchAssetManagerAddress(suiSpokeProvider: SuiBaseSpokeProvider): Promise<string>;
8436
8871
  /**
8437
8872
  * Fetch the latest asset manager package id from the spoke chain.
8438
- * @param {SuiSpokeProvider} suiSpokeProvider - The spoke provider.
8873
+ * @param {SuiBaseSpokeProvider} suiSpokeProvider - The spoke provider.
8439
8874
  * @returns {Promise<string>} The latest asset manager package id.
8440
8875
  */
8441
- static fetchLatestAssetManagerPackageId(suiSpokeProvider: SuiSpokeProvider): Promise<string>;
8876
+ static fetchLatestAssetManagerPackageId(provider: SuiBaseSpokeProvider): Promise<string>;
8442
8877
  /**
8443
8878
  * Transfers tokens to the hub chain.
8444
8879
  * @param {SuiTransferToHubParams} params - The parameters for the transfer, including:
@@ -8446,9 +8881,9 @@ declare class SuiSpokeService {
8446
8881
  * - {Uint8Array} recipient: The recipient address on the hub chain.
8447
8882
  * - {string} amount: The amount to transfer.
8448
8883
  * - {Uint8Array} [data=new Uint8Array([])]: Additional data for the transfer.
8449
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
8884
+ * @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
8450
8885
  * @param {boolean} raw - The return type raw or just transaction hash
8451
- * @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.
8452
8887
  */
8453
8888
  private static transfer;
8454
8889
  /**
@@ -8456,217 +8891,91 @@ declare class SuiSpokeService {
8456
8891
  * @param {bigint} dstChainId - The chain ID of the hub chain.
8457
8892
  * @param {HubAddress} dstAddress - The address on the hub chain.
8458
8893
  * @param {Hex} payload - The payload to send.
8459
- * @param {SuiSpokeProvider} spokeProvider - The provider for the spoke chain.
8894
+ * @param {SuiSpokeProviderType} spokeProvider - The provider for the spoke chain.
8460
8895
  * @param {boolean} raw - The return type raw or just transaction hash
8461
- * @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.
8462
8897
  */
8463
8898
  private static call;
8464
8899
  }
8465
8900
 
8466
- /**
8467
- * The action type for the intent relay service.
8468
- * submit - submit a transaction to the intent relay service
8469
- * get_transaction_packets - get transaction packets from the intent relay service
8470
- * get_packet - get a packet from the intent relay service
8471
- */
8472
- type RelayAction = 'submit' | 'get_transaction_packets' | 'get_packet';
8473
- /**
8474
- * The status of the relay transaction.
8475
- * pending - no signatures
8476
- * validating - not enough signatures
8477
- * executing - enough signatures,no confirmed txn-hash
8478
- * executed - has confirmed transaction-hash
8479
- */
8480
- type RelayTxStatus = 'pending' | 'validating' | 'executing' | 'executed';
8481
- type RelayErrorCode = 'SUBMIT_TX_FAILED' | 'RELAY_TIMEOUT';
8482
- type RelayError = {
8483
- code: RelayErrorCode;
8484
- error: unknown;
8485
- };
8486
- type SubmitTxParams = {
8487
- chain_id: string;
8488
- tx_hash: string;
8489
- data?: {
8490
- address: Hex;
8491
- payload: Hex;
8492
- };
8901
+ declare class Erc20Service {
8902
+ private constructor();
8903
+ static getErc20Token(token: Address$1, publicClient: PublicClient): Promise<Erc20Token>;
8904
+ /**
8905
+ * Check if spender has enough ERC20 allowance for given amount
8906
+ * @param token - ERC20 token address
8907
+ * @param amount - Amount to check allowance for
8908
+ * @param owner - User wallet address
8909
+ * @param spender - Spender address
8910
+ * @param spokeProvider - EVM Spoke provider
8911
+ * @return - True if spender is allowed to spend amount on behalf of owner
8912
+ */
8913
+ static isAllowanceValid(token: Address$1, amount: bigint, owner: Address$1, spender: Address$1, spokeProvider: EvmSpokeProviderType | SonicSpokeProviderType): Promise<Result<boolean>>;
8914
+ /**
8915
+ * Approve ERC20 amount spending
8916
+ * @param token - ERC20 token address
8917
+ * @param amount - Amount to approve
8918
+ * @param spender - Spender address
8919
+ * @param provider - EVM Provider
8920
+ */
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>>;
8922
+ /**
8923
+ * Encodes a transfer transaction for a token.
8924
+ * @param token - The address of the token.
8925
+ * @param to - The address to transfer the token to.
8926
+ * @param amount - The amount of the token to transfer.
8927
+ * @returns The encoded contract call.
8928
+ */
8929
+ static encodeTransfer(token: Address$1, to: Address$1, amount: bigint): EvmContractCall;
8930
+ /**
8931
+ * Encodes a transferFrom transaction for a token.
8932
+ * @param token - The address of the token.
8933
+ * @param from - The address to transfer the token from.
8934
+ * @param to - The address to transfer the token to.
8935
+ * @param amount - The amount of the token to transfer.
8936
+ * @returns The encoded contract call.
8937
+ */
8938
+ static encodeTransferFrom(token: Address$1, from: Address$1, to: Address$1, amount: bigint): EvmContractCall;
8939
+ /**
8940
+ * Encodes an approval transaction for a token.
8941
+ * @param token - The address of the token.
8942
+ * @param to - The address to approve the token to.
8943
+ * @param amount - The amount of the token to approve.
8944
+ * @returns The encoded contract call.
8945
+ */
8946
+ static encodeApprove(token: Address$1, to: Address$1, amount: bigint): EvmContractCall;
8947
+ }
8948
+
8949
+ type LegacybnUSDChainId = (typeof bnUSDLegacySpokeChainIds)[number];
8950
+ type LegacybnUSDTokenAddress = (typeof bnUSDLegacyTokens)[number]['address'];
8951
+ type LegacybnUSDToken = (typeof bnUSDLegacyTokens)[number];
8952
+ type NewbnUSDChainId = (typeof newbnUSDSpokeChainIds)[number];
8953
+ type MoneyMarketServiceConfig = Prettify<MoneyMarketConfig & PartnerFeeConfig & RelayerApiConfig>;
8954
+ type SwapServiceConfig = Prettify<SolverConfig & PartnerFeeConfig & RelayerApiConfig>;
8955
+ type MigrationServiceConfig = Prettify<RelayerApiConfig>;
8956
+ type BridgeServiceConfig = Optional<PartnerFeeConfig, 'partnerFee'>;
8957
+ type BackendApiConfig = {
8958
+ baseURL?: HttpUrl;
8959
+ timeout?: number;
8960
+ headers?: Record<string, string>;
8493
8961
  };
8494
- type GetTransactionPacketsParams = {
8495
- chain_id: string;
8496
- tx_hash: string;
8962
+ type MoneyMarketConfigParams = Prettify<MoneyMarketConfig & Optional<PartnerFeeConfig, 'partnerFee'>> | Optional<PartnerFeeConfig, 'partnerFee'>;
8963
+ type Default = {
8964
+ default: boolean;
8497
8965
  };
8498
- type GetPacketParams = {
8499
- chain_id: string;
8500
- tx_hash: string;
8501
- conn_sn: string;
8966
+ type RelayerApiConfig = {
8967
+ relayerApiEndpoint: HttpUrl;
8502
8968
  };
8503
- type SubmitTxResponse = {
8504
- success: boolean;
8505
- message: string;
8969
+ type EvmContractCall = {
8970
+ address: Address;
8971
+ value: bigint;
8972
+ data: Hex$1;
8506
8973
  };
8507
- type PacketData = {
8508
- src_chain_id: number;
8509
- src_tx_hash: string;
8510
- src_address: string;
8511
- status: RelayTxStatus;
8512
- dst_chain_id: number;
8513
- conn_sn: number;
8514
- dst_address: string;
8515
- dst_tx_hash: string;
8516
- signatures: string[];
8517
- payload: string;
8518
- };
8519
- type IntentDeliveryInfo = {
8520
- srcChainId: SpokeChainId;
8521
- srcTxHash: string;
8522
- srcAddress: string;
8523
- dstChainId: SpokeChainId;
8524
- dstTxHash: string;
8525
- dstAddress: string;
8526
- };
8527
- type GetTransactionPacketsResponse = {
8528
- success: boolean;
8529
- data: PacketData[];
8530
- };
8531
- type GetPacketResponse = {
8532
- success: true;
8533
- data: PacketData;
8534
- } | {
8535
- success: false;
8536
- message: string;
8537
- };
8538
- type GetRelayRequestParamType<T extends RelayAction> = T extends 'submit' ? SubmitTxParams : T extends 'get_transaction_packets' ? GetTransactionPacketsParams : T extends 'get_packet' ? GetPacketParams : never;
8539
- type GetRelayResponse<T extends RelayAction> = T extends 'submit' ? SubmitTxResponse : T extends 'get_transaction_packets' ? GetTransactionPacketsResponse : T extends 'get_packet' ? GetPacketResponse : never;
8540
- type IntentRelayRequestParams = SubmitTxParams | GetTransactionPacketsParams | GetPacketParams;
8541
- type WaitUntilIntentExecutedPayload = {
8542
- intentRelayChainId: string;
8543
- spokeTxHash: string;
8544
- timeout: number;
8545
- apiUrl: HttpUrl;
8546
- };
8547
- /**
8548
- * Represents the request payload for submitting a transaction to the intent relay service.
8549
- * Contains the action type and parameters including chain ID and transaction hash.
8550
- */
8551
- type IntentRelayRequest<T extends RelayAction> = {
8552
- action: T;
8553
- params: GetRelayRequestParamType<T>;
8554
- };
8555
- /**
8556
- * Submits a transaction to the intent relay service.
8557
- * @param payload - The request payload containing the 'submit' action type and parameters.
8558
- * @param apiUrl - The URL of the intent relay service.
8559
- * @returns The response from the intent relay service.
8560
- */
8561
- declare function submitTransaction(payload: IntentRelayRequest<'submit'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'submit'>>;
8562
- /**
8563
- * Retrieves transaction packets from the intent relay service.
8564
- * @param payload - The request payload containing the 'get_transaction_packets' action type and parameters.
8565
- * @param apiUrl - The URL of the intent relay service.
8566
- * @returns The response from the intent relay service.
8567
- */
8568
- declare function getTransactionPackets(payload: IntentRelayRequest<'get_transaction_packets'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'get_transaction_packets'>>;
8569
- /**
8570
- * Retrieves a packet from the intent relay service.
8571
- * @param payload - The request payload containing the 'get_packet' action type and parameters.
8572
- * @param apiUrl - The URL of the intent relay service.
8573
- * @returns The response from the intent relay service.
8574
- */
8575
- declare function getPacket(payload: IntentRelayRequest<'get_packet'>, apiUrl: HttpUrl): Promise<GetRelayResponse<'get_packet'>>;
8576
- declare function waitUntilIntentExecuted(payload: WaitUntilIntentExecutedPayload): Promise<Result<PacketData, IntentError<'RELAY_TIMEOUT'>>>;
8577
- /**
8578
- * Submit the transaction to the Solver API and wait for it to be executed
8579
- * @param spokeTxHash - The transaction hash to submit.
8580
- * @param data - The additional data to submit when relaying the transaction on Solana. Due to Solana's 1232 byte transaction
8581
- * size limit, Solana transactions are split: the on-chain tx contains only a verification hash, while the full
8582
- * data is submitted off-chain via the relayer. Contains the to address on Hub chain and instruction data.
8583
- * @param spokeProvider - The spoke provider.
8584
- * @param timeout - The timeout in milliseconds for the transaction. Default is 20 seconds.
8585
- * @returns The transaction hash.
8586
- */
8587
- declare function relayTxAndWaitPacket<S extends SpokeProvider>(spokeTxHash: string, data: {
8588
- address: Hex;
8589
- payload: Hex;
8590
- } | undefined, spokeProvider: S, relayerApiEndpoint: HttpUrl, timeout?: number): Promise<Result<PacketData, RelayError>>;
8591
-
8592
- declare class Erc20Service {
8593
- private constructor();
8594
- static getErc20Token(token: Address$1, publicClient: PublicClient): Promise<Erc20Token>;
8595
- /**
8596
- * Check if spender has enough ERC20 allowance for given amount
8597
- * @param token - ERC20 token address
8598
- * @param amount - Amount to check allowance for
8599
- * @param owner - User wallet address
8600
- * @param spender - Spender address
8601
- * @param spokeProvider - EVM Spoke provider
8602
- * @return - True if spender is allowed to spend amount on behalf of owner
8603
- */
8604
- static isAllowanceValid(token: Address$1, amount: bigint, owner: Address$1, spender: Address$1, spokeProvider: EvmSpokeProvider | SonicSpokeProvider): Promise<Result<boolean>>;
8605
- /**
8606
- * Approve ERC20 amount spending
8607
- * @param token - ERC20 token address
8608
- * @param amount - Amount to approve
8609
- * @param spender - Spender address
8610
- * @param provider - EVM Provider
8611
- */
8612
- static approve<R extends boolean = false>(token: Address$1, amount: bigint, spender: Address$1, spokeProvider: EvmSpokeProvider | SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
8613
- /**
8614
- * Encodes a transfer transaction for a token.
8615
- * @param token - The address of the token.
8616
- * @param to - The address to transfer the token to.
8617
- * @param amount - The amount of the token to transfer.
8618
- * @returns The encoded contract call.
8619
- */
8620
- static encodeTransfer(token: Address$1, to: Address$1, amount: bigint): EvmContractCall;
8621
- /**
8622
- * Encodes a transferFrom transaction for a token.
8623
- * @param token - The address of the token.
8624
- * @param from - The address to transfer the token from.
8625
- * @param to - The address to transfer the token to.
8626
- * @param amount - The amount of the token to transfer.
8627
- * @returns The encoded contract call.
8628
- */
8629
- static encodeTransferFrom(token: Address$1, from: Address$1, to: Address$1, amount: bigint): EvmContractCall;
8630
- /**
8631
- * Encodes an approval transaction for a token.
8632
- * @param token - The address of the token.
8633
- * @param to - The address to approve the token to.
8634
- * @param amount - The amount of the token to approve.
8635
- * @returns The encoded contract call.
8636
- */
8637
- static encodeApprove(token: Address$1, to: Address$1, amount: bigint): EvmContractCall;
8638
- }
8639
-
8640
- type LegacybnUSDChainId = (typeof bnUSDLegacySpokeChainIds)[number];
8641
- type LegacybnUSDTokenAddress = (typeof bnUSDLegacyTokens)[number]['address'];
8642
- type LegacybnUSDToken = (typeof bnUSDLegacyTokens)[number];
8643
- type NewbnUSDChainId = (typeof newbnUSDSpokeChainIds)[number];
8644
- type MoneyMarketServiceConfig = Prettify<MoneyMarketConfig & PartnerFeeConfig & RelayerApiConfig>;
8645
- type SwapServiceConfig = Prettify<SolverConfig & PartnerFeeConfig & RelayerApiConfig>;
8646
- type MigrationServiceConfig = Prettify<RelayerApiConfig>;
8647
- type BridgeServiceConfig = Optional<PartnerFeeConfig, 'partnerFee'>;
8648
- type BackendApiConfig = {
8649
- baseURL?: HttpUrl;
8650
- timeout?: number;
8651
- headers?: Record<string, string>;
8652
- };
8653
- type MoneyMarketConfigParams = Prettify<MoneyMarketConfig & Optional<PartnerFeeConfig, 'partnerFee'>> | Optional<PartnerFeeConfig, 'partnerFee'>;
8654
- type Default = {
8655
- default: boolean;
8656
- };
8657
- type RelayerApiConfig = {
8658
- relayerApiEndpoint: HttpUrl;
8659
- };
8660
- type EvmContractCall = {
8661
- address: Address;
8662
- value: bigint;
8663
- data: Hex$1;
8664
- };
8665
- type EvmTransferToHubParams = {
8666
- token: Address;
8667
- recipient: Address;
8668
- amount: bigint;
8669
- data: Hex$1;
8974
+ type EvmTransferToHubParams = {
8975
+ token: Address;
8976
+ recipient: Address;
8977
+ amount: bigint;
8978
+ data: Hex$1;
8670
8979
  };
8671
8980
  type EvmTransferParams = {
8672
8981
  fromToken: Address;
@@ -8749,8 +9058,8 @@ type Result<T, E = Error | unknown> = {
8749
9058
  error: E;
8750
9059
  };
8751
9060
  type SpokeDepositParams = EvmSpokeDepositParams | InjectiveSpokeDepositParams | IconSpokeDepositParams;
8752
- 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;
8753
- 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;
8754
9063
  type SolverConfigParams = Prettify<SolverConfig & Optional<PartnerFeeConfig, 'partnerFee'>> | Optional<PartnerFeeConfig, 'partnerFee'>;
8755
9064
  type QuoteType = 'exact_input' | 'exact_output';
8756
9065
  type SolverIntentQuoteRequest = {
@@ -8843,21 +9152,33 @@ type SuiRawTransaction = {
8843
9152
  data: Base64String;
8844
9153
  };
8845
9154
  type EvmReturnType<Raw extends boolean> = Raw extends true ? EvmRawTransaction : Hex$1;
8846
- type SolanaReturnType<Raw extends boolean> = Raw extends true ? SolanaRawTransaction : Hex$1;
9155
+ type SolanaReturnType<Raw extends boolean> = Raw extends true ? SolanaRawTransaction : string;
8847
9156
  type StellarReturnType<Raw extends boolean> = Raw extends true ? StellarRawTransaction : string;
8848
9157
  type IconReturnType<Raw extends boolean> = Raw extends true ? IconRawTransaction : Hex$1;
8849
- type SuiReturnType<Raw extends boolean> = Raw extends true ? SuiRawTransaction : Hex$1;
8850
- 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;
8851
9160
  type HashTxReturnType = EvmReturnType<false> | SolanaReturnType<false> | IconReturnType<false> | SuiReturnType<false> | InjectiveReturnType<false> | StellarReturnType<false>;
8852
9161
  type RawTxReturnType = EvmRawTransaction | SolanaRawTransaction | InjectiveRawTransaction | IconRawTransaction | SuiRawTransaction | StellarRawTransaction;
8853
- 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;
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;
8854
9168
  type PromiseEvmTxReturnType<Raw extends boolean> = Promise<TxReturnType<EvmSpokeProvider, Raw>>;
8855
9169
  type PromiseSolanaTxReturnType<Raw extends boolean> = Promise<TxReturnType<SolanaSpokeProvider, Raw>>;
8856
9170
  type PromiseStellarTxReturnType<Raw extends boolean> = Promise<TxReturnType<StellarSpokeProvider, Raw>>;
8857
9171
  type PromiseIconTxReturnType<Raw extends boolean> = Promise<TxReturnType<IconSpokeProvider, Raw>>;
8858
9172
  type PromiseSuiTxReturnType<Raw extends boolean> = Promise<TxReturnType<SuiSpokeProvider, Raw>>;
8859
9173
  type PromiseInjectiveTxReturnType<Raw extends boolean> = Promise<TxReturnType<InjectiveSpokeProvider, Raw>>;
8860
- 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;
8861
9182
  type Prettify<T> = {
8862
9183
  [K in keyof T]: T[K];
8863
9184
  } & {};
@@ -8881,7 +9202,7 @@ type InjectiveGasEstimate = {
8881
9202
  gasUsed: number;
8882
9203
  };
8883
9204
  type GasEstimateType = EvmGasEstimate | SolanaGasEstimate | StellarGasEstimate | IconGasEstimate | SuiGasEstimate | InjectiveGasEstimate;
8884
- 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;
8885
9206
  type OptionalRaw<R extends boolean = false> = {
8886
9207
  raw?: R;
8887
9208
  };
@@ -8895,6 +9216,7 @@ type RelayExtraData = {
8895
9216
  type RelayOptionalExtraData = {
8896
9217
  data?: RelayExtraData;
8897
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>;
8898
9220
 
8899
9221
  /**
8900
9222
  * BackendApiService - Proxy service for Sodax Backend API
@@ -9286,1616 +9608,1465 @@ declare function encodeAddress(spokeChainId: SpokeChainId, address: string): Hex
9286
9608
  */
9287
9609
  declare function hexToBigInt(hex: string): bigint;
9288
9610
  /**
9289
- * Derive user hub abstracted wallet address. Original address is used if spoke equals hub chain.
9290
- * @param spokeProvider - Spoke provider instance for origin chain
9291
- * @param hubProvider - Hub spoke provider
9292
- * @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
9293
9615
  * @returns Abstracted user wallet address for spoke chains with different chain id than hub or original
9294
9616
  */
9295
- declare function deriveUserWalletAddress(spokeProvider: SpokeProvider, hubProvider: EvmHubProvider, walletAddress?: string): Promise<Address>;
9617
+ declare function deriveUserWalletAddress(hubProvider: EvmHubProvider, spokeChainId: SpokeChainId, spokeAddress: string): Promise<Address>;
9296
9618
  declare function parseToStroops(amount: string): bigint;
9297
9619
  declare function sleep(ms: number): Promise<void>;
9298
9620
 
9299
- declare const DEFAULT_MAX_RETRY = 3;
9300
- declare const DEFAULT_RELAY_TX_TIMEOUT = 120000;
9301
- declare const DEFAULT_RETRY_DELAY_MS = 2000;
9302
- declare const ICON_TX_RESULT_WAIT_MAX_RETRY = 10;
9303
- declare const MAX_UINT256: bigint;
9304
- declare const FEE_PERCENTAGE_SCALE = 10000n;
9305
- declare const STELLAR_PRIORITY_FEE = "10000";
9306
- declare const STELLAR_DEFAULT_TX_TIMEOUT_SECONDS = 100;
9307
- declare const DEFAULT_DEADLINE_OFFSET = 300n;
9308
- declare const DEFAULT_BACKEND_API_ENDPOINT = "https://api.sodax.com/v1/be";
9309
- declare const DEFAULT_BACKEND_API_TIMEOUT = 30000;
9310
- declare const DEFAULT_BACKEND_API_HEADERS: {
9311
- 'Content-Type': string;
9312
- Accept: string;
9621
+ type IcxMigrateParams = {
9622
+ address: IcxTokenType;
9623
+ amount: bigint;
9624
+ to: Address$1;
9313
9625
  };
9314
- declare const DEFAULT_RELAYER_API_ENDPOINT = "https://xcall-relay.nw.iconblockchain.xyz";
9315
- declare const VAULT_TOKEN_DECIMALS = 18;
9316
- declare const hyper: {
9317
- blockExplorers: {
9318
- readonly default: {
9319
- readonly name: "HyperEVMScan";
9320
- readonly url: "https://hyperevmscan.io/";
9321
- };
9322
- };
9323
- contracts: {
9324
- readonly multicall3: {
9325
- readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
9326
- readonly blockCreated: 13051;
9327
- };
9328
- };
9329
- ensTlds?: readonly string[] | undefined;
9330
- id: 999;
9331
- name: "HyperEVM";
9332
- nativeCurrency: {
9333
- readonly decimals: 18;
9334
- readonly name: "HYPE";
9335
- readonly symbol: "HYPE";
9336
- };
9337
- rpcUrls: {
9338
- readonly default: {
9339
- readonly http: readonly ["https://rpc.hyperliquid.xyz/evm"];
9340
- };
9341
- };
9342
- sourceId?: number | undefined;
9343
- testnet?: boolean | undefined;
9344
- custom?: Record<string, unknown> | undefined;
9345
- fees?: viem.ChainFees<undefined> | undefined;
9346
- formatters?: undefined;
9347
- serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
9626
+ type IcxCreateRevertMigrationParams = {
9627
+ amount: bigint;
9628
+ to: IconEoaAddress;
9348
9629
  };
9349
- declare function getEvmViemChain(id: EvmChainId): Chain;
9350
- declare const bnUSDLegacySpokeChainIds: readonly ["0x1.icon", "sui", "stellar"];
9351
- declare const newbnUSDSpokeChainIds: ("0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "sonic" | "0xa.optimism" | "0x89.polygon" | "hyper" | "lightlink" | "ethereum" | "sui" | "stellar" | "injective-1" | "solana")[];
9352
- declare const bnUSDLegacyTokens: readonly [{
9353
- readonly symbol: "bnUSD (legacy)";
9354
- readonly name: "bnUSD";
9355
- readonly decimals: 18;
9356
- readonly address: "cx88fd7df7ddff82f7cc735c871dc519838cb235bb";
9357
- readonly xChainId: "0x1.icon";
9358
- }, {
9359
- readonly symbol: "bnUSD (legacy)";
9360
- readonly name: "legacybnUSD";
9361
- readonly decimals: 9;
9362
- readonly address: "0x03917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR";
9363
- readonly xChainId: "sui";
9364
- }, {
9365
- readonly symbol: "bnUSD (legacy)";
9366
- readonly name: "legacybnUSD";
9367
- readonly decimals: 18;
9368
- readonly address: "CCT4ZYIYZ3TUO2AWQFEOFGBZ6HQP3GW5TA37CK7CRZVFRDXYTHTYX7KP";
9369
- readonly xChainId: "stellar";
9370
- }];
9371
- declare const bnUSDNewTokens: ({
9372
- readonly symbol: "bnUSD";
9373
- readonly name: "bnUSD";
9374
- readonly decimals: 9;
9375
- readonly address: "0xff4de2b2b57dd7611d2812d231a467d007b702a101fd5c7ad3b278257cddb507::bnusd::BNUSD";
9376
- readonly xChainId: "sui";
9377
- } | {
9378
- readonly symbol: "bnUSD";
9379
- readonly name: "bnUSD";
9380
- readonly decimals: 7;
9381
- readonly address: "CD6YBFFWMU2UJHX2NGRJ7RN76IJVTCC7MRA46DUBXNB7E6W7H7JRJ2CX";
9382
- readonly xChainId: "stellar";
9383
- } | {
9384
- readonly symbol: "bnUSD";
9385
- readonly name: "bnUSD";
9386
- readonly decimals: 18;
9387
- readonly address: "0x6958a4CBFe11406E2a1c1d3a71A1971aD8B3b92F";
9388
- readonly xChainId: "0xa86a.avax";
9389
- } | {
9390
- readonly symbol: "bnUSD";
9391
- readonly name: "bnUSD";
9392
- readonly decimals: 18;
9393
- readonly address: "0xA256dd181C3f6E5eC68C6869f5D50a712d47212e";
9394
- readonly xChainId: "0xa4b1.arbitrum";
9395
- } | {
9396
- readonly symbol: "bnUSD";
9397
- readonly name: "bnUSD";
9398
- readonly decimals: 18;
9399
- readonly address: "0xAcfab3F31C0a18559D78556BBf297EC29c6cf8aa";
9400
- readonly xChainId: "0x2105.base";
9401
- } | {
9402
- readonly symbol: "bnUSD";
9403
- readonly name: "bnUSD";
9404
- readonly decimals: 18;
9405
- readonly address: "0x8428FedC020737a5A2291F46cB1B80613eD71638";
9406
- readonly xChainId: "0x38.bsc";
9407
- } | {
9408
- readonly symbol: "bnUSD";
9409
- readonly name: "Balanced Dollar";
9410
- readonly decimals: 18;
9411
- readonly address: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131";
9412
- readonly xChainId: "sonic";
9413
- } | {
9414
- readonly symbol: "bnUSD";
9415
- readonly name: "bnUSD";
9416
- readonly decimals: 18;
9417
- readonly address: "0xF4f7dC27c17470a26d0de9039Cf0EA5045F100E8";
9418
- readonly xChainId: "0xa.optimism";
9419
- } | {
9420
- readonly symbol: "bnUSD";
9421
- readonly name: "bnUSD";
9422
- readonly decimals: 18;
9423
- readonly address: "0x39E77f86C1B1f3fbAb362A82b49D2E86C09659B4";
9424
- readonly xChainId: "0x89.polygon";
9425
- } | {
9426
- readonly symbol: "bnUSD";
9427
- readonly name: "bnUSD";
9428
- readonly decimals: 18;
9429
- readonly address: "0x506Ba7C8d91dAdf7a91eE677a205D9687b751579";
9430
- readonly xChainId: "hyper";
9431
- } | {
9432
- readonly symbol: "bnUSD";
9433
- readonly name: "bnUSD";
9434
- readonly decimals: 18;
9435
- readonly address: "0x36134A03dcD03Bbe858B8F7ED28a71AAC608F9E7";
9436
- readonly xChainId: "lightlink";
9437
- } | {
9438
- readonly symbol: "bnUSD";
9439
- readonly name: "bnUSD";
9440
- readonly decimals: 18;
9441
- readonly address: "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13";
9442
- readonly xChainId: "ethereum";
9443
- } | {
9444
- readonly symbol: "bnUSD";
9445
- readonly name: "bnUSD";
9446
- readonly decimals: 18;
9447
- readonly address: "factory/inj1d036ftaatxpkqsu9hja8r24rv3v33chz3appxp/bnUSD";
9448
- readonly xChainId: "injective-1";
9449
- } | {
9450
- readonly symbol: "bnUSD";
9451
- readonly name: "bnUSD";
9452
- readonly decimals: 9;
9453
- readonly address: "3rSPCLNEF7Quw4wX8S1NyKivELoyij8eYA2gJwBgt4V5";
9454
- readonly xChainId: "solana";
9455
- })[];
9456
- declare const isLegacybnUSDChainId: (chainId: SpokeChainId) => boolean;
9457
- declare const isNewbnUSDChainId: (chainId: SpokeChainId) => boolean;
9458
- declare const isLegacybnUSDToken: (token: Token | string) => boolean;
9459
- declare const isNewbnUSDToken: (token: Token | string) => boolean;
9460
- declare const getAllLegacybnUSDTokens: () => {
9461
- token: LegacybnUSDToken;
9462
- chainId: LegacybnUSDChainId;
9463
- }[];
9464
-
9465
- declare function isEvmHubChainConfig(value: HubChainConfig): value is EvmHubChainConfig;
9466
- declare function isEvmSpokeChainConfig(value: SpokeChainConfig): value is EvmSpokeChainConfig;
9467
- declare function isEvmUninitializedConfig(value: EvmUninitializedConfig | EvmInitializedConfig): value is EvmUninitializedConfig;
9468
- declare function isEvmInitializedConfig(value: EvmUninitializedConfig | EvmInitializedConfig): value is EvmInitializedConfig;
9469
- declare function isEvmUninitializedBrowserConfig(value: EvmUninitializedConfig): value is EvmUninitializedBrowserConfig;
9470
- declare function isEvmUninitializedPrivateKeyConfig(value: EvmUninitializedConfig): value is EvmUninitializedPrivateKeyConfig;
9471
- declare function isIconAddress(value: unknown): value is IconAddress;
9472
- declare function isResponseAddressType(value: unknown): value is ResponseAddressType;
9473
- declare function isResponseSigningType(value: unknown): value is ResponseSigningType;
9474
- declare function isJsonRpcPayloadResponse(value: unknown): value is JsonRpcPayloadResponse;
9475
- declare function isIntentRelayChainId(value: bigint): value is IntentRelayChainId;
9476
- declare function isPartnerFeeAmount(value: unknown): value is PartnerFeeAmount;
9477
- declare function isPartnerFeePercentage(value: unknown): value is PartnerFeePercentage;
9478
- declare function isEvmSpokeProvider(value: SpokeProvider): value is EvmSpokeProvider;
9479
- declare function isSonicSpokeProvider(value: SpokeProvider): value is SonicSpokeProvider;
9480
- declare function isSolanaSpokeProvider(value: SpokeProvider): value is SolanaSpokeProvider;
9481
- declare function isStellarSpokeProvider(value: SpokeProvider): value is StellarSpokeProvider;
9482
- declare function isInjectiveSpokeProvider(value: SpokeProvider): value is InjectiveSpokeProvider;
9483
- declare function isIconSpokeProvider(value: SpokeProvider): value is IconSpokeProvider;
9484
- declare function isSuiSpokeProvider(value: SpokeProvider): value is SuiSpokeProvider;
9485
- declare function isConfiguredSolverConfig(value: SolverConfigParams): value is Prettify<SolverConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
9486
- declare function isConfiguredMoneyMarketConfig(value: MoneyMarketConfigParams): value is Prettify<MoneyMarketConfig & Optional<PartnerFeeConfig, 'partnerFee'>>;
9487
- declare function isIntentCreationFailedError(error: unknown): error is IntentError<'CREATION_FAILED'>;
9488
- declare function isIntentSubmitTxFailedError(error: unknown): error is IntentError<'SUBMIT_TX_FAILED'>;
9489
- declare function isIntentPostExecutionFailedError(error: unknown): error is IntentError<'POST_EXECUTION_FAILED'>;
9490
- declare function isWaitUntilIntentExecutedFailed(error: unknown): error is IntentError<'RELAY_TIMEOUT'>;
9491
- declare function isIntentCreationUnknownError(error: unknown): error is IntentError<'UNKNOWN'>;
9492
- declare function isMoneyMarketSubmitTxFailedError(error: unknown): error is MoneyMarketError<'SUBMIT_TX_FAILED'>;
9493
- declare function isMoneyMarketRelayTimeoutError(error: unknown): error is MoneyMarketError<'RELAY_TIMEOUT'>;
9494
- declare function isMoneyMarketCreateSupplyIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED'>;
9495
- declare function isMoneyMarketCreateBorrowIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_BORROW_INTENT_FAILED'>;
9496
- declare function isMoneyMarketCreateWithdrawIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED'>;
9497
- declare function isMoneyMarketCreateRepayIntentFailedError(error: unknown): error is MoneyMarketError<'CREATE_REPAY_INTENT_FAILED'>;
9498
- declare function isMoneyMarketSupplyUnknownError(error: unknown): error is MoneyMarketUnknownError<'SUPPLY_UNKNOWN_ERROR'>;
9499
- declare function isMoneyMarketBorrowUnknownError(error: unknown): error is MoneyMarketUnknownError<'BORROW_UNKNOWN_ERROR'>;
9500
- declare function isMoneyMarketWithdrawUnknownError(error: unknown): error is MoneyMarketUnknownError<'WITHDRAW_UNKNOWN_ERROR'>;
9501
- declare function isMoneyMarketRepayUnknownError(error: unknown): error is MoneyMarketUnknownError<'REPAY_UNKNOWN_ERROR'>;
9502
- declare function isIcxMigrateParams(value: unknown): value is IcxMigrateParams;
9503
- declare function isUnifiedBnUSDMigrateParams(value: unknown): value is UnifiedBnUSDMigrateParams;
9504
- declare function isBalnMigrateParams(value: unknown): value is BalnMigrateParams;
9505
- declare function isIcxCreateRevertMigrationParams(value: unknown): value is IcxCreateRevertMigrationParams;
9506
-
9507
- type CreateBridgeIntentParams = {
9508
- srcChainId: SpokeChainId;
9509
- srcAsset: string;
9630
+ type IcxRevertMigrationParams = {
9631
+ wICX: IconAddress;
9510
9632
  amount: bigint;
9511
- dstChainId: SpokeChainId;
9512
- dstAsset: string;
9513
- recipient: string;
9514
- };
9515
- type BridgeParams<S extends SpokeProvider> = Prettify<{
9516
- params: CreateBridgeIntentParams;
9517
- spokeProvider: S;
9518
- skipSimulation?: boolean;
9519
- } & OptionalFee>;
9520
- type BridgeErrorCode = 'ALLOWANCE_CHECK_FAILED' | 'APPROVAL_FAILED' | 'CREATE_BRIDGE_INTENT_FAILED' | 'BRIDGE_FAILED' | RelayErrorCode;
9521
- type BridgeError<T extends BridgeErrorCode> = {
9522
- code: T;
9523
- error: unknown;
9524
- };
9525
- type BridgeExtraData = {
9526
- address: Hex$1;
9527
- payload: Hex$1;
9528
- };
9529
- type BridgeOptionalExtraData = {
9530
- data?: BridgeExtraData;
9633
+ userWallet: Address$1;
9634
+ to: Hex;
9531
9635
  };
9532
- type BridgeServiceConstructorParams = {
9636
+ type IcxMigrationServiceConstructorParams = {
9533
9637
  hubProvider: EvmHubProvider;
9534
- relayerApiEndpoint: HttpUrl;
9535
- config: BridgeServiceConfig | undefined;
9536
9638
  configService: ConfigService;
9537
9639
  };
9538
9640
  /**
9539
- * BridgeService is a service that allows you to bridge tokens between chains
9540
- * Birdge action can be between to spokes chains but can also be used to withdraw and deposit into soda tokens on the HUB.
9541
- * By using soda tokens as src or destinatin address.
9542
- * @param hubProvider - The hub provider
9543
- * @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.
9544
9643
  */
9545
- declare class BridgeService {
9546
- readonly hubProvider: EvmHubProvider;
9547
- readonly relayerApiEndpoint: HttpUrl;
9548
- readonly config: BridgeServiceConfig;
9549
- readonly configService: ConfigService;
9550
- constructor({ hubProvider, relayerApiEndpoint, config, configService }: BridgeServiceConstructorParams);
9644
+ declare class IcxMigrationService {
9645
+ private readonly hubProvider;
9646
+ private readonly configService;
9647
+ constructor({ hubProvider, configService }: IcxMigrationServiceConstructorParams);
9551
9648
  /**
9552
- * Get the fee for a given input amount
9553
- * @param {bigint} inputAmount - The amount of input tokens
9554
- * @returns {Promise<bigint>} The fee amount (denominated in input tokens)
9649
+ * Retrieves the available amount of SODA tokens in the ICX migration contract.
9650
+ * This represents the amount of tokens available for migration.
9555
9651
  *
9556
- * @example
9557
- * const fee: bigint = await sodax.bridge.getFee(1000000000000000n);
9558
- * console.log('Fee:', fee);
9652
+ * @returns The available balance of SODA tokens in the migration contract
9559
9653
  */
9560
- getFee(inputAmount: bigint): bigint;
9654
+ getAvailableAmount(): Promise<bigint>;
9561
9655
  /**
9562
- * Check if allowance is valid for the bridge transaction
9563
- * @param params - The bridge parameters
9564
- * @param spokeProvider - The spoke provider
9565
- * @returns {Promise<Result<boolean, BridgeError<'ALLOWANCE_CHECK_FAILED'>>>}
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
9660
+ *
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
9566
9664
  */
9567
- isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }: BridgeParams<S>): Promise<Result<boolean, BridgeError<'ALLOWANCE_CHECK_FAILED'>>>;
9665
+ migrateData(params: IcxMigrateParams): Hex;
9568
9666
  /**
9569
- * Approve token spending for the bridge transaction
9570
- * @param params - The bridge parameters
9571
- * @param spokeProvider - The spoke provider
9572
- * @param raw - Whether to return raw transaction data
9573
- * @returns Promise<Result<TxReturnType<S, R>, BridgeError<'APPROVAL_FAILED'>>>
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
9574
9671
  */
9575
- approve<S extends SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<BridgeParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>, BridgeError<'APPROVAL_FAILED'>>>;
9672
+ revertMigration(params: IcxRevertMigrationParams): Hex;
9576
9673
  /**
9577
- * Execute a bridge transaction to transfer tokens from one chain to another
9578
- * @param params - The bridge parameters including source/destination chains, assets, and recipient
9579
- * @param spokeProvider - The spoke provider for the source chain
9580
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
9581
- * @returns {Promise<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>>} - Returns the transaction hashes for both spoke and hub chains or error
9582
- *
9583
- * @example
9584
- * const result = await sodax.bridge.bridge(
9585
- * {
9586
- * srcChainId: '0x2105.base',
9587
- * srcAsset: '0x...', // Address of the source token
9588
- * amount: 1000n, // Amount to bridge (in token decimals)
9589
- * dstChainId: '0x89.polygon',
9590
- * dstAsset: '0x...', // Address of the destination token
9591
- * recipient: '0x...', // Recipient address on destination chain
9592
- * partnerFee: { address: '0x...', percentage: 0.1 } // Optional partner fee. Partner fees and denominated in vault token decimals (18)
9593
- * },
9594
- * spokeProvider,
9595
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
9596
- * );
9597
- *
9598
- * if (!result.ok) {
9599
- * // Handle error
9600
- * }
9674
+ * Encodes a migration transaction for the ICX swap contract.
9675
+ * This creates the contract call data for swapping wICX tokens to SODA tokens.
9601
9676
  *
9602
- * const [
9603
- * spokeTxHash, // transaction hash on the source chain
9604
- * hubTxHash, // transaction hash on the hub chain
9605
- * ] = result.value;
9606
- * console.log('Bridge transaction hashes:', { spokeTxHash, hubTxHash });
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
9607
9680
  */
9608
- bridge<S extends SpokeProvider>({ params, spokeProvider, fee, timeout, }: Prettify<BridgeParams<S> & OptionalTimeout>): Promise<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>>;
9681
+ encodeMigrate(amount: bigint, to: Address$1): EvmContractCall;
9609
9682
  /**
9610
- * Create bridge intent only (without relaying to hub)
9611
- * NOTE: This method only executes the transaction on the spoke chain and creates the bridge intent
9612
- * In order to successfully bridge tokens, you need to:
9613
- * 1. Check if the allowance is sufficient using isAllowanceValid
9614
- * 2. Approve the appropriate contract to spend the tokens using approve
9615
- * 3. Create the bridge intent using this method
9616
- * 4. Relay the transaction to the hub and await completion using the bridge method
9617
- *
9618
- * @param params - The bridge parameters including source/destination chains, assets, and recipient
9619
- * @param spokeProvider - The spoke provider for the source chain
9620
- * @param raw - Whether to return the raw transaction data
9621
- * @returns {Promise<Result<TxReturnType<S, R>, BridgeError<BridgeErrorCode>>>} - Returns the transaction result
9622
- *
9623
- * @example
9624
- * const bridgeService = new BridgeService(hubProvider, relayerApiEndpoint);
9625
- * const result = await sodax.bridge.createBridgeIntent(
9626
- * {
9627
- * srcChainId: 'ethereum',
9628
- * srcAsset: "0x123...", // source token address
9629
- * amount: 1000000000000000000n, // 1 token in wei
9630
- * dstChainId: 'polygon',
9631
- * dstAsset: "0x456...", // destination token address
9632
- * recipient: "0x789..." // recipient address
9633
- * },
9634
- * spokeProvider,
9635
- * raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
9636
- * );
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.
9637
9685
  *
9638
- * if (result.ok) {
9639
- * const txHash = result.value;
9640
- * console.log('Bridge intent transaction hash:', txHash);
9641
- * } else {
9642
- * console.error('Bridge intent creation failed:', result.error);
9643
- * }
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
9644
9689
  */
9645
- 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>;
9646
- /**
9647
- * Build the bridge transaction data for executing the bridge operation on the hub
9648
- * @param params - The create bridge intent parameters
9649
- * @param srcAssetInfo - The source asset information
9650
- * @param dstAssetInfo - The destination asset information
9651
- * @returns Hex - The encoded contract calls for the bridge operation
9652
- */
9653
- buildBridgeData(params: CreateBridgeIntentParams, srcAssetInfo: HubAssetInfo, dstAssetInfo: HubAssetInfo, partnerFee: PartnerFee | undefined): Hex$1;
9690
+ encodeRevertMigration(amount: bigint, to: Address$1): EvmContractCall;
9691
+ }
9692
+
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);
9654
9729
  /**
9655
- * Retrieves the deposited token balance held by the asset manager on a spoke chain.
9656
- * This balance represents the available liquidity for bridging operations and is used to verify
9657
- * that the target chain has sufficient funds to complete a bridge transaction.
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
9658
9735
  *
9659
- * @param spokeProvider - The spoke provider instance
9660
- * @param token - The token address to query the balance for
9661
- * @returns {Promise<bigint>} - The token balance as a bigint value
9662
- */
9663
- getBridgeableAmount(from: XToken, to: XToken): Promise<Result<bigint, unknown>>;
9664
- /**
9665
- * Check if two assets on different chains are bridgeable
9666
- * Two assets are bridgeable if they share the same vault on the hub chain
9667
- * @param from - The source X token
9668
- * @param to - The destination X token
9669
- * @param unchecked - Whether to skip the chain ID validation
9670
- * @returns boolean - true if assets are bridgeable, false otherwise
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
9671
9739
  */
9672
- isBridgeable({ from, to, unchecked, }: {
9673
- from: XToken;
9674
- to: XToken;
9675
- unchecked?: boolean;
9676
- }): boolean;
9740
+ migrateData(params: FormattedBnUSDMigrateParams): Hex;
9677
9741
  /**
9678
- * Get all bridgeable tokens from a source token to a destination chain
9679
- * @param from - The source chain ID
9680
- * @param to - The destination chain ID
9681
- * @param token - The source token address
9682
- * @returns XToken[] - Array of bridgeable tokens on the destination chain
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
9683
9751
  */
9684
- getBridgeableTokens(from: SpokeChainId, to: SpokeChainId, token: string): Result<XToken[]>;
9685
- filterTokensWithSameVault(tokens: Record<string, XToken>, to: SpokeChainId, srcAssetInfo: HubAssetInfo | undefined): XToken[];
9752
+ revertMigrationData(params: BnUSDRevertMigrationParams): Hex;
9686
9753
  }
9687
9754
 
9688
- declare class StakingLogic {
9689
- private constructor();
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);
9690
9835
  /**
9691
- * Retrieves all unstake requests for a specific user.
9692
- * @param stakedSoda - The address of the StakedSoda contract.
9693
- * @param user - The address of the user.
9694
- * @param publicClient - PublicClient<HttpTransport>
9695
- * @returns Array of user unstake info for the user.
9836
+ * Gets the multiplier for a given lockup period.
9837
+ * @param lockupPeriod - The lockup period
9838
+ * @returns The multiplier in basis points
9696
9839
  */
9697
- static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient<HttpTransport>): Promise<readonly UserUnstakeInfo[]>;
9840
+ getMultiplierForPeriod(lockupPeriod: LockupPeriod): bigint;
9698
9841
  /**
9699
- * Encodes the depositFor transaction data.
9700
- * @param stakedSoda - The address of the StakedSoda contract.
9701
- * @param account - The address of the account to deposit for.
9702
- * @param amount - The amount of tokens to deposit.
9703
- * @returns The encoded contract call data.
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
9704
9846
  */
9705
- static encodeDepositFor(stakedSoda: Address$1, account: Address$1, amount: bigint): EvmContractCall;
9847
+ calculateSodaAmount(balnAmount: bigint, lockupPeriod: LockupPeriod): bigint;
9706
9848
  /**
9707
- * Encodes the withdrawTo transaction data.
9708
- * @param stakedSoda - The address of the StakedSoda contract.
9709
- * @param account - The address of the account to withdraw to.
9710
- * @param value - The amount of tokens to withdraw.
9711
- * @returns The encoded contract call data.
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
9712
9858
  */
9713
- static encodeWithdrawTo(stakedSoda: Address$1, account: Address$1, value: bigint): EvmContractCall;
9859
+ swapData(balnToken: IconContractAddress, params: BalnMigrateParams, configService: ConfigService): Hex;
9714
9860
  /**
9715
- * Encodes the unstake transaction data.
9716
- * @param stakedSoda - The address of the StakedSoda contract.
9717
- * @param account - The address of the account to unstake for.
9718
- * @param value - The amount of tokens to unstake.
9719
- * @returns The encoded contract call data.
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
9720
9866
  */
9721
- static encodeUnstake(stakedSoda: Address$1, account: Address$1, value: bigint): EvmContractCall;
9867
+ claim<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
9722
9868
  /**
9723
- * Encodes the cancelUnstakeSodaRequest transaction data.
9724
- * @param stakedSoda - The address of the StakedSoda contract.
9725
- * @param requestId - The ID of the unstake request to cancel.
9726
- * @returns The encoded contract call data.
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
9727
9874
  */
9728
- static encodeCancelUnstakeSodaRequest(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
9875
+ claimUnstaked<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
9729
9876
  /**
9730
- * Encodes the cancelUnstakeRequest transaction data (alias for encodeCancelUnstakeSodaRequest).
9731
- * @param stakedSoda - The address of the StakedSoda contract.
9732
- * @param requestId - The ID of the unstake request to cancel.
9733
- * @returns The encoded contract call data.
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
9734
9882
  */
9735
- static encodeCancelUnstakeRequest(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
9883
+ stake<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
9736
9884
  /**
9737
- * Encodes the claim transaction data.
9738
- * @param stakedSoda - The address of the StakedSoda contract.
9739
- * @param requestId - The ID of the unstake request to claim.
9740
- * @returns The encoded contract call data.
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
9741
9890
  */
9742
- static encodeClaim(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
9891
+ unstake<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
9743
9892
  /**
9744
- * Returns the total amount of SODA assets held by the xSoda vault.
9745
- * @param xSoda - The address of the xSoda token contract.
9746
- * @param publicClient - PublicClient<HttpTransport>
9747
- * @returns The total amount of SODA assets.
9748
- */
9749
- static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9750
- /**
9751
- * Calculates the number of xSoda shares equivalent to a given amount of SODA assets.
9752
- * @param xSoda - The address of the xSoda token contract.
9753
- * @param assets - The amount of SODA assets to convert.
9754
- * @param publicClient - PublicClient<HttpTransport>
9755
- * @returns The number of xSoda shares.
9756
- */
9757
- static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9758
- /**
9759
- * Calculates the amount of SODA assets corresponding to a specific number of xSoda shares.
9760
- * @param xSoda - The address of the xSoda token contract.
9761
- * @param shares - The number of xSoda shares to convert.
9762
- * @param publicClient - PublicClient<HttpTransport>
9763
- * @returns The amount of SODA assets.
9764
- */
9765
- static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9766
- /**
9767
- * Simulates the effects of depositing SODA into xSoda without executing it.
9768
- * @param xSoda - The address of the xSoda token contract.
9769
- * @param assets - The amount of SODA assets to deposit.
9770
- * @param publicClient - PublicClient<HttpTransport>
9771
- * @returns The number of xSoda shares that would be minted.
9772
- */
9773
- static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9774
- /**
9775
- * Simulates the effects of minting xSoda shares without executing it.
9776
- * @param xSoda - The address of the xSoda token contract.
9777
- * @param shares - The number of xSoda shares to mint.
9778
- * @param publicClient - PublicClient<HttpTransport>
9779
- * @returns The amount of SODA assets that would be deposited.
9780
- */
9781
- static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9782
- /**
9783
- * Simulates the effects of withdrawing SODA from xSoda without executing it.
9784
- * @param xSoda - The address of the xSoda token contract.
9785
- * @param assets - The amount of SODA assets to withdraw.
9786
- * @param publicClient - PublicClient<HttpTransport>
9787
- * @returns The number of xSoda shares that would be burned.
9788
- */
9789
- static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9790
- /**
9791
- * Simulates the effects of redeeming xSoda shares without executing it.
9792
- * @param xSoda - The address of the xSoda token contract.
9793
- * @param shares - The number of xSoda shares to redeem.
9794
- * @param publicClient - PublicClient<HttpTransport>
9795
- * @returns The amount of SODA assets that would be withdrawn.
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
9796
9898
  */
9797
- static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9899
+ cancelUnstake<S extends SonicSpokeProviderType, R extends boolean = false>(params: BalnLockParams, spokeProvider: S, raw?: R): Promise<TxReturnType<S, R>>;
9798
9900
  /**
9799
- * Encodes the xSoda deposit transaction data (deposit SODA to get xSoda shares).
9800
- * @param xSoda - The address of the xSoda token contract.
9801
- * @param assets - The amount of SODA assets to deposit.
9802
- * @param receiver - The address of the receiver.
9803
- * @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
9804
9906
  */
9805
- static encodeXSodaDeposit(xSoda: Address$1, assets: bigint, receiver: Address$1): EvmContractCall;
9907
+ getDetailedUserLocks(publicClient: PublicClient<HttpTransport>, user: Address$1): Promise<readonly DetailedLock[]>;
9806
9908
  /**
9807
- * Encodes the xSoda mint transaction data (mint xSoda shares by depositing SODA).
9808
- * @param xSoda - The address of the xSoda token contract.
9809
- * @param shares - The number of xSoda shares to mint.
9810
- * @param receiver - The address of the receiver.
9811
- * @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
9812
9916
  */
9813
- static encodeXSodaMint(xSoda: Address$1, shares: bigint, receiver: Address$1): EvmContractCall;
9917
+ encodeSwap(amount: bigint, lockupPeriod: LockupPeriod, to: Address$1, stake: boolean): EvmContractCall;
9814
9918
  /**
9815
- * Encodes the xSoda withdraw transaction data (withdraw SODA by burning xSoda shares).
9816
- * @param xSoda - The address of the xSoda token contract.
9817
- * @param assets - The amount of SODA assets to withdraw.
9818
- * @param receiver - The address of the receiver.
9819
- * @param owner - The address of the owner.
9820
- * @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
9821
9923
  */
9822
- static encodeXSodaWithdraw(xSoda: Address$1, assets: bigint, receiver: Address$1, owner: Address$1): EvmContractCall;
9924
+ encodeClaim(lockId: bigint): EvmContractCall;
9823
9925
  /**
9824
- * Encodes the xSoda redeem transaction data (redeem xSoda shares to get SODA).
9825
- * @param xSoda - The address of the xSoda token contract.
9826
- * @param shares - The number of xSoda shares to redeem.
9827
- * @param receiver - The address of the receiver.
9828
- * @param owner - The address of the owner.
9829
- * @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
9830
9930
  */
9831
- static encodeXSodaRedeem(xSoda: Address$1, shares: bigint, receiver: Address$1, owner: Address$1): EvmContractCall;
9931
+ encodeClaimUnstaked(lockId: bigint): EvmContractCall;
9832
9932
  /**
9833
- * Encodes the StakingRouter stake transaction data.
9834
- * @param stakingRouter - The address of the StakingRouter contract.
9835
- * @param amount - The amount of SODA to stake.
9836
- * @param to - The address to receive the staked tokens.
9837
- * @param minReceive - The minimum amount to receive.
9838
- * @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
9839
9937
  */
9840
- static encodeStakingRouterStake(stakingRouter: Address$1, amount: bigint, to: Address$1, minReceive: bigint): EvmContractCall;
9938
+ encodeStake(lockId: bigint): EvmContractCall;
9841
9939
  /**
9842
- * Encodes the StakingRouter unstake transaction data.
9843
- * @param stakingRouter - The address of the StakingRouter contract.
9844
- * @param amount - The amount of xSoda to unstake.
9845
- * @param minAmount - The minimum amount of SODA to receive.
9846
- * @param asset - The asset address to receive.
9847
- * @param chainID - The destination chain ID.
9848
- * @param to - The destination address as bytes.
9849
- * @returns The encoded contract call data.
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
9850
9944
  */
9851
- static encodeStakingRouterUnstake(stakingRouter: Address$1, amount: bigint, minAmount: bigint, asset: Address$1, chainID: bigint, to: Hex): EvmContractCall;
9945
+ encodeUnstake(lockId: bigint): EvmContractCall;
9852
9946
  /**
9853
- * Estimates the xSoda amount and preview deposit for a given SODA amount.
9854
- * @param stakingRouter - The address of the StakingRouter contract.
9855
- * @param amount - The amount of SODA to estimate.
9856
- * @param publicClient - PublicClient<HttpTransport>
9857
- * @returns Tuple containing [xSodaAmount, previewDepositAmount].
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
9858
9951
  */
9859
- static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<readonly [bigint, bigint]>;
9952
+ encodeCancelUnstake(lockId: bigint): EvmContractCall;
9860
9953
  /**
9861
- * Estimates the instant unstake amount for a given xSoda amount.
9862
- * @param stakingRouter - The address of the StakingRouter contract.
9863
- * @param amount - The amount of xSoda to estimate unstake for.
9864
- * @param publicClient - PublicClient<HttpTransport>
9865
- * @returns The estimated SODA amount from instant unstake.
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
9866
9959
  */
9867
- static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
9960
+ call<S extends SonicSpokeProviderType, R extends boolean = false>(spokeProvider: S, rawTx: EvmContractCall, raw?: R): Promise<TxReturnType<S, R>>;
9868
9961
  }
9869
9962
 
9870
- type StakeParams = {
9871
- amount: bigint;
9872
- minReceive: bigint;
9873
- account: Address$1;
9874
- action: 'stake';
9875
- };
9876
- type UnstakeParams = {
9877
- amount: bigint;
9878
- account: Address$1;
9879
- action: 'unstake';
9880
- };
9881
- type ClaimParams = {
9882
- requestId: bigint;
9883
- amount: bigint;
9884
- action: 'claim';
9885
- };
9886
- type CancelUnstakeParams = {
9887
- requestId: bigint;
9888
- action: 'cancelUnstake';
9889
- };
9890
- 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;
9891
10023
  amount: bigint;
9892
- minAmount: bigint;
9893
- account: Address$1;
9894
- action: 'instantUnstake';
10024
+ dstChainId: SpokeChainId;
10025
+ dstAsset: string;
10026
+ recipient: string;
9895
10027
  };
9896
- type StakingAction = 'stake' | 'unstake' | 'claim' | 'cancelUnstake' | 'instantUnstake';
9897
- type StakingParams = StakeParams | UnstakeParams | ClaimParams | CancelUnstakeParams | InstantUnstakeParams;
9898
- type StakingInfo = {
9899
- totalStaked: bigint;
9900
- totalUnderlying: bigint;
9901
- userXSodaBalance: bigint;
9902
- userXSodaValue: bigint;
9903
- userUnderlying: bigint;
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> = {
10035
+ code: T;
10036
+ error: unknown;
9904
10037
  };
9905
- type UnstakingInfo = {
9906
- userUnstakeSodaRequests: readonly UserUnstakeInfo[];
9907
- totalUnstaking: bigint;
10038
+ type BridgeExtraData = {
10039
+ address: Hex$1;
10040
+ payload: Hex$1;
9908
10041
  };
9909
- type UnstakeRequestWithPenalty = UserUnstakeInfo & {
9910
- penalty: bigint;
9911
- penaltyPercentage: number;
9912
- claimableAmount: bigint;
10042
+ type BridgeOptionalExtraData = {
10043
+ data?: BridgeExtraData;
9913
10044
  };
9914
- type StakingConfig = {
9915
- unstakingPeriod: bigint;
9916
- minUnstakingPeriod: bigint;
9917
- maxPenalty: bigint;
9918
- };
9919
- type StakingErrorCode = 'STAKE_FAILED' | 'UNSTAKE_FAILED' | 'INSTANT_UNSTAKE_FAILED' | 'CLAIM_FAILED' | 'CANCEL_UNSTAKE_FAILED' | 'INFO_FETCH_FAILED' | 'ALLOWANCE_CHECK_FAILED' | 'APPROVAL_FAILED';
9920
- type StakingError<T extends StakingErrorCode> = {
9921
- code: T;
9922
- error: unknown;
9923
- };
9924
- type StakingServiceConstructorParams = {
9925
- hubProvider: EvmHubProvider;
9926
- relayerApiEndpoint: HttpUrl;
9927
- configService: ConfigService;
10045
+ type BridgeServiceConstructorParams = {
10046
+ hubProvider: EvmHubProvider;
10047
+ relayerApiEndpoint: HttpUrl;
10048
+ config: BridgeServiceConfig | undefined;
10049
+ configService: ConfigService;
9928
10050
  };
9929
10051
  /**
9930
- * StakingService provides a high-level interface for staking operations
9931
- * including staking SODA tokens, unstaking, claiming rewards, and retrieving staking information.
9932
- * 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
9933
10057
  */
9934
- declare class StakingService {
9935
- private readonly hubProvider;
9936
- private readonly relayerApiEndpoint;
9937
- private readonly configService;
9938
- 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);
9939
10064
  /**
9940
- * Check if allowance is valid for the staking operations
9941
- * @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
9942
10077
  * @param spokeProvider - The spoke provider
9943
- * @returns {Promise<Result<boolean, StakingError<'ALLOWANCE_CHECK_FAILED'>>>}
10078
+ * @returns {Promise<Result<boolean, BridgeError<'ALLOWANCE_CHECK_FAILED'>>>}
9944
10079
  */
9945
- isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }: Prettify<{
9946
- params: StakingParams;
9947
- spokeProvider: S;
9948
- }>): Promise<Result<boolean, StakingError<'ALLOWANCE_CHECK_FAILED'>>>;
10080
+ isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }: BridgeParams<S>): Promise<Result<boolean, BridgeError<'ALLOWANCE_CHECK_FAILED'>>>;
9949
10081
  /**
9950
- * Approve token spending for the staking operations
9951
- * @param params - The staking parameters
10082
+ * Approve token spending for the bridge transaction
10083
+ * @param params - The bridge parameters
9952
10084
  * @param spokeProvider - The spoke provider
9953
10085
  * @param raw - Whether to return raw transaction data
9954
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'APPROVAL_FAILED'>>>
10086
+ * @returns Promise<Result<TxReturnType<S, R>, BridgeError<'APPROVAL_FAILED'>>>
9955
10087
  */
9956
- approve<S extends SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
9957
- params: StakingParams;
9958
- spokeProvider: S;
9959
- raw?: R;
9960
- }>): 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'>>>;
9961
10089
  /**
9962
- * Execute stake transaction for staking SODA tokens to receive xSoda shares
9963
- * NOTE: For EVM chains, you may need to approve token spending first using the approve method
9964
- * @param params - The staking parameters
9965
- * @param spokeProvider - The spoke provider
9966
- * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
9967
- * @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 });
9968
10120
  */
9969
- 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>>>;
9970
10122
  /**
9971
- * Create stake intent only (without relaying to hub)
9972
- * NOTE: This method only executes the transaction on the spoke chain and creates the stake intent
9973
- * 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:
9974
10126
  * 1. Check if the allowance is sufficient using isAllowanceValid
9975
10127
  * 2. Approve the appropriate contract to spend the tokens using approve
9976
- * 3. Create the stake intent using this method
9977
- * 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
9978
10130
  *
9979
- * @param params - The stake parameters including amount and account
10131
+ * @param params - The bridge parameters including source/destination chains, assets, and recipient
9980
10132
  * @param spokeProvider - The spoke provider for the source chain
9981
- * @param raw - Whether to return the raw transaction data (default: false)
9982
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'STAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
9983
- */
9984
- createStakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
9985
- params: StakeParams;
9986
- spokeProvider: S;
9987
- raw?: R;
9988
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'STAKE_FAILED'>> & {
9989
- data?: {
9990
- address: string;
9991
- payload: Hex;
9992
- };
9993
- }>;
9994
- /**
9995
- * Build stake data using StakingRouter (simplified flow)
9996
- * @param sodaAsset - The SODA asset information
9997
- * @param to - The destination address
9998
- * @param params - The staking parameters
9999
- * @returns The encoded contract call data
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
+ * }
10000
10157
  */
10001
- 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>;
10002
10159
  /**
10003
- * Execute unstake transaction for unstaking xSoda shares
10004
- * @param params - The unstaking parameters
10005
- * @param spokeProvider - The spoke provider
10006
- * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10007
- * @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
10008
10165
  */
10009
- 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;
10010
10167
  /**
10011
- * Create unstake intent only (without relaying to hub)
10012
- * NOTE: This method only executes the transaction on the spoke chain and creates the unstake intent
10013
- * In order to successfully unstake tokens, you need to:
10014
- * 1. Check if the allowance is sufficient using isAllowanceValid
10015
- * 2. Approve the appropriate contract to spend the tokens using approve
10016
- * 3. Create the unstake intent using this method
10017
- * 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.
10018
10171
  *
10019
- * @param params - The unstake parameters including amount and account
10020
- * @param spokeProvider - The spoke provider for the source chain
10021
- * @param raw - Whether to return the raw transaction data (default: false)
10022
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
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
10023
10175
  */
10024
- createUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10025
- params: UnstakeParams;
10026
- spokeProvider: S;
10027
- raw?: R;
10028
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'UNSTAKE_FAILED'>> & {
10029
- data?: {
10030
- address: string;
10031
- payload: Hex;
10032
- };
10033
- }>;
10176
+ getBridgeableAmount(from: XToken, to: XToken): Promise<Result<bigint, unknown>>;
10034
10177
  /**
10035
- * Build unstake data for unstaking xSoda shares
10036
- * @param hubWallet - The hub wallet address
10037
- * @param params - The unstake parameters
10038
- * @returns The encoded contract call data
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
10039
10184
  */
10040
- buildUnstakeData(hubWallet: Address$1, params: UnstakeParams): Hex;
10185
+ isBridgeable({ from, to, unchecked, }: {
10186
+ from: XToken;
10187
+ to: XToken;
10188
+ unchecked?: boolean;
10189
+ }): boolean;
10041
10190
  /**
10042
- * Execute instant unstake transaction for instantly unstaking xSoda shares
10043
- * @param params - The instant unstaking parameters
10044
- * @param spokeProvider - The spoke provider
10045
- * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10046
- * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'INSTANT_UNSTAKE_FAILED'> | RelayError>>
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
10047
10196
  */
10048
- instantUnstake(params: InstantUnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'INSTANT_UNSTAKE_FAILED'> | RelayError>>;
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();
10049
10203
  /**
10050
- * Create instant unstake intent only (without relaying to hub)
10051
- * NOTE: This method only executes the transaction on the spoke chain and creates the instant unstake intent
10052
- * In order to successfully instant unstake tokens, you need to:
10053
- * 1. Create the instant unstake intent using this method
10054
- * 2. Relay the transaction to the hub and await completion using the instantUnstake method
10055
- *
10056
- * @param params - The instant unstake parameters including amount, minAmount and account
10057
- * @param spokeProvider - The spoke provider for the source chain
10058
- * @param raw - Whether to return the raw transaction data (default: false)
10059
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'INSTANT_UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
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.
10060
10209
  */
10061
- createInstantUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10062
- params: InstantUnstakeParams;
10063
- spokeProvider: S;
10064
- raw?: R;
10065
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'INSTANT_UNSTAKE_FAILED'>> & {
10066
- data?: {
10067
- address: string;
10068
- payload: Hex;
10069
- };
10070
- }>;
10210
+ static getUnstakeSodaRequests(stakedSoda: Address$1, user: Address$1, publicClient: PublicClient<HttpTransport>): Promise<readonly UserUnstakeInfo[]>;
10071
10211
  /**
10072
- * Build instant unstake data for instantly unstaking xSoda shares
10073
- * @param sodaAsset - The SODA asset information
10074
- * @param dstChainId - The destination chain ID
10075
- * @param dstWallet - The destination wallet address
10076
- * @param params - The instant unstake parameters
10077
- * @returns The encoded contract call data
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.
10078
10217
  */
10079
- buildInstantUnstakeData(sodaAsset: HubAssetInfo, dstChainId: SpokeChainId, dstWallet: Hex, params: InstantUnstakeParams): Hex;
10218
+ static encodeDepositFor(stakedSoda: Address$1, account: Address$1, amount: bigint): EvmContractCall;
10080
10219
  /**
10081
- * Execute claim transaction for claiming unstaked tokens after the unstaking period
10082
- * @param params - The claim parameters
10083
- * @param spokeProvider - The spoke provider
10084
- * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10085
- * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'CLAIM_FAILED'> | RelayError>>
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.
10086
10225
  */
10087
- claim(params: ClaimParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'CLAIM_FAILED'> | RelayError>>;
10226
+ static encodeWithdrawTo(stakedSoda: Address$1, account: Address$1, value: bigint): EvmContractCall;
10088
10227
  /**
10089
- * Create claim intent only (without relaying to hub)
10090
- * NOTE: This method only executes the transaction on the spoke chain and creates the claim intent
10091
- * In order to successfully claim tokens, you need to:
10092
- * 1. Create the claim intent using this method
10093
- * 2. Relay the transaction to the hub and await completion using the claim method
10094
- *
10095
- * @param params - The claim parameters including requestId
10096
- * @param spokeProvider - The spoke provider for the source chain
10097
- * @param raw - Whether to return the raw transaction data (default: false)
10098
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'CLAIM_FAILED'>> & { data?: { address: string; payload: Hex } }>
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.
10099
10233
  */
10100
- createClaimIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10101
- params: ClaimParams;
10102
- spokeProvider: S;
10103
- raw?: R;
10104
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'CLAIM_FAILED'>> & {
10105
- data?: {
10106
- address: string;
10107
- payload: Hex;
10108
- };
10109
- }>;
10234
+ static encodeUnstake(stakedSoda: Address$1, account: Address$1, value: bigint): EvmContractCall;
10110
10235
  /**
10111
- * Build claim data for claiming unstaked tokens
10112
- * @param sodaAsset - The SODA asset information
10113
- * @param dstChainId - The destination chain ID
10114
- * @param dstWallet - The destination wallet address
10115
- * @param params - The claim parameters
10116
- * @returns The encoded contract call data
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.
10117
10240
  */
10118
- buildClaimData(sodaAsset: HubAssetInfo, dstChainId: SpokeChainId, dstWallet: Hex, params: ClaimParams): Hex;
10241
+ static encodeCancelUnstakeSodaRequest(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
10119
10242
  /**
10120
- * Execute cancel unstake transaction for cancelling an unstake request
10121
- * @param params - The cancel unstake parameters
10122
- * @param spokeProvider - The spoke provider
10123
- * @param timeout - The timeout in milliseconds for the transaction (default: DEFAULT_RELAY_TX_TIMEOUT)
10124
- * @returns Promise<Result<[SpokeTxHash, HubTxHash], StakingError<'CANCEL_UNSTAKE_FAILED'> | RelayError>>
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.
10125
10247
  */
10126
- cancelUnstake(params: CancelUnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'CANCEL_UNSTAKE_FAILED'> | RelayError>>;
10248
+ static encodeCancelUnstakeRequest(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
10127
10249
  /**
10128
- * Create cancel unstake intent only (without relaying to hub)
10129
- * NOTE: This method only executes the transaction on the spoke chain and creates the cancel unstake intent
10130
- * In order to successfully cancel an unstake request, you need to:
10131
- * 1. Create the cancel unstake intent using this method
10132
- * 2. Relay the transaction to the hub and await completion using the cancelUnstake method
10133
- *
10134
- * @param params - The cancel unstake parameters including requestId
10135
- * @param spokeProvider - The spoke provider for the source chain
10136
- * @param raw - Whether to return the raw transaction data (default: false)
10137
- * @returns Promise<Result<TxReturnType<S, R>, StakingError<'CANCEL_UNSTAKE_FAILED'>> & { data?: { address: string; payload: Hex } }>
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.
10138
10254
  */
10139
- createCancelUnstakeIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>({ params, spokeProvider, raw, }: Prettify<{
10140
- params: CancelUnstakeParams;
10141
- spokeProvider: S;
10142
- raw?: R;
10143
- }>): Promise<Result<TxReturnType<S, R>, StakingError<'CANCEL_UNSTAKE_FAILED'>> & {
10144
- data?: {
10145
- address: string;
10146
- payload: Hex;
10147
- };
10148
- }>;
10255
+ static encodeClaim(stakedSoda: Address$1, requestId: bigint): EvmContractCall;
10149
10256
  /**
10150
- * Build cancel unstake data for cancelling an unstake request
10151
- * @param params - The cancel unstake parameters
10152
- * @param hubWallet - The hub wallet address
10153
- * @returns Promise<Hex> - The encoded contract call data
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.
10154
10261
  */
10155
- buildCancelUnstakeData(params: CancelUnstakeParams, hubWallet: Address$1): Promise<Hex>;
10262
+ static getXSodaTotalAssets(xSoda: Address$1, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10156
10263
  /**
10157
- * Get comprehensive staking information for a user using spoke provider
10158
- * @param spokeProvider - The spoke provider
10159
- * @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.
10160
10269
  */
10161
- getStakingInfoFromSpoke(spokeProvider: SpokeProvider): Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
10270
+ static convertSodaToXSodaShares(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10162
10271
  /**
10163
- * Get comprehensive staking information for a user
10164
- * @param userAddress - The user's address
10165
- * @returns Promise<Result<StakingInfo, 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.
10166
10277
  */
10167
- getStakingInfo(userAddress: Address$1): Promise<Result<StakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
10278
+ static convertXSodaSharesToSoda(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10168
10279
  /**
10169
- * Get unstaking information for a user
10170
- * @param param - The user's address or spoke provider
10171
- * @returns Promise<Result<UnstakingInfo, 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.
10172
10285
  */
10173
- getUnstakingInfo(param: SpokeProvider | Address$1): Promise<Result<UnstakingInfo, StakingError<'INFO_FETCH_FAILED'>>>;
10286
+ static previewXSodaDeposit(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10174
10287
  /**
10175
- * Get staking configuration from the stakedSoda contract
10176
- * @returns Promise<Result<StakingConfig, StakingError<'INFO_FETCH_FAILED'>>>
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.
10177
10293
  */
10178
- getStakingConfig(): Promise<Result<StakingConfig, StakingError<'INFO_FETCH_FAILED'>>>;
10294
+ static previewXSodaMint(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10179
10295
  /**
10180
- * Calculate penalty for an unstake request based on the contract logic
10181
- * @param startTime - The start time of the unstake request
10182
- * @param config - The staking configuration
10183
- * @returns The penalty amount and percentage
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.
10184
10301
  */
10185
- private calculatePenalty;
10302
+ static previewXSodaWithdraw(xSoda: Address$1, assets: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10186
10303
  /**
10187
- * Get unstaking information with penalty calculations
10188
- * @param param - The user's address or spoke provider
10189
- * @returns Promise<Result<UnstakingInfo & { requestsWithPenalty: UnstakeRequestWithPenalty[] }, 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.
10190
10309
  */
10191
- getUnstakingInfoWithPenalty(param: SpokeProvider | Address$1): Promise<Result<UnstakingInfo & {
10192
- requestsWithPenalty: UnstakeRequestWithPenalty[];
10193
- }, StakingError<'INFO_FETCH_FAILED'>>>;
10310
+ static previewXSodaRedeem(xSoda: Address$1, shares: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10194
10311
  /**
10195
- * Get instant unstake ratio for a given amount
10196
- * @param amount - The amount of xSoda to estimate instant unstake for
10197
- * @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.
10198
10317
  */
10199
- getInstantUnstakeRatio(amount: bigint): Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>;
10318
+ static encodeXSodaDeposit(xSoda: Address$1, assets: bigint, receiver: Address$1): EvmContractCall;
10200
10319
  /**
10201
- * Get converted assets amount for xSODA shares
10202
- * @param amount - The amount of xSoda shares to convert
10203
- * @returns Promise<Result<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.
10204
10325
  */
10205
- getConvertedAssets(amount: bigint): Promise<Result<bigint, StakingError<'INFO_FETCH_FAILED'>>>;
10326
+ static encodeXSodaMint(xSoda: Address$1, shares: bigint, receiver: Address$1): EvmContractCall;
10206
10327
  /**
10207
- * Get stake ratio for a given amount (xSoda amount and preview deposit)
10208
- * @param amount - The amount of SODA to estimate stake for
10209
- * @returns Promise<Result<[bigint, bigint], StakingError<'INFO_FETCH_FAILED'>>>
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.
10210
10334
  */
10211
- getStakeRatio(amount: bigint): Promise<Result<[bigint, bigint], StakingError<'INFO_FETCH_FAILED'>>>;
10335
+ static encodeXSodaWithdraw(xSoda: Address$1, assets: bigint, receiver: Address$1, owner: Address$1): EvmContractCall;
10212
10336
  /**
10213
- * Helper method to get xSoda balance for a user
10214
- * @param xSoda - The xSoda token contract address
10215
- * @param userAddress - The user's address
10216
- * @returns Promise<bigint>
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.
10217
10343
  */
10218
- private getXSodaBalance;
10219
- }
10220
-
10221
- type IcxMigrateParams = {
10222
- address: IcxTokenType;
10223
- amount: bigint;
10224
- to: Address$1;
10225
- };
10226
- type IcxCreateRevertMigrationParams = {
10227
- amount: bigint;
10228
- to: IconEoaAddress;
10229
- };
10230
- type IcxRevertMigrationParams = {
10231
- wICX: IconAddress;
10232
- amount: bigint;
10233
- userWallet: Address$1;
10234
- to: Hex;
10235
- };
10236
- type IcxMigrationServiceConstructorParams = {
10237
- hubProvider: EvmHubProvider;
10238
- configService: ConfigService;
10239
- };
10240
- /**
10241
- * Service for handling ICX migration operations on the hub chain.
10242
- * Provides functionality to migrate wICX tokens from ICON to the hub chain.
10243
- */
10244
- declare class IcxMigrationService {
10245
- private readonly hubProvider;
10246
- private readonly configService;
10247
- constructor({ hubProvider, configService }: IcxMigrationServiceConstructorParams);
10344
+ static encodeXSodaRedeem(xSoda: Address$1, shares: bigint, receiver: Address$1, owner: Address$1): EvmContractCall;
10248
10345
  /**
10249
- * Retrieves the available amount of SODA tokens in the ICX migration contract.
10250
- * This represents the amount of tokens available for migration.
10251
- *
10252
- * @returns The available balance of SODA tokens in the migration contract
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.
10253
10352
  */
10254
- getAvailableAmount(): Promise<bigint>;
10353
+ static encodeStakingRouterStake(stakingRouter: Address$1, amount: bigint, to: Address$1, minReceive: bigint): EvmContractCall;
10255
10354
  /**
10256
- * Generates transaction data for migrating wICX tokens from ICON to the hub chain.
10257
- * This method creates the necessary contract calls to:
10258
- * 1. Approve the migration contract to spend the wICX tokens
10259
- * 2. Execute the migration swap
10260
- *
10261
- * @param params - The migration parameters including token address, amount, and recipient
10262
- * @returns Encoded transaction data for the migration operation
10263
- * @throws Will throw an error if the hub asset configuration is not found
10264
- */
10265
- migrateData(params: IcxMigrateParams): Hex;
10266
- /**
10267
- * Generates transaction data for migrating back tokens to the ICON chain.
10268
- * @param params - The migration parameters including token address, amount, and recipient
10269
- * @returns Encoded transaction data for the migration operation
10270
- * @throws Will throw an error if the hub asset configuration is not found
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.
10271
10363
  */
10272
- revertMigration(params: IcxRevertMigrationParams): Hex;
10364
+ static encodeStakingRouterUnstake(stakingRouter: Address$1, amount: bigint, minAmount: bigint, asset: Address$1, chainID: bigint, to: Hex): EvmContractCall;
10273
10365
  /**
10274
- * Encodes a migration transaction for the ICX swap contract.
10275
- * This creates the contract call data for swapping wICX tokens to SODA tokens.
10276
- *
10277
- * @param amount - The amount of wICX tokens to migrate
10278
- * @param to - The address that will receive the migrated SODA tokens
10279
- * @returns The encoded contract call for the migration operation
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].
10280
10371
  */
10281
- encodeMigrate(amount: bigint, to: Address$1): EvmContractCall;
10372
+ static estimateXSodaAmount(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<readonly [bigint, bigint]>;
10282
10373
  /**
10283
- * Encodes a revert migration transaction for the ICX swap contract.
10284
- * This creates the contract call data for swapping SODA tokens to wICX tokens.
10285
- *
10286
- * @param amount - The amount of wICX tokens to migrate
10287
- * @param to - The address that will receive the migrated SODA tokens
10288
- * @returns The encoded contract call for the migration operation
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.
10289
10379
  */
10290
- encodeRevertMigration(amount: bigint, to: Address$1): EvmContractCall;
10380
+ static estimateInstantUnstake(stakingRouter: Address$1, amount: bigint, publicClient: PublicClient<HttpTransport>): Promise<bigint>;
10291
10381
  }
10292
10382
 
10293
- 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;
10294
- type MigrationFailedErrorData<T extends MigrationErrorCode> = {
10295
- payload: GetMigrationFailedPayload<T>;
10296
- error: unknown;
10383
+ type StakeParams = {
10384
+ amount: bigint;
10385
+ minReceive: bigint;
10386
+ account: Address$1;
10387
+ action: 'stake';
10297
10388
  };
10298
- type MigrationErrorCode = 'MIGRATION_FAILED' | 'CREATE_MIGRATION_INTENT_FAILED' | 'CREATE_REVERT_MIGRATION_INTENT_FAILED' | 'REVERT_MIGRATION_FAILED';
10299
- type MigrationErrorData<T extends MigrationErrorCode> = T extends 'CREATE_MIGRATION_INTENT_FAILED' ? MigrationFailedErrorData<T> : T extends 'CREATE_REVERT_MIGRATION_INTENT_FAILED' ? MigrationFailedErrorData<T> : T extends 'REVERT_MIGRATION_FAILED' ? MigrationFailedErrorData<T> : T extends 'MIGRATION_FAILED' ? MigrationFailedErrorData<T> : never;
10300
- type MigrationError<T extends MigrationErrorCode> = {
10389
+ type UnstakeParams = {
10390
+ amount: bigint;
10391
+ account: Address$1;
10392
+ action: 'unstake';
10393
+ };
10394
+ type ClaimParams = {
10395
+ requestId: bigint;
10396
+ amount: bigint;
10397
+ action: 'claim';
10398
+ };
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> = {
10301
10434
  code: T;
10302
- data: MigrationErrorData<T>;
10435
+ error: unknown;
10303
10436
  };
10304
- type MigrationAction = 'migrate' | 'revert';
10305
- type MigrationParams = IcxMigrateParams | UnifiedBnUSDMigrateParams | BalnMigrateParams;
10306
- type MigrationRevertParams = IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams;
10307
- declare const SupportedMigrationTokens: readonly ["ICX", "bnUSD", "BALN"];
10308
- type MigrationTokens = (typeof SupportedMigrationTokens)[number];
10309
- type MigrationServiceConstructorParams = {
10437
+ type StakingServiceConstructorParams = {
10310
10438
  hubProvider: EvmHubProvider;
10311
- configService: ConfigService;
10312
10439
  relayerApiEndpoint: HttpUrl;
10440
+ configService: ConfigService;
10313
10441
  };
10314
- declare class MigrationService {
10315
- readonly icxMigration: IcxMigrationService;
10316
- readonly bnUSDMigrationService: BnUSDMigrationService;
10317
- readonly balnSwapService: BalnSwapService;
10318
- readonly hubProvider: EvmHubProvider;
10319
- readonly relayerApiEndpoint: HttpUrl;
10320
- readonly configService: ConfigService;
10321
- constructor({ relayerApiEndpoint, hubProvider, configService }: MigrationServiceConstructorParams);
10442
+ /**
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.
10446
+ */
10447
+ declare class StakingService {
10448
+ private readonly hubProvider;
10449
+ private readonly relayerApiEndpoint;
10450
+ private readonly configService;
10451
+ constructor({ hubProvider, relayerApiEndpoint, configService }: StakingServiceConstructorParams);
10322
10452
  /**
10323
- * Checks if the allowance is valid for the migration transaction.
10324
- * @param params - The parameters for the migration transaction.
10325
- * @param spokeProvider - The spoke provider.
10326
- * @returns {Promise<Result<boolean>>} - Returns the result of the allowance check or error
10327
- *
10328
- * @example
10329
- * const result = await migrationService.isAllowanceValid(
10330
- * {
10331
- * token: 'ICX', // Token to migrate
10332
- * icx: 'cx...', // Address of the ICX or wICX token to migrate
10333
- * amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
10334
- * to: '0x...', // Address to receive the migrated SODA tokens
10335
- * },
10336
- * 'migrate',
10337
- * spokeProvider, // IconSpokeProvider instance
10338
- * );
10339
- *
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'>>>}
10340
10457
  */
10341
- isAllowanceValid<S extends SpokeProvider>(params: MigrationParams | MigrationRevertParams, action: MigrationAction, spokeProvider: S): Promise<Result<boolean>>;
10458
+ isAllowanceValid<S extends SpokeProvider>({ params, spokeProvider, }: Prettify<{
10459
+ params: StakingParams;
10460
+ spokeProvider: S;
10461
+ }>): Promise<Result<boolean, StakingError<'ALLOWANCE_CHECK_FAILED'>>>;
10342
10462
  /**
10343
- * Approves the amount spending for the revert migration transaction.
10344
- * @param params - The parameters for the revert migration transaction.
10345
- * @param spokeProvider - The spoke provider.
10346
- * @param raw - Whether to return the raw transaction hash instead of the transaction receipt
10347
- * @returns {Promise<Result<TxReturnType<S, R>>>} - Returns the raw transaction payload or transaction hash
10348
- *
10349
- * @example
10350
- * const result = await migrationService.approve(
10351
- * {
10352
- * amount: 1000n, // Amount of SODA tokens to revert
10353
- * to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
10354
- * },
10355
- * 'revert',
10356
- * spokeProvider, // SonicSpokeProvider instance
10357
- * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
10358
- * );
10359
- *
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'>>>
10360
10468
  */
10361
- approve<S extends SpokeProvider, R extends boolean = false>(params: IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams, action: MigrationAction, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>>>;
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'>>>;
10362
10474
  /**
10363
- * Migrates bnUSD tokens between legacy and new formats across supported spoke chains via the hub chain (sonic).
10364
- * Handles both legacy-to-new and new-to-legacy bnUSD migrations, enforcing validation and relaying the transaction.
10365
- *
10366
- * @param params - Migration parameters, including source/destination chain IDs, token addresses, amount, and recipient.
10367
- * @param spokeProvider - The SpokeProvider instance for the source chain.
10368
- * @param timeout - Optional timeout in milliseconds for the relay operation (default: 60 seconds).
10369
- * @param unchecked - Optional flag to skip validation checks (default: false).
10370
- * @returns {Promise<Result<[string, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
10371
- * Result containing a tuple: [spokeTxHash, hubTxHash] if successful, or an error describing the failure.
10372
- *
10373
- * @example
10374
- * // Migrate legacy bnUSD to new bnUSD
10375
- * const result = await sodax.migration.migratebnUSD({
10376
- * srcChainId: '0x1.icon', // Source chain ID (legacy)
10377
- * dstChainId: 'sonic', // Destination chain ID (new)
10378
- * srcbnUSD: 'cx...', // Legacy bnUSD token address
10379
- * dstbnUSD: '0x...', // New bnUSD token address
10380
- * amount: 1000n, // Amount to migrate
10381
- * to: '0x...', // Recipient address on destination chain
10382
- * }, iconSpokeProvider);
10383
- *
10384
- * // Reverse migration: new bnUSD to legacy bnUSD
10385
- * const result = await sodax.migration.migratebnUSD({
10386
- * srcChainId: 'sonic', // Source chain ID (new)
10387
- * dstChainId: '0x1.icon', // Destination chain ID (legacy)
10388
- * srcbnUSD: '0x...', // New bnUSD token address
10389
- * dstbnUSD: 'cx...', // Legacy bnUSD token address
10390
- * amount: 1000n, // Amount to migrate
10391
- * to: 'hx...', // Recipient address on destination chain
10392
- * }, sonicSpokeProvider);
10393
- *
10394
- * if (result.ok) {
10395
- * // result.value is a tuple: [spokeTxHash, hubTxHash]
10396
- * const [spokeTxHash, hubTxHash] = result.value;
10397
- * console.log('[migrateBnUSD] hubTxHash', hubTxHash);
10398
- * console.log('[migrateBnUSD] spokeTxHash', spokeTxHash);
10399
- * } else {
10400
- * // Handle migration error
10401
- * console.error('[migrateBnUSD] error', result.error);
10402
- * }
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>>
10403
10481
  */
10404
- migratebnUSD(params: UnifiedBnUSDMigrateParams, spokeProvider: SpokeProvider, timeout?: number, unchecked?: boolean): Promise<Result<[
10405
- string,
10406
- Hex$1
10407
- ], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
10482
+ stake(params: StakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'STAKE_FAILED'> | RelayError>>;
10408
10483
  /**
10409
- * Migrates ICX tokens to SODA tokens on the hub chain (sonic).
10410
- * This function handles the migration of ICX 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
10411
10491
  *
10412
- * @param params - The parameters for the migration transaction.
10413
- * @param spokeProvider - The spoke provider.
10414
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10415
- * @returns {Promise<Result<[Hex, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
10416
- * Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
10417
- * or an error describing why the migration or relay failed.
10418
- *
10419
- * @example
10420
- * const result = await migrationService.migrateIcxToSoda(
10421
- * {
10422
- * address: 'cx...', // Address of the ICX or wICX token to migrate
10423
- * amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
10424
- * to: '0x...', // Address to receive the migrated SODA tokens (i.e. the hub chain address)
10425
- * },
10426
- * spokeProvider, // IconSpokeProvider instance
10427
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
10428
- * );
10429
- *
10430
- * if (!result.ok) {
10431
- * // Handle error
10432
- * }
10433
- *
10434
- * const [
10435
- * spokeTxHash, // transaction hash on the spoke chain
10436
- * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
10437
- * ] = result.value;
10438
- * console.log('Migration transaction hashes:', { spokeTxHash, hubTxHash });
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 } }>
10439
10496
  */
10440
- migrateIcxToSoda(params: IcxMigrateParams, spokeProvider: IconSpokeProvider, timeout?: number): Promise<Result<[
10441
- Hex$1,
10442
- Hex$1
10443
- ], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
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
+ }>;
10444
10507
  /**
10445
- * Creates a revert migration (SODA to ICX) intent and submits (relays) it to the spoke chain.
10446
- * @param params - The parameters for the revert migration transaction.
10447
- * @param spokeProvider - The SonicSpokeProvider instance.
10448
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10449
- *
10450
- * @returns {Promise<Result<[Hex, Hex], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>}
10451
- * Returns a Result containing a tuple of [hubTxHash, spokeTxHash] if successful,
10452
- * or an error describing why the revert migration or relay failed.
10453
- *
10454
- *
10455
- * @example
10456
- * const result = await migrationService.revertMigrateSodaToIcx(
10457
- * {
10458
- * amount: 1000n, // Amount of SODA tokens to revert
10459
- * to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
10460
- * },
10461
- * spokeProvider, // SonicSpokeProvider instance
10462
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
10463
- * );
10464
- *
10465
- * if (!result.ok) {
10466
- * // Handle error
10467
- * }
10468
- *
10469
- * const [
10470
- * hubTxHash, // transaction hash on the hub chain
10471
- * spokeTxHash, // transaction hash on the spoke chain (i.e. the transaction that was relayed to the spoke)
10472
- * ] = result.value;
10473
- * console.log('Revert migration transaction hashes:', { hubTxHash, spokeTxHash });
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
10474
10513
  */
10475
- revertMigrateSodaToIcx(params: Omit<IcxCreateRevertMigrationParams, 'wICX'>, spokeProvider: SonicSpokeProvider, timeout?: number): Promise<Result<[
10476
- Hex$1,
10477
- Hex$1
10478
- ], MigrationError<'REVERT_MIGRATION_FAILED'> | MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'> | RelayError>>;
10514
+ buildStakeData(sodaAsset: HubAssetInfo, to: Address$1, params: StakeParams): Hex;
10479
10515
  /**
10480
- * Migrates BALN tokens to SODA tokens on the hub chain (sonic).
10481
- * This function handles the migration of BALN tokens to SODA tokens.
10482
- *
10483
- * @param params - The parameters for the migration transaction.
10484
- * @param spokeProvider - The spoke provider.
10485
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
10486
- * @returns {Promise<Result<[Hex, Hex], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>}
10487
- * Returns a Result containing a tuple of [spokeTxHash, hubTxHash] if successful,
10488
- * or an error describing why the migration or relay failed.
10489
- *
10490
- * @example
10491
- * const result = await migrationService.migrateBaln(
10492
- * {
10493
- * amount: 1000n, // The amount of BALN tokens to swap
10494
- * lockupPeriod: SIX_MONTHS, // The lockup period for the swap (see LockupPeriod type)
10495
- * to: '0x...', // The hub (sonic) chain address that will receive the swapped BALN tokens
10496
- * stake: true, // Whether to stake the BALN tokens
10497
- * },
10498
- * spokeProvider, // IconSpokeProvider instance
10499
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
10500
- * );
10501
- *
10502
- * if (!result.ok) {
10503
- * // Handle error
10504
- * }
10505
- *
10506
- * const [
10507
- * spokeTxHash, // transaction hash on the spoke chain
10508
- * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
10509
- * ] = result.value;
10510
- * console.log('Migration transaction hashes:', { spokeTxHash, hubTxHash });
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>>
10511
10521
  */
10512
- migrateBaln(params: BalnMigrateParams, spokeProvider: IconSpokeProvider, timeout?: number): Promise<Result<[
10513
- Hex$1,
10514
- Hex$1
10515
- ], MigrationError<'MIGRATION_FAILED'> | MigrationError<'CREATE_MIGRATION_INTENT_FAILED'> | RelayError>>;
10522
+ unstake(params: UnstakeParams, spokeProvider: SpokeProvider, timeout?: number): Promise<Result<[string, string], StakingError<'UNSTAKE_FAILED'> | RelayError>>;
10516
10523
  /**
10517
- * Creates a BALN migration intent on spoke chain (icon).
10518
- *
10519
- * @param params - The parameters for the BALN migration transaction.
10520
- * @param spokeProvider - The spoke provider.
10521
- * @param raw - Whether to return the raw transaction hash instead of the transaction receipt
10522
- * @returns {Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>> } - Returns the raw transaction payload or transaction hash
10523
- *
10524
- * @example
10525
- * const result = await migrationService.createMigrateBalnIntent(
10526
- * {
10527
- * amount: 1000n, // The amount of BALN tokens to swap
10528
- * lockupPeriod: SIX_MONTHS, // The lockup period for the swap (see LockupPeriod type)
10529
- * to: '0x...', // The hub (sonic) chain address that will receive the swapped BALN tokens
10530
- * stake: true, // Whether to stake the BALN tokens
10531
- * },
10532
- * spokeProvider, // IconSpokeProvider instance
10533
- * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
10534
- * );
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
10535
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
10536
  */
10537
- createMigrateBalnIntent<R extends boolean = false>(params: BalnMigrateParams, spokeProvider: IconSpokeProvider, raw?: R): Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>;
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
+ }>;
10538
10547
  /**
10539
- * Creates a bnUSD migration or reverse migration (legacy bnUSD to new bnUSD or vice versa) intent on a spoke chain.
10540
- *
10541
- * This function prepares the transaction data for migrating legacy bnUSD to new bnUSD,
10542
- * or for reverting (migrating new bnUSD back to legacy bnUSD), depending on the provided parameters.
10543
- * It performs validation on chain IDs and token addresses unless `unchecked` is set to true.
10544
- *
10545
- * @param params - The parameters for the bnUSD migration or reverse migration transaction.
10546
- * @param spokeProvider - The spoke provider instance for the source chain.
10547
- * @param unchecked - If true, skips input validation (use with caution).
10548
- * @param raw - If true, returns the raw transaction hash instead of the transaction receipt.
10549
- * @returns {Promise<Result<TxReturnType<S, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>}
10550
- * Returns a Result containing the transaction payload or hash, or an error if creation failed.
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
10551
10568
  *
10552
- * @example
10553
- * // Migrate legacy bnUSD to new bnUSD
10554
- * const result = await migrationService.createMigratebnUSDIntent(
10555
- * {
10556
- * srcChainId: '0x1.icon', // Source chain ID (legacy bnUSD chain)
10557
- * dstChainId: 'sonic', // Destination chain ID (new bnUSD chain)
10558
- * srcbnUSD: 'cx...', // Legacy bnUSD token address
10559
- * dstbnUSD: '0x...', // New bnUSD token address
10560
- * amount: 1000n, // Amount to migrate
10561
- * to: '0x...', // Recipient address on destination chain
10562
- * } satisfies UnifiedBnUSDMigrateParams,
10563
- * spokeProvider, // SpokeProvider instance
10564
- * false, // Optional unchecked flag (validation is skipped)
10565
- * true // Optional raw flag
10566
- * );
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
10567
10607
  *
10568
- * // Reverse migration: new bnUSD to legacy bnUSD
10569
- * const result = await migrationService.createMigratebnUSDIntent(
10570
- * {
10571
- * srcChainId: 'sonic', // Source chain ID (new bnUSD chain)
10572
- * dstChainId: '0x1.icon', // Destination chain ID (legacy bnUSD chain)
10573
- * srcbnUSD: '0x...', // New bnUSD token address
10574
- * dstbnUSD: 'cx...', // Legacy bnUSD token address
10575
- * amount: 1000n, // Amount to migrate
10576
- * to: 'hx...', // Recipient address on destination chain
10577
- * } satisfies UnifiedBnUSDMigrateParams,
10578
- * spokeProvider
10579
- * );
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 } }>
10580
10612
  */
10581
- 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'>>>;
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
+ }>;
10582
10623
  /**
10583
- * Creates a migration of ICX to SODA intent on spoke chain (icon).
10584
- * This function handles the migration of ICX or wICX tokens to SODA tokens on the hub chain.
10585
- * Note: This function does not relay the transaction to the spoke chain.
10586
- * You should call the `isAllowanceValid` function before calling this function to check if the allowance is valid.
10587
- * You should call the `relayTxAndWaitPacket` function after calling this function to relay the transaction to the spoke chain.
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
10588
10646
  *
10589
- * @param {MigrationParams} params - The parameters for the migration transaction.
10590
- * @param {IconSpokeProvider} spokeProvider - The spoke provider.
10591
- * @param {boolean} raw - Whether to return the raw transaction hash instead of the transaction receipt
10592
- * @returns {Promise<Result<TxReturnType<IconSpokeProvider, R>, MigrationError<'CREATE_MIGRATION_INTENT_FAILED'>>>} - Returns the raw transaction payload or transaction hash
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;
10732
+ }
10733
+
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;
10735
+ type MigrationFailedErrorData<T extends MigrationErrorCode> = {
10736
+ payload: GetMigrationFailedPayload<T>;
10737
+ error: unknown;
10738
+ };
10739
+ type MigrationErrorCode = 'MIGRATION_FAILED' | 'CREATE_MIGRATION_INTENT_FAILED' | 'CREATE_REVERT_MIGRATION_INTENT_FAILED' | 'REVERT_MIGRATION_FAILED';
10740
+ type MigrationErrorData<T extends MigrationErrorCode> = T extends 'CREATE_MIGRATION_INTENT_FAILED' ? MigrationFailedErrorData<T> : T extends 'CREATE_REVERT_MIGRATION_INTENT_FAILED' ? MigrationFailedErrorData<T> : T extends 'REVERT_MIGRATION_FAILED' ? MigrationFailedErrorData<T> : T extends 'MIGRATION_FAILED' ? MigrationFailedErrorData<T> : never;
10741
+ type MigrationError<T extends MigrationErrorCode> = {
10742
+ code: T;
10743
+ data: MigrationErrorData<T>;
10744
+ };
10745
+ type MigrationAction = 'migrate' | 'revert';
10746
+ type MigrationParams = IcxMigrateParams | UnifiedBnUSDMigrateParams | BalnMigrateParams;
10747
+ type MigrationRevertParams = IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams;
10748
+ declare const SupportedMigrationTokens: readonly ["ICX", "bnUSD", "BALN"];
10749
+ type MigrationTokens = (typeof SupportedMigrationTokens)[number];
10750
+ type MigrationServiceConstructorParams = {
10751
+ hubProvider: EvmHubProvider;
10752
+ configService: ConfigService;
10753
+ relayerApiEndpoint: HttpUrl;
10754
+ };
10755
+ declare class MigrationService {
10756
+ readonly icxMigration: IcxMigrationService;
10757
+ readonly bnUSDMigrationService: BnUSDMigrationService;
10758
+ readonly balnSwapService: BalnSwapService;
10759
+ readonly hubProvider: EvmHubProvider;
10760
+ readonly relayerApiEndpoint: HttpUrl;
10761
+ readonly configService: ConfigService;
10762
+ constructor({ relayerApiEndpoint, hubProvider, configService }: MigrationServiceConstructorParams);
10763
+ /**
10764
+ * Checks if the allowance is valid for the migration transaction.
10765
+ * @param params - The parameters for the migration transaction.
10766
+ * @param spokeProvider - The spoke provider.
10767
+ * @returns {Promise<Result<boolean>>} - Returns the result of the allowance check or error
10593
10768
  *
10594
10769
  * @example
10595
- * const result = await migrationService.createMigrateIcxToSodaIntent(
10770
+ * const result = await migrationService.isAllowanceValid(
10596
10771
  * {
10772
+ * token: 'ICX', // Token to migrate
10597
10773
  * icx: 'cx...', // Address of the ICX or wICX token to migrate
10598
10774
  * amount: 1000n, // Amount to migrate (in ICX decimals, usually 18)
10599
10775
  * to: '0x...', // Address to receive the migrated SODA tokens
10600
10776
  * },
10777
+ * 'migrate',
10601
10778
  * spokeProvider, // IconSpokeProvider instance
10602
- * true // Optional raw flag to return the raw transaction hash instead of the transaction receipt
10603
10779
  * );
10604
10780
  *
10605
- * if (!result.ok) {
10606
- * // Handle error
10607
- * }
10608
10781
  */
10609
- 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>>;
10610
10783
  /**
10611
- * Creates a revert migration intent transaction on the hub chain.
10612
- * Note: This function does not relay the transaction to the spoke chain.
10613
- * You should call the `isAllowanceValid` function before calling this function to check if the allowance is valid.
10614
- * You should call the `relayTxAndWaitPacket` function after calling this function to relay the transaction to the spoke chain.
10615
- * @param {IcxCreateRevertMigrationParams} - The parameters for the revert migration transaction.
10616
- * @param {SonicSpokeProvider} spokeProvider - The spoke provider.
10617
- * @param {boolean} raw - Whether to return the raw transaction hash instead of the transaction receipt
10618
- * @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
10619
10789
  *
10620
10790
  * @example
10621
- * const result = await migrationService.createRevertSodaToIcxMigrationIntent(
10791
+ * const result = await migrationService.approve(
10622
10792
  * {
10623
10793
  * amount: 1000n, // Amount of SODA tokens to revert
10624
10794
  * to: 'hx...', // Icon Address to receive the reverted SODA tokens as ICX
10625
- * action: 'revert',
10626
10795
  * },
10627
- */
10628
- createRevertSodaToIcxMigrationIntent<R extends boolean = false>(params: Omit<IcxCreateRevertMigrationParams, 'wICX'>, spokeProvider: SonicSpokeProvider, raw?: R): Promise<Result<TxReturnType<SonicSpokeProvider, R>, MigrationError<'CREATE_REVERT_MIGRATION_INTENT_FAILED'>>>;
10629
- }
10630
-
10631
- type UnifiedBnUSDMigrateParams = {
10632
- srcChainId: SpokeChainId;
10633
- srcbnUSD: string;
10634
- dstChainId: SpokeChainId;
10635
- dstbnUSD: string;
10636
- amount: bigint;
10637
- to: string;
10638
- };
10639
- type FormattedBnUSDMigrateParams = {
10640
- srcChainId: SpokeChainId;
10641
- legacybnUSD: string;
10642
- newbnUSD: string;
10643
- amount: bigint;
10644
- to: Hex;
10645
- dstChainId: SpokeChainId;
10646
- };
10647
- type BnUSDRevertMigrationParams = {
10648
- srcChainId: SpokeChainId;
10649
- legacybnUSD: string;
10650
- newbnUSD: string;
10651
- amount: bigint;
10652
- to: Hex;
10653
- dstChainId: SpokeChainId;
10654
- };
10655
- type BnUSDMigrationServiceConstructorParams = {
10656
- hubProvider: EvmHubProvider;
10657
- configService: ConfigService;
10658
- };
10659
- /**
10660
- * Service for handling bnUSD migration operations on the hub chain.
10661
- * Provides functionality to migrate between legacy and new bnUSD tokens.
10662
- */
10663
- declare class BnUSDMigrationService {
10664
- private readonly hubProvider;
10665
- private readonly configService;
10666
- constructor({ hubProvider, configService }: BnUSDMigrationServiceConstructorParams);
10667
- /**
10668
- * Generates transaction data for migrating legacy bnUSD tokens to new bnUSD tokens.
10669
- * This method creates the necessary contract calls to:
10670
- * 1. Wrap legacy bnUSD into vault tokens
10671
- * 2. Migrate to new bnUSD vault
10672
- * 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
+ * );
10673
10800
  *
10674
- * @param params - The migration parameters including token addresses, amount, and recipient
10675
- * @returns Encoded transaction data for the migration operation
10676
- * @throws Will throw an error if the hub asset configuration is not found
10677
10801
  */
10678
- 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>>>;
10679
10803
  /**
10680
- * Generates transaction data for migrating new bnUSD tokens back to legacy bnUSD tokens.
10681
- * This method creates the necessary contract calls to:
10682
- * 1. Wrap new bnUSD into vault tokens
10683
- * 2. Migrate to legacy bnUSD vault
10684
- * 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.
10685
10806
  *
10686
- * @param params - The migration parameters including token addresses, amount, and recipient
10687
- * @returns Encoded transaction data for the migration operation
10688
- * @throws Will throw an error if the hub asset configuration is not found
10689
- */
10690
- revertMigrationData(params: BnUSDRevertMigrationParams): Hex;
10691
- }
10692
-
10693
- /**
10694
- * Lockup periods in seconds
10695
- */
10696
- declare enum LockupPeriod {
10697
- NO_LOCKUP = 0,
10698
- SIX_MONTHS = 15552000,// 6 months
10699
- TWELVE_MONTHS = 31104000,// 12 months
10700
- EIGHTEEN_MONTHS = 46656000,// 18 months
10701
- TWENTY_FOUR_MONTHS = 62208000
10702
- }
10703
- /**
10704
- * Reward multipliers (in basis points, 10000 = 1.0)
10705
- */
10706
- declare enum LockupMultiplier {
10707
- NO_LOCKUP_MULTIPLIER = 5000,// 0.5x
10708
- SIX_MONTHS_MULTIPLIER = 7500,// 0.75x
10709
- TWELVE_MONTHS_MULTIPLIER = 10000,// 1.0x
10710
- EIGHTEEN_MONTHS_MULTIPLIER = 12500,// 1.25x
10711
- TWENTY_FOUR_MONTHS_MULTIPLIER = 15000
10712
- }
10713
- /**
10714
- * Unstake request information from the staked SODA contract.
10715
- */
10716
- type UnstakeRequest = {
10717
- /** The amount being unstaked */
10718
- amount: bigint;
10719
- /** The start time of the unstake request */
10720
- startTime: bigint;
10721
- /** The address to receive the unstaked tokens */
10722
- to: Address$1;
10723
- };
10724
- /**
10725
- * Detailed lock information structure returned by the BALN swap contract.
10726
- */
10727
- type DetailedLock = {
10728
- /** The amount of BALN tokens in the lock */
10729
- balnAmount: bigint;
10730
- /** The amount of SODA tokens in the lock */
10731
- sodaAmount: bigint;
10732
- /** The unlock time for the lock */
10733
- unlockTime: bigint;
10734
- /** The amount of xSODA tokens in the lock */
10735
- xSodaAmount: bigint;
10736
- /** The unstaking ID for the lock */
10737
- unstakingId: bigint;
10738
- /** The unstake request information */
10739
- unstakeRequest: UnstakeRequest;
10740
- /** The amount of staked SODA tokens */
10741
- stakedSodaAmount: bigint;
10742
- };
10743
- /**
10744
- * Parameters for BALN swap operations.
10745
- */
10746
- type BalnMigrateParams = {
10747
- /** The amount of BALN tokens to swap */
10748
- amount: bigint;
10749
- /** The lockup period for the swap */
10750
- lockupPeriod: LockupPeriod;
10751
- /** The address that will receive the swapped SODA tokens */
10752
- to: Address$1;
10753
- /** Whether to stake the SODA tokens */
10754
- stake: boolean;
10755
- };
10756
- /**
10757
- * Parameters for BALN lock operations.
10758
- */
10759
- type BalnLockParams = {
10760
- /** The lock ID to operate on */
10761
- lockId: bigint;
10762
- };
10763
- type BalnSwapServiceConstructorParams = {
10764
- hubProvider: EvmHubProvider;
10765
- };
10766
- /**
10767
- * Service for handling BALN swap operations on the hub chain.
10768
- * Provides functionality to interact directly with the BALN swap contract.
10769
- */
10770
- declare class BalnSwapService {
10771
- private readonly hubProvider;
10772
- constructor({ hubProvider }: BalnSwapServiceConstructorParams);
10773
- /**
10774
- * Gets the multiplier for a given lockup period.
10775
- * @param lockupPeriod - The lockup period
10776
- * @returns The multiplier in basis points
10777
- */
10778
- getMultiplierForPeriod(lockupPeriod: LockupPeriod): bigint;
10779
- /**
10780
- * Calculates the SODA amount for a given BALN amount and lockup period without calling the contract.
10781
- * @param balnAmount - The amount of BALN tokens
10782
- * @param lockupPeriod - The lockup period
10783
- * @returns The calculated SODA amount
10784
- */
10785
- calculateSodaAmount(balnAmount: bigint, lockupPeriod: LockupPeriod): bigint;
10786
- /**
10787
- * Generates transaction data for swapping BALN tokens to SODA tokens.
10788
- * This method creates the necessary contract calls to:
10789
- * 1. Approve the BALN swap contract to spend the BALN tokens
10790
- * 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.
10791
10813
  *
10792
- * @param balnToken - The address of the BALN token
10793
- * @param params - The BALN swap parameters including amount, lockup period, and recipient
10794
- * @param configService - The config service
10795
- * @returns Encoded transaction data for the BALN swap operation
10796
- */
10797
- swapData(balnToken: IconContractAddress, params: BalnMigrateParams, configService: ConfigService): Hex;
10798
- /**
10799
- * Executes a claim operation directly through the wallet provider.
10800
- * @param params - The lock parameters including lock ID
10801
- * @param spokeProvider - The Sonic spoke provider
10802
- * @param raw - Whether to return raw transaction data
10803
- * @returns The transaction hash or raw transaction data
10804
- */
10805
- claim<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
10806
- /**
10807
- * Executes a claim unstaked operation directly through the wallet provider.
10808
- * @param params - The lock parameters including lock ID
10809
- * @param spokeProvider - The Sonic spoke provider
10810
- * @param raw - Whether to return raw transaction data
10811
- * @returns The transaction hash or raw transaction data
10812
- */
10813
- claimUnstaked<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
10814
- /**
10815
- * Executes a stake operation directly through the wallet provider.
10816
- * @param params - The lock parameters including lock ID
10817
- * @param spokeProvider - The Sonic spoke provider
10818
- * @param raw - Whether to return raw transaction data
10819
- * @returns The transaction hash or raw transaction data
10820
- */
10821
- stake<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
10822
- /**
10823
- * Executes an unstake operation directly through the wallet provider.
10824
- * @param params - The lock parameters including lock ID
10825
- * @param spokeProvider - The Sonic spoke provider
10826
- * @param raw - Whether to return raw transaction data
10827
- * @returns The transaction hash or raw transaction data
10828
- */
10829
- unstake<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
10830
- /**
10831
- * Executes a cancel unstake operation directly through the wallet provider.
10832
- * @param params - The lock parameters including lock ID
10833
- * @param spokeProvider - The Sonic spoke provider
10834
- * @param raw - Whether to return raw transaction data
10835
- * @returns The transaction hash or raw transaction data
10836
- */
10837
- cancelUnstake<R extends boolean = false>(params: BalnLockParams, spokeProvider: SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
10838
- /**
10839
- * 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);
10840
10834
  *
10841
- * @param publicClient - The public client for reading contract state
10842
- * @param user - The user address
10843
- * @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
+ * }
10844
10844
  */
10845
- 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>>;
10846
10849
  /**
10847
- * 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.
10848
10852
  *
10849
- * @param amount - The amount of BALN tokens to swap
10850
- * @param lockupPeriod - The lockup period for the swap
10851
- * @param to - The address that will receive the swapped SODA tokens
10852
- * @param stake - Whether to stake the SODA tokens
10853
- * @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 });
10854
10880
  */
10855
- 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>>;
10856
10885
  /**
10857
- * 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.
10858
10890
  *
10859
- * @param lockId - The lock ID to claim from
10860
- * @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 });
10861
10915
  */
10862
- 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>>;
10863
10920
  /**
10864
- * 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.
10865
10923
  *
10866
- * @param lockId - The lock ID to claim unstaked tokens from
10867
- * @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 });
10868
10952
  */
10869
- 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>>;
10870
10957
  /**
10871
- * 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
+ * );
10872
10976
  *
10873
- * @param lockId - The lock ID to stake
10874
- * @returns The encoded contract call for the stake operation
10875
10977
  */
10876
- 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'>>>;
10877
10979
  /**
10878
- * 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.
10879
10981
  *
10880
- * @param lockId - The lock ID to unstake
10881
- * @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
+ * );
10882
11021
  */
10883
- 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'>>>;
10884
11023
  /**
10885
- * 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.
10886
11029
  *
10887
- * @param lockId - The lock ID to cancel unstake for
10888
- * @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
+ * }
10889
11049
  */
10890
- 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'>>>;
10891
11051
  /**
10892
- * Executes a contract call through the Sonic wallet provider.
10893
- * @param spokeProvider - The Sonic spoke provider
10894
- * @param rawTx - The raw contract call to execute
10895
- * @param raw - Whether to return raw transaction data
10896
- * @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
+ * },
10897
11068
  */
10898
- 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'>>>;
10899
11070
  }
10900
11071
 
10901
- 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 };