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

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
@@ -1,11 +1,11 @@
1
- import { getAbiItem, parseAbi, isAddress, toHex, hexToBytes, encodeAbiParameters, parseAbiParameters, defineChain, encodeFunctionData, erc20Abi as erc20Abi$1, createPublicClient, http, bytesToHex, keccak256, stringToBytes, fromHex, encodePacked, decodeAbiParameters, parseEventLogs, isHex, maxUint160, maxUint48, fallback } from 'viem';
1
+ import { getAbiItem, parseAbi, defineChain, isAddress, toHex, hexToBytes, encodeAbiParameters, parseAbiParameters, encodeFunctionData, erc20Abi as erc20Abi$1, createPublicClient, http, bytesToHex, keccak256, stringToBytes, fromHex, encodePacked, decodeAbiParameters, parseEventLogs, isHex, maxUint160, maxUint48, fallback } from 'viem';
2
+ import { initEccLib, address, networks, Transaction, Psbt, payments, opcodes, script } from 'bitcoinjs-lib';
2
3
  import { bcs } from '@mysten/sui/bcs';
3
4
  import { PublicKey, Connection, VersionedTransaction, SystemProgram, ComputeBudgetProgram, TransactionMessage, TransactionInstruction } from '@solana/web3.js';
4
5
  import { rpc, Address, xdr, Account, Horizon, Contract, TransactionBuilder, nativeToScVal, TimeoutInfinite, scValToBigInt, Operation, Asset, FeeBumpTransaction, NotFoundError, Networks, Keypair } from '@stellar/stellar-sdk';
5
- import { serializeCV, Cl, deserializeCV, cvToString, createNetwork, fetchFeeEstimateTransaction, fetchCallReadOnlyFunction, parseContractId, PostConditionMode, noneCV, someCV, uintCV, getAddressFromPublicKey, makeUnsignedContractCall, serializePayloadBytes } from '@sodax/libs/stacks/core';
6
+ import { serializeCV, Cl, deserializeCV, cvToString, createNetwork, fetchFeeEstimateTransaction, fetchCallReadOnlyFunction, parseContractId, noneCV, someCV, uintCV, getAddressFromPublicKey, makeUnsignedContractCall, serializePayloadBytes, PostConditionMode, Pc } from '@sodax/libs/stacks/core';
6
7
  import { hedera, kaia, redbellyMainnet, mainnet, lightlinkPhoenix, polygon, bsc, optimism, base, arbitrum, avalanche, sonic } from 'viem/chains';
7
8
  import * as rlp from 'rlp';
8
- import { initEccLib, networks, Transaction, Psbt, payments, opcodes, script } from 'bitcoinjs-lib';
9
9
  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';
