@sodax/sdk 0.0.1-rc.20 → 0.0.1-rc.22

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.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Address, Hex, PublicClient, HttpTransport, Hash, GetLogsReturnType, TransactionReceipt, WalletClient, CustomTransport, Chain, Account } from 'viem';
2
- import { IInjectiveWalletProvider, InjectiveExecuteResponse, SpokeChainId, Hex as Hex$1, IEvmWalletProvider, Address as Address$1, Token, HubAddress, EvmRawTransaction, Hash as Hash$1, IconEoaAddress, IIconWalletProvider, ISolanaWalletProvider, SolanaBase58PublicKey, IStellarWalletProvider, ISuiWalletProvider, ChainType, InjectiveNetworkEnv, StellarRawTransaction, InjectiveRawTransaction, HubChainId, ICON_MAINNET_CHAIN_ID, EvmRawTransactionReceipt, ChainId, OriginalAssetAddress } from '@sodax/types';
2
+ import { IInjectiveWalletProvider, InjectiveExecuteResponse, SpokeChainId, Hex as Hex$1, IEvmWalletProvider, Address as Address$1, HubAddress, EvmRawTransaction, Hash as Hash$1, IconEoaAddress, IIconWalletProvider, ISolanaWalletProvider, SolanaBase58PublicKey, IStellarWalletProvider, ISuiWalletProvider, ChainType, HubChainId, Token, InjectiveNetworkEnv, StellarRawTransaction, InjectiveRawTransaction, ICON_MAINNET_CHAIN_ID, EvmRawTransactionReceipt, ChainId, OriginalAssetAddress } from '@sodax/types';
3
3
  export * from '@sodax/types';
4
4
  import { TxGrpcApi } from '@injectivelabs/sdk-ts';
5
5
  import { Horizon, SorobanRpc, Transaction, Memo, MemoType, Operation, FeeBumpTransaction } from '@stellar/stellar-sdk';
@@ -7,6 +7,7 @@ import { Api } from '@stellar/stellar-sdk/rpc';
7
7
  import { SuiClient } from '@mysten/sui/client';
8
8
  import { Transaction as Transaction$1, TransactionResult } from '@mysten/sui/transactions';
9
9
  import { IconService } from 'icon-sdk-js';
10
+ import BigNumber$1 from 'bignumber.js';
10
11
  import { PublicKey } from '@solana/web3.js';
11
12
 
12
13
  declare const assetManagerAbi: readonly [{
@@ -5075,6 +5076,237 @@ declare class WalletAbstractionService {
5075
5076
  static getUserHubWalletAddress(address: string, spokeProvider: SpokeProvider, hubProvider: EvmHubProvider): Promise<Address$1>;
5076
5077
  }
5077
5078
 
5079
+ declare class Erc20Service {
5080
+ private constructor();
5081
+ /**
5082
+ * Check if spender has enough ERC20 allowance for given amount
5083
+ * @param token - ERC20 token address
5084
+ * @param amount - Amount to check allowance for
5085
+ * @param owner - User wallet address
5086
+ * @param spender - Spender address
5087
+ * @param spokeProvider - EVM Spoke provider
5088
+ * @return - True if spender is allowed to spend amount on behalf of owner
5089
+ */
5090
+ static isAllowanceValid(token: Address, amount: bigint, owner: Address, spender: Address, spokeProvider: EvmSpokeProvider | SonicSpokeProvider): Promise<Result<boolean>>;
5091
+ /**
5092
+ * Approve ERC20 amount spending
5093
+ * @param token - ERC20 token address
5094
+ * @param amount - Amount to approve
5095
+ * @param spender - Spender address
5096
+ * @param provider - EVM Provider
5097
+ */
5098
+ static approve<R extends boolean = false>(token: Address, amount: bigint, spender: Address, spokeProvider: EvmSpokeProvider | SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
5099
+ /**
5100
+ * Encodes a transfer transaction for a token.
5101
+ * @param token - The address of the token.
5102
+ * @param to - The address to transfer the token to.
5103
+ * @param amount - The amount of the token to transfer.
5104
+ * @returns The encoded contract call.
5105
+ */
5106
+ static encodeTransfer(token: Address, to: Address, amount: bigint): EvmContractCall;
5107
+ /**
5108
+ * Encodes a transferFrom transaction for a token.
5109
+ * @param token - The address of the token.
5110
+ * @param from - The address to transfer the token from.
5111
+ * @param to - The address to transfer the token to.
5112
+ * @param amount - The amount of the token to transfer.
5113
+ * @returns The encoded contract call.
5114
+ */
5115
+ static encodeTransferFrom(token: Address, from: Address, to: Address, amount: bigint): EvmContractCall;
5116
+ /**
5117
+ * Encodes an approval transaction for a token.
5118
+ * @param token - The address of the token.
5119
+ * @param to - The address to approve the token to.
5120
+ * @param amount - The amount of the token to approve.
5121
+ * @returns The encoded contract call.
5122
+ */
5123
+ static encodeApprove(token: Address, to: Address, amount: bigint): EvmContractCall;
5124
+ }
5125
+
5126
+ type EvmSpokeDepositParams = {
5127
+ from: Address;
5128
+ to?: HubAddress;
5129
+ token: Hex$1;
5130
+ amount: bigint;
5131
+ data: Hex$1;
5132
+ };
5133
+ declare class EvmSpokeService {
5134
+ private constructor();
5135
+ /**
5136
+ * Estimates the gas necessary to complete a transaction without submitting it to the network.
5137
+ *
5138
+ * - Docs: https://viem.sh/docs/actions/public/estimateGas
5139
+ * - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
5140
+ *
5141
+ * @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
5142
+ * @param {EvmSpokeProvider} spokeProvider - The EVM spoke provider.
5143
+ * @returns {Promise<bigint>} Estimated gas for the transaction.
5144
+ *
5145
+ * @example
5146
+ *
5147
+ * const rawTx: EvmRawTransaction = {
5148
+ * from: '0x1234...abcd', // sender address
5149
+ * to: '0xabcd...1234', // recipient address
5150
+ * value: 1000000000000000000n, // 1 ETH in wei
5151
+ * data: '0x', // no calldata
5152
+ * };
5153
+ *
5154
+ * // Assume spokeProvider is an initialized EvmSpokeProvider
5155
+ * const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
5156
+ * console.log(`Estimated gas: ${estimatedGas}`);
5157
+ */
5158
+ static estimateGas(rawTx: EvmRawTransaction, spokeProvider: EvmSpokeProvider): Promise<bigint>;
5159
+ /**
5160
+ * Deposit tokens to the spoke chain.
5161
+ * @param {EvmSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
5162
+ * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
5163
+ * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
5164
+ * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
5165
+ */
5166
+ static deposit<R extends boolean = false>(params: EvmSpokeDepositParams, spokeProvider: EvmSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseEvmTxReturnType<R>;
5167
+ /**
5168
+ * Get the balance of the token in the spoke chain.
5169
+ * @param {Address} token - The address of the token to get the balance of.
5170
+ * @param {EvmSpokeProvider} spokeProvider - The spoke provider.
5171
+ * @returns {Promise<bigint>} The balance of the token.
5172
+ */
5173
+ static getDeposit(token: Address, spokeProvider: EvmSpokeProvider): Promise<bigint>;
5174
+ /**
5175
+ * Calls a contract on the spoke chain using the user's wallet.
5176
+ * @param {HubAddress} from - The address of the user on the hub chain.
5177
+ * @param {Hex} payload - The payload to send to the contract.
5178
+ * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
5179
+ * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
5180
+ * @param {boolean} raw - The return type raw or just transaction hash
5181
+ * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
5182
+ */
5183
+ static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider: EvmSpokeProvider, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<EvmSpokeProvider, R>>;
5184
+ /**
5185
+ * Transfers tokens to the hub chain.
5186
+ * @param {EvmTransferToHubParams} params - The parameters for the transfer, including:
5187
+ * - {Address} token: The address of the token to transfer (use address(0) for native token).
5188
+ * - {Address} recipient: The recipient address on the hub chain.
5189
+ * - {bigint} amount: The amount to transfer.
5190
+ * - {Hex} [data="0x"]: Additional data for the transfer.
5191
+ * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
5192
+ * @param {boolean} raw - The return type raw or just transaction hash
5193
+ * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
5194
+ */
5195
+ private static transfer;
5196
+ /**
5197
+ * Sends a message to the hub chain.
5198
+ * @param {bigint} dstChainId - The chain ID of the hub chain.
5199
+ * @param {Address} dstAddress - The address on the hub chain.
5200
+ * @param {Hex} payload - The payload to send.
5201
+ * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
5202
+ * @param {boolean} raw - The return type raw or just transaction hash
5203
+ * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
5204
+ */
5205
+ private static call;
5206
+ }
5207
+
5208
+ /**
5209
+ * SpokeService is a main class that provides functionalities for dealing with spoke chains.
5210
+ * It uses command pattern to execute different spoke chain operations.
5211
+ */
5212
+ declare class SpokeService {
5213
+ private constructor();
5214
+ /**
5215
+ * Estimate the gas for a raw transaction.
5216
+ * @param {TxReturnType<T, true>} params - The parameters for the raw transaction.
5217
+ * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
5218
+ * @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
5219
+ */
5220
+ static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
5221
+ /**
5222
+ * Deposit tokens to the spoke chain.
5223
+ * @param {GetSpokeDepositParamsType<T extends SpokeProvider>} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
5224
+ * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
5225
+ * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
5226
+ * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
5227
+ */
5228
+ static deposit<T extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: GetSpokeDepositParamsType<T>, spokeProvider: T, hubProvider: EvmHubProvider, raw?: R): Promise<PromiseTxReturnType<T, R>>;
5229
+ /**
5230
+ * Get the balance of the token in the spoke chain.
5231
+ * @param {Address} token - The address of the token to get the balance of.
5232
+ * @param {SpokeProvider} spokeProvider - The spoke provider.
5233
+ * @returns {Promise<bigint>} The balance of the token.
5234
+ */
5235
+ static getDeposit(token: Address$1, spokeProvider: SpokeProvider): Promise<bigint>;
5236
+ /**
5237
+ * Calls a contract on the spoke chain using the user's wallet.
5238
+ * @param {HubAddress} from - The address of the user on the hub chain.
5239
+ * @param {Hex} payload - The payload to send to the contract.
5240
+ * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
5241
+ * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
5242
+ * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
5243
+ */
5244
+ static callWallet<T extends SpokeProvider = SpokeProvider, R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider: T, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<T, R>>;
5245
+ }
5246
+
5247
+ type PoolBaseCurrencyHumanized = {
5248
+ marketReferenceCurrencyDecimals: number;
5249
+ marketReferenceCurrencyPriceInUsd: string;
5250
+ networkBaseTokenPriceInUsd: string;
5251
+ networkBaseTokenPriceDecimals: number;
5252
+ };
5253
+ type ReserveDataHumanized = {
5254
+ originalId: number;
5255
+ id: string;
5256
+ underlyingAsset: string;
5257
+ name: string;
5258
+ symbol: string;
5259
+ decimals: number;
5260
+ baseLTVasCollateral: string;
5261
+ reserveLiquidationThreshold: string;
5262
+ reserveLiquidationBonus: string;
5263
+ reserveFactor: string;
5264
+ usageAsCollateralEnabled: boolean;
5265
+ borrowingEnabled: boolean;
5266
+ isActive: boolean;
5267
+ isFrozen: boolean;
5268
+ liquidityIndex: string;
5269
+ variableBorrowIndex: string;
5270
+ liquidityRate: string;
5271
+ variableBorrowRate: string;
5272
+ lastUpdateTimestamp: number;
5273
+ aTokenAddress: string;
5274
+ variableDebtTokenAddress: string;
5275
+ interestRateStrategyAddress: string;
5276
+ availableLiquidity: string;
5277
+ totalScaledVariableDebt: string;
5278
+ priceInMarketReferenceCurrency: string;
5279
+ priceOracle: string;
5280
+ variableRateSlope1: string;
5281
+ variableRateSlope2: string;
5282
+ baseVariableBorrowRate: string;
5283
+ optimalUsageRatio: string;
5284
+ isPaused: boolean;
5285
+ isSiloedBorrowing: boolean;
5286
+ accruedToTreasury: string;
5287
+ unbacked: string;
5288
+ isolationModeTotalDebt: string;
5289
+ flashLoanEnabled: boolean;
5290
+ debtCeiling: string;
5291
+ debtCeilingDecimals: number;
5292
+ borrowCap: string;
5293
+ supplyCap: string;
5294
+ borrowableInIsolation: boolean;
5295
+ virtualAccActive: boolean;
5296
+ virtualUnderlyingBalance: string;
5297
+ };
5298
+ type UserReserveData = {
5299
+ underlyingAsset: string;
5300
+ scaledATokenBalance: bigint;
5301
+ usageAsCollateralEnabledOnUser: boolean;
5302
+ scaledVariableDebt: bigint;
5303
+ };
5304
+ type BaseCurrencyInfo = {
5305
+ marketReferenceCurrencyUnit: bigint;
5306
+ marketReferenceCurrencyPriceInUsd: bigint;
5307
+ networkBaseTokenPriceInUsd: bigint;
5308
+ networkBaseTokenPriceDecimals: number;
5309
+ };
5078
5310
  type AggregatedReserveData = {
5079
5311
  underlyingAsset: Address$1;
5080
5312
  name: string;
@@ -5118,17 +5350,40 @@ type AggregatedReserveData = {
5118
5350
  virtualAccActive: boolean;
5119
5351
  virtualUnderlyingBalance: bigint;
5120
5352
  };
5121
- type BaseCurrencyInfo = {
5122
- marketReferenceCurrencyUnit: bigint;
5123
- marketReferenceCurrencyPriceInUsd: bigint;
5124
- networkBaseTokenPriceInUsd: bigint;
5125
- networkBaseTokenPriceDecimals: number;
5353
+ type ReservesDataHumanized = {
5354
+ reservesData: ReserveDataHumanized[];
5355
+ baseCurrencyData: PoolBaseCurrencyHumanized;
5126
5356
  };
5127
- type UserReserveData = {
5357
+ type UserReserveDataHumanized = {
5358
+ id: string;
5128
5359
  underlyingAsset: string;
5129
- scaledATokenBalance: bigint;
5360
+ scaledATokenBalance: string;
5130
5361
  usageAsCollateralEnabledOnUser: boolean;
5131
- scaledVariableDebt: bigint;
5362
+ scaledVariableDebt: string;
5363
+ };
5364
+ type EModeCategoryHumanized = {
5365
+ ltv: string;
5366
+ liquidationThreshold: string;
5367
+ liquidationBonus: string;
5368
+ collateralBitmap: string;
5369
+ label: string;
5370
+ borrowableBitmap: string;
5371
+ };
5372
+ type EModeCategory = {
5373
+ ltv: number;
5374
+ liquidationThreshold: number;
5375
+ liquidationBonus: number;
5376
+ collateralBitmap: bigint;
5377
+ label: string;
5378
+ borrowableBitmap: bigint;
5379
+ };
5380
+ type EmodeDataHumanized = {
5381
+ id: number;
5382
+ eMode: EModeCategoryHumanized;
5383
+ };
5384
+ type EModeData = {
5385
+ id: number;
5386
+ eMode: EModeCategory;
5132
5387
  };
5133
5388
  type ReserveDataLegacy = {
5134
5389
  configuration: bigint;
@@ -5147,723 +5402,608 @@ type ReserveDataLegacy = {
5147
5402
  unbacked: bigint;
5148
5403
  isolationModeTotalDebt: bigint;
5149
5404
  };
5150
- type MoneyMarketEncodeSupplyParams = {
5151
- asset: Address$1;
5152
- amount: bigint;
5153
- onBehalfOf: Address$1;
5154
- referralCode: number;
5155
- };
5156
- type MoneyMarketEncodeWithdrawParams = {
5157
- asset: Address$1;
5158
- amount: bigint;
5159
- to: Address$1;
5160
- };
5161
- type MoneyMarketEncodeBorrowParams = {
5162
- asset: Address$1;
5163
- amount: bigint;
5164
- interestRateMode: bigint;
5165
- referralCode: number;
5166
- onBehalfOf: Address$1;
5167
- };
5168
- type MoneyMarketEncodeRepayParams = {
5169
- asset: Address$1;
5170
- amount: bigint;
5171
- interestRateMode: bigint;
5172
- onBehalfOf: Address$1;
5173
- };
5174
- type MoneyMarketEncodeRepayWithATokensParams = {
5175
- asset: Address$1;
5176
- amount: bigint;
5177
- interestRateMode: bigint;
5178
- };
5179
- type MoneyMarketAction = 'supply' | 'borrow' | 'withdraw' | 'repay';
5180
- type MoneyMarketSupplyParams = {
5181
- token: string;
5182
- amount: bigint;
5183
- action: 'supply';
5184
- };
5185
- type MoneyMarketBorrowParams = {
5186
- token: string;
5187
- amount: bigint;
5188
- action: 'borrow';
5189
- };
5190
- type MoneyMarketWithdrawParams = {
5191
- token: string;
5192
- amount: bigint;
5193
- action: 'withdraw';
5194
- };
5195
- type MoneyMarketRepayParams = {
5196
- token: string;
5197
- amount: bigint;
5198
- action: 'repay';
5199
- };
5200
- type MoneyMarketParams = MoneyMarketSupplyParams | MoneyMarketBorrowParams | MoneyMarketWithdrawParams | MoneyMarketRepayParams;
5201
- type MoneyMarketUnknownErrorCode = 'SUPPLY_UNKNOWN_ERROR' | 'BORROW_UNKNOWN_ERROR' | 'WITHDRAW_UNKNOWN_ERROR' | 'REPAY_UNKNOWN_ERROR';
5202
- type GetMoneyMarketParams<T extends MoneyMarketUnknownErrorCode> = T extends 'SUPPLY_UNKNOWN_ERROR' ? MoneyMarketSupplyParams : T extends 'BORROW_UNKNOWN_ERROR' ? MoneyMarketBorrowParams : T extends 'WITHDRAW_UNKNOWN_ERROR' ? MoneyMarketWithdrawParams : T extends 'REPAY_UNKNOWN_ERROR' ? MoneyMarketRepayParams : never;
5203
- type MoneyMarketErrorCode = MoneyMarketUnknownErrorCode | RelayErrorCode | 'CREATE_SUPPLY_INTENT_FAILED' | 'CREATE_BORROW_INTENT_FAILED' | 'CREATE_WITHDRAW_INTENT_FAILED' | 'CREATE_REPAY_INTENT_FAILED';
5204
- type MoneyMarketUnknownError<T extends MoneyMarketUnknownErrorCode> = {
5205
- error: unknown;
5206
- payload: GetMoneyMarketParams<T>;
5207
- };
5208
- type MoneyMarketSubmitTxFailedError = {
5209
- error: RelayError;
5210
- payload: SpokeTxHash;
5211
- };
5212
- type MoneyMarketSupplyFailedError = {
5213
- error: unknown;
5214
- payload: MoneyMarketSupplyParams;
5215
- };
5216
- type MoneyMarketBorrowFailedError = {
5217
- error: unknown;
5218
- payload: MoneyMarketBorrowParams;
5219
- };
5220
- type MoneyMarketWithdrawFailedError = {
5221
- error: unknown;
5222
- payload: MoneyMarketWithdrawParams;
5223
- };
5224
- type MoneyMarketRepayFailedError = {
5225
- error: unknown;
5226
- payload: MoneyMarketRepayParams;
5227
- };
5228
- type GetMoneyMarketError<T extends MoneyMarketErrorCode> = T extends 'SUBMIT_TX_FAILED' ? MoneyMarketSubmitTxFailedError : T extends 'RELAY_TIMEOUT' ? MoneyMarketSubmitTxFailedError : T extends 'CREATE_SUPPLY_INTENT_FAILED' ? MoneyMarketSupplyFailedError : T extends 'CREATE_BORROW_INTENT_FAILED' ? MoneyMarketBorrowFailedError : T extends 'CREATE_WITHDRAW_INTENT_FAILED' ? MoneyMarketWithdrawFailedError : T extends 'CREATE_REPAY_INTENT_FAILED' ? MoneyMarketRepayFailedError : T extends MoneyMarketUnknownErrorCode ? MoneyMarketUnknownError<T> : never;
5229
- type MoneyMarketError<T extends MoneyMarketErrorCode> = {
5230
- code: T;
5231
- data: GetMoneyMarketError<T>;
5232
- };
5233
- type MoneyMarketExtraData = {
5234
- address: Hex;
5235
- payload: Hex;
5236
- };
5237
- type MoneyMarketOptionalExtraData = {
5238
- data?: MoneyMarketExtraData;
5239
- };
5240
- declare class MoneyMarketService {
5241
- readonly config: MoneyMarketServiceConfig;
5405
+ interface UiPoolDataProviderInterface {
5406
+ getReservesList: () => Promise<readonly Address$1[]>;
5407
+ getReservesData: () => Promise<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>;
5408
+ getUserReservesData: (userAddress: Address$1) => Promise<readonly [readonly UserReserveData[], number]>;
5409
+ getEModes: () => Promise<readonly EModeData[]>;
5410
+ getEModesHumanized: () => Promise<EmodeDataHumanized[]>;
5411
+ getReservesHumanized: () => Promise<ReservesDataHumanized>;
5412
+ getUserReservesHumanized: (userAddress: Address$1) => Promise<{
5413
+ userReserves: UserReserveDataHumanized[];
5414
+ userEmodeCategoryId: number;
5415
+ }>;
5416
+ }
5417
+
5418
+ type BigNumberValue = string | number | BigNumber;
5419
+ declare const BigNumberZeroDecimal: typeof globalThis.BigNumber;
5420
+ declare function valueToBigNumber(amount: BigNumberValue): BigNumber;
5421
+ declare function valueToZDBigNumber(amount: BigNumberValue): BigNumber;
5422
+ declare function normalize(n: BigNumberValue, decimals: number): string;
5423
+ declare function normalizeBN(n: BigNumberValue, decimals: number): BigNumber;
5424
+
5425
+ declare const SECONDS_PER_YEAR: BigNumber;
5426
+ declare const USD_DECIMALS = 8;
5427
+ declare const WEI_DECIMALS = 18;
5428
+ declare const RAY_DECIMALS = 27;
5429
+ declare const LTV_PRECISION = 4;
5430
+
5431
+ declare const WAD: BigNumber$1;
5432
+ declare const HALF_WAD: BigNumber$1;
5433
+ declare const RAY: BigNumber$1;
5434
+ declare const HALF_RAY: BigNumber$1;
5435
+ declare const WAD_RAY_RATIO: BigNumber$1;
5436
+ declare function rayMul(a: BigNumberValue, b: BigNumberValue): BigNumber$1;
5437
+ declare function rayDiv(a: BigNumberValue, b: BigNumberValue): BigNumber$1;
5438
+ declare function rayToWad(a: BigNumberValue): BigNumber$1;
5439
+ declare function wadToRay(a: BigNumberValue): BigNumber$1;
5440
+ declare function rayPow(a: BigNumberValue, p: BigNumberValue): BigNumber$1;
5441
+ /**
5442
+ * RayPow is slow and gas intensive therefore in v2 we switched to binomial approximation on the contract level.
5443
+ * While the results ar not exact to the last decimal, they are close enough.
5444
+ */
5445
+ declare function binomialApproximatedRayPow(a: BigNumberValue, p: BigNumberValue): BigNumber$1;
5446
+
5447
+ interface CalculateCompoundedInterestRequest {
5448
+ rate: BigNumberValue;
5449
+ currentTimestamp: number;
5450
+ lastUpdateTimestamp: number;
5451
+ }
5452
+ declare function calculateCompoundedInterest({ rate, currentTimestamp, lastUpdateTimestamp, }: CalculateCompoundedInterestRequest): BigNumber$1;
5453
+ interface CompoundedBalanceRequest {
5454
+ principalBalance: BigNumberValue;
5455
+ reserveIndex: BigNumberValue;
5456
+ reserveRate: BigNumberValue;
5457
+ lastUpdateTimestamp: number;
5458
+ currentTimestamp: number;
5459
+ }
5460
+ declare function getCompoundedBalance({ principalBalance: _principalBalance, reserveIndex, reserveRate, lastUpdateTimestamp, currentTimestamp, }: CompoundedBalanceRequest): BigNumber$1;
5461
+ interface LinearInterestRequest {
5462
+ rate: BigNumberValue;
5463
+ currentTimestamp: number;
5464
+ lastUpdateTimestamp: number;
5465
+ }
5466
+ declare function calculateLinearInterest({ rate, currentTimestamp, lastUpdateTimestamp, }: LinearInterestRequest): BigNumber$1;
5467
+ interface ReserveNormalizedIncomeRequest {
5468
+ rate: BigNumberValue;
5469
+ index: BigNumberValue;
5470
+ lastUpdateTimestamp: number;
5471
+ currentTimestamp: number;
5472
+ }
5473
+ declare function getReserveNormalizedIncome({ rate, index, lastUpdateTimestamp, currentTimestamp, }: ReserveNormalizedIncomeRequest): BigNumber$1;
5474
+ interface LinearBalanceRequest {
5475
+ balance: BigNumberValue;
5476
+ index: BigNumberValue;
5477
+ rate: BigNumberValue;
5478
+ lastUpdateTimestamp: number;
5479
+ currentTimestamp: number;
5480
+ }
5481
+ declare function getLinearBalance({ balance, index, rate, lastUpdateTimestamp, currentTimestamp, }: LinearBalanceRequest): BigNumber$1;
5482
+ interface HealthFactorFromBalanceRequest {
5483
+ collateralBalanceMarketReferenceCurrency: BigNumberValue;
5484
+ borrowBalanceMarketReferenceCurrency: BigNumberValue;
5485
+ currentLiquidationThreshold: BigNumberValue;
5486
+ }
5487
+ declare function calculateHealthFactorFromBalances({ borrowBalanceMarketReferenceCurrency, collateralBalanceMarketReferenceCurrency, currentLiquidationThreshold, }: HealthFactorFromBalanceRequest): BigNumber$1;
5488
+ interface HealthFactorFromBalanceBigUnitsRequest {
5489
+ collateralBalanceMarketReferenceCurrency: BigNumberValue;
5490
+ borrowBalanceMarketReferenceCurrency: BigNumberValue;
5491
+ currentLiquidationThreshold: BigNumberValue;
5492
+ }
5493
+ declare function calculateHealthFactorFromBalancesBigUnits({ collateralBalanceMarketReferenceCurrency, borrowBalanceMarketReferenceCurrency, currentLiquidationThreshold, }: HealthFactorFromBalanceBigUnitsRequest): BigNumber$1;
5494
+ interface AvailableBorrowsMarketReferenceCurrencyRequest {
5495
+ collateralBalanceMarketReferenceCurrency: BigNumberValue;
5496
+ borrowBalanceMarketReferenceCurrency: BigNumberValue;
5497
+ currentLtv: BigNumberValue;
5498
+ }
5499
+ declare function calculateAvailableBorrowsMarketReferenceCurrency({ collateralBalanceMarketReferenceCurrency, borrowBalanceMarketReferenceCurrency, currentLtv, }: AvailableBorrowsMarketReferenceCurrencyRequest): BigNumber$1;
5500
+ interface MarketReferenceCurrencyAndUsdBalanceRequest {
5501
+ balance: BigNumberValue;
5502
+ priceInMarketReferenceCurrency: BigNumberValue;
5503
+ marketReferenceCurrencyDecimals: number;
5504
+ decimals: number;
5505
+ marketReferencePriceInUsdNormalized: BigNumberValue;
5506
+ }
5507
+ interface MarketReferenceAndUsdBalanceResponse {
5508
+ marketReferenceCurrencyBalance: BigNumber$1;
5509
+ usdBalance: BigNumber$1;
5510
+ }
5511
+ /**
5512
+ * @returns non humanized/normalized values for usd/marketReference
5513
+ */
5514
+ declare function getMarketReferenceCurrencyAndUsdBalance({ balance, priceInMarketReferenceCurrency, marketReferenceCurrencyDecimals, decimals, marketReferencePriceInUsdNormalized, }: MarketReferenceCurrencyAndUsdBalanceRequest): MarketReferenceAndUsdBalanceResponse;
5515
+
5516
+ interface CalculateCompoundedRateRequest {
5517
+ rate: BigNumberValue;
5518
+ duration: BigNumberValue;
5519
+ }
5520
+
5521
+ declare function calculateCompoundedRate({ rate, duration }: CalculateCompoundedRateRequest): BigNumber$1;
5522
+
5523
+ interface EModeCategoryData {
5524
+ ltv: string;
5525
+ liquidationThreshold: string;
5526
+ liquidationBonus: string;
5527
+ collateralBitmap: string;
5528
+ label: string;
5529
+ borrowableBitmap: string;
5530
+ }
5531
+ interface FormattedEModeCategory extends EModeCategoryData {
5532
+ formattedLtv: string;
5533
+ formattedLiquidationThreshold: string;
5534
+ formattedLiquidationBonus: string;
5535
+ }
5536
+ interface EModeDataString {
5537
+ id: number;
5538
+ eMode: EModeCategoryData;
5539
+ }
5540
+ declare function formatEModeCategory(eModeCategory: EModeCategoryData): FormattedEModeCategory;
5541
+ declare function formatEModes(eModes: EModeDataString[]): {
5542
+ eMode: FormattedEModeCategory;
5543
+ id: number;
5544
+ }[];
5545
+ interface ReserveEMode extends EModeDataString {
5546
+ collateralEnabled: boolean;
5547
+ borrowingEnabled: boolean;
5548
+ }
5549
+ declare function getReservesEModes(reserveId: number, eModes: EModeDataString[]): ReserveEMode[];
5550
+ interface FormattedReserveEMode extends Omit<ReserveEMode, 'eMode'> {
5551
+ eMode: FormattedEModeCategory;
5552
+ }
5553
+ declare function getAndFormatReserveEModes(reserveId: number, eModes: EModeDataString[]): FormattedReserveEMode[];
5554
+
5555
+ interface ReservesIncentiveDataHumanized {
5556
+ underlyingAsset: string;
5557
+ aIncentiveData: IncentiveDataHumanized;
5558
+ vIncentiveData: IncentiveDataHumanized;
5559
+ }
5560
+ interface UserReservesIncentivesDataHumanized {
5561
+ underlyingAsset: string;
5562
+ aTokenIncentivesUserData: UserIncentiveDataHumanized;
5563
+ vTokenIncentivesUserData: UserIncentiveDataHumanized;
5564
+ }
5565
+ interface UserReserveCalculationData {
5566
+ scaledATokenBalance: string;
5567
+ scaledVariableDebt: string;
5568
+ reserve: {
5569
+ underlyingAsset: string;
5570
+ totalLiquidity: string;
5571
+ liquidityIndex: string;
5572
+ totalScaledVariableDebt: string;
5573
+ decimals: number;
5574
+ };
5575
+ }
5576
+ interface ReserveCalculationData {
5577
+ underlyingAsset: string;
5578
+ symbol: string;
5579
+ totalLiquidity: string;
5580
+ totalVariableDebt: string;
5581
+ formattedPriceInMarketReferenceCurrency: string;
5582
+ decimals: number;
5583
+ }
5584
+ interface UserIncentiveDataHumanized {
5585
+ tokenAddress: string;
5586
+ incentiveControllerAddress: string;
5587
+ userRewardsInformation: UserRewardInfoHumanized[];
5588
+ }
5589
+ interface UserRewardInfoHumanized {
5590
+ rewardTokenSymbol: string;
5591
+ rewardOracleAddress: string;
5592
+ rewardTokenAddress: string;
5593
+ userUnclaimedRewards: string;
5594
+ tokenIncentivesUserIndex: string;
5595
+ rewardPriceFeed: string;
5596
+ priceFeedDecimals: number;
5597
+ rewardTokenDecimals: number;
5598
+ }
5599
+ interface IncentiveDataHumanized {
5600
+ tokenAddress: string;
5601
+ incentiveControllerAddress: string;
5602
+ rewardsTokenInformation: RewardInfoHumanized[];
5603
+ }
5604
+ interface RewardInfoHumanized {
5605
+ rewardTokenSymbol: string;
5606
+ rewardTokenAddress: string;
5607
+ rewardOracleAddress: string;
5608
+ emissionPerSecond: string;
5609
+ incentivesLastUpdateTimestamp: number;
5610
+ tokenIncentivesIndex: string;
5611
+ emissionEndTimestamp: number;
5612
+ rewardPriceFeed: string;
5613
+ rewardTokenDecimals: number;
5614
+ precision: number;
5615
+ priceFeedDecimals: number;
5616
+ }
5617
+
5618
+ type UserIncentiveDict = Record<string, UserIncentiveData>;
5619
+ interface UserIncentiveData {
5620
+ incentiveControllerAddress: string;
5621
+ rewardTokenSymbol: string;
5622
+ rewardPriceFeed: string;
5623
+ rewardTokenDecimals: number;
5624
+ claimableRewards: BigNumber;
5625
+ assets: string[];
5626
+ }
5627
+ interface CalculateAllUserIncentivesRequest {
5628
+ reserveIncentives: ReservesIncentiveDataHumanized[];
5629
+ userIncentives: UserReservesIncentivesDataHumanized[];
5630
+ userReserves: UserReserveCalculationData[];
5631
+ currentTimestamp: number;
5632
+ }
5633
+ declare function calculateAllUserIncentives({ reserveIncentives, userIncentives, userReserves, currentTimestamp, }: CalculateAllUserIncentivesRequest): UserIncentiveDict;
5634
+
5635
+ type ReserveIncentiveDict = Record<string, ReserveIncentives>;
5636
+ interface ReserveIncentives {
5637
+ aIncentives: ReserveIncentive[];
5638
+ vIncentives: ReserveIncentive[];
5639
+ }
5640
+ interface ReserveIncentive {
5641
+ incentiveAPR: string;
5642
+ rewardTokenAddress: string;
5643
+ rewardTokenSymbol: string;
5644
+ }
5645
+ interface CalculateAllReserveIncentivesRequest {
5646
+ reserveIncentives: ReservesIncentiveDataHumanized[];
5647
+ reserves: ReserveCalculationData[];
5648
+ marketReferenceCurrencyDecimals: number;
5649
+ }
5650
+ declare function calculateAllReserveIncentives({ reserveIncentives, reserves, marketReferenceCurrencyDecimals, }: CalculateAllReserveIncentivesRequest): ReserveIncentiveDict;
5651
+
5652
+ interface ReserveIncentiveResponse {
5653
+ incentiveAPR: string;
5654
+ rewardTokenAddress: string;
5655
+ rewardTokenSymbol: string;
5656
+ }
5657
+ interface CalculateReserveIncentivesResponse {
5658
+ underlyingAsset: string;
5659
+ aIncentivesData: ReserveIncentiveResponse[];
5660
+ vIncentivesData: ReserveIncentiveResponse[];
5661
+ }
5662
+
5663
+ interface FormatReserveResponse extends ReserveData {
5664
+ formattedBaseLTVasCollateral: string;
5665
+ formattedReserveLiquidationThreshold: string;
5666
+ formattedReserveLiquidationBonus: string;
5667
+ formattedAvailableLiquidity: string;
5668
+ totalDebt: string;
5669
+ totalVariableDebt: string;
5670
+ totalLiquidity: string;
5671
+ borrowUsageRatio: string;
5672
+ supplyUsageRatio: string;
5673
+ supplyAPY: string;
5674
+ variableBorrowAPY: string;
5675
+ unborrowedLiquidity: string;
5676
+ supplyAPR: string;
5677
+ variableBorrowAPR: string;
5678
+ isIsolated: boolean;
5679
+ isolationModeTotalDebtUSD: string;
5680
+ availableDebtCeilingUSD: string;
5681
+ debtCeilingUSD: string;
5682
+ eModes: FormattedReserveEMode[];
5683
+ }
5684
+ interface FormatReserveRequest {
5685
+ reserve: ReserveData;
5686
+ currentTimestamp: number;
5687
+ eModes?: EModeDataString[];
5688
+ }
5689
+ interface ReserveData {
5690
+ originalId: number;
5691
+ id: string;
5692
+ symbol: string;
5693
+ name: string;
5694
+ decimals: number;
5695
+ underlyingAsset: string;
5696
+ usageAsCollateralEnabled: boolean;
5697
+ reserveFactor: string;
5698
+ baseLTVasCollateral: string;
5699
+ liquidityIndex: string;
5700
+ reserveLiquidationThreshold: string;
5701
+ reserveLiquidationBonus: string;
5702
+ variableBorrowIndex: string;
5703
+ variableBorrowRate: string;
5704
+ availableLiquidity: string;
5705
+ liquidityRate: string;
5706
+ totalScaledVariableDebt: string;
5707
+ lastUpdateTimestamp: number;
5708
+ borrowCap: string;
5709
+ supplyCap: string;
5710
+ debtCeiling: string;
5711
+ debtCeilingDecimals: number;
5712
+ isolationModeTotalDebt: string;
5713
+ unbacked: string;
5714
+ virtualAccActive: boolean;
5715
+ virtualUnderlyingBalance: string;
5716
+ }
5717
+ /**
5718
+ * @description computes additional fields and normalizes numbers into human readable decimals
5719
+ */
5720
+ declare function formatReserve({ reserve, currentTimestamp, eModes }: FormatReserveRequest): FormatReserveResponse;
5721
+ type ReserveDataWithPrice = ReserveData & {
5722
+ priceInMarketReferenceCurrency: string;
5723
+ };
5724
+ interface FormatReserveUSDRequest {
5725
+ reserve: ReserveDataWithPrice;
5726
+ currentTimestamp: number;
5727
+ marketReferencePriceInUsd: string;
5728
+ marketReferenceCurrencyDecimals: number;
5729
+ eModes?: EModeDataString[];
5730
+ }
5731
+ interface FormatReserveUSDResponse extends FormatReserveResponse {
5732
+ totalLiquidityUSD: string;
5733
+ availableLiquidityUSD: string;
5734
+ totalDebtUSD: string;
5735
+ totalVariableDebtUSD: string;
5736
+ borrowCapUSD: string;
5737
+ supplyCapUSD: string;
5738
+ unbackedUSD: string;
5739
+ priceInMarketReferenceCurrency: string;
5740
+ formattedPriceInMarketReferenceCurrency: string;
5741
+ priceInUSD: string;
5742
+ }
5743
+ /**
5744
+ * @description computes additional fields and normalizes numbers into human readable decimals
5745
+ * In addition to that it also converts the numbers to USD
5746
+ */
5747
+ declare function formatReserveUSD({ reserve, currentTimestamp, marketReferencePriceInUsd, marketReferenceCurrencyDecimals, eModes, }: FormatReserveUSDRequest): FormatReserveUSDResponse;
5748
+ interface FormatReservesUSDRequest<T extends ReserveDataWithPrice> {
5749
+ reserves: T[];
5750
+ eModes?: EModeDataString[];
5751
+ currentTimestamp: number;
5752
+ marketReferencePriceInUsd: string;
5753
+ marketReferenceCurrencyDecimals: number;
5754
+ }
5755
+ declare function formatReserves<T extends ReserveDataWithPrice>({ reserves, eModes, currentTimestamp, marketReferencePriceInUsd, marketReferenceCurrencyDecimals, }: FormatReservesUSDRequest<T>): (T & FormatReserveUSDResponse)[];
5756
+ interface FormatReservesAndIncentivesUSDRequest<T extends ReserveDataWithPrice> extends FormatReservesUSDRequest<T & {
5757
+ underlyingAsset: string;
5758
+ }> {
5759
+ reserveIncentives: ReservesIncentiveDataHumanized[];
5760
+ }
5761
+ declare function formatReservesAndIncentives<T extends ReserveDataWithPrice>({ reserves, eModes, currentTimestamp, marketReferencePriceInUsd, marketReferenceCurrencyDecimals, reserveIncentives, }: FormatReservesAndIncentivesUSDRequest<T>): Array<FormatReserveUSDResponse & T & Partial<CalculateReserveIncentivesResponse>>;
5762
+
5763
+ interface NativeToUSD {
5764
+ amount: BigNumber$1;
5765
+ currencyDecimals: number;
5766
+ priceInMarketReferenceCurrency: BigNumberValue;
5767
+ marketReferenceCurrencyDecimals: number;
5768
+ normalizedMarketReferencePriceInUsd: BigNumberValue;
5769
+ }
5770
+ declare function nativeToUSD({ amount, currencyDecimals, priceInMarketReferenceCurrency, marketReferenceCurrencyDecimals, normalizedMarketReferencePriceInUsd, }: NativeToUSD): string;
5771
+
5772
+ declare function normalizedToUsd(value: BigNumber$1, marketReferencePriceInUsd: BigNumberValue, marketReferenceCurrencyDecimals: number): BigNumber$1;
5773
+
5774
+ interface UserReserveDataString {
5775
+ underlyingAsset: string;
5776
+ scaledATokenBalance: string;
5777
+ usageAsCollateralEnabledOnUser: boolean;
5778
+ scaledVariableDebt: string;
5779
+ }
5780
+ interface CombinedReserveData<T extends FormatReserveUSDResponse = FormatReserveUSDResponse> extends UserReserveDataString {
5781
+ reserve: T;
5782
+ }
5783
+ interface ComputedUserReserve<T extends FormatReserveUSDResponse = FormatReserveUSDResponse> extends CombinedReserveData<T> {
5784
+ underlyingBalance: string;
5785
+ underlyingBalanceMarketReferenceCurrency: string;
5786
+ underlyingBalanceUSD: string;
5787
+ variableBorrows: string;
5788
+ variableBorrowsMarketReferenceCurrency: string;
5789
+ variableBorrowsUSD: string;
5790
+ totalBorrows: string;
5791
+ totalBorrowsMarketReferenceCurrency: string;
5792
+ totalBorrowsUSD: string;
5793
+ }
5794
+ interface FormatUserSummaryRequest<T extends FormatReserveUSDResponse = FormatReserveUSDResponse> {
5795
+ userReserves: UserReserveDataString[];
5796
+ formattedReserves: T[];
5797
+ marketReferencePriceInUsd: BigNumberValue;
5798
+ marketReferenceCurrencyDecimals: number;
5799
+ currentTimestamp: number;
5800
+ userEmodeCategoryId: number;
5801
+ }
5802
+ interface FormatUserSummaryResponse<T extends FormatReserveUSDResponse = FormatReserveUSDResponse> {
5803
+ userReservesData: Array<ComputedUserReserve<T>>;
5804
+ totalLiquidityMarketReferenceCurrency: string;
5805
+ totalLiquidityUSD: string;
5806
+ totalCollateralMarketReferenceCurrency: string;
5807
+ totalCollateralUSD: string;
5808
+ totalBorrowsMarketReferenceCurrency: string;
5809
+ totalBorrowsUSD: string;
5810
+ netWorthUSD: string;
5811
+ availableBorrowsMarketReferenceCurrency: string;
5812
+ availableBorrowsUSD: string;
5813
+ currentLoanToValue: string;
5814
+ currentLiquidationThreshold: string;
5815
+ healthFactor: string;
5816
+ userEmodeCategoryId: number;
5817
+ isInIsolationMode: boolean;
5818
+ isolatedReserve?: FormatReserveUSDResponse;
5819
+ }
5820
+ interface FormatUserSummaryAndIncentivesRequest<T extends FormatReserveUSDResponse = FormatReserveUSDResponse> extends FormatUserSummaryRequest<T> {
5821
+ reserveIncentives: ReservesIncentiveDataHumanized[];
5822
+ userIncentives: UserReservesIncentivesDataHumanized[];
5823
+ }
5824
+ interface FormatUserSummaryAndIncentivesResponse<T extends FormatReserveUSDResponse = FormatReserveUSDResponse> extends FormatUserSummaryResponse<T> {
5825
+ calculatedUserIncentives: UserIncentiveDict;
5826
+ }
5827
+ declare function formatUserSummary<T extends FormatReserveUSDResponse = FormatReserveUSDResponse>({ currentTimestamp, marketReferencePriceInUsd, marketReferenceCurrencyDecimals, userReserves, formattedReserves, userEmodeCategoryId, }: FormatUserSummaryRequest<T>): FormatUserSummaryResponse<T>;
5828
+ declare function formatUserSummaryAndIncentives<T extends FormatReserveUSDResponse = FormatReserveUSDResponse>({ currentTimestamp, marketReferencePriceInUsd, marketReferenceCurrencyDecimals, userReserves, formattedReserves, userEmodeCategoryId, reserveIncentives, userIncentives, }: FormatUserSummaryAndIncentivesRequest<T>): FormatUserSummaryAndIncentivesResponse<T>;
5829
+
5830
+ declare class UiPoolDataProviderService implements UiPoolDataProviderInterface {
5242
5831
  private readonly hubProvider;
5243
- constructor(config: MoneyMarketConfigParams | undefined, hubProvider: EvmHubProvider, relayerApiEndpoint?: HttpUrl);
5832
+ private readonly uiPoolDataProvider;
5833
+ private readonly poolAddressesProvider;
5834
+ constructor(hubProvider: EvmHubProvider);
5835
+ getUserReservesHumanized(userAddress: Address$1): Promise<{
5836
+ userReserves: UserReserveDataHumanized[];
5837
+ userEmodeCategoryId: number;
5838
+ }>;
5244
5839
  /**
5245
- * Estimate the gas for a raw transaction.
5246
- * @param {TxReturnType<T, true>} params - The parameters for the raw transaction.
5247
- * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
5248
- * @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
5840
+ * Get the list of all eModes in the pool humanized
5841
+ * @returns {Promise<EmodeDataHumanized[]>} - Array of eMode data humanized
5249
5842
  */
5250
- static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
5843
+ getEModesHumanized(): Promise<EmodeDataHumanized[]>;
5251
5844
  /**
5252
- * Check if allowance is sufficient for actions on the money market pool
5253
- * @param {MoneyMarketParams} params - Money market params containing token address and amount
5254
- * @param {SpokeProvider} spokeProvider - The spoke provider instance
5255
- * @return {Promise<Result<boolean>>} - Returns true if allowance is sufficient, false otherwise
5256
- *
5257
- * @example
5258
- * const allowanceValid = await isAllowanceValid({
5259
- * token: '0x...', // Address of the token (spoke chain) to supply
5260
- * amount: 1000n, // Amount to supply (in token decimals)
5261
- * action: 'supply',
5262
- * }, spokeProvider);
5263
- *
5264
- * if (!allowanceValid.ok) {
5265
- * // Handle error
5266
- * }
5267
- *
5268
- * if (!allowanceValid.value) {
5269
- * // Need to approve
5270
- * }
5845
+ * Get the list of all eModes in the pool
5846
+ * @returns {Promise<readonly EModeData[]>} - Array of eMode data
5271
5847
  */
5272
- isAllowanceValid<S extends SpokeProvider>(params: MoneyMarketParams, spokeProvider: S): Promise<Result<boolean>>;
5848
+ getEModes(): Promise<readonly EModeData[]>;
5273
5849
  /**
5274
- * Approve amount spending if isAllowanceValid returns false.
5275
- * For evm spoke chains, the spender is the asset manager contract while
5276
- * for sonic spoke (hub) chain, the spender is the user router contract.
5277
- * @param token - ERC20 token address
5278
- * @param amount - Amount to approve
5279
- * @param spender - Spender address
5280
- * @param spokeProvider - Spoke provider
5281
- * @returns {Promise<Result<TxReturnType<S, R>>>} - Returns the transaction receipt
5282
- *
5283
- * @example
5284
- * const approveResult = await approve(
5285
- * {
5286
- * token: '0x...', // ERC20 token address
5287
- * amount: 1000n, // Amount to approve (in token decimals)
5288
- * action: 'supply', // Action to perform
5289
- * },
5290
- * spokeProvider,
5291
- * raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
5292
- * );
5293
- *
5294
- * if (!approveResult.ok) {
5295
- * // Handle error
5296
- * }
5297
- *
5298
- * const txReceipt = approveResult.value;
5850
+ * Get the list of all reserves in the pool
5851
+ * @param uiPoolDataProvider - The address of the UI Pool Data Provider
5852
+ * @param poolAddressesProvider - The address of the Pool Addresses Provider
5853
+ * @returns {Promise<readonly Address[]>} - Array of reserve addresses
5299
5854
  */
5300
- approve<S extends SpokeProvider, R extends boolean = false>(params: MoneyMarketParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>>>;
5855
+ getReservesList(): Promise<readonly Address$1[]>;
5301
5856
  /**
5302
- * Supply tokens to the money market pool, relay the transaction to the hub and submit the intent to the Solver API
5303
- * @param params - The parameters for the supply transaction.
5304
- * @param spokeProvider - The spoke provider.
5305
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
5306
- * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
5307
- *
5308
- * @example
5309
- * const result = await moneyMarketService.supply(
5310
- * {
5311
- * token: '0x...', // Address of the token (spoke chain address) to supply
5312
- * amount: 1000n, // Amount to supply (in token decimals)
5313
- * },
5314
- * spokeProvider,
5315
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
5316
- * );
5317
- *
5318
- * if (!result.ok) {
5319
- * // Handle error
5320
- * }
5321
- *
5322
- * const [
5323
- * spokeTxHash, // transaction hash on the spoke chain
5324
- * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
5325
- * ] = result.value;
5326
- * console.log('Supply transaction hashes:', { spokeTxHash, hubTxHash });
5857
+ * Get detailed data for all reserves in the pool
5858
+ * @returns {Promise<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>} - Tuple containing array of reserve data and base currency info
5327
5859
  */
5328
- supply<S extends SpokeProvider>(params: MoneyMarketSupplyParams, spokeProvider: S, timeout?: number): Promise<Result<[
5329
- SpokeTxHash,
5330
- HubTxHash
5331
- ], MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED' | 'SUPPLY_UNKNOWN_ERROR' | RelayErrorCode>>>;
5860
+ getReservesData(): Promise<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>;
5332
5861
  /**
5333
- * Create supply intent only (without relay submit to Solver API)
5334
- * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
5335
- * In order to successfully supply tokens, you need to:
5336
- * 1. Check if the allowance is sufficient
5337
- * 2. Approve the asset manager contract to spend the tokens
5338
- * 3. Supply the tokens
5339
- * 4. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
5340
- *
5341
- * @param params - The parameters for the supply transaction.
5342
- * @param spokeProvider - The spoke provider.
5343
- * @param raw - Whether to return the raw transaction data.
5344
- * @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} - Returns the transaction result.
5345
- *
5346
- * @example
5347
- * const moneyMarketService = new MoneyMarketService(config);
5348
- * const result = await moneyMarketService.createSupplyIntent(
5349
- * {
5350
- * token: "0x123...", // token address
5351
- * amount: 1000000000000000000n // 1 token in wei
5352
- * },
5353
- * spokeProvider,
5354
- * raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
5355
- * );
5356
- *
5357
- * if (result.ok) {
5358
- * const txHash = result.value;
5359
- * console.log('Supply transaction hash:', txHash);
5360
- * } else {
5361
- * console.error('Supply failed:', result.error);
5362
- * }
5862
+ * Get user-specific reserve data
5863
+ * @param userAddress Address of the user
5864
+ * @param uiPoolDataProvider - The address of the UI Pool Data Provider
5865
+ * @param poolAddressesProvider - The address of the Pool Addresses Provider
5866
+ * @returns {Promise<readonly [readonly UserReserveData[], number]>} - Tuple containing array of user reserve data and eMode category ID
5363
5867
  */
5364
- createSupplyIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketSupplyParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED'>> & MoneyMarketOptionalExtraData>;
5868
+ getUserReservesData(userAddress: Address$1): Promise<readonly [readonly UserReserveData[], number]>;
5365
5869
  /**
5366
- * Borrow tokens from the money market pool, relay the transaction to the hub and submit the intent to the Solver API
5367
- * @param params - The parameters for the borrow transaction.
5368
- * @param spokeProvider - The spoke provider.
5369
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
5370
- * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
5371
- *
5372
- * @example
5373
- * const result = await moneyMarketService.borrow(
5374
- * {
5375
- * token: '0x...', // Address of the token (spoke chain address) to borrow
5376
- * amount: 1000n, // Amount to borrow (in token decimals)
5377
- * },
5378
- * spokeProvider,
5379
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
5380
- * );
5381
- *
5382
- * if (!result.ok) {
5383
- * // Handle error
5384
- * }
5385
- *
5386
- * const [
5387
- * spokeTxHash, // transaction hash on the spoke chain
5388
- * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
5389
- * ] = result.value;
5390
- * console.log('Borrow transaction hashes:', { spokeTxHash, hubTxHash });
5870
+ * Get the reserves data humanized
5871
+ * @returns {Promise<ReservesDataHumanized>} - The reserves data humanized
5391
5872
  */
5392
- borrow<S extends SpokeProvider>(params: MoneyMarketBorrowParams, spokeProvider: S, timeout?: number): Promise<Result<[
5393
- SpokeTxHash,
5394
- HubTxHash
5395
- ], MoneyMarketError<'CREATE_BORROW_INTENT_FAILED' | 'BORROW_UNKNOWN_ERROR' | RelayErrorCode>>>;
5873
+ getReservesHumanized(): Promise<ReservesDataHumanized>;
5874
+ }
5875
+
5876
+ declare class LendingPoolService {
5877
+ private readonly hubProvider;
5878
+ private readonly lendingPool;
5879
+ constructor(hubProvider: EvmHubProvider);
5396
5880
  /**
5397
- * Create borrow intent only (without relay and submit to Solver API)
5398
- * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
5399
- * In order to successfully borrow tokens, you need to:
5400
- * 1. Execute the borrow transaction on the spoke chain
5401
- * 2. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
5402
- *
5403
- * @param params - The parameters for the borrow transaction.
5404
- * @param spokeProvider - The spoke provider.
5405
- * @param raw - Whether to return the raw transaction data.
5406
- * @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} - Returns the transaction result (raw transaction data or transaction hash).
5407
- *
5408
- * @example
5409
- * const moneyMarketService = new MoneyMarketService(config);
5410
- * const result = await moneyMarketService.createBorrowIntent(
5411
- * {
5412
- * token: "0x123...", // token address
5413
- * amount: 1000000000000000000n // 1 token in wei
5414
- * },
5415
- * spokeProvider,
5416
- * raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
5417
- * );
5418
- *
5419
- * if (result.ok) {
5420
- * const txHash = result.value;
5421
- * console.log('Borrow transaction hash:', txHash);
5422
- * } else {
5423
- * console.error('Borrow failed:', result.error);
5424
- * }
5881
+ * Get the list of all reserves in the lending pool
5882
+ * @returns {Promise<readonly Address[]>} - Array of reserve addresses
5425
5883
  */
5426
- createBorrowIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketBorrowParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketError<'CREATE_BORROW_INTENT_FAILED'>> & MoneyMarketOptionalExtraData>;
5884
+ getReservesList(): Promise<readonly Address$1[]>;
5427
5885
  /**
5428
- * Withdraw tokens from the money market pool, relay the transaction to the hub and submit the intent to the Solver API
5429
- *
5430
- * @param params - The parameters for the withdraw transaction.
5431
- * @param spokeProvider - The spoke provider.
5432
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
5433
- * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the spoke and hub transaction hashes or error
5434
- *
5435
- * @example
5436
- * const result = await moneyMarketService.withdraw(
5437
- * {
5438
- * token: '0x...', // Address of the token (spoke chain address) to withdraw
5439
- * amount: 1000n, // Amount to withdraw (in token decimals)
5440
- * },
5441
- * spokeProvider,
5442
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
5443
- * );
5444
- *
5445
- * if (!result.ok) {
5446
- * // Handle error
5447
- * }
5448
- *
5449
- * const [
5450
- * spokeTxHash, // transaction hash on the spoke chain
5451
- * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
5452
- * ] = result.value;
5453
- * console.log('Withdraw transaction hashes:', { spokeTxHash, hubTxHash });
5886
+ * Get detailed data for a reserve in the pool
5887
+ * @param assetAddress - The address of the asset
5888
+ * @returns {Promise<ReserveDataLegacy>} - Reserve data
5454
5889
  */
5455
- withdraw<S extends SpokeProvider>(params: MoneyMarketWithdrawParams, spokeProvider: S, timeout?: number): Promise<Result<[
5456
- SpokeTxHash,
5457
- HubTxHash
5458
- ], MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED' | 'WITHDRAW_UNKNOWN_ERROR' | RelayErrorCode>>>;
5890
+ getReserveData(assetAddress: Address$1): Promise<ReserveDataLegacy>;
5459
5891
  /**
5460
- * Create withdraw intent only (without relay and submit to Solver API)
5461
- * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
5462
- * In order to successfully withdraw tokens, you need to:
5463
- * 1. Execute the withdraw transaction on the spoke chain
5464
- * 2. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
5465
- *
5466
- * @param params - The parameters for the withdraw transaction.
5467
- * @param spokeProvider - The spoke provider.
5468
- * @param raw - Whether to return the raw transaction data.
5469
- * @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} - Returns the transaction result (raw transaction data or transaction hash).
5470
- *
5471
- * @example
5472
- * const moneyMarketService = new MoneyMarketService(config);
5473
- * const result = await moneyMarketService.createWithdrawIntent(
5474
- * {
5475
- * token: "0x123...", // token address
5476
- * amount: 1000000000000000000n // 1 token in wei
5477
- * },
5478
- * spokeProvider,
5479
- * raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
5480
- * );
5481
- *
5482
- * if (result.ok) {
5483
- * const txHash = result.value;
5484
- * console.log('Withdraw transaction hash:', txHash);
5485
- * } else {
5486
- * console.error('Withdraw failed:', result.error);
5487
- * }
5892
+ * Get the normalized income for a reserve
5893
+ * @param asset - The address of the asset
5894
+ * @returns {Promise<bigint>} - Normalized income
5488
5895
  */
5489
- createWithdrawIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketWithdrawParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED'>> & MoneyMarketOptionalExtraData>;
5896
+ getReserveNormalizedIncome(asset: Address$1): Promise<bigint>;
5897
+ }
5898
+
5899
+ declare class MoneyMarketDataService {
5900
+ readonly uiPoolDataProviderService: UiPoolDataProviderService;
5901
+ readonly lendingPoolService: LendingPoolService;
5902
+ readonly hubProvider: EvmHubProvider;
5903
+ constructor(hubProvider: EvmHubProvider);
5490
5904
  /**
5491
- * Repay tokens to the money market pool, relay the transaction to the hub and submit the intent to the Solver API
5492
- *
5493
- * @param params - The parameters for the repay transaction.
5494
- * @param spokeProvider - The spoke provider.
5495
- * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
5496
- * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the spoke and hub transaction hashes or error
5497
- *
5498
- * @example
5499
- * const result = await moneyMarketService.repay(
5500
- * {
5501
- * token: '0x...', // Address of the token (spoke chain address) to repay
5502
- * amount: 1000n, // Amount to repay (in token decimals)
5503
- * },
5504
- * spokeProvider,
5505
- * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
5506
- * );
5507
- *
5508
- * if (!result.ok) {
5509
- * // Handle error
5510
- * }
5511
- *
5512
- * const [
5513
- * spokeTxHash, // transaction hash on the spoke chain
5514
- * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
5515
- * ] = result.value;
5516
- * console.log('Repay transaction hashes:', { spokeTxHash, hubTxHash });
5905
+ * LendingPool
5517
5906
  */
5518
- repay<S extends SpokeProvider>(params: MoneyMarketRepayParams, spokeProvider: S, timeout?: number): Promise<Result<[
5519
- SpokeTxHash,
5520
- HubTxHash
5521
- ], MoneyMarketError<'CREATE_REPAY_INTENT_FAILED' | 'REPAY_UNKNOWN_ERROR' | RelayErrorCode>>>;
5522
5907
  /**
5523
- * Create repay intent only (without relay and submit to Solver API)
5524
- * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
5525
- * In order to successfully repay tokens, you need to:
5526
- * 1. Check if the allowance is sufficient
5527
- * 2. Approve the asset manager contract to spend the tokens
5528
- * 3. Execute the repay transaction on the spoke chain
5529
- * 4. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
5530
- *
5531
- * @param params - The parameters for the repay transaction.
5532
- * @param spokeProvider - The spoke provider.
5533
- * @param raw - Whether to return the raw transaction data.
5534
- * @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} The transaction result (raw transaction data or transaction hash) or error.
5535
- *
5536
- * @example
5537
- * const moneyMarketService = new MoneyMarketService(config);
5538
- * const result = await moneyMarketService.createRepayIntent(
5539
- * {
5540
- * token: "0x123...", // token address
5541
- * amount: 1000000000000000000n // 1 token in wei
5542
- * },
5543
- * spokeProvider,
5544
- * raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
5545
- * );
5546
- *
5547
- * if (result.ok) {
5548
- * const txHash = result.value;
5549
- * console.log('Repay transaction hash:', txHash);
5550
- * } else {
5551
- * console.error('Repay failed:', result.error);
5552
- * }
5908
+ * Get the normalized income for a reserve
5909
+ * @param asset - The address of the asset
5910
+ * @returns {Promise<bigint>} - Normalized income
5553
5911
  */
5554
- 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>;
5912
+ getReserveNormalizedIncome(asset: Address$1): Promise<bigint>;
5555
5913
  /**
5556
- * Build transaction data for supplying to the money market pool
5557
- * @param token - The address of the token on spoke chain
5558
- * @param to - The user wallet address on the hub chain
5559
- * @param amount - The amount to deposit
5560
- * @param spokeChainId - The chain ID of the spoke chain
5561
- * @returns {Hex} The transaction data.
5914
+ * Get the reserve data for an asset
5915
+ * @param asset - The address of the asset
5916
+ * @returns {Promise<ReserveDataLegacy>} - The reserve data
5562
5917
  */
5563
- buildSupplyData(token: string, to: Address$1, amount: bigint, spokeChainId: SpokeChainId): Hex;
5918
+ getReserveData(asset: Address$1): Promise<ReserveDataLegacy>;
5564
5919
  /**
5565
- * Build transaction data for borrowing from the money market pool
5566
- * @param from - The user wallet address on the hub chain
5567
- * @param to - The user wallet address on the spoke chain
5568
- * @param token - The address of the token to borrow
5569
- * @param amount - The amount to borrow in hub chain decimals
5570
- * @param spokeChainId - The chain ID of the spoke chain
5571
- * @returns {Hex} The transaction data.
5920
+ * UiPoolDataProvider
5572
5921
  */
5573
- buildBorrowData(from: Address$1, to: Address$1 | Hex, token: string, amount: bigint, spokeChainId: SpokeChainId): Hex;
5574
5922
  /**
5575
- * Build transaction data for withdrawing from the money market pool
5576
- * @param from - The user wallet address on the hub chain
5577
- * @param to - The user wallet address on the spoke chain
5578
- * @param token - The address of the token to borrow
5579
- * @param amount - The amount to borrow in hub chain decimals
5580
- * @param spokeChainId - The chain ID of the spoke chain
5581
- * @returns {Hex} The transaction data.
5923
+ * Get the reserves list
5924
+ * @returns {Promise<readonly Address[]>} - List of reserve asset addresses
5582
5925
  */
5583
- buildWithdrawData(from: Address$1, to: Address$1, token: string, amount: bigint, spokeChainId: SpokeChainId): Hex;
5926
+ getReservesList(): Promise<readonly Address$1[]>;
5584
5927
  /**
5585
- * Build transaction data for repaying to the money market pool
5586
- * @param token - The address of the token to repay
5587
- * @param to - The user wallet address on the hub chain
5588
- * @param amount - The amount to repay
5589
- * @param spokeChainId - The chain ID of the spoke chain
5590
- * @returns {Hex} The transaction data.
5928
+ * Get the reserves data
5929
+ * @returns {Promise<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>} - The reserves data
5591
5930
  */
5592
- buildRepayData(token: string, to: Address$1, amount: bigint, spokeChainId: SpokeChainId): Hex;
5931
+ getReservesData(): Promise<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>;
5593
5932
  /**
5594
- * Get the list of all reserves in the pool
5595
- * @param uiPoolDataProvider - The address of the UI Pool Data Provider
5596
- * @param poolAddressesProvider - The address of the Pool Addresses Provider
5597
- * @returns {Promise<readonly Address[]>} - Array of reserve addresses
5933
+ * Get the user reserves data
5934
+ * @param spokeProvider - The spoke provider
5935
+ * @returns {Promise<readonly [readonly UserReserveData[], number]>} - The user reserves data
5598
5936
  */
5599
- getReservesList(uiPoolDataProvider: Address$1, poolAddressesProvider: Address$1): Promise<readonly Address$1[]>;
5937
+ getUserReservesData(spokeProvider: SpokeProvider): Promise<readonly [readonly UserReserveData[], number]>;
5600
5938
  /**
5601
- * Get detailed data for all reserves in the pool
5602
- * @param uiPoolDataProvider - The address of the UI Pool Data Provider
5603
- * @param poolAddressesProvider - The address of the Pool Addresses Provider
5604
- * @returns {Promise<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>} - Tuple containing array of reserve data and base currency info
5939
+ * Get the list of all eModes in the pool
5940
+ * @returns {Promise<readonly EModeData[]>} - Array of eMode data
5605
5941
  */
5606
- getReservesData(uiPoolDataProvider: Address$1, poolAddressesProvider: Address$1): Promise<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>;
5942
+ getEModes(): Promise<readonly EModeData[]>;
5607
5943
  /**
5608
- * Get detailed data for a reserve in the pool
5609
- * @param poolAddress - The address of the pool
5610
- * @param assetAddress - The address of the asset
5611
- * @returns Tuple containing array of reserve data and base currency info
5944
+ * Get the list of all eModes in the pool humanized
5945
+ * @returns {Promise<EmodeDataHumanized[]>} - Array of eMode data humanized
5612
5946
  */
5613
- getReserveData(poolAddress: Address$1, assetAddress: Address$1): Promise<ReserveDataLegacy>;
5947
+ getEModesHumanized(): Promise<EmodeDataHumanized[]>;
5614
5948
  /**
5615
- * Calculate aToken amount from actual amount using liquidityIndex
5616
- * @param amount - The actual amount
5617
- * @param normalizedIncome - The current normalized income from reserve data
5618
- * @returns {bigint} The equivalent aToken amount
5949
+ * Get the reserves data humanized
5950
+ * @returns {Promise<ReservesDataHumanized>} - The reserves data humanized
5619
5951
  */
5620
- static calculateATokenAmount(amount: bigint, normalizedIncome: bigint): bigint;
5952
+ getReservesHumanized(): Promise<ReservesDataHumanized>;
5621
5953
  /**
5622
- * Get the normalized income for a reserve
5623
- * @param poolAddress The address of the pool
5624
- * @param asset The address of the asset
5625
- * @returns The normalized income
5954
+ * Get the user reserves humanized
5955
+ * @param spokeProvider - The spoke provider
5956
+ * @returns {Promise<{userReserves: UserReserveDataHumanized[], userEmodeCategoryId: number}>} - The user reserves humanized
5626
5957
  */
5627
- getReserveNormalizedIncome(poolAddress: Address$1, asset: Address$1): Promise<bigint>;
5958
+ getUserReservesHumanized(spokeProvider: SpokeProvider): Promise<{
5959
+ userReserves: UserReserveDataHumanized[];
5960
+ userEmodeCategoryId: number;
5961
+ }>;
5628
5962
  /**
5629
- * Get user-specific reserve data
5630
- * @param userAddress Address of the user
5631
- * @param uiPoolDataProvider - The address of the UI Pool Data Provider
5632
- * @param poolAddressesProvider - The address of the Pool Addresses Provider
5633
- * @returns {Promise<readonly [readonly UserReserveData[], number]>} - Tuple containing array of user reserve data and eMode category ID
5634
- */
5635
- getUserReservesData(userAddress: Address$1, uiPoolDataProvider: Address$1, poolAddressesProvider: Address$1): Promise<readonly [readonly UserReserveData[], number]>;
5636
- /**
5637
- * Encodes a supply transaction for a money market pool.
5638
- * @param {MoneyMarketEncodeWithdrawParams} params - The parameters for the supply transaction.
5639
- * @param {Address} lendingPool - The address of the lending pool contract.
5640
- * @returns {EvmContractCall} The encoded contract call.
5641
- */
5642
- static encodeSupply(params: MoneyMarketEncodeSupplyParams, lendingPool: Address$1): EvmContractCall;
5643
- /**
5644
- * Encodes a withdraw transaction from a pool.
5645
- * @param {MoneyMarketEncodeWithdrawParams} params - The parameters for the withdraw transaction.
5646
- * @param {Address} params.asset - The address of the asset to withdraw.
5647
- * @param {bigint} params.amount - The amount of the asset to withdraw.
5648
- * @param {Address} params.to - The address that will receive the withdrawn assets.
5649
- * @param {Address} lendingPool - The address of the lending pool contract.
5650
- * @returns {EvmContractCall} The encoded contract call.
5651
- */
5652
- static encodeWithdraw(params: MoneyMarketEncodeWithdrawParams, lendingPool: Address$1): EvmContractCall;
5653
- /**
5654
- * Encodes a borrow transaction from a pool.
5655
- * @param {MoneyMarketEncodeBorrowParams} params - The parameters for the borrow transaction.
5656
- * @param {Address} lendingPool - The address of the lending pool contract.
5657
- * @returns {EvmContractCall} The encoded contract call.
5658
- */
5659
- static encodeBorrow(params: MoneyMarketEncodeBorrowParams, lendingPool: Address$1): EvmContractCall;
5660
- /**
5661
- * Encodes a repay transaction for a pool.
5662
- * @param {MoneyMarketEncodeRepayParams} params - The parameters for the repay transaction.
5663
- * @param {Address} params.asset - The address of the borrowed asset to repay.
5664
- * @param {bigint} params.amount - The amount to repay. Use type(uint256).max to repay the entire debt.
5665
- * @param {number} params.interestRateMode - The interest rate mode (2 for Variable).
5666
- * @param {Address} params.onBehalfOf - The address of the user who will get their debt reduced/removed.
5667
- * @param {Address} lendingPool - The address of the lending pool contract.
5668
- * @returns {EvmContractCall} The encoded contract call.
5669
- */
5670
- static encodeRepay(params: MoneyMarketEncodeRepayParams, lendingPool: Address$1): EvmContractCall;
5671
- /**
5672
- * Encodes a repayWithATokens transaction for a pool.
5673
- * @param {MoneyMarketEncodeRepayWithATokensParams} params - The parameters for the repayWithATokens transaction.
5674
- * @param {Address} lendingPool - The address of the lending pool contract.
5675
- * @returns {EvmContractCall} The encoded contract call.
5676
- */
5677
- static encodeRepayWithATokens(params: MoneyMarketEncodeRepayWithATokensParams, lendingPool: Address$1): EvmContractCall;
5678
- /**
5679
- * Encodes a setUserUseReserveAsCollateral transaction.
5680
- * @param asset - The address of the underlying asset to be used as collateral.
5681
- * @param useAsCollateral - True to enable the asset as collateral, false to disable.
5682
- * @param lendingPool - The address of lending pool contract
5683
- * @returns The encoded contract call.
5684
- */
5685
- static encodeSetUserUseReserveAsCollateral(asset: Address$1, useAsCollateral: boolean, lendingPool: Address$1): EvmContractCall;
5686
- /**
5687
- * Get the list of all supported money market tokens (supply / borrow tokens) for a given spoke chain ID
5688
- * @param chainId The chain ID
5689
- * @returns {readonly Token[]} - Array of supported tokens
5690
- */
5691
- getSupportedTokens(chainId: SpokeChainId): readonly Token[];
5692
- /**
5693
- * Get the list of all supported money market reserves (supply / borrow reserves)
5694
- * NOTE: reserve addresses are on the hub chain and can be of type vault, erc20, etc.
5695
- * @returns {readonly Address[]} - Array of supported reserves
5696
- */
5697
- getSupportedReserves(): readonly Address$1[];
5698
- }
5699
-
5700
- declare class Erc20Service {
5701
- private constructor();
5702
- /**
5703
- * Check if spender has enough ERC20 allowance for given amount
5704
- * @param token - ERC20 token address
5705
- * @param amount - Amount to check allowance for
5706
- * @param owner - User wallet address
5707
- * @param spender - Spender address
5708
- * @param spokeProvider - EVM Spoke provider
5709
- * @return - True if spender is allowed to spend amount on behalf of owner
5710
- */
5711
- static isAllowanceValid(token: Address, amount: bigint, owner: Address, spender: Address, spokeProvider: EvmSpokeProvider | SonicSpokeProvider): Promise<Result<boolean>>;
5712
- /**
5713
- * Approve ERC20 amount spending
5714
- * @param token - ERC20 token address
5715
- * @param amount - Amount to approve
5716
- * @param spender - Spender address
5717
- * @param provider - EVM Provider
5718
- */
5719
- static approve<R extends boolean = false>(token: Address, amount: bigint, spender: Address, spokeProvider: EvmSpokeProvider | SonicSpokeProvider, raw?: R): PromiseEvmTxReturnType<R>;
5720
- /**
5721
- * Encodes a transfer transaction for a token.
5722
- * @param token - The address of the token.
5723
- * @param to - The address to transfer the token to.
5724
- * @param amount - The amount of the token to transfer.
5725
- * @returns The encoded contract call.
5726
- */
5727
- static encodeTransfer(token: Address, to: Address, amount: bigint): EvmContractCall;
5728
- /**
5729
- * Encodes a transferFrom transaction for a token.
5730
- * @param token - The address of the token.
5731
- * @param from - The address to transfer the token from.
5732
- * @param to - The address to transfer the token to.
5733
- * @param amount - The amount of the token to transfer.
5734
- * @returns The encoded contract call.
5735
- */
5736
- static encodeTransferFrom(token: Address, from: Address, to: Address, amount: bigint): EvmContractCall;
5737
- /**
5738
- * Encodes an approval transaction for a token.
5739
- * @param token - The address of the token.
5740
- * @param to - The address to approve the token to.
5741
- * @param amount - The amount of the token to approve.
5742
- * @returns The encoded contract call.
5743
- */
5744
- static encodeApprove(token: Address, to: Address, amount: bigint): EvmContractCall;
5745
- }
5746
-
5747
- type EvmSpokeDepositParams = {
5748
- from: Address;
5749
- to?: HubAddress;
5750
- token: Hex$1;
5751
- amount: bigint;
5752
- data: Hex$1;
5753
- };
5754
- declare class EvmSpokeService {
5755
- private constructor();
5756
- /**
5757
- * Estimates the gas necessary to complete a transaction without submitting it to the network.
5758
- *
5759
- * - Docs: https://viem.sh/docs/actions/public/estimateGas
5760
- * - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
5761
- *
5762
- * @param {EvmRawTransaction} rawTx - The raw transaction to estimate the gas for.
5763
- * @param {EvmSpokeProvider} spokeProvider - The EVM spoke provider.
5764
- * @returns {Promise<bigint>} Estimated gas for the transaction.
5765
- *
5766
- * @example
5767
- *
5768
- * const rawTx: EvmRawTransaction = {
5769
- * from: '0x1234...abcd', // sender address
5770
- * to: '0xabcd...1234', // recipient address
5771
- * value: 1000000000000000000n, // 1 ETH in wei
5772
- * data: '0x', // no calldata
5773
- * };
5774
- *
5775
- * // Assume spokeProvider is an initialized EvmSpokeProvider
5776
- * const estimatedGas = await EvmSpokeService.estimateGas(rawTx, spokeProvider);
5777
- * console.log(`Estimated gas: ${estimatedGas}`);
5778
- */
5779
- static estimateGas(rawTx: EvmRawTransaction, spokeProvider: EvmSpokeProvider): Promise<bigint>;
5780
- /**
5781
- * Deposit tokens to the spoke chain.
5782
- * @param {EvmSpokeDepositParams} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
5783
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
5784
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
5785
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
5786
- */
5787
- static deposit<R extends boolean = false>(params: EvmSpokeDepositParams, spokeProvider: EvmSpokeProvider, hubProvider: EvmHubProvider, raw?: R): PromiseEvmTxReturnType<R>;
5788
- /**
5789
- * Get the balance of the token in the spoke chain.
5790
- * @param {Address} token - The address of the token to get the balance of.
5791
- * @param {EvmSpokeProvider} spokeProvider - The spoke provider.
5792
- * @returns {Promise<bigint>} The balance of the token.
5793
- */
5794
- static getDeposit(token: Address, spokeProvider: EvmSpokeProvider): Promise<bigint>;
5795
- /**
5796
- * Calls a contract on the spoke chain using the user's wallet.
5797
- * @param {HubAddress} from - The address of the user on the hub chain.
5798
- * @param {Hex} payload - The payload to send to the contract.
5799
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
5800
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
5801
- * @param {boolean} raw - The return type raw or just transaction hash
5802
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
5963
+ * Utils for building requests
5803
5964
  */
5804
- static callWallet<R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider: EvmSpokeProvider, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<EvmSpokeProvider, R>>;
5805
5965
  /**
5806
- * Transfers tokens to the hub chain.
5807
- * @param {EvmTransferToHubParams} params - The parameters for the transfer, including:
5808
- * - {Address} token: The address of the token to transfer (use address(0) for native token).
5809
- * - {Address} recipient: The recipient address on the hub chain.
5810
- * - {bigint} amount: The amount to transfer.
5811
- * - {Hex} [data="0x"]: Additional data for the transfer.
5812
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
5813
- * @param {boolean} raw - The return type raw or just transaction hash
5814
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
5966
+ * @description Util function to build the request for the formatReserves function
5815
5967
  */
5816
- private static transfer;
5968
+ buildReserveDataWithPrice(reserves: ReservesDataHumanized): FormatReservesUSDRequest<ReserveDataWithPrice>;
5817
5969
  /**
5818
- * Sends a message to the hub chain.
5819
- * @param {bigint} dstChainId - The chain ID of the hub chain.
5820
- * @param {Address} dstAddress - The address on the hub chain.
5821
- * @param {Hex} payload - The payload to send.
5822
- * @param {EvmSpokeProvider} spokeProvider - The provider for the spoke chain.
5823
- * @param {boolean} raw - The return type raw or just transaction hash
5824
- * @returns {PromiseEvmTxReturnType<R>} A promise that resolves to the transaction hash.
5970
+ * @description Util function to build the request for the formatReserves function
5825
5971
  */
5826
- private static call;
5827
- }
5828
-
5829
- /**
5830
- * SpokeService is a main class that provides functionalities for dealing with spoke chains.
5831
- * It uses command pattern to execute different spoke chain operations.
5832
- */
5833
- declare class SpokeService {
5834
- private constructor();
5972
+ buildUserSummaryRequest(reserves: ReservesDataHumanized, formattedReserves: (ReserveData & {
5973
+ priceInMarketReferenceCurrency: string;
5974
+ } & FormatReserveUSDResponse)[], userReserves: {
5975
+ userReserves: UserReserveDataHumanized[];
5976
+ userEmodeCategoryId: number;
5977
+ }): FormatUserSummaryRequest<FormatReserveUSDResponse>;
5835
5978
  /**
5836
- * Estimate the gas for a raw transaction.
5837
- * @param {TxReturnType<T, true>} params - The parameters for the raw transaction.
5838
- * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
5839
- * @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
5979
+ * Formatted data
5840
5980
  */
5841
- static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
5842
5981
  /**
5843
- * Deposit tokens to the spoke chain.
5844
- * @param {GetSpokeDepositParamsType<T extends SpokeProvider>} params - The parameters for the deposit, including the user's address, token address, amount, and additional data.
5845
- * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
5846
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
5847
- * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
5982
+ * @description computes additional fields and normalizes numbers into human readable decimals
5983
+ * In addition to that it also converts the numbers to USD
5984
+ * @param {FormatReservesUSDRequest<ReserveDataWithPrice>} - the request parameters
5985
+ * @returns {FormatReserveUSDResponse<FormatReservesUSDRequest>} - an array of formatted configuration and live usage data for each reserve in a Sodax market
5848
5986
  */
5849
- static deposit<T extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: GetSpokeDepositParamsType<T>, spokeProvider: T, hubProvider: EvmHubProvider, raw?: R): Promise<PromiseTxReturnType<T, R>>;
5987
+ formatReservesUSD(params: FormatReservesUSDRequest<ReserveDataWithPrice>): (ReserveData & {
5988
+ priceInMarketReferenceCurrency: string;
5989
+ } & FormatReserveUSDResponse)[];
5850
5990
  /**
5851
- * Get the balance of the token in the spoke chain.
5852
- * @param {Address} token - The address of the token to get the balance of.
5853
- * @param {SpokeProvider} spokeProvider - The spoke provider.
5854
- * @returns {Promise<bigint>} The balance of the token.
5991
+ * @description computes additional fields and normalizes numbers into human readable decimals
5992
+ * In addition to that it also converts the numbers to USD
5993
+ * @param FormatReserveUSDRequest - the request parameters
5994
+ * @returns an array of formatted configuration and live usage data for each reserve in a Sodax market
5855
5995
  */
5856
- static getDeposit(token: Address$1, spokeProvider: SpokeProvider): Promise<bigint>;
5996
+ formatReserveUSD(params: FormatReserveUSDRequest): FormatReserveUSDResponse;
5857
5997
  /**
5858
- * Calls a contract on the spoke chain using the user's wallet.
5859
- * @param {HubAddress} from - The address of the user on the hub chain.
5860
- * @param {Hex} payload - The payload to send to the contract.
5861
- * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
5862
- * @param {EvmHubProvider} hubProvider - The provider for the hub chain.
5863
- * @returns {Promise<Hash>} A promise that resolves to the transaction hash.
5998
+ * Returns formatted summary of Sodax money market user portfolio (holdings, total liquidity,
5999
+ * collateral, borrows, liquidation threshold, health factor, available borrowing power, etc..)
6000
+ * @param {FormatUserSummaryRequest<FormatReserveUSDResponse>} - the request parameters
6001
+ * @returns {FormatReserveUSDResponse<FormatUserSummaryRequest>} - a formatted summary of Sodax user portfolio
5864
6002
  */
5865
- static callWallet<T extends SpokeProvider = SpokeProvider, R extends boolean = false>(from: HubAddress, payload: Hex$1, spokeProvider: T, hubProvider: EvmHubProvider, raw?: R): Promise<TxReturnType<T, R>>;
6003
+ formatUserSummary(params: FormatUserSummaryRequest<FormatReserveUSDResponse>): FormatUserSummaryResponse<FormatReserveUSDResponse>;
5866
6004
  }
6005
+ declare function formatPercentage(value: bigint, decimals?: number): string;
6006
+ declare function formatBasisPoints(value: bigint): string;
5867
6007
 
5868
6008
  type SonicSpokeDepositParams = {
5869
6009
  from: Address;
@@ -5945,7 +6085,7 @@ declare class SonicSpokeService {
5945
6085
  * @param moneyMarketService - The money market service
5946
6086
  * @returns {WithdrawInfo} WithdrawInfo containing aToken address, amount and vault address
5947
6087
  */
5948
- static getWithdrawInfo(token: Address, amount: bigint, spokeProvider: SonicSpokeProvider, moneyMarketService: MoneyMarketService): Promise<WithdrawInfo>;
6088
+ static getWithdrawInfo(token: Address, amount: bigint, spokeProvider: SonicSpokeProvider, dataService: MoneyMarketDataService): Promise<WithdrawInfo>;
5949
6089
  /**
5950
6090
  * Get borrow information for a given token
5951
6091
  * @param token - The address of the underlying token
@@ -5954,7 +6094,7 @@ declare class SonicSpokeService {
5954
6094
  * @param moneyMarketService - The money market service
5955
6095
  * @returns BorrowInfo containing variable debt token address and vault address
5956
6096
  */
5957
- static getBorrowInfo(token: Address, amount: bigint, chainId: SpokeChainId, moneyMarketService: MoneyMarketService): Promise<BorrowInfo>;
6097
+ static getBorrowInfo(token: Address, amount: bigint, chainId: SpokeChainId, dataService: MoneyMarketDataService): Promise<BorrowInfo>;
5958
6098
  /**
5959
6099
  * Check if the user has approved the withdrawal of tokens from the spoke chain using the Sonic wallet abstraction.
5960
6100
  * @param from - The address of the user on the spoke chain
@@ -6177,8 +6317,8 @@ declare class SolverService {
6177
6317
  * - spokeProvider: The spoke provider instance.
6178
6318
  * - fee: (Optional) Partner fee configuration.
6179
6319
  * - timeout: (Optional) Timeout in milliseconds for the transaction (default: 60 seconds).
6180
- * @returns {Promise<Result<[SolverExecutionResponse, Intent, Hex], IntentError<IntentErrorCode>>>}
6181
- * A promise resolving to a Result containing a tuple of SolverExecutionResponse, Intent, and packet data (Hex),
6320
+ * @returns {Promise<Result<[SolverExecutionResponse, Intent, IntentDeliveryInfo], IntentError<IntentErrorCode>>>}
6321
+ * A promise resolving to a Result containing a tuple of SolverExecutionResponse, Intent, and intent delivery info,
6182
6322
  * or an IntentError if the operation fails.
6183
6323
  *
6184
6324
  * @example
@@ -6203,15 +6343,15 @@ declare class SolverService {
6203
6343
  * });
6204
6344
  *
6205
6345
  * if (swapResult.ok) {
6206
- * const [solverExecutionResponse, intent, packetData] = swapResult.value;
6346
+ * const [solverExecutionResponse, intent, intentDeliveryInfo] = swapResult.value;
6207
6347
  * console.log('Intent execution response:', solverExecutionResponse);
6208
6348
  * console.log('Intent:', intent);
6209
- * console.log('Packet data:', packetData);
6349
+ * console.log('Intent delivery info:', intentDeliveryInfo);
6210
6350
  * } else {
6211
6351
  * // handle error
6212
6352
  * }
6213
6353
  */
6214
- swap<S extends SpokeProvider>({ intentParams: params, spokeProvider, fee, timeout, }: Prettify<SwapParams<S> & OptionalTimeout>): Promise<Result<[SolverExecutionResponse, Intent, Hex$1], IntentError<IntentErrorCode>>>;
6354
+ swap<S extends SpokeProvider>({ intentParams: params, spokeProvider, fee, timeout, }: Prettify<SwapParams<S> & OptionalTimeout>): Promise<Result<[SolverExecutionResponse, Intent, IntentDeliveryInfo], IntentError<IntentErrorCode>>>;
6215
6355
  /**
6216
6356
  * Creates an intent and submits it to the Solver API and Relayer API
6217
6357
  * @param {Prettify<SwapParams<S> & OptionalTimeout>} params - Object containing:
@@ -6219,8 +6359,8 @@ declare class SolverService {
6219
6359
  * - spokeProvider: The spoke provider instance.
6220
6360
  * - fee: (Optional) Partner fee configuration.
6221
6361
  * - timeout: (Optional) Timeout in milliseconds for the transaction (default: 60 seconds).
6222
- * @returns {Promise<Result<[SolverExecutionResponse, Intent, Hex], IntentError<IntentErrorCode>>>}
6223
- * A promise resolving to a Result containing a tuple of SolverExecutionResponse, Intent, and packet data (Hex),
6362
+ * @returns {Promise<Result<[SolverExecutionResponse, Intent, IntentDeliveryInfo], IntentError<IntentErrorCode>>>}
6363
+ * A promise resolving to a Result containing a tuple of SolverExecutionResponse, Intent, and intent delivery info,
6224
6364
  * or an IntentError if the operation fails.
6225
6365
  *
6226
6366
  * @example
@@ -6246,21 +6386,20 @@ declare class SolverService {
6246
6386
  *
6247
6387
  *
6248
6388
  * if (createAndSubmitIntentResult.ok) {
6249
- * const [solverExecutionResponse, intent, packetData] = createAndSubmitIntentResult.value;
6389
+ * const [solverExecutionResponse, intent, intentDeliveryInfo] = createAndSubmitIntentResult.value;
6250
6390
  * console.log('Intent execution response:', solverExecutionResponse);
6251
6391
  * console.log('Intent:', intent);
6252
- * console.log('Packet data:', packetData);
6392
+ * console.log('Intent delivery info:', intentDeliveryInfo);
6253
6393
  * } else {
6254
6394
  * // handle error
6255
6395
  * }
6256
6396
  */
6257
- createAndSubmitIntent<S extends SpokeProvider>({ intentParams: params, spokeProvider, fee, timeout, }: Prettify<SwapParams<S> & OptionalTimeout>): Promise<Result<[SolverExecutionResponse, Intent, Hex$1], IntentError<IntentErrorCode>>>;
6397
+ createAndSubmitIntent<S extends SpokeProvider>({ intentParams: params, spokeProvider, fee, timeout, }: Prettify<SwapParams<S> & OptionalTimeout>): Promise<Result<[SolverExecutionResponse, Intent, IntentDeliveryInfo], IntentError<IntentErrorCode>>>;
6258
6398
  /**
6259
6399
  * Check whether the Asset Manager contract is allowed to spend the specified amount of tokens
6260
6400
  * @param {Prettify<SwapParams<S>} params - Object containing:
6261
6401
  * - intentParams: The parameters for creating the intent.
6262
6402
  * - spokeProvider: The spoke provider instance.
6263
- * - fee: (Optional) Partner fee configuration.
6264
6403
  * @returns {Promise<Result<boolean>>} - Returns true if allowance is sufficient, false if approval is needed
6265
6404
  *
6266
6405
  * @example
@@ -6292,13 +6431,12 @@ declare class SolverService {
6292
6431
  * console.log('Approval required');
6293
6432
  * }
6294
6433
  */
6295
- isAllowanceValid<S extends SpokeProvider>({ intentParams: params, spokeProvider, fee, }: SwapParams<S>): Promise<Result<boolean>>;
6434
+ isAllowanceValid<S extends SpokeProvider>({ intentParams: params, spokeProvider, }: SwapParams<S>): Promise<Result<boolean>>;
6296
6435
  /**
6297
6436
  * Approve the Asset Manager contract to spend tokens on behalf of the user (required for EVM chains)
6298
6437
  * @param {Prettify<SwapParams<S> & OptionalRaw<R>>} params - Object containing:
6299
6438
  * - intentParams: The parameters for creating the intent.
6300
6439
  * - spokeProvider: The spoke provider instance.
6301
- * - fee: (Optional) Partner fee configuration.
6302
6440
  * - raw: (Optional) Whether to return the raw transaction data instead of executing it
6303
6441
  * @returns {Promise<Result<TxReturnType<S, R>>>} - Returns transaction hash or raw transaction data
6304
6442
  *
@@ -6332,7 +6470,7 @@ declare class SolverService {
6332
6470
  * console.log('Approval transaction:', txHash);
6333
6471
  * }
6334
6472
  */
6335
- approve<S extends SpokeProvider, R extends boolean = false>({ intentParams: params, spokeProvider, fee, raw, }: Prettify<SwapParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>>>;
6473
+ approve<S extends SpokeProvider, R extends boolean = false>({ intentParams: params, spokeProvider, raw, }: Prettify<SwapParams<S> & OptionalRaw<R>>): Promise<Result<TxReturnType<S, R>>>;
6336
6474
  /**
6337
6475
  * Creates an intent by handling token approval and intent creation
6338
6476
  * NOTE: This method does not submit the intent to the Solver API
@@ -6341,7 +6479,7 @@ declare class SolverService {
6341
6479
  * - spokeProvider: The spoke provider instance.
6342
6480
  * - fee: (Optional) Partner fee configuration.
6343
6481
  * - raw: (Optional) Whether to return the raw transaction data instead of executing it
6344
- * @returns {Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount], IntentError<'CREATION_FAILED'>>>} The encoded contract call or raw transaction data
6482
+ * @returns {Promise<Result<[TxReturnType<S, R>, Intent & FeeAmount, Hex], IntentError<'CREATION_FAILED'>>>} The encoded contract call or raw transaction data, Intent and intent data as hex
6345
6483
  *
6346
6484
  * @example
6347
6485
  * const payload = {
@@ -6367,9 +6505,10 @@ declare class SolverService {
6367
6505
  * });
6368
6506
  *
6369
6507
  * if (createIntentResult.ok) {
6370
- * const [txResult, intent] = createIntentResult.value;
6508
+ * const [txResult, intent, intentData] = createIntentResult.value;
6509
+ * console.log('Transaction result:', txResult);
6371
6510
  * console.log('Intent:', intent);
6372
- * console.log('Packet data:', packetData);
6511
+ * console.log('Intent data:', intentData);
6373
6512
  * } else {
6374
6513
  * // handle error
6375
6514
  * }
@@ -6450,6 +6589,14 @@ type PacketData = {
6450
6589
  signatures: string[];
6451
6590
  payload: string;
6452
6591
  };
6592
+ type IntentDeliveryInfo = {
6593
+ srcChainId: SpokeChainId;
6594
+ srcTxHash: string;
6595
+ srcAddress: string;
6596
+ dstChainId: SpokeChainId;
6597
+ dstTxHash: string;
6598
+ dstAddress: string;
6599
+ };
6453
6600
  type GetTransactionPacketsResponse = {
6454
6601
  success: boolean;
6455
6602
  data: PacketData[];
@@ -7879,11 +8026,526 @@ declare class Sodax {
7879
8026
  readonly solver: SolverService;
7880
8027
  readonly moneyMarket: MoneyMarketService;
7881
8028
  readonly migration: MigrationService;
7882
- private readonly hubProvider;
7883
- private readonly relayerApiEndpoint;
8029
+ readonly hubProvider: EvmHubProvider;
8030
+ readonly relayerApiEndpoint: HttpUrl;
7884
8031
  constructor(config?: SodaxConfig);
7885
8032
  }
7886
8033
 
8034
+ type MoneyMarketEncodeSupplyParams = {
8035
+ asset: Address$1;
8036
+ amount: bigint;
8037
+ onBehalfOf: Address$1;
8038
+ referralCode: number;
8039
+ };
8040
+ type MoneyMarketEncodeWithdrawParams = {
8041
+ asset: Address$1;
8042
+ amount: bigint;
8043
+ to: Address$1;
8044
+ };
8045
+ type MoneyMarketEncodeBorrowParams = {
8046
+ asset: Address$1;
8047
+ amount: bigint;
8048
+ interestRateMode: bigint;
8049
+ referralCode: number;
8050
+ onBehalfOf: Address$1;
8051
+ };
8052
+ type MoneyMarketEncodeRepayParams = {
8053
+ asset: Address$1;
8054
+ amount: bigint;
8055
+ interestRateMode: bigint;
8056
+ onBehalfOf: Address$1;
8057
+ };
8058
+ type MoneyMarketEncodeRepayWithATokensParams = {
8059
+ asset: Address$1;
8060
+ amount: bigint;
8061
+ interestRateMode: bigint;
8062
+ };
8063
+ type MoneyMarketAction = 'supply' | 'borrow' | 'withdraw' | 'repay';
8064
+ type MoneyMarketSupplyParams = {
8065
+ token: string;
8066
+ amount: bigint;
8067
+ action: 'supply';
8068
+ };
8069
+ type MoneyMarketBorrowParams = {
8070
+ token: string;
8071
+ amount: bigint;
8072
+ action: 'borrow';
8073
+ };
8074
+ type MoneyMarketWithdrawParams = {
8075
+ token: string;
8076
+ amount: bigint;
8077
+ action: 'withdraw';
8078
+ };
8079
+ type MoneyMarketRepayParams = {
8080
+ token: string;
8081
+ amount: bigint;
8082
+ action: 'repay';
8083
+ };
8084
+ type MoneyMarketParams = MoneyMarketSupplyParams | MoneyMarketBorrowParams | MoneyMarketWithdrawParams | MoneyMarketRepayParams;
8085
+ type MoneyMarketUnknownErrorCode = 'SUPPLY_UNKNOWN_ERROR' | 'BORROW_UNKNOWN_ERROR' | 'WITHDRAW_UNKNOWN_ERROR' | 'REPAY_UNKNOWN_ERROR';
8086
+ type GetMoneyMarketParams<T extends MoneyMarketUnknownErrorCode> = T extends 'SUPPLY_UNKNOWN_ERROR' ? MoneyMarketSupplyParams : T extends 'BORROW_UNKNOWN_ERROR' ? MoneyMarketBorrowParams : T extends 'WITHDRAW_UNKNOWN_ERROR' ? MoneyMarketWithdrawParams : T extends 'REPAY_UNKNOWN_ERROR' ? MoneyMarketRepayParams : never;
8087
+ type MoneyMarketErrorCode = MoneyMarketUnknownErrorCode | RelayErrorCode | 'CREATE_SUPPLY_INTENT_FAILED' | 'CREATE_BORROW_INTENT_FAILED' | 'CREATE_WITHDRAW_INTENT_FAILED' | 'CREATE_REPAY_INTENT_FAILED';
8088
+ type MoneyMarketUnknownError<T extends MoneyMarketUnknownErrorCode> = {
8089
+ error: unknown;
8090
+ payload: GetMoneyMarketParams<T>;
8091
+ };
8092
+ type MoneyMarketSubmitTxFailedError = {
8093
+ error: RelayError;
8094
+ payload: SpokeTxHash;
8095
+ };
8096
+ type MoneyMarketSupplyFailedError = {
8097
+ error: unknown;
8098
+ payload: MoneyMarketSupplyParams;
8099
+ };
8100
+ type MoneyMarketBorrowFailedError = {
8101
+ error: unknown;
8102
+ payload: MoneyMarketBorrowParams;
8103
+ };
8104
+ type MoneyMarketWithdrawFailedError = {
8105
+ error: unknown;
8106
+ payload: MoneyMarketWithdrawParams;
8107
+ };
8108
+ type MoneyMarketRepayFailedError = {
8109
+ error: unknown;
8110
+ payload: MoneyMarketRepayParams;
8111
+ };
8112
+ type GetMoneyMarketError<T extends MoneyMarketErrorCode> = T extends 'SUBMIT_TX_FAILED' ? MoneyMarketSubmitTxFailedError : T extends 'RELAY_TIMEOUT' ? MoneyMarketSubmitTxFailedError : T extends 'CREATE_SUPPLY_INTENT_FAILED' ? MoneyMarketSupplyFailedError : T extends 'CREATE_BORROW_INTENT_FAILED' ? MoneyMarketBorrowFailedError : T extends 'CREATE_WITHDRAW_INTENT_FAILED' ? MoneyMarketWithdrawFailedError : T extends 'CREATE_REPAY_INTENT_FAILED' ? MoneyMarketRepayFailedError : T extends MoneyMarketUnknownErrorCode ? MoneyMarketUnknownError<T> : never;
8113
+ type MoneyMarketError<T extends MoneyMarketErrorCode> = {
8114
+ code: T;
8115
+ data: GetMoneyMarketError<T>;
8116
+ };
8117
+ type MoneyMarketExtraData = {
8118
+ address: Hex;
8119
+ payload: Hex;
8120
+ };
8121
+ type MoneyMarketOptionalExtraData = {
8122
+ data?: MoneyMarketExtraData;
8123
+ };
8124
+ declare class MoneyMarketService {
8125
+ readonly config: MoneyMarketServiceConfig;
8126
+ private readonly hubProvider;
8127
+ readonly data: MoneyMarketDataService;
8128
+ constructor(config: MoneyMarketConfigParams | undefined, hubProvider: EvmHubProvider, relayerApiEndpoint?: HttpUrl);
8129
+ /**
8130
+ * Estimate the gas for a raw transaction.
8131
+ * @param {TxReturnType<T, true>} params - The parameters for the raw transaction.
8132
+ * @param {SpokeProvider} spokeProvider - The provider for the spoke chain.
8133
+ * @returns {Promise<GetEstimateGasReturnType<T>>} A promise that resolves to the gas.
8134
+ */
8135
+ static estimateGas<T extends SpokeProvider = SpokeProvider>(params: TxReturnType<T, true>, spokeProvider: T): Promise<GetEstimateGasReturnType<T>>;
8136
+ /**
8137
+ * Check if allowance is sufficient for actions on the money market pool
8138
+ * @param {MoneyMarketParams} params - Money market params containing token address and amount
8139
+ * @param {SpokeProvider} spokeProvider - The spoke provider instance
8140
+ * @return {Promise<Result<boolean>>} - Returns true if allowance is sufficient, false otherwise
8141
+ *
8142
+ * @example
8143
+ * const allowanceValid = await isAllowanceValid({
8144
+ * token: '0x...', // Address of the token (spoke chain) to supply
8145
+ * amount: 1000n, // Amount to supply (in token decimals)
8146
+ * action: 'supply',
8147
+ * }, spokeProvider);
8148
+ *
8149
+ * if (!allowanceValid.ok) {
8150
+ * // Handle error
8151
+ * }
8152
+ *
8153
+ * if (!allowanceValid.value) {
8154
+ * // Need to approve
8155
+ * }
8156
+ */
8157
+ isAllowanceValid<S extends SpokeProvider>(params: MoneyMarketParams, spokeProvider: S): Promise<Result<boolean>>;
8158
+ /**
8159
+ * Approve amount spending if isAllowanceValid returns false.
8160
+ * For evm spoke chains, the spender is the asset manager contract while
8161
+ * for sonic spoke (hub) chain, the spender is the user router contract.
8162
+ * @param token - ERC20 token address
8163
+ * @param amount - Amount to approve
8164
+ * @param spender - Spender address
8165
+ * @param spokeProvider - Spoke provider
8166
+ * @returns {Promise<Result<TxReturnType<S, R>>>} - Returns the transaction receipt
8167
+ *
8168
+ * @example
8169
+ * const approveResult = await approve(
8170
+ * {
8171
+ * token: '0x...', // ERC20 token address
8172
+ * amount: 1000n, // Amount to approve (in token decimals)
8173
+ * action: 'supply', // Action to perform
8174
+ * },
8175
+ * spokeProvider,
8176
+ * raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
8177
+ * );
8178
+ *
8179
+ * if (!approveResult.ok) {
8180
+ * // Handle error
8181
+ * }
8182
+ *
8183
+ * const txReceipt = approveResult.value;
8184
+ */
8185
+ approve<S extends SpokeProvider, R extends boolean = false>(params: MoneyMarketParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>>>;
8186
+ /**
8187
+ * Supply tokens to the money market pool, relay the transaction to the hub and submit the intent to the Solver API
8188
+ * @param params - The parameters for the supply transaction.
8189
+ * @param spokeProvider - The spoke provider.
8190
+ * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
8191
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8192
+ *
8193
+ * @example
8194
+ * const result = await moneyMarketService.supply(
8195
+ * {
8196
+ * token: '0x...', // Address of the token (spoke chain address) to supply
8197
+ * amount: 1000n, // Amount to supply (in token decimals)
8198
+ * },
8199
+ * spokeProvider,
8200
+ * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
8201
+ * );
8202
+ *
8203
+ * if (!result.ok) {
8204
+ * // Handle error
8205
+ * }
8206
+ *
8207
+ * const [
8208
+ * spokeTxHash, // transaction hash on the spoke chain
8209
+ * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
8210
+ * ] = result.value;
8211
+ * console.log('Supply transaction hashes:', { spokeTxHash, hubTxHash });
8212
+ */
8213
+ supply<S extends SpokeProvider>(params: MoneyMarketSupplyParams, spokeProvider: S, timeout?: number): Promise<Result<[
8214
+ SpokeTxHash,
8215
+ HubTxHash
8216
+ ], MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED' | 'SUPPLY_UNKNOWN_ERROR' | RelayErrorCode>>>;
8217
+ /**
8218
+ * Create supply intent only (without relay submit to Solver API)
8219
+ * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
8220
+ * In order to successfully supply tokens, you need to:
8221
+ * 1. Check if the allowance is sufficient
8222
+ * 2. Approve the asset manager contract to spend the tokens
8223
+ * 3. Supply the tokens
8224
+ * 4. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
8225
+ *
8226
+ * @param params - The parameters for the supply transaction.
8227
+ * @param spokeProvider - The spoke provider.
8228
+ * @param raw - Whether to return the raw transaction data.
8229
+ * @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} - Returns the transaction result.
8230
+ *
8231
+ * @example
8232
+ * const moneyMarketService = new MoneyMarketService(config);
8233
+ * const result = await moneyMarketService.createSupplyIntent(
8234
+ * {
8235
+ * token: "0x123...", // token address
8236
+ * amount: 1000000000000000000n // 1 token in wei
8237
+ * },
8238
+ * spokeProvider,
8239
+ * raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
8240
+ * );
8241
+ *
8242
+ * if (result.ok) {
8243
+ * const txHash = result.value;
8244
+ * console.log('Supply transaction hash:', txHash);
8245
+ * } else {
8246
+ * console.error('Supply failed:', result.error);
8247
+ * }
8248
+ */
8249
+ createSupplyIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketSupplyParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED'>> & MoneyMarketOptionalExtraData>;
8250
+ /**
8251
+ * Borrow tokens from the money market pool, relay the transaction to the hub and submit the intent to the Solver API
8252
+ * @param params - The parameters for the borrow transaction.
8253
+ * @param spokeProvider - The spoke provider.
8254
+ * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
8255
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the transaction result and the hub transaction hash or error
8256
+ *
8257
+ * @example
8258
+ * const result = await moneyMarketService.borrow(
8259
+ * {
8260
+ * token: '0x...', // Address of the token (spoke chain address) to borrow
8261
+ * amount: 1000n, // Amount to borrow (in token decimals)
8262
+ * },
8263
+ * spokeProvider,
8264
+ * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
8265
+ * );
8266
+ *
8267
+ * if (!result.ok) {
8268
+ * // Handle error
8269
+ * }
8270
+ *
8271
+ * const [
8272
+ * spokeTxHash, // transaction hash on the spoke chain
8273
+ * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
8274
+ * ] = result.value;
8275
+ * console.log('Borrow transaction hashes:', { spokeTxHash, hubTxHash });
8276
+ */
8277
+ borrow<S extends SpokeProvider>(params: MoneyMarketBorrowParams, spokeProvider: S, timeout?: number): Promise<Result<[
8278
+ SpokeTxHash,
8279
+ HubTxHash
8280
+ ], MoneyMarketError<'CREATE_BORROW_INTENT_FAILED' | 'BORROW_UNKNOWN_ERROR' | RelayErrorCode>>>;
8281
+ /**
8282
+ * Create borrow intent only (without relay and submit to Solver API)
8283
+ * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
8284
+ * In order to successfully borrow tokens, you need to:
8285
+ * 1. Execute the borrow transaction on the spoke chain
8286
+ * 2. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
8287
+ *
8288
+ * @param params - The parameters for the borrow transaction.
8289
+ * @param spokeProvider - The spoke provider.
8290
+ * @param raw - Whether to return the raw transaction data.
8291
+ * @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} - Returns the transaction result (raw transaction data or transaction hash).
8292
+ *
8293
+ * @example
8294
+ * const moneyMarketService = new MoneyMarketService(config);
8295
+ * const result = await moneyMarketService.createBorrowIntent(
8296
+ * {
8297
+ * token: "0x123...", // token address
8298
+ * amount: 1000000000000000000n // 1 token in wei
8299
+ * },
8300
+ * spokeProvider,
8301
+ * raw // Optional: true = return the raw transaction data, false = execute and return the transaction hash (default: false)
8302
+ * );
8303
+ *
8304
+ * if (result.ok) {
8305
+ * const txHash = result.value;
8306
+ * console.log('Borrow transaction hash:', txHash);
8307
+ * } else {
8308
+ * console.error('Borrow failed:', result.error);
8309
+ * }
8310
+ */
8311
+ createBorrowIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketBorrowParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketError<'CREATE_BORROW_INTENT_FAILED'>> & MoneyMarketOptionalExtraData>;
8312
+ /**
8313
+ * Withdraw tokens from the money market pool, relay the transaction to the hub and submit the intent to the Solver API
8314
+ *
8315
+ * @param params - The parameters for the withdraw transaction.
8316
+ * @param spokeProvider - The spoke provider.
8317
+ * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
8318
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the spoke and hub transaction hashes or error
8319
+ *
8320
+ * @example
8321
+ * const result = await moneyMarketService.withdraw(
8322
+ * {
8323
+ * token: '0x...', // Address of the token (spoke chain address) to withdraw
8324
+ * amount: 1000n, // Amount to withdraw (in token decimals)
8325
+ * },
8326
+ * spokeProvider,
8327
+ * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
8328
+ * );
8329
+ *
8330
+ * if (!result.ok) {
8331
+ * // Handle error
8332
+ * }
8333
+ *
8334
+ * const [
8335
+ * spokeTxHash, // transaction hash on the spoke chain
8336
+ * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
8337
+ * ] = result.value;
8338
+ * console.log('Withdraw transaction hashes:', { spokeTxHash, hubTxHash });
8339
+ */
8340
+ withdraw<S extends SpokeProvider>(params: MoneyMarketWithdrawParams, spokeProvider: S, timeout?: number): Promise<Result<[
8341
+ SpokeTxHash,
8342
+ HubTxHash
8343
+ ], MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED' | 'WITHDRAW_UNKNOWN_ERROR' | RelayErrorCode>>>;
8344
+ /**
8345
+ * Create withdraw intent only (without relay and submit to Solver API)
8346
+ * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
8347
+ * In order to successfully withdraw tokens, you need to:
8348
+ * 1. Execute the withdraw transaction on the spoke chain
8349
+ * 2. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
8350
+ *
8351
+ * @param params - The parameters for the withdraw transaction.
8352
+ * @param spokeProvider - The spoke provider.
8353
+ * @param raw - Whether to return the raw transaction data.
8354
+ * @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} - Returns the transaction result (raw transaction data or transaction hash).
8355
+ *
8356
+ * @example
8357
+ * const moneyMarketService = new MoneyMarketService(config);
8358
+ * const result = await moneyMarketService.createWithdrawIntent(
8359
+ * {
8360
+ * token: "0x123...", // token address
8361
+ * amount: 1000000000000000000n // 1 token in wei
8362
+ * },
8363
+ * spokeProvider,
8364
+ * raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
8365
+ * );
8366
+ *
8367
+ * if (result.ok) {
8368
+ * const txHash = result.value;
8369
+ * console.log('Withdraw transaction hash:', txHash);
8370
+ * } else {
8371
+ * console.error('Withdraw failed:', result.error);
8372
+ * }
8373
+ */
8374
+ createWithdrawIntent<S extends SpokeProvider = SpokeProvider, R extends boolean = false>(params: MoneyMarketWithdrawParams, spokeProvider: S, raw?: R): Promise<Result<TxReturnType<S, R>, MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED'>> & MoneyMarketOptionalExtraData>;
8375
+ /**
8376
+ * Repay tokens to the money market pool, relay the transaction to the hub and submit the intent to the Solver API
8377
+ *
8378
+ * @param params - The parameters for the repay transaction.
8379
+ * @param spokeProvider - The spoke provider.
8380
+ * @param timeout - The timeout in milliseconds for the transaction. Default is 60 seconds.
8381
+ * @returns {Promise<Result<[SpokeTxHash, HubTxHash], MoneyMarketError>>} - Returns the spoke and hub transaction hashes or error
8382
+ *
8383
+ * @example
8384
+ * const result = await moneyMarketService.repay(
8385
+ * {
8386
+ * token: '0x...', // Address of the token (spoke chain address) to repay
8387
+ * amount: 1000n, // Amount to repay (in token decimals)
8388
+ * },
8389
+ * spokeProvider,
8390
+ * 30000 // Optional timeout in milliseconds (default: 60000, i.e. 60 seconds)
8391
+ * );
8392
+ *
8393
+ * if (!result.ok) {
8394
+ * // Handle error
8395
+ * }
8396
+ *
8397
+ * const [
8398
+ * spokeTxHash, // transaction hash on the spoke chain
8399
+ * hubTxHash, // transaction hash on the hub chain (i.e. the transaction that was relayed to the hub)
8400
+ * ] = result.value;
8401
+ * console.log('Repay transaction hashes:', { spokeTxHash, hubTxHash });
8402
+ */
8403
+ repay<S extends SpokeProvider>(params: MoneyMarketRepayParams, spokeProvider: S, timeout?: number): Promise<Result<[
8404
+ SpokeTxHash,
8405
+ HubTxHash
8406
+ ], MoneyMarketError<'CREATE_REPAY_INTENT_FAILED' | 'REPAY_UNKNOWN_ERROR' | RelayErrorCode>>>;
8407
+ /**
8408
+ * Create repay intent only (without relay and submit to Solver API)
8409
+ * NOTE: This method does not submit the intent to the Solver API, it only executes the transaction on the spoke chain
8410
+ * In order to successfully repay tokens, you need to:
8411
+ * 1. Check if the allowance is sufficient
8412
+ * 2. Approve the asset manager contract to spend the tokens
8413
+ * 3. Execute the repay transaction on the spoke chain
8414
+ * 4. Submit the intent to the Solver API and await it using relayTxAndWaitPacket method
8415
+ *
8416
+ * @param params - The parameters for the repay transaction.
8417
+ * @param spokeProvider - The spoke provider.
8418
+ * @param raw - Whether to return the raw transaction data.
8419
+ * @returns {Promise<Result<TxReturnType<S, R>, MoneyMarketErrorCode>>} The transaction result (raw transaction data or transaction hash) or error.
8420
+ *
8421
+ * @example
8422
+ * const moneyMarketService = new MoneyMarketService(config);
8423
+ * const result = await moneyMarketService.createRepayIntent(
8424
+ * {
8425
+ * token: "0x123...", // token address
8426
+ * amount: 1000000000000000000n // 1 token in wei
8427
+ * },
8428
+ * spokeProvider,
8429
+ * raw // Optional: true = return the raw transaction data, false = exeute and return the transaction hash (default: false)
8430
+ * );
8431
+ *
8432
+ * if (result.ok) {
8433
+ * const txHash = result.value;
8434
+ * console.log('Repay transaction hash:', txHash);
8435
+ * } else {
8436
+ * console.error('Repay failed:', result.error);
8437
+ * }
8438
+ */
8439
+ 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>;
8440
+ /**
8441
+ * Build transaction data for supplying to the money market pool
8442
+ * @param token - The address of the token on spoke chain
8443
+ * @param to - The user wallet address on the hub chain
8444
+ * @param amount - The amount to deposit
8445
+ * @param spokeChainId - The chain ID of the spoke chain
8446
+ * @returns {Hex} The transaction data.
8447
+ */
8448
+ buildSupplyData(token: string, to: Address$1, amount: bigint, spokeChainId: SpokeChainId): Hex;
8449
+ /**
8450
+ * Build transaction data for borrowing from the money market pool
8451
+ * @param from - The user wallet address on the hub chain
8452
+ * @param to - The user wallet address on the spoke chain
8453
+ * @param token - The address of the token to borrow
8454
+ * @param amount - The amount to borrow in hub chain decimals
8455
+ * @param spokeChainId - The chain ID of the spoke chain
8456
+ * @returns {Hex} The transaction data.
8457
+ */
8458
+ buildBorrowData(from: Address$1, to: Address$1 | Hex, token: string, amount: bigint, spokeChainId: SpokeChainId): Hex;
8459
+ /**
8460
+ * Build transaction data for withdrawing from the money market pool
8461
+ * @param from - The user wallet address on the hub chain
8462
+ * @param to - The user wallet address on the spoke chain
8463
+ * @param token - The address of the token to borrow
8464
+ * @param amount - The amount to borrow in hub chain decimals
8465
+ * @param spokeChainId - The chain ID of the spoke chain
8466
+ * @returns {Hex} The transaction data.
8467
+ */
8468
+ buildWithdrawData(from: Address$1, to: Address$1, token: string, amount: bigint, spokeChainId: SpokeChainId): Hex;
8469
+ /**
8470
+ * Build transaction data for repaying to the money market pool
8471
+ * @param token - The address of the token to repay
8472
+ * @param to - The user wallet address on the hub chain
8473
+ * @param amount - The amount to repay
8474
+ * @param spokeChainId - The chain ID of the spoke chain
8475
+ * @returns {Hex} The transaction data.
8476
+ */
8477
+ buildRepayData(token: string, to: Address$1, amount: bigint, spokeChainId: SpokeChainId): Hex;
8478
+ /**
8479
+ * Calculate aToken amount from actual amount using liquidityIndex
8480
+ * @param amount - The actual amount
8481
+ * @param normalizedIncome - The current normalized income from reserve data
8482
+ * @returns {bigint} The equivalent aToken amount
8483
+ */
8484
+ static calculateATokenAmount(amount: bigint, normalizedIncome: bigint): bigint;
8485
+ /**
8486
+ * Encodes a supply transaction for a money market pool.
8487
+ * @param {MoneyMarketEncodeWithdrawParams} params - The parameters for the supply transaction.
8488
+ * @param {Address} lendingPool - The address of the lending pool contract.
8489
+ * @returns {EvmContractCall} The encoded contract call.
8490
+ */
8491
+ static encodeSupply(params: MoneyMarketEncodeSupplyParams, lendingPool: Address$1): EvmContractCall;
8492
+ /**
8493
+ * Encodes a withdraw transaction from a pool.
8494
+ * @param {MoneyMarketEncodeWithdrawParams} params - The parameters for the withdraw transaction.
8495
+ * @param {Address} params.asset - The address of the asset to withdraw.
8496
+ * @param {bigint} params.amount - The amount of the asset to withdraw.
8497
+ * @param {Address} params.to - The address that will receive the withdrawn assets.
8498
+ * @param {Address} lendingPool - The address of the lending pool contract.
8499
+ * @returns {EvmContractCall} The encoded contract call.
8500
+ */
8501
+ static encodeWithdraw(params: MoneyMarketEncodeWithdrawParams, lendingPool: Address$1): EvmContractCall;
8502
+ /**
8503
+ * Encodes a borrow transaction from a pool.
8504
+ * @param {MoneyMarketEncodeBorrowParams} params - The parameters for the borrow transaction.
8505
+ * @param {Address} lendingPool - The address of the lending pool contract.
8506
+ * @returns {EvmContractCall} The encoded contract call.
8507
+ */
8508
+ static encodeBorrow(params: MoneyMarketEncodeBorrowParams, lendingPool: Address$1): EvmContractCall;
8509
+ /**
8510
+ * Encodes a repay transaction for a pool.
8511
+ * @param {MoneyMarketEncodeRepayParams} params - The parameters for the repay transaction.
8512
+ * @param {Address} params.asset - The address of the borrowed asset to repay.
8513
+ * @param {bigint} params.amount - The amount to repay. Use type(uint256).max to repay the entire debt.
8514
+ * @param {number} params.interestRateMode - The interest rate mode (2 for Variable).
8515
+ * @param {Address} params.onBehalfOf - The address of the user who will get their debt reduced/removed.
8516
+ * @param {Address} lendingPool - The address of the lending pool contract.
8517
+ * @returns {EvmContractCall} The encoded contract call.
8518
+ */
8519
+ static encodeRepay(params: MoneyMarketEncodeRepayParams, lendingPool: Address$1): EvmContractCall;
8520
+ /**
8521
+ * Encodes a repayWithATokens transaction for a pool.
8522
+ * @param {MoneyMarketEncodeRepayWithATokensParams} params - The parameters for the repayWithATokens transaction.
8523
+ * @param {Address} lendingPool - The address of the lending pool contract.
8524
+ * @returns {EvmContractCall} The encoded contract call.
8525
+ */
8526
+ static encodeRepayWithATokens(params: MoneyMarketEncodeRepayWithATokensParams, lendingPool: Address$1): EvmContractCall;
8527
+ /**
8528
+ * Encodes a setUserUseReserveAsCollateral transaction.
8529
+ * @param asset - The address of the underlying asset to be used as collateral.
8530
+ * @param useAsCollateral - True to enable the asset as collateral, false to disable.
8531
+ * @param lendingPool - The address of lending pool contract
8532
+ * @returns The encoded contract call.
8533
+ */
8534
+ static encodeSetUserUseReserveAsCollateral(asset: Address$1, useAsCollateral: boolean, lendingPool: Address$1): EvmContractCall;
8535
+ /**
8536
+ * Get the list of all supported money market tokens (supply / borrow tokens) for a given spoke chain ID
8537
+ * @param chainId The chain ID
8538
+ * @returns {readonly Token[]} - Array of supported tokens
8539
+ */
8540
+ getSupportedTokens(chainId: SpokeChainId): readonly Token[];
8541
+ /**
8542
+ * Get the list of all supported money market reserves (supply / borrow reserves)
8543
+ * NOTE: reserve addresses are on the hub chain and can be of type vault, erc20, etc.
8544
+ * @returns {readonly Address[]} - Array of supported reserves
8545
+ */
8546
+ getSupportedReserves(): readonly Address$1[];
8547
+ }
8548
+
7887
8549
  /**
7888
8550
  * ABI-encode an array of ContractCall objects.
7889
8551
  * @param calls An array of ContractCall objects.
@@ -9028,4 +9690,4 @@ declare function isUnifiedBnUSDMigrateParams(value: unknown): value is UnifiedBn
9028
9690
  declare function isBalnMigrateParams(value: unknown): value is BalnMigrateParams;
9029
9691
  declare function isIcxCreateRevertMigrationParams(value: unknown): value is IcxCreateRevertMigrationParams;
9030
9692
 
9031
- export { type AggregatedReserveData, type AssetInfo, type BalnLockParams, type BalnMigrateParams, type BalnSwapAbi, BalnSwapService, type BaseCurrencyInfo, type BaseHubChainConfig, type BaseSpokeChainConfig, type BaseSpokeChainInfo, BigIntToHex, BnUSDMigrationService, type BnUSDRevertMigrationParams, type BorrowInfo, ChainIdToIntentRelayChainId, type CreateIntentParams, type CustomProvider, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, type Default, type DetailedLock, EVM_CHAIN_IDS, EVM_SPOKE_CHAIN_IDS, Erc20Service, EvmAssetManagerService, type EvmChainId, type EvmContractCall, type EvmDepositToDataParams, type EvmGasEstimate, type EvmHubChainConfig, EvmHubProvider, type EvmHubProviderConfig, type EvmInitializedConfig, type EvmReturnType, EvmSolverService, type EvmSpokeChainConfig, type EvmSpokeChainId, type EvmSpokeDepositParams, EvmSpokeProvider, EvmSpokeService, type EvmTransferParams, type EvmTransferToHubParams, type EvmTxReturnType, type EvmUninitializedBrowserConfig, type EvmUninitializedConfig, type EvmUninitializedPrivateKeyConfig, EvmVaultTokenService, EvmWalletAbstraction, type EvmWithdrawAssetDataParams, FEE_PERCENTAGE_SCALE, type FeeAmount, type FeeData, type GasEstimateType, type GetAddressType, type GetEstimateGasReturnType, type GetMigrationFailedPayload, type GetMoneyMarketError, type GetMoneyMarketParams, type GetPacketParams, type GetPacketResponse, type GetRelayRequestParamType, type GetRelayResponse, type GetSpokeChainIdType, type GetSpokeDepositParamsType, type GetTransactionPacketsParams, type GetTransactionPacketsResponse, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type HashTxReturnType, type HttpPrefixedUrl, type HttpUrl, type HubAssetInfo, type HubChainConfig, type HubChainInfo, type HubTxHash, type HubVaultSymbol, HubVaultSymbols, ICON_TX_RESULT_WAIT_MAX_RETRY, INTENT_RELAY_CHAIN_IDS, type ISpokeProvider, type IWalletProvider, type IconAddress, type IconContractAddress, type IconGasEstimate, type IconJsonRpcVersion, type IconRawTransaction, type IconReturnType, type IconSpokeChainConfig, IconSpokeProvider, type IcxCreateRevertMigrationParams, type IcxMigrateParams, IcxMigrationService, type IcxRawTransaction, type IcxRevertMigrationParams, type IcxTokenType, type InjectiveGasEstimate, type InjectiveReturnType, type InjectiveSpokeChainConfig, InjectiveSpokeProvider, type Intent, IntentCreatedEventAbi, type IntentCreatedEventLog, type IntentCreationFailedErrorData, type IntentData, IntentDataType, type IntentError, type IntentErrorCode, type IntentErrorData, type IntentRelayChainId, type IntentRelayRequest, type IntentRelayRequestParams, type IntentState, type IntentSubmitTxFailedErrorData, type IntentWaitUntilIntentExecutedFailedErrorData, IntentsAbi, type JsonRpcPayloadResponse, type LegacybnUSDChainId, type LegacybnUSDToken, type LegacybnUSDTokenAddress, LockupMultiplier, LockupPeriod, MAX_UINT256, type MigrationAction, type MigrationError, type MigrationErrorCode, type MigrationErrorData, type MigrationFailedErrorData, type MigrationParams, type MigrationRevertParams, MigrationService, type MigrationServiceConfig, type MigrationTokens, type MoneyMarketAction, type MoneyMarketBorrowFailedError, type MoneyMarketBorrowParams, type MoneyMarketConfig, type MoneyMarketConfigParams, type MoneyMarketEncodeBorrowParams, type MoneyMarketEncodeRepayParams, type MoneyMarketEncodeRepayWithATokensParams, type MoneyMarketEncodeSupplyParams, type MoneyMarketEncodeWithdrawParams, type MoneyMarketError, type MoneyMarketErrorCode, type MoneyMarketExtraData, type MoneyMarketOptionalExtraData, type MoneyMarketParams, type MoneyMarketRepayFailedError, type MoneyMarketRepayParams, MoneyMarketService, type MoneyMarketServiceConfig, type MoneyMarketSubmitTxFailedError, type MoneyMarketSupplyFailedError, type MoneyMarketSupplyParams, type MoneyMarketUnknownError, type MoneyMarketUnknownErrorCode, type MoneyMarketWithdrawFailedError, type MoneyMarketWithdrawParams, type NewbnUSDChainId, type Optional, type OptionalFee, type OptionalRaw, type OptionalTimeout, type PacketData, type PartnerFee, type PartnerFeeAmount, type PartnerFeeConfig, type PartnerFeePercentage, type Prettify, type PromiseEvmTxReturnType, type PromiseIconTxReturnType, type PromiseInjectiveTxReturnType, type PromiseSolanaTxReturnType, type PromiseStellarTxReturnType, type PromiseSuiTxReturnType, type PromiseTxReturnType, type QuoteType, type RawTxReturnType, type RelayAction, type RelayError, type RelayErrorCode, type RelayRequestDetail, type RelayRequestSigning, type RelayTxStatus, type RelayerApiConfig, type ReserveDataLegacy, type ResponseAddressType, type ResponseSigningType, type Result, STELLAR_DEFAULT_TX_TIMEOUT_SECONDS, STELLAR_PRIORITY_FEE, Sodax, type SodaxConfig, type SolanaChainConfig, type SolanaGasEstimate, type SolanaRawTransaction, type SolanaReturnType, SolanaSpokeProvider, type SolverConfig, type SolverConfigParams, type SolverErrorResponse, type SolverExecutionRequest, type SolverExecutionResponse, SolverIntentErrorCode, type SolverIntentQuoteRequest, type SolverIntentQuoteResponse, type SolverIntentQuoteResponseRaw, SolverIntentStatusCode, type SolverIntentStatusRequest, type SolverIntentStatusResponse, SolverService, type SolverServiceConfig, type SonicSpokeChainConfig, type SonicSpokeDepositParams, SonicSpokeProvider, SonicSpokeService, type SpokeChainConfig, type SpokeChainInfo, type SpokeDepositParams, type SpokeProvider, SpokeService, type SpokeTokenSymbols, type SpokeTxHash, type StellarGasEstimate, type StellarReturnType, type StellarRpcConfig, type StellarSpokeChainConfig, StellarSpokeProvider, type SubmitTxParams, type SubmitTxResponse, type SuiGasEstimate, type SuiRawTransaction, type SuiReturnType, type SuiSpokeChainConfig, SuiSpokeProvider, SupportedMigrationTokens, type SwapParams, type TokenInfo, type TxReturnType, type UnifiedBnUSDMigrateParams, type UnstakeRequest, type UserReserveData, VAULT_TOKEN_DECIMALS, type VaultReserves, type VaultType, type WaitUntilIntentExecutedPayload, WalletAbstractionService, type WithdrawInfo, assetManagerAbi, balnSwapAbi, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateFeeAmount, calculatePercentageFeeAmount, chainIdToHubAssetsMap, connectionAbi, encodeAddress, encodeContractCalls, erc20Abi, getAllLegacybnUSDTokens, getEvmViemChain, getHubAssetInfo, getHubChainConfig, getIconAddressBytes, getIntentRelayChainId, getMoneyMarketConfig, getOriginalAssetAddress, getPacket, getRandomBytes, getSolanaAddressBytes, getSolverConfig, getSpokeChainIdFromIntentRelayChainId, getSupportedMoneyMarketTokens, getSupportedSolverTokens, getTransactionPackets, hexToBigInt, hubAssetToOriginalAssetMap, hubAssets, hubVaults, hubVaultsAddressSet, intentRelayChainIdToSpokeChainIdMap, 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, isMoneyMarketReserveAsset, isMoneyMarketReserveHubAsset, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketSupportedToken, isMoneyMarketWithdrawUnknownError, isNativeToken, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSolanaSpokeProvider, isSolverSupportedToken, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isUnifiedBnUSDMigrateParams, isValidChainHubAsset, isValidHubAsset, isValidIntentRelayChainId, isValidOriginalAssetAddress, isValidSpokeChainId, isWaitUntilIntentExecutedFailed, moneyMarketReserveAssets, moneyMarketReserveHubAssetsSet, moneyMarketSupportedTokens, newbnUSDSpokeChainIds, originalAssetTohubAssetMap, poolAbi, randomUint256, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainIdsSet, submitTransaction, supportedHubAssets, supportedHubChains, supportedSpokeChains, supportedTokensPerChain, uiPoolDataAbi, variableDebtTokenAbi, vaultTokenAbi, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
9693
+ export { type AggregatedReserveData, type AssetInfo, type BalnLockParams, type BalnMigrateParams, type BalnSwapAbi, BalnSwapService, type BaseCurrencyInfo, type BaseHubChainConfig, type BaseSpokeChainConfig, type BaseSpokeChainInfo, BigIntToHex, type BigNumberValue, BigNumberZeroDecimal, BnUSDMigrationService, type BnUSDRevertMigrationParams, type BorrowInfo, type CalculateAllReserveIncentivesRequest, type CalculateAllUserIncentivesRequest, type CalculateCompoundedRateRequest, ChainIdToIntentRelayChainId, type CombinedReserveData, type ComputedUserReserve, type CreateIntentParams, type CustomProvider, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, type Default, type DetailedLock, type EModeCategory, type EModeCategoryHumanized, type EModeData, type EModeDataString, EVM_CHAIN_IDS, EVM_SPOKE_CHAIN_IDS, type EmodeDataHumanized, Erc20Service, EvmAssetManagerService, type EvmChainId, type EvmContractCall, type EvmDepositToDataParams, type EvmGasEstimate, type EvmHubChainConfig, EvmHubProvider, type EvmHubProviderConfig, type EvmInitializedConfig, type EvmReturnType, EvmSolverService, type EvmSpokeChainConfig, type EvmSpokeChainId, type EvmSpokeDepositParams, EvmSpokeProvider, EvmSpokeService, type EvmTransferParams, type EvmTransferToHubParams, type EvmTxReturnType, type EvmUninitializedBrowserConfig, type EvmUninitializedConfig, type EvmUninitializedPrivateKeyConfig, EvmVaultTokenService, EvmWalletAbstraction, type EvmWithdrawAssetDataParams, FEE_PERCENTAGE_SCALE, type FeeAmount, type FeeData, type 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 GetSpokeChainIdType, type GetSpokeDepositParamsType, type GetTransactionPacketsParams, type GetTransactionPacketsResponse, HALF_RAY, HALF_WAD, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type HashTxReturnType, type HttpPrefixedUrl, type HttpUrl, type HubAssetInfo, type HubChainConfig, type HubChainInfo, type HubTxHash, type HubVaultSymbol, HubVaultSymbols, ICON_TX_RESULT_WAIT_MAX_RETRY, INTENT_RELAY_CHAIN_IDS, type ISpokeProvider, type IWalletProvider, type IconAddress, type IconContractAddress, type IconGasEstimate, type IconJsonRpcVersion, type IconRawTransaction, type IconReturnType, type IconSpokeChainConfig, IconSpokeProvider, type IcxCreateRevertMigrationParams, type IcxMigrateParams, IcxMigrationService, type IcxRawTransaction, type IcxRevertMigrationParams, type IcxTokenType, type IncentiveDataHumanized, type InjectiveGasEstimate, type InjectiveReturnType, type InjectiveSpokeChainConfig, InjectiveSpokeProvider, type Intent, IntentCreatedEventAbi, type IntentCreatedEventLog, type IntentCreationFailedErrorData, type IntentData, IntentDataType, type IntentDeliveryInfo, type IntentError, type IntentErrorCode, type IntentErrorData, type IntentRelayChainId, type IntentRelayRequest, type IntentRelayRequestParams, 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 MigrationTokens, type MoneyMarketAction, type MoneyMarketBorrowFailedError, type MoneyMarketBorrowParams, type MoneyMarketConfig, type MoneyMarketConfigParams, MoneyMarketDataService, type MoneyMarketEncodeBorrowParams, type MoneyMarketEncodeRepayParams, type MoneyMarketEncodeRepayWithATokensParams, type MoneyMarketEncodeSupplyParams, type MoneyMarketEncodeWithdrawParams, type MoneyMarketError, type MoneyMarketErrorCode, type MoneyMarketExtraData, type MoneyMarketOptionalExtraData, type MoneyMarketParams, type MoneyMarketRepayFailedError, type MoneyMarketRepayParams, MoneyMarketService, type MoneyMarketServiceConfig, type MoneyMarketSubmitTxFailedError, type MoneyMarketSupplyFailedError, type MoneyMarketSupplyParams, type MoneyMarketUnknownError, type MoneyMarketUnknownErrorCode, type MoneyMarketWithdrawFailedError, type MoneyMarketWithdrawParams, type NewbnUSDChainId, type Optional, type OptionalFee, type OptionalRaw, type OptionalTimeout, 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 QuoteType, RAY, RAY_DECIMALS, type RawTxReturnType, type RelayAction, type RelayError, type RelayErrorCode, type RelayRequestDetail, type RelayRequestSigning, type RelayTxStatus, type RelayerApiConfig, 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 SolanaChainConfig, type SolanaGasEstimate, type SolanaRawTransaction, type SolanaReturnType, SolanaSpokeProvider, type SolverConfig, type SolverConfigParams, type SolverErrorResponse, type SolverExecutionRequest, type SolverExecutionResponse, SolverIntentErrorCode, type SolverIntentQuoteRequest, type SolverIntentQuoteResponse, type SolverIntentQuoteResponseRaw, SolverIntentStatusCode, type SolverIntentStatusRequest, type SolverIntentStatusResponse, SolverService, type SolverServiceConfig, type SonicSpokeChainConfig, type SonicSpokeDepositParams, SonicSpokeProvider, SonicSpokeService, type SpokeChainConfig, type SpokeChainInfo, type SpokeDepositParams, type SpokeProvider, SpokeService, type SpokeTokenSymbols, type SpokeTxHash, type StellarGasEstimate, type StellarReturnType, type StellarRpcConfig, type StellarSpokeChainConfig, StellarSpokeProvider, type SubmitTxParams, type SubmitTxResponse, type SuiGasEstimate, type SuiRawTransaction, type SuiReturnType, type SuiSpokeChainConfig, SuiSpokeProvider, SupportedMigrationTokens, type SwapParams, type TokenInfo, type TxReturnType, USD_DECIMALS, type UiPoolDataProviderInterface, UiPoolDataProviderService, type UnifiedBnUSDMigrateParams, type UnstakeRequest, type UserIncentiveData, type UserIncentiveDataHumanized, type UserIncentiveDict, type UserReserveCalculationData, type UserReserveData, type UserReserveDataHumanized, type UserReserveDataString, type UserReservesIncentivesDataHumanized, type UserRewardInfoHumanized, VAULT_TOKEN_DECIMALS, type VaultReserves, type VaultType, WAD, WAD_RAY_RATIO, WEI_DECIMALS, type WaitUntilIntentExecutedPayload, WalletAbstractionService, type WithdrawInfo, assetManagerAbi, balnSwapAbi, binomialApproximatedRayPow, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bnUSDNewTokens, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, chainIdToHubAssetsMap, connectionAbi, encodeAddress, encodeContractCalls, erc20Abi, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getCompoundedBalance, getEvmViemChain, getHubAssetInfo, getHubChainConfig, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getMoneyMarketConfig, getOriginalAssetAddress, getPacket, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeChainIdFromIntentRelayChainId, getSupportedMoneyMarketTokens, getSupportedSolverTokens, getTransactionPackets, hexToBigInt, hubAssetToOriginalAssetMap, hubAssets, hubVaults, hubVaultsAddressSet, intentRelayChainIdToSpokeChainIdMap, 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, isMoneyMarketReserveAsset, isMoneyMarketReserveHubAsset, isMoneyMarketSubmitTxFailedError, isMoneyMarketSupplyUnknownError, isMoneyMarketSupportedToken, isMoneyMarketWithdrawUnknownError, isNativeToken, isNewbnUSDChainId, isNewbnUSDToken, isPartnerFeeAmount, isPartnerFeePercentage, isResponseAddressType, isResponseSigningType, isSolanaSpokeProvider, isSolverSupportedToken, isSonicSpokeProvider, isStellarSpokeProvider, isSuiSpokeProvider, isUnifiedBnUSDMigrateParams, isValidChainHubAsset, isValidHubAsset, isValidIntentRelayChainId, isValidOriginalAssetAddress, isValidSpokeChainId, isWaitUntilIntentExecutedFailed, moneyMarketReserveAssets, moneyMarketReserveHubAssetsSet, moneyMarketSupportedTokens, nativeToUSD, newbnUSDSpokeChainIds, normalize, normalizeBN, normalizedToUsd, originalAssetTohubAssetMap, poolAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, retry, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainIdsSet, submitTransaction, supportedHubAssets, supportedHubChains, supportedSpokeChains, supportedTokensPerChain, uiPoolDataAbi, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, wadToRay, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };