@hyperbridge/sdk 1.6.3 → 1.6.4

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.
@@ -1069,6 +1069,8 @@ declare class ChainConfigService {
1069
1069
  getUsdtDecimals(chain: string): number;
1070
1070
  getCNgnAsset(chain: string): HexString | undefined;
1071
1071
  getCNgnDecimals(chain: string): number | undefined;
1072
+ getExtAsset(chain: string): HexString | undefined;
1073
+ getExtDecimals(chain: string): number | undefined;
1072
1074
  getChainId(chain: string): number;
1073
1075
  getConsensusStateId(chain: string): HexString;
1074
1076
  getHyperbridgeChainId(): number;
@@ -2329,12 +2331,6 @@ declare enum RequestKind {
2329
2331
  * Configuration for the IntentFiller
2330
2332
  */
2331
2333
  interface FillerConfig {
2332
- /**
2333
- * Policy for determining confirmation requirements
2334
- */
2335
- confirmationPolicy: {
2336
- getConfirmationBlocks: (chainId: number, amountUsd: number) => number;
2337
- };
2338
2334
  /**
2339
2335
  * Maximum number of orders to process concurrently
2340
2336
  */
@@ -3878,6 +3874,7 @@ declare const BundlerMethod: {
3878
3874
  readonly ETH_SEND_USER_OPERATION: "eth_sendUserOperation";
3879
3875
  readonly ETH_GET_USER_OPERATION_RECEIPT: "eth_getUserOperationReceipt";
3880
3876
  readonly ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas";
3877
+ readonly PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice";
3881
3878
  };
3882
3879
  type BundlerMethod = (typeof BundlerMethod)[keyof typeof BundlerMethod];
3883
3880
  /** Response from bundler's eth_estimateUserOperationGas */
@@ -3951,7 +3948,6 @@ declare class IntentsV2 {
3951
3948
  private readonly orderPlacer;
3952
3949
  private readonly orderExecutor;
3953
3950
  private readonly orderCanceller;
3954
- private readonly orderStatusChecker;
3955
3951
  private readonly bidManager;
3956
3952
  private readonly gasEstimator;
3957
3953
  private constructor();
@@ -3974,6 +3970,7 @@ declare class IntentsV2 {
3974
3970
  pollIntervalMs?: number;
3975
3971
  }): AsyncGenerator<{
3976
3972
  calldata: HexString;
3973
+ feesInWei?: bigint;
3977
3974
  sessionPrivateKey: HexString;
3978
3975
  } | IntentOrderStatusUpdate, void, HexString>;
3979
3976
  placeOrder(order: OrderV2, graffiti?: HexString): AsyncGenerator<{
@@ -3988,35 +3985,6 @@ declare class IntentsV2 {
3988
3985
  estimateFillOrderV2(params: EstimateFillOrderV2Params): Promise<FillOrderEstimateV2>;
3989
3986
  encodeERC7821Execute(calls: ERC7821Call[]): HexString;
3990
3987
  decodeERC7821Execute(callData: HexString): ERC7821Call[] | null;
3991
- isOrderFilled(order: OrderV2): Promise<boolean>;
3992
- isOrderRefunded(order: OrderV2): Promise<boolean>;
3993
- }
3994
-
3995
- declare class OrderStatusChecker {
3996
- private readonly ctx;
3997
- constructor(ctx: IntentsV2Context);
3998
- /**
3999
- * Checks if a V2 order has been filled by reading the commitment storage slot on the destination chain.
4000
- *
4001
- * Reads the storage slot returned by `calculateCommitmentSlotHash` on the IntentGatewayV2 contract.
4002
- * A non-zero value at that slot means the solver has called `fillOrder` and the order is complete
4003
- * from the user's perspective (the beneficiary has received their tokens).
4004
- *
4005
- * @param order - The V2 order to check. `order.id` is used as the commitment; if not set it is computed.
4006
- * @returns True if the order has been filled on the destination chain, false otherwise.
4007
- */
4008
- isOrderFilled(order: OrderV2): Promise<boolean>;
4009
- /**
4010
- * Checks if a V2 order has been refunded by reading the `_orders` mapping on the source chain.
4011
- *
4012
- * Calls `_orders(commitment, tokenAddress)` for each input token. When the order is placed the
4013
- * escrowed amounts are stored there. After a successful refund the contract zeroes them out.
4014
- * An order is considered refunded when all escrowed input amounts have been returned (i.e. are 0).
4015
- *
4016
- * @param order - The V2 order to check. `order.id` is used as the commitment; if not set it is computed.
4017
- * @returns True if all escrowed inputs have been returned to the user on the source chain, false otherwise.
4018
- */
4019
- isOrderRefunded(order: OrderV2): Promise<boolean>;
4020
3988
  }
4021
3989
 
4022
3990
  /**
@@ -4433,11 +4401,13 @@ interface ChainConfigData {
4433
4401
  USDC: string;
4434
4402
  USDT: string;
4435
4403
  cNGN?: string;
4404
+ EXT?: string;
4436
4405
  };
4437
4406
  tokenDecimals?: {
4438
4407
  USDC: number;
4439
4408
  USDT: number;
4440
4409
  cNGN?: number;
4410
+ EXT?: number;
4441
4411
  };
4442
4412
  tokenStorageSlots?: {
4443
4413
  USDT?: {
@@ -4491,4 +4461,4 @@ declare const getChainId: (stateMachineId: string) => number | undefined;
4491
4461
  declare const getViemChain: (chainId: number) => Chain | undefined;
4492
4462
  declare const hyperbridgeAddress = "";
4493
4463
 
4494
- export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type CancelEvent, type CancelEventMap, type CancelOptions, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedOrderV2PlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchInfoV2, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type EstimateFillOrderV2Params, type EstimateGasCallData, EvmChain, type EvmChainParams, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOptionsV2, type FillOrderEstimateV2, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IChain, type IConfig, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayParams, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusMetadata, type IntentOrderStatusUpdate, IntentsCoprocessor, IntentsV2, type IntentsV2Context, type IsmpRequest, MOCK_ADDRESS, type NewDeployment, ORDER_V2_PARAM_TYPE, type Order, type OrderResponse, OrderStatus, OrderStatusChecker, type OrderStatusMetadata, type OrderV2, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, type PaymentInfoV2, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QuoteNativeResult, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, type RequestBody, type RequestCommitment, RequestKind, type RequestResponse, RequestStatus, type RequestStatusKey, type RequestStatusWithMetadata, type ResponseCommitmentWithValues, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, type SubmitBidOptions, SubstrateChain, Swap, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenInfoV2, type TokenPrice, type TokenPricesResponse, type TokenRegistry, type TokenRegistryResponse, type Transaction, TronChain, type TronChainParams, USE_ETHERSCAN_CHAINS, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createChain, createEvmChain, createIndexerClient, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChain, getChainId, getConfigByStateMachineId, getContractCallInput, getEvmChain, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getSubstrateChain, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, orderV2Commitment, parseStateMachineId, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
4464
+ export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type CancelEvent, type CancelEventMap, type CancelOptions, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedOrderV2PlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchInfoV2, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type EstimateFillOrderV2Params, type EstimateGasCallData, EvmChain, type EvmChainParams, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOptionsV2, type FillOrderEstimateV2, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IChain, type IConfig, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayParams, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusMetadata, type IntentOrderStatusUpdate, IntentsCoprocessor, IntentsV2, type IntentsV2Context, type IsmpRequest, MOCK_ADDRESS, type NewDeployment, ORDER_V2_PARAM_TYPE, type Order, type OrderResponse, OrderStatus, type OrderStatusMetadata, type OrderV2, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, type PaymentInfoV2, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QuoteNativeResult, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, type RequestBody, type RequestCommitment, RequestKind, type RequestResponse, RequestStatus, type RequestStatusKey, type RequestStatusWithMetadata, type ResponseCommitmentWithValues, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, type SubmitBidOptions, SubstrateChain, Swap, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenInfoV2, type TokenPrice, type TokenPricesResponse, type TokenRegistry, type TokenRegistryResponse, type Transaction, TronChain, type TronChainParams, USE_ETHERSCAN_CHAINS, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createChain, createEvmChain, createIndexerClient, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChain, getChainId, getConfigByStateMachineId, getContractCallInput, getEvmChain, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getSubstrateChain, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, orderV2Commitment, parseStateMachineId, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
@@ -1,6 +1,6 @@
1
1
  import { createConsola, LogLevels } from 'consola';
2
2
  import { flatten, zip, capitalize, maxBy, isNil } from 'lodash-es';
3
- import { defineChain, keccak256, toHex, hexToBytes, encodePacked, encodeAbiParameters, bytesToHex, createPublicClient, http, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, numberToBytes, maxUint256, parseAbiParameters, parseAbiItem, formatUnits, parseUnits, concatHex, hexToString as hexToString$1, parseEventLogs, isHex, concat, decodeFunctionData, decodeAbiParameters } from 'viem';
3
+ import { defineChain, keccak256, toHex, hexToBytes, encodePacked, encodeAbiParameters, bytesToHex, createPublicClient, http, encodeFunctionData, erc20Abi, bytesToBigInt, pad, toBytes, numberToBytes, maxUint256, parseAbiParameters, parseAbiItem, formatUnits, parseUnits, concatHex, hexToString as hexToString$1, parseEventLogs, concat, decodeFunctionData, decodeAbiParameters, isHex } from 'viem';
4
4
  import mergeRace from '@async-generator/merge-race';
5
5
  import { polygonAmoy, unichain, polygon, base, arbitrum, bsc, mainnet, sepolia, gnosisChiado, bscTestnet, tron, gnosis, soneium, baseSepolia, optimismSepolia, optimism, arbitrumSepolia } from 'viem/chains';
6
6
  import { TronWeb } from 'tronweb';
@@ -439,13 +439,11 @@ var chainConfigs = {
439
439
  WETH: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
440
440
  DAI: "0x6b175474e89094c44da98b954eedeac495271d0f",
441
441
  USDC: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
442
- USDT: "0xdac17f958d2ee523a2206206994597c13d831ec7",
443
- cNGN: "0x17CDB2a01e7a34CbB3DD4b83260B05d0274C8dab"
442
+ USDT: "0xdac17f958d2ee523a2206206994597c13d831ec7"
444
443
  },
445
444
  tokenDecimals: {
446
445
  USDC: 6,
447
- USDT: 6,
448
- cNGN: 6
446
+ USDT: 6
449
447
  },
450
448
  tokenStorageSlots: {
451
449
  USDT: { balanceSlot: 2, allowanceSlot: 5 },
@@ -491,11 +489,13 @@ var chainConfigs = {
491
489
  WETH: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
492
490
  DAI: "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3",
493
491
  USDC: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
494
- USDT: "0x55d398326f99059ff775485246999027b3197955"
492
+ USDT: "0x55d398326f99059ff775485246999027b3197955",
493
+ EXT: "0x7C8c11ADb8EF7cd3CFa718008Ea048445C6E7209"
495
494
  },
496
495
  tokenDecimals: {
497
496
  USDC: 18,
498
- USDT: 18
497
+ USDT: 18,
498
+ EXT: 18
499
499
  },
500
500
  tokenStorageSlots: {
501
501
  USDT: { balanceSlot: 1, allowanceSlot: 2 },
@@ -543,11 +543,13 @@ var chainConfigs = {
543
543
  WETH: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
544
544
  DAI: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",
545
545
  USDC: "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
546
- USDT: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
546
+ USDT: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
547
+ EXT: "0x0e668E5127087e236578893a0e01E41837A28469"
547
548
  },
548
549
  tokenDecimals: {
549
550
  USDC: 6,
550
- USDT: 6
551
+ USDT: 6,
552
+ EXT: 18
551
553
  },
552
554
  tokenStorageSlots: {
553
555
  USDT: { balanceSlot: 51, allowanceSlot: 52 },
@@ -594,12 +596,12 @@ var chainConfigs = {
594
596
  DAI: "0x50c5725949a6f0c72e6c4a641f24049a917db0cb",
595
597
  USDC: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
596
598
  USDT: "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2",
597
- cNGN: "0x46C85152bFe9f96829aA94755D9f915F9B10EF5F"
599
+ EXT: "0x0e668E5127087e236578893a0e01E41837A28469"
598
600
  },
599
601
  tokenDecimals: {
600
602
  USDC: 6,
601
603
  USDT: 6,
602
- cNGN: 6
604
+ EXT: 18
603
605
  },
604
606
  tokenStorageSlots: {
605
607
  USDT: { balanceSlot: 0, allowanceSlot: 1 },
@@ -646,12 +648,12 @@ var chainConfigs = {
646
648
  DAI: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",
647
649
  USDC: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
648
650
  USDT: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
649
- cNGN: "0x52828daa48C1a9A06F37500882b42daf0bE04C3B"
651
+ EXT: "0x7C8c11ADb8EF7cd3CFa718008Ea048445C6E7209"
650
652
  },
651
653
  tokenDecimals: {
652
654
  USDC: 6,
653
655
  USDT: 6,
654
- cNGN: 6
656
+ EXT: 18
655
657
  },
656
658
  tokenStorageSlots: {
657
659
  USDT: { balanceSlot: 0, allowanceSlot: 1 },
@@ -3886,6 +3888,12 @@ var ChainConfigService = class {
3886
3888
  getCNgnDecimals(chain) {
3887
3889
  return this.getConfig(chain)?.tokenDecimals?.cNGN;
3888
3890
  }
3891
+ getExtAsset(chain) {
3892
+ return this.getConfig(chain)?.assets?.EXT;
3893
+ }
3894
+ getExtDecimals(chain) {
3895
+ return this.getConfig(chain)?.tokenDecimals?.EXT;
3896
+ }
3889
3897
  getChainId(chain) {
3890
3898
  return this.getConfig(chain)?.chainId ?? 0;
3891
3899
  }
@@ -8383,6 +8391,7 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
8383
8391
  provider: new WsProvider(wsUrl),
8384
8392
  typesBundle: {
8385
8393
  spec: {
8394
+ nexus: { hasher: keccakAsU8a },
8386
8395
  gargantua: { hasher: keccakAsU8a }
8387
8396
  }
8388
8397
  }
@@ -8432,7 +8441,8 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
8432
8441
  if (this.substratePrivateKey.includes(" ")) {
8433
8442
  return keyring.addFromMnemonic(this.substratePrivateKey);
8434
8443
  }
8435
- const seedBytes = Buffer.from(this.substratePrivateKey, "hex");
8444
+ const hex = this.substratePrivateKey.startsWith("0x") ? this.substratePrivateKey.slice(2) : this.substratePrivateKey;
8445
+ const seedBytes = Buffer.from(hex, "hex");
8436
8446
  return keyring.addFromSeed(seedBytes);
8437
8447
  }
8438
8448
  /**
@@ -15148,7 +15158,8 @@ var ERC7821_BATCH_MODE = "0x0100000000000000000000000000000000000000000000000000
15148
15158
  var BundlerMethod = {
15149
15159
  ETH_SEND_USER_OPERATION: "eth_sendUserOperation",
15150
15160
  ETH_GET_USER_OPERATION_RECEIPT: "eth_getUserOperationReceipt",
15151
- ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas"
15161
+ ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas",
15162
+ PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice"
15152
15163
  };
15153
15164
 
15154
15165
  // src/protocols/intentsV2/CryptoUtils.ts
@@ -15988,7 +15999,7 @@ var BidManager = class {
15988
15999
  signature
15989
16000
  };
15990
16001
  try {
15991
- await this.simulate(order, selectOptions, bidWithOptions.options, solverAddress2, intentGatewayV2Address);
16002
+ await this.simulate(bidWithOptions.bid, selectOptions, intentGatewayV2Address);
15992
16003
  selectedBid = bidWithOptions;
15993
16004
  sessionSignature = signature;
15994
16005
  break;
@@ -16125,37 +16136,24 @@ var BidManager = class {
16125
16136
  }
16126
16137
  return null;
16127
16138
  }
16128
- async simulate(order, selectOptions, fillOptions, solverAddress, intentGatewayV2Address) {
16129
- const nativeOutputValue = order.output.assets.filter((asset) => bytes32ToBytes20(asset.token) === ADDRESS_ZERO).reduce((sum, asset) => sum + asset.amount, 0n);
16130
- const totalNativeValue = nativeOutputValue + fillOptions.nativeDispatchFee;
16139
+ async simulate(bid, selectOptions, intentGatewayV2Address) {
16140
+ const solverAddress = bid.userOp.sender;
16131
16141
  const selectCalldata = encodeFunctionData({
16132
16142
  abi: ABI3,
16133
16143
  functionName: "select",
16134
16144
  args: [selectOptions]
16135
16145
  });
16136
- const fillOrderCalldata = encodeFunctionData({
16137
- abi: ABI3,
16138
- functionName: "fillOrder",
16139
- args: [transformOrderForContract(order), fillOptions]
16140
- });
16141
- const batchedCalldata = this.crypto.encodeERC7821Execute([
16142
- {
16143
- target: intentGatewayV2Address,
16144
- value: 0n,
16145
- data: selectCalldata
16146
- },
16147
- {
16148
- target: intentGatewayV2Address,
16149
- value: totalNativeValue,
16150
- data: fillOrderCalldata
16151
- }
16152
- ]);
16146
+ const calls = [
16147
+ { target: intentGatewayV2Address, value: 0n, data: selectCalldata },
16148
+ { target: solverAddress, value: 0n, data: bid.userOp.callData }
16149
+ ];
16150
+ const batchedCalldata = this.crypto.encodeERC7821Execute(calls);
16153
16151
  try {
16154
16152
  await this.ctx.dest.client.call({
16155
16153
  account: solverAddress,
16156
16154
  to: solverAddress,
16157
16155
  data: batchedCalldata,
16158
- value: totalNativeValue
16156
+ value: 0n
16159
16157
  });
16160
16158
  } catch (e) {
16161
16159
  throw new Error(`Simulation failed: ${e instanceof Error ? e.message : String(e)}`);
@@ -16361,11 +16359,13 @@ var GasEstimator = class {
16361
16359
  const { order } = params;
16362
16360
  const solverPrivateKey = generatePrivateKey();
16363
16361
  const solverAccountAddress = privateKeyToAddress(solverPrivateKey);
16364
- const souceStateMachineId = isHex(order.source) ? hexToString$1(order.source) : order.source;
16362
+ const sourceStateMachineId = isHex(order.source) ? hexToString$1(order.source) : order.source;
16365
16363
  const destStateMachineId = isHex(order.destination) ? hexToString$1(order.destination) : order.destination;
16366
16364
  const intentGatewayV2Address = this.ctx.dest.configService.getIntentGatewayV2Address(destStateMachineId);
16367
16365
  const entryPointAddress = this.ctx.dest.configService.getEntryPointV08Address(destStateMachineId);
16368
- const chainId = BigInt(Number.parseInt(destStateMachineId.split("-")[1]));
16366
+ const chainId = BigInt(
16367
+ this.ctx.dest.client.chain?.id ?? Number.parseInt(this.ctx.dest.config.stateMachineId.split("-")[1])
16368
+ );
16369
16369
  const totalEthValue = order.output.assets.filter((output) => bytes32ToBytes20(output.token) === ADDRESS_ZERO).reduce((sum, output) => sum + output.amount, 0n);
16370
16370
  const sourceFeeToken = await getFeeToken(this.ctx, this.ctx.source.config.stateMachineId, this.ctx.source);
16371
16371
  const destFeeToken = await getFeeToken(this.ctx, this.ctx.dest.config.stateMachineId, this.ctx.dest);
@@ -16382,7 +16382,7 @@ var GasEstimator = class {
16382
16382
  intentGatewayV2Address,
16383
16383
  entryPointAddress
16384
16384
  });
16385
- const isSameChain = souceStateMachineId === destStateMachineId;
16385
+ const isSameChain = order.source === destStateMachineId;
16386
16386
  let postRequestFeeInDestFeeToken = 0n;
16387
16387
  let protocolFeeInNativeToken = 0n;
16388
16388
  if (!isSameChain) {
@@ -16391,7 +16391,7 @@ var GasEstimator = class {
16391
16391
  this.ctx,
16392
16392
  postRequestGas,
16393
16393
  "source",
16394
- souceStateMachineId
16394
+ sourceStateMachineId
16395
16395
  );
16396
16396
  postRequestFeeInDestFeeToken = adjustDecimals(
16397
16397
  postRequestFeeInSourceFeeToken,
@@ -16400,12 +16400,12 @@ var GasEstimator = class {
16400
16400
  );
16401
16401
  const postRequest = {
16402
16402
  source: destStateMachineId,
16403
- dest: souceStateMachineId,
16403
+ dest: order.source,
16404
16404
  body: constructRedeemEscrowRequestBody({ ...order, id: orderV2Commitment(order) }, MOCK_ADDRESS),
16405
16405
  timeoutTimestamp: 0n,
16406
16406
  nonce: await this.ctx.source.getHostNonce(),
16407
16407
  from: this.ctx.source.configService.getIntentGatewayV2Address(destStateMachineId),
16408
- to: this.ctx.source.configService.getIntentGatewayV2Address(souceStateMachineId)
16408
+ to: this.ctx.source.configService.getIntentGatewayV2Address(sourceStateMachineId)
16409
16409
  };
16410
16410
  protocolFeeInNativeToken = await this.quoteNative(postRequest, postRequestFeeInDestFeeToken).catch(
16411
16411
  () => this.ctx.dest.quoteNative(postRequest, postRequestFeeInDestFeeToken).catch(() => 0n)
@@ -16422,8 +16422,8 @@ var GasEstimator = class {
16422
16422
  const gasPrice = await this.ctx.dest.client.getGasPrice();
16423
16423
  const priorityFeeBumpPercent = params.maxPriorityFeePerGasBumpPercent ?? 8;
16424
16424
  const maxFeeBumpPercent = params.maxFeePerGasBumpPercent ?? 10;
16425
- const maxPriorityFeePerGas = gasPrice + gasPrice * BigInt(priorityFeeBumpPercent) / 100n;
16426
- const maxFeePerGas = gasPrice + gasPrice * BigInt(maxFeeBumpPercent) / 100n;
16425
+ let maxPriorityFeePerGas = gasPrice + gasPrice * BigInt(priorityFeeBumpPercent) / 100n;
16426
+ let maxFeePerGas = gasPrice + gasPrice * BigInt(maxFeeBumpPercent) / 100n;
16427
16427
  const orderForEstimation = { ...order, session: solverAccountAddress };
16428
16428
  const commitment = orderV2Commitment(orderForEstimation);
16429
16429
  const fillOrderCalldata = encodeFunctionData({
@@ -16485,6 +16485,23 @@ var GasEstimator = class {
16485
16485
  callGasLimit = BigInt(gasEstimate.callGasLimit) * 105n / 100n;
16486
16486
  verificationGasLimit = BigInt(gasEstimate.verificationGasLimit) * 105n / 100n;
16487
16487
  preVerificationGas = BigInt(gasEstimate.preVerificationGas) * 105n / 100n;
16488
+ if (this.ctx.bundlerUrl?.toLowerCase().includes("pimlico.io")) {
16489
+ try {
16490
+ const pimlicoGasPrices = await this.crypto.sendBundler(
16491
+ BundlerMethod.PIMLICO_GET_USER_OPERATION_GAS_PRICE,
16492
+ []
16493
+ );
16494
+ const level = pimlicoGasPrices.fast ?? pimlicoGasPrices.standard ?? pimlicoGasPrices.slow ?? null;
16495
+ if (level) {
16496
+ const pimMaxFeePerGas = BigInt(level.maxFeePerGas);
16497
+ const pimMaxPriorityFeePerGas = BigInt(level.maxPriorityFeePerGas);
16498
+ maxFeePerGas = pimMaxFeePerGas;
16499
+ maxPriorityFeePerGas = pimMaxPriorityFeePerGas;
16500
+ }
16501
+ } catch (e) {
16502
+ console.warn("Pimlico gas price fetch failed, using default gas price:", e);
16503
+ }
16504
+ }
16488
16505
  } catch (e) {
16489
16506
  console.warn("Bundler gas estimation failed, using fallback values:", e);
16490
16507
  }
@@ -16639,66 +16656,6 @@ var GasEstimator = class {
16639
16656
  });
16640
16657
  }
16641
16658
  };
16642
- var OrderStatusChecker = class {
16643
- constructor(ctx) {
16644
- this.ctx = ctx;
16645
- }
16646
- /**
16647
- * Checks if a V2 order has been filled by reading the commitment storage slot on the destination chain.
16648
- *
16649
- * Reads the storage slot returned by `calculateCommitmentSlotHash` on the IntentGatewayV2 contract.
16650
- * A non-zero value at that slot means the solver has called `fillOrder` and the order is complete
16651
- * from the user's perspective (the beneficiary has received their tokens).
16652
- *
16653
- * @param order - The V2 order to check. `order.id` is used as the commitment; if not set it is computed.
16654
- * @returns True if the order has been filled on the destination chain, false otherwise.
16655
- */
16656
- async isOrderFilled(order) {
16657
- const commitment = order.id ?? orderV2Commitment(order);
16658
- const destStateMachineId = isHex(order.destination) ? hexToString$1(order.destination) : order.destination;
16659
- const intentGatewayV2Address = this.ctx.dest.configService.getIntentGatewayV2Address(destStateMachineId);
16660
- const filledSlot = await this.ctx.dest.client.readContract({
16661
- abi: ABI3,
16662
- address: intentGatewayV2Address,
16663
- functionName: "calculateCommitmentSlotHash",
16664
- args: [commitment]
16665
- });
16666
- const filledStatus = await this.ctx.dest.client.getStorageAt({
16667
- address: intentGatewayV2Address,
16668
- slot: filledSlot
16669
- });
16670
- return filledStatus !== "0x0000000000000000000000000000000000000000000000000000000000000000";
16671
- }
16672
- /**
16673
- * Checks if a V2 order has been refunded by reading the `_orders` mapping on the source chain.
16674
- *
16675
- * Calls `_orders(commitment, tokenAddress)` for each input token. When the order is placed the
16676
- * escrowed amounts are stored there. After a successful refund the contract zeroes them out.
16677
- * An order is considered refunded when all escrowed input amounts have been returned (i.e. are 0).
16678
- *
16679
- * @param order - The V2 order to check. `order.id` is used as the commitment; if not set it is computed.
16680
- * @returns True if all escrowed inputs have been returned to the user on the source chain, false otherwise.
16681
- */
16682
- async isOrderRefunded(order) {
16683
- if (!order.inputs || order.inputs.length === 0) return false;
16684
- const commitment = order.id ?? orderV2Commitment(order);
16685
- const sourceStateMachineId = isHex(order.source) ? hexToString$1(order.source) : order.source;
16686
- const intentGatewayV2Address = this.ctx.source.configService.getIntentGatewayV2Address(sourceStateMachineId);
16687
- for (const input of order.inputs) {
16688
- const tokenAddress = bytes32ToBytes20(input.token);
16689
- const escrowedAmount = await this.ctx.source.client.readContract({
16690
- abi: ABI3,
16691
- address: intentGatewayV2Address,
16692
- functionName: "_orders",
16693
- args: [commitment, tokenAddress]
16694
- });
16695
- if (escrowedAmount !== 0n) {
16696
- return false;
16697
- }
16698
- }
16699
- return true;
16700
- }
16701
- };
16702
16659
 
16703
16660
  // src/protocols/intentsV2/IntentsV2.ts
16704
16661
  var IntentsV2 = class _IntentsV2 {
@@ -16711,7 +16668,6 @@ var IntentsV2 = class _IntentsV2 {
16711
16668
  orderPlacer;
16712
16669
  orderExecutor;
16713
16670
  orderCanceller;
16714
- orderStatusChecker;
16715
16671
  bidManager;
16716
16672
  gasEstimator;
16717
16673
  constructor(source, dest, intentsCoprocessor, bundlerUrl) {
@@ -16741,7 +16697,6 @@ var IntentsV2 = class _IntentsV2 {
16741
16697
  this.orderPlacer = new OrderPlacer(this.ctx);
16742
16698
  this.orderExecutor = new OrderExecutor(this.ctx, bidManager);
16743
16699
  this.orderCanceller = new OrderCanceller(this.ctx);
16744
- this.orderStatusChecker = new OrderStatusChecker(this.ctx);
16745
16700
  this.bidManager = bidManager;
16746
16701
  this.gasEstimator = gasEstimator;
16747
16702
  this._crypto = crypto;
@@ -16778,13 +16733,15 @@ var IntentsV2 = class _IntentsV2 {
16778
16733
  }
16779
16734
  }
16780
16735
  async *execute(order, graffiti = DEFAULT_GRAFFITI, options) {
16736
+ let feesInWei;
16781
16737
  if (!order.fees || order.fees === 0n) {
16782
16738
  const estimate = await this.gasEstimator.estimateFillOrderV2({
16783
16739
  order,
16784
16740
  maxPriorityFeePerGasBumpPercent: options?.maxPriorityFeePerGasBumpPercent,
16785
16741
  maxFeePerGasBumpPercent: options?.maxFeePerGasBumpPercent
16786
16742
  });
16787
- order.fees = estimate.totalGasInFeeToken;
16743
+ feesInWei = estimate.totalGasCostWei + estimate.totalGasCostWei * 2n / 100n;
16744
+ order.fees = estimate.totalGasInFeeToken + estimate.totalGasInFeeToken * 1n / 100n;
16788
16745
  }
16789
16746
  const placeOrderGen = this.orderPlacer.placeOrder(order, graffiti);
16790
16747
  const placeOrderFirst = await placeOrderGen.next();
@@ -16792,7 +16749,7 @@ var IntentsV2 = class _IntentsV2 {
16792
16749
  throw new Error("placeOrder generator completed without yielding");
16793
16750
  }
16794
16751
  const { calldata, sessionPrivateKey } = placeOrderFirst.value;
16795
- const signedTransaction = yield { calldata, sessionPrivateKey };
16752
+ const signedTransaction = yield { calldata, feesInWei, sessionPrivateKey };
16796
16753
  const placeOrderSecond = await placeOrderGen.next(signedTransaction);
16797
16754
  if (placeOrderSecond.done === false) {
16798
16755
  throw new Error("placeOrder generator yielded unexpectedly after signing");
@@ -16835,12 +16792,6 @@ var IntentsV2 = class _IntentsV2 {
16835
16792
  decodeERC7821Execute(callData) {
16836
16793
  return this._crypto.decodeERC7821Execute(callData);
16837
16794
  }
16838
- async isOrderFilled(order) {
16839
- return this.orderStatusChecker.isOrderFilled(order);
16840
- }
16841
- async isOrderRefunded(order) {
16842
- return this.orderStatusChecker.isOrderRefunded(order);
16843
- }
16844
16795
  };
16845
16796
  var TokenGateway = class {
16846
16797
  source;
@@ -17292,6 +17243,6 @@ async function teleportDot(param_) {
17292
17243
  return stream;
17293
17244
  }
17294
17245
 
17295
- export { ADDRESS_ZERO, BundlerMethod, ChainConfigService, Chains, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, EvmLanguage, HyperClientStatus, IndexerClient, IntentGateway, IntentOrderStatus, IntentsCoprocessor, IntentsV2, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, OrderStatusChecker, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, 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, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createChain, createEvmChain, createIndexerClient, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof2 as fetchSourceProof, generateRootWithProof, getChain, getChainId, getConfigByStateMachineId, getContractCallInput, getEvmChain, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getSubstrateChain, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, orderV2Commitment, parseStateMachineId, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
17246
+ export { ADDRESS_ZERO, BundlerMethod, ChainConfigService, Chains, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, ERC20Method, ERC7821_BATCH_MODE, EvmChain, EvmLanguage, HyperClientStatus, IndexerClient, IntentGateway, IntentOrderStatus, IntentsCoprocessor, IntentsV2, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, OrderStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, 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, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createChain, createEvmChain, createIndexerClient, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof2 as fetchSourceProof, generateRootWithProof, getChain, getChainId, getConfigByStateMachineId, getContractCallInput, getEvmChain, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getSubstrateChain, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, orderV2Commitment, parseStateMachineId, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
17296
17247
  //# sourceMappingURL=index.js.map
17297
17248
  //# sourceMappingURL=index.js.map