@sodax/sdk 2.2.0-rc.1 → 2.2.0-rc.2

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.mjs CHANGED
@@ -10,11 +10,11 @@ import * as ecc from '@bitcoinerlab/secp256k1';
10
10
  import { CLPositionManagerAbi, encodeCLPositionManagerMintCalldata, encodeCLPositionManagerIncreaseLiquidityCalldata, encodeCLPositionManagerDecreaseLiquidityCalldata, getPoolId, CLPoolManagerAbi, decodePoolKey } from '@pancakeswap/infinity-sdk';
11
11
  import { Transaction as Transaction$1 } from '@mysten/sui/transactions';
12
12
  import { SuiGrpcClient } from '@mysten/sui/grpc';
13
- import { TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, getAssociatedTokenAddress } from '@solana/spl-token';
13
+ import { TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, getAssociatedTokenAddressSync, unpackAccount, getAssociatedTokenAddress } from '@solana/spl-token';
14
14
  import { AnchorProvider, Program } from '@coral-xyz/anchor';
15
15
  import BN from 'bn.js';
16
16
  import * as IconSdkRaw from 'icon-sdk-js';
17
- import { ChainGrpcWasmApi, TxGrpcApi, toBase64, fromBase64, MsgExecuteContract, ChainRestAuthApi, BaseAccount, createTransaction } from '@injectivelabs/sdk-ts';
17
+ import { ChainGrpcWasmApi, IndexerGrpcAccountPortfolioApi, TxGrpcApi, toBase64, fromBase64, MsgExecuteContract, ChainRestAuthApi, BaseAccount, createTransaction } from '@injectivelabs/sdk-ts';
18
18
  import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx.js';
19
19
  import { getNetworkEndpoints, Network } from '@injectivelabs/networks';
20
20
  import * as v from 'valibot';
@@ -3528,7 +3528,9 @@ var spokeChainConfig = {
3528
3528
  },
3529
3529
  chain: baseChainInfo[ChainKeys.BITCOIN_MAINNET],
3530
3530
  bnUSD: "no",
3531
- nativeToken: "BTC",
3531
+ // Must equal bitcoinSupportedTokens.BTC.address: isNativeToken compares a token's `address`
3532
+ // against this value, so a symbol here classifies native BTC as a contract token.
3533
+ nativeToken: "0:0",
3532
3534
  supportedTokens: bitcoinSupportedTokens,
3533
3535
  radfi: {
3534
3536
  walletMode: "TRADING",
@@ -4078,8 +4080,12 @@ var moneyMarketSupportedTokens = {
4078
4080
  spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.USDS,
4079
4081
  spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.XLM
4080
4082
  ],
4081
- // Robinhood Chain: lending/borrowing deferred at launch (swaps + bridging only)
4082
- [ChainKeys.ROBINHOOD_MAINNET]: []
4083
+ [ChainKeys.ROBINHOOD_MAINNET]: [
4084
+ spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.ETH,
4085
+ spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.bnUSD,
4086
+ spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.SODA,
4087
+ spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.USDG
4088
+ ]
4083
4089
  };
4084
4090
  var moneyMarketReserveAssets = [
4085
4091
  ...Object.values(SodaTokens).map((vault) => vault.address),
@@ -4858,7 +4864,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
4858
4864
  }
4859
4865
 
4860
4866
  // ../types/dist/index.js
4861
- var CONFIG_VERSION = 231;
4867
+ var CONFIG_VERSION = 232;
4862
4868
 
4863
4869
  // src/shared/utils/resolveTimeoutMs.ts
4864
4870
  function resolveTimeoutMs(timeout, fallbackMs) {
@@ -15422,10 +15428,54 @@ var EvmAssetManagerService = class _EvmAssetManagerService {
15422
15428
  });
15423
15429
  }
15424
15430
  };
15431
+
15432
+ // src/shared/services/spoke/balance-utils.ts
15433
+ function createBalanceCollector({ logger, chainKey }) {
15434
+ const balances = {};
15435
+ let attempted = 0;
15436
+ let failed = 0;
15437
+ return {
15438
+ ok(tokenAddress, value) {
15439
+ attempted++;
15440
+ balances[tokenAddress] = value;
15441
+ },
15442
+ fail(tokenAddress, reason) {
15443
+ attempted++;
15444
+ failed++;
15445
+ logger.warn("[getWalletBalances] balance read failed, reporting 0n", {
15446
+ chainKey,
15447
+ token: tokenAddress,
15448
+ error: reason instanceof Error ? reason.message : String(reason)
15449
+ });
15450
+ balances[tokenAddress] = 0n;
15451
+ },
15452
+ finish() {
15453
+ if (attempted > 0 && failed === attempted) {
15454
+ throw new Error(`[getWalletBalances] every balance read failed on ${chainKey} (${failed}/${attempted})`);
15455
+ }
15456
+ return balances;
15457
+ }
15458
+ };
15459
+ }
15460
+ async function settleWalletBalances(collector, tokens, read) {
15461
+ const settled = await Promise.allSettled(tokens.map((token) => read(token)));
15462
+ tokens.forEach((token, index) => {
15463
+ const outcome = settled[index];
15464
+ if (!outcome) return;
15465
+ if (outcome.status === "fulfilled") {
15466
+ collector.ok(token.address, outcome.value);
15467
+ } else {
15468
+ collector.fail(token.address, outcome.reason);
15469
+ }
15470
+ });
15471
+ }
15425
15472
  var HEDERA_NATIVE_VALUE_SCALE = 10n ** 10n;
15426
15473
  function scaleNativeMsgValue(chainKey, amount) {
15427
15474
  return chainKey === ChainKeys.HEDERA_MAINNET ? amount * HEDERA_NATIVE_VALUE_SCALE : amount;
15428
15475
  }
15476
+ function scaleNativeBalance(chainKey, amount) {
15477
+ return chainKey === ChainKeys.HEDERA_MAINNET ? amount / HEDERA_NATIVE_VALUE_SCALE : amount;
15478
+ }
15429
15479
  var EvmSpokeService = class {
15430
15480
  config;
15431
15481
  // map containing the public clients for each evm spoke chain, lazy loaded on demand
@@ -15542,6 +15592,79 @@ var EvmSpokeService = class {
15542
15592
  args: [this.config.getChainConfig(params.srcChainKey).addresses.assetManager]
15543
15593
  });
15544
15594
  }
