@argent/x-shared 1.74.2 → 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 (79) 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/weierstrass.cjs +1 -1
  4. package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js +12 -13
  5. package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.cjs +1 -1
  6. package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js +60 -60
  7. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.cjs +1 -1
  8. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js +1 -1
  9. package/dist/src/chains/starknet/address.cjs +1 -1
  10. package/dist/src/chains/starknet/address.js +16 -16
  11. package/dist/src/features/defiDecomposition/helpers/computeCollateralizedDebtPositionsUsdValue.cjs +1 -1
  12. package/dist/src/features/defiDecomposition/helpers/computeCollateralizedDebtPositionsUsdValue.js +27 -27
  13. package/dist/src/features/defiDecomposition/helpers/computeConcentratedLiquidityPositionsUsdValue.cjs +1 -1
  14. package/dist/src/features/defiDecomposition/helpers/computeConcentratedLiquidityPositionsUsdValue.js +22 -22
  15. package/dist/src/features/defiDecomposition/helpers/computeDelegatedTokensPositionsUsdValue.cjs +1 -1
  16. package/dist/src/features/defiDecomposition/helpers/computeDelegatedTokensPositionsUsdValue.js +14 -14
  17. package/dist/src/features/defiDecomposition/helpers/computeStakingPositionsUsdValue.cjs +1 -1
  18. package/dist/src/features/defiDecomposition/helpers/computeStakingPositionsUsdValue.js +9 -9
  19. package/dist/src/features/defiDecomposition/helpers/computeStrkDelegatedStakingPositionsUsdValue.cjs +1 -1
  20. package/dist/src/features/defiDecomposition/helpers/computeStrkDelegatedStakingPositionsUsdValue.js +13 -13
  21. package/dist/src/features/defiDecomposition/helpers/parseCollateralizedDebtPositions.cjs +1 -1
  22. package/dist/src/features/defiDecomposition/helpers/parseCollateralizedDebtPositions.js +24 -25
  23. package/dist/src/features/simulation/activity/normalize.cjs +1 -1
  24. package/dist/src/features/simulation/activity/normalize.js +12 -13
  25. package/dist/src/features/simulation/activity/utils/createNativeActivity.cjs +1 -1
  26. package/dist/src/features/simulation/activity/utils/createNativeActivity.js +22 -24
  27. package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.cjs +1 -1
  28. package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.js +11 -12
  29. package/dist/src/features/simulation/activity/utils/hasDelegationActivity.cjs +1 -1
  30. package/dist/src/features/simulation/activity/utils/hasDelegationActivity.js +2 -8
  31. package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.cjs +1 -1
  32. package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.js +4 -8
  33. package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.cjs +1 -1
  34. package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.js +4 -8
  35. package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.cjs +1 -1
  36. package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.js +3 -9
  37. package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.cjs +1 -1
  38. package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.js +15 -19
  39. package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.cjs +1 -1
  40. package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.js +4 -8
  41. package/dist/src/features/simulation/activity/utils/isSwapActivity.cjs +1 -1
  42. package/dist/src/features/simulation/activity/utils/isSwapActivity.js +9 -16
  43. package/dist/src/features/simulation/activity/utils/isUpgradeActivity.cjs +1 -1
  44. package/dist/src/features/simulation/activity/utils/isUpgradeActivity.js +4 -8
  45. package/dist/src/features/simulation/fees/schema.cjs +1 -1
  46. package/dist/src/features/simulation/fees/schema.d.ts +16 -0
  47. package/dist/src/features/simulation/fees/schema.js +8 -6
  48. package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.cjs +1 -1
  49. package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.js +10 -11
  50. package/dist/src/features/simulation/transactionReview/schema.cjs +1 -1
  51. package/dist/src/features/simulation/transactionReview/schema.d.ts +23 -0
  52. package/dist/src/features/simulation/transactionReview/schema.js +20 -18
  53. package/dist/src/features/swap/services/SwapTransactionService.cjs +1 -1
  54. package/dist/src/features/swap/services/SwapTransactionService.js +46 -49
  55. package/dist/src/http/HttpService.cjs +1 -1
  56. package/dist/src/http/HttpService.js +55 -55
  57. package/dist/src/knownDapps/utils/getDapplandUrl.cjs +1 -1
  58. package/dist/src/knownDapps/utils/getDapplandUrl.js +6 -8
  59. package/dist/src/nfts/BackendNftService.cjs +1 -1
  60. package/dist/src/nfts/BackendNftService.js +15 -16
  61. package/dist/src/tokens/service/implementation.cjs +1 -1
  62. package/dist/src/tokens/service/implementation.js +12 -12
  63. package/dist/src/transactions/estimate/utils.cjs +1 -1
  64. package/dist/src/transactions/estimate/utils.d.ts +33 -0
  65. package/dist/src/transactions/estimate/utils.js +80 -76
  66. package/dist/src/transactions/service/implementation.cjs +1 -1
  67. package/dist/src/transactions/service/implementation.d.ts +4 -0
  68. package/dist/src/transactions/service/implementation.js +89 -96
  69. package/dist/src/transactions/service/utils.cjs +1 -1
  70. package/dist/src/transactions/service/utils.d.ts +2 -3
  71. package/dist/src/transactions/service/utils.js +12 -11
  72. package/dist/src/transactions/transactionVersion.cjs +1 -1
  73. package/dist/src/transactions/transactionVersion.d.ts +2 -0
  74. package/dist/src/transactions/transactionVersion.js +12 -10
  75. package/dist/src/utils/readFileAsString.cjs +1 -1
  76. package/dist/src/utils/readFileAsString.js +3 -6
  77. package/package.json +5 -5
  78. 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
  79. 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
@@ -576,6 +576,7 @@ export declare const paymasterFeeEstimationSchema: z.ZodObject<{
576
576
  }, z.core.$strip>;
577
577
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
578
578
  maxFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
579
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
579
580
  }, z.core.$strip>;
580
581
  export declare const feeEstimationSchema: z.ZodObject<{
581
582
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
@@ -599,6 +600,7 @@ export declare const feeEstimationSchema: z.ZodObject<{
599
600
  unknown: z.ZodBoolean;
600
601
  type: z.ZodLiteral<"ERC20">;
601
602
  }, z.core.$strip>;
603
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
602
604
  }, z.core.$strip>;
603
605
  export declare const feeEstimationNativeOrPaymasterSchema: z.ZodUnion<[z.ZodObject<{
604
606
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
@@ -622,6 +624,7 @@ export declare const feeEstimationNativeOrPaymasterSchema: z.ZodUnion<[z.ZodObje
622
624
  unknown: z.ZodBoolean;
623
625
  type: z.ZodLiteral<"ERC20">;
624
626
  }, z.core.$strip>;
627
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
625
628
  }, z.core.$strip>, z.ZodObject<{
626
629
  token: z.ZodObject<{
627
630
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -630,6 +633,7 @@ export declare const feeEstimationNativeOrPaymasterSchema: z.ZodUnion<[z.ZodObje
630
633
  }, z.core.$strip>;
631
634
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
632
635
  maxFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
636
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
633
637
  }, z.core.$strip>]>;
634
638
  declare const summarySchema: z.ZodObject<{
635
639
  type: z.ZodString;
@@ -753,6 +757,7 @@ declare const simulationSchema: z.ZodObject<{
753
757
  unknown: z.ZodBoolean;
754
758
  type: z.ZodLiteral<"ERC20">;
755
759
  }, z.core.$strip>;
760
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
756
761
  }, z.core.$strip>;
757
762
  feeEstimations: z.ZodArray<z.ZodUnion<[z.ZodObject<{
758
763
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
@@ -776,6 +781,7 @@ declare const simulationSchema: z.ZodObject<{
776
781
  unknown: z.ZodBoolean;
777
782
  type: z.ZodLiteral<"ERC20">;
778
783
  }, z.core.$strip>;
784
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
779
785
  }, z.core.$strip>, z.ZodObject<{
780
786
  token: z.ZodObject<{
781
787
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -784,6 +790,7 @@ declare const simulationSchema: z.ZodObject<{
784
790
  }, z.core.$strip>;
785
791
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
786
792
  maxFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
793
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
787
794
  }, z.core.$strip>]>>;
788
795
  summary: z.ZodOptional<z.ZodArray<z.ZodObject<{
789
796
  type: z.ZodString;
@@ -1091,6 +1098,7 @@ declare const transactionSimulationSchema: z.ZodObject<{
1091
1098
  unknown: z.ZodBoolean;
1092
1099
  type: z.ZodLiteral<"ERC20">;
1093
1100
  }, z.core.$strip>;
1101
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
1094
1102
  }, z.core.$strip>;
1095
1103
  feeEstimations: z.ZodArray<z.ZodUnion<[z.ZodObject<{
1096
1104
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
@@ -1114,6 +1122,7 @@ declare const transactionSimulationSchema: z.ZodObject<{
1114
1122
  unknown: z.ZodBoolean;
1115
1123
  type: z.ZodLiteral<"ERC20">;
1116
1124
  }, z.core.$strip>;
1125
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
1117
1126
  }, z.core.$strip>, z.ZodObject<{
1118
1127
  token: z.ZodObject<{
1119
1128
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -1122,6 +1131,7 @@ declare const transactionSimulationSchema: z.ZodObject<{
1122
1131
  }, z.core.$strip>;
1123
1132
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
1124
1133
  maxFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
1134
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
1125
1135
  }, z.core.$strip>]>>;
1126
1136
  summary: z.ZodOptional<z.ZodArray<z.ZodObject<{
1127
1137
  type: z.ZodString;
@@ -1610,6 +1620,7 @@ declare const transactionSchema: z.ZodUnion<[z.ZodObject<{
1610
1620
  unknown: z.ZodBoolean;
1611
1621
  type: z.ZodLiteral<"ERC20">;
1612
1622
  }, z.core.$strip>;
1623
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
1613
1624
  }, z.core.$strip>;
1614
1625
  feeEstimations: z.ZodArray<z.ZodUnion<[z.ZodObject<{
1615
1626
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
@@ -1633,6 +1644,7 @@ declare const transactionSchema: z.ZodUnion<[z.ZodObject<{
1633
1644
  unknown: z.ZodBoolean;
1634
1645
  type: z.ZodLiteral<"ERC20">;
1635
1646
  }, z.core.$strip>;
1647
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
1636
1648
  }, z.core.$strip>, z.ZodObject<{
1637
1649
  token: z.ZodObject<{
1638
1650
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -1641,6 +1653,7 @@ declare const transactionSchema: z.ZodUnion<[z.ZodObject<{
1641
1653
  }, z.core.$strip>;
1642
1654
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
1643
1655
  maxFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
1656
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
1644
1657
  }, z.core.$strip>]>>;
1645
1658
  summary: z.ZodOptional<z.ZodArray<z.ZodObject<{
1646
1659
  type: z.ZodString;
@@ -2144,6 +2157,7 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
2144
2157
  unknown: z.ZodBoolean;
2145
2158
  type: z.ZodLiteral<"ERC20">;
2146
2159
  }, z.core.$strip>;
2160
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
2147
2161
  }, z.core.$strip>;
2148
2162
  feeEstimations: z.ZodArray<z.ZodUnion<[z.ZodObject<{
2149
2163
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
@@ -2167,6 +2181,7 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
2167
2181
  unknown: z.ZodBoolean;
2168
2182
  type: z.ZodLiteral<"ERC20">;
2169
2183
  }, z.core.$strip>;
2184
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
2170
2185
  }, z.core.$strip>, z.ZodObject<{
2171
2186
  token: z.ZodObject<{
2172
2187
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -2175,6 +2190,7 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
2175
2190
  }, z.core.$strip>;
2176
2191
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
2177
2192
  maxFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
2193
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
2178
2194
  }, z.core.$strip>]>>;
2179
2195
  summary: z.ZodOptional<z.ZodArray<z.ZodObject<{
2180
2196
  type: z.ZodString;
@@ -2673,6 +2689,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
2673
2689
  unknown: z.ZodBoolean;
2674
2690
  type: z.ZodLiteral<"ERC20">;
2675
2691
  }, z.core.$strip>;
2692
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
2676
2693
  }, z.core.$strip>;
2677
2694
  feeEstimations: z.ZodArray<z.ZodUnion<[z.ZodObject<{
2678
2695
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
@@ -2696,6 +2713,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
2696
2713
  unknown: z.ZodBoolean;
2697
2714
  type: z.ZodLiteral<"ERC20">;
2698
2715
  }, z.core.$strip>;
2716
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
2699
2717
  }, z.core.$strip>, z.ZodObject<{
2700
2718
  token: z.ZodObject<{
2701
2719
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -2704,6 +2722,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
2704
2722
  }, z.core.$strip>;
2705
2723
  overallFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
2706
2724
  maxFee: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>;
2725
+ defaultTip: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, string | number | bigint>>>;
2707
2726
  }, z.core.$strip>]>>;
2708
2727
  summary: z.ZodOptional<z.ZodArray<z.ZodObject<{
2709
2728
  type: z.ZodString;
@@ -2954,6 +2973,7 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
2954
2973
  gasPrice: z.ZodBigInt;
2955
2974
  }, z.core.$strip>;
2956
2975
  overallFee: z.ZodOptional<z.ZodBigInt>;
2976
+ tip: z.ZodOptional<z.ZodBigInt>;
2957
2977
  }, z.core.$strip>;
2958
2978
  deployment: z.ZodOptional<z.ZodObject<{
2959
2979
  feeTokenAddress: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodString>, z.ZodTransform<`0x${string}`, string>>;
@@ -2970,17 +2990,20 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
2970
2990
  gasPrice: z.ZodBigInt;
2971
2991
  }, z.core.$strip>;
2972
2992
  overallFee: z.ZodOptional<z.ZodBigInt>;
2993
+ tip: z.ZodOptional<z.ZodBigInt>;
2973
2994
  }, z.core.$strip>>;
2974
2995
  }, z.core.$strip>, z.ZodObject<{
2975
2996
  type: z.ZodLiteral<"paymaster">;
2976
2997
  transactions: z.ZodObject<{
2977
2998
  feeTokenAddress: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodString>, z.ZodTransform<`0x${string}`, string>>;
2978
2999
  overallFee: z.ZodBigInt;
3000
+ tip: z.ZodOptional<z.ZodBigInt>;
2979
3001
  maxFee: z.ZodBigInt;
2980
3002
  }, z.core.$strip>;
2981
3003
  deployment: z.ZodOptional<z.ZodObject<{
2982
3004
  feeTokenAddress: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodString>, z.ZodTransform<`0x${string}`, string>>;
2983
3005
  overallFee: z.ZodBigInt;
3006
+ tip: z.ZodOptional<z.ZodBigInt>;
2984
3007
  maxFee: z.ZodBigInt;
2985
3008
  }, z.core.$strip>>;
2986
3009
  }, z.core.$strip>]>>>;