@@ -18,7 +18,7 @@ import { ChainGrpcWasmApi, IndexerGrpcAccountPortfolioApi, TxGrpcApi, toBase64,
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';
21
- import { SwapsApi, SwapsApiError } from '@sodax/swaps-api';
21
+ import { SwapsApi, SwapsApiError, rawTxSchemaForChainKey as rawTxSchemaForChainKey$1, makeQuoteResponseSchema, DeadlineResponseSchema, AllowanceCheckResponseSchema, makeApproveResponseSchema, makeCreateIntentResponseSchema, SubmitIntentResponseSchema, StatusResponseSchema, makeCancelIntentResponseSchema, IntentHashResponseSchema, IntentPacketResponseSchema, RelayExtraDataResponseSchema as RelayExtraDataResponseSchema$1, IntentStateSchema, IntentResponseSchema as IntentResponseSchema$1, GasEstimateResponseSchema, FeeResponseSchema, SubmitTxResponseSchema, SubmitTxStatusResponseSchema } from '@sodax/swaps-api';
22
22
  export { SwapsApiError } from '@sodax/swaps-api';
23
23
  import BigNumber5, { BigNumber } from 'bignumber.js';
24
24
  import { Token, Price } from '@pancakeswap/swap-sdk-core';
@@ -94,8 +94,8 @@ function serializeCause(cause, depth) {
94
94
  }
95
95
  function sanitizeContext(value, depth) {
96
96
  const out = {};
97
- for (const [key, v10] of Object.entries(value)) {
98
- out[key] = sanitizeValue(v10, depth + 1);
97
+ for (const [key, v12] of Object.entries(value)) {
98
+ out[key] = sanitizeValue(v12, depth + 1);
99
99
  }
100
100
  return out;
101
101
  }
@@ -106,13 +106,13 @@ function sanitizeValue(value, depth) {
106
106
  if (t === "bigint") return value.toString();
107
107
  if (t === "string" || t === "number" || t === "boolean") return value;
108
108
  if (t === "function" || t === "symbol") return safeString(value);
109
- if (Array.isArray(value)) return value.map((v10) => sanitizeValue(v10, depth + 1));
109
+ if (Array.isArray(value)) return value.map((v12) => sanitizeValue(v12, depth + 1));
110
110
  if (value instanceof Date) return value.toISOString();
111
111
  if (value instanceof Map) {
112
- return Array.from(value.entries()).map(([k, v10]) => [sanitizeValue(k, depth + 1), sanitizeValue(v10, depth + 1)]);
112
+ return Array.from(value.entries()).map(([k, v12]) => [sanitizeValue(k, depth + 1), sanitizeValue(v12, depth + 1)]);
113
113
  }
114
114
  if (value instanceof Set) {
115
- return Array.from(value.values()).map((v10) => sanitizeValue(v10, depth + 1));
115
+ return Array.from(value.values()).map((v12) => sanitizeValue(v12, depth + 1));
116
116
  }
117
117
  if (value instanceof Error) return { name: value.name, message: value.message };
118
118
  if (t === "object") {
@@ -124,9 +124,9 @@ function sanitizeValue(value, depth) {
124
124
  }
125
125
  return safeString(value);
126
126
  }
127
- function safeString(v10) {
127
+ function safeString(v12) {
128
128
  try {
129
- return String(v10);
129
+ return String(v12);
130
130
  } catch {
131
131
  return "[unserializable]";
132
132
  }
@@ -4864,7 +4864,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
4864
4864
  }
4865
4865
 
4866
4866
  // ../types/dist/index.js
4867
- var CONFIG_VERSION = 232;
4867
+ var CONFIG_VERSION = 233;
4868
4868
 
4869
4869
  // src/shared/utils/resolveTimeoutMs.ts
4870
4870
  function resolveTimeoutMs(timeout, fallbackMs) {
@@ -4877,6 +4877,33 @@ function isEvmSpokeChainConfig(value) {
4877
4877
  function isIconAddress(value) {
4878
4878
  return typeof value === "string" && /^hx[a-f0-9]{40}$|^cx[a-f0-9]{40}$/.test(value);
4879
4879
  }
4880
+ var NEAR_ACCOUNT_ID_REGEX = /^(([a-z\d]+[-_])*[a-z\d]+\.)*([a-z\d]+[-_])*[a-z\d]+$/;
4881
+ function isValidNearAccountId(accountId) {
4882
+ return accountId.length >= 2 && accountId.length <= 64 && NEAR_ACCOUNT_ID_REGEX.test(accountId);
4883
+ }
4884
+ var INJECTIVE_ADDRESS_REGEX = /^inj1(?:[02-9ac-hj-np-z]{38}|[02-9ac-hj-np-z]{58})$/;
4885
+ var BECH32_CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
4886
+ var BECH32_GENERATOR = [996825010, 642813549, 513874426, 1027748829, 705979059];
4887
+ function bech32ChecksumVerifies(hrp, dataChars) {
4888
+ const values = [
4889
+ ...[...hrp].map((c) => c.charCodeAt(0) >>> 5),
4890
+ 0,
4891
+ ...[...hrp].map((c) => c.charCodeAt(0) & 31),
4892
+ ...[...dataChars].map((c) => BECH32_CHARSET.indexOf(c))
4893
+ ];
4894
+ let chk = 1;
4895
+ for (const value of values) {
4896
+ const top = chk >>> 25;
4897
+ chk = (chk & 33554431) << 5 ^ value;
4898
+ for (let i = 0; i < 5; i++) {
4899
+ if (top >>> i & 1) chk ^= BECH32_GENERATOR[i];
4900
+ }
4901
+ }
4902
+ return chk === 1;
4903
+ }
4904
+ function isValidInjectiveAddress(address) {
4905
+ return INJECTIVE_ADDRESS_REGEX.test(address) && bech32ChecksumVerifies("inj", address.slice(4));
4906
+ }
4880
4907
  function isResponseAddressType(value) {
4881
4908
  return typeof value === "object" && value !== null && "type" in value && "payload" in value && value.type === "RESPONSE_ADDRESS" && isIconAddress(value.payload);
4882
4909
  }
@@ -4984,6 +5011,81 @@ function isUndefinedOrValidWalletProviderForChainKey(chainKey, walletProvider) {
4984
5011
  function isOptionalBitcoinWalletProviderType(walletProvider) {
4985
5012
  return walletProvider === void 0 || isBitcoinWalletProviderType(walletProvider);
4986
5013
  }
5014
+ var BITCOIN_FEE_SAFETY_VBYTES = 20;
5015
+ function calcOpReturnOutputVbytes(payloadByteLength) {
5016
+ let scriptSize;
5017
+ if (payloadByteLength <= 75) {
5018
+ scriptSize = 3 + payloadByteLength;
5019
+ } else if (payloadByteLength <= 255) {
5020
+ scriptSize = 4 + payloadByteLength;
5021
+ } else {
5022
+ scriptSize = 5 + payloadByteLength;
5023
+ }
5024
+ const scriptLenVarint = scriptSize <= 252 ? 1 : 3;
5025
+ return 8 + scriptLenVarint + scriptSize;
5026
+ }
5027
+ function estimateBitcoinTxSize(inputCount, outputCount, addressType, opReturnOutputVbytes = 44) {
5028
+ let inputWeight;
5029
+ switch (addressType) {
5030
+ case "P2PKH":
5031
+ inputWeight = 148;
5032
+ break;
5033
+ case "P2SH":
5034
+ inputWeight = 91;
5035
+ break;
5036
+ case "P2TR":
5037
+ inputWeight = 58;
5038
+ break;
5039
+ default:
5040
+ inputWeight = 68;
5041
+ break;
5042
+ }
5043
+ return Math.ceil(
5044
+ 10.5 + opReturnOutputVbytes + BITCOIN_FEE_SAFETY_VBYTES + inputCount * inputWeight + outputCount * 31
5045
+ );
5046
+ }
5047
+ function encodeBtcPayloadToBytes(payload) {
5048
+ const isBase58Check = payload.address_type === "P2PKH" || payload.address_type === "P2SH";
5049
+ return JSON.stringify({
5050
+ src_address: isBase58Check ? payload.src_address : payload.src_address.toLowerCase(),
5051
+ data: payload.data.toLowerCase(),
5052
+ src_chain_id: payload.src_chain_id,
5053
+ dst_chain_id: payload.dst_chain_id,
5054
+ wallet_used: payload.wallet_used,
5055
+ timestamp: payload.timestamp,
5056
+ address_type: payload.address_type
5057
+ });
5058
+ }
5059
+ function isValidBitcoinAddress(address$1) {
5060
+ try {
5061
+ const { prefix: prefix2, version, data } = address.fromBech32(address$1);
5062
+ if (prefix2 !== "bc" && prefix2 !== "tb") return false;
5063
+ return version === 0 && (data.length === 20 || data.length === 32) || version === 1 && data.length === 32;
5064
+ } catch {
5065
+ }
5066
+ try {
5067
+ const { version } = address.fromBase58Check(address$1);
5068
+ return version === 0 || version === 5 || version === 111 || version === 196;
5069
+ } catch {
5070
+ return false;
5071
+ }
5072
+ }
5073
+ function canonicalizeBitcoinAddress(address$1) {
5074
+ try {
5075
+ address.fromBech32(address$1);
5076
+ return address$1.toLowerCase();
5077
+ } catch {
5078
+ return address$1;
5079
+ }
5080
+ }
5081
+ function normalizePsbtToBase64(signedPsbt) {
5082
+ const isHex2 = /^[0-9a-fA-F]+$/.test(signedPsbt);
5083
+ return isHex2 ? Buffer.from(signedPsbt, "hex").toString("base64") : signedPsbt;
5084
+ }
5085
+ function normalizeSignatureToBase64(signature) {
5086
+ const isHex2 = /^[0-9a-fA-F]+$/.test(signature);
5087
+ return isHex2 ? Buffer.from(signature, "hex").toString("base64") : signature;
5088
+ }
4987
5089
  function isNativeBitcoinTransfer(config, chainKey, token) {
4988
5090
  return isBitcoinChainKeyType(chainKey) && !!token && isNativeBitcoinToken(config.getChainConfig(chainKey), token.address);
4989
5091
  }
@@ -5003,11 +5105,10 @@ async function retry(action, retryCount = DEFAULT_MAX_RETRY, delayMs = DEFAULT_R
5003
5105
  throw new Error(`Retry exceeded MAX_RETRY_DEFAULT=${DEFAULT_MAX_RETRY}`);
5004
5106
  }
5005
5107
  function getRandomBytes(length) {
5006
- const array3 = new Uint8Array(length);
5007
- for (let i = 0; i < length; i++) {
5008
- array3[i] = Math.floor(Math.random() * 256);
5108
+ if (!globalThis.crypto?.getRandomValues) {
5109
+ throw new Error("Web Crypto (crypto.getRandomValues) is unavailable in this runtime");
5009
5110
  }
5010
- return array3;
5111
+ return globalThis.crypto.getRandomValues(new Uint8Array(length));
5011
5112
  }
5012
5113
  function randomUint256() {
5013
5114
  const bytes = getRandomBytes(32);
@@ -5056,6 +5157,7 @@ function encodeAddress(spokeChainId, address) {
5056
5157
  const chainType = getChainType(spokeChainId);
5057
5158
  switch (chainType) {
5058
5159
  case "EVM":
5160
+ invariant(isAddress(address), `Invalid EVM address: ${address}`);
5059
5161
  return address;
5060
5162
  case "ICON": {
5061
5163
  invariant(isIconAddress(address), `Invalid ICON address: ${address}`);
@@ -5071,8 +5173,13 @@ function encodeAddress(spokeChainId, address) {
5071
5173
  case "STACKS":
5072
5174
  return `0x${serializeCV(Cl.principal(address))}`;
5073
5175
  case "BITCOIN":
5176
+ invariant(isValidBitcoinAddress(address), `Invalid Bitcoin address: ${address}`);
5177
+ return toHex(Buffer.from(canonicalizeBitcoinAddress(address), "utf-8"));
5074
5178
  case "NEAR":
5179
+ invariant(isValidNearAccountId(address), `Invalid NEAR account id: ${address}`);
5180
+ return toHex(Buffer.from(address, "utf-8"));
5075
5181
  case "INJECTIVE":
5182
+ invariant(isValidInjectiveAddress(address), `Invalid Injective address: ${address}`);
5076
5183
  return toHex(Buffer.from(address, "utf-8"));
5077
5184
  default: {
5078
5185
  const exhaustiveCheck = chainType;
@@ -5080,6 +5187,16 @@ function encodeAddress(spokeChainId, address) {
5080
5187
  }
5081
5188
  }
5082
5189
  }
5190
+ function encodeTokenIdentifier(spokeChainId, token) {
5191
+ switch (getChainType(spokeChainId)) {
5192
+ case "BITCOIN":
5193
+ case "NEAR":
5194
+ case "INJECTIVE":
5195
+ return toHex(Buffer.from(token, "utf-8"));
5196
+ default:
5197
+ return encodeAddress(spokeChainId, token);
5198
+ }
5199
+ }
5083
5200
  function reverseEncodeAddress(spokeChainId, encoded) {
5084
5201
  const chainType = getChainType(spokeChainId);
5085
5202
  switch (chainType) {
@@ -14779,6 +14896,11 @@ var ConfigService = class {
14779
14896
  get bridgeUseBackendSubmitTx() {
14780
14897
  return this.bridge.useBackendSubmitTx ?? this.sodax.bridgeOptions?.useBackendSubmitTx ?? true;
14781
14898
  }
14899
+ // Opt-in (default OFF), unlike the swaps/bridge toggles above: the leverage-yield submit-tx
14900
+ // backend path is newer, so an omitted flag keeps the proven client-side relay.
14901
+ get leverageYieldUseBackendSubmitTx() {
14902
+ return this.leverageYield.useBackendSubmitTx ?? false;
14903
+ }
14782
14904
  get dex() {
14783
14905
  return this.sodax.dex;
14784
14906
  }
@@ -14830,7 +14952,7 @@ function mergeSodaxConfig(base2, override) {
14830
14952
  }
14831
14953
  function encodeContractCalls(calls) {
14832
14954
  return encodeAbiParameters(parseAbiParameters("(address,uint256,bytes)[]"), [
14833
- calls.map((v10) => [v10.address, v10.value, v10.data])
14955
+ calls.map((v12) => [v12.address, v12.value, v12.data])
14834
14956
  ]);
14835
14957
  }
14836
14958
  async function waitForTransactionReceipt(hash, provider) {
@@ -15033,16 +15155,20 @@ var EvmVaultTokenService = class {
15033
15155
  */
15034
15156
  static async deposit(vault, token, amount, walletProvider) {
15035
15157
  const from = await walletProvider.getWalletAddress();
15036
- return walletProvider.sendTransaction({
15037
- from,
15038
- to: vault,
15039
- value: 0n,
15040
- data: encodeFunctionData({
15041
- abi: vaultTokenAbi,
15042
- functionName: "deposit",
15043
- args: [token, amount]
15044
- })
15045
- });
15158
+ return walletProvider.sendTransaction(
15159
+ {
15160
+ from,
15161
+ to: vault,
15162
+ value: 0n,
15163
+ data: encodeFunctionData({
15164
+ abi: vaultTokenAbi,
15165
+ functionName: "deposit",
15166
+ args: [token, amount]
15167
+ })
15168
+ },
15169
+ // Vaults live on the hub; refuse to broadcast from a wallet on another EVM network.
15170
+ { expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id }
15171
+ );
15046
15172
  }
15047
15173
  /**
15048
15174
  * Withdraws a specified amount of a token from the vault.
@@ -15054,16 +15180,19 @@ var EvmVaultTokenService = class {
15054
15180
  */
15055
15181
  static async withdraw(vault, token, amount, provider) {
15056
15182
  const from = await provider.getWalletAddress();
15057
- return provider.sendTransaction({
15058
- from,
15059
- to: vault,
15060
- value: 0n,
15061
- data: encodeFunctionData({
15062
- abi: vaultTokenAbi,
15063
- functionName: "withdraw",
15064
- args: [token, amount]
15065
- })
15066
- });
15183
+ return provider.sendTransaction(
15184
+ {
15185
+ from,
15186
+ to: vault,
15187
+ value: 0n,
15188
+ data: encodeFunctionData({
15189
+ abi: vaultTokenAbi,
15190
+ functionName: "withdraw",
15191
+ args: [token, amount]
15192
+ })
15193
+ },
15194
+ { expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id }
15195
+ );
15067
15196
  }
15068
15197
  /**
15069
15198
  * Encodes the deposit transaction data for the vault.
@@ -15264,7 +15393,9 @@ var Erc20Service = class _Erc20Service {
15264
15393
  if (params.raw) {
15265
15394
  return rawTx;
15266
15395
  }
15267
- return await params.walletProvider.sendTransaction(rawTx);
15396
+ return await params.walletProvider.sendTransaction(rawTx, {
15397
+ expectedChainId: params.expectedChainId
15398
+ });
15268
15399
  }
15269
15400
  /**
15270
15401
  * Encodes a transfer transaction for a token.
@@ -15577,7 +15708,9 @@ var EvmSpokeService = class {
15577
15708
  if (params.raw === true) {
15578
15709
  return rawTx;
15579
15710
  }
15580
- return params.walletProvider.sendTransaction(rawTx);
15711
+ return params.walletProvider.sendTransaction(rawTx, {
15712
+ expectedChainId: getEvmViemChain(srcChainKey).id
15713
+ });
15581
15714
  }
15582
15715
  /**
15583
15716
  * Get the balance of the token deposited in the spoke chain asset manager.
@@ -15690,7 +15823,9 @@ var EvmSpokeService = class {
15690
15823
  if (params.raw) {
15691
15824
  return rawTx;
15692
15825
  }
15693
- return params.walletProvider.sendTransaction(rawTx);
15826
+ return params.walletProvider.sendTransaction(rawTx, {
15827
+ expectedChainId: getEvmViemChain(srcChainKey).id
15828
+ });
15694
15829
  }
15695
15830
  async waitForTransactionReceipt(params) {
15696
15831
  try {
@@ -15782,6 +15917,24 @@ var StacksSpokeService = class {
15782
15917
  });
15783
15918
  return result.value.value;
15784
15919
  }
15920
+ ftAssetNames = /* @__PURE__ */ new Map();
15921
+ /** Post-conditions need the on-chain `define-fungible-token` names; SIP-10 exposes no read for them. */
15922
+ async getFtAssetNames(tokenContractId) {
15923
+ const cached = this.ftAssetNames.get(tokenContractId);
15924
+ if (cached) return cached;
15925
+ const [address, name] = parseContractId(tokenContractId);
15926
+ const response = await fetch(`${this.network.client.baseUrl}/v2/contracts/interface/${address}/${name}`);
15927
+ if (!response.ok) {
15928
+ throw new Error(`Failed to fetch the contract interface for ${tokenContractId}: ${response.statusText}`);
15929
+ }
15930
+ const abi = await response.json();
15931
+ const assetNames = (abi.fungible_tokens ?? []).map((token) => token.name);
15932
+ if (assetNames.length === 0) {
15933
+ throw new Error(`${tokenContractId} defines no fungible token \u2014 not a SIP-10 contract`);
15934
+ }
15935
+ this.ftAssetNames.set(tokenContractId, assetNames);
15936
+ return assetNames;
15937
+ }
15785
15938
  async getImplContractAddress(stateContract) {
15786
15939
  const [contractAddress, contractName] = parseContractId(stateContract);
15787
15940
  const txParams = {
@@ -15804,18 +15957,18 @@ var StacksSpokeService = class {
15804
15957
  const assetManagerImpl = await this.getImplContractAddress(chainConfig.addresses.assetManager);
15805
15958
  const [implAddress, implName] = parseContractId(assetManagerImpl);
15806
15959
  const [connectionAddress, connectionName] = parseContractId(chainConfig.addresses.connection);
15960
+ const isNative = isNativeToken(params.srcChainKey, params.token);
15807
15961
  const reqData = {
15808
15962
  contractAddress: implAddress,
15809
15963
  contractName: implName,
15810
15964
  functionName: "transfer",
15811
15965
  functionArgs: [
15812
- isNativeToken(params.srcChainKey, params.token) ? noneCV() : someCV(Cl.principal(params.token)),
15966
+ isNative ? noneCV() : someCV(Cl.principal(params.token)),
15813
15967
  Cl.bufferFromHex(params.to),
15814
15968
  uintCV(params.amount),
15815
15969
  Cl.bufferFromHex(params.data),
15816
15970
  Cl.contractPrincipal(connectionAddress, connectionName)
15817
- ],
15818
- postConditionMode: PostConditionMode.Allow
15971
+ ]
15819
15972
  };
15820
15973
  if (params.raw === true) {
15821
15974
  if (!params.srcPublicKey) {
@@ -15844,9 +15997,25 @@ var StacksSpokeService = class {
15844
15997
  payload: bytesToHex(serializePayloadBytes(tx.payload))
15845
15998
  };
15846
15999
  }
15847
- const txId = await params.walletProvider.sendTransaction(reqData);
16000
+ const txId = await params.walletProvider.sendTransaction({
16001
+ ...reqData,
16002
+ postConditionMode: PostConditionMode.Deny,
16003
+ postConditions: await this.depositPostConditions(params.srcAddress, params.token, params.amount, isNative)
16004
+ });
15848
16005
  return txId;
15849
16006
  }
16007
+ /**
16008
+ * Caps for a Deny-mode deposit: asset-manager-state.deposit moves exactly `amount` from the
16009
+ * caller, so cap the sender at `amount` — one cap per FT the token contract defines (sBTC has
16010
+ * two; the unmoved ones pass at 0 trivially), or uSTX for native.
16011
+ */
16012
+ async depositPostConditions(srcAddress, token, amount, isNative) {
16013
+ if (isNative) return [Pc.principal(srcAddress).willSendLte(amount).ustx()];
16014
+ const assetNames = await this.getFtAssetNames(token);
16015
+ return assetNames.map(
16016
+ (assetName) => Pc.principal(srcAddress).willSendLte(amount).ft(token, assetName)
16017
+ );
16018
+ }
15850
16019
  /**
15851
16020
  * Get the balance of the token deposited in the spoke chain asset manager.
15852
16021
  * @param {GetDepositParams<StacksChainKey>} params - The parameters for the deposit, including the user's address, token address, and chain id.
@@ -15896,8 +16065,7 @@ var StacksSpokeService = class {
15896
16065
  contractAddress: connectionAddress,
15897
16066
  contractName: connectionName,
15898
16067
  functionName: "send-message",
15899
- functionArgs: [uintCV(dstRelayChainId), Cl.bufferFromHex(params.dstAddress), Cl.bufferFromHex(params.payload)],
15900
- postConditionMode: PostConditionMode.Allow
16068
+ functionArgs: [uintCV(dstRelayChainId), Cl.bufferFromHex(params.dstAddress), Cl.bufferFromHex(params.payload)]
15901
16069
  };
15902
16070
  if (params.raw === true) {
15903
16071
  const tx = await makeUnsignedContractCall({
@@ -15912,7 +16080,12 @@ var StacksSpokeService = class {
15912
16080
  payload: bytesToHex(serializePayloadBytes(tx.payload))
15913
16081
  };
15914
16082
  }
15915
- const txId = await params.walletProvider.sendTransaction(reqData);
16083
+ const txId = await params.walletProvider.sendTransaction({
16084
+ ...reqData,
16085
+ // send-message moves no assets — deny with no conditions aborts if it ever tries.
16086
+ postConditionMode: PostConditionMode.Deny,
16087
+ postConditions: []
16088
+ });
15916
16089
  return txId;
15917
16090
  }
15918
16091
  async waitForTransactionReceipt(params) {
@@ -16359,60 +16532,6 @@ var RadfiProvider = class {
16359
16532
  }
16360
16533
  };
16361
16534
 
16362
- // src/shared/entities/btc/btc-utils.ts
16363
- var BITCOIN_FEE_SAFETY_VBYTES = 20;
16364
- function calcOpReturnOutputVbytes(payloadByteLength) {
16365
- let scriptSize;
16366
- if (payloadByteLength <= 75) {
16367
- scriptSize = 3 + payloadByteLength;
16368
- } else if (payloadByteLength <= 255) {
16369
- scriptSize = 4 + payloadByteLength;
16370
- } else {
16371
- scriptSize = 5 + payloadByteLength;
16372
- }
16373
- const scriptLenVarint = scriptSize <= 252 ? 1 : 3;
16374
- return 8 + scriptLenVarint + scriptSize;
16375
- }
16376
- function estimateBitcoinTxSize(inputCount, outputCount, addressType, opReturnOutputVbytes = 44) {
16377
- let inputWeight;
16378
- switch (addressType) {
16379
- case "P2PKH":
16380
- inputWeight = 148;
16381
- break;
16382
- case "P2SH":
16383
- inputWeight = 91;
16384
- break;
16385
- case "P2TR":
16386
- inputWeight = 58;
16387
- break;
16388
- default:
16389
- inputWeight = 68;
16390
- break;
16391
- }
16392
- return Math.ceil(
16393
- 10.5 + opReturnOutputVbytes + BITCOIN_FEE_SAFETY_VBYTES + inputCount * inputWeight + outputCount * 31
16394
- );
16395
- }
16396
- function encodeBtcPayloadToBytes(payload) {
16397
- return JSON.stringify({
16398
- src_address: payload.src_address.toLowerCase(),
16399
- data: payload.data.toLowerCase(),
16400
- src_chain_id: payload.src_chain_id,
16401
- dst_chain_id: payload.dst_chain_id,
16402
- wallet_used: payload.wallet_used,
16403
- timestamp: payload.timestamp,
16404
- address_type: payload.address_type
16405
- });
16406
- }
16407
- function normalizePsbtToBase64(signedPsbt) {
16408
- const isHex2 = /^[0-9a-fA-F]+$/.test(signedPsbt);
16409
- return isHex2 ? Buffer.from(signedPsbt, "hex").toString("base64") : signedPsbt;
16410
- }
16411
- function normalizeSignatureToBase64(signature) {
16412
- const isHex2 = /^[0-9a-fA-F]+$/.test(signature);
16413
- return isHex2 ? Buffer.from(signature, "hex").toString("base64") : signature;
16414
- }
16415
-
16416
16535
  // src/shared/services/spoke/BitcoinSpokeService.ts
16417
16536
  initEccLib(ecc);
16418
16537
  var BITCOIN_DEFAULT_FEE_RATE = 3;
@@ -17070,7 +17189,7 @@ function hexToBytes2(hex) {
17070
17189
  const al = hl / 2;
17071
17190
  if (hl % 2)
17072
17191
  throw new Error("hex string expected, got unpadded hex of length " + hl);
17073
- const array3 = new Uint8Array(al);
17192
+ const array4 = new Uint8Array(al);
17074
17193
  for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
17075
17194
  const n1 = asciiToBase16(hex.charCodeAt(hi));
17076
17195
  const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
@@ -17078,9 +17197,9 @@ function hexToBytes2(hex) {
17078
17197
  const char = hex[hi] + hex[hi + 1];
17079
17198
  throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
17080
17199
  }
17081
- array3[ai] = n1 * 16 + n2;
17200
+ array4[ai] = n1 * 16 + n2;
17082
17201
  }
17083
- return array3;
17202
+ return array4;
17084
17203
  }
17085
17204
  function concatBytes(...arrays) {
17086
17205
  let sum = 0;
@@ -17710,22 +17829,22 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
17710
17829
  const byte0 = Uint8Array.of(0);
17711
17830
  const byte1 = Uint8Array.of(1);
17712
17831
  const _maxDrbgIters = 1e3;
17713
- let v10 = u8n(hashLen);
17832
+ let v12 = u8n(hashLen);
17714
17833
  let k = u8n(hashLen);
17715
17834
  let i = 0;
17716
17835
  const reset = () => {
17717
- v10.fill(1);
17836
+ v12.fill(1);
17718
17837
  k.fill(0);
17719
17838
  i = 0;
17720
17839
  };
17721
- const h = (...msgs) => hmacFn(k, concatBytes(v10, ...msgs));
17840
+ const h = (...msgs) => hmacFn(k, concatBytes(v12, ...msgs));
17722
17841
  const reseed = (seed = NULL) => {
17723
17842
  k = h(byte0, seed);
17724
- v10 = h();
17843
+ v12 = h();
17725
17844
  if (seed.length === 0)
17726
17845
  return;
17727
17846
  k = h(byte1, seed);
17728
- v10 = h();
17847
+ v12 = h();
17729
17848
  };
17730
17849
  const gen = () => {
17731
17850
  if (i++ >= _maxDrbgIters)
@@ -17733,10 +17852,10 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
17733
17852
  let len = 0;
17734
17853
  const out = [];
17735
17854
  while (len < qByteLen) {
17736
- v10 = h();
17737
- const sl = v10.slice();
17855
+ v12 = h();
17856
+ const sl = v12.slice();
17738
17857
  out.push(sl);
17739
- len += v10.length;
17858
+ len += v12.length;
17740
17859
  }
17741
17860
  return concatBytes(...out);
17742
17861
  };
@@ -17751,18 +17870,18 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
17751
17870
  };
17752
17871
  return genUntil;
17753
17872
  }
17754
- function validateObject(object5, fields = {}, optFields = {}) {
17755
- if (!object5 || typeof object5 !== "object")
17873
+ function validateObject(object6, fields = {}, optFields = {}) {
17874
+ if (!object6 || typeof object6 !== "object")
17756
17875
  throw new Error("expected valid options object");
17757
17876
  function checkField(fieldName, expectedType, isOpt) {
17758
- const val = object5[fieldName];
17877
+ const val = object6[fieldName];
17759
17878
  if (isOpt && val === void 0)
17760
17879
  return;
17761
17880
  const current = typeof val;
17762
17881
  if (current !== expectedType || val === null)
17763
17882
  throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`);
17764
17883
  }
17765
- const iter = (f, isOpt) => Object.entries(f).forEach(([k, v10]) => checkField(k, v10, isOpt));
17884
+ const iter = (f, isOpt) => Object.entries(f).forEach(([k, v12]) => checkField(k, v12, isOpt));
17766
17885
  iter(fields, false);
17767
17886
  iter(optFields, true);
17768
17887
  }
@@ -17801,12 +17920,12 @@ function pow2(x, power, modulo) {
17801
17920
  }
17802
17921
  return res;
17803
17922
  }
17804
- function invert(number5, modulo) {
17805
- if (number5 === _0n2)
17923
+ function invert(number6, modulo) {
17924
+ if (number6 === _0n2)
17806
17925
  throw new Error("invert: expected non-zero number");
17807
17926
  if (modulo <= _0n2)
17808
17927
  throw new Error("invert: expected positive modulus, got " + modulo);
17809
- let a = mod(number5, modulo);
17928
+ let a = mod(number6, modulo);
17810
17929
  let b = modulo;
17811
17930
  let x = _0n2, u = _1n2;
17812
17931
  while (a !== _0n2) {
@@ -17833,9 +17952,9 @@ function sqrt3mod4(Fp, n) {
17833
17952
  function sqrt5mod8(Fp, n) {
17834
17953
  const p5div8 = (Fp.ORDER - _5n) / _8n;
17835
17954
  const n2 = Fp.mul(n, _2n);
17836
- const v10 = Fp.pow(n2, p5div8);
17837
- const nv = Fp.mul(n, v10);
17838
- const i = Fp.mul(Fp.mul(nv, _2n), v10);
17955
+ const v12 = Fp.pow(n2, p5div8);
17956
+ const nv = Fp.mul(n, v12);
17957
+ const i = Fp.mul(Fp.mul(nv, _2n), v12);
17839
17958
  const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
17840
17959
  assertIsSquare(Fp, root, n);
17841
17960
  return root;
@@ -18417,9 +18536,9 @@ function edwards(params, extraOpts = {}) {
18417
18536
  validateObject(extraOpts, {}, { uvRatio: "function" });
18418
18537
  const MASK = _2n2 << BigInt(Fn.BYTES * 8) - _1n4;
18419
18538
  const modP = (n) => Fp.create(n);
18420
- const uvRatio2 = extraOpts.uvRatio || ((u, v10) => {
18539
+ const uvRatio2 = extraOpts.uvRatio || ((u, v12) => {
18421
18540
  try {
18422
- return { isValid: true, value: Fp.sqrt(Fp.div(u, v10)) };
18541
+ return { isValid: true, value: Fp.sqrt(Fp.div(u, v12)) };
18423
18542
  } catch (e) {
18424
18543
  return { isValid: false, value: _0n4 };
18425
18544
  }
@@ -18515,8 +18634,8 @@ function edwards(params, extraOpts = {}) {
18515
18634
  aInRange("point.y", y, _0n4, max);
18516
18635
  const y2 = modP(y * y);
18517
18636
  const u = modP(y2 - _1n4);
18518
- const v10 = modP(d * y2 - a);
18519
- let { isValid, value: x } = uvRatio2(u, v10);
18637
+ const v12 = modP(d * y2 - a);
18638
+ let { isValid, value: x } = uvRatio2(u, v12);
18520
18639
  if (!isValid)
18521
18640
  throw new Error("bad point: invalid y coordinate");
18522
18641
  const isXOdd = (x & _1n4) === _1n4;
@@ -18856,13 +18975,13 @@ function adjustScalarBytes(bytes) {
18856
18975
  return bytes;
18857
18976
  }
18858
18977
  var ED25519_SQRT_M1 = /* @__PURE__ */ BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");
18859
- function uvRatio(u, v10) {
18978
+ function uvRatio(u, v12) {
18860
18979
  const P = ed25519_CURVE_p;
18861
- const v32 = mod(v10 * v10 * v10, P);
18862
- const v72 = mod(v32 * v32 * v10, P);
18980
+ const v32 = mod(v12 * v12 * v12, P);
18981
+ const v72 = mod(v32 * v32 * v12, P);
18863
18982
  const pow = ed25519_pow_2_252_3(u * v72).pow_p_5_8;
18864
18983
  let x = mod(u * v32 * pow, P);
18865
- const vx2 = mod(v10 * x * x, P);
18984
+ const vx2 = mod(v12 * x * x, P);
18866
18985
  const root1 = x;
18867
18986
  const root2 = mod(x * ED25519_SQRT_M1, P);
18868
18987
  const useRoot1 = vx2 === u;
@@ -19193,7 +19312,7 @@ function findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio, protocol
19193
19312
  return findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumStakeRatio);
19194
19313
  }
19195
19314
  function findSeatPriceForProtocolBefore49(validators, numSeats) {
19196
- const stakes = validators.map((v10) => BigInt(v10.stake)).sort(sortBigIntAsc);
19315
+ const stakes = validators.map((v12) => BigInt(v12.stake)).sort(sortBigIntAsc);
19197
19316
  const num = BigInt(numSeats);
19198
19317
  const stakesSum = stakes.reduce((a, b) => a + b);
19199
19318
  if (stakesSum < num) {
@@ -19222,7 +19341,7 @@ function findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumSt
19222
19341
  if (minimumStakeRatio.length != 2) {
19223
19342
  throw Error("minimumStakeRatio should have 2 elements");
19224
19343
  }
19225
- const stakes = validators.map((v10) => BigInt(v10.stake)).sort(sortBigIntAsc);
19344
+ const stakes = validators.map((v12) => BigInt(v12.stake)).sort(sortBigIntAsc);
19226
19345
  const stakesSum = stakes.reduce((a, b) => a + b);
19227
19346
  if (validators.length < maxNumberOfSeats) {
19228
19347
  return stakesSum * BigInt(minimumStakeRatio[0]) / BigInt(minimumStakeRatio[1]);
@@ -19394,10 +19513,10 @@ var DER = {
19394
19513
  if (length < 128)
19395
19514
  throw new E("tlv.decode(long): not minimal encoding");
19396
19515
  }
19397
- const v10 = data.subarray(pos, pos + length);
19398
- if (v10.length !== length)
19516
+ const v12 = data.subarray(pos, pos + length);
19517
+ if (v12.length !== length)
19399
19518
  throw new E("tlv.decode: wrong value length");
19400
- return { v: v10, l: data.subarray(pos + length) };
19519
+ return { v: v12, l: data.subarray(pos + length) };
19401
19520
  }
19402
19521
  },
19403
19522
  // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
@@ -19965,9 +20084,9 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
19965
20084
  extraEntropy: false
19966
20085
  };
19967
20086
  const hasLargeCofactor = CURVE_ORDER * _2n4 < Fp.ORDER;
19968
- function isBiggerThanHalfOrder(number5) {
20087
+ function isBiggerThanHalfOrder(number6) {
19969
20088
  const HALF = CURVE_ORDER >> _1n6;
19970
- return number5 > HALF;
20089
+ return number6 > HALF;
19971
20090
  }
19972
20091
  function validateRS(title, num) {
19973
20092
  if (!Fn.isValidNot0(num))
@@ -20150,8 +20269,8 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
20150
20269
  const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2));
20151
20270
  if (R.is0())
20152
20271
  return false;
20153
- const v10 = Fn.create(R.x);
20154
- return v10 === r;
20272
+ const v12 = Fn.create(R.x);
20273
+ return v12 === r;
20155
20274
  } catch (e) {
20156
20275
  return false;
20157
20276
  }
@@ -23839,7 +23958,9 @@ var SonicSpokeService = class {
23839
23958
  if (params.raw === true) {
23840
23959
  return rawTx;
23841
23960
  }
23842
- return params.walletProvider.sendTransaction(rawTx);
23961
+ return params.walletProvider.sendTransaction(rawTx, {
23962
+ expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
23963
+ });
23843
23964
  }
23844
23965
  static async createSwapIntent(params) {
23845
23966
  const { createIntentParams, creatorHubWalletAddress, solverConfig: solverConfig2, fee, hubProvider } = params;
@@ -23889,7 +24010,9 @@ var SonicSpokeService = class {
23889
24010
  return [rawTx, intent, feeAmount, txData.data];
23890
24011
  }
23891
24012
  return [
23892
- await params.walletProvider.sendTransaction(rawTx),
24013
+ await params.walletProvider.sendTransaction(rawTx, {
24014
+ expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
24015
+ }),
23893
24016
  intent,
23894
24017
  feeAmount,
23895
24018
  txData.data
@@ -24020,7 +24143,9 @@ var SonicSpokeService = class {
24020
24143
  if (params.raw === true) {
24021
24144
  return rawTx;
24022
24145
  }
24023
- return params.walletProvider.sendTransaction(rawTx);
24146
+ return params.walletProvider.sendTransaction(rawTx, {
24147
+ expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
24148
+ });
24024
24149
  }
24025
24150
  };
24026
24151
  async function toMystenTransaction(txn) {
@@ -24105,16 +24230,16 @@ var SuiGrpcTransport = class {
24105
24230
  return effects.gasUsed;
24106
24231
  }
24107
24232
  async fetchLatestPackageId(objectId) {
24108
- let object5;
24233
+ let object6;
24109
24234
  try {
24110
- ({ object: object5 } = await this.client.core.getObject({ objectId, include: { json: true } }));
24235
+ ({ object: object6 } = await this.client.core.getObject({ objectId, include: { json: true } }));
24111
24236
  } catch (error) {
24112
24237
  throw new Error("Failed to fetch asset manager id", { cause: error });
24113
24238
  }
24114
- if (!object5) {
24239
+ if (!object6) {
24115
24240
  throw new Error("Asset manager id not found (no data)");
24116
24241
  }
24117
- const fields = object5.json;
24242
+ const fields = object6.json;
24118
24243
  if (!fields) {
24119
24244
  throw new Error("Asset manager id not found (not a move object)");
24120
24245
  }
@@ -26171,7 +26296,9 @@ var SpokeService = class _SpokeService {
26171
26296
  from: params.owner,
26172
26297
  spender: params.spender,
26173
26298
  raw: false,
26174
- walletProvider
26299
+ walletProvider,
26300
+ // Covers the reset leg too — an approval must not broadcast on the wrong EVM network.
26301
+ expectedChainId: getEvmViemChain(params.srcChainKey).id
26175
26302
  });
26176
26303
  if (plan.resetAmount !== void 0) {
26177
26304
  const resetHash = await sendApprove(plan.resetAmount);
@@ -26378,7 +26505,8 @@ var SpokeService = class _SpokeService {
26378
26505
  return this.sui.encodeSimulationParams(token, assetManager);
26379
26506
  default:
26380
26507
  return {
26381
- encodedToken: encodeAddress(srcChainKey, token),
26508
+ // Token identifiers on BITCOIN/NEAR/INJECTIVE are not addresses — recipient validation stays on the address leg only.
26509
+ encodedToken: encodeTokenIdentifier(srcChainKey, token),
26382
26510
  encodedSrcAddress: encodeAddress(srcChainKey, assetManager)
26383
26511
  };
26384
26512
  }
@@ -27005,6 +27133,7 @@ var SpokeService = class _SpokeService {
27005
27133
  }
27006
27134
  }
27007
27135
  };
27136
+ var HUB_CHAIN_ID = getEvmViemChain(ChainKeys.SONIC_MAINNET).id;
27008
27137
  var Erc4626Service = class {
27009
27138
  constructor() {
27010
27139
  }
@@ -27183,7 +27312,7 @@ var Erc4626Service = class {
27183
27312
  if (raw) {
27184
27313
  return rawTx;
27185
27314
  }
27186
- return walletProvider.sendTransaction(rawTx);
27315
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID });
27187
27316
  }
27188
27317
  /**
27189
27318
  * Get the maximum amount of shares that can be minted
@@ -27260,7 +27389,7 @@ var Erc4626Service = class {
27260
27389
  if (raw) {
27261
27390
  return rawTx;
27262
27391
  }
27263
- return walletProvider.sendTransaction(rawTx);
27392
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID });
27264
27393
  }
27265
27394
  /**
27266
27395
  * Get the maximum amount of assets that can be withdrawn
@@ -27338,7 +27467,7 @@ var Erc4626Service = class {
27338
27467
  if (raw) {
27339
27468
  return rawTx;
27340
27469
  }
27341
- return walletProvider.sendTransaction(rawTx);
27470
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID });
27342
27471
  }
27343
27472
  /**
27344
27473
  * Get the maximum amount of shares that can be redeemed
@@ -27416,7 +27545,7 @@ var Erc4626Service = class {
27416
27545
  if (raw) {
27417
27546
  return rawTx;
27418
27547
  }
27419
- return walletProvider.sendTransaction(rawTx);
27548
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID });
27420
27549
  }
27421
27550
  /**
27422
27551
  * Encodes a deposit transaction for a vault.
@@ -27493,6 +27622,7 @@ var Erc4626Service = class {
27493
27622
  };
27494
27623
  }
27495
27624
  };
27625
+ var HUB_CHAIN_ID2 = getEvmViemChain(ChainKeys.SONIC_MAINNET).id;
27496
27626
  var Permit2Service = class _Permit2Service {
27497
27627
  constructor() {
27498
27628
  }
@@ -27581,7 +27711,7 @@ var Permit2Service = class _Permit2Service {
27581
27711
  if (raw) {
27582
27712
  return rawTx;
27583
27713
  }
27584
- return walletProvider.sendTransaction(rawTx);
27714
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
27585
27715
  }
27586
27716
  /**
27587
27717
  * Execute a permit for a single token
@@ -27606,7 +27736,7 @@ var Permit2Service = class _Permit2Service {
27606
27736
  if (raw) {
27607
27737
  return rawTx;
27608
27738
  }
27609
- return walletProvider.sendTransaction(rawTx);
27739
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
27610
27740
  }
27611
27741
  /**
27612
27742
  * Execute a permit for multiple tokens
@@ -27631,7 +27761,7 @@ var Permit2Service = class _Permit2Service {
27631
27761
  if (raw) {
27632
27762
  return rawTx;
27633
27763
  }
27634
- return walletProvider.sendTransaction(rawTx);
27764
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
27635
27765
  }
27636
27766
  /**
27637
27767
  * Transfer tokens from one address to another using Permit2
@@ -27657,7 +27787,7 @@ var Permit2Service = class _Permit2Service {
27657
27787
  if (raw) {
27658
27788
  return rawTx;
27659
27789
  }
27660
- return walletProvider.sendTransaction(rawTx);
27790
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
27661
27791
  }
27662
27792
  /**
27663
27793
  * Transfer multiple tokens in a batch using Permit2
@@ -27680,7 +27810,7 @@ var Permit2Service = class _Permit2Service {
27680
27810
  if (raw) {
27681
27811
  return rawTx;
27682
27812
  }
27683
- return walletProvider.sendTransaction(rawTx);
27813
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
27684
27814
  }
27685
27815
  /**
27686
27816
  * Lockdown approvals to prevent malicious usage
@@ -27703,7 +27833,7 @@ var Permit2Service = class _Permit2Service {
27703
27833
  if (raw) {
27704
27834
  return rawTx;
27705
27835
  }
27706
- return walletProvider.sendTransaction(rawTx);
27836
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
27707
27837
  }
27708
27838
  /**
27709
27839
  * Invalidate nonces to prevent replay attacks
@@ -27728,7 +27858,7 @@ var Permit2Service = class _Permit2Service {
27728
27858
  if (raw) {
27729
27859
  return rawTx;
27730
27860
  }
27731
- return walletProvider.sendTransaction(rawTx);
27861
+ return walletProvider.sendTransaction(rawTx, { expectedChainId: HUB_CHAIN_ID2 });
27732
27862
  }
27733
27863
  /**
27734
27864
  * Encodes an approve transaction for Permit2.
@@ -30986,7 +31116,9 @@ var BalnSwapService = class {
30986
31116
  if (walletProviderSlot.raw) {
30987
31117
  return tx;
30988
31118
  }
30989
- return walletProviderSlot.walletProvider.sendTransaction(tx);
31119
+ return walletProviderSlot.walletProvider.sendTransaction(tx, {
31120
+ expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
31121
+ });
30990
31122
  }
30991
31123
  };
30992
31124
 
@@ -32125,6 +32257,9 @@ function resolveSponsoringApiConfig(layers) {
32125
32257
  function resolveBridgeApiConfig(layers) {
32126
32258
  return resolveSharedApiConfig(layers);
32127
32259
  }
32260
+ function resolveLeverageYieldApiConfig(layers) {
32261
+ return resolveSharedApiConfig(layers);
32262
+ }
32128
32263
  var SwapsApiService = class _SwapsApiService {
32129
32264
  // Fully-resolved swaps-API config supplied by the caller (BackendApiService resolves the
32130
32265
  // `ApiConfig` union via `resolveSwapsApiConfig`); this service does not resolve the union.
@@ -32850,6 +32985,623 @@ var BridgeApiService = class {
32850
32985
  return this.config.timeout;
32851
32986
  }
32852
32987
  };
32988
+ var LsdSourceSchema = v.object({
32989
+ poolId: v.string(),
32990
+ fallbackAprPct: v.number(),
32991
+ label: v.string()
32992
+ });
32993
+ var LeverageVaultSchema = v.object({
32994
+ name: v.string(),
32995
+ vault: v.string(),
32996
+ asset: v.string(),
32997
+ borrowToken: v.string(),
32998
+ lsdSource: v.optional(LsdSourceSchema)
32999
+ });
33000
+ var GetLeverageVaultsResponseSchema = v.array(LeverageVaultSchema);
33001
+ var GetLeverageVaultResponseSchema = LeverageVaultSchema;
33002
+ var VaultAssetResponseSchema = v.object({
33003
+ asset: v.string()
33004
+ });
33005
+ var LeverageYieldPositionSchema = v.object({
33006
+ collateral: v.string(),
33007
+ debt: v.string(),
33008
+ ltv: v.string(),
33009
+ healthFactor: v.string(),
33010
+ idleAsset: v.string()
33011
+ });
33012
+ var LeverageYieldAprSchema = v.object({
33013
+ supplyAprRay: v.string(),
33014
+ borrowAprRay: v.string(),
33015
+ targetLtvBps: v.string(),
33016
+ leverageMultiplierWad: v.string(),
33017
+ netAprRay: v.string()
33018
+ });
33019
+ var LeverageYieldLsdAprSchema = v.object({
33020
+ aprRay: v.string(),
33021
+ label: v.string(),
33022
+ stale: v.boolean()
33023
+ });
33024
+ var LeverageYieldEffectiveAprSchema = v.object({
33025
+ supplyAprRay: v.string(),
33026
+ borrowAprRay: v.string(),
33027
+ targetLtvBps: v.string(),
33028
+ leverageMultiplierWad: v.string(),
33029
+ netAprRay: v.string(),
33030
+ lsdApr: LeverageYieldLsdAprSchema,
33031
+ effectiveSupplyAprRay: v.string(),
33032
+ effectiveNetAprRay: v.string()
33033
+ });
33034
+ var VaultTotalAssetsResponseSchema = v.object({
33035
+ totalAssets: v.string()
33036
+ });
33037
+ var PreviewDepositResponseSchema = v.object({
33038
+ shares: v.string()
33039
+ });
33040
+ var PreviewWithdrawResponseSchema = v.object({
33041
+ shares: v.string()
33042
+ });
33043
+ var PreviewRedeemResponseSchema = v.object({
33044
+ assets: v.string()
33045
+ });
33046
+ var ShareBalanceResponseSchema = v.object({
33047
+ balance: v.string()
33048
+ });
33049
+ var MaxWithdrawResponseSchema = v.object({
33050
+ maxWithdraw: v.string()
33051
+ });
33052
+
33053
+ // src/backendApi/LeverageYieldApiService.ts
33054
+ var LeverageYieldApiService = class _LeverageYieldApiService {
33055
+ // Fully-resolved API config supplied by the caller (BackendApiService resolves the ApiConfig
33056
+ // union via `resolveBaseApiConfig`); leverage-yield endpoints are sub-paths under the base URL.
33057
+ config;
33058
+ headers;
33059
+ logger;
33060
+ /** See {@link LeverageYieldApiServiceOptions.trimLegacyOverrides}. */
33061
+ trimsLegacyOverrides;
33062
+ constructor(config, logger = consoleLogger, options = {}) {
33063
+ this.config = config;
33064
+ this.headers = { ...config.headers };
33065
+ this.logger = logger;
33066
+ this.trimsLegacyOverrides = options.trimLegacyOverrides ?? true;
33067
+ }
33068
+ /**
33069
+ * Issues a single HTTP request, validates the JSON body against `schema`, and wraps the
33070
+ * result in `Result<T>`. Mirrors `SwapsApiService.request`; every public method delegates here.
33071
+ */
33072
+ async request(endpoint, config, schema, overrideConfig) {
33073
+ try {
33074
+ const raw = await makeRequest({
33075
+ endpoint,
33076
+ config: { baseURL: this.config.baseURL, timeout: this.config.timeout, headers: this.headers, ...config },
33077
+ // Normalized like a configured base URL: the override is the gateway root, so a legacy
33078
+ // `/be`-suffixed value must not nest `/leverage-yield/*` under the data API's mount — unless the
33079
+ // config opted out of the legacy trim, in which case the per-call value is left as given.
33080
+ overrideConfig: this.trimsLegacyOverrides ? normalizeOverrideBaseURL(overrideConfig) : overrideConfig,
33081
+ logger: this.logger,
33082
+ serviceLabel: "LeverageYieldApiService"
33083
+ });
33084
+ const parsed = v.safeParse(schema, raw);
33085
+ if (!parsed.success) {
33086
+ return {
33087
+ ok: false,
33088
+ error: toInvalidResponseShapeError({
33089
+ api: "leverageYield",
33090
+ feature: "backend",
33091
+ endpoint,
33092
+ issues: v.flatten(parsed.issues)
33093
+ })
33094
+ };
33095
+ }
33096
+ return { ok: true, value: parsed.output };
33097
+ } catch (error) {
33098
+ return { ok: false, error: toExternalApiError({ api: "leverageYield", feature: "backend", endpoint, error }) };
33099
+ }
33100
+ }
33101
+ /**
33102
+ * Drop the SDK-only display field `feeAmount` before an intent reaches the strict wire serializer.
33103
+ * `sodax.leverageYield.createVaultIntent` returns `Intent & FeeAmount`, which is structurally
33104
+ * assignable to the wire `IntentRequestV2` and so gets passed straight into the intent-carrying
33105
+ * endpoints; the lenient JSON serializer would send the extra bigint wholesale. Mirrors
33106
+ * `SwapsApiService.toWireIntent`; a no-op for an already-clean `IntentRequestV2`.
33107
+ */
33108
+ static toWireIntent(intent) {
33109
+ const { feeAmount: _feeAmount, ...rest } = intent;
33110
+ return rest;
33111
+ }
33112
+ /** Append `params` to `base` as a query string, returning `base` unchanged when `params` is empty. */
33113
+ withQuery(base2, params) {
33114
+ const queryString = new URLSearchParams(params).toString();
33115
+ return queryString.length > 0 ? `${base2}?${queryString}` : base2;
33116
+ }
33117
+ // ──────────────────────────────────────────────────────────────────────
33118
+ // Vault registry
33119
+ // ──────────────────────────────────────────────────────────────────────
33120
+ /**
33121
+ * Fetch the registry of deployed leverage-yield vaults.
33122
+ *
33123
+ * @returns `Result<GetLeverageVaultsResponseV2>` — array of vault descriptors.
33124
+ */
33125
+ async getVaults(config) {
33126
+ return this.request("/leverage-yield/vaults", { method: "GET" }, GetLeverageVaultsResponseSchema, config);
33127
+ }
33128
+ /**
33129
+ * Fetch a single vault descriptor by its lsoda* share-token name (e.g. `lsodaWEETH`).
33130
+ *
33131
+ * @returns `Result<GetLeverageVaultResponseV2>` — the vault descriptor.
33132
+ */
33133
+ async getVault(name, config) {
33134
+ return this.request(
33135
+ `/leverage-yield/vaults/${name}`,
33136
+ { method: "GET" },
33137
+ GetLeverageVaultResponseSchema,
33138
+ config
33139
+ );
33140
+ }
33141
+ // ──────────────────────────────────────────────────────────────────────
33142
+ // Vault reads
33143
+ // ──────────────────────────────────────────────────────────────────────
33144
+ /**
33145
+ * Get the vault's underlying hub asset (Sodax vault-token wrapper).
33146
+ *
33147
+ * @returns `Result<VaultAssetResponseV2>` — `{ asset }`.
33148
+ */
33149
+ async getAsset(query, config) {
33150
+ return this.request(
33151
+ this.withQuery("/leverage-yield/asset", { vault: query.vault }),
33152
+ { method: "GET" },
33153
+ VaultAssetResponseSchema,
33154
+ config
33155
+ );
33156
+ }
33157
+ /**
33158
+ * Get a leveraged-position snapshot for the vault.
33159
+ *
33160
+ * @returns `Result<LeverageYieldPositionV2>` — `{ collateral, debt, ltv, healthFactor, idleAsset }` (decimal strings).
33161
+ */
33162
+ async getPosition(query, config) {
33163
+ return this.request(
33164
+ this.withQuery("/leverage-yield/position", { vault: query.vault }),
33165
+ { method: "GET" },
33166
+ LeverageYieldPositionSchema,
33167
+ config
33168
+ );
33169
+ }
33170
+ /**
33171
+ * Get the AAVE-only steady-state APR for the vault (goes negative when the LSD yield is the alpha).
33172
+ *
33173
+ * @returns `Result<LeverageYieldAprV2>` — RAY-denominated rates as decimal strings.
33174
+ */
33175
+ async getApr(query, config) {
33176
+ return this.request(
33177
+ this.withQuery("/leverage-yield/apr", { vault: query.vault }),
33178
+ { method: "GET" },
33179
+ LeverageYieldAprSchema,
33180
+ config
33181
+ );
33182
+ }
33183
+ /**
33184
+ * Get the honest combined AAVE + LSD effective APR for the vault.
33185
+ *
33186
+ * @returns `Result<LeverageYieldEffectiveAprV2>` — includes `effectiveNetAprRay` (the headline number).
33187
+ */
33188
+ async getEffectiveApr(query, config) {
33189
+ return this.request(
33190
+ this.withQuery("/leverage-yield/apr/effective", { vault: query.vault }),
33191
+ { method: "GET" },
33192
+ LeverageYieldEffectiveAprSchema,
33193
+ config
33194
+ );
33195
+ }
33196
+ /**
33197
+ * Get the off-chain LSD staking-APR snapshot for the vault's underlying asset.
33198
+ *
33199
+ * @returns `Result<LeverageYieldLsdAprV2>` — `{ aprRay, label, stale }`.
33200
+ */
33201
+ async getLsdApr(query, config) {
33202
+ return this.request(
33203
+ this.withQuery("/leverage-yield/apr/lsd", { vault: query.vault }),
33204
+ { method: "GET" },
33205
+ LeverageYieldLsdAprSchema,
33206
+ config
33207
+ );
33208
+ }
33209
+ /**
33210
+ * Get the total assets managed by the vault.
33211
+ *
33212
+ * @returns `Result<VaultTotalAssetsResponseV2>` — `{ totalAssets }` (decimal string).
33213
+ */
33214
+ async getTotalAssets(query, config) {
33215
+ return this.request(
33216
+ this.withQuery("/leverage-yield/total-assets", { vault: query.vault }),
33217
+ { method: "GET" },
33218
+ VaultTotalAssetsResponseSchema,
33219
+ config
33220
+ );
33221
+ }
33222
+ /**
33223
+ * Preview the shares minted for depositing `assets` into the vault (ERC-4626 `previewDeposit`).
33224
+ *
33225
+ * @returns `Result<PreviewDepositResponseV2>` — `{ shares }` (decimal string).
33226
+ */
33227
+ async previewDeposit(query, config) {
33228
+ return this.request(
33229
+ this.withQuery("/leverage-yield/preview/deposit", { vault: query.vault, assets: query.assets }),
33230
+ { method: "GET" },
33231
+ PreviewDepositResponseSchema,
33232
+ config
33233
+ );
33234
+ }
33235
+ /**
33236
+ * Preview the shares burned to withdraw `assets` from the vault (ERC-4626 `previewWithdraw`).
33237
+ *
33238
+ * @returns `Result<PreviewWithdrawResponseV2>` — `{ shares }` (decimal string).
33239
+ */
33240
+ async previewWithdraw(query, config) {
33241
+ return this.request(
33242
+ this.withQuery("/leverage-yield/preview/withdraw", { vault: query.vault, assets: query.assets }),
33243
+ { method: "GET" },
33244
+ PreviewWithdrawResponseSchema,
33245
+ config
33246
+ );
33247
+ }
33248
+ /**
33249
+ * Preview the assets returned for redeeming `shares` from the vault (ERC-4626 `previewRedeem`).
33250
+ *
33251
+ * @returns `Result<PreviewRedeemResponseV2>` — `{ assets }` (decimal string).
33252
+ */
33253
+ async previewRedeem(query, config) {
33254
+ return this.request(
33255
+ this.withQuery("/leverage-yield/preview/redeem", { vault: query.vault, shares: query.shares }),
33256
+ { method: "GET" },
33257
+ PreviewRedeemResponseSchema,
33258
+ config
33259
+ );
33260
+ }
33261
+ /**
33262
+ * Get an owner's vault share (lsoda*) balance.
33263
+ *
33264
+ * @returns `Result<ShareBalanceResponseV2>` — `{ balance }` (decimal string).
33265
+ */
33266
+ async getShareBalance(query, config) {
33267
+ return this.request(
33268
+ this.withQuery("/leverage-yield/share-balance", { vault: query.vault, owner: query.owner }),
33269
+ { method: "GET" },
33270
+ ShareBalanceResponseSchema,
33271
+ config
33272
+ );
33273
+ }
33274
+ /**
33275
+ * Get an owner's RAW ERC-4626 `maxWithdraw` — NOT dust-trimmed, unlike the SDK-local
33276
+ * `sodax.leverageYield.getMaxWithdrawForUser`. Apply a margin before using it as a withdraw amount.
33277
+ *
33278
+ * @returns `Result<MaxWithdrawResponseV2>` — `{ maxWithdraw }` (decimal string).
33279
+ */
33280
+ async getMaxWithdraw(query, config) {
33281
+ return this.request(
33282
+ this.withQuery("/leverage-yield/max-withdraw", { vault: query.vault, owner: query.owner }),
33283
+ { method: "GET" },
33284
+ MaxWithdrawResponseSchema,
33285
+ config
33286
+ );
33287
+ }
33288
+ // ──────────────────────────────────────────────────────────────────────
33289
+ // Quote · deadline
33290
+ // ──────────────────────────────────────────────────────────────────────
33291
+ /**
33292
+ * Quote a swap-style deposit: any solver-supported `tokenSrc` → the vault's lsoda* shares.
33293
+ * Pass `query.includeTxData = true` to also build the unsigned create-intent tx (`srcAddress`
33294
+ * required in the body then).
33295
+ *
33296
+ * @returns `Result<QuoteResponseV2>` — `quotedAmount` (shares) and optional `txData`.
33297
+ */
33298
+ async getDepositQuote(body, query, config) {
33299
+ const endpoint = query?.includeTxData ? "/leverage-yield/quote/deposit?includeTxData=true" : "/leverage-yield/quote/deposit";
33300
+ const txSchema = rawTxSchemaForChainKey$1(body.tokenSrcChainKey);
33301
+ return this.request(
33302
+ endpoint,
33303
+ { method: "POST", body: toJsonBody(body) },
33304
+ makeQuoteResponseSchema(txSchema),
33305
+ config
33306
+ );
33307
+ }
33308
+ /**
33309
+ * Quote a swap-style withdraw: the vault's lsoda* shares → any solver-supported `tokenDst`.
33310
+ * Pass `query.includeTxData = true` to also build the unsigned tx (signed on `srcChainKey`;
33311
+ * `srcAddress`/`dstAddress` required in the body then).
33312
+ *
33313
+ * @returns `Result<QuoteResponseV2>` — `quotedAmount` (output token) and optional `txData`.
33314
+ */
33315
+ async getWithdrawQuote(body, query, config) {
33316
+ const endpoint = query?.includeTxData ? "/leverage-yield/quote/withdraw?includeTxData=true" : "/leverage-yield/quote/withdraw";
33317
+ const txSchema = rawTxSchemaForChainKey$1(body.srcChainKey);
33318
+ return this.request(
33319
+ endpoint,
33320
+ { method: "POST", body: toJsonBody(body) },
33321
+ makeQuoteResponseSchema(txSchema),
33322
+ config
33323
+ );
33324
+ }
33325
+ /**
33326
+ * Compute a deposit/withdraw deadline (hub timestamp + `offsetSeconds`, default 300s).
33327
+ *
33328
+ * @returns `Result<DeadlineResponseV2>` — unix-seconds deadline (decimal string).
33329
+ */
33330
+ async getDeadline(query, config) {
33331
+ const params = {};
33332
+ if (query?.offsetSeconds !== void 0) params.offsetSeconds = String(query.offsetSeconds);
33333
+ return this.request(
33334
+ this.withQuery("/leverage-yield/deadline", params),
33335
+ { method: "GET" },
33336
+ DeadlineResponseSchema,
33337
+ config
33338
+ );
33339
+ }
33340
+ // ──────────────────────────────────────────────────────────────────────
33341
+ // Deposit allowance · approve · create intent (deposit / withdraw)
33342
+ // ──────────────────────────────────────────────────────────────────────
33343
+ /**
33344
+ * Check whether the deposit input-token allowance is already sufficient for the intent.
33345
+ * (Withdraw needs no spoke allowance — it spends lsoda* from the hub wallet.)
33346
+ *
33347
+ * @returns `Result<AllowanceCheckResponseV2>` — `{ valid }`.
33348
+ */
33349
+ async checkAllowance(body, config) {
33350
+ return this.request(
33351
+ "/leverage-yield/allowance/check",
33352
+ { method: "POST", body: toJsonBody(body) },
33353
+ AllowanceCheckResponseSchema,
33354
+ config
33355
+ );
33356
+ }
33357
+ /**
33358
+ * Build an unsigned token-approval transaction for the deposit input token.
33359
+ *
33360
+ * @returns `Result<ApproveResponseV2>` — `{ tx }` (chain-specific unsigned tx).
33361
+ */
33362
+ async approve(body, config) {
33363
+ const txSchema = rawTxSchemaForChainKey$1(body.srcChainKey);
33364
+ return this.request(
33365
+ "/leverage-yield/approve",
33366
+ { method: "POST", body: toJsonBody(body) },
33367
+ makeApproveResponseSchema(txSchema),
33368
+ config
33369
+ );
33370
+ }
33371
+ /**
33372
+ * Build an unsigned deposit create-intent transaction (any token → lsoda* shares).
33373
+ *
33374
+ * @returns `Result<CreateIntentResponseV2>` — `{ tx, intent, relayData }`.
33375
+ */
33376
+ async createDepositIntent(body, config) {
33377
+ const txSchema = rawTxSchemaForChainKey$1(body.srcChainKey);
33378
+ return this.request(
33379
+ "/leverage-yield/intents/deposit",
33380
+ { method: "POST", body: toJsonBody(body) },
33381
+ makeCreateIntentResponseSchema(txSchema),
33382
+ config
33383
+ );
33384
+ }
33385
+ /**
33386
+ * Build an unsigned withdraw create-intent transaction (lsoda* shares → any token). The backend
33387
+ * sets `hubWalletSwap` internally so the swap spends the lsoda* held in the user's hub wallet.
33388
+ *
33389
+ * @returns `Result<CreateIntentResponseV2>` — `{ tx, intent, relayData }`.
33390
+ */
33391
+ async createWithdrawIntent(body, config) {
33392
+ const txSchema = rawTxSchemaForChainKey$1(body.srcChainKey);
33393
+ return this.request(
33394
+ "/leverage-yield/intents/withdraw",
33395
+ { method: "POST", body: toJsonBody(body) },
33396
+ makeCreateIntentResponseSchema(txSchema),
33397
+ config
33398
+ );
33399
+ }
33400
+ // ──────────────────────────────────────────────────────────────────────
33401
+ // Intent lifecycle: submit · status · cancel · hash · packet · extra-data
33402
+ // ──────────────────────────────────────────────────────────────────────
33403
+ /**
33404
+ * Submit the broadcast intent tx to the relay.
33405
+ *
33406
+ * @returns `Result<SubmitIntentResponseV2>` — `{ result }` (opaque relay response).
33407
+ */
33408
+ async submitIntent(body, config) {
33409
+ return this.request(
33410
+ "/leverage-yield/intents/submit",
33411
+ { method: "POST", body: toJsonBody(body) },
33412
+ SubmitIntentResponseSchema,
33413
+ config
33414
+ );
33415
+ }
33416
+ /**
33417
+ * Poll the solver for intent execution status.
33418
+ *
33419
+ * @returns `Result<StatusResponseV2>` — `{ status, fillTxHash? }`.
33420
+ */
33421
+ async getStatus(body, config) {
33422
+ return this.request(
33423
+ "/leverage-yield/intents/status",
33424
+ { method: "POST", body: toJsonBody(body) },
33425
+ StatusResponseSchema,
33426
+ config
33427
+ );
33428
+ }
33429
+ /**
33430
+ * Build an unsigned cancel-intent transaction. The `intent` field carries `bigint` numerics —
33431
+ * {@link toJsonBody} serializes them to decimal strings.
33432
+ *
33433
+ * @returns `Result<CancelIntentResponseV2>` — `{ tx }`.
33434
+ */
33435
+ async cancelIntent(body, config) {
33436
+ const txSchema = rawTxSchemaForChainKey$1(body.srcChainKey);
33437
+ return this.request(
33438
+ "/leverage-yield/intents/cancel",
33439
+ { method: "POST", body: toJsonBody({ ...body, intent: _LeverageYieldApiService.toWireIntent(body.intent) }) },
33440
+ makeCancelIntentResponseSchema(txSchema),
33441
+ config
33442
+ );
33443
+ }
33444
+ /**
33445
+ * Compute the keccak256 hash of an Intent struct. The `intent` field carries `bigint` numerics.
33446
+ *
33447
+ * @returns `Result<IntentHashResponseV2>` — `{ hash }`.
33448
+ */
33449
+ async getIntentHash(body, config) {
33450
+ return this.request(
33451
+ "/leverage-yield/intents/hash",
33452
+ { method: "POST", body: toJsonBody({ ...body, intent: _LeverageYieldApiService.toWireIntent(body.intent) }) },
33453
+ IntentHashResponseSchema,
33454
+ config
33455
+ );
33456
+ }
33457
+ /**
33458
+ * Long-poll the relayer until the fill packet lands on the destination chain.
33459
+ *
33460
+ * @returns `Result<IntentPacketResponseV2>` — delivered packet data.
33461
+ */
33462
+ async getSolvedIntentPacket(body, config) {
33463
+ return this.request(
33464
+ "/leverage-yield/intents/packet",
33465
+ { method: "POST", body: toJsonBody(body) },
33466
+ IntentPacketResponseSchema,
33467
+ config
33468
+ );
33469
+ }
33470
+ /**
33471
+ * Recover the relay extra data needed by `/leverage-yield/intents/submit`. Provide EITHER
33472
+ * `txHash` OR `intent` (whose `bigint` numerics {@link toJsonBody} serializes).
33473
+ *
33474
+ * @returns `Result<IntentExtraDataResponseV2>` — `{ address, payload }`.
33475
+ */
33476
+ async getIntentSubmitTxExtraData(body, config) {
33477
+ const normalized = body.intent ? { ...body, intent: _LeverageYieldApiService.toWireIntent(body.intent) } : body;
33478
+ return this.request(
33479
+ "/leverage-yield/intents/extra-data",
33480
+ { method: "POST", body: toJsonBody(normalized) },
33481
+ RelayExtraDataResponseSchema$1,
33482
+ config
33483
+ );
33484
+ }
33485
+ /**
33486
+ * Get the on-chain fill state for an intent by its hub-chain tx hash.
33487
+ *
33488
+ * @returns `Result<IntentStateV2>` — `{ exists, remainingInput, receivedOutput, pendingPayment }`.
33489
+ */
33490
+ async getFilledIntent(txHash, config) {
33491
+ return this.request(
33492
+ `/leverage-yield/intents/${txHash}/fill`,
33493
+ { method: "GET" },
33494
+ IntentStateSchema,
33495
+ config
33496
+ );
33497
+ }
33498
+ /**
33499
+ * Look up an Intent struct by its hub-chain creation tx hash.
33500
+ *
33501
+ * @returns `Result<GetIntentResponseV2>` — the decoded intent (bigint fields as decimal strings).
33502
+ */
33503
+ async getIntent(txHash, config) {
33504
+ return this.request(`/leverage-yield/intents/${txHash}`, { method: "GET" }, IntentResponseSchema$1, config);
33505
+ }
33506
+ // ──────────────────────────────────────────────────────────────────────
33507
+ // Gas · fees
33508
+ // ──────────────────────────────────────────────────────────────────────
33509
+ /**
33510
+ * Estimate gas for a raw transaction on a spoke chain.
33511
+ *
33512
+ * @returns `Result<GasEstimateResponseV2>` — `{ gas }` (chain-specific shape).
33513
+ */
33514
+ async estimateGas(body, config) {
33515
+ return this.request(
33516
+ "/leverage-yield/gas/estimate",
33517
+ { method: "POST", body: toJsonBody(body) },
33518
+ GasEstimateResponseSchema,
33519
+ config
33520
+ );
33521
+ }
33522
+ /**
33523
+ * Compute the partner fee for a given input amount.
33524
+ *
33525
+ * @returns `Result<FeeResponseV2>` — `{ fee }` (decimal string).
33526
+ */
33527
+ async getPartnerFee(query, config) {
33528
+ return this.request(
33529
+ this.withQuery("/leverage-yield/fees/partner", { amount: query.amount }),
33530
+ { method: "GET" },
33531
+ FeeResponseSchema,
33532
+ config
33533
+ );
33534
+ }
33535
+ /**
33536
+ * Compute the protocol (solver) fee for a given input amount.
33537
+ *
33538
+ * @returns `Result<FeeResponseV2>` — `{ fee }` (decimal string).
33539
+ */
33540
+ async getSolverFee(query, config) {
33541
+ return this.request(
33542
+ this.withQuery("/leverage-yield/fees/solver", { amount: query.amount }),
33543
+ { method: "GET" },
33544
+ FeeResponseSchema,
33545
+ config
33546
+ );
33547
+ }
33548
+ // ──────────────────────────────────────────────────────────────────────
33549
+ // Submit-tx state machine
33550
+ // ──────────────────────────────────────────────────────────────────────
33551
+ /**
33552
+ * Submit a vault-swap transaction to be processed (relay, post-execution, etc.). The `intent`
33553
+ * field carries `bigint` numerics — {@link toJsonBody} serializes them. Idempotent on
33554
+ * `(txHash, srcChainKey)`.
33555
+ *
33556
+ * @returns `Result<SubmitTxResponseV2>` — `{ success, data: { status, message } }`.
33557
+ */
33558
+ async submitTx(body, config) {
33559
+ return this.request(
33560
+ "/leverage-yield/submit-tx",
33561
+ { method: "POST", body: toJsonBody({ ...body, intent: _LeverageYieldApiService.toWireIntent(body.intent) }) },
33562
+ SubmitTxResponseSchema,
33563
+ config
33564
+ );
33565
+ }
33566
+ /**
33567
+ * Get the processing status of a submitted vault-swap transaction by `(txHash, srcChainKey)`.
33568
+ *
33569
+ * @returns `Result<SubmitTxStatusResponseV2>` — `{ success, data }` (processing state).
33570
+ */
33571
+ async getSubmitTxStatus(query, config) {
33572
+ return this.request(
33573
+ this.withQuery("/leverage-yield/submit-tx/status", { txHash: query.txHash, srcChainKey: query.srcChainKey }),
33574
+ { method: "GET" },
33575
+ SubmitTxStatusResponseSchema,
33576
+ config
33577
+ );
33578
+ }
33579
+ // ──────────────────────────────────────────────────────────────────────
33580
+ // Utilities (parity with SwapsApiService)
33581
+ // ──────────────────────────────────────────────────────────────────────
33582
+ /**
33583
+ * Merge additional headers into the service's default header set. Existing keys are
33584
+ * overwritten; keys absent from `headers` are preserved.
33585
+ */
33586
+ setHeaders(headers) {
33587
+ assignHeaders(this.headers, headers);
33588
+ }
33589
+ /** Return the base URL the service is currently pointing at. */
33590
+ getBaseURL() {
33591
+ return this.config.baseURL;
33592
+ }
33593
+ /**
33594
+ * Return the effective per-request timeout (ms).
33595
+ *
33596
+ * Callers bounding a request tighter than this need it as the CEILING, because a
33597
+ * `RequestOverrideConfig.timeout` REPLACES the service value rather than lowering it: an override
33598
+ * derived from a caller budget alone would raise the bound whenever that budget is the larger of the
33599
+ * two. `SubmitTxAttempt.requestTimeout` clamps against both (`min(budget left in the attempt, this)`).
33600
+ */
33601
+ getTimeout() {
33602
+ return this.config.timeout;
33603
+ }
33604
+ };
32853
33605
 
32854
33606
  // src/backendApi/BackendApiService.ts
32855
33607
  var BackendApiService = class {
@@ -32857,6 +33609,7 @@ var BackendApiService = class {
32857
33609
  swaps;
32858
33610
  sponsoring;
32859
33611
  bridge;
33612
+ leverageYield;
32860
33613
  // resolved base-API config: the flat fields of the ApiConfig union with any `baseApiConfig` layered on
32861
33614
  // top. `baseURL` is the gateway root; `basePath` is this service's own mount below it.
32862
33615
  config;
@@ -32885,6 +33638,7 @@ var BackendApiService = class {
32885
33638
  const swapsConfig2 = resolveSwapsApiConfig(config);
32886
33639
  const sponsoringConfig = resolveSponsoringApiConfig(config);
32887
33640
  const bridgeConfig2 = resolveBridgeApiConfig(config);
33641
+ const leverageYieldConfig2 = resolveLeverageYieldApiConfig(config);
32888
33642
  const shortRoots = [
32889
33643
  ["backendApi", this.config.baseURL],
32890
33644
  ["api.swaps", swapsConfig2.baseURL],
@@ -32909,6 +33663,11 @@ var BackendApiService = class {
32909
33663
  inheritedApiKeyBaseURLs: [DEFAULT_SPONSORING_API_ENDPOINT, this.config.baseURL]
32910
33664
  });
32911
33665
  this.bridge = new BridgeApiService(withApiKey(bridgeConfig2, options.apiKey), this.logger, overrideOptions);
33666
+ this.leverageYield = new LeverageYieldApiService(
33667
+ withApiKey(leverageYieldConfig2, options.apiKey),
33668
+ this.logger,
33669
+ overrideOptions
33670
+ );
32912
33671
  }
32913
33672
  /**
32914
33673
  * Issue the HTTP call for a route.
@@ -33312,15 +34071,17 @@ var BackendApiService = class {
33312
34071
  * without constructing a new service instance. Existing header keys are
33313
34072
  * overwritten; keys absent from `headers` are preserved.
33314
34073
  *
33315
- * Headers also reach `swaps` and `bridge`, but never `sponsoring`: it is configured independently, so
33316
- * base-API credentials must not be forwarded to whatever origin it points at. Note `swaps` can also be
33317
- * retargeted to another origin via `swapsApiConfig`, in which case a header set here follows it.
34074
+ * Headers also reach `swaps`, `bridge` and `leverageYield`, but never `sponsoring`: it is configured
34075
+ * independently, so base-API credentials must not be forwarded to whatever origin it points at. Note
34076
+ * `swaps` can also be retargeted to another origin via `swapsApiConfig`, in which case a header set
34077
+ * here follows it.
33318
34078
  *
33319
34079
  * @param headers - Key-value pairs to add or overwrite in the default headers.
33320
34080
  */
33321
34081
  setHeaders(headers) {
33322
34082
  assignHeaders(this.headers, headers);
33323
34083
  this.swaps.setHeaders(headers);
34084
+ this.leverageYield.setHeaders(headers);
33324
34085
  this.bridge.setHeaders(headers);
33325
34086
  }
33326
34087
  /**
@@ -36262,7 +37023,7 @@ var AssetService = class {
36262
37023
  ok: true,
36263
37024
  value: {
36264
37025
  tx: txResult.value,
36265
- relayData: { address: recipient, payload: data }
37026
+ relayData: { address: fromHubWallet, payload: data }
36266
37027
  }
36267
37028
  };
36268
37029
  } catch (error) {
@@ -41546,7 +42307,9 @@ var PartnerFeeClaimService = class {
41546
42307
  isEvmWalletProviderType(walletProvider),
41547
42308
  "PartnerFeeClaimService only supports Evm (sonic) wallet provider"
41548
42309
  );
41549
- const txHash = await walletProvider.sendTransaction(rawTx);
42310
+ const txHash = await walletProvider.sendTransaction(rawTx, {
42311
+ expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
42312
+ });
41550
42313
  return {
41551
42314
  ok: true,
41552
42315
  value: txHash
@@ -41741,7 +42504,9 @@ var PartnerFeeClaimService = class {
41741
42504
  value: rawTx
41742
42505
  };
41743
42506
  }
41744
- const txHash = await _params.walletProvider.sendTransaction(rawTx);
42507
+ const txHash = await _params.walletProvider.sendTransaction(rawTx, {
42508
+ expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
42509
+ });
41745
42510
  return {
41746
42511
  ok: true,
41747
42512
  value: txHash
@@ -41888,7 +42653,9 @@ var PartnerFeeClaimService = class {
41888
42653
  value: rawTx
41889
42654
  };
41890
42655
  }
41891
- const txHash = await _params.walletProvider.sendTransaction(rawTx);
42656
+ const txHash = await _params.walletProvider.sendTransaction(rawTx, {
42657
+ expectedChainId: getEvmViemChain(ChainKeys.SONIC_MAINNET).id
42658
+ });
41892
42659
  return {
41893
42660
  ok: true,
41894
42661
  value: txHash
@@ -42265,10 +43032,20 @@ var LeverageYieldService = class {
42265
43032
  hubProvider;
42266
43033
  config;
42267
43034
  spoke;
42268
- constructor({ hubProvider, config, spoke }) {
43035
+ backendApi;
43036
+ /**
43037
+ * Effective backend submit-tx flow (`leverageYield.useBackendSubmitTx`, default off). Read live off
43038
+ * `ConfigService`, like `config.leverageYieldPartnerFee`, so the config object and the behavior can
43039
+ * never disagree.
43040
+ */
43041
+ get useBackendSubmitTx() {
43042
+ return this.config.leverageYieldUseBackendSubmitTx;
43043
+ }
43044
+ constructor({ hubProvider, config, spoke, backendApi }) {
42269
43045
  this.hubProvider = hubProvider;
42270
43046
  this.config = config;
42271
43047
  this.spoke = spoke;
43048
+ this.backendApi = backendApi;
42272
43049
  }
42273
43050
  // ─── Registry ──────────────────────────────────────────────────────────
42274
43051
  /** Returns the static registry of known leverage-yield vaults. */
@@ -42277,7 +43054,7 @@ var LeverageYieldService = class {
42277
43054
  }
42278
43055
  /** Looks up a vault by its `name` field. Returns `undefined` when not registered. */
42279
43056
  getVault(name) {
42280
- return this.listVaults().find((v10) => v10.name === name);
43057
+ return this.listVaults().find((v12) => v12.name === name);
42281
43058
  }
42282
43059
  /**
42283
43060
  * Looks up a registered vault by its on-chain proxy address (case-insensitive).
@@ -42285,7 +43062,7 @@ var LeverageYieldService = class {
42285
43062
  */
42286
43063
  getVaultByAddress(address) {
42287
43064
  const normalized = address.toLowerCase();
42288
- return this.listVaults().find((v10) => v10.vault.toLowerCase() === normalized);
43065
+ return this.listVaults().find((v12) => v12.vault.toLowerCase() === normalized);
42289
43066
  }
42290
43067
  /**
42291
43068
  * Resolves the intent `deadline`: returns the caller-supplied value verbatim, otherwise
@@ -42708,62 +43485,21 @@ var LeverageYieldService = class {
42708
43485
  "vaultSwap",
42709
43486
  async () => {
42710
43487
  try {
42711
- const timeout = _params.timeout;
42712
43488
  const createIntentResult = await this.createVaultIntent(_params);
42713
43489
  if (!createIntentResult.ok) {
42714
43490
  return { ok: false, error: createIntentResult.error };
42715
43491
  }
42716
- const { tx: spokeTxHash, intent, relayData } = createIntentResult.value;
42717
- const verifyTxHashResult = await this.spoke.verifyTxHash({
42718
- txHash: spokeTxHash,
42719
- chainKey: srcChainKey
42720
- });
42721
- if (!verifyTxHashResult.ok) {
42722
- return {
42723
- ok: false,
42724
- error: verifyFailed("leverageYield", verifyTxHashResult.error, baseCtx)
42725
- };
42726
- }
42727
- let dstIntentTxHash;
42728
- if (isHubChainKeyType(srcChainKey)) {
42729
- dstIntentTxHash = spokeTxHash;
42730
- } else {
42731
- const packet = await relayTxAndWaitPacket({
42732
- srcTxHash: spokeTxHash,
42733
- data: relayData,
42734
- chainKey: srcChainKey,
42735
- relayerApiEndpoint: this.config.relay.relayerApiEndpoint,
42736
- timeout
42737
- });
42738
- if (!packet.ok) {
42739
- return {
42740
- ok: false,
42741
- error: mapRelayFailure(packet.error, { feature: "leverageYield", ...baseCtx })
42742
- };
42743
- }
42744
- dstIntentTxHash = packet.value.dst_tx_hash;
42745
- }
42746
- const postExecResult = await this.notifySolver({
42747
- intent_tx_hash: dstIntentTxHash
42748
- });
42749
- if (!postExecResult.ok) {
42750
- return { ok: false, error: postExecResult.error };
43492
+ const created = createIntentResult.value;
43493
+ const timeoutMs = resolveTimeoutMs(_params.timeout, DEFAULT_RELAY_TX_TIMEOUT);
43494
+ if (this.useBackendSubmitTx) {
43495
+ const submitted = await this.submitTx(_params, created, createSubmitTxAttempt(timeoutMs));
43496
+ if (submitted.ok) return submitted;
43497
+ this.config.logger.warn(
43498
+ "[leverageYield] backend submit-tx did not complete; falling back to the client-side relay",
43499
+ { error: submitted.error }
43500
+ );
42751
43501
  }
42752
- return {
42753
- ok: true,
42754
- value: {
42755
- solverExecutionResponse: postExecResult.value,
42756
- intent,
42757
- intentDeliveryInfo: {
42758
- srcChainKey,
42759
- srcTxHash: spokeTxHash,
42760
- srcAddress: params.srcAddress,
42761
- dstChainKey: params.dstChainKey,
42762
- dstTxHash: dstIntentTxHash,
42763
- dstAddress: params.dstAddress
42764
- }
42765
- }
42766
- };
43502
+ return this.fallbackVaultSwapSteps(_params, created, timeoutMs);
42767
43503
  } catch (error) {
42768
43504
  if (isLeverageYieldSwapError(error)) return { ok: false, error };
42769
43505
  return {
@@ -42791,6 +43527,129 @@ var LeverageYieldService = class {
42791
43527
  }
42792
43528
  );
42793
43529
  }
43530
+ /**
43531
+ * Client-side vault-swap completion (the default path): verify the broadcast intent tx landed,
43532
+ * relay it to the hub (Sonic) — or use it directly when the source IS the hub — then notify the
43533
+ * solver via {@link LeverageYieldService.notifySolver} and build the {@link VaultSwapResponse}.
43534
+ * Extracted from `vaultSwap()` so the opt-in backend 2-step path ({@link LeverageYieldService.submitTx})
43535
+ * can fall back to it on any non-success. Leverage-yield copy of `SwapService.fallbackSwapSteps`.
43536
+ */
43537
+ async fallbackVaultSwapSteps(_params, created, timeoutMs) {
43538
+ const { params } = _params;
43539
+ const srcChainKey = params.srcChainKey;
43540
+ const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "vaultSwap" };
43541
+ const { tx: spokeTxHash, intent, relayData } = created;
43542
+ const verifyTxHashResult = await this.spoke.verifyTxHash({
43543
+ txHash: spokeTxHash,
43544
+ chainKey: srcChainKey
43545
+ });
43546
+ if (!verifyTxHashResult.ok) {
43547
+ return { ok: false, error: verifyFailed("leverageYield", verifyTxHashResult.error, baseCtx) };
43548
+ }
43549
+ let dstIntentTxHash;
43550
+ if (isHubChainKeyType(srcChainKey)) {
43551
+ dstIntentTxHash = spokeTxHash;
43552
+ } else {
43553
+ const packet = await relayTxAndWaitPacket({
43554
+ srcTxHash: spokeTxHash,
43555
+ data: relayData,
43556
+ chainKey: srcChainKey,
43557
+ relayerApiEndpoint: this.config.relay.relayerApiEndpoint,
43558
+ // The caller's full `timeout`, starting HERE — whether this runs as the only path or as the
43559
+ // backend's fallback, so a stalled backend attempt cannot shorten the relay wait. The floor
43560
+ // covers a sub-floor caller `timeout`: `relayTxAndWaitPacket` SUBMITS before `timeout` bounds
43561
+ // anything, so a zero budget would strand an already-landed tx unrelayed.
43562
+ timeout: Math.max(timeoutMs, RELAY_FALLBACK_FLOOR_MS)
43563
+ });
43564
+ if (!packet.ok) {
43565
+ return { ok: false, error: mapRelayFailure(packet.error, { feature: "leverageYield", ...baseCtx }) };
43566
+ }
43567
+ dstIntentTxHash = packet.value.dst_tx_hash;
43568
+ }
43569
+ const postExecResult = await this.notifySolver({
43570
+ intent_tx_hash: dstIntentTxHash
43571
+ });
43572
+ if (!postExecResult.ok) {
43573
+ return { ok: false, error: postExecResult.error };
43574
+ }
43575
+ return {
43576
+ ok: true,
43577
+ value: {
43578
+ solverExecutionResponse: postExecResult.value,
43579
+ intent,
43580
+ intentDeliveryInfo: {
43581
+ srcChainKey,
43582
+ srcTxHash: spokeTxHash,
43583
+ srcAddress: params.srcAddress,
43584
+ dstChainKey: params.dstChainKey,
43585
+ dstTxHash: dstIntentTxHash,
43586
+ dstAddress: params.dstAddress
43587
+ }
43588
+ }
43589
+ };
43590
+ }
43591
+ /**
43592
+ * Backend 2-step vault-swap path (opt-in via `leverageYield.useBackendSubmitTx`): hand the
43593
+ * broadcast intent tx to the leverage-yield API (`POST /leverage-yield/submit-tx`); the backend
43594
+ * relays + post-executes server-side. Polls `getSubmitTxStatus` until `solved`, then reconstructs
43595
+ * the same {@link VaultSwapResponse} the client-side path returns.
43596
+ *
43597
+ * Never throws — returns `{ ok: false }` on any non-success (submit `!ok`, a 200 the backend did not
43598
+ * accept, terminal `failed` / abandoned, or poll timeout) so `vaultSwap()` falls back to
43599
+ * {@link LeverageYieldService.fallbackVaultSwapSteps}. Falling back is safe: re-relaying / re-posting
43600
+ * an already-processed vault swap is idempotent (the relay dedups the `executed` packet and the solver
43601
+ * re-affirms the intent — no double-fill), and load-bearing rather than belt-and-braces: the backend
43602
+ * keeps processing after this attempt gives up, so the fallback's relay can race the backend's own.
43603
+ *
43604
+ * The attempt itself — POST, budget clamps, status poll — is {@link runBackendSubmitTx}, shared with
43605
+ * swaps and bridge. What is leverage-yield-specific and lives here: the request body (including the
43606
+ * `operation` discriminator), the `solved` terminal status, the mapping to a
43607
+ * {@link VaultSwapResponse}, and the leverage-yield error taxonomy.
43608
+ *
43609
+ * `attempt` bounds this attempt alone — the POST and every status request draw on it, and the
43610
+ * client-side fallback holds a separate fresh `timeout`.
43611
+ */
43612
+ async submitTx(_params, created, attempt) {
43613
+ const { params } = _params;
43614
+ const srcChainKey = params.srcChainKey;
43615
+ const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "vaultSwap" };
43616
+ const { tx: spokeTxHash, intent, relayData } = created;
43617
+ try {
43618
+ const outcome = await runBackendSubmitTx({
43619
+ attempt,
43620
+ api: this.backendApi.leverageYield,
43621
+ body: {
43622
+ txHash: spokeTxHash,
43623
+ srcChainKey,
43624
+ walletAddress: params.srcAddress,
43625
+ intent,
43626
+ relayData: relayData.payload,
43627
+ // `withdraw` sets `hubWalletSwap: true` (spends the hub-wallet lsoda*); a plain deposit doesn't.
43628
+ operation: _params.hubWalletSwap ? "withdraw" : "deposit"
43629
+ },
43630
+ statusQuery: { txHash: spokeTxHash, srcChainKey },
43631
+ // A vault deposit/withdraw IS a solver swap, so terminal success is `solved` — not bridge's
43632
+ // `executed`.
43633
+ terminalStatus: "solved",
43634
+ onExecuted: (result) => result?.dstIntentTxHash && result.intent_hash ? {
43635
+ // Backend serializes the hex intent_hash as a plain string; brand it at the boundary.
43636
+ solverExecutionResponse: { answer: "OK", intent_hash: result.intent_hash },
43637
+ intent,
43638
+ intentDeliveryInfo: {
43639
+ srcChainKey,
43640
+ srcTxHash: spokeTxHash,
43641
+ srcAddress: params.srcAddress,
43642
+ dstChainKey: params.dstChainKey,
43643
+ dstTxHash: result.dstIntentTxHash,
43644
+ dstAddress: params.dstAddress
43645
+ }
43646
+ } : void 0
43647
+ });
43648
+ return outcome.ok ? { ok: true, value: outcome.value } : { ok: false, error: executionFailed("leverageYield", outcome.cause, baseCtx) };
43649
+ } catch (error) {
43650
+ return { ok: false, error: unknownFailed("leverageYield", error, baseCtx) };
43651
+ }
43652
+ }
42794
43653
  /**
42795
43654
  * Notifies the solver that the vault intent landed on the hub, triggering it to fill.
42796
43655
  * Leverage-yield copy of the swap domain's `postExecution` — emits only
@@ -43802,7 +44661,8 @@ var Sodax = class {
43802
44661
  this.leverageYield = new LeverageYieldService({
43803
44662
  hubProvider: this.hubProvider,
43804
44663
  config: this.config,
43805
- spoke: this.spoke
44664
+ spoke: this.spoke,
44665
+ backendApi: this.backendApi
43806
44666
  });
43807
44667
  this.sponsoring = new SponsoringService({
43808
44668
  config: this.config,
@@ -43850,4 +44710,4 @@ var isPartnerError = isCodeMember(PARTNER_CODES);
43850
44710
  (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
43851
44711
  */
43852
44712
 
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 };
44713
+ 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, LeverageYieldApiService, 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, canonicalizeBitcoinAddress, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, classifySponsorError, concentratedLiquidityConfig, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createBalanceCollector, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, encodeTokenIdentifier, 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, isValidBitcoinAddress, isValidInjectiveAddress, isValidNearAccountId, 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 };