15595
+ /**
15596
+ * Get the user's own wallet balance of a token on an EVM spoke chain, in smallest units.
15597
+ * Native coin via `eth_getBalance` (Hedera scaled to canonical decimals); erc20 via `balanceOf`.
15598
+ * @param {GetBalanceParams<EvmSpokeOnlyChainKey>} params - The chain key, user address, and token.
15599
+ * @returns {Promise<bigint>} The token balance in smallest units.
15600
+ */
15601
+ async getWalletBalance(params) {
15602
+ const { srcChainKey, srcAddress, token } = params;
15603
+ const publicClient = this.getPublicClient(srcChainKey);
15604
+ if (isNativeToken(srcChainKey, token)) {
15605
+ const balance2 = await publicClient.getBalance({ address: srcAddress });
15606
+ return scaleNativeBalance(srcChainKey, balance2);
15607
+ }
15608
+ const balance = await publicClient.readContract({
15609
+ address: token.address,
15610
+ abi: erc20Abi,
15611
+ functionName: "balanceOf",
15612
+ args: [srcAddress]
15613
+ });
15614
+ return balance ?? 0n;
15615
+ }
15616
+ /**
15617
+ * Get the user's own wallet balances of multiple tokens on an EVM spoke chain, in smallest
15618
+ * units. Non-native tokens are batched via multicall3 when the chain supports it, otherwise
15619
+ * read in parallel.
15620
+ * @param {GetBalancesParams<EvmSpokeOnlyChainKey>} params - The chain key, user address, and tokens.
15621
+ * @returns {Promise<WalletBalanceMap>} A map of token address to balance in smallest units.
15622
+ */
15623
+ async getWalletBalances(params) {
15624
+ const { srcChainKey, srcAddress, tokens } = params;
15625
+ const nativeTokens = tokens.filter((token) => isNativeToken(srcChainKey, token));
15626
+ const nonNativeTokens = tokens.filter((token) => !isNativeToken(srcChainKey, token));
15627
+ const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
15628
+ await settleWalletBalances(
15629
+ collector,
15630
+ nativeTokens,
15631
+ (token) => this.getWalletBalance({ srcChainKey, srcAddress, token })
15632
+ );
15633
+ if (nonNativeTokens.length === 0) {
15634
+ return collector.finish();
15635
+ }
15636
+ const publicClient = this.getPublicClient(srcChainKey);
15637
+ if (getEvmViemChain(srcChainKey).contracts?.multicall3) {
15638
+ const results = await publicClient.multicall({
15639
+ contracts: nonNativeTokens.map((token) => ({
15640
+ abi: erc20Abi,
15641
+ address: token.address,
15642
+ functionName: "balanceOf",
15643
+ args: [srcAddress]
15644
+ }))
15645
+ });
15646
+ nonNativeTokens.forEach((token, index) => {
15647
+ const result = results[index];
15648
+ if (result?.status === "success") {
15649
+ collector.ok(token.address, BigInt(result.result));
15650
+ } else {
15651
+ collector.fail(token.address, result?.error ?? new Error(`missing multicall result for ${token.address}`));
15652
+ }
15653
+ });
15654
+ return collector.finish();
15655
+ }
15656
+ await settleWalletBalances(
15657
+ collector,
15658
+ nonNativeTokens,
15659
+ (token) => publicClient.readContract({
15660
+ address: token.address,
15661
+ abi: erc20Abi,
15662
+ functionName: "balanceOf",
15663
+ args: [srcAddress]
15664
+ })
15665
+ );
15666
+ return collector.finish();
15667
+ }
15545
15668
  /**
15546
15669
  * Sends a message to the hub chain.
15547
15670
  * @param {SendMessageParams} params - Includes dstChainKey, the chain key of the hub chain.
@@ -15736,6 +15859,31 @@ var StacksSpokeService = class {
15736
15859
  }
15737
15860
  return this.readTokenBalance(params.token, assetManager);
15738
15861
  }
15862
+ /**
15863
+ * Get the user's own wallet balance of a token on Stacks, in smallest units. Native STX via the
15864
+ * Hiro REST `/extended/v1/address/{addr}/balances` endpoint; SIP-010 fungible tokens via the
15865
+ * read-only `get-balance` contract call. Unlike {@link getDeposit}, this reads the holding of
15866
+ * `srcAddress` (the user), not the protocol asset manager.
15867
+ * @param {GetBalanceParams<StacksChainKey>} params - The chain key, user address, and token.
15868
+ * @returns {Promise<bigint>} The token balance in smallest units.
15869
+ */
15870
+ async getWalletBalance(params) {
15871
+ if (isNativeToken(params.srcChainKey, params.token)) {
15872
+ return this.getSTXBalance(params.srcAddress);
15873
+ }
15874
+ return this.readTokenBalance(params.token.address, params.srcAddress);
15875
+ }
15876
+ /**
15877
+ * Get the user's own wallet balances of multiple tokens on Stacks, in smallest units.
15878
+ * @param {GetBalancesParams<StacksChainKey>} params - The chain key, user address, and tokens.
15879
+ * @returns {Promise<WalletBalanceMap>} A map of token address to balance in smallest units.
15880
+ */
15881
+ async getWalletBalances(params) {
15882
+ const { srcChainKey, srcAddress, tokens } = params;
15883
+ const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
15884
+ await settleWalletBalances(collector, tokens, (token) => this.getWalletBalance({ srcChainKey, srcAddress, token }));
15885
+ return collector.finish();
15886
+ }
15739
15887
  /**
15740
15888
  * Sends a message to the hub chain.
15741
15889
  */
@@ -16296,6 +16444,32 @@ var BitcoinSpokeService = class {
16296
16444
  }
16297
16445
  throw new Error("Token balance queries not yet implemented for non-BTC assets");
16298
16446
  }
16447
+ /**
16448
+ * Get the user's own wallet balance of a token on Bitcoin, in satoshis. Only native BTC is
16449
+ * readable (summed from confirmed/unconfirmed UTXOs). Non-native spoke tokens are Rune ids
16450
+ * (`block:tx`), whose amounts the Esplora UTXO endpoint does not carry, so they resolve to 0n.
16451
+ * @param {GetBalanceParams<BitcoinChainKey>} params - The chain key, user address, and token.
16452
+ * @returns {Promise<bigint>} The balance in satoshis.
16453
+ */
16454
+ async getWalletBalance(params) {
16455
+ const { srcChainKey, srcAddress, token } = params;
16456
+ if (isNativeToken(srcChainKey, token)) {
16457
+ const utxos = await this.fetchUTXOs(srcAddress);
16458
+ return BigInt(utxos.reduce((sum, utxo) => sum + utxo.value, 0));
16459
+ }
16460
+ return 0n;
16461
+ }
16462
+ /**
16463
+ * Get the user's own wallet balances of multiple tokens on Bitcoin, in satoshis.
16464
+ * @param {GetBalancesParams<BitcoinChainKey>} params - The chain key, user address, and tokens.
16465
+ * @returns {Promise<WalletBalanceMap>} A map of token address to balance in smallest units.
16466
+ */
16467
+ async getWalletBalances(params) {
16468
+ const { srcChainKey, srcAddress, tokens } = params;
16469
+ const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
16470
+ await settleWalletBalances(collector, tokens, (token) => this.getWalletBalance({ srcChainKey, srcAddress, token }));
16471
+ return collector.finish();
16472
+ }
16299
16473
  async fetchScriptPubKey(utxo) {
16300
16474
  const txHex = await this.fetchRawTransaction(utxo.txid);
16301
16475
  const tx = Transaction.fromHex(txHex);
@@ -22842,6 +23016,39 @@ var NearSpokeService = class {
22842
23016
  }
22843
23017
  return BigInt(bal);
22844
23018
  }
23019
+ /**
23020
+ * Get the user's own wallet balance of a token on NEAR, in smallest units (yoctoNEAR for the
23021
+ * native coin). Native NEAR via the account's `viewAccount().amount`; NEP-141 tokens via the
23022
+ * token contract's `ft_balance_of` view. Reads the balance held by `srcAddress` (the user
23023
+ * wallet), not the protocol asset manager. Uses this service's own configured RPC provider.
23024
+ * @param {GetBalanceParams<NearChainKey>} params - The chain key, user address, and token.
23025
+ * @returns {Promise<bigint>} The token balance in smallest units.
23026
+ */
23027
+ async getWalletBalance(params) {
23028
+ if (isNativeToken(params.srcChainKey, params.token)) {
23029
+ const account = await this.rpcProvider.viewAccount({ accountId: params.srcAddress });
23030
+ return BigInt(account.amount);
23031
+ }
23032
+ const bal = await this.queryContract(params.token.address, "ft_balance_of", {
23033
+ account_id: params.srcAddress
23034
+ });
23035
+ if (typeof bal !== "string") {
23036
+ throw new Error("[NearSpokeService.getWalletBalance] Failed to get balance. Unexpected response type.");
23037
+ }
23038
+ return BigInt(bal);
23039
+ }
23040
+ /**
23041
+ * Get the user's own wallet balances of multiple tokens on NEAR, in smallest units. Fans out
23042
+ * over {@link getWalletBalance}, keyed by `token.address`.
23043
+ * @param {GetBalancesParams<NearChainKey>} params - The chain key, user address, and tokens.
23044
+ * @returns {Promise<WalletBalanceMap>} A map of token address to balance in smallest units.
23045
+ */
23046
+ async getWalletBalances(params) {
23047
+ const { srcChainKey, srcAddress, tokens } = params;
23048
+ const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
23049
+ await settleWalletBalances(collector, tokens, (token) => this.getWalletBalance({ srcChainKey, srcAddress, token }));
23050
+ return collector.finish();
23051
+ }
22845
23052
  /**
22846
23053
  * Whether `accountId` is storage-registered on a NEP-141 `token` contract. NEP-141 requires an
22847
23054
  * account to pay a one-time storage bond before it can receive (hold a balance of) the token, so
@@ -23701,6 +23908,76 @@ var SonicSpokeService = class {
23701
23908
  args: [params.token]
23702
23909
  });
23703
23910
  }
23911
+ /**
23912
+ * Get the user's own wallet balance of a token on the hub (Sonic) chain, in smallest units.
23913
+ * Native coin via `eth_getBalance`; erc20 via `balanceOf`.
23914
+ * @param {GetBalanceParams<SonicChainKey>} params - The chain key, user address, and token.
23915
+ * @returns {Promise<bigint>} The token balance in smallest units.
23916
+ */
23917
+ async getWalletBalance(params) {
23918
+ const { srcChainKey, srcAddress, token } = params;
23919
+ if (isNativeToken(srcChainKey, token)) {
23920
+ return this.publicClient.getBalance({ address: srcAddress });
23921
+ }
23922
+ const balance = await this.publicClient.readContract({
23923
+ address: token.address,
23924
+ abi: erc20Abi$1,
23925
+ functionName: "balanceOf",
23926
+ args: [srcAddress]
23927
+ });
23928
+ return balance ?? 0n;
23929
+ }
23930
+ /**
23931
+ * Get the user's own wallet balances of multiple tokens on the hub (Sonic) chain, in smallest
23932
+ * units. Non-native tokens are batched via multicall3 when the chain supports it, otherwise
23933
+ * read in parallel.
23934
+ * @param {GetBalancesParams<SonicChainKey>} params - The chain key, user address, and tokens.
23935
+ * @returns {Promise<WalletBalanceMap>} A map of token address to balance in smallest units.
23936
+ */
23937
+ async getWalletBalances(params) {
23938
+ const { srcChainKey, srcAddress, tokens } = params;
23939
+ const nativeTokens = tokens.filter((token) => isNativeToken(srcChainKey, token));
23940
+ const nonNativeTokens = tokens.filter((token) => !isNativeToken(srcChainKey, token));
23941
+ const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
23942
+ await settleWalletBalances(
23943
+ collector,
23944
+ nativeTokens,
23945
+ (token) => this.getWalletBalance({ srcChainKey, srcAddress, token })
23946
+ );
23947
+ if (nonNativeTokens.length === 0) {
23948
+ return collector.finish();
23949
+ }
23950
+ if (getEvmViemChain(srcChainKey).contracts?.multicall3) {
23951
+ const results = await this.publicClient.multicall({
23952
+ contracts: nonNativeTokens.map((token) => ({
23953
+ abi: erc20Abi$1,
23954
+ address: token.address,
23955
+ functionName: "balanceOf",
23956
+ args: [srcAddress]
23957
+ }))
23958
+ });
23959
+ nonNativeTokens.forEach((token, index) => {
23960
+ const result = results[index];
23961
+ if (result?.status === "success") {
23962
+ collector.ok(token.address, BigInt(result.result));
23963
+ } else {
23964
+ collector.fail(token.address, result?.error ?? new Error(`missing multicall result for ${token.address}`));
23965
+ }
23966
+ });
23967
+ return collector.finish();
23968
+ }
23969
+ await settleWalletBalances(
23970
+ collector,
23971
+ nonNativeTokens,
23972
+ (token) => this.publicClient.readContract({
23973
+ address: token.address,
23974
+ abi: erc20Abi$1,
23975
+ functionName: "balanceOf",
23976
+ args: [srcAddress]
23977
+ })
23978
+ );
23979
+ return collector.finish();
23980
+ }
23704
23981
  /**
23705
23982
  * Execute a batch of contract calls through the Sonic wallet contract.
23706
23983
  * @param {Hex} payload - The encoded payload containing the calls array
@@ -23799,8 +24076,8 @@ var SuiGrpcTransport = class {
23799
24076
  this.endpoint = endpoint;
23800
24077
  this.client = new SuiGrpcClient({ network: "mainnet", baseUrl: endpoint });
23801
24078
  }
23802
- async getCoins(owner, coinType, limit = DEFAULT_GET_COINS_LIMIT) {
23803
- const response = await this.client.core.listCoins({ owner, coinType, limit });
24079
+ async getCoins(owner, coinType, limit = DEFAULT_GET_COINS_LIMIT, cursor) {
24080
+ const response = await this.client.core.listCoins({ owner, coinType, limit, cursor: cursor ?? void 0 });
23804
24081
  return toSuiPaginatedCoins(response, coinType);
23805
24082
  }
23806
24083
  async simulate(tx, sender) {
@@ -24040,6 +24317,42 @@ var SuiSpokeService = class {
24040
24317
  const str_u64 = bcs.U64.parse(Uint8Array.from(val));
24041
24318
  return BigInt(str_u64);
24042
24319
  }
24320
+ /**
24321
+ * Get the user's own wallet balance of a token on Sui, in smallest units. Unlike {@link getDeposit}
24322
+ * (which reads the protocol asset manager holding), this reads the balance held by `params.srcAddress`
24323
+ * itself. Native SUI is read via its canonical `0x2::sui::SUI` coin type; other coins use the token's
24324
+ * Sui coinType (`token.address`).
24325
+ * @param {GetBalanceParams<SuiChainKey>} params - The chain key, user address, and token.
24326
+ * @returns {Promise<bigint>} The token balance in smallest units.
24327
+ */
24328
+ async getWalletBalance(params) {
24329
+ const { srcChainKey, srcAddress, token } = params;
24330
+ let coinType = isNativeToken(srcChainKey, token) ? "0x2::sui::SUI" : token.address;
24331
+ if (coinType === "0x03917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR") {
24332
+ coinType = "0x3917a812fe4a6d6bc779c5ab53f8a80ba741f8af04121193fc44e0f662e2ceb::balanced_dollar::BALANCED_DOLLAR";
24333
+ }
24334
+ let total = 0n;
24335
+ let cursor;
24336
+ do {
24337
+ const page = await this.transport.getCoins(srcAddress, coinType, void 0, cursor);
24338
+ for (const coin of page.data) {
24339
+ total += BigInt(coin.balance);
24340
+ }
24341
+ cursor = page.hasNextPage ? page.nextCursor : void 0;
24342
+ } while (cursor);
24343
+ return total;
24344
+ }
24345
+ /**
24346
+ * Get the user's own wallet balances of multiple tokens on Sui, in smallest units.
24347
+ * @param {GetBalancesParams<SuiChainKey>} params - The chain key, user address, and tokens.
24348
+ * @returns {Promise<WalletBalanceMap>} A map of token address to balance in smallest units.
24349
+ */
24350
+ async getWalletBalances(params) {
24351
+ const { srcChainKey, srcAddress, tokens } = params;
24352
+ const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
24353
+ await settleWalletBalances(collector, tokens, (token) => this.getWalletBalance({ srcChainKey, srcAddress, token }));
24354
+ return collector.finish();
24355
+ }
24043
24356
  /**
24044
24357
  * Fetch the asset manager config from the spoke chain.
24045
24358
  * @param {SuiChainKey} chainId - The Sui chain key.
@@ -24186,6 +24499,11 @@ var CustomSorobanServer = class extends rpc.Server {
24186
24499
  return response.json().then((json) => json.result);
24187
24500
  }
24188
24501
  };
24502
+ var STELLAR_BASE_RESERVE_STROOPS = 5000000n;
24503
+ function parseXlmBalanceToStroops(balanceStr) {
24504
+ const [whole = "0", frac = ""] = balanceStr.split(".");
24505
+ return BigInt(whole + frac.padEnd(7, "0").slice(0, 7));
24506
+ }
24189
24507
  var CustomStellarAccount = class {
24190
24508
  accountId;
24191
24509
  sequenceNumber;
@@ -24224,7 +24542,7 @@ var CustomStellarAccount = class {
24224
24542
  }
24225
24543
  };
24226
24544
  var TRUSTLINE_TX_TIMEOUT_SECONDS = 300;
24227
- var StellarSpokeService = class {
24545
+ var StellarSpokeService = class _StellarSpokeService {
24228
24546
  config;
24229
24547
  chainConfig;
24230
24548
  server;
@@ -24265,6 +24583,109 @@ var StellarSpokeService = class {
24265
24583
  }
24266
24584
  throw new Error("result undefined");
24267
24585
  }
24586
+ /**
24587
+ * Get the user's own wallet balance of a token on Stellar, in smallest units. Native XLM returns
24588
+ * the spendable amount (total minus the minimum reserve and selling liabilities) via Horizon;
24589
+ * other assets return the Soroban token contract's `balance` for the user.
24590
+ * @param {GetBalanceParams<StellarChainKey>} params - The chain key, user address, and token.
24591
+ * @returns {Promise<bigint>} The token balance in smallest units.
24592
+ */
24593
+ async getWalletBalance(params) {
24594
+ const { srcChainKey, srcAddress, token } = params;
24595
+ if (isNativeToken(srcChainKey, token)) {
24596
+ return _StellarSpokeService.spendableXlmStroops(await this.server.loadAccount(srcAddress));
24597
+ }
24598
+ const [network, sourceAccount] = await Promise.all([
24599
+ this.sorobanServer.getNetwork(),
24600
+ this.sorobanServer.getAccount(srcAddress)
24601
+ ]);
24602
+ return this.simulateTokenBalance(
24603
+ token.address,
24604
+ srcAddress,
24605
+ new CustomStellarAccount({ account_id: sourceAccount.accountId(), sequence: sourceAccount.sequenceNumber() }),
24606
+ network.passphrase
24607
+ );
24608
+ }
24609
+ /**
24610
+ * Spendable XLM in stroops: the account's native balance minus its minimum reserve and selling
24611
+ * liabilities. Reporting the raw balance would let a user try to spend reserves the network
24612
+ * refuses to release.
24613
+ */
24614
+ static spendableXlmStroops(account) {
24615
+ const nativeBalance = account.balances.find(
24616
+ (balance) => balance.asset_type === "native"
24617
+ );
24618
+ if (!nativeBalance) {
24619
+ return 0n;
24620
+ }
24621
+ const rawStroops = parseXlmBalanceToStroops(nativeBalance.balance);
24622
+ const sellingLiabilitiesStroops = nativeBalance.selling_liabilities ? parseXlmBalanceToStroops(nativeBalance.selling_liabilities) : 0n;
24623
+ const reserveCount = Math.max(0, 2 + account.subentry_count + account.num_sponsoring - account.num_sponsored);
24624
+ const minStroops = BigInt(reserveCount) * STELLAR_BASE_RESERVE_STROOPS + sellingLiabilitiesStroops;
24625
+ return rawStroops > minStroops ? rawStroops - minStroops : 0n;
24626
+ }
24627
+ /**
24628
+ * Simulate a Soroban token `balance` call. Takes the network passphrase and source account so a
24629
+ * batch can fetch them once; `getAccountClone()` hands each builder its own `Account`, because
24630
+ * `TransactionBuilder.build()` increments the source's sequence number and concurrent builders
24631
+ * would otherwise interleave on a shared one.
24632
+ */
24633
+ async simulateTokenBalance(tokenAddress, srcAddress, account, networkPassphrase) {
24634
+ const contract = new Contract(tokenAddress);
24635
+ const tx = new TransactionBuilder(account.getAccountClone(), { fee: this.baseFee, networkPassphrase }).addOperation(contract.call("balance", nativeToScVal(srcAddress, { type: "address" }))).setTimeout(TimeoutInfinite).build();
24636
+ const result = await this.sorobanServer.simulateTransaction(tx);
24637
+ if (!rpc.Api.isSimulationSuccess(result)) {
24638
+ throw new Error("Failed to simulate transaction");
24639
+ }
24640
+ if (!result.result) {
24641
+ throw new Error("Failed to read token balance: simulation returned no result");
24642
+ }
24643
+ return scValToBigInt(result.result.retval);
24644
+ }
24645
+ /**
24646
+ * Get the user's own wallet balances of multiple tokens on Stellar, in smallest units.
24647
+ *
24648
+ * The network passphrase and the source account are the same for every token, so they are
24649
+ * fetched once per batch instead of once per token — and only when a partition actually needs
24650
+ * them, so an all-native request issues no Soroban calls at all.
24651
+ * @param {GetBalancesParams<StellarChainKey>} params - The chain key, user address, and tokens.
24652
+ * @returns {Promise<WalletBalanceMap>} A map of token address to balance in smallest units.
24653
+ */
24654
+ async getWalletBalances(params) {
24655
+ const { srcChainKey, srcAddress, tokens } = params;
24656
+ const nativeTokens = tokens.filter((token) => isNativeToken(srcChainKey, token));
24657
+ const sorobanTokens = tokens.filter((token) => !isNativeToken(srcChainKey, token));
24658
+ const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
24659
+ if (nativeTokens.length > 0) {
24660
+ try {
24661
+ const spendable = _StellarSpokeService.spendableXlmStroops(await this.server.loadAccount(srcAddress));
24662
+ for (const token of nativeTokens) {
24663
+ collector.ok(token.address, spendable);
24664
+ }
24665
+ } catch (error) {
24666
+ for (const token of nativeTokens) {
24667
+ collector.fail(token.address, error);
24668
+ }
24669
+ }
24670
+ }
24671
+ if (sorobanTokens.length === 0) {
24672
+ return collector.finish();
24673
+ }
24674
+ const [network, sourceAccount] = await Promise.all([
24675
+ this.sorobanServer.getNetwork(),
24676
+ this.sorobanServer.getAccount(srcAddress)
24677
+ ]);
24678
+ const account = new CustomStellarAccount({
24679
+ account_id: sourceAccount.accountId(),
24680
+ sequence: sourceAccount.sequenceNumber()
24681
+ });
24682
+ await settleWalletBalances(
24683
+ collector,
24684
+ sorobanTokens,
24685
+ (token) => this.simulateTokenBalance(token.address, srcAddress, account, network.passphrase)
24686
+ );
24687
+ return collector.finish();
24688
+ }
24268
24689
  async buildPriorityStellarTransaction(account, network, operation) {
24269
24690
  const simulationForFee = await this.sorobanServer.simulateTransaction(
24270
24691
  new TransactionBuilder(account.getAccountClone(), {
@@ -24838,6 +25259,48 @@ var SolanaSpokeService = class _SolanaSpokeService {
24838
25259
  const tokenAccount = await _SolanaSpokeService.getTokenAccountBalance(this.connection, vaultToken.pda.toBase58());
24839
25260
  return BigInt(tokenAccount.value.amount);
24840
25261
  }
25262
+ /**
25263
+ * Get the user's own wallet balance of a token on Solana, in smallest units. Native SOL via
25264
+ * `getBalance`; SPL via the associated token account. The mint may belong to the legacy SPL
25265
+ * Token program or Token-2022 (e.g. xStock tokens), which derive different ATAs, so both
25266
+ * candidate ATAs are read in one call and the existing one is used.
25267
+ * @param {GetBalanceParams<SolanaChainKey>} params - The chain key, user address, and token.
25268
+ * @returns {Promise<bigint>} The token balance in smallest units.
25269
+ */
25270
+ async getWalletBalance(params) {
25271
+ const { srcChainKey, srcAddress, token } = params;
25272
+ if (isNativeToken(srcChainKey, token)) {
25273
+ return BigInt(await _SolanaSpokeService.getBalance(this.connection, srcAddress));
25274
+ }
25275
+ const owner = new PublicKey(srcAddress);
25276
+ const mint = new PublicKey(token.address);
25277
+ const candidates = [TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID].map((programId) => ({
25278
+ programId,
25279
+ ata: getAssociatedTokenAddressSync(mint, owner, true, programId)
25280
+ }));
25281
+ const accounts = await this.connection.getMultipleAccountsInfo(candidates.map((c) => c.ata));
25282
+ let balance = 0n;
25283
+ for (const [i, candidate] of candidates.entries()) {
25284
+ const info = accounts[i];
25285
+ if (!info) continue;
25286
+ try {
25287
+ balance += unpackAccount(candidate.ata, info, candidate.programId).amount;
25288
+ } catch {
25289
+ }
25290
+ }
25291
+ return balance;
25292
+ }
25293
+ /**
25294
+ * Get the user's own wallet balances of multiple tokens on Solana, in smallest units.
25295
+ * @param {GetBalancesParams<SolanaChainKey>} params - The chain key, user address, and tokens.
25296
+ * @returns {Promise<WalletBalanceMap>} A map of token address to balance in smallest units.
25297
+ */
25298
+ async getWalletBalances(params) {
25299
+ const { srcChainKey, srcAddress, tokens } = params;
25300
+ const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
25301
+ await settleWalletBalances(collector, tokens, (token) => this.getWalletBalance({ srcChainKey, srcAddress, token }));
25302
+ return collector.finish();
25303
+ }
24841
25304
  /**
24842
25305
  * Sends a message to the hub chain.
24843
25306
  * @param dstChainKey - The chain key of the hub chain.
@@ -25059,8 +25522,84 @@ var IconSpokeService = class {
25059
25522
  async getDeposit(params) {
25060
25523
  const { token, srcChainKey } = params;
25061
25524
  const transaction = new CallBuilder().to(token).method("balanceOf").params({ _owner: this.config.getChainConfig(srcChainKey).addresses.assetManager }).build();
25525
+ return this.readIrc2Balance(transaction);
25526
+ }
25527
+ /**
25528
+ * Read an int-returning SCORE call. `iconService.call(...)` registers no result converter, so
25529
+ * `execute()` resolves the raw JSON-RPC `result` — a bare hex string for an int, not `{ value }`.
25530
+ */
25531
+ async readIrc2Balance(transaction) {
25532
+ const result = await this.iconService.call(transaction).execute();
25533
+ if (typeof result !== "string") {
25534
+ throw new Error(`[IconSpokeService] Unexpected balanceOf response: ${JSON.stringify(result)}`);
25535
+ }
25536
+ return hexToBigInt(result);
25537
+ }
25538
+ /**
25539
+ * Get the user's own wallet balance of a token on ICON, in smallest units. Native ICX is read
25540
+ * via `iconService.getBalance`; IRC-2 tokens via a `balanceOf(_owner)` call on the token contract.
25541
+ * @param {GetBalanceParams<IconChainKey>} params - The chain key, user address, and token.
25542
+ * @returns {Promise<bigint>} The token balance in smallest units.
25543
+ */
25544
+ async getWalletBalance(params) {
25545
+ const { srcChainKey, srcAddress, token } = params;
25546
+ if (isNativeToken(srcChainKey, token)) {
25547
+ const balance = await this.iconService.getBalance(srcAddress).execute();
25548
+ return BigInt(balance.toFixed());
25549
+ }
25550
+ const transaction = new CallBuilder().to(token.address).method("balanceOf").params({ _owner: srcAddress }).build();
25551
+ return this.readIrc2Balance(transaction);
25552
+ }
25553
+ /**
25554
+ * Get the user's own wallet balances of multiple tokens on ICON, in smallest units. Native ICX
25555
+ * is read via `iconService.getBalance`; IRC-2 balances are batched into a single `tryAggregate`
25556
+ * multicall so every `balanceOf(_owner)` read shares one round-trip.
25557
+ * @param {GetBalancesParams<IconChainKey>} params - The chain key, user address, and tokens.
25558
+ * @returns {Promise<WalletBalanceMap>} A map of token address to balance in smallest units.
25559
+ */
25560
+ async getWalletBalances(params) {
25561
+ const { srcChainKey, srcAddress, tokens } = params;
25562
+ const nativeTokens = tokens.filter((token) => isNativeToken(srcChainKey, token));
25563
+ const nonNativeTokens = tokens.filter((token) => !isNativeToken(srcChainKey, token));
25564
+ const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
25565
+ if (nativeTokens.length > 0) {
25566
+ try {
25567
+ const balance = await this.iconService.getBalance(srcAddress).execute();
25568
+ for (const token of nativeTokens) {
25569
+ collector.ok(token.address, BigInt(balance.toFixed()));
25570
+ }
25571
+ } catch (error) {
25572
+ for (const token of nativeTokens) {
25573
+ collector.fail(token.address, error);
25574
+ }
25575
+ }
25576
+ }
25577
+ if (nonNativeTokens.length === 0) {
25578
+ return collector.finish();
25579
+ }
25580
+ const multicallAddress = "cxa4aa9185e23558cff990f494c1fd2845f6cbf741";
25581
+ const calls = nonNativeTokens.map((token) => ({
25582
+ target: token.address,
25583
+ method: "balanceOf",
25584
+ params: [srcAddress]
25585
+ }));
25586
+ const transaction = new CallBuilder().to(multicallAddress).method("tryAggregate").params({ requireSuccess: Converter.toHex(0), calls }).build();
25062
25587
  const result = await this.iconService.call(transaction).execute();
25063
- return BigInt(result.value);
25588
+ const aggregated = result.returnData;
25589
+ if (!Array.isArray(aggregated) || aggregated.length !== nonNativeTokens.length) {
25590
+ throw new Error(
25591
+ `[IconSpokeService] tryAggregate returned ${Array.isArray(aggregated) ? aggregated.length : "no"} entries for ${nonNativeTokens.length} tokens`
25592
+ );
25593
+ }
25594
+ nonNativeTokens.forEach((token, index) => {
25595
+ const agg = aggregated[index];
25596
+ if (agg && agg.success !== "0x0" && typeof agg.returnData === "string") {
25597
+ collector.ok(token.address, hexToBigInt(agg.returnData));
25598
+ } else {
25599
+ collector.fail(token.address, new Error(`balanceOf failed for ${token.address}: ${agg?.returnData}`));
25600
+ }
25601
+ });
25602
+ return collector.finish();
25064
25603
  }
25065
25604
  /**
25066
25605
  * Sends a message to the hub chain.
@@ -25126,6 +25665,7 @@ var GAS_PRICE_REGEX = /^(\d+)(.*)$/;
25126
25665
  var InjectiveSpokeService = class {
25127
25666
  config;
25128
25667
  chainGrpcWasmApi;
25668
+ indexerGrpcAccountPortfolioApi;
25129
25669
  txClient;
25130
25670
  endpoints;
25131
25671
  pollingIntervalMs;
@@ -25135,6 +25675,7 @@ var InjectiveSpokeService = class {
25135
25675
  this.config = config;
25136
25676
  this.endpoints = getNetworkEndpoints(Network.Mainnet);
25137
25677
  this.chainGrpcWasmApi = new ChainGrpcWasmApi(this.endpoints.grpc);
25678
+ this.indexerGrpcAccountPortfolioApi = new IndexerGrpcAccountPortfolioApi(this.endpoints.indexer);
25138
25679
  this.txClient = new TxGrpcApi(this.endpoints.grpc);
25139
25680
  this.pollingIntervalMs = this.config.sodaxConfig.chains[ChainKeys.INJECTIVE_MAINNET].pollingConfig.pollingIntervalMs;
25140
25681
  this.maxTimeoutMs = this.config.sodaxConfig.chains[ChainKeys.INJECTIVE_MAINNET].pollingConfig.maxTimeoutMs;
@@ -25218,6 +25759,37 @@ var InjectiveSpokeService = class {
25218
25759
  );
25219
25760
  return BigInt(fromBase64(response.data));
25220
25761
  }
25762
+ /**
25763
+ * Get the user's own wallet balance of a token on Injective, in smallest units. On Injective every
25764
+ * asset is a bank coin, so the native coin (`inj`) and factory/peggy/IBC tokens are all read from the
25765
+ * account's portfolio bank balances and matched by denom. The denom is the chain's native denom for
25766
+ * the native coin and `params.token.address` for standard tokens.
25767
+ * @param {GetBalanceParams<InjectiveChainKey>} params - The chain key, user address, and token.
25768
+ * @returns {Promise<bigint>} The token balance in smallest units, or 0n when the account holds none.
25769
+ */
25770
+ async getWalletBalance(params) {
25771
+ const denom = isNativeToken(params.srcChainKey, params.token) ? this.config.getChainConfig(params.srcChainKey).nativeToken : params.token.address;
25772
+ const portfolio = await this.indexerGrpcAccountPortfolioApi.fetchAccountPortfolioBalances(params.srcAddress);
25773
+ const balance = portfolio.bankBalancesList.find((_balance) => _balance.denom === denom);
25774
+ return balance ? BigInt(balance.amount) : 0n;
25775
+ }
25776
+ /**
25777
+ * Get the user's own wallet balances of multiple tokens on Injective, in smallest units.
25778
+ * @param {GetBalancesParams<InjectiveChainKey>} params - The chain key, user address, and tokens.
25779
+ * @returns {Promise<WalletBalanceMap>} A map of token address to balance in smallest units.
25780
+ */
25781
+ async getWalletBalances(params) {
25782
+ const { srcChainKey, srcAddress, tokens } = params;
25783
+ const portfolio = await this.indexerGrpcAccountPortfolioApi.fetchAccountPortfolioBalances(srcAddress);
25784
+ const amountByDenom = new Map(portfolio.bankBalancesList.map((balance) => [balance.denom, BigInt(balance.amount)]));
25785
+ const nativeDenom = this.config.getChainConfig(srcChainKey).nativeToken;
25786
+ const balances = {};
25787
+ for (const token of tokens) {
25788
+ const denom = isNativeToken(srcChainKey, token) ? nativeDenom : token.address;
25789
+ balances[token.address] = amountByDenom.get(denom) ?? 0n;
25790
+ }
25791
+ return balances;
25792
+ }
25221
25793
  async getRawTransaction(chainId, senderAddress, contractAddress, msg, memo, funds = []) {
25222
25794
  const msgExec = MsgExecuteContract.fromJSON({
25223
25795
  contractAddress,
@@ -26025,6 +26597,138 @@ var SpokeService = class _SpokeService {
26025
26597
  return { ok: false, error };
26026
26598
  }
26027
26599
  }
26600
+ /**
26601
+ * Get a user's own wallet balance of a single token on a spoke chain, in smallest units.
26602
+ * Chain-agnostic: dispatches to the per-chain service, which reads the native coin or the
26603
+ * chain's token standard (EVM erc20, Solana SPL, …). Unlike {@link getDeposit}, this reads
26604
+ * `srcAddress` itself, not the protocol asset manager.
26605
+ * @param {GetBalanceParams<C>} params - The chain key, user address, and token.
26606
+ * @returns {Promise<Result<bigint>>} The token balance in smallest units.
26607
+ */
26608
+ async getWalletBalance(params) {
26609
+ try {
26610
+ if (isHubChainKeyType(params.srcChainKey)) {
26611
+ const value = await this.sonic.getWalletBalance(params);
26612
+ return { ok: true, value };
26613
+ }
26614
+ const chainType = getChainType(params.srcChainKey);
26615
+ switch (chainType) {
26616
+ case "EVM": {
26617
+ const value = await this.evm.getWalletBalance(params);
26618
+ return { ok: true, value };
26619
+ }
26620
+ case "INJECTIVE": {
26621
+ const value = await this.injective.getWalletBalance(params);
26622
+ return { ok: true, value };
26623
+ }
26624
+ case "STELLAR": {
26625
+ const value = await this.stellar.getWalletBalance(params);
26626
+ return { ok: true, value };
26627
+ }
26628
+ case "SUI": {
26629
+ const value = await this.sui.getWalletBalance(params);
26630
+ return { ok: true, value };
26631
+ }
26632
+ case "ICON": {
26633
+ const value = await this.icon.getWalletBalance(params);
26634
+ return { ok: true, value };
26635
+ }
26636
+ case "SOLANA": {
26637
+ const value = await this.solana.getWalletBalance(params);
26638
+ return { ok: true, value };
26639
+ }
26640
+ case "STACKS": {
26641
+ const value = await this.stacks.getWalletBalance(params);
26642
+ return { ok: true, value };
26643
+ }
26644
+ case "BITCOIN": {
26645
+ const value = await this.bitcoin.getWalletBalance(params);
26646
+ return { ok: true, value };
26647
+ }
26648
+ case "NEAR": {
26649
+ const value = await this.near.getWalletBalance(params);
26650
+ return { ok: true, value };
26651
+ }
26652
+ default: {
26653
+ const exhaustiveCheck = chainType;
26654
+ this.config.logger.debug("Unhandled exhaustive case", { value: exhaustiveCheck });
26655
+ return {
26656
+ ok: false,
26657
+ error: new Error(`[getWalletBalance] Invalid chain type. Valid chain types: ${ChainTypeArr.join(", ")}`)
26658
+ };
26659
+ }
26660
+ }
26661
+ } catch (error) {
26662
+ return { ok: false, error };
26663
+ }
26664
+ }
26665
+ /**
26666
+ * Get a user's own wallet balances of multiple tokens on a spoke chain, in smallest units.
26667
+ * Chain-agnostic sibling of {@link getWalletBalance}; per-chain services batch the reads where the
26668
+ * chain supports it (e.g. EVM multicall3, ICON aggregated call data).
26669
+ * @param {GetBalancesParams<C>} params - The chain key, user address, and tokens.
26670
+ * @returns {Promise<Result<WalletBalanceMap>>} A map of token address to balance in smallest
26671
+ * units. A token that could not be read is logged and reported as `0n`; the `Result` fails when
26672
+ * the whole batch is unusable — invalid chain, a shared round-trip every token depends on, or a
26673
+ * batch in which no token could be read at all.
26674
+ */
26675
+ async getWalletBalances(params) {
26676
+ try {
26677
+ if (isHubChainKeyType(params.srcChainKey)) {
26678
+ const value = await this.sonic.getWalletBalances(params);
26679
+ return { ok: true, value };
26680
+ }
26681
+ const chainType = getChainType(params.srcChainKey);
26682
+ switch (chainType) {
26683
+ case "EVM": {
26684
+ const value = await this.evm.getWalletBalances(params);
26685
+ return { ok: true, value };
26686
+ }
26687
+ case "INJECTIVE": {
26688
+ const value = await this.injective.getWalletBalances(params);
26689
+ return { ok: true, value };
26690
+ }
26691
+ case "STELLAR": {
26692
+ const value = await this.stellar.getWalletBalances(params);
26693
+ return { ok: true, value };
26694
+ }
26695
+ case "SUI": {
26696
+ const value = await this.sui.getWalletBalances(params);
26697
+ return { ok: true, value };
26698
+ }
26699
+ case "ICON": {
26700
+ const value = await this.icon.getWalletBalances(params);
26701
+ return { ok: true, value };
26702
+ }
26703
+ case "SOLANA": {
26704
+ const value = await this.solana.getWalletBalances(params);
26705
+ return { ok: true, value };
26706
+ }
26707
+ case "STACKS": {
26708
+ const value = await this.stacks.getWalletBalances(params);
26709
+ return { ok: true, value };
26710
+ }
26711
+ case "BITCOIN": {
26712
+ const value = await this.bitcoin.getWalletBalances(params);
26713
+ return { ok: true, value };
26714
+ }
26715
+ case "NEAR": {
26716
+ const value = await this.near.getWalletBalances(params);
26717
+ return { ok: true, value };
26718
+ }
26719
+ default: {
26720
+ const exhaustiveCheck = chainType;
26721
+ this.config.logger.debug("Unhandled exhaustive case", { value: exhaustiveCheck });
26722
+ return {
26723
+ ok: false,
26724
+ error: new Error(`[getWalletBalances] Invalid chain type. Valid chain types: ${ChainTypeArr.join(", ")}`)
26725
+ };
26726
+ }
26727
+ }
26728
+ } catch (error) {
26729
+ return { ok: false, error };
26730
+ }
26731
+ }
26028
26732
  /**
26029
26733
  * Calls the connection contract on the spoke chain to send a message to the hub wallet, which then executes the message's payload.
26030
26734
  * @param {HubAddress} from - The address of the user on the hub chain.
@@ -27866,9 +28570,38 @@ var TokensByChainMapSchema = v.custom(
27866
28570
  );
27867
28571
  var TokensListSchema = v.array(XTokenSchema);
27868
28572
  var ReserveAssetsSchema = v.array(AddressSchema);
28573
+ var ORACLE_CANDLE_INTERVALS = ["1m", "5m", "1h", "1d"];
28574
+ var OracleCandleIntervalSchema = v.picklist(ORACLE_CANDLE_INTERVALS);
28575
+ var OracleMarketsResponseSchema = v.object({
28576
+ quote: v.string(),
28577
+ intervals: v.array(
28578
+ v.object({
28579
+ key: v.string(),
28580
+ label: v.string(),
28581
+ seconds: v.number()
28582
+ })
28583
+ ),
28584
+ symbols: v.array(v.string())
28585
+ });
28586
+ var OracleCandlesResponseSchema = v.object({
28587
+ symbol: v.string(),
28588
+ quote: v.string(),
28589
+ interval: OracleCandleIntervalSchema,
28590
+ candles: v.array(
28591
+ v.object({
28592
+ timestamp: v.number(),
28593
+ open: v.string(),
28594
+ high: v.string(),
28595
+ low: v.string(),
28596
+ close: v.string(),
28597
+ final: v.optional(v.boolean())
28598
+ })
28599
+ )
28600
+ });
27869
28601
 
27870
28602
  // src/backendApi/guards.ts
27871
28603
  var isFillEvent = (value) => v.is(FillEventSchema, value);
28604
+ var isOracleCandleInterval = (value) => v.is(OracleCandleIntervalSchema, value);
27872
28605
  function decodePacketIntentTarget(payload) {
27873
28606
  try {
27874
28607
  const hex = payload.startsWith("0x") ? payload.slice(2) : payload;
@@ -32401,6 +33134,46 @@ var BackendApiService = class {
32401
33134
  const endpoint = `/moneymarket/borrowers?${queryString}`;
32402
33135
  return this.request(endpoint, { ...config, method: "GET" }, MoneyMarketBorrowersSchema);
32403
33136
  }
33137
+ // Oracle endpoints
33138
+ /**
33139
+ * Fetch the oracle candle store's discovery payload: the quote currency (currently always
33140
+ * `"USD"`), the selectable candle intervals, and the canonical symbols that have candle data.
33141
+ *
33142
+ * Use this to populate a symbol picker and interval switcher before calling
33143
+ * {@link getOracleCandles}.
33144
+ *
33145
+ * @returns `Result<OracleMarketsResponse>` — on success, `{ quote, intervals, symbols }`.
33146
+ */
33147
+ async getOracleMarkets(config) {
33148
+ return this.request("/oracle/markets", { ...config, method: "GET" }, OracleMarketsResponseSchema);
33149
+ }
33150
+ /**
33151
+ * Fetch USD OHLC candles for a symbol over the half-open time range `[from, to)`.
33152
+ *
33153
+ * `from` and `to` are UNIX **seconds** (integers); `to` is exclusive and must exceed `from`,
33154
+ * and the range may cover at most 5000 buckets of the requested interval (invalid or wider
33155
+ * ranges fail with HTTP 400). A valid range with no stored candles resolves `ok` with
33156
+ * `candles: []`; an unknown symbol currently does the same rather than returning 404. The last
33157
+ * candle may still be forming; re-poll while its `final === false`.
33158
+ * Responses are cached server-side for roughly 10 seconds per distinct URL.
33159
+ *
33160
+ * @param params.symbol - Canonical symbol, exact case, from {@link getOracleMarkets} (e.g. `"ETH"`).
33161
+ * @param params.interval - Candle bucket size: `'1m' | '5m' | '1h' | '1d'`.
33162
+ * @param params.from - Range start, UNIX seconds, inclusive.
33163
+ * @param params.to - Range end, UNIX seconds, exclusive.
33164
+ * @returns `Result<OracleCandlesResponse>` — on success, the echoed query dimensions and
33165
+ * oldest-first candles with USD decimal-string prices (no volume field).
33166
+ */
33167
+ async getOracleCandles(params, config) {
33168
+ const queryParams = new URLSearchParams();
33169
+ queryParams.append("symbol", params.symbol);
33170
+ queryParams.append("interval", params.interval);
33171
+ queryParams.append("from", String(params.from));
33172
+ queryParams.append("to", String(params.to));
33173
+ const queryString = queryParams.toString();
33174
+ const endpoint = `/oracle/candles?${queryString}`;
33175
+ return this.request(endpoint, { ...config, method: "GET" }, OracleCandlesResponseSchema);
33176
+ }
32404
33177
  /**
32405
33178
  * Fetch the complete SODAX runtime configuration in a single request.
32406
33179
  *
@@ -42591,7 +43364,7 @@ function xlmDecimalToStroops(amount) {
42591
43364
  const scaled = `${whole}${fraction.padEnd(XLM_DECIMALS, "0").slice(0, XLM_DECIMALS)}`;
42592
43365
  return BigInt(scaled);
42593
43366
  }
42594
- var STELLAR_BASE_RESERVE_STROOPS = 5000000n;
43367
+ var STELLAR_BASE_RESERVE_STROOPS2 = 5000000n;
42595
43368
  var BASE_RESERVE_UNITS = 2;
42596
43369
  function parseBaseReserveStroops(ledger) {
42597
43370
  const value = ledger?.base_reserve_in_stroops;
@@ -42618,7 +43391,7 @@ var SPONSOR_CONFIG_TTL_MS = 6e4;
42618
43391
  var STELLAR_BASE_RESERVE_TTL_MS = 36e5;
42619
43392
  var DEFAULT_MAX_HORIZON_RETRIES = 2;
42620
43393
  var STELLAR_FEE_HEADROOM_STROOPS = 100000n;
42621
- var STELLAR_TRUSTLINE_MIN_XLM_STROOPS = STELLAR_BASE_RESERVE_STROOPS + STELLAR_FEE_HEADROOM_STROOPS;
43394
+ var STELLAR_TRUSTLINE_MIN_XLM_STROOPS = STELLAR_BASE_RESERVE_STROOPS2 + STELLAR_FEE_HEADROOM_STROOPS;
42622
43395
  var SponsoringService = class {
42623
43396
  config;
42624
43397
  spoke;
@@ -42721,7 +43494,7 @@ var SponsoringService = class {
42721
43494
  reason: messageOf(error, String(error))
42722
43495
  });
42723
43496
  }
42724
- return STELLAR_BASE_RESERVE_STROOPS;
43497
+ return STELLAR_BASE_RESERVE_STROOPS2;
42725
43498
  };
42726
43499
  const request = read().then((value) => {
42727
43500
  this.baseReserveCache = { value, expiresAt: Date.now() + STELLAR_BASE_RESERVE_TTL_MS };
@@ -43077,4 +43850,4 @@ var isPartnerError = isCodeMember(PARTNER_CODES);
43077
43850
  (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
43078
43851
  */
43079
43852
 
43080
- export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, AssetService, BACKEND_API_BASE_PATH, BITCOIN_CHAIN_KEYS, BITCOIN_CHAIN_KEYS_SET, BITCOIN_DUST_SATS, BTC_WALLET_ADDRESS_TYPES, BackendApiService, BackendHttpError, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BitcoinSpokeService, BnUSDMigrationService, BridgeApiService, BridgeService, CHAIN_KEYS, CHAIN_LOGO_BASE_URL, CONFIG_VERSION, CREATE_INTENT_CODES, ChainKeys, ChainTypeArr, ClService, ConfigService, CustomSorobanServer, CustomStellarAccount, DEFAULT_API_BASE_URL, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, DEFAULT_SPONSORING_API_ENDPOINT, DETAILED_STATUS_NOT_DELIVERED, DexService, EVM_CHAIN_ID_TO_KEY, EVM_CHAIN_KEYS, EVM_CHAIN_KEYS_SET, EVM_SPOKE_ONLY_CHAIN_KEYS, EVM_SPOKE_ONLY_CHAIN_KEYS_SET, Erc20Service, Erc4626Service, EvmAssetManagerService, EvmHubProvider, EvmSolverService, EvmSpokeService, EvmVaultTokenService, FEE_PERCENTAGE_SCALE, GAS_ESTIMATION_CODES, HALF_RAY, HALF_WAD, HUB_CHAIN_KEY, HookKind, HookService, HttpRelayError, HubVaultSymbols, ICON_CHAIN_KEYS, ICON_CHAIN_KEYS_SET, ICON_TX_RESULT_WAIT_MAX_RETRY, INJECTIVE_CHAIN_KEYS, INJECTIVE_CHAIN_KEYS_SET, INTENT_CHAIN_IDS, IconSpokeService, IcxMigrationService, Injective20Token, InjectiveSpokeService, IntentCreatedEventAbi, IntentDataService, IntentDataType, IntentFilledEventAbi, IntentRelayChainIdToChainKey, IntentsAbi, LOOKUP_CODES, LTV_PRECISION, LendingPoolService, LeverageYieldService, LockupMultiplier, LockupPeriod, LsodaSymbols, LsodaTokens, MAX_UINT256, MigrationService, MintPositionEventAbi, MoneyMarketDataService, MoneyMarketService, NEAR_CHAIN_KEYS, NEAR_CHAIN_KEYS_SET, NEAR_DEFAULT_GAS, NEAR_STORAGE_DEPOSIT, NearSpokeService, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RELAY_FALLBACK_FLOOR_MS, RELAY_REQUEST_TIMEOUT_MS, RadfiApiError, RadfiProvider, RecoveryService, RelayChainIdMap, SECONDS_PER_YEAR, SODAX_ERROR_CODES, SODAX_FEATURES, SOLANA_CHAIN_KEYS, SOLANA_CHAIN_KEYS_SET, SONIC_CHAIN_KEYS, SONIC_CHAIN_KEYS_SET, SPEED_TIER_SECONDS, SPEED_TIER_THRESHOLDS, SPONSORING_API_ERROR_CODES, SPONSORING_API_STELLAR_BASE_PATH, SPONSOR_CONFIG_TTL_MS, STACKS_CHAIN_KEYS, STACKS_CHAIN_KEYS_SET, STELLAR_BASE_RESERVE_TTL_MS, STELLAR_CHAIN_KEYS, STELLAR_CHAIN_KEYS_SET, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, SUI_CHAIN_KEYS, SUI_CHAIN_KEYS_SET, SodaTokens, Sodax, SodaxError, SolanaSpokeService, SolverApiService, SolverIntentErrorCode, SolverIntentStatusCode, SonicSpokeService, SpokeService, SponsoringApiService, SponsoringService, StacksSpokeService, StakingLogic, StakingService, StatATokenAddresses, StellarSpokeService, SuiGrpcTransport, SuiSpokeService, SupportedMigrationTokens, SwapService, SwapsApiService, TOKEN_LOGO_BASE_URL, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, adjustAmountByFee, allowanceCheckFailed, apiConfig, approveFailed, arbitrumSupportedTokens, assetManagerAbi, avalancheSupportedTokens, balnSwapAbi, baseChainInfo, baseSupportedTokens, binomialApproximatedRayPow, bitcoinSupportedTokens, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bridgeConfig, bridgeInvariant, bscSupportedTokens, calcOpReturnOutputVbytes, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, classifySponsorError, concentratedLiquidityConfig, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, erc20Abi, erc4626Abi, estimateBitcoinTxSize, estimateSwapSpeedTier, ethereumSupportedTokens, executionFailed, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getChainKeyFromRelayChainId, getChainType, getCompoundedBalance, getConcentratedLiquidityConfig, getConnectionIdl, getConnectionProgram, getEvmChainKeyByChainId, getEvmViemChain, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeHook, getSpokeHooks, getStagingSolverTokens, getSupportedSolverTokens, getTransactionPackets, getbnUSDToken, hederaSupportedTokens, hexToBigInt, hexToSolanaAddress, hubConfig, hyper, hyperevmSupportedTokens, iconSupportedTokens, injectiveSupportedTokens, intentCreationFailed, isApprovalSupportedChainKeyType, isAuthFailure, isAuthStatus, isBackendHttpError, isBalnMigrateParams, isBitcoinChainKey, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexApproveError, isDexCreateIntentError, isDexError, isEvmChainKey, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKey, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isFillEvent, isHookSupportedToken, isHubChainKey, isHubChainKeyType, isIconAddress, isIconChainKey, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKey, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isLeverageYieldAllowanceCheckError, isLeverageYieldApproveError, isLeverageYieldCreateIntentError, isLeverageYieldError, isLeverageYieldLookupError, isLeverageYieldPostExecutionError, isLeverageYieldSwapError, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNativeBitcoinToken, isNativeBitcoinTransfer, isNativeToken, isNearChainKey, isNearChainKeyType, isNewbnUSDChainId, isNewbnUSDToken, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKey, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKey, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeChainKey, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isSponsoringConfigError, isSponsoringLookupError, isSponsoringOrchestrationError, isStacksChainKey, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKey, isStellarChainKeyType, isStellarWalletProviderType, isSuiChainKey, isSuiChainKeyType, isSupportedBitcoinAddressType, isSwapCreateIntentError, isSwapError, isSwapSupportedToken, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, isValidWalletProviderForChainKey, kaiaSupportedTokens, leverageYieldConfig, leverageYieldInvariant, leverageYieldVaults, lightlinkSupportedTokens, lookupFailed, mapRelayFailure, mergeSodaxConfig, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, moneyMarketConfig, moneyMarketReserveAssets, moneyMarketSupportedTokens, nativeToUSD, nearSupportedTokens, newbnUSDSpokeChainIds, noopAnalytics, normalize, normalizeBN, normalizePsbtToBase64, normalizeSignatureToBase64, normalizedToUsd, optimismSupportedTokens, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, polygonSupportedTokens, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, redbellySupportedTokens, relayConfig, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, resolveAnalytics, resolveLogger, retry, reverseEncodeAddress, robinhoodChain, robinhoodSupportedTokens, serializeAddressData, silentLogger, sleep, sodaxConfig, sodaxInvariant, solanaSupportedTokens, solverConfig, sonicSupportedTokens, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainKeysSet, spokeHooks, sponsoringInvariant, stacksSupportedTokens, stagingSwapSupportedTokens, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, stellarSupportedTokens, submitTransaction, suiSupportedTokens, supportedSpokeChains, supportedTokensByChain, swapExactInSingleParamsAbi, swapInvariant, swapSupportedTokens, swapsConfig, toCreateBridgeIntentParamsV2, toSuiExecutionResult, toSuiExecutionStatus, toSuiPaginatedCoins, tokenLogo, tokenLogoSlug, uiPoolDataAbi, universalRouterAbi, unknownFailed, usesBip322MessageSigning, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
43853
+ export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, AssetService, BACKEND_API_BASE_PATH, BITCOIN_CHAIN_KEYS, BITCOIN_CHAIN_KEYS_SET, BITCOIN_DUST_SATS, BTC_WALLET_ADDRESS_TYPES, BackendApiService, BackendHttpError, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BitcoinSpokeService, BnUSDMigrationService, BridgeApiService, BridgeService, CHAIN_KEYS, CHAIN_LOGO_BASE_URL, CONFIG_VERSION, CREATE_INTENT_CODES, ChainKeys, ChainTypeArr, ClService, ConfigService, CustomSorobanServer, CustomStellarAccount, DEFAULT_API_BASE_URL, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, DEFAULT_SPONSORING_API_ENDPOINT, DETAILED_STATUS_NOT_DELIVERED, DexService, EVM_CHAIN_ID_TO_KEY, EVM_CHAIN_KEYS, EVM_CHAIN_KEYS_SET, EVM_SPOKE_ONLY_CHAIN_KEYS, EVM_SPOKE_ONLY_CHAIN_KEYS_SET, Erc20Service, Erc4626Service, EvmAssetManagerService, EvmHubProvider, EvmSolverService, EvmSpokeService, EvmVaultTokenService, FEE_PERCENTAGE_SCALE, GAS_ESTIMATION_CODES, HALF_RAY, HALF_WAD, HUB_CHAIN_KEY, HookKind, HookService, HttpRelayError, HubVaultSymbols, ICON_CHAIN_KEYS, ICON_CHAIN_KEYS_SET, ICON_TX_RESULT_WAIT_MAX_RETRY, INJECTIVE_CHAIN_KEYS, INJECTIVE_CHAIN_KEYS_SET, INTENT_CHAIN_IDS, IconSpokeService, IcxMigrationService, Injective20Token, InjectiveSpokeService, IntentCreatedEventAbi, IntentDataService, IntentDataType, IntentFilledEventAbi, IntentRelayChainIdToChainKey, IntentsAbi, LOOKUP_CODES, LTV_PRECISION, LendingPoolService, LeverageYieldService, LockupMultiplier, LockupPeriod, LsodaSymbols, LsodaTokens, MAX_UINT256, MigrationService, MintPositionEventAbi, MoneyMarketDataService, MoneyMarketService, NEAR_CHAIN_KEYS, NEAR_CHAIN_KEYS_SET, NEAR_DEFAULT_GAS, NEAR_STORAGE_DEPOSIT, NearSpokeService, ORACLE_CANDLE_INTERVALS, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RELAY_FALLBACK_FLOOR_MS, RELAY_REQUEST_TIMEOUT_MS, RadfiApiError, RadfiProvider, RecoveryService, RelayChainIdMap, SECONDS_PER_YEAR, SODAX_ERROR_CODES, SODAX_FEATURES, SOLANA_CHAIN_KEYS, SOLANA_CHAIN_KEYS_SET, SONIC_CHAIN_KEYS, SONIC_CHAIN_KEYS_SET, SPEED_TIER_SECONDS, SPEED_TIER_THRESHOLDS, SPONSORING_API_ERROR_CODES, SPONSORING_API_STELLAR_BASE_PATH, SPONSOR_CONFIG_TTL_MS, STACKS_CHAIN_KEYS, STACKS_CHAIN_KEYS_SET, STELLAR_BASE_RESERVE_TTL_MS, STELLAR_CHAIN_KEYS, STELLAR_CHAIN_KEYS_SET, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, SUI_CHAIN_KEYS, SUI_CHAIN_KEYS_SET, SodaTokens, Sodax, SodaxError, SolanaSpokeService, SolverApiService, SolverIntentErrorCode, SolverIntentStatusCode, SonicSpokeService, SpokeService, SponsoringApiService, SponsoringService, StacksSpokeService, StakingLogic, StakingService, StatATokenAddresses, StellarSpokeService, SuiGrpcTransport, SuiSpokeService, SupportedMigrationTokens, SwapService, SwapsApiService, TOKEN_LOGO_BASE_URL, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, adjustAmountByFee, allowanceCheckFailed, apiConfig, approveFailed, arbitrumSupportedTokens, assetManagerAbi, avalancheSupportedTokens, balnSwapAbi, baseChainInfo, baseSupportedTokens, binomialApproximatedRayPow, bitcoinSupportedTokens, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bridgeConfig, bridgeInvariant, bscSupportedTokens, calcOpReturnOutputVbytes, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, classifySponsorError, concentratedLiquidityConfig, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createBalanceCollector, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, erc20Abi, erc4626Abi, estimateBitcoinTxSize, estimateSwapSpeedTier, ethereumSupportedTokens, executionFailed, formatBasisPoints, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getChainKeyFromRelayChainId, getChainType, getCompoundedBalance, getConcentratedLiquidityConfig, getConnectionIdl, getConnectionProgram, getEvmChainKeyByChainId, getEvmViemChain, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeHook, getSpokeHooks, getStagingSolverTokens, getSupportedSolverTokens, getTransactionPackets, getbnUSDToken, hederaSupportedTokens, hexToBigInt, hexToSolanaAddress, hubConfig, hyper, hyperevmSupportedTokens, iconSupportedTokens, injectiveSupportedTokens, intentCreationFailed, isApprovalSupportedChainKeyType, isAuthFailure, isAuthStatus, isBackendHttpError, isBalnMigrateParams, isBitcoinChainKey, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexApproveError, isDexCreateIntentError, isDexError, isEvmChainKey, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKey, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isFillEvent, isHookSupportedToken, isHubChainKey, isHubChainKeyType, isIconAddress, isIconChainKey, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKey, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isLeverageYieldAllowanceCheckError, isLeverageYieldApproveError, isLeverageYieldCreateIntentError, isLeverageYieldError, isLeverageYieldLookupError, isLeverageYieldPostExecutionError, isLeverageYieldSwapError, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNativeBitcoinToken, isNativeBitcoinTransfer, isNativeToken, isNearChainKey, isNearChainKeyType, isNewbnUSDChainId, isNewbnUSDToken, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isOracleCandleInterval, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKey, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKey, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeChainKey, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isSponsoringConfigError, isSponsoringLookupError, isSponsoringOrchestrationError, isStacksChainKey, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKey, isStellarChainKeyType, isStellarWalletProviderType, isSuiChainKey, isSuiChainKeyType, isSupportedBitcoinAddressType, isSwapCreateIntentError, isSwapError, isSwapSupportedToken, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, isValidWalletProviderForChainKey, kaiaSupportedTokens, leverageYieldConfig, leverageYieldInvariant, leverageYieldVaults, lightlinkSupportedTokens, lookupFailed, mapRelayFailure, mergeSodaxConfig, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, moneyMarketConfig, moneyMarketReserveAssets, moneyMarketSupportedTokens, nativeToUSD, nearSupportedTokens, newbnUSDSpokeChainIds, noopAnalytics, normalize, normalizeBN, normalizePsbtToBase64, normalizeSignatureToBase64, normalizedToUsd, optimismSupportedTokens, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, polygonSupportedTokens, poolAbi, poolKeyAbi, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, redbellySupportedTokens, relayConfig, relayTxAndWaitPacket, requestAddress, requestJsonRpc, requestSigning, resolveAnalytics, resolveLogger, retry, reverseEncodeAddress, robinhoodChain, robinhoodSupportedTokens, serializeAddressData, settleWalletBalances, silentLogger, sleep, sodaxConfig, sodaxInvariant, solanaSupportedTokens, solverConfig, sonicSupportedTokens, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainKeysSet, spokeHooks, sponsoringInvariant, stacksSupportedTokens, stagingSwapSupportedTokens, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, stellarSupportedTokens, submitTransaction, suiSupportedTokens, supportedSpokeChains, supportedTokensByChain, swapExactInSingleParamsAbi, swapInvariant, swapSupportedTokens, swapsConfig, toCreateBridgeIntentParamsV2, toSuiExecutionResult, toSuiExecutionStatus, toSuiPaginatedCoins, tokenLogo, tokenLogoSlug, uiPoolDataAbi, universalRouterAbi, unknownFailed, usesBip322MessageSigning, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };