@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 };
@@ -3,7 +3,7 @@ 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
5
  import { flatten, zip, capitalize, maxBy, isNil } from 'lodash-es';
6
- 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';
6
+ 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';
7
7
  import mergeRace from '@async-generator/merge-race';
8
8
  import { polygonAmoy, unichain, polygon, base, arbitrum, bsc, mainnet, sepolia, gnosisChiado, bscTestnet, tron, gnosis, soneium, baseSepolia, optimismSepolia, optimism, arbitrumSepolia } from 'viem/chains';
9
9
  import { TronWeb } from 'tronweb';
@@ -389,13 +389,11 @@ var chainConfigs = {
389
389
  WETH: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
390
390
  DAI: "0x6b175474e89094c44da98b954eedeac495271d0f",
391
391
  USDC: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
392
- USDT: "0xdac17f958d2ee523a2206206994597c13d831ec7",
393
- cNGN: "0x17CDB2a01e7a34CbB3DD4b83260B05d0274C8dab"
392
+ USDT: "0xdac17f958d2ee523a2206206994597c13d831ec7"
394
393
  },
395
394
  tokenDecimals: {
396
395
  USDC: 6,
397
- USDT: 6,
398
- cNGN: 6
396
+ USDT: 6
399
397
  },
400
398
  tokenStorageSlots: {
401
399
  USDT: { balanceSlot: 2, allowanceSlot: 5 },
@@ -441,11 +439,13 @@ var chainConfigs = {
441
439
  WETH: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
442
440
  DAI: "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3",
443
441
  USDC: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
444
- USDT: "0x55d398326f99059ff775485246999027b3197955"
442
+ USDT: "0x55d398326f99059ff775485246999027b3197955",
443
+ EXT: "0x7C8c11ADb8EF7cd3CFa718008Ea048445C6E7209"
445
444
  },
446
445
  tokenDecimals: {
447
446
  USDC: 18,
448
- USDT: 18
447
+ USDT: 18,
448
+ EXT: 18
449
449
  },
450
450
  tokenStorageSlots: {
451
451
  USDT: { balanceSlot: 1, allowanceSlot: 2 },
@@ -493,11 +493,13 @@ var chainConfigs = {
493
493
  WETH: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
494
494
  DAI: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",
495
495
  USDC: "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
496
- USDT: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
496
+ USDT: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
497
+ EXT: "0x0e668E5127087e236578893a0e01E41837A28469"
497
498
  },
498
499
  tokenDecimals: {
499
500
  USDC: 6,
500
- USDT: 6
501
+ USDT: 6,
502
+ EXT: 18
501
503
  },
502
504
  tokenStorageSlots: {
503
505
  USDT: { balanceSlot: 51, allowanceSlot: 52 },
@@ -544,12 +546,12 @@ var chainConfigs = {
544
546
  DAI: "0x50c5725949a6f0c72e6c4a641f24049a917db0cb",
545
547
  USDC: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
546
548
  USDT: "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2",
547
- cNGN: "0x46C85152bFe9f96829aA94755D9f915F9B10EF5F"
549
+ EXT: "0x0e668E5127087e236578893a0e01E41837A28469"
548
550
  },
549
551
  tokenDecimals: {
550
552
  USDC: 6,
551
553
  USDT: 6,
552
- cNGN: 6
554
+ EXT: 18
553
555
  },
554
556
  tokenStorageSlots: {
555
557
  USDT: { balanceSlot: 0, allowanceSlot: 1 },
@@ -596,12 +598,12 @@ var chainConfigs = {
596
598
  DAI: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063",
597
599
  USDC: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
598
600
  USDT: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
599
- cNGN: "0x52828daa48C1a9A06F37500882b42daf0bE04C3B"
601
+ EXT: "0x7C8c11ADb8EF7cd3CFa718008Ea048445C6E7209"
600
602
  },
601
603
  tokenDecimals: {
602
604
  USDC: 6,
603
605
  USDT: 6,
604
- cNGN: 6
606
+ EXT: 18
605
607
  },
606
608
  tokenStorageSlots: {
607
609
  USDT: { balanceSlot: 0, allowanceSlot: 1 },
@@ -3836,6 +3838,12 @@ var ChainConfigService = class {
3836
3838
  getCNgnDecimals(chain) {
3837
3839
  return this.getConfig(chain)?.tokenDecimals?.cNGN;
3838
3840
  }
3841
+ getExtAsset(chain) {
3842
+ return this.getConfig(chain)?.assets?.EXT;
3843
+ }
3844
+ getExtDecimals(chain) {
3845
+ return this.getConfig(chain)?.tokenDecimals?.EXT;
3846
+ }
3839
3847
  getChainId(chain) {
3840
3848
  return this.getConfig(chain)?.chainId ?? 0;
3841
3849
  }
@@ -8333,6 +8341,7 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
8333
8341
  provider: new WsProvider(wsUrl),
8334
8342
  typesBundle: {
8335
8343
  spec: {
8344
+ nexus: { hasher: keccakAsU8a },
8336
8345
  gargantua: { hasher: keccakAsU8a }
8337
8346
  }
8338
8347
  }
@@ -8382,7 +8391,8 @@ var IntentsCoprocessor = class _IntentsCoprocessor {
8382
8391
  if (this.substratePrivateKey.includes(" ")) {
8383
8392
  return keyring.addFromMnemonic(this.substratePrivateKey);
8384
8393
  }
8385
- const seedBytes = Buffer.from(this.substratePrivateKey, "hex");
8394
+ const hex = this.substratePrivateKey.startsWith("0x") ? this.substratePrivateKey.slice(2) : this.substratePrivateKey;
8395
+ const seedBytes = Buffer.from(hex, "hex");
8386
8396
  return keyring.addFromSeed(seedBytes);
8387
8397
  }
8388
8398
  /**
@@ -15088,7 +15098,8 @@ var ERC7821_BATCH_MODE = "0x0100000000000000000000000000000000000000000000000000
15088
15098
  var BundlerMethod = {
15089
15099
  ETH_SEND_USER_OPERATION: "eth_sendUserOperation",
15090
15100
  ETH_GET_USER_OPERATION_RECEIPT: "eth_getUserOperationReceipt",
15091
- ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas"
15101
+ ETH_ESTIMATE_USER_OPERATION_GAS: "eth_estimateUserOperationGas",
15102
+ PIMLICO_GET_USER_OPERATION_GAS_PRICE: "pimlico_getUserOperationGasPrice"
15092
15103
  };
15093
15104
 
15094
15105
  // src/protocols/intentsV2/CryptoUtils.ts
@@ -15928,7 +15939,7 @@ var BidManager = class {
15928
15939
  signature
15929
15940
  };
15930
15941
  try {
15931
- await this.simulate(order, selectOptions, bidWithOptions.options, solverAddress2, intentGatewayV2Address);
15942
+ await this.simulate(bidWithOptions.bid, selectOptions, intentGatewayV2Address);
15932
15943
  selectedBid = bidWithOptions;
15933
15944
  sessionSignature = signature;
15934
15945
  break;
@@ -16065,37 +16076,24 @@ var BidManager = class {
16065
16076
  }
16066
16077
  return null;
16067
16078
  }
16068
- async simulate(order, selectOptions, fillOptions, solverAddress, intentGatewayV2Address) {
16069
- const nativeOutputValue = order.output.assets.filter((asset) => bytes32ToBytes20(asset.token) === ADDRESS_ZERO).reduce((sum, asset) => sum + asset.amount, 0n);
16070
- const totalNativeValue = nativeOutputValue + fillOptions.nativeDispatchFee;
16079
+ async simulate(bid, selectOptions, intentGatewayV2Address) {
16080
+ const solverAddress = bid.userOp.sender;
16071
16081
  const selectCalldata = encodeFunctionData({
16072
16082
  abi: ABI3,
16073
16083
  functionName: "select",
16074
16084
  args: [selectOptions]
16075
16085
  });
16076
- const fillOrderCalldata = encodeFunctionData({
16077
- abi: ABI3,
16078
- functionName: "fillOrder",
16079
- args: [transformOrderForContract(order), fillOptions]
16080
- });
16081
- const batchedCalldata = this.crypto.encodeERC7821Execute([
16082
- {
16083
- target: intentGatewayV2Address,
16084
- value: 0n,
16085
- data: selectCalldata
16086
- },
16087
- {
16088
- target: intentGatewayV2Address,
16089
- value: totalNativeValue,
16090
- data: fillOrderCalldata
16091
- }
16092
- ]);
16086
+ const calls = [
16087
+ { target: intentGatewayV2Address, value: 0n, data: selectCalldata },
16088
+ { target: solverAddress, value: 0n, data: bid.userOp.callData }
16089
+ ];
16090
+ const batchedCalldata = this.crypto.encodeERC7821Execute(calls);
16093
16091
  try {
16094
16092
  await this.ctx.dest.client.call({
16095
16093
  account: solverAddress,
16096
16094
  to: solverAddress,
16097
16095
  data: batchedCalldata,
16098
- value: totalNativeValue
16096
+ value: 0n
16099
16097
  });
16100
16098
  } catch (e) {
16101
16099
  throw new Error(`Simulation failed: ${e instanceof Error ? e.message : String(e)}`);
@@ -16301,11 +16299,13 @@ var GasEstimator = class {
16301
16299
  const { order } = params;
16302
16300
  const solverPrivateKey = generatePrivateKey();
16303
16301
  const solverAccountAddress = privateKeyToAddress(solverPrivateKey);
16304
- const souceStateMachineId = isHex(order.source) ? hexToString$1(order.source) : order.source;
16302
+ const sourceStateMachineId = isHex(order.source) ? hexToString$1(order.source) : order.source;
16305
16303
  const destStateMachineId = isHex(order.destination) ? hexToString$1(order.destination) : order.destination;
16306
16304
  const intentGatewayV2Address = this.ctx.dest.configService.getIntentGatewayV2Address(destStateMachineId);
16307
16305
  const entryPointAddress = this.ctx.dest.configService.getEntryPointV08Address(destStateMachineId);
16308
- const chainId = BigInt(Number.parseInt(destStateMachineId.split("-")[1]));
16306
+ const chainId = BigInt(
16307
+ this.ctx.dest.client.chain?.id ?? Number.parseInt(this.ctx.dest.config.stateMachineId.split("-")[1])
16308
+ );
16309
16309
  const totalEthValue = order.output.assets.filter((output) => bytes32ToBytes20(output.token) === ADDRESS_ZERO).reduce((sum, output) => sum + output.amount, 0n);
16310
16310
  const sourceFeeToken = await getFeeToken(this.ctx, this.ctx.source.config.stateMachineId, this.ctx.source);
16311
16311
  const destFeeToken = await getFeeToken(this.ctx, this.ctx.dest.config.stateMachineId, this.ctx.dest);
@@ -16322,7 +16322,7 @@ var GasEstimator = class {
16322
16322
  intentGatewayV2Address,
16323
16323
  entryPointAddress
16324
16324
  });
16325
- const isSameChain = souceStateMachineId === destStateMachineId;
16325
+ const isSameChain = order.source === destStateMachineId;
16326
16326
  let postRequestFeeInDestFeeToken = 0n;
16327
16327
  let protocolFeeInNativeToken = 0n;
16328
16328
  if (!isSameChain) {
@@ -16331,7 +16331,7 @@ var GasEstimator = class {
16331
16331
  this.ctx,
16332
16332
  postRequestGas,
16333
16333
  "source",
16334
- souceStateMachineId
16334
+ sourceStateMachineId
16335
16335
  );
16336
16336
  postRequestFeeInDestFeeToken = adjustDecimals(
16337
16337
  postRequestFeeInSourceFeeToken,
@@ -16340,12 +16340,12 @@ var GasEstimator = class {
16340
16340
  );
16341
16341
  const postRequest = {
16342
16342
  source: destStateMachineId,
16343
- dest: souceStateMachineId,
16343
+ dest: order.source,
16344
16344
  body: constructRedeemEscrowRequestBody({ ...order, id: orderV2Commitment(order) }, MOCK_ADDRESS),
16345
16345
  timeoutTimestamp: 0n,
16346
16346
  nonce: await this.ctx.source.getHostNonce(),
16347
16347
  from: this.ctx.source.configService.getIntentGatewayV2Address(destStateMachineId),
16348
- to: this.ctx.source.configService.getIntentGatewayV2Address(souceStateMachineId)
16348
+ to: this.ctx.source.configService.getIntentGatewayV2Address(sourceStateMachineId)
16349
16349
  };
16350
16350
  protocolFeeInNativeToken = await this.quoteNative(postRequest, postRequestFeeInDestFeeToken).catch(
16351
16351
  () => this.ctx.dest.quoteNative(postRequest, postRequestFeeInDestFeeToken).catch(() => 0n)
@@ -16362,8 +16362,8 @@ var GasEstimator = class {
16362
16362
  const gasPrice = await this.ctx.dest.client.getGasPrice();
16363
16363
  const priorityFeeBumpPercent = params.maxPriorityFeePerGasBumpPercent ?? 8;
16364
16364
  const maxFeeBumpPercent = params.maxFeePerGasBumpPercent ?? 10;
16365
- const maxPriorityFeePerGas = gasPrice + gasPrice * BigInt(priorityFeeBumpPercent) / 100n;
16366
- const maxFeePerGas = gasPrice + gasPrice * BigInt(maxFeeBumpPercent) / 100n;
16365
+ let maxPriorityFeePerGas = gasPrice + gasPrice * BigInt(priorityFeeBumpPercent) / 100n;
16366
+ let maxFeePerGas = gasPrice + gasPrice * BigInt(maxFeeBumpPercent) / 100n;
16367
16367
  const orderForEstimation = { ...order, session: solverAccountAddress };
16368
16368
  const commitment = orderV2Commitment(orderForEstimation);
16369
16369
  const fillOrderCalldata = encodeFunctionData({
@@ -16425,6 +16425,23 @@ var GasEstimator = class {
16425
16425
  callGasLimit = BigInt(gasEstimate.callGasLimit) * 105n / 100n;
16426
16426
  verificationGasLimit = BigInt(gasEstimate.verificationGasLimit) * 105n / 100n;
16427
16427
  preVerificationGas = BigInt(gasEstimate.preVerificationGas) * 105n / 100n;
16428
+ if (this.ctx.bundlerUrl?.toLowerCase().includes("pimlico.io")) {
16429
+ try {
16430
+ const pimlicoGasPrices = await this.crypto.sendBundler(
16431
+ BundlerMethod.PIMLICO_GET_USER_OPERATION_GAS_PRICE,
16432
+ []
16433
+ );
16434
+ const level = pimlicoGasPrices.fast ?? pimlicoGasPrices.standard ?? pimlicoGasPrices.slow ?? null;
16435
+ if (level) {
16436
+ const pimMaxFeePerGas = BigInt(level.maxFeePerGas);
16437
+ const pimMaxPriorityFeePerGas = BigInt(level.maxPriorityFeePerGas);
16438
+ maxFeePerGas = pimMaxFeePerGas;
16439
+ maxPriorityFeePerGas = pimMaxPriorityFeePerGas;
16440
+ }
16441
+ } catch (e) {
16442
+ console.warn("Pimlico gas price fetch failed, using default gas price:", e);
16443
+ }
16444
+ }
16428
16445
  } catch (e) {
16429
16446
  console.warn("Bundler gas estimation failed, using fallback values:", e);
16430
16447
  }
@@ -16579,66 +16596,6 @@ var GasEstimator = class {
16579
16596
  });
16580
16597
  }
16581
16598
  };
16582
- var OrderStatusChecker = class {
16583
- constructor(ctx) {
16584
- this.ctx = ctx;
16585
- }
16586
- /**
16587
- * Checks if a V2 order has been filled by reading the commitment storage slot on the destination chain.
16588
- *
16589
- * Reads the storage slot returned by `calculateCommitmentSlotHash` on the IntentGatewayV2 contract.
16590
- * A non-zero value at that slot means the solver has called `fillOrder` and the order is complete
16591
- * from the user's perspective (the beneficiary has received their tokens).
16592
- *
16593
- * @param order - The V2 order to check. `order.id` is used as the commitment; if not set it is computed.
16594
- * @returns True if the order has been filled on the destination chain, false otherwise.
16595
- */
16596
- async isOrderFilled(order) {
16597
- const commitment = order.id ?? orderV2Commitment(order);
16598
- const destStateMachineId = isHex(order.destination) ? hexToString$1(order.destination) : order.destination;
16599
- const intentGatewayV2Address = this.ctx.dest.configService.getIntentGatewayV2Address(destStateMachineId);
16600
- const filledSlot = await this.ctx.dest.client.readContract({
16601
- abi: ABI3,
16602
- address: intentGatewayV2Address,
16603
- functionName: "calculateCommitmentSlotHash",
16604
- args: [commitment]
16605
- });
16606
- const filledStatus = await this.ctx.dest.client.getStorageAt({
16607
- address: intentGatewayV2Address,
16608
- slot: filledSlot
16609
- });
16610
- return filledStatus !== "0x0000000000000000000000000000000000000000000000000000000000000000";
16611
- }
16612
- /**
16613
- * Checks if a V2 order has been refunded by reading the `_orders` mapping on the source chain.
16614
- *
16615
- * Calls `_orders(commitment, tokenAddress)` for each input token. When the order is placed the
16616
- * escrowed amounts are stored there. After a successful refund the contract zeroes them out.
16617
- * An order is considered refunded when all escrowed input amounts have been returned (i.e. are 0).
16618
- *
16619
- * @param order - The V2 order to check. `order.id` is used as the commitment; if not set it is computed.
16620
- * @returns True if all escrowed inputs have been returned to the user on the source chain, false otherwise.
16621
- */
16622
- async isOrderRefunded(order) {
16623
- if (!order.inputs || order.inputs.length === 0) return false;
16624
- const commitment = order.id ?? orderV2Commitment(order);
16625
- const sourceStateMachineId = isHex(order.source) ? hexToString$1(order.source) : order.source;
16626
- const intentGatewayV2Address = this.ctx.source.configService.getIntentGatewayV2Address(sourceStateMachineId);
16627
- for (const input of order.inputs) {
16628
- const tokenAddress = bytes32ToBytes20(input.token);
16629
- const escrowedAmount = await this.ctx.source.client.readContract({
16630
- abi: ABI3,
16631
- address: intentGatewayV2Address,
16632
- functionName: "_orders",
16633
- args: [commitment, tokenAddress]
16634
- });
16635
- if (escrowedAmount !== 0n) {
16636
- return false;
16637
- }
16638
- }
16639
- return true;
16640
- }
16641
- };
16642
16599
 
16643
16600
  // src/protocols/intentsV2/IntentsV2.ts
16644
16601
  var IntentsV2 = class _IntentsV2 {
@@ -16651,7 +16608,6 @@ var IntentsV2 = class _IntentsV2 {
16651
16608
  orderPlacer;
16652
16609
  orderExecutor;
16653
16610
  orderCanceller;
16654
- orderStatusChecker;
16655
16611
  bidManager;
16656
16612
  gasEstimator;
16657
16613
  constructor(source, dest, intentsCoprocessor, bundlerUrl) {
@@ -16681,7 +16637,6 @@ var IntentsV2 = class _IntentsV2 {
16681
16637
  this.orderPlacer = new OrderPlacer(this.ctx);
16682
16638
  this.orderExecutor = new OrderExecutor(this.ctx, bidManager);
16683
16639
  this.orderCanceller = new OrderCanceller(this.ctx);
16684
- this.orderStatusChecker = new OrderStatusChecker(this.ctx);
16685
16640
  this.bidManager = bidManager;
16686
16641
  this.gasEstimator = gasEstimator;
16687
16642
  this._crypto = crypto;
@@ -16718,13 +16673,15 @@ var IntentsV2 = class _IntentsV2 {
16718
16673
  }
16719
16674
  }
16720
16675
  async *execute(order, graffiti = DEFAULT_GRAFFITI, options) {
16676
+ let feesInWei;
16721
16677
  if (!order.fees || order.fees === 0n) {
16722
16678
  const estimate = await this.gasEstimator.estimateFillOrderV2({
16723
16679
  order,
16724
16680
  maxPriorityFeePerGasBumpPercent: options?.maxPriorityFeePerGasBumpPercent,
16725
16681
  maxFeePerGasBumpPercent: options?.maxFeePerGasBumpPercent
16726
16682
  });
16727
- order.fees = estimate.totalGasInFeeToken;
16683
+ feesInWei = estimate.totalGasCostWei + estimate.totalGasCostWei * 2n / 100n;
16684
+ order.fees = estimate.totalGasInFeeToken + estimate.totalGasInFeeToken * 1n / 100n;
16728
16685
  }
16729
16686
  const placeOrderGen = this.orderPlacer.placeOrder(order, graffiti);
16730
16687
  const placeOrderFirst = await placeOrderGen.next();
@@ -16732,7 +16689,7 @@ var IntentsV2 = class _IntentsV2 {
16732
16689
  throw new Error("placeOrder generator completed without yielding");
16733
16690
  }
16734
16691
  const { calldata, sessionPrivateKey } = placeOrderFirst.value;
16735
- const signedTransaction = yield { calldata, sessionPrivateKey };
16692
+ const signedTransaction = yield { calldata, feesInWei, sessionPrivateKey };
16736
16693
  const placeOrderSecond = await placeOrderGen.next(signedTransaction);
16737
16694
  if (placeOrderSecond.done === false) {
16738
16695
  throw new Error("placeOrder generator yielded unexpectedly after signing");
@@ -16775,12 +16732,6 @@ var IntentsV2 = class _IntentsV2 {
16775
16732
  decodeERC7821Execute(callData) {
16776
16733
  return this._crypto.decodeERC7821Execute(callData);
16777
16734
  }
16778
- async isOrderFilled(order) {
16779
- return this.orderStatusChecker.isOrderFilled(order);
16780
- }
16781
- async isOrderRefunded(order) {
16782
- return this.orderStatusChecker.isOrderRefunded(order);
16783
- }
16784
16735
  };
16785
16736
  var TokenGateway = class {
16786
16737
  source;
@@ -17232,6 +17183,6 @@ async function teleportDot(param_) {
17232
17183
  return stream;
17233
17184
  }
17234
17185
 
17235
- 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 };
17186
+ 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 };
17236
17187
  //# sourceMappingURL=index.js.map
17237
17188
  //# sourceMappingURL=index.js.map