@@ -114,7 +114,7 @@ const v = t.object({
114
114
  preview: t.string().nullable().optional(),
115
115
  full: t.string().nullable().optional(),
116
116
  original: t.string().nullable().optional()
117
- }), A = t.object({
117
+ }), T = t.object({
118
118
  twitter: t.string().optional(),
119
119
  external: t.string().optional(),
120
120
  discord: t.string().optional()
@@ -129,15 +129,15 @@ const v = t.object({
129
129
  iconUrl: t.string().optional(),
130
130
  unknown: t.boolean().optional(),
131
131
  imageUrls: p.optional(),
132
- links: A.optional()
133
- }), _ = t.object({
132
+ links: T.optional()
133
+ }), A = t.object({
134
134
  tokenAddress: o,
135
135
  owner: o,
136
136
  spender: o,
137
137
  value: t.string().optional(),
138
138
  approvalForAll: t.boolean(),
139
139
  details: s.optional()
140
- }), x = t.object({
140
+ }), _ = t.object({
141
141
  tokenAddress: o,
142
142
  from: o,
143
143
  to: o,
@@ -151,20 +151,22 @@ const v = t.object({
151
151
  }), i = t.object({
152
152
  maxAmount: n,
153
153
  maxPricePerUnit: n
154
- }), T = t.object({
154
+ }), x = t.object({
155
155
  l1Gas: i,
156
156
  l1DataGas: i,
157
157
  l2Gas: i
158
158
  }), N = t.object({
159
159
  token: m,
160
160
  overallFee: n,
161
- maxFee: n
162
- }), b = t.object({
161
+ maxFee: n,
162
+ defaultTip: n.optional()
163
+ }), d = t.object({
163
164
  overallFee: n,
164
- resourceBounds: T,
165
+ resourceBounds: x,
165
166
  unit: t.string().transform((a) => a.toUpperCase()).pipe(t.literal("FRI")),
166
- token: m
167
- }), P = b.or(N), R = t.object({
167
+ token: m,
168
+ defaultTip: n.optional()
169
+ }), P = d.or(N), R = t.object({
168
170
  type: t.string(),
169
171
  label: t.string(),
170
172
  tokenId: t.string().optional(),
@@ -178,10 +180,10 @@ const v = t.object({
178
180
  imageUrls: p.optional()
179
181
  }).optional()
180
182
  }), I = t.object({
181
- approvals: t.array(_).optional(),
182
- transfers: t.array(x).optional(),
183
+ approvals: t.array(A).optional(),
184
+ transfers: t.array(_).optional(),
183
185
  calculatedNonce: t.string().optional(),
184
- feeEstimation: b,
186
+ feeEstimation: d,
185
187
  feeEstimations: t.array(P),
186
188
  summary: t.array(R).optional()
187
189
  }), O = t.object({
@@ -189,7 +191,7 @@ const v = t.object({
189
191
  code: t.number().optional(),
190
192
  message: t.string().optional(),
191
193
  error: t.string().optional()
192
- }), d = t.object({
194
+ }), b = t.object({
193
195
  reviewOfTransaction: c,
194
196
  simulation: I,
195
197
  simulationError: t.undefined().optional()
@@ -197,7 +199,7 @@ const v = t.object({
197
199
  reviewOfTransaction: c,
198
200
  simulation: t.undefined().optional(),
199
201
  simulationError: O
200
- }), u = d.or(g), S = t.object({
202
+ }), u = b.or(g), S = t.object({
201
203
  subsidiseDeployment: t.boolean(),
202
204
  subsidiseTransaction: t.boolean()
203
205
  }), B = t.object({
@@ -217,7 +219,7 @@ const v = t.object({
217
219
  promotions: h.optional()
218
220
  });
219
221
  function J(a) {
220
- return d.safeParse(a).success;
222
+ return b.safeParse(a).success;
221
223
  }
222
224
  function K(a) {
223
225
  return g.safeParse(a).success;
@@ -228,8 +230,8 @@ export {
228
230
  q as enrichedSimulateAndReviewSchema,
229
231
  i as feeEstimationGasSchema,
230
232
  P as feeEstimationNativeOrPaymasterSchema,
231
- T as feeEstimationResourceBoundSchema,
232
- b as feeEstimationSchema,
233
+ x as feeEstimationResourceBoundSchema,
234
+ d as feeEstimationSchema,
233
235
  J as isNotTransactionSimulationError,
234
236
  K as isTransactionSimulationError,
235
237
  N as paymasterFeeEstimationSchema,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("lodash-es"),w=require("starknet"),B=require("../../../transactions/transactionExecuteTypes.cjs"),E=require("../../../../node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.cjs"),U=require("../../../utils/url/urlWithQuery.cjs");class T{constructor(n="",i){this.argentAffiliateUrl=n,this.httpService=i}async execute({paymasterParams:n,transactionParams:i,isSubsidised:A,currency:v}){if(q.isEmpty(this.argentAffiliateUrl))throw new Error("Argent affiliate URL is not set");let o;n?o={executeRequest:{...n,signature:n.signature,deploymentData:n.deploymentData,userAddress:n.accountAddress,typedData:n.typedData},isSubsidised:A}:o={transactions:i==null?void 0:i.map(e=>{var r,c,u,a,l,d,p,_,f,g,y,h;const t={type:e.type,calls:e.calls,chainId:e.chainId,cairoVersion:e.cairoVersion,account:e.account,signature:e.signature,nonce:e.nonce,version:e.version};return e.version===E.ETransactionVersion.V1?t.maxFee=e.maxFee:(t.resourceBounds={l1Gas:{maxAmount:(c=(r=e.resourceBounds)==null?void 0:r.l1_gas)==null?void 0:c.max_amount,maxPricePerUnit:(a=(u=e.resourceBounds)==null?void 0:u.l1_gas)==null?void 0:a.max_price_per_unit},l2Gas:{maxAmount:(d=(l=e.resourceBounds)==null?void 0:l.l2_gas)==null?void 0:d.max_amount,maxPricePerUnit:(_=(p=e.resourceBounds)==null?void 0:p.l2_gas)==null?void 0:_.max_price_per_unit},l1DataGas:{maxAmount:(g=(f=e.resourceBounds)==null?void 0:f.l1_data_gas)==null?void 0:g.max_amount,maxPricePerUnit:(h=(y=e.resourceBounds)==null?void 0:y.l1_data_gas)==null?void 0:h.max_price_per_unit}},t.nonceDataAvailabilityMode=e.nonceDataAvailabilityMode,t.feeDataAvailabilityMode=e.feeDataAvailabilityMode,t.tip=e.tip),t})};const D={currency:v},S=U.urlWithQuery(this.argentAffiliateUrl,D),b=await this.httpService.post(S,{body:w.json.stringify(o),headers:{"Content-Type":"application/json"}}),s=B.transactionExecutionResponseSchema.safeParse(b);if(!s.success)throw new Error("Invalid response from swap API");return s.data}}exports.SwapTransactionService=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("lodash-es"),a=require("starknet"),g=require("../../../transactions/transactionExecuteTypes.cjs"),f=require("../../../utils/url/urlWithQuery.cjs");class y{constructor(t="",o){this.argentAffiliateUrl=t,this.httpService=o}async execute({paymasterParams:t,transactionParams:o,isSubsidised:c,currency:u}){if(_.isEmpty(this.argentAffiliateUrl))throw new Error("Argent affiliate URL is not set");let s;t?s={executeRequest:{...t,signature:t.signature,deploymentData:t.deploymentData,userAddress:t.accountAddress,typedData:t.typedData},isSubsidised:c}:s={transactions:o?.map(e=>{const n=e.resourceBounds?a.stark.resourceBoundsToHexString(e.resourceBounds):void 0,i={type:e.type,calls:e.calls,chainId:e.chainId,cairoVersion:e.cairoVersion,account:e.account,signature:e.signature,nonce:e.nonce,version:e.version,resourceBounds:{l1Gas:{maxAmount:n?.l1_gas?.max_amount,maxPricePerUnit:n?.l1_gas?.max_price_per_unit},l2Gas:{maxAmount:n?.l2_gas?.max_amount,maxPricePerUnit:n?.l2_gas?.max_price_per_unit},l1DataGas:{maxAmount:n?.l1_data_gas?.max_amount,maxPricePerUnit:n?.l1_data_gas?.max_price_per_unit}}};return i.nonceDataAvailabilityMode=e.nonceDataAvailabilityMode,i.feeDataAvailabilityMode=e.feeDataAvailabilityMode,i.tip=e.tip,i})};const l={currency:u},d=f.urlWithQuery(this.argentAffiliateUrl,l),p=await this.httpService.post(d,{body:a.json.stringify(s),headers:{"Content-Type":"application/json"}}),r=g.transactionExecutionResponseSchema.safeParse(p);if(!r.success)throw new Error("Invalid response from swap API");return r.data}}exports.SwapTransactionService=y;
@@ -1,67 +1,64 @@
1
- import { isEmpty as U } from "lodash-es";
2
- import { json as b } from "starknet";
3
- import { transactionExecutionResponseSchema as m } from "../../../transactions/transactionExecuteTypes.js";
4
- import { ETransactionVersion as E } from "../../../../node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.js";
5
- import { urlWithQuery as R } from "../../../utils/url/urlWithQuery.js";
6
- class j {
7
- constructor(o = "", n) {
8
- this.argentAffiliateUrl = o, this.httpService = n;
1
+ import { isEmpty as d } from "lodash-es";
2
+ import { stark as f, json as _ } from "starknet";
3
+ import { transactionExecutionResponseSchema as g } from "../../../transactions/transactionExecuteTypes.js";
4
+ import { urlWithQuery as h } from "../../../utils/url/urlWithQuery.js";
5
+ class U {
6
+ constructor(t = "", o) {
7
+ this.argentAffiliateUrl = t, this.httpService = o;
9
8
  }
10
- async execute({ paymasterParams: o, transactionParams: n, isSubsidised: y, currency: v }) {
11
- if (U(this.argentAffiliateUrl))
9
+ async execute({ paymasterParams: t, transactionParams: o, isSubsidised: a, currency: c }) {
10
+ if (d(this.argentAffiliateUrl))
12
11
  throw new Error("Argent affiliate URL is not set");
13
- let t;
14
- o ? t = {
12
+ let r;
13
+ t ? r = {
15
14
  executeRequest: {
16
- ...o,
17
- signature: o.signature,
18
- deploymentData: o.deploymentData,
19
- userAddress: o.accountAddress,
20
- typedData: o.typedData
15
+ ...t,
16
+ signature: t.signature,
17
+ deploymentData: t.deploymentData,
18
+ userAddress: t.accountAddress,
19
+ typedData: t.typedData
21
20
  },
22
- isSubsidised: y
23
- } : t = {
24
- transactions: n == null ? void 0 : n.map((e) => {
25
- var s, c, u, l, a, p, d, f, _, g, h, A;
26
- const i = {
27
- type: e.type,
28
- calls: e.calls,
29
- chainId: e.chainId,
30
- cairoVersion: e.cairoVersion,
31
- account: e.account,
32
- signature: e.signature,
33
- nonce: e.nonce,
34
- version: e.version
35
- };
36
- return e.version === E.V1 ? i.maxFee = e.maxFee : (i.resourceBounds = {
21
+ isSubsidised: a
22
+ } : r = { transactions: o?.map((e) => {
23
+ const n = e.resourceBounds ? f.resourceBoundsToHexString(e.resourceBounds) : void 0, i = {
24
+ type: e.type,
25
+ calls: e.calls,
26
+ chainId: e.chainId,
27
+ cairoVersion: e.cairoVersion,
28
+ account: e.account,
29
+ signature: e.signature,
30
+ nonce: e.nonce,
31
+ version: e.version,
32
+ resourceBounds: {
37
33
  l1Gas: {
38
- maxAmount: (c = (s = e.resourceBounds) == null ? void 0 : s.l1_gas) == null ? void 0 : c.max_amount,
39
- maxPricePerUnit: (l = (u = e.resourceBounds) == null ? void 0 : u.l1_gas) == null ? void 0 : l.max_price_per_unit
34
+ maxAmount: n?.l1_gas?.max_amount,
35
+ maxPricePerUnit: n?.l1_gas?.max_price_per_unit
40
36
  },
41
37
  l2Gas: {
42
- maxAmount: (p = (a = e.resourceBounds) == null ? void 0 : a.l2_gas) == null ? void 0 : p.max_amount,
43
- maxPricePerUnit: (f = (d = e.resourceBounds) == null ? void 0 : d.l2_gas) == null ? void 0 : f.max_price_per_unit
38
+ maxAmount: n?.l2_gas?.max_amount,
39
+ maxPricePerUnit: n?.l2_gas?.max_price_per_unit
44
40
  },
45
41
  l1DataGas: {
46
- maxAmount: (g = (_ = e.resourceBounds) == null ? void 0 : _.l1_data_gas) == null ? void 0 : g.max_amount,
47
- maxPricePerUnit: (A = (h = e.resourceBounds) == null ? void 0 : h.l1_data_gas) == null ? void 0 : A.max_price_per_unit
42
+ maxAmount: n?.l1_data_gas?.max_amount,
43
+ maxPricePerUnit: n?.l1_data_gas?.max_price_per_unit
48
44
  }
49
- }, i.nonceDataAvailabilityMode = e.nonceDataAvailabilityMode, i.feeDataAvailabilityMode = e.feeDataAvailabilityMode, i.tip = e.tip), i;
50
- })
51
- };
52
- const D = {
53
- currency: v
54
- }, w = R(this.argentAffiliateUrl, D), B = await this.httpService.post(w, {
55
- body: b.stringify(t),
45
+ }
46
+ };
47
+ return i.nonceDataAvailabilityMode = e.nonceDataAvailabilityMode, i.feeDataAvailabilityMode = e.feeDataAvailabilityMode, i.tip = e.tip, i;
48
+ }) };
49
+ const u = {
50
+ currency: c
51
+ }, l = h(this.argentAffiliateUrl, u), p = await this.httpService.post(l, {
52
+ body: _.stringify(r),
56
53
  headers: {
57
54
  "Content-Type": "application/json"
58
55
  }
59
- }), r = m.safeParse(B);
60
- if (!r.success)
56
+ }), s = g.safeParse(p);
57
+ if (!s.success)
61
58
  throw new Error("Invalid response from swap API");
62
- return r.data;
59
+ return s.data;
63
60
  }
64
61
  }
65
62
  export {
66
- j as SwapTransactionService
63
+ U as SwapTransactionService
67
64
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("lodash-es"),n=require("./HttpError.cjs"),d=require("./IHttpService.cjs");class w{constructor(a,t="json"){this.requestInit=a,this.responseType=t}async get(a,t){const s=i.isFunction(this.requestInit)?await this.requestInit():this.requestInit,r={...s,...t,method:"GET",headers:{...s==null?void 0:s.headers,...t==null?void 0:t.headers}},e=await fetch(a,r).catch(async o=>{let c;throw o instanceof Response&&(c=await o.json().catch(()=>{})),new n.HttpError(d.HTTP_ERROR_MESSAGE.FAILED_TO_FETCH_URL,0,c)});if(this.responseType==="json"){if(!e.ok)throw new n.HttpError(e.statusText,e.status,await e.json().catch(()=>{}));return await e.json()}return e}async post(a,t,s){const r=i.isFunction(this.requestInit)?await this.requestInit():this.requestInit,e={...r,...t,method:"POST",headers:{...r==null?void 0:r.headers,...t==null?void 0:t.headers}},o=await fetch(a,e).catch(()=>{throw new n.HttpError(d.HTTP_ERROR_MESSAGE.FAILED_TO_POST_URL,0)});if(!o.ok)throw new n.HttpError(o.statusText,o.status,await o.json());if(o.status===204)return{};const c=await o.json();if(s)try{return s.parse(c)}catch(h){throw new n.HttpError(h.message,0)}return c}async put(a,t){const s=i.isFunction(this.requestInit)?await this.requestInit():this.requestInit,r={...s,...t,method:"PUT",headers:{...s==null?void 0:s.headers,...t==null?void 0:t.headers}},e=await fetch(a,r).catch(()=>{throw new n.HttpError("Failed to put url",0)});if(!e.ok)throw new n.HttpError(e.statusText,e.status);return await e.json()}async delete(a,t){const s=i.isFunction(this.requestInit)?await this.requestInit():this.requestInit,r={...s,...t,method:"DELETE",headers:{...s==null?void 0:s.headers,...t==null?void 0:t.headers}},e=await fetch(a,r).catch(()=>{throw new n.HttpError("Failed to delete url",0)});if(!e.ok)throw new n.HttpError(e.statusText,e.status)}}exports.HTTPService=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("lodash-es"),o=require("./HttpError.cjs"),u=require("./IHttpService.cjs");class d{constructor(n,e="json"){this.requestInit=n,this.responseType=e}async get(n,e){const s=c.isFunction(this.requestInit)?await this.requestInit():this.requestInit,a={...s,...e,method:"GET",headers:{...s?.headers,...e?.headers}},t=await fetch(n,a).catch(async r=>{let i;throw r instanceof Response&&(i=await r.json().catch(()=>{})),new o.HttpError(u.HTTP_ERROR_MESSAGE.FAILED_TO_FETCH_URL,0,i)});if(this.responseType==="json"){if(!t.ok)throw new o.HttpError(t.statusText,t.status,await t.json().catch(()=>{}));return await t.json()}return t}async post(n,e,s){const a=c.isFunction(this.requestInit)?await this.requestInit():this.requestInit,t={...a,...e,method:"POST",headers:{...a?.headers,...e?.headers}},r=await fetch(n,t).catch(()=>{throw new o.HttpError(u.HTTP_ERROR_MESSAGE.FAILED_TO_POST_URL,0)});if(!r.ok)throw new o.HttpError(r.statusText,r.status,await r.json());if(r.status===204)return{};const i=await r.json();if(s)try{return s.parse(i)}catch(h){throw new o.HttpError(h.message,0)}return i}async put(n,e){const s=c.isFunction(this.requestInit)?await this.requestInit():this.requestInit,a={...s,...e,method:"PUT",headers:{...s?.headers,...e?.headers}},t=await fetch(n,a).catch(()=>{throw new o.HttpError("Failed to put url",0)});if(!t.ok)throw new o.HttpError(t.statusText,t.status);return await t.json()}async delete(n,e){const s=c.isFunction(this.requestInit)?await this.requestInit():this.requestInit,a={...s,...e,method:"DELETE",headers:{...s?.headers,...e?.headers}},t=await fetch(n,a).catch(()=>{throw new o.HttpError("Failed to delete url",0)});if(!t.ok)throw new o.HttpError(t.statusText,t.status)}}exports.HTTPService=d;
@@ -1,93 +1,93 @@
1
- import { isFunction as c } from "lodash-es";
2
- import { HttpError as h } from "./HttpError.js";
3
- import { HTTP_ERROR_MESSAGE as w } from "./IHttpService.js";
4
- class m {
5
- constructor(r, t = "json") {
6
- this.requestInit = r, this.responseType = t;
1
+ import { isFunction as h } from "lodash-es";
2
+ import { HttpError as o } from "./HttpError.js";
3
+ import { HTTP_ERROR_MESSAGE as u } from "./IHttpService.js";
4
+ class T {
5
+ constructor(n, e = "json") {
6
+ this.requestInit = n, this.responseType = e;
7
7
  }
8
- async get(r, t) {
9
- const s = c(this.requestInit) ? await this.requestInit() : this.requestInit, a = {
8
+ async get(n, e) {
9
+ const s = h(this.requestInit) ? await this.requestInit() : this.requestInit, r = {
10
10
  ...s,
11
- ...t,
11
+ ...e,
12
12
  method: "GET",
13
13
  // merge headers
14
14
  headers: {
15
- ...s == null ? void 0 : s.headers,
16
- ...t == null ? void 0 : t.headers
15
+ ...s?.headers,
16
+ ...e?.headers
17
17
  }
18
- }, e = await fetch(r, a).catch(async (o) => {
19
- let n;
20
- throw o instanceof Response && (n = await o.json().catch(() => {
21
- })), new h(w.FAILED_TO_FETCH_URL, 0, n);
18
+ }, t = await fetch(n, r).catch(async (a) => {
19
+ let i;
20
+ throw a instanceof Response && (i = await a.json().catch(() => {
21
+ })), new o(u.FAILED_TO_FETCH_URL, 0, i);
22
22
  });
23
23
  if (this.responseType === "json") {
24
- if (!e.ok)
25
- throw new h(e.statusText, e.status, await e.json().catch(() => {
24
+ if (!t.ok)
25
+ throw new o(t.statusText, t.status, await t.json().catch(() => {
26
26
  }));
27
- return await e.json();
27
+ return await t.json();
28
28
  }
29
- return e;
29
+ return t;
30
30
  }
31
- async post(r, t, s) {
32
- const a = c(this.requestInit) ? await this.requestInit() : this.requestInit, e = {
33
- ...a,
34
- ...t,
31
+ async post(n, e, s) {
32
+ const r = h(this.requestInit) ? await this.requestInit() : this.requestInit, t = {
33
+ ...r,
34
+ ...e,
35
35
  method: "POST",
36
36
  // merge headers
37
37
  headers: {
38
- ...a == null ? void 0 : a.headers,
39
- ...t == null ? void 0 : t.headers
38
+ ...r?.headers,
39
+ ...e?.headers
40
40
  }
41
- }, o = await fetch(r, e).catch(() => {
42
- throw new h(w.FAILED_TO_POST_URL, 0);
41
+ }, a = await fetch(n, t).catch(() => {
42
+ throw new o(u.FAILED_TO_POST_URL, 0);
43
43
  });
44
- if (!o.ok)
45
- throw new h(o.statusText, o.status, await o.json());
46
- if (o.status === 204)
44
+ if (!a.ok)
45
+ throw new o(a.statusText, a.status, await a.json());
46
+ if (a.status === 204)
47
47
  return {};
48
- const n = await o.json();
48
+ const i = await a.json();
49
49
  if (s)
50
50
  try {
51
- return s.parse(n);
52
- } catch (i) {
53
- throw new h(i.message, 0);
51
+ return s.parse(i);
52
+ } catch (c) {
53
+ throw new o(c.message, 0);
54
54
  }
55
- return n;
55
+ return i;
56
56
  }
57
- async put(r, t) {
58
- const s = c(this.requestInit) ? await this.requestInit() : this.requestInit, a = {
57
+ async put(n, e) {
58
+ const s = h(this.requestInit) ? await this.requestInit() : this.requestInit, r = {
59
59
  ...s,
60
- ...t,
60
+ ...e,
61
61
  method: "PUT",
62
62
  // merge headers
63
63
  headers: {
64
- ...s == null ? void 0 : s.headers,
65
- ...t == null ? void 0 : t.headers
64
+ ...s?.headers,
65
+ ...e?.headers
66
66
  }
67
- }, e = await fetch(r, a).catch(() => {
68
- throw new h("Failed to put url", 0);
67
+ }, t = await fetch(n, r).catch(() => {
68
+ throw new o("Failed to put url", 0);
69
69
  });
70
- if (!e.ok)
71
- throw new h(e.statusText, e.status);
72
- return await e.json();
70
+ if (!t.ok)
71
+ throw new o(t.statusText, t.status);
72
+ return await t.json();
73
73
  }
74
- async delete(r, t) {
75
- const s = c(this.requestInit) ? await this.requestInit() : this.requestInit, a = {
74
+ async delete(n, e) {
75
+ const s = h(this.requestInit) ? await this.requestInit() : this.requestInit, r = {
76
76
  ...s,
77
- ...t,
77
+ ...e,
78
78
  method: "DELETE",
79
79
  // merge headers
80
80
  headers: {
81
- ...s == null ? void 0 : s.headers,
82
- ...t == null ? void 0 : t.headers
81
+ ...s?.headers,
82
+ ...e?.headers
83
83
  }
84
- }, e = await fetch(r, a).catch(() => {
85
- throw new h("Failed to delete url", 0);
84
+ }, t = await fetch(n, r).catch(() => {
85
+ throw new o("Failed to delete url", 0);
86
86
  });
87
- if (!e.ok)
88
- throw new h(e.statusText, e.status);
87
+ if (!t.ok)
88
+ throw new o(t.statusText, t.status);
89
89
  }
90
90
  }
91
91
  export {
92
- m as HTTPService
92
+ T as HTTPService
93
93
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(n){var r;return(r=n==null?void 0:n.links)==null?void 0:r.find(t=>t.name==="dappland")}function a(n){var r;return(r=e(n))==null?void 0:r.url}exports.getDapplandLinkForDapp=e;exports.getDapplandUrlForDapp=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(p){return p?.links?.find(a=>a.name==="dappland")}function r(p){return n(p)?.url}exports.getDapplandLinkForDapp=n;exports.getDapplandUrlForDapp=r;
@@ -1,12 +1,10 @@
1
- function e(n) {
2
- var r;
3
- return (r = n == null ? void 0 : n.links) == null ? void 0 : r.find((t) => t.name === "dappland");
1
+ function a(n) {
2
+ return n?.links?.find((p) => p.name === "dappland");
4
3
  }
5
- function l(n) {
6
- var r;
7
- return (r = e(n)) == null ? void 0 : r.url;
4
+ function r(n) {
5
+ return a(n)?.url;
8
6
  }
9
7
  export {
10
- e as getDapplandLinkForDapp,
11
- l as getDapplandUrlForDapp
8
+ a as getDapplandLinkForDapp,
9
+ r as getDapplandUrlForDapp
12
10
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("url-join"),f=require("./BackendPaginationError.cjs"),A=require("../utils/address.cjs"),P=require("../chains/starknet/address.cjs"),u=32;class S{constructor(e,t){this.apiBase=e,this.httpService=t}async getNfts(e,t,r,s=1){const a=this.normalizeAddress(r),c=o(this.apiBase,"pandora",e,t),m=this.pageToPageIndex(s),l=`${o(c,"profile",a,"nfts")}?page=${m}&size=${u}`,i=await this.httpService.get(l),n=i.content.map(p=>this.mapItem(p,r));return{totalPages:i.totalPages,page:i.number+1,count:n.length,nfts:n}}async getCollection(e,t,r){const s=this.normalizeAddress(r),a=o(this.apiBase,"pandora",e,t),c=o(a,"collection",s),m=`${a}/collection/${s}`,[g,l]=await Promise.all([this.httpService.get(c),this.httpService.get(m)]),i=h(g),n=l.content.map(p=>this.mapItem(p));return{...i,nfts:{totalPages:l.totalPages,page:l.number,count:n.length,data:n}}}async getNft(e,t,r,s){const a=this.normalizeAddress(r),c=o(this.apiBase,"pandora",e,t),m=o(c,"nft",a,s),g=await this.httpService.get(m);return this.mapItem(g)}async getProfileCollections(e,t,r,s=1,a=!1){const c=this.pageToPageIndex(s),m=this.normalizeAddress(r),g=o(this.apiBase,"pandora",e,t),l=o(g,"profile",m,"collections",`?page=${c}&size=${u}`),i=await this.httpService.get(l),n=[];for(const p of i.content)if(a){const b=await this.getCollectionMetrics(e,t,p.contractAddress);n.push(h(p,b))}else n.push(h(p));return{totalPages:i.totalPages,page:i.number+1,count:n.length,collections:n}}async getCollectionMetrics(e,t,r){const s=this.normalizeAddress(r),a=o(this.apiBase,"pandora",e,t),c=o(a,"collection",s,"metrics");return this.httpService.get(c)}normalizeAddress(e){return P.addressSchemaArgentBackend.parse(e)}pageToPageIndex(e){if(!Number.isInteger(e))throw new f.BackendPaginationError("notANumber");const t=e-1;if(t<0)throw new f.BackendPaginationError("tooLow");return t}mapItem(e,t){var s;const r=e.name??e.tokenId;return{token_id:e.tokenId,contract_address:e.contractAddress,name:r,spec:"spec"in e?v(e.spec):void 0,description:"",best_bid_order:{payment_amount:"bestListPrice"in e?BigInt(e.bestListPrice):void 0},properties:"properties"in e&&e.properties.map(a=>({key:a.key,value:a.value}))||[],image_uri:e.imageUrls.preview,image_url_copy:e.imageUrls.full,owner:{account_address:((s=e.owner)==null?void 0:s.address)||t},contract_name:A.formatAddress(e.contractAddress)}}}function v(d){switch(d){case"erc721":case"starknetErc721":return"ERC721";case"erc1155":case"starknetErc1155":return"ERC1155"}}function h(d,e){return{contractAddress:P.addressSchema.parse(d.contractAddress),name:d.name||A.formatAddress(d.contractAddress),description:d.description??"",imageUri:d.imageUrls.preview,...e&&{owners:{total:e.numberOfItems,unique:e.uniqueOwners},...e.floorPrice&&{floorPrice:BigInt(e.floorPrice)}}}}exports.BackendNftService=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("url-join"),f=require("./BackendPaginationError.cjs"),A=require("../utils/address.cjs"),P=require("../chains/starknet/address.cjs"),u=32;class S{constructor(e,t){this.apiBase=e,this.httpService=t}async getNfts(e,t,a,s=1){const r=this.normalizeAddress(a),c=o(this.apiBase,"pandora",e,t),m=this.pageToPageIndex(s),l=`${o(c,"profile",r,"nfts")}?page=${m}&size=${u}`,i=await this.httpService.get(l),n=i.content.map(p=>this.mapItem(p,a));return{totalPages:i.totalPages,page:i.number+1,count:n.length,nfts:n}}async getCollection(e,t,a){const s=this.normalizeAddress(a),r=o(this.apiBase,"pandora",e,t),c=o(r,"collection",s),m=`${r}/collection/${s}`,[g,l]=await Promise.all([this.httpService.get(c),this.httpService.get(m)]),i=h(g),n=l.content.map(p=>this.mapItem(p));return{...i,nfts:{totalPages:l.totalPages,page:l.number,count:n.length,data:n}}}async getNft(e,t,a,s){const r=this.normalizeAddress(a),c=o(this.apiBase,"pandora",e,t),m=o(c,"nft",r,s),g=await this.httpService.get(m);return this.mapItem(g)}async getProfileCollections(e,t,a,s=1,r=!1){const c=this.pageToPageIndex(s),m=this.normalizeAddress(a),g=o(this.apiBase,"pandora",e,t),l=o(g,"profile",m,"collections",`?page=${c}&size=${u}`),i=await this.httpService.get(l),n=[];for(const p of i.content)if(r){const b=await this.getCollectionMetrics(e,t,p.contractAddress);n.push(h(p,b))}else n.push(h(p));return{totalPages:i.totalPages,page:i.number+1,count:n.length,collections:n}}async getCollectionMetrics(e,t,a){const s=this.normalizeAddress(a),r=o(this.apiBase,"pandora",e,t),c=o(r,"collection",s,"metrics");return this.httpService.get(c)}normalizeAddress(e){return P.addressSchemaArgentBackend.parse(e)}pageToPageIndex(e){if(!Number.isInteger(e))throw new f.BackendPaginationError("notANumber");const t=e-1;if(t<0)throw new f.BackendPaginationError("tooLow");return t}mapItem(e,t){const a=e.name??e.tokenId;return{token_id:e.tokenId,contract_address:e.contractAddress,name:a,spec:"spec"in e?v(e.spec):void 0,description:"",best_bid_order:{payment_amount:"bestListPrice"in e?BigInt(e.bestListPrice):void 0},properties:"properties"in e&&e.properties.map(s=>({key:s.key,value:s.value}))||[],image_uri:e.imageUrls.preview,image_url_copy:e.imageUrls.full,owner:{account_address:e.owner?.address||t},contract_name:A.formatAddress(e.contractAddress)}}}function v(d){switch(d){case"erc721":case"starknetErc721":return"ERC721";case"erc1155":case"starknetErc1155":return"ERC1155"}}function h(d,e){return{contractAddress:P.addressSchema.parse(d.contractAddress),name:d.name||A.formatAddress(d.contractAddress),description:d.description??"",imageUri:d.imageUrls.preview,...e&&{owners:{total:e.numberOfItems,unique:e.uniqueOwners},...e.floorPrice&&{floorPrice:BigInt(e.floorPrice)}}}}exports.BackendNftService=S;