@hyperbridge/sdk 2.2.3 → 2.3.0

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.
@@ -2,7 +2,7 @@ import { readFileSync } from 'fs';
2
2
  import { join } from 'path';
3
3
  import { TextDecoder as TextDecoder$1, TextEncoder as TextEncoder$1 } from 'util';
4
4
  import { createConsola, LogLevels } from 'consola';
5
- import { defineChain, keccak256, toHex, createPublicClient, http, hexToBytes, toFunctionSelector, bytesToHex, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, numberToBytes, getAddress, encodeAbiParameters, isHex, maxUint256, parseAbiParameters, encodePacked, parseAbiItem, concat, decodeFunctionData, decodeAbiParameters, hexToString as hexToString$1, decodeEventLog, parseEventLogs, parseUnits, concatHex, zeroAddress, decodeFunctionResult, formatUnits } from 'viem';
5
+ import { defineChain, keccak256, toHex, createPublicClient, http, hexToBytes, toFunctionSelector, bytesToHex, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, numberToBytes, decodeAbiParameters, getAddress, encodeAbiParameters, isHex, maxUint256, parseAbiParameters, encodePacked, parseAbiItem, concat, decodeFunctionData, hexToString as hexToString$1, decodeEventLog, parseEventLogs, parseUnits, concatHex, zeroAddress, decodeFunctionResult, formatUnits } from 'viem';
6
6
  import { baseSepolia, optimismSepolia, arbitrumSepolia, soneium, gnosis, optimism, polygonAmoy, polygon, base, arbitrum, bsc, mainnet, sepolia, gnosisChiado, bscTestnet, tron, unichain } from 'viem/chains';
7
7
  import { TronWeb } from 'tronweb';
8
8
  import { flatten, zip, capitalize, maxBy, isNil } from 'lodash-es';
@@ -11,6 +11,7 @@ import { WsProvider, ApiPromise, Keyring } from '@polkadot/api';
11
11
  import { Struct, Vector, u8, Bytes, Enum, Tuple, _void, u64, u32, Option, bool, u128 } from 'scale-ts';
12
12
  import { keccakAsU8a, decodeAddress, keccakAsHex, xxhashAsU8a, blake2AsU8a } from '@polkadot/util-crypto';
13
13
  import { hexToU8a, u8aToHex, u8aConcat } from '@polkadot/util';
14
+ import PQueue from 'p-queue';
14
15
  import { hasWindow, isNode, env } from 'std-env';
15
16
  import mergeRace from '@async-generator/merge-race';
16
17
  import { GraphQLClient } from 'graphql-request';
@@ -514,6 +515,11 @@ var ABI = [
514
515
  name: "context",
515
516
  type: "bytes",
516
517
  internalType: "bytes"
518
+ },
519
+ {
520
+ name: "payer",
521
+ type: "address",
522
+ internalType: "address"
517
523
  }
518
524
  ]
519
525
  }
@@ -2569,9 +2575,9 @@ var chainConfigs = {
2569
2575
  USDT: { balanceSlot: 151, allowanceSlot: 152 }
2570
2576
  },
2571
2577
  addresses: {
2572
- IntentGateway: "0xE13fB34CAe12505ae51BaC8C405AF8EB27AC8058",
2578
+ IntentGateway: "0x6CF42FA9BecbC5b6a26884964956b113530f7cFA",
2573
2579
  TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
2574
- Host: "0xEB944071A9Bf22810757C5BcFf7a2aE9663a311D",
2580
+ Host: "0x9AA003594d59C62EE17A73A569Fd7B1DbdBd71E1",
2575
2581
  UniswapRouter02: "0x9639379819420704457B07A0C33B678D9E0F8Df0",
2576
2582
  UniswapV2Factory: "0x12e036669DA18F4A2777853d6e2136b32AceEC86",
2577
2583
  UniswapV3Factory: "0x0000000000000000000000000000000000000000",
@@ -2579,7 +2585,7 @@ var chainConfigs = {
2579
2585
  UniswapV3Quoter: "0x0000000000000000000000000000000000000000",
2580
2586
  UniswapV4Quoter: "0x0000000000000000000000000000000000000000",
2581
2587
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
2582
- SolverAccount: "0x0b5cfBc16ef60AD6930ba5A90Bb09475B7BF3815"
2588
+ SolverAccount: "0x07FeC66d967800998060194EaECDd7C66dA4a1B1"
2583
2589
  },
2584
2590
  rpcEnvKey: "BSC_CHAPEL",
2585
2591
  defaultRpcUrl: "https://bnb-testnet.api.onfinality.io/public",
@@ -2610,7 +2616,7 @@ var chainConfigs = {
2610
2616
  addresses: {
2611
2617
  IntentGateway: "0x016b6ffC9f890d1e28f9Fdb9eaDA776b02F89509",
2612
2618
  TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
2613
- Host: "0xEB944071A9Bf22810757C5BcFf7a2aE9663a311D",
2619
+ Host: "0x58A41B89F4871725E5D898d98eF4BF917601c5eB",
2614
2620
  UniswapRouter02: "0x0000000000000000000000000000000000000000",
2615
2621
  UniswapV2Factory: "0x0000000000000000000000000000000000000000",
2616
2622
  UniswapV3Factory: "0x0000000000000000000000000000000000000000",
@@ -2649,7 +2655,7 @@ var chainConfigs = {
2649
2655
  addresses: {
2650
2656
  IntentGateway: "0x016b6ffC9f890d1e28f9Fdb9eaDA776b02F89509",
2651
2657
  TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
2652
- Host: "0xEB944071A9Bf22810757C5BcFf7a2aE9663a311D",
2658
+ Host: "0x9AA003594d59C62EE17A73A569Fd7B1DbdBd71E1",
2653
2659
  UniswapRouter02: "0x0000000000000000000000000000000000000000",
2654
2660
  UniswapV2Factory: "0x0000000000000000000000000000000000000000",
2655
2661
  UniswapV3Factory: "0x0000000000000000000000000000000000000000",
@@ -2995,13 +3001,13 @@ var chainConfigs = {
2995
3001
  USDC: { balanceSlot: 1, allowanceSlot: 2 }
2996
3002
  },
2997
3003
  addresses: {
2998
- IntentGateway: "0xE13fB34CAe12505ae51BaC8C405AF8EB27AC8058",
3004
+ IntentGateway: "0x6CF42FA9BecbC5b6a26884964956b113530f7cFA",
2999
3005
  TokenGateway: "0x8b536105b6Fae2aE9199f5146D3C57Dfe53b614E",
3000
- Host: "0xEB944071A9Bf22810757C5BcFf7a2aE9663a311D",
3006
+ Host: "0x9AA003594d59C62EE17A73A569Fd7B1DbdBd71E1",
3001
3007
  Calldispatcher: "0x876F1891982E260026630c233A4897160A281Fb8",
3002
3008
  Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
3003
3009
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
3004
- SolverAccount: "0x0b5cfBc16ef60AD6930ba5A90Bb09475B7BF3815"
3010
+ SolverAccount: "0x07FeC66d967800998060194EaECDd7C66dA4a1B1"
3005
3011
  },
3006
3012
  rpcEnvKey: "POLYGON_AMOY",
3007
3013
  defaultRpcUrl: "https://rpc-amoy.polygon.technology",
@@ -3117,7 +3123,7 @@ var chainConfigs = {
3117
3123
  },
3118
3124
  addresses: {
3119
3125
  TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
3120
- Host: "0xEB944071A9Bf22810757C5BcFf7a2aE9663a311D",
3126
+ Host: "0x9AA003594d59C62EE17A73A569Fd7B1DbdBd71E1",
3121
3127
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
3122
3128
  },
3123
3129
  defaultRpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
@@ -3141,7 +3147,7 @@ var chainConfigs = {
3141
3147
  },
3142
3148
  addresses: {
3143
3149
  TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
3144
- Host: "0xEB944071A9Bf22810757C5BcFf7a2aE9663a311D",
3150
+ Host: "0x9AA003594d59C62EE17A73A569Fd7B1DbdBd71E1",
3145
3151
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
3146
3152
  },
3147
3153
  defaultRpcUrl: "https://sepolia.optimism.io",
@@ -3165,7 +3171,7 @@ var chainConfigs = {
3165
3171
  },
3166
3172
  addresses: {
3167
3173
  TokenGateway: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6",
3168
- Host: "0xEB944071A9Bf22810757C5BcFf7a2aE9663a311D",
3174
+ Host: "0x9AA003594d59C62EE17A73A569Fd7B1DbdBd71E1",
3169
3175
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
3170
3176
  },
3171
3177
  defaultRpcUrl: "https://sepolia.base.org",
@@ -3191,7 +3197,7 @@ var chainConfigs = {
3191
3197
  addresses: {
3192
3198
  IntentGateway: "0x606ba811aa6cb424ce2108e8977c5284686f0d1f",
3193
3199
  TokenGateway: "0x1c1e5be83df4a54c7a2230c337e4a3e8b7354b1c",
3194
- Host: "0xEB944071A9Bf22810757C5BcFf7a2aE9663a311D",
3200
+ Host: "0x9AA003594d59C62EE17A73A569Fd7B1DbdBd71E1",
3195
3201
  EntryPointV08: "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108"
3196
3202
  },
3197
3203
  defaultRpcUrl: "https://testnet-asset-hub-eth-rpc.polkadot.io",
@@ -3241,7 +3247,7 @@ var chainConfigs = {
3241
3247
  wrappedNativeDecimals: 18,
3242
3248
  addresses: {
3243
3249
  TokenGateway: "0x451bDd8273839AD0Ec7F4Fa798E8B3DABb223fD8",
3244
- Host: "0xEB944071A9Bf22810757C5BcFf7a2aE9663a311D",
3250
+ Host: "0x9AA003594d59C62EE17A73A569Fd7B1DbdBd71E1",
3245
3251
  IntentGateway: "0xb8039832c6c9266F928d038eA49A8a169300C670"
3246
3252
  },
3247
3253
  consensusStateId: "PHAR",
@@ -4373,6 +4379,11 @@ var ABI3 = [
4373
4379
  name: "context",
4374
4380
  type: "bytes",
4375
4381
  internalType: "bytes"
4382
+ },
4383
+ {
4384
+ name: "payer",
4385
+ type: "address",
4386
+ internalType: "address"
4376
4387
  }
4377
4388
  ]
4378
4389
  }
@@ -7533,6 +7544,7 @@ function encodeISMPMessage(message) {
7533
7544
  }
7534
7545
  }
7535
7546
  var OFFCHAIN_BID_PREFIX = new TextEncoder().encode("intents::bid::");
7547
+ var OFFCHAIN_PHANTOM_PREFIX = new TextEncoder().encode("intents::phantom::order::");
7536
7548
  var BidCodec = Struct({ filler: Bytes(32), user_op: Vector(u8) });
7537
7549
  var PackedUserOperationCodec = Struct({
7538
7550
  sender: Bytes(20),
@@ -7593,6 +7605,11 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
7593
7605
  ownsConnection;
7594
7606
  /** Cached result of whether the node exposes intents_* RPC methods */
7595
7607
  hasIntentsRpc = null;
7608
+ // Serialises every extrinsic submission on this instance's substrate account. All submit/retract
7609
+ // methods funnel through signAndSendExtrinsic, each using the API's auto-nonce; fired in parallel
7610
+ // (bids for orders on different chains, or several phantom orders in one interval) they would grab
7611
+ // the same nonce and all but one would fail. Concurrency 1 sequences them.
7612
+ submissionQueue = new PQueue({ concurrency: 1 });
7596
7613
  /**
7597
7614
  * Creates and connects an IntentsCoprocessor to a Hyperbridge node.
7598
7615
  * This creates and manages its own API connection.
@@ -7645,14 +7662,17 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
7645
7662
  }
7646
7663
  }
7647
7664
  /**
7648
- * Creates a Substrate keypair from the configured private key
7649
- * Supports both hex seed (without 0x prefix) and mnemonic phrases
7665
+ * Creates a Substrate keypair from the configured private key.
7666
+ * Supports hex seed (with or without 0x), mnemonic phrases, and URI derivation paths (//Alice).
7650
7667
  */
7651
7668
  getKeyPair() {
7652
7669
  if (!this.substratePrivateKey) {
7653
7670
  throw new Error("Substrate PrivateKey Required");
7654
7671
  }
7655
7672
  const keyring = new Keyring({ type: "sr25519" });
7673
+ if (this.substratePrivateKey.startsWith("//")) {
7674
+ return keyring.addFromUri(this.substratePrivateKey);
7675
+ }
7656
7676
  if (this.substratePrivateKey.includes(" ")) {
7657
7677
  return keyring.addFromMnemonic(this.substratePrivateKey);
7658
7678
  }
@@ -7661,10 +7681,19 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
7661
7681
  return keyring.addFromSeed(seedBytes);
7662
7682
  }
7663
7683
  /**
7664
- * Signs and sends an extrinsic, handling status updates and errors
7665
- * Implements retry logic with progressive tip increases for stuck transactions
7684
+ * Signs and sends an extrinsic. Submissions are serialised through {@link submissionQueue} so
7685
+ * concurrent calls never collide on the substrate account nonce — each extrinsic reaches a block
7686
+ * before the next is signed.
7666
7687
  */
7667
7688
  async signAndSendExtrinsic(extrinsic, maxRetries = 3, timeoutMs = 3e4) {
7689
+ const result = await this.submissionQueue.add(() => this.sendExtrinsicWithRetries(extrinsic, maxRetries, timeoutMs));
7690
+ return result ?? { success: false, error: "Submission queue returned no result" };
7691
+ }
7692
+ /**
7693
+ * Signs and sends an extrinsic, handling status updates and errors.
7694
+ * Implements retry logic with progressive tip increases for stuck transactions.
7695
+ */
7696
+ async sendExtrinsicWithRetries(extrinsic, maxRetries, timeoutMs) {
7668
7697
  const keyPair = this.getKeyPair();
7669
7698
  let baseTip = 500000000000n;
7670
7699
  let attempt = 0;
@@ -7709,20 +7738,34 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
7709
7738
  }, timeoutMs);
7710
7739
  extrinsic.signAndSend(keyPair, { tip }, (result) => {
7711
7740
  if (resolved) return;
7712
- if (result.status.isInBlock || result.status.isFinalized) {
7741
+ if (result.dispatchError && (result.status.isInBlock || result.status.isFinalized)) {
7713
7742
  resolved = true;
7714
7743
  clearTimeout(timeoutId);
7744
+ let errorMsg;
7745
+ if (result.dispatchError.isModule) {
7746
+ const decoded = this.api.registry.findMetaError(result.dispatchError.asModule);
7747
+ errorMsg = `Dispatch error: ${decoded.section}::${decoded.name}`;
7748
+ } else {
7749
+ errorMsg = `Dispatch error: ${result.dispatchError.toString()}`;
7750
+ }
7715
7751
  resolve({
7716
- success: true,
7717
- blockHash: result.status.asInBlock.toHex(),
7718
- extrinsicHash: extrinsic.hash.toHex()
7752
+ success: false,
7753
+ error: errorMsg
7719
7754
  });
7720
- } else if (result.dispatchError) {
7755
+ } else if (result.status.isDropped || result.status.isInvalid || result.status.isUsurped || result.status.isFinalityTimeout) {
7721
7756
  resolved = true;
7722
7757
  clearTimeout(timeoutId);
7723
7758
  resolve({
7724
7759
  success: false,
7725
- error: `Dispatch error: ${result.dispatchError.toString()}`
7760
+ error: `Transaction ${result.status.type.toLowerCase()}`
7761
+ });
7762
+ } else if (result.status.isInBlock || result.status.isFinalized) {
7763
+ resolved = true;
7764
+ clearTimeout(timeoutId);
7765
+ resolve({
7766
+ success: true,
7767
+ blockHash: (result.status.isInBlock ? result.status.asInBlock : result.status.asFinalized).toHex(),
7768
+ extrinsicHash: extrinsic.hash.toHex()
7726
7769
  });
7727
7770
  }
7728
7771
  }).then((unsub) => {
@@ -7777,6 +7820,31 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
7777
7820
  };
7778
7821
  }
7779
7822
  }
7823
+ /**
7824
+ * Retracts a previous bid and places a new one in a single transaction via utility.batch.
7825
+ * The retraction runs first, so the old deposit is reclaimed even if the new bid then fails
7826
+ * (batch is non-atomic — a failing call interrupts the batch without reverting the calls that
7827
+ * already succeeded, unlike batchAll which would roll the retraction back too).
7828
+ *
7829
+ * @param retractCommitment - The order commitment of the bid to retract (bytes32)
7830
+ * @param bidCommitment - The order commitment of the new bid (bytes32)
7831
+ * @param userOp - The encoded PackedUserOperation as hex string
7832
+ * @returns BidSubmissionResult with success status and block/extrinsic hash
7833
+ */
7834
+ async submitBidWithRetraction(retractCommitment, bidCommitment, userOp) {
7835
+ try {
7836
+ const batch = this.api.tx.utility.batch([
7837
+ this.api.tx.intentsCoprocessor.retractBid(retractCommitment),
7838
+ this.api.tx.intentsCoprocessor.placeBid(bidCommitment, userOp)
7839
+ ]);
7840
+ return await this.signAndSendExtrinsic(batch);
7841
+ } catch (error) {
7842
+ return {
7843
+ success: false,
7844
+ error: error instanceof Error ? error.message : "Unknown error"
7845
+ };
7846
+ }
7847
+ }
7780
7848
  /**
7781
7849
  * Fetches all bid storage entries for a given order commitment.
7782
7850
  * Returns the on-chain data only (filler addresses and deposits).
@@ -7861,6 +7929,80 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
7861
7929
  buildOffchainBidKey(commitment, filler) {
7862
7930
  return u8aConcat(OFFCHAIN_BID_PREFIX, hexToU8a(commitment), decodeAddress(filler));
7863
7931
  }
7932
+ /**
7933
+ * Fetches the ABI-encoded phantom order from offchain storage and decodes it
7934
+ * into an `Order` object. The pallet writes the order bytes under the key
7935
+ * `intents::phantom::order::<commitment>` when it calls `on_initialize`.
7936
+ *
7937
+ * Returns `null` if the key is absent (e.g. the node is not an offchain worker
7938
+ * or the commitment has expired and been cleared).
7939
+ */
7940
+ async fetchPhantomOrder(commitment) {
7941
+ const key = u8aConcat(OFFCHAIN_PHANTOM_PREFIX, hexToU8a(commitment));
7942
+ const result = await this.api.rpc.offchain.localStorageGet("PERSISTENT", u8aToHex(key));
7943
+ if (!result || result.isNone) return null;
7944
+ const rawHex = result.unwrap().toHex();
7945
+ if (rawHex === "0x" || rawHex === "0x00") return null;
7946
+ const placeOrderAbi = IntentGatewayV2_default.ABI.find(
7947
+ (item) => item.type === "function" && item.name === "placeOrder"
7948
+ );
7949
+ const orderType = placeOrderAbi?.inputs?.[0];
7950
+ if (!orderType) return null;
7951
+ const [decoded] = decodeAbiParameters([orderType], rawHex);
7952
+ const d = decoded;
7953
+ const textDecoder = new TextDecoder();
7954
+ return {
7955
+ id: commitment,
7956
+ user: d.user,
7957
+ source: textDecoder.decode(hexToBytes(d.source)),
7958
+ destination: textDecoder.decode(hexToBytes(d.destination)),
7959
+ deadline: d.deadline,
7960
+ nonce: d.nonce,
7961
+ fees: d.fees,
7962
+ session: d.session,
7963
+ predispatch: {
7964
+ assets: d.predispatch.assets.map((a) => ({
7965
+ token: a.token,
7966
+ amount: a.amount
7967
+ })),
7968
+ call: d.predispatch.call
7969
+ },
7970
+ inputs: d.inputs.map((i) => ({
7971
+ token: i.token,
7972
+ amount: i.amount
7973
+ })),
7974
+ output: {
7975
+ beneficiary: d.output.beneficiary,
7976
+ assets: d.output.assets.map((a) => ({
7977
+ token: a.token,
7978
+ amount: a.amount
7979
+ })),
7980
+ call: d.output.call
7981
+ }
7982
+ };
7983
+ }
7984
+ /**
7985
+ * Subscribes to PhantomOrderRegistered events from the intents coprocessor pallet.
7986
+ * Calls the callback for each new phantom order as blocks arrive.
7987
+ * Returns an unsubscribe function to stop the subscription.
7988
+ */
7989
+ async subscribePhantomOrders(callback) {
7990
+ const unsub = await this.api.query.system.events((records) => {
7991
+ for (const { event } of records) {
7992
+ if (event.section !== "intentsCoprocessor" || event.method !== "PhantomOrderRegistered") continue;
7993
+ const [commitment, chain, createdAt, tokenA, tokenB, standardAmount] = event.data;
7994
+ callback({
7995
+ commitment: commitment.toHex(),
7996
+ chain: new TextDecoder().decode(hexToU8a(chain.toHex())),
7997
+ createdAt: createdAt.toNumber(),
7998
+ tokenA: tokenA.toHex(),
7999
+ tokenB: tokenB.toHex(),
8000
+ standardAmount: BigInt(standardAmount.toString())
8001
+ });
8002
+ }
8003
+ });
8004
+ return unsub;
8005
+ }
7864
8006
  };
7865
8007
  var TronChain = class _TronChain {
7866
8008
  constructor(params, evm) {
@@ -14603,16 +14745,6 @@ var CryptoUtils = class _CryptoUtils {
14603
14745
  }
14604
14746
  }
14605
14747
  };
14606
- var FEE_TOKEN_CACHE_TTL_MS = 5 * 60 * 1e3;
14607
- async function getFeeToken(ctx, chainId, chain) {
14608
- const cached = ctx.feeTokenCache.get(chainId);
14609
- if (cached && Date.now() - cached.cachedAt < FEE_TOKEN_CACHE_TTL_MS) {
14610
- return cached;
14611
- }
14612
- const fresh = await chain.getFeeTokenWithDecimals();
14613
- ctx.feeTokenCache.set(chainId, { ...fresh, cachedAt: Date.now() });
14614
- return fresh;
14615
- }
14616
14748
  function encodeERC7821ExecuteBatch(calls) {
14617
14749
  const executionData = encodeAbiParameters(
14618
14750
  [{ type: "tuple[]", components: erc7281_default.ABI[1].components }],
@@ -14624,6 +14756,36 @@ function encodeERC7821ExecuteBatch(calls) {
14624
14756
  args: [ERC7821_BATCH_MODE, executionData]
14625
14757
  });
14626
14758
  }
14759
+ function decodeERC7821ExecuteBatch(callData) {
14760
+ try {
14761
+ const decoded = decodeFunctionData({ abi: erc7281_default.ABI, data: callData });
14762
+ if (decoded.functionName !== "execute" || !decoded.args || decoded.args.length < 2) return null;
14763
+ const executionData = decoded.args[1];
14764
+ const [calls] = decodeAbiParameters(
14765
+ [{ type: "tuple[]", components: erc7281_default.ABI[1].components }],
14766
+ executionData
14767
+ );
14768
+ return calls.map((call) => ({
14769
+ target: call.target,
14770
+ value: call.value,
14771
+ data: call.data
14772
+ }));
14773
+ } catch {
14774
+ return null;
14775
+ }
14776
+ }
14777
+
14778
+ // src/protocols/intents/utils.ts
14779
+ var FEE_TOKEN_CACHE_TTL_MS = 5 * 60 * 1e3;
14780
+ async function getFeeToken(ctx, chainId, chain) {
14781
+ const cached = ctx.feeTokenCache.get(chainId);
14782
+ if (cached && Date.now() - cached.cachedAt < FEE_TOKEN_CACHE_TTL_MS) {
14783
+ return cached;
14784
+ }
14785
+ const fresh = await chain.getFeeTokenWithDecimals();
14786
+ ctx.feeTokenCache.set(chainId, { ...fresh, cachedAt: Date.now() });
14787
+ return fresh;
14788
+ }
14627
14789
  async function fetchSourceProof(commitment, source, sourceStateMachine, sourceConsensusStateId, sourceHeight) {
14628
14790
  const { slot1, slot2 } = requestCommitmentKey(commitment);
14629
14791
  const proofHex = await source.queryStateProof(sourceHeight, [slot1, slot2]);
@@ -18503,6 +18665,11 @@ var HyperFungibleTokenABI = [
18503
18665
  name: "context",
18504
18666
  type: "bytes",
18505
18667
  internalType: "bytes"
18668
+ },
18669
+ {
18670
+ name: "payer",
18671
+ type: "address",
18672
+ internalType: "address"
18506
18673
  }
18507
18674
  ]
18508
18675
  }
@@ -19624,6 +19791,11 @@ var WrappedHyperFungibleTokenABI = [
19624
19791
  name: "context",
19625
19792
  type: "bytes",
19626
19793
  internalType: "bytes"
19794
+ },
19795
+ {
19796
+ name: "payer",
19797
+ type: "address",
19798
+ internalType: "address"
19627
19799
  }
19628
19800
  ]
19629
19801
  }
@@ -21461,6 +21633,11 @@ var ABI8 = [
21461
21633
  internalType: "bytes",
21462
21634
  name: "context",
21463
21635
  type: "bytes"
21636
+ },
21637
+ {
21638
+ internalType: "address",
21639
+ name: "payer",
21640
+ type: "address"
21464
21641
  }
21465
21642
  ],
21466
21643
  internalType: "struct DispatchGet",
@@ -21729,6 +21906,11 @@ var ABI8 = [
21729
21906
  internalType: "bytes",
21730
21907
  name: "context",
21731
21908
  type: "bytes"
21909
+ },
21910
+ {
21911
+ internalType: "address",
21912
+ name: "payer",
21913
+ type: "address"
21732
21914
  }
21733
21915
  ],
21734
21916
  internalType: "struct DispatchGet",
@@ -22091,6 +22273,6 @@ async function teleportDot(param_) {
22091
22273
  return stream;
22092
22274
  }
22093
22275
 
22094
- export { ADDRESS_ZERO2 as ADDRESS_ZERO, BundlerMethod, ChainConfigService, Chains, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, ABI as EvmHostABI, EvmLanguage, HyperClientStatus, HyperFungibleToken, HyperFungibleTokenABI, IntentGateway, ABI3 as IntentGatewayABI, IntentOrderStatus, IntentsCoprocessor, IsmpClient, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, OrderStatusChecker, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, PharosChain, PolkadotHubChain, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, SubstrateChain, Swap, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, TokenGateway, TronChain, USE_ETHERSCAN_CHAINS, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, WrappedHyperFungibleTokenABI, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
22276
+ export { ADDRESS_ZERO2 as ADDRESS_ZERO, BundlerMethod, ChainConfigService, Chains, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, ABI as EvmHostABI, EvmLanguage, HyperClientStatus, HyperFungibleToken, HyperFungibleTokenABI, IntentGateway, ABI3 as IntentGatewayABI, IntentOrderStatus, IntentsCoprocessor, IsmpClient, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, OrderStatusChecker, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, PharosChain, PolkadotHubChain, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, SubstrateChain, Swap, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, TokenGateway, TronChain, USE_ETHERSCAN_CHAINS, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, WrappedHyperFungibleTokenABI, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeERC7821ExecuteBatch, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
22095
22277
  //# sourceMappingURL=index.js.map
22096
22278
  //# sourceMappingURL=index.js.map