@argent/x-shared 1.74.1 → 1.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +212 -209
  3. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js +5 -5
  4. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.cjs +1 -1
  5. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js +13 -14
  6. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.cjs +1 -1
  7. package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js +3 -3
  8. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.cjs +1 -1
  9. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js +3 -3
  10. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.cjs +1 -1
  11. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js +1 -1
  12. package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.js +6 -6
  13. package/dist/src/chains/starknet/address.cjs +1 -1
  14. package/dist/src/chains/starknet/address.js +17 -17
  15. package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.js +1 -1
  16. package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.js +1 -1
  17. package/dist/src/features/defiDecomposition/helpers/computeCollateralizedDebtPositionsUsdValue.cjs +1 -1
  18. package/dist/src/features/defiDecomposition/helpers/computeCollateralizedDebtPositionsUsdValue.js +27 -27
  19. package/dist/src/features/defiDecomposition/helpers/computeConcentratedLiquidityPositionsUsdValue.cjs +1 -1
  20. package/dist/src/features/defiDecomposition/helpers/computeConcentratedLiquidityPositionsUsdValue.js +22 -22
  21. package/dist/src/features/defiDecomposition/helpers/computeDelegatedTokensPositionsUsdValue.cjs +1 -1
  22. package/dist/src/features/defiDecomposition/helpers/computeDelegatedTokensPositionsUsdValue.js +14 -14
  23. package/dist/src/features/defiDecomposition/helpers/computeStakingPositionsUsdValue.cjs +1 -1
  24. package/dist/src/features/defiDecomposition/helpers/computeStakingPositionsUsdValue.js +9 -9
  25. package/dist/src/features/defiDecomposition/helpers/computeStrkDelegatedStakingPositionsUsdValue.cjs +1 -1
  26. package/dist/src/features/defiDecomposition/helpers/computeStrkDelegatedStakingPositionsUsdValue.js +13 -13
  27. package/dist/src/features/defiDecomposition/helpers/parseCollateralizedDebtPositions.cjs +1 -1
  28. package/dist/src/features/defiDecomposition/helpers/parseCollateralizedDebtPositions.js +24 -25
  29. package/dist/src/features/simulation/activity/normalize.cjs +1 -1
  30. package/dist/src/features/simulation/activity/normalize.js +12 -13
  31. package/dist/src/features/simulation/activity/schema.cjs +1 -1
  32. package/dist/src/features/simulation/activity/schema.js +6 -6
  33. package/dist/src/features/simulation/activity/utils/createNativeActivity.cjs +1 -1
  34. package/dist/src/features/simulation/activity/utils/createNativeActivity.js +22 -24
  35. package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.cjs +1 -1
  36. package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.js +11 -12
  37. package/dist/src/features/simulation/activity/utils/hasDelegationActivity.cjs +1 -1
  38. package/dist/src/features/simulation/activity/utils/hasDelegationActivity.js +2 -8
  39. package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.cjs +1 -1
  40. package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.js +4 -8
  41. package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.cjs +1 -1
  42. package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.js +4 -8
  43. package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.cjs +1 -1
  44. package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.js +3 -9
  45. package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.cjs +1 -1
  46. package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.js +15 -19
  47. package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.cjs +1 -1
  48. package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.js +4 -8
  49. package/dist/src/features/simulation/activity/utils/isSwapActivity.cjs +1 -1
  50. package/dist/src/features/simulation/activity/utils/isSwapActivity.js +9 -16
  51. package/dist/src/features/simulation/activity/utils/isUpgradeActivity.cjs +1 -1
  52. package/dist/src/features/simulation/activity/utils/isUpgradeActivity.js +4 -8
  53. package/dist/src/features/simulation/fees/schema.cjs +1 -1
  54. package/dist/src/features/simulation/fees/schema.d.ts +16 -0
  55. package/dist/src/features/simulation/fees/schema.js +8 -6
  56. package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.cjs +1 -1
  57. package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.js +10 -11
  58. package/dist/src/features/simulation/transactionReview/schema.cjs +1 -1
  59. package/dist/src/features/simulation/transactionReview/schema.d.ts +23 -0
  60. package/dist/src/features/simulation/transactionReview/schema.js +21 -19
  61. package/dist/src/features/swap/services/SwapTransactionService.cjs +1 -1
  62. package/dist/src/features/swap/services/SwapTransactionService.js +46 -49
  63. package/dist/src/http/HttpService.cjs +1 -1
  64. package/dist/src/http/HttpService.js +55 -55
  65. package/dist/src/knownDapps/utils/getDapplandUrl.cjs +1 -1
  66. package/dist/src/knownDapps/utils/getDapplandUrl.js +6 -8
  67. package/dist/src/nfts/BackendNftService.cjs +1 -1
  68. package/dist/src/nfts/BackendNftService.js +18 -19
  69. package/dist/src/tokens/service/implementation.cjs +1 -1
  70. package/dist/src/tokens/service/implementation.js +12 -12
  71. package/dist/src/tokens/service/types/backend.model.js +1 -1
  72. package/dist/src/transactions/estimate/utils.cjs +1 -1
  73. package/dist/src/transactions/estimate/utils.d.ts +33 -0
  74. package/dist/src/transactions/estimate/utils.js +80 -76
  75. package/dist/src/transactions/service/implementation.cjs +1 -1
  76. package/dist/src/transactions/service/implementation.d.ts +4 -0
  77. package/dist/src/transactions/service/implementation.js +89 -96
  78. package/dist/src/transactions/service/utils.cjs +1 -1
  79. package/dist/src/transactions/service/utils.d.ts +2 -3
  80. package/dist/src/transactions/service/utils.js +12 -11
  81. package/dist/src/transactions/transactionVersion.cjs +1 -1
  82. package/dist/src/transactions/transactionVersion.d.ts +2 -0
  83. package/dist/src/transactions/transactionVersion.js +12 -10
  84. package/dist/src/utils/base58.js +5 -5
  85. package/dist/src/utils/number/abbreviateNumber.d.ts +2 -1
  86. package/dist/src/utils/readFileAsString.cjs +1 -1
  87. package/dist/src/utils/readFileAsString.js +3 -6
  88. package/package.json +23 -23
  89. package/dist/node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.cjs +0 -1
  90. package/dist/node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.js +0 -6
@@ -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"),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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("lodash-es"),o=require("starknet"),C=require("./adjustment.cjs"),I=require("./argentMaxFee.cjs"),p=require("./error.cjs"),T=require("../../chains/starknet/constants.cjs"),g=require("../../chains/starknet/address.cjs"),D=e=>{const{transactions:t}=e;if(!t)throw new p.EstimateError({code:"SIMULATE_AND_REVIEW_FAILED"});if(!Array.isArray(t))throw Error(`Unexpected simulation response. Expected array. Got ${typeof t}`);if(E.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 p.EstimateError({code:"SIMULATE_AND_REVIEW_FAILED"});return{...m.simulation,...M(m.simulation.feeEstimations)}}),[s,n]=a.length===1?[a[0],void 0]:[a[1],a[0]],r=y(s,n),i=x(s,n);return[...r,...i]},M=e=>{const[t,a]=E.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])}))},y=(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])}))},l=e=>({feeTokenAddress:e.token.address,maxFee:BigInt(e.maxFee),overallFee:BigInt(e.overallFee),tip:e.defaultTip?o.num.toBigInt(e.defaultTip):void 0}),F=e=>({feeTokenAddress:T.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)},tip:e.defaultTip?o.num.toBigInt(e.defaultTip):void 0}),S=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)},k=e=>{const{type:t,deployment:a,transactions:s}=e;if(t==="paymaster")return s.maxFee+(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?.overallFee,r=d=>n?G(d):c(d),i=a?r(a):0n,m=r(s);return i+m},R=e=>e.transactions.overallFee?e.transactions.overallFee+(e.deployment?.overallFee??0n):A(e),v=(e=[])=>e.filter(a=>a.type==="native"),w=e=>e.filter(t=>t.type==="paymaster"),f=()=>T.STRK_TOKEN_ADDRESS,B=(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},P=(e=[])=>{const t=f();return B(e,t)},q=(e=[])=>P(e),A=e=>{if(e.deployment&&!g.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},G=e=>c(h(e)),h=(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(I.argentMaxFee({estimatedFee:i})),d=Number(m)/Number(i),N=t(d),u=BigInt(Math.trunc(N*Number(a)));return{...e,l1Gas:{gasConsumed:s.gasConsumed*u/a,gasPrice:s.gasPrice*u/a},l2Gas:{gasConsumed:n.gasConsumed*u/a,gasPrice:n.gasPrice*u/a},l1DataGas:{gasConsumed:r.gasConsumed*u/a,gasPrice:r.gasPrice*u/a}}},_=e=>{const t=e.overallFee?e:h(e);return{...e,resourceBounds:{l1_gas:U(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=>({...e,resourceBounds:o.stark.resourceBoundsToBigInt(_(e).resourceBounds)}),U=e=>({max_amount:o.num.toHex(e.gasConsumed),max_price_per_unit:o.num.toHex(e.gasPrice)});exports.estimatedFeeToMaxFeeTotal=G;exports.estimatedFeeToMaxResourceBounds=_;exports.estimatedFeeToMaxResourceBoundsBN=V;exports.estimatedFeeToTotal=c;exports.estimatedFeesToMaxFeeTotalV2=k;exports.estimatedFeesToTotal=A;exports.estimatedFeesToTotalWithOverallFee=R;exports.filterPaymasterEstimatedFees=w;exports.getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2=D;exports.getNativeEstimatedFeeByFeeToken=B;exports.getNativeEstimatedFeeByTxVersion=P;exports.getNativeEstimatedFeeForAccount=q;exports.getNativeEstimatedFees=v;exports.getNativeFeeFromSimulation=y;exports.getNativeFeeTokenAddress=f;exports.getPaymasterFeeFromSimulation=x;exports.toMaxFeeEstimation=S;
@@ -39,4 +39,37 @@ export declare const estimatedFeeToMaxResourceBounds: (estimatedFee: NativeEstim
39
39
  max_price_per_unit: string;
40
40
  };
41
41
  };
42
+ feeTokenAddress: `0x${string}`;
43
+ l1Gas: {
44
+ gasConsumed: bigint;
45
+ gasPrice: bigint;
46
+ };
47
+ l2Gas: {
48
+ gasConsumed: bigint;
49
+ gasPrice: bigint;
50
+ };
51
+ l1DataGas: {
52
+ gasConsumed: bigint;
53
+ gasPrice: bigint;
54
+ };
55
+ overallFee?: bigint | undefined;
56
+ tip?: bigint | undefined;
57
+ };
58
+ export declare const estimatedFeeToMaxResourceBoundsBN: (estimatedFee: NativeEstimatedFeeData) => {
59
+ resourceBounds: import('starknet').ResourceBoundsBN;
60
+ feeTokenAddress: `0x${string}`;
61
+ l1Gas: {
62
+ gasConsumed: bigint;
63
+ gasPrice: bigint;
64
+ };
65
+ l2Gas: {
66
+ gasConsumed: bigint;
67
+ gasPrice: bigint;
68
+ };
69
+ l1DataGas: {
70
+ gasConsumed: bigint;
71
+ gasPrice: bigint;
72
+ };
73
+ overallFee?: bigint | undefined;
74
+ tip?: bigint | undefined;
42
75
  };
@@ -1,14 +1,14 @@
1
- import { isEmpty as y, partition as P } from "lodash-es";
2
- import { num as o } from "starknet";
3
- import { calculateCubeRootAdjustment as v } from "./adjustment.js";
4
- import { argentMaxFee as A } from "./argentMaxFee.js";
5
- import { EstimateError as p } from "./error.js";
1
+ import { isEmpty as y, partition as v } from "lodash-es";
2
+ import { stark as P, num as n } from "starknet";
3
+ import { calculateCubeRootAdjustment as T } from "./adjustment.js";
4
+ import { argentMaxFee as B } from "./argentMaxFee.js";
5
+ import { EstimateError as F } from "./error.js";
6
6
  import { STRK_TOKEN_ADDRESS as E } from "../../chains/starknet/constants.js";
7
- import { isEqualAddress as F } from "../../chains/starknet/address.js";
8
- const L = (e) => {
7
+ import { isEqualAddress as p } from "../../chains/starknet/address.js";
8
+ const j = (e) => {
9
9
  const { transactions: t } = e;
10
10
  if (!t)
11
- throw new p({ code: "SIMULATE_AND_REVIEW_FAILED" });
11
+ throw new F({ code: "SIMULATE_AND_REVIEW_FAILED" });
12
12
  if (!Array.isArray(t))
13
13
  throw Error(`Unexpected simulation response. Expected array. Got ${typeof t}`);
14
14
  if (y(t))
@@ -17,104 +17,103 @@ const L = (e) => {
17
17
  throw Error(`Unexpected simulation response length. Got ${t.length}`);
18
18
  const a = t.map((m) => {
19
19
  if (!m.simulation)
20
- throw new p({ code: "SIMULATE_AND_REVIEW_FAILED" });
20
+ throw new F({ code: "SIMULATE_AND_REVIEW_FAILED" });
21
21
  return {
22
22
  ...m.simulation,
23
- ...G(m.simulation.feeEstimations)
23
+ ...A(m.simulation.feeEstimations)
24
24
  };
25
- }), [s, n] = a.length === 1 ? [a[0], void 0] : [a[1], a[0]], r = h(s, n), i = T(s, n);
25
+ }), [s, o] = a.length === 1 ? [a[0], void 0] : [a[1], a[0]], r = h(s, o), i = G(s, o);
26
26
  return [...r, ...i];
27
- }, G = (e) => {
28
- const [t, a] = P(e, (s) => "unit" in s && s.unit === "FRI");
27
+ }, A = (e) => {
28
+ const [t, a] = v(e, (s) => "unit" in s && s.unit === "FRI");
29
29
  return { nativeFeeEstimations: t, paymasterFeeEstimations: a };
30
- }, T = (e, t) => {
30
+ }, G = (e, t) => {
31
31
  if (!e)
32
32
  return [];
33
33
  if (!t)
34
- return e.paymasterFeeEstimations.map((n) => ({
34
+ return e.paymasterFeeEstimations.map((o) => ({
35
35
  type: "paymaster",
36
- transactions: d(n),
36
+ transactions: d(o),
37
37
  deployment: void 0
38
38
  }));
39
39
  const a = t.paymasterFeeEstimations, s = e.paymasterFeeEstimations;
40
40
  if (a.length !== s.length)
41
41
  throw Error("Deployment and transaction fee estimations length mismatch");
42
- return s.map((n, r) => ({
42
+ return s.map((o, r) => ({
43
43
  type: "paymaster",
44
- transactions: d(n),
44
+ transactions: d(o),
45
45
  deployment: d(a[r])
46
46
  }));
47
47
  }, h = (e, t) => {
48
48
  if (!e)
49
49
  return [];
50
50
  if (!t)
51
- return e.nativeFeeEstimations.map((n) => ({
51
+ return e.nativeFeeEstimations.map((o) => ({
52
52
  type: "native",
53
- transactions: g(n),
53
+ transactions: g(o),
54
54
  deployment: void 0
55
55
  }));
56
56
  const a = t.nativeFeeEstimations, s = e.nativeFeeEstimations;
57
57
  if (a.length !== s.length)
58
58
  throw Error("Deployment and transaction fee estimations length mismatch");
59
- return s.map((n, r) => ({
59
+ return s.map((o, r) => ({
60
60
  type: "native",
61
- transactions: g(n),
61
+ transactions: g(o),
62
62
  deployment: g(a[r])
63
63
  }));
64
64
  }, d = (e) => ({
65
65
  feeTokenAddress: e.token.address,
66
66
  maxFee: BigInt(e.maxFee),
67
- overallFee: BigInt(e.overallFee)
67
+ overallFee: BigInt(e.overallFee),
68
+ tip: e.defaultTip ? n.toBigInt(e.defaultTip) : void 0
68
69
  }), g = (e) => ({
69
70
  feeTokenAddress: E,
70
- overallFee: o.toBigInt(e.overallFee),
71
+ overallFee: n.toBigInt(e.overallFee),
71
72
  l1Gas: {
72
- gasConsumed: o.toBigInt(e.resourceBounds.l1Gas.maxAmount),
73
- gasPrice: o.toBigInt(e.resourceBounds.l1Gas.maxPricePerUnit)
73
+ gasConsumed: n.toBigInt(e.resourceBounds.l1Gas.maxAmount),
74
+ gasPrice: n.toBigInt(e.resourceBounds.l1Gas.maxPricePerUnit)
74
75
  },
75
76
  l1DataGas: {
76
- gasConsumed: o.toBigInt(e.resourceBounds.l1DataGas.maxAmount),
77
- gasPrice: o.toBigInt(e.resourceBounds.l1DataGas.maxPricePerUnit)
77
+ gasConsumed: n.toBigInt(e.resourceBounds.l1DataGas.maxAmount),
78
+ gasPrice: n.toBigInt(e.resourceBounds.l1DataGas.maxPricePerUnit)
78
79
  },
79
80
  l2Gas: {
80
- gasConsumed: o.toBigInt(e.resourceBounds.l2Gas.maxAmount),
81
- gasPrice: o.toBigInt(e.resourceBounds.l2Gas.maxPricePerUnit)
82
- }
83
- }), b = (e) => {
84
- const { l1Gas: t, l2Gas: a, l1DataGas: s } = e.resourceBounds, n = t.maxAmount * t.maxPricePerUnit + a.maxAmount * a.maxPricePerUnit + s.maxAmount * s.maxPricePerUnit;
85
- return o.toBigInt(n);
86
- }, j = (e) => {
81
+ gasConsumed: n.toBigInt(e.resourceBounds.l2Gas.maxAmount),
82
+ gasPrice: n.toBigInt(e.resourceBounds.l2Gas.maxPricePerUnit)
83
+ },
84
+ tip: e.defaultTip ? n.toBigInt(e.defaultTip) : void 0
85
+ }), W = (e) => {
86
+ const { l1Gas: t, l2Gas: a, l1DataGas: s } = e.resourceBounds, o = t.maxAmount * t.maxPricePerUnit + a.maxAmount * a.maxPricePerUnit + s.maxAmount * s.maxPricePerUnit;
87
+ return n.toBigInt(o);
88
+ }, $ = (e) => {
87
89
  const { type: t, deployment: a, transactions: s } = e;
88
90
  if (t === "paymaster")
89
- return s.maxFee + ((a == null ? void 0 : a.maxFee) ?? 0n);
90
- if (a && !F(a.feeTokenAddress, s.feeTokenAddress))
91
+ return s.maxFee + (a?.maxFee ?? 0n);
92
+ if (a && !p(a.feeTokenAddress, s.feeTokenAddress))
91
93
  throw Error("Cannot calculate estimated fees for different tokens");
92
- const n = !s.overallFee && !(a != null && a.overallFee), r = (u) => n ? N(u) : l(u), i = a ? r(a) : 0n, m = r(s);
94
+ const o = !s.overallFee && !a?.overallFee, r = (u) => o ? w(u) : l(u), i = a ? r(a) : 0n, m = r(s);
93
95
  return i + m;
94
- }, W = (e) => {
95
- var t;
96
- return e.transactions.overallFee ? e.transactions.overallFee + (((t = e.deployment) == null ? void 0 : t.overallFee) ?? 0n) : D(e);
97
- }, _ = (e = []) => e.filter((a) => a.type === "native"), $ = (e) => e.filter((t) => t.type === "paymaster"), B = () => E, C = (e = [], t) => {
98
- const a = _(e).find((s) => F(s.transactions.feeTokenAddress, t));
96
+ }, K = (e) => e.transactions.overallFee ? e.transactions.overallFee + (e.deployment?.overallFee ?? 0n) : N(e), _ = (e = []) => e.filter((a) => a.type === "native"), O = (e) => e.filter((t) => t.type === "paymaster"), C = () => E, I = (e = [], t) => {
97
+ const a = _(e).find((s) => p(s.transactions.feeTokenAddress, t));
99
98
  if (!a)
100
99
  throw Error(`No native estimated fee found for ${t}`);
101
100
  return a;
102
- }, I = (e = []) => {
103
- const t = B();
104
- return C(e, t);
105
- }, K = (e = []) => I(e), D = (e) => {
106
- if (e.deployment && !F(e.deployment.feeTokenAddress, e.transactions.feeTokenAddress))
101
+ }, D = (e = []) => {
102
+ const t = C();
103
+ return I(e, t);
104
+ }, q = (e = []) => D(e), N = (e) => {
105
+ if (e.deployment && !p(e.deployment.feeTokenAddress, e.transactions.feeTokenAddress))
107
106
  throw Error("Cannot calculate estimated fees for different tokens");
108
107
  const t = l(e.transactions), a = e.deployment ? l(e.deployment) : 0n;
109
108
  return t + a;
110
109
  }, l = (e) => {
111
110
  const { l1Gas: t, l2Gas: a, l1DataGas: s } = e;
112
111
  return t.gasConsumed * t.gasPrice + a.gasConsumed * a.gasPrice + s.gasConsumed * s.gasPrice;
113
- }, N = (e) => l(f(e)), f = (e, t = v) => {
114
- const a = 10000n, { l1Gas: s, l2Gas: n, l1DataGas: r } = e, i = s.gasConsumed * s.gasPrice + n.gasConsumed * n.gasPrice + r.gasConsumed * r.gasPrice;
112
+ }, w = (e) => l(x(e)), x = (e, t = T) => {
113
+ const a = 10000n, { l1Gas: s, l2Gas: o, l1DataGas: r } = e, i = s.gasConsumed * s.gasPrice + o.gasConsumed * o.gasPrice + r.gasConsumed * r.gasPrice;
115
114
  if (i < 0)
116
115
  throw Error("Cannot calculate max fee for negative fee");
117
- const m = o.toBigInt(A({ estimatedFee: i })), u = Number(m) / Number(i), x = t(u), c = BigInt(Math.trunc(x * Number(a)));
116
+ const m = n.toBigInt(B({ estimatedFee: i })), u = Number(m) / Number(i), f = t(u), c = BigInt(Math.trunc(f * Number(a)));
118
117
  return {
119
118
  ...e,
120
119
  l1Gas: {
@@ -122,48 +121,53 @@ const L = (e) => {
122
121
  gasPrice: s.gasPrice * c / a
123
122
  },
124
123
  l2Gas: {
125
- gasConsumed: n.gasConsumed * c / a,
126
- gasPrice: n.gasPrice * c / a
124
+ gasConsumed: o.gasConsumed * c / a,
125
+ gasPrice: o.gasPrice * c / a
127
126
  },
128
127
  l1DataGas: {
129
128
  gasConsumed: r.gasConsumed * c / a,
130
129
  gasPrice: r.gasPrice * c / a
131
130
  }
132
131
  };
133
- }, O = (e) => {
134
- const t = e.overallFee ? e : f(e);
132
+ }, k = (e) => {
133
+ const t = e.overallFee ? e : x(e);
135
134
  return {
135
+ ...e,
136
136
  resourceBounds: {
137
- l1_gas: w(t.l1Gas),
137
+ l1_gas: M(t.l1Gas),
138
138
  l2_gas: {
139
- max_amount: o.toHex(t.l2Gas.gasConsumed),
140
- max_price_per_unit: o.toHex(t.l2Gas.gasPrice)
139
+ max_amount: n.toHex(t.l2Gas.gasConsumed),
140
+ max_price_per_unit: n.toHex(t.l2Gas.gasPrice)
141
141
  },
142
142
  l1_data_gas: {
143
- max_amount: o.toHex(t.l1DataGas.gasConsumed),
144
- max_price_per_unit: o.toHex(t.l1DataGas.gasPrice)
143
+ max_amount: n.toHex(t.l1DataGas.gasConsumed),
144
+ max_price_per_unit: n.toHex(t.l1DataGas.gasPrice)
145
145
  }
146
146
  }
147
147
  };
148
- }, w = (e) => ({
149
- max_amount: o.toHex(e.gasConsumed),
150
- max_price_per_unit: o.toHex(e.gasPrice)
148
+ }, z = (e) => ({
149
+ ...e,
150
+ resourceBounds: P.resourceBoundsToBigInt(k(e).resourceBounds)
151
+ }), M = (e) => ({
152
+ max_amount: n.toHex(e.gasConsumed),
153
+ max_price_per_unit: n.toHex(e.gasPrice)
151
154
  });
152
155
  export {
153
- N as estimatedFeeToMaxFeeTotal,
154
- O as estimatedFeeToMaxResourceBounds,
156
+ w as estimatedFeeToMaxFeeTotal,
157
+ k as estimatedFeeToMaxResourceBounds,
158
+ z as estimatedFeeToMaxResourceBoundsBN,
155
159
  l as estimatedFeeToTotal,
156
- j as estimatedFeesToMaxFeeTotalV2,
157
- D as estimatedFeesToTotal,
158
- W as estimatedFeesToTotalWithOverallFee,
159
- $ as filterPaymasterEstimatedFees,
160
- L as getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2,
161
- C as getNativeEstimatedFeeByFeeToken,
162
- I as getNativeEstimatedFeeByTxVersion,
163
- K as getNativeEstimatedFeeForAccount,
160
+ $ as estimatedFeesToMaxFeeTotalV2,
161
+ N as estimatedFeesToTotal,
162
+ K as estimatedFeesToTotalWithOverallFee,
163
+ O as filterPaymasterEstimatedFees,
164
+ j as getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2,
165
+ I as getNativeEstimatedFeeByFeeToken,
166
+ D as getNativeEstimatedFeeByTxVersion,
167
+ q as getNativeEstimatedFeeForAccount,
164
168
  _ as getNativeEstimatedFees,
165
169
  h as getNativeFeeFromSimulation,
166
- B as getNativeFeeTokenAddress,
167
- T as getPaymasterFeeFromSimulation,
168
- b as toMaxFeeEstimation
170
+ C as getNativeFeeTokenAddress,
171
+ G as getPaymasterFeeFromSimulation,
172
+ W as toMaxFeeEstimation
169
173
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("starknet"),E=require("url-join"),d=require("../../errors/review.cjs"),v=require("./utils.cjs"),S=require("../../utils/url/urlWithQuery.cjs"),w=require("../../features/simulation/transactionReview/schema.cjs"),I=require("../estimate/utils.cjs"),T=require("../../utils/arrays.cjs");class F{constructor(e,a){this.apiBase=e,this.httpService=a}async getLabels(){const e=E(this.apiBase,"reviewer","labels");return await this.httpService.get(e)}async getWarnings(){const e=E(this.apiBase,"reviewer","warnings/reasons");return await this.httpService.get(e)}async simulateAndReview(e,a,l,n,o,r){var g;const i=a.some(s=>s.type==="DEPLOY_ACCOUNT");try{if(!("getChainId"in e))throw new Error("MISSING_METHOD");const s=p.constants.TRANSACTION_VERSION.V3,t=i?"0x0":await e.getNonce(),c=await e.getChainId(),m={transactions:a.map(h=>({...v.getPayloadFromTransaction({transaction:h,nonce:t,version:s,chainId:c,isDeploymentTransaction:i,appDomain:n,cairoVersion:e.cairoVersion,address:e.address}),type:h.type}))},_=E(this.apiBase,"reviewer","transactions","v2","review","starknet"),y=r?S.urlWithQuery(_,{delayedTransactions:"true"}):_,u=await this.httpService.post(y,{headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(m)},w.simulateAndReviewSchema);if((g=u.transactions)==null?void 0:g.some(h=>w.isTransactionSimulationError(h)))return u;const C=I.getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2(u);return{...u,enrichedFeeEstimation:C}}catch(s){return console.error(s),this.fallbackToOnchainFeeEstimation({transactions:a,account:e,isDeploymentTransaction:i,feeTokenAddress:l,accountDeployTransaction:o})}}getCallsFromTx(e){let a;return e.calls&&(a=T.ensureArray(e.calls)),a}async fallbackToOnchainFeeEstimation({transactions:e,account:a,isDeploymentTransaction:l,feeTokenAddress:n,accountDeployTransaction:o}){try{const r=l?this.getCallsFromTx(e[1]):this.getCallsFromTx(e[0]);if(!r)throw new d.ReviewError({code:"NO_CALLS_FOUND"});const i=await this.fetchFeesOnchain({starknetAccount:a,calls:r,isDeployed:!l,feeTokenAddress:n,accountDeployTransaction:o});return{transactions:[],enrichedFeeEstimation:i,isBackendDown:!0}}catch(r){throw console.error(r),new d.ReviewError({message:`${r}`,code:"SIMULATE_AND_REVIEW_FAILED"})}}async fetchFeesOnchain({starknetAccount:e,calls:a,isDeployed:l,feeTokenAddress:n,accountDeployTransaction:o}){try{const r=p.constants.TRANSACTION_VERSION.V3,i={type:"native",transactions:{feeTokenAddress:n,l1Gas:{gasConsumed:0n,gasPrice:0n},l2Gas:{gasConsumed:0n,gasPrice:0n},l1DataGas:{gasConsumed:0n,gasPrice:0n}}};if(!l&&o){if("estimateFeeBulk"in e){const g=[{type:p.TransactionType.DEPLOY_ACCOUNT,payload:{classHash:o.classHash,addressSalt:o.salt,constructorCalldata:o.calldata,contractAddress:e.address}},{type:p.TransactionType.INVOKE,payload:a}],[s,t]=await e.estimateFeeBulk(g,{version:r}).catch(c=>{throw console.error(c),c});if(!s.l1_gas_consumed||!s.l1_gas_price||!s.l2_gas_consumed||!s.l2_gas_price||!t.l2_gas_consumed||!t.l2_gas_price)throw new d.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:"Missing gas_consumed or gas_price"});i.deployment={feeTokenAddress:n,l1Gas:{gasConsumed:s.l1_gas_consumed,gasPrice:s.l1_gas_price},l2Gas:{gasConsumed:s.l2_gas_consumed,gasPrice:s.l2_gas_price},l1DataGas:{gasConsumed:s.l1_data_gas_consumed,gasPrice:s.l1_data_gas_price}},i.transactions={feeTokenAddress:n,l1Gas:{gasConsumed:t.l1_gas_consumed,gasPrice:t.l1_gas_price},l2Gas:{gasConsumed:t.l2_gas_consumed,gasPrice:t.l2_gas_price},l1DataGas:{gasConsumed:t.l1_data_gas_consumed,gasPrice:t.l1_data_gas_price}}}}else{const{l1_data_gas_price:g,l1_data_gas_consumed:s,l1_gas_consumed:t,l2_gas_price:c,l2_gas_consumed:m,l1_gas_price:_}=await e.estimateFee(a,{skipValidate:!0,version:r});if(!t||!_||!m||!c)throw new d.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:"Missing gas_consumed or gas_price"});i.transactions={feeTokenAddress:n,l1Gas:{gasConsumed:t,gasPrice:_},l2Gas:{gasConsumed:m,gasPrice:c},l1DataGas:{gasConsumed:s,gasPrice:g}}}return[i]}catch(r){throw new d.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:`${r}`})}}}exports.TransactionReviewServiceWeb=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("starknet"),g=require("url-join"),l=require("../../errors/review.cjs"),y=require("./utils.cjs"),C=require("../../utils/url/urlWithQuery.cjs"),h=require("../../features/simulation/transactionReview/schema.cjs"),B=require("../estimate/utils.cjs"),v=require("../../utils/arrays.cjs");class F{constructor(e,a){this.apiBase=e,this.httpService=a}async getLabels(){const e=g(this.apiBase,"reviewer","labels");return await this.httpService.get(e)}async getWarnings(){const e=g(this.apiBase,"reviewer","warnings/reasons");return await this.httpService.get(e)}async simulateAndReview(e,a,c,i,o,t){const s=a.some(r=>r.type==="DEPLOY_ACCOUNT");try{if(!("getChainId"in e))throw new Error("MISSING_METHOD");const r=s?"0x0":await e.getNonce(),n=await e.getChainId(),u={transactions:a.map(d=>({...y.getPayloadFromTransaction({transaction:d,nonce:r,chainId:n,isDeploymentTransaction:s,appDomain:i,cairoVersion:e.cairoVersion,address:e.address}),type:d.type}))},m=g(this.apiBase,"reviewer","transactions","v2","review","starknet"),w=t?C.urlWithQuery(m,{delayedTransactions:"true"}):m,_=await this.httpService.post(w,{headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(u)},h.simulateAndReviewSchema);if(_.transactions?.some(d=>h.isTransactionSimulationError(d)))return _;const E=B.getEstimatedFeeFromSimulationAndRespectWatermarkFeeV2(_);return{..._,enrichedFeeEstimation:E}}catch(r){return console.error(r),this.fallbackToOnchainFeeEstimation({transactions:a,account:e,isDeploymentTransaction:s,feeTokenAddress:c,accountDeployTransaction:o})}}getCallsFromTx(e){let a;return e.calls&&(a=v.ensureArray(e.calls)),a}async fallbackToOnchainFeeEstimation({transactions:e,account:a,isDeploymentTransaction:c,feeTokenAddress:i,accountDeployTransaction:o}){try{const t=c?this.getCallsFromTx(e[1]):this.getCallsFromTx(e[0]);if(!t)throw new l.ReviewError({code:"NO_CALLS_FOUND"});const s=await this.fetchFeesOnchain({starknetAccount:a,calls:t,isDeployed:!c,feeTokenAddress:i,accountDeployTransaction:o});return{transactions:[],enrichedFeeEstimation:s,isBackendDown:!0}}catch(t){throw console.error(t),new l.ReviewError({message:`${t}`,code:"SIMULATE_AND_REVIEW_FAILED"})}}async fetchFeesOnchain({starknetAccount:e,calls:a,isDeployed:c,feeTokenAddress:i,accountDeployTransaction:o}){try{const t={type:"native",transactions:{feeTokenAddress:i,l1Gas:{gasConsumed:0n,gasPrice:0n},l2Gas:{gasConsumed:0n,gasPrice:0n},l1DataGas:{gasConsumed:0n,gasPrice:0n}}};if(!c&&o){if("estimateFeeBulk"in e){const s=[{type:p.TransactionType.DEPLOY_ACCOUNT,payload:{classHash:o.classHash,addressSalt:o.salt,constructorCalldata:o.calldata,contractAddress:e.address}},{type:p.TransactionType.INVOKE,payload:a}],[r,n]=await e.estimateFeeBulk(s).catch(u=>{throw console.error(u),u});if(!r.resourceBounds.l1_data_gas||!r.resourceBounds.l1_gas||!r.resourceBounds.l2_gas||!n.resourceBounds.l1_data_gas||!n.resourceBounds.l1_gas||!n.resourceBounds.l2_gas)throw new l.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:"Missing gas_consumed or gas_price"});t.deployment={feeTokenAddress:i,l1Gas:{gasConsumed:r.resourceBounds.l1_gas.max_amount,gasPrice:r.resourceBounds.l1_gas.max_price_per_unit},l2Gas:{gasConsumed:r.resourceBounds.l2_gas.max_amount,gasPrice:r.resourceBounds.l2_gas.max_price_per_unit},l1DataGas:{gasConsumed:r.resourceBounds.l1_data_gas.max_amount,gasPrice:r.resourceBounds.l1_data_gas.max_price_per_unit}},t.transactions={feeTokenAddress:i,l1Gas:{gasConsumed:n.resourceBounds.l1_gas.max_amount,gasPrice:n.resourceBounds.l1_gas.max_price_per_unit},l2Gas:{gasConsumed:n.resourceBounds.l2_gas.max_amount,gasPrice:n.resourceBounds.l2_gas.max_price_per_unit},l1DataGas:{gasConsumed:n.resourceBounds.l1_data_gas.max_amount,gasPrice:n.resourceBounds.l1_data_gas.max_price_per_unit}}}}else{const{resourceBounds:s}=await e.estimateInvokeFee(a);if(!s.l1_gas||!s.l2_gas||!s.l1_data_gas)throw new l.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:"Missing gas_consumed or gas_price"});t.transactions={feeTokenAddress:i,l1Gas:{gasConsumed:s.l1_gas.max_amount,gasPrice:s.l1_gas.max_price_per_unit},l2Gas:{gasConsumed:s.l2_gas.max_amount,gasPrice:s.l2_gas.max_price_per_unit},l1DataGas:{gasConsumed:s.l1_data_gas.max_amount,gasPrice:s.l1_data_gas.max_price_per_unit}}}return[t]}catch(t){throw new l.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:`${t}`})}}}exports.TransactionReviewServiceWeb=F;
@@ -50,6 +50,7 @@ export declare class TransactionReviewServiceWeb implements ITransactionReviewSe
50
50
  gasPrice: bigint;
51
51
  };
52
52
  overallFee?: bigint | undefined;
53
+ tip?: bigint | undefined;
53
54
  };
54
55
  deployment?: {
55
56
  feeTokenAddress: `0x${string}`;
@@ -66,6 +67,7 @@ export declare class TransactionReviewServiceWeb implements ITransactionReviewSe
66
67
  gasPrice: bigint;
67
68
  };
68
69
  overallFee?: bigint | undefined;
70
+ tip?: bigint | undefined;
69
71
  } | undefined;
70
72
  } | {
71
73
  type: "paymaster";
@@ -73,11 +75,13 @@ export declare class TransactionReviewServiceWeb implements ITransactionReviewSe
73
75
  feeTokenAddress: `0x${string}`;
74
76
  overallFee: bigint;
75
77
  maxFee: bigint;
78
+ tip?: bigint | undefined;
76
79
  };
77
80
  deployment?: {
78
81
  feeTokenAddress: `0x${string}`;
79
82
  overallFee: bigint;
80
83
  maxFee: bigint;
84
+ tip?: bigint | undefined;
81
85
  } | undefined;
82
86
  })[];
83
87
  isBackendDown: boolean;