@argent/x-shared 1.71.0 → 1.72.1

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.
Files changed (30) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +36 -36
  3. package/dist/simulation.cjs +1 -1
  4. package/dist/simulation.js +54 -48
  5. package/dist/src/features/simulation/activity/utils/index.d.ts +3 -0
  6. package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.cjs +1 -0
  7. package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.d.ts +3 -0
  8. package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.js +24 -0
  9. package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.cjs +1 -0
  10. package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.d.ts +3 -0
  11. package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.js +24 -0
  12. package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.cjs +1 -0
  13. package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.d.ts +3 -0
  14. package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.js +24 -0
  15. package/dist/src/features/simulation/activity/utils/isReplaceMultisigSignersActivity.d.ts +3 -0
  16. package/dist/src/features/simulation/activity/utils/isSwapActivity.cjs +1 -1
  17. package/dist/src/features/simulation/activity/utils/isSwapActivity.d.ts +2 -1
  18. package/dist/src/features/simulation/activity/utils/isSwapActivity.js +15 -17
  19. package/dist/src/features/simulation/activity/utils/isUpgradeActivity.cjs +1 -1
  20. package/dist/src/features/simulation/activity/utils/isUpgradeActivity.d.ts +2 -1
  21. package/dist/src/features/simulation/activity/utils/isUpgradeActivity.js +16 -14
  22. package/dist/src/features/simulation/fees/schema.cjs +1 -1
  23. package/dist/src/features/simulation/fees/schema.d.ts +72 -32
  24. package/dist/src/features/simulation/fees/schema.js +9 -8
  25. package/dist/src/features/simulation/transactionReview/schema.d.ts +62 -48
  26. package/dist/src/transactions/estimate/utils.cjs +1 -1
  27. package/dist/src/transactions/estimate/utils.d.ts +1 -1
  28. package/dist/src/transactions/estimate/utils.js +109 -108
  29. package/dist/src/transactions/service/implementation.d.ts +4 -2
  30. package/package.json +1 -1
@@ -3766,16 +3766,16 @@ export declare const paymasterFeeEstimationSchema: z.ZodObject<{
3766
3766
  type: "ERC20";
3767
3767
  unknown: boolean;
3768
3768
  };
3769
- maxFee: number;
3770
3769
  overallFee: number;
3770
+ maxFee: number;
3771
3771
  }, {
3772
3772
  token: {
3773
3773
  address: string;
3774
3774
  type: "ERC20";
3775
3775
  unknown: boolean;
3776
3776
  };
3777
- maxFee: string | number | bigint;
3778
3777
  overallFee: string | number | bigint;
3778
+ maxFee: string | number | bigint;
3779
3779
  }>;
3780
3780
  export declare const feeEstimationSchema: z.ZodObject<{
3781
3781
  overallFee: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, number, string | number | bigint>;
@@ -4036,16 +4036,16 @@ export declare const feeEstimationNativeOrPaymasterSchema: z.ZodUnion<[z.ZodObje
4036
4036
  type: "ERC20";
4037
4037
  unknown: boolean;
4038
4038
  };
4039
- maxFee: number;
4040
4039
  overallFee: number;
4040
+ maxFee: number;
4041
4041
  }, {
4042
4042
  token: {
4043
4043
  address: string;
4044
4044
  type: "ERC20";
4045
4045
  unknown: boolean;
4046
4046
  };
4047
- maxFee: string | number | bigint;
4048
4047
  overallFee: string | number | bigint;
4048
+ maxFee: string | number | bigint;
4049
4049
  }>]>;
4050
4050
  declare const summarySchema: z.ZodObject<{
4051
4051
  type: z.ZodString;
@@ -4804,16 +4804,16 @@ declare const simulationSchema: z.ZodObject<{
4804
4804
  type: "ERC20";
4805
4805
  unknown: boolean;
4806
4806
  };
4807
- maxFee: number;
4808
4807
  overallFee: number;
4808
+ maxFee: number;
4809
4809
  }, {
4810
4810
  token: {
4811
4811
  address: string;
4812
4812
  type: "ERC20";
4813
4813
  unknown: boolean;
4814
4814
  };
4815
- maxFee: string | number | bigint;
4816
4815
  overallFee: string | number | bigint;
4816
+ maxFee: string | number | bigint;
4817
4817
  }>]>, "many">;
4818
4818
  summary: z.ZodOptional<z.ZodArray<z.ZodObject<{
4819
4819
  type: z.ZodString;
@@ -5051,8 +5051,8 @@ declare const simulationSchema: z.ZodObject<{
5051
5051
  type: "ERC20";
5052
5052
  unknown: boolean;
5053
5053
  };
5054
- maxFee: number;
5055
5054
  overallFee: number;
5055
+ maxFee: number;
5056
5056
  } | {
5057
5057
  token: {
5058
5058
  address: `0x${string}`;
@@ -5205,8 +5205,8 @@ declare const simulationSchema: z.ZodObject<{
5205
5205
  type: "ERC20";
5206
5206
  unknown: boolean;
5207
5207
  };
5208
- maxFee: string | number | bigint;
5209
5208
  overallFee: string | number | bigint;
5209
+ maxFee: string | number | bigint;
5210
5210
  } | {
5211
5211
  token: {
5212
5212
  address: string;
@@ -7418,16 +7418,16 @@ declare const transactionSimulationSchema: z.ZodObject<{
7418
7418
  type: "ERC20";
7419
7419
  unknown: boolean;
7420
7420
  };
7421
- maxFee: number;
7422
7421
  overallFee: number;
7422
+ maxFee: number;
7423
7423
  }, {
7424
7424
  token: {
7425
7425
  address: string;
7426
7426
  type: "ERC20";
7427
7427
  unknown: boolean;
7428
7428
  };
7429
- maxFee: string | number | bigint;
7430
7429
  overallFee: string | number | bigint;
7430
+ maxFee: string | number | bigint;
7431
7431
  }>]>, "many">;
7432
7432
  summary: z.ZodOptional<z.ZodArray<z.ZodObject<{
7433
7433
  type: z.ZodString;
@@ -7665,8 +7665,8 @@ declare const transactionSimulationSchema: z.ZodObject<{
7665
7665
  type: "ERC20";
7666
7666
  unknown: boolean;
7667
7667
  };
7668
- maxFee: number;
7669
7668
  overallFee: number;
7669
+ maxFee: number;
7670
7670
  } | {
7671
7671
  token: {
7672
7672
  address: `0x${string}`;
@@ -7819,8 +7819,8 @@ declare const transactionSimulationSchema: z.ZodObject<{
7819
7819
  type: "ERC20";
7820
7820
  unknown: boolean;
7821
7821
  };
7822
- maxFee: string | number | bigint;
7823
7822
  overallFee: string | number | bigint;
7823
+ maxFee: string | number | bigint;
7824
7824
  } | {
7825
7825
  token: {
7826
7826
  address: string;
@@ -7976,8 +7976,8 @@ declare const transactionSimulationSchema: z.ZodObject<{
7976
7976
  type: "ERC20";
7977
7977
  unknown: boolean;
7978
7978
  };
7979
- maxFee: number;
7980
7979
  overallFee: number;
7980
+ maxFee: number;
7981
7981
  } | {
7982
7982
  token: {
7983
7983
  address: `0x${string}`;
@@ -8309,8 +8309,8 @@ declare const transactionSimulationSchema: z.ZodObject<{
8309
8309
  type: "ERC20";
8310
8310
  unknown: boolean;
8311
8311
  };
8312
- maxFee: string | number | bigint;
8313
8312
  overallFee: string | number | bigint;
8313
+ maxFee: string | number | bigint;
8314
8314
  } | {
8315
8315
  token: {
8316
8316
  address: string;
@@ -12591,16 +12591,16 @@ declare const transactionSchema: z.ZodUnion<[z.ZodObject<{
12591
12591
  type: "ERC20";
12592
12592
  unknown: boolean;
12593
12593
  };
12594
- maxFee: number;
12595
12594
  overallFee: number;
12595
+ maxFee: number;
12596
12596
  }, {
12597
12597
  token: {
12598
12598
  address: string;
12599
12599
  type: "ERC20";
12600
12600
  unknown: boolean;
12601
12601
  };
12602
- maxFee: string | number | bigint;
12603
12602
  overallFee: string | number | bigint;
12603
+ maxFee: string | number | bigint;
12604
12604
  }>]>, "many">;
12605
12605
  summary: z.ZodOptional<z.ZodArray<z.ZodObject<{
12606
12606
  type: z.ZodString;
@@ -12838,8 +12838,8 @@ declare const transactionSchema: z.ZodUnion<[z.ZodObject<{
12838
12838
  type: "ERC20";
12839
12839
  unknown: boolean;
12840
12840
  };
12841
- maxFee: number;
12842
12841
  overallFee: number;
12842
+ maxFee: number;
12843
12843
  } | {
12844
12844
  token: {
12845
12845
  address: `0x${string}`;
@@ -12992,8 +12992,8 @@ declare const transactionSchema: z.ZodUnion<[z.ZodObject<{
12992
12992
  type: "ERC20";
12993
12993
  unknown: boolean;
12994
12994
  };
12995
- maxFee: string | number | bigint;
12996
12995
  overallFee: string | number | bigint;
12996
+ maxFee: string | number | bigint;
12997
12997
  } | {
12998
12998
  token: {
12999
12999
  address: string;
@@ -13149,8 +13149,8 @@ declare const transactionSchema: z.ZodUnion<[z.ZodObject<{
13149
13149
  type: "ERC20";
13150
13150
  unknown: boolean;
13151
13151
  };
13152
- maxFee: number;
13153
13152
  overallFee: number;
13153
+ maxFee: number;
13154
13154
  } | {
13155
13155
  token: {
13156
13156
  address: `0x${string}`;
@@ -13482,8 +13482,8 @@ declare const transactionSchema: z.ZodUnion<[z.ZodObject<{
13482
13482
  type: "ERC20";
13483
13483
  unknown: boolean;
13484
13484
  };
13485
- maxFee: string | number | bigint;
13486
13485
  overallFee: string | number | bigint;
13486
+ maxFee: string | number | bigint;
13487
13487
  } | {
13488
13488
  token: {
13489
13489
  address: string;
@@ -17797,16 +17797,16 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
17797
17797
  type: "ERC20";
17798
17798
  unknown: boolean;
17799
17799
  };
17800
- maxFee: number;
17801
17800
  overallFee: number;
17801
+ maxFee: number;
17802
17802
  }, {
17803
17803
  token: {
17804
17804
  address: string;
17805
17805
  type: "ERC20";
17806
17806
  unknown: boolean;
17807
17807
  };
17808
- maxFee: string | number | bigint;
17809
17808
  overallFee: string | number | bigint;
17809
+ maxFee: string | number | bigint;
17810
17810
  }>]>, "many">;
17811
17811
  summary: z.ZodOptional<z.ZodArray<z.ZodObject<{
17812
17812
  type: z.ZodString;
@@ -18044,8 +18044,8 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
18044
18044
  type: "ERC20";
18045
18045
  unknown: boolean;
18046
18046
  };
18047
- maxFee: number;
18048
18047
  overallFee: number;
18048
+ maxFee: number;
18049
18049
  } | {
18050
18050
  token: {
18051
18051
  address: `0x${string}`;
@@ -18198,8 +18198,8 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
18198
18198
  type: "ERC20";
18199
18199
  unknown: boolean;
18200
18200
  };
18201
- maxFee: string | number | bigint;
18202
18201
  overallFee: string | number | bigint;
18202
+ maxFee: string | number | bigint;
18203
18203
  } | {
18204
18204
  token: {
18205
18205
  address: string;
@@ -18355,8 +18355,8 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
18355
18355
  type: "ERC20";
18356
18356
  unknown: boolean;
18357
18357
  };
18358
- maxFee: number;
18359
18358
  overallFee: number;
18359
+ maxFee: number;
18360
18360
  } | {
18361
18361
  token: {
18362
18362
  address: `0x${string}`;
@@ -18688,8 +18688,8 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
18688
18688
  type: "ERC20";
18689
18689
  unknown: boolean;
18690
18690
  };
18691
- maxFee: string | number | bigint;
18692
18691
  overallFee: string | number | bigint;
18692
+ maxFee: string | number | bigint;
18693
18693
  } | {
18694
18694
  token: {
18695
18695
  address: string;
@@ -20950,8 +20950,8 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
20950
20950
  type: "ERC20";
20951
20951
  unknown: boolean;
20952
20952
  };
20953
- maxFee: number;
20954
20953
  overallFee: number;
20954
+ maxFee: number;
20955
20955
  } | {
20956
20956
  token: {
20957
20957
  address: `0x${string}`;
@@ -21478,8 +21478,8 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
21478
21478
  type: "ERC20";
21479
21479
  unknown: boolean;
21480
21480
  };
21481
- maxFee: string | number | bigint;
21482
21481
  overallFee: string | number | bigint;
21482
+ maxFee: string | number | bigint;
21483
21483
  } | {
21484
21484
  token: {
21485
21485
  address: string;
@@ -24048,16 +24048,16 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
24048
24048
  type: "ERC20";
24049
24049
  unknown: boolean;
24050
24050
  };
24051
- maxFee: number;
24052
24051
  overallFee: number;
24052
+ maxFee: number;
24053
24053
  }, {
24054
24054
  token: {
24055
24055
  address: string;
24056
24056
  type: "ERC20";
24057
24057
  unknown: boolean;
24058
24058
  };
24059
- maxFee: string | number | bigint;
24060
24059
  overallFee: string | number | bigint;
24060
+ maxFee: string | number | bigint;
24061
24061
  }>]>, "many">;
24062
24062
  summary: z.ZodOptional<z.ZodArray<z.ZodObject<{
24063
24063
  type: z.ZodString;
@@ -24295,8 +24295,8 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
24295
24295
  type: "ERC20";
24296
24296
  unknown: boolean;
24297
24297
  };
24298
- maxFee: number;
24299
24298
  overallFee: number;
24299
+ maxFee: number;
24300
24300
  } | {
24301
24301
  token: {
24302
24302
  address: `0x${string}`;
@@ -24449,8 +24449,8 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
24449
24449
  type: "ERC20";
24450
24450
  unknown: boolean;
24451
24451
  };
24452
- maxFee: string | number | bigint;
24453
24452
  overallFee: string | number | bigint;
24453
+ maxFee: string | number | bigint;
24454
24454
  } | {
24455
24455
  token: {
24456
24456
  address: string;
@@ -24606,8 +24606,8 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
24606
24606
  type: "ERC20";
24607
24607
  unknown: boolean;
24608
24608
  };
24609
- maxFee: number;
24610
24609
  overallFee: number;
24610
+ maxFee: number;
24611
24611
  } | {
24612
24612
  token: {
24613
24613
  address: `0x${string}`;
@@ -24939,8 +24939,8 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
24939
24939
  type: "ERC20";
24940
24940
  unknown: boolean;
24941
24941
  };
24942
- maxFee: string | number | bigint;
24943
24942
  overallFee: string | number | bigint;
24943
+ maxFee: string | number | bigint;
24944
24944
  } | {
24945
24945
  token: {
24946
24946
  address: string;
@@ -27194,6 +27194,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27194
27194
  gasConsumed: bigint;
27195
27195
  gasPrice: bigint;
27196
27196
  }>;
27197
+ overallFee: z.ZodOptional<z.ZodBigInt>;
27197
27198
  }, "type">, "strip", z.ZodTypeAny, {
27198
27199
  feeTokenAddress: `0x${string}`;
27199
27200
  l1Gas: {
@@ -27208,6 +27209,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27208
27209
  gasConsumed: bigint;
27209
27210
  gasPrice: bigint;
27210
27211
  };
27212
+ overallFee?: bigint | undefined;
27211
27213
  }, {
27212
27214
  feeTokenAddress: string;
27213
27215
  l1Gas: {
@@ -27222,6 +27224,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27222
27224
  gasConsumed: bigint;
27223
27225
  gasPrice: bigint;
27224
27226
  };
27227
+ overallFee?: bigint | undefined;
27225
27228
  }>;
27226
27229
  deployment: z.ZodOptional<z.ZodObject<Omit<{
27227
27230
  type: z.ZodLiteral<"native">;
@@ -27256,6 +27259,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27256
27259
  gasConsumed: bigint;
27257
27260
  gasPrice: bigint;
27258
27261
  }>;
27262
+ overallFee: z.ZodOptional<z.ZodBigInt>;
27259
27263
  }, "type">, "strip", z.ZodTypeAny, {
27260
27264
  feeTokenAddress: `0x${string}`;
27261
27265
  l1Gas: {
@@ -27270,6 +27274,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27270
27274
  gasConsumed: bigint;
27271
27275
  gasPrice: bigint;
27272
27276
  };
27277
+ overallFee?: bigint | undefined;
27273
27278
  }, {
27274
27279
  feeTokenAddress: string;
27275
27280
  l1Gas: {
@@ -27284,6 +27289,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27284
27289
  gasConsumed: bigint;
27285
27290
  gasPrice: bigint;
27286
27291
  };
27292
+ overallFee?: bigint | undefined;
27287
27293
  }>>;
27288
27294
  }, "strip", z.ZodTypeAny, {
27289
27295
  type: "native";
@@ -27301,6 +27307,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27301
27307
  gasConsumed: bigint;
27302
27308
  gasPrice: bigint;
27303
27309
  };
27310
+ overallFee?: bigint | undefined;
27304
27311
  };
27305
27312
  deployment?: {
27306
27313
  feeTokenAddress: `0x${string}`;
@@ -27316,6 +27323,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27316
27323
  gasConsumed: bigint;
27317
27324
  gasPrice: bigint;
27318
27325
  };
27326
+ overallFee?: bigint | undefined;
27319
27327
  } | undefined;
27320
27328
  }, {
27321
27329
  type: "native";
@@ -27333,6 +27341,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27333
27341
  gasConsumed: bigint;
27334
27342
  gasPrice: bigint;
27335
27343
  };
27344
+ overallFee?: bigint | undefined;
27336
27345
  };
27337
27346
  deployment?: {
27338
27347
  feeTokenAddress: string;
@@ -27348,6 +27357,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27348
27357
  gasConsumed: bigint;
27349
27358
  gasPrice: bigint;
27350
27359
  };
27360
+ overallFee?: bigint | undefined;
27351
27361
  } | undefined;
27352
27362
  }>, z.ZodObject<{
27353
27363
  type: z.ZodLiteral<"paymaster">;
@@ -27358,12 +27368,12 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27358
27368
  overallFee: z.ZodBigInt;
27359
27369
  }, "type">, "strip", z.ZodTypeAny, {
27360
27370
  feeTokenAddress: `0x${string}`;
27361
- maxFee: bigint;
27362
27371
  overallFee: bigint;
27372
+ maxFee: bigint;
27363
27373
  }, {
27364
27374
  feeTokenAddress: string;
27365
- maxFee: bigint;
27366
27375
  overallFee: bigint;
27376
+ maxFee: bigint;
27367
27377
  }>;
27368
27378
  deployment: z.ZodOptional<z.ZodObject<Omit<{
27369
27379
  type: z.ZodLiteral<"paymaster">;
@@ -27372,36 +27382,36 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27372
27382
  overallFee: z.ZodBigInt;
27373
27383
  }, "type">, "strip", z.ZodTypeAny, {
27374
27384
  feeTokenAddress: `0x${string}`;
27375
- maxFee: bigint;
27376
27385
  overallFee: bigint;
27386
+ maxFee: bigint;
27377
27387
  }, {
27378
27388
  feeTokenAddress: string;
27379
- maxFee: bigint;
27380
27389
  overallFee: bigint;
27390
+ maxFee: bigint;
27381
27391
  }>>;
27382
27392
  }, "strip", z.ZodTypeAny, {
27383
27393
  type: "paymaster";
27384
27394
  transactions: {
27385
27395
  feeTokenAddress: `0x${string}`;
27386
- maxFee: bigint;
27387
27396
  overallFee: bigint;
27397
+ maxFee: bigint;
27388
27398
  };
27389
27399
  deployment?: {
27390
27400
  feeTokenAddress: `0x${string}`;
27391
- maxFee: bigint;
27392
27401
  overallFee: bigint;
27402
+ maxFee: bigint;
27393
27403
  } | undefined;
27394
27404
  }, {
27395
27405
  type: "paymaster";
27396
27406
  transactions: {
27397
27407
  feeTokenAddress: string;
27398
- maxFee: bigint;
27399
27408
  overallFee: bigint;
27409
+ maxFee: bigint;
27400
27410
  };
27401
27411
  deployment?: {
27402
27412
  feeTokenAddress: string;
27403
- maxFee: bigint;
27404
27413
  overallFee: bigint;
27414
+ maxFee: bigint;
27405
27415
  } | undefined;
27406
27416
  }>]>, "many">>;
27407
27417
  isBackendDown: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -27447,8 +27457,8 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27447
27457
  type: "ERC20";
27448
27458
  unknown: boolean;
27449
27459
  };
27450
- maxFee: number;
27451
27460
  overallFee: number;
27461
+ maxFee: number;
27452
27462
  } | {
27453
27463
  token: {
27454
27464
  address: `0x${string}`;
@@ -27959,6 +27969,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27959
27969
  gasConsumed: bigint;
27960
27970
  gasPrice: bigint;
27961
27971
  };
27972
+ overallFee?: bigint | undefined;
27962
27973
  };
27963
27974
  deployment?: {
27964
27975
  feeTokenAddress: `0x${string}`;
@@ -27974,18 +27985,19 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
27974
27985
  gasConsumed: bigint;
27975
27986
  gasPrice: bigint;
27976
27987
  };
27988
+ overallFee?: bigint | undefined;
27977
27989
  } | undefined;
27978
27990
  } | {
27979
27991
  type: "paymaster";
27980
27992
  transactions: {
27981
27993
  feeTokenAddress: `0x${string}`;
27982
- maxFee: bigint;
27983
27994
  overallFee: bigint;
27995
+ maxFee: bigint;
27984
27996
  };
27985
27997
  deployment?: {
27986
27998
  feeTokenAddress: `0x${string}`;
27987
- maxFee: bigint;
27988
27999
  overallFee: bigint;
28000
+ maxFee: bigint;
27989
28001
  } | undefined;
27990
28002
  })[] | undefined;
27991
28003
  isBackendDown?: boolean | undefined;
@@ -28021,8 +28033,8 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
28021
28033
  type: "ERC20";
28022
28034
  unknown: boolean;
28023
28035
  };
28024
- maxFee: string | number | bigint;
28025
28036
  overallFee: string | number | bigint;
28037
+ maxFee: string | number | bigint;
28026
28038
  } | {
28027
28039
  token: {
28028
28040
  address: string;
@@ -28533,6 +28545,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
28533
28545
  gasConsumed: bigint;
28534
28546
  gasPrice: bigint;
28535
28547
  };
28548
+ overallFee?: bigint | undefined;
28536
28549
  };
28537
28550
  deployment?: {
28538
28551
  feeTokenAddress: string;
@@ -28548,18 +28561,19 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
28548
28561
  gasConsumed: bigint;
28549
28562
  gasPrice: bigint;
28550
28563
  };
28564
+ overallFee?: bigint | undefined;
28551
28565
  } | undefined;
28552
28566
  } | {
28553
28567
  type: "paymaster";
28554
28568
  transactions: {
28555
28569
  feeTokenAddress: string;
28556
- maxFee: bigint;
28557
28570
  overallFee: bigint;
28571
+ maxFee: bigint;
28558
28572
  };
28559
28573
  deployment?: {
28560
28574
  feeTokenAddress: string;
28561
- maxFee: bigint;
28562
28575
  overallFee: bigint;
28576
+ maxFee: bigint;
28563
28577
  } | undefined;
28564
28578
  })[] | undefined;
28565
28579
  isBackendDown?: boolean | undefined;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("lodash-es"),o=require("starknet"),C=require("./adjustment.cjs"),N=require("./argentMaxFee.cjs"),E=require("./error.cjs"),y=require("../../chains/starknet/constants.cjs"),F=require("../../chains/starknet/address.cjs"),D=e=>{const{transactions:t}=e;if(!t)throw new E.EstimateError({code:"SIMULATE_AND_REVIEW_FAILED"});if(!Array.isArray(t))throw Error(`Unexpected simulation response. Expected array. Got ${typeof t}`);if(p.isEmpty(t))return[];if(t.length>2)throw Error(`Unexpected simulation response length. Got ${t.length}`);const a=t.map(m=>{if(!m.simulation)throw new E.EstimateError({code:"SIMULATE_AND_REVIEW_FAILED"});return{...m.simulation,...I(m.simulation.feeEstimations)}}),[s,n]=a.length===1?[a[0],void 0]:[a[1],a[0]],r=T(s,n),i=x(s,n);return[...r,...i]},I=e=>{const[t,a]=p.partition(e,s=>"unit"in s&&s.unit==="FRI");return{nativeFeeEstimations:t,paymasterFeeEstimations:a}},x=(e,t)=>{if(!e)return[];if(!t)return e.paymasterFeeEstimations.map(n=>({type:"paymaster",transactions:l(n),deployment:void 0}));const a=t.paymasterFeeEstimations,s=e.paymasterFeeEstimations;if(a.length!==s.length)throw Error("Deployment and transaction fee estimations length mismatch");return s.map((n,r)=>({type:"paymaster",transactions:l(n),deployment:l(a[r])}))},T=(e,t)=>{if(!e)return[];if(!t)return e.nativeFeeEstimations.map(n=>({type:"native",transactions:g(n),deployment:void 0}));const a=t.nativeFeeEstimations,s=e.nativeFeeEstimations;if(a.length!==s.length)throw Error("Deployment and transaction fee estimations length mismatch");return s.map((n,r)=>({type:"native",transactions:g(n),deployment:g(a[r])}))},l=e=>({feeTokenAddress:e.token.address,maxFee:BigInt(e.maxFee),overallFee:BigInt(e.overallFee)}),g=e=>({feeTokenAddress:y.STRK_TOKEN_ADDRESS,l1Gas:{gasConsumed:o.num.toBigInt(e.resourceBounds.l1Gas.maxAmount),gasPrice:o.num.toBigInt(e.resourceBounds.l1Gas.maxPricePerUnit)},l1DataGas:{gasConsumed:o.num.toBigInt(e.resourceBounds.l1DataGas.maxAmount),gasPrice:o.num.toBigInt(e.resourceBounds.l1DataGas.maxPricePerUnit)},l2Gas:{gasConsumed:o.num.toBigInt(e.resourceBounds.l2Gas.maxAmount),gasPrice:o.num.toBigInt(e.resourceBounds.l2Gas.maxPricePerUnit)}}),M=e=>{const{l1Gas:t,l2Gas:a,l1DataGas:s}=e.resourceBounds,n=t.maxAmount*t.maxPricePerUnit+a.maxAmount*a.maxPricePerUnit+s.maxAmount*s.maxPricePerUnit;return o.num.toBigInt(n)},S=e=>{var s;if(e.type==="paymaster")return e.transactions.maxFee+(((s=e.deployment)==null?void 0:s.maxFee)??0n);if(e.deployment&&!F.isEqualAddress(e.deployment.feeTokenAddress,e.transactions.feeTokenAddress))throw Error("Cannot calculate estimated fees for different tokens");const t=e.deployment?u(e.deployment):0n,a=u(e.transactions);return t+a},k=e=>{var t;return e.type==="paymaster"?e.transactions.overallFee+(((t=e.deployment)==null?void 0:t.overallFee)??0n):G(e)},f=(e=[])=>e.filter(a=>a.type==="native"),w=e=>e.filter(t=>t.type==="paymaster"),P=()=>y.STRK_TOKEN_ADDRESS,A=(e=[],t)=>{const a=f(e).find(s=>F.isEqualAddress(s.transactions.feeTokenAddress,t));if(!a)throw Error(`No native estimated fee found for ${t}`);return a},v=(e=[])=>{const t=P();return A(e,t)},R=(e=[])=>v(e),G=e=>{if(e.deployment&&!F.isEqualAddress(e.deployment.feeTokenAddress,e.transactions.feeTokenAddress))throw Error("Cannot calculate estimated fees for different tokens");const t=c(e.transactions),a=e.deployment?c(e.deployment):0n;return t+a},c=e=>{const{l1Gas:t,l2Gas:a,l1DataGas:s}=e;return t.gasConsumed*t.gasPrice+a.gasConsumed*a.gasPrice+s.gasConsumed*s.gasPrice},u=e=>c(_(e)),_=(e,t=C.calculateCubeRootAdjustment)=>{const a=10000n,{l1Gas:s,l2Gas:n,l1DataGas:r}=e,i=s.gasConsumed*s.gasPrice+n.gasConsumed*n.gasPrice+r.gasConsumed*r.gasPrice;if(i<0)throw Error("Cannot calculate max fee for negative fee");const m=o.num.toBigInt(N.argentMaxFee({estimatedFee:i})),B=Number(m)/Number(i),h=t(B),d=BigInt(Math.trunc(h*Number(a)));return{...e,l1Gas:{gasConsumed:s.gasConsumed*d/a,gasPrice:s.gasPrice},l2Gas:{gasConsumed:n.gasConsumed*d/a,gasPrice:n.gasPrice},l1DataGas:{gasConsumed:r.gasConsumed*d/a,gasPrice:r.gasPrice}}},V=e=>{const t=_(e);return u(e),{resourceBounds:{l1_gas:q(t.l1Gas),l2_gas:{max_amount:o.num.toHex(t.l2Gas.gasConsumed),max_price_per_unit:o.num.toHex(t.l2Gas.gasPrice)},l1_data_gas:{max_amount:o.num.toHex(t.l1DataGas.gasConsumed),max_price_per_unit:o.num.toHex(t.l1DataGas.gasPrice)}}}},q=e=>({max_amount:o.num.toHex(e.gasConsumed),max_price_per_unit:o.num.toHex(e.gasPrice)});exports.estimatedFeeToMaxFeeTotal=u;exports.estimatedFeeToMaxResourceBounds=V;exports.estimatedFeeToTotal=c;exports.estimatedFeesToMaxFeeTotalV2=S;exports.estimatedFeesToTotal=G;exports.estimatedFeesToTotalV2=k;exports.filterPaymasterEstimatedFees=w;exports.getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2=D;exports.getNativeEstimatedFeeByFeeToken=A;exports.getNativeEstimatedFeeByTxVersion=v;exports.getNativeEstimatedFeeForAccount=R;exports.getNativeEstimatedFees=f;exports.getNativeFeeFromSimulation=T;exports.getNativeFeeTokenAddress=P;exports.getPaymasterFeeFromSimulation=x;exports.toMaxFeeEstimation=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("lodash-es"),o=require("starknet"),C=require("./adjustment.cjs"),N=require("./argentMaxFee.cjs"),E=require("./error.cjs"),x=require("../../chains/starknet/constants.cjs"),g=require("../../chains/starknet/address.cjs"),D=e=>{const{transactions:t}=e;if(!t)throw new E.EstimateError({code:"SIMULATE_AND_REVIEW_FAILED"});if(!Array.isArray(t))throw Error(`Unexpected simulation response. Expected array. Got ${typeof t}`);if(p.isEmpty(t))return[];if(t.length>2)throw Error(`Unexpected simulation response length. Got ${t.length}`);const a=t.map(m=>{if(!m.simulation)throw new E.EstimateError({code:"SIMULATE_AND_REVIEW_FAILED"});return{...m.simulation,...I(m.simulation.feeEstimations)}}),[s,n]=a.length===1?[a[0],void 0]:[a[1],a[0]],r=T(s,n),i=y(s,n);return[...r,...i]},I=e=>{const[t,a]=p.partition(e,s=>"unit"in s&&s.unit==="FRI");return{nativeFeeEstimations:t,paymasterFeeEstimations:a}},y=(e,t)=>{if(!e)return[];if(!t)return e.paymasterFeeEstimations.map(n=>({type:"paymaster",transactions:d(n),deployment:void 0}));const a=t.paymasterFeeEstimations,s=e.paymasterFeeEstimations;if(a.length!==s.length)throw Error("Deployment and transaction fee estimations length mismatch");return s.map((n,r)=>({type:"paymaster",transactions:d(n),deployment:d(a[r])}))},T=(e,t)=>{if(!e)return[];if(!t)return e.nativeFeeEstimations.map(n=>({type:"native",transactions:F(n),deployment:void 0}));const a=t.nativeFeeEstimations,s=e.nativeFeeEstimations;if(a.length!==s.length)throw Error("Deployment and transaction fee estimations length mismatch");return s.map((n,r)=>({type:"native",transactions:F(n),deployment:F(a[r])}))},d=e=>({feeTokenAddress:e.token.address,maxFee:BigInt(e.maxFee),overallFee:BigInt(e.overallFee)}),F=e=>({feeTokenAddress:x.STRK_TOKEN_ADDRESS,overallFee:o.num.toBigInt(e.overallFee),l1Gas:{gasConsumed:o.num.toBigInt(e.resourceBounds.l1Gas.maxAmount),gasPrice:o.num.toBigInt(e.resourceBounds.l1Gas.maxPricePerUnit)},l1DataGas:{gasConsumed:o.num.toBigInt(e.resourceBounds.l1DataGas.maxAmount),gasPrice:o.num.toBigInt(e.resourceBounds.l1DataGas.maxPricePerUnit)},l2Gas:{gasConsumed:o.num.toBigInt(e.resourceBounds.l2Gas.maxAmount),gasPrice:o.num.toBigInt(e.resourceBounds.l2Gas.maxPricePerUnit)}}),M=e=>{const{l1Gas:t,l2Gas:a,l1DataGas:s}=e.resourceBounds,n=t.maxAmount*t.maxPricePerUnit+a.maxAmount*a.maxPricePerUnit+s.maxAmount*s.maxPricePerUnit;return o.num.toBigInt(n)},S=e=>{const{type:t,deployment:a,transactions:s}=e;if(t==="paymaster")return s.maxFee+((a==null?void 0:a.maxFee)??0n);if(a&&!g.isEqualAddress(a.feeTokenAddress,s.feeTokenAddress))throw Error("Cannot calculate estimated fees for different tokens");const n=!s.overallFee&&!(a!=null&&a.overallFee),r=l=>n?h(l):u(l),i=a?r(a):0n,m=r(s);return i+m},k=e=>{var t;return e.transactions.overallFee?e.transactions.overallFee+(((t=e.deployment)==null?void 0:t.overallFee)??0n):G(e)},v=(e=[])=>e.filter(a=>a.type==="native"),w=e=>e.filter(t=>t.type==="paymaster"),f=()=>x.STRK_TOKEN_ADDRESS,P=(e=[],t)=>{const a=v(e).find(s=>g.isEqualAddress(s.transactions.feeTokenAddress,t));if(!a)throw Error(`No native estimated fee found for ${t}`);return a},A=(e=[])=>{const t=f();return P(e,t)},R=(e=[])=>A(e),G=e=>{if(e.deployment&&!g.isEqualAddress(e.deployment.feeTokenAddress,e.transactions.feeTokenAddress))throw Error("Cannot calculate estimated fees for different tokens");const t=u(e.transactions),a=e.deployment?u(e.deployment):0n;return t+a},u=e=>{const{l1Gas:t,l2Gas:a,l1DataGas:s}=e;return t.gasConsumed*t.gasPrice+a.gasConsumed*a.gasPrice+s.gasConsumed*s.gasPrice},h=e=>u(_(e)),_=(e,t=C.calculateCubeRootAdjustment)=>{const a=10000n,{l1Gas:s,l2Gas:n,l1DataGas:r}=e,i=s.gasConsumed*s.gasPrice+n.gasConsumed*n.gasPrice+r.gasConsumed*r.gasPrice;if(i<0)throw Error("Cannot calculate max fee for negative fee");const m=o.num.toBigInt(N.argentMaxFee({estimatedFee:i})),l=Number(m)/Number(i),B=t(l),c=BigInt(Math.trunc(B*Number(a)));return{...e,l1Gas:{gasConsumed:s.gasConsumed*c/a,gasPrice:s.gasPrice*c/a},l2Gas:{gasConsumed:n.gasConsumed*c/a,gasPrice:n.gasPrice*c/a},l1DataGas:{gasConsumed:r.gasConsumed*c/a,gasPrice:r.gasPrice*c/a}}},q=e=>{const t=e.overallFee?e:_(e);return{resourceBounds:{l1_gas:V(t.l1Gas),l2_gas:{max_amount:o.num.toHex(t.l2Gas.gasConsumed),max_price_per_unit:o.num.toHex(t.l2Gas.gasPrice)},l1_data_gas:{max_amount:o.num.toHex(t.l1DataGas.gasConsumed),max_price_per_unit:o.num.toHex(t.l1DataGas.gasPrice)}}}},V=e=>({max_amount:o.num.toHex(e.gasConsumed),max_price_per_unit:o.num.toHex(e.gasPrice)});exports.estimatedFeeToMaxFeeTotal=h;exports.estimatedFeeToMaxResourceBounds=q;exports.estimatedFeeToTotal=u;exports.estimatedFeesToMaxFeeTotalV2=S;exports.estimatedFeesToTotal=G;exports.estimatedFeesToTotalWithOverallFee=k;exports.filterPaymasterEstimatedFees=w;exports.getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2=D;exports.getNativeEstimatedFeeByFeeToken=P;exports.getNativeEstimatedFeeByTxVersion=A;exports.getNativeEstimatedFeeForAccount=R;exports.getNativeEstimatedFees=v;exports.getNativeFeeFromSimulation=T;exports.getNativeFeeTokenAddress=f;exports.getPaymasterFeeFromSimulation=y;exports.toMaxFeeEstimation=M;
@@ -14,7 +14,7 @@ export declare const getNativeFeeFromSimulation: (invokeTransaction: {
14
14
  } | undefined) => EstimatedFees[];
15
15
  export declare const toMaxFeeEstimation: (fee: FeeEstimation) => bigint;
16
16
  export declare const estimatedFeesToMaxFeeTotalV2: (estimatedFees: EstimatedFees) => bigint;
17
- export declare const estimatedFeesToTotalV2: (estimatedFees: EstimatedFees) => bigint;
17
+ export declare const estimatedFeesToTotalWithOverallFee: (estimatedFees: EstimatedFees) => bigint;
18
18
  export declare const getNativeEstimatedFees: (estimatedFees?: EstimatedFees[]) => NativeEstimatedFees[];
19
19
  export declare const filterPaymasterEstimatedFees: (estimatedFees: EstimatedFees[]) => PaymasterEstimatedFeesData[];
20
20
  export declare const getNativeFeeTokenAddress: () => Address;