@argent/x-shared 1.70.2 → 1.71.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 (50) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +286 -307
  3. package/dist/simulation.cjs +1 -1
  4. package/dist/simulation.js +66 -68
  5. package/dist/src/features/paymaster/types.d.ts +2 -2
  6. package/dist/src/features/simulation/fees/schema.cjs +1 -1
  7. package/dist/src/features/simulation/fees/schema.d.ts +665 -705
  8. package/dist/src/features/simulation/fees/schema.js +32 -39
  9. package/dist/src/features/simulation/transactionReview/schema.cjs +1 -1
  10. package/dist/src/features/simulation/transactionReview/schema.d.ts +2117 -7917
  11. package/dist/src/features/simulation/transactionReview/schema.js +103 -112
  12. package/dist/src/features/swap/models/execute.model.d.ts +4 -0
  13. package/dist/src/features/swap/services/SwapTransactionService.cjs +1 -1
  14. package/dist/src/features/swap/services/SwapTransactionService.js +22 -18
  15. package/dist/src/staking/schema.cjs +1 -1
  16. package/dist/src/staking/schema.d.ts +11 -0
  17. package/dist/src/staking/schema.js +1 -0
  18. package/dist/src/tokens/isUnlimitedAmount.cjs +1 -1
  19. package/dist/src/tokens/isUnlimitedAmount.js +3 -3
  20. package/dist/src/transactions/amount.cjs +1 -1
  21. package/dist/src/transactions/amount.d.ts +2 -2
  22. package/dist/src/transactions/amount.js +9 -9
  23. package/dist/src/transactions/estimate/adjustment.cjs +1 -0
  24. package/dist/src/transactions/estimate/adjustment.d.ts +4 -0
  25. package/dist/src/transactions/estimate/adjustment.js +7 -0
  26. package/dist/src/transactions/estimate/argentMaxFee.d.ts +3 -3
  27. package/dist/src/transactions/estimate/index.d.ts +0 -1
  28. package/dist/src/transactions/estimate/model.d.ts +1 -10
  29. package/dist/src/transactions/estimate/utils.cjs +1 -1
  30. package/dist/src/transactions/estimate/utils.d.ts +31 -61
  31. package/dist/src/transactions/estimate/utils.js +156 -223
  32. package/dist/src/transactions/index.d.ts +0 -1
  33. package/dist/src/transactions/service/implementation.cjs +1 -1
  34. package/dist/src/transactions/service/implementation.d.ts +39 -22
  35. package/dist/src/transactions/service/implementation.js +130 -97
  36. package/dist/src/transactions/service/index.d.ts +1 -0
  37. package/dist/src/transactions/service/utils.cjs +1 -0
  38. package/dist/src/transactions/service/utils.d.ts +25 -0
  39. package/dist/src/transactions/service/utils.js +25 -0
  40. package/dist/src/transactions/transactionSimulationTypes.d.ts +1 -7
  41. package/dist/src/transactions/transactionVersion.cjs +1 -1
  42. package/dist/src/transactions/transactionVersion.d.ts +5 -6
  43. package/dist/src/transactions/transactionVersion.js +10 -12
  44. package/package.json +2 -2
  45. package/dist/src/transactions/estimate/utilsV2.cjs +0 -1
  46. package/dist/src/transactions/estimate/utilsV2.d.ts +0 -26
  47. package/dist/src/transactions/estimate/utilsV2.js +0 -107
  48. package/dist/src/transactions/getTransactionVersion.cjs +0 -1
  49. package/dist/src/transactions/getTransactionVersion.d.ts +0 -12
  50. package/dist/src/transactions/getTransactionVersion.js +0 -21
@@ -1,8 +1,8 @@
1
1
  import { z as t } from "zod";
2
- import { estimatedFeesSchema as y, estimatedFeesV2Schema as f } from "../fees/schema.js";
3
- import { severitySchema as j, reasonsSchema as k } from "../warning/schema.js";
4
- import { addressSchemaArgentBackend as n, addressSchema as v } from "../../../chains/starknet/address.js";
5
- const w = t.object({
2
+ import { severitySchema as y, reasonsSchema as j } from "../warning/schema.js";
3
+ import { estimatedFeesSchema as f } from "../fees/schema.js";
4
+ import { addressSchemaArgentBackend as o, addressSchema as k } from "../../../chains/starknet/address.js";
5
+ const v = t.object({
6
6
  name: t.string(),
7
7
  url: t.string(),
8
8
  position: t.number()
@@ -14,7 +14,7 @@ const w = t.object({
14
14
  unknown: t.boolean(),
15
15
  iconUrl: t.string().optional(),
16
16
  type: t.string()
17
- }), c = t.discriminatedUnion("type", [
17
+ }), r = t.discriminatedUnion("type", [
18
18
  t.object({
19
19
  type: t.literal("amount"),
20
20
  label: t.string(),
@@ -62,54 +62,54 @@ const w = t.object({
62
62
  label: t.string(),
63
63
  token: e
64
64
  })
65
- ]), E = t.object({
65
+ ]), w = t.object({
66
66
  name: t.string(),
67
- properties: t.array(c),
68
- defaultProperties: t.array(c).optional()
69
- }), F = t.union([
67
+ properties: t.array(r),
68
+ defaultProperties: t.array(r).optional()
69
+ }), E = t.union([
70
70
  t.literal("verified"),
71
71
  t.literal("neutral"),
72
72
  t.literal("partial"),
73
73
  t.literal("warn")
74
- ]), U = t.object({
74
+ ]), D = t.object({
75
75
  unknown_token: t.unknown().optional(),
76
76
  date_of_addition: t.string().optional(),
77
- contract_address: v.optional(),
77
+ contract_address: k.optional(),
78
78
  reason: t.string().optional(),
79
79
  value: t.string().or(t.number()).optional()
80
- }), p = t.object({
81
- reason: k,
82
- details: U.optional(),
83
- severity: j
84
- }), x = t.object({
85
- assessment: F,
86
- warnings: t.array(p).optional(),
80
+ }), l = t.object({
81
+ reason: j,
82
+ details: D.optional(),
83
+ severity: y
84
+ }), U = t.object({
85
+ assessment: E,
86
+ warnings: t.array(l).optional(),
87
87
  assessmentReasons: t.array(t.string()).optional(),
88
88
  assessmentDetails: t.object({
89
89
  contract_address: t.string()
90
90
  }).optional(),
91
- action: E
92
- }), D = t.object({
91
+ action: w
92
+ }), F = t.object({
93
93
  name: t.string(),
94
94
  description: t.string(),
95
95
  logoUrl: t.string().optional(),
96
96
  iconUrl: t.string().optional(),
97
97
  argentVerified: t.boolean(),
98
- links: t.array(w)
99
- }), m = t.object({
98
+ links: t.array(v)
99
+ }), c = t.object({
100
100
  assessment: t.union([
101
101
  t.literal("verified"),
102
102
  t.literal("neutral"),
103
103
  t.literal("partial"),
104
104
  t.literal("warn")
105
105
  ]),
106
- warnings: t.array(p).optional(),
106
+ warnings: t.array(l).optional(),
107
107
  assessmentDetails: t.object({
108
108
  contract_address: t.string()
109
109
  }).optional(),
110
- targetedDapp: D.optional(),
111
- reviews: t.array(x)
112
- }).optional(), d = t.object({
110
+ targetedDapp: F.optional(),
111
+ reviews: t.array(U)
112
+ }).optional(), p = t.object({
113
113
  banner: t.string().nullable().optional(),
114
114
  preview: t.string().nullable().optional(),
115
115
  full: t.string().nullable().optional(),
@@ -118,8 +118,8 @@ const w = t.object({
118
118
  twitter: t.string().optional(),
119
119
  external: t.string().optional(),
120
120
  discord: t.string().optional()
121
- }), i = t.object({
122
- address: n,
121
+ }), s = t.object({
122
+ address: o,
123
123
  decimals: t.number().optional(),
124
124
  symbol: t.string().optional(),
125
125
  name: t.string(),
@@ -128,128 +128,119 @@ const w = t.object({
128
128
  usdValue: t.string().optional(),
129
129
  iconUrl: t.string().optional(),
130
130
  unknown: t.boolean().optional(),
131
- imageUrls: d.optional(),
131
+ imageUrls: p.optional(),
132
132
  links: A.optional()
133
- }), T = t.object({
134
- tokenAddress: n,
135
- owner: n,
136
- spender: n,
133
+ }), _ = t.object({
134
+ tokenAddress: o,
135
+ owner: o,
136
+ spender: o,
137
137
  value: t.string().optional(),
138
138
  approvalForAll: t.boolean(),
139
- details: i.optional()
140
- }), P = t.object({
141
- tokenAddress: n,
142
- from: n,
143
- to: n,
139
+ details: s.optional()
140
+ }), x = t.object({
141
+ tokenAddress: o,
142
+ from: o,
143
+ to: o,
144
144
  tokenId: t.string().optional(),
145
145
  value: t.string().optional(),
146
- details: i.optional()
147
- }), o = t.union([t.string(), t.number(), t.bigint()]).transform((a) => parseInt(a.toString(), 10)), g = {
148
- overallFee: o,
149
- gasPrice: o,
150
- gasUsage: o,
151
- dataGasPrice: o.optional(),
152
- dataGasConsumed: o.optional()
153
- }, _ = t.object({
154
- ...g,
155
- unit: t.string().transform((a) => a.toUpperCase()).pipe(t.literal("WEI")),
156
- maxFee: o
157
- }), b = t.object({
158
- address: n,
146
+ details: s.optional()
147
+ }), n = t.union([t.string(), t.number(), t.bigint()]).transform((a) => parseInt(a.toString(), 10)), m = t.object({
148
+ address: o,
159
149
  unknown: t.boolean(),
160
150
  type: t.literal("ERC20")
161
- }), V = t.object({
162
- ...g,
151
+ }), i = t.object({
152
+ maxAmount: n,
153
+ maxPricePerUnit: n
154
+ }), T = t.object({
155
+ l1Gas: i,
156
+ l1DataGas: i,
157
+ l2Gas: i
158
+ }), N = t.object({
159
+ token: m,
160
+ overallFee: n,
161
+ maxFee: n
162
+ }), b = t.object({
163
+ overallFee: n,
164
+ resourceBounds: T,
163
165
  unit: t.string().transform((a) => a.toUpperCase()).pipe(t.literal("FRI")),
164
- maxAmount: o,
165
- maxPricePerUnit: o,
166
- token: b
167
- }), I = t.object({
168
- token: b,
169
- overallFee: o,
170
- maxFee: o
171
- }), u = _.or(V), N = u.or(I), R = t.object({
166
+ token: m
167
+ }), P = b.or(N), R = t.object({
172
168
  type: t.string(),
173
169
  label: t.string(),
174
170
  tokenId: t.string().optional(),
175
171
  value: t.string().optional(),
176
172
  usdValue: t.string().optional(),
177
- token: i,
173
+ token: s,
178
174
  sent: t.boolean().optional(),
179
175
  tokenIdDetails: t.object({
180
176
  name: t.string().optional(),
181
177
  description: t.string().optional(),
182
- imageUrls: d.optional()
178
+ imageUrls: p.optional()
183
179
  }).optional()
184
- }), C = t.object({
185
- approvals: t.array(T).optional(),
186
- transfers: t.array(P).optional(),
180
+ }), I = t.object({
181
+ approvals: t.array(_).optional(),
182
+ transfers: t.array(x).optional(),
187
183
  calculatedNonce: t.string().optional(),
188
- feeEstimation: u,
189
- feeEstimations: t.array(N),
184
+ feeEstimation: b,
185
+ feeEstimations: t.array(P),
190
186
  summary: t.array(R).optional()
191
187
  }), O = t.object({
192
188
  label: t.string().optional(),
193
189
  code: t.number().optional(),
194
190
  message: t.string().optional(),
195
191
  error: t.string().optional()
196
- }), S = t.object({
197
- reviewOfTransaction: m,
198
- simulation: C,
192
+ }), d = t.object({
193
+ reviewOfTransaction: c,
194
+ simulation: I,
199
195
  simulationError: t.undefined()
200
- }), h = t.object({
201
- reviewOfTransaction: m,
196
+ }), g = t.object({
197
+ reviewOfTransaction: c,
202
198
  simulation: t.undefined(),
203
199
  simulationError: O
204
- }), s = S.or(h), r = t.object({
200
+ }), u = d.or(g), S = t.object({
205
201
  subsidiseDeployment: t.boolean(),
206
202
  subsidiseTransaction: t.boolean()
207
203
  }), B = t.object({
208
204
  name: t.string().optional(),
209
205
  shouldShow: t.boolean().optional()
210
- }), l = t.array(B), q = t.object({
211
- transactions: t.array(s).optional(),
212
- subsidyStatus: r.optional(),
213
- promotions: l.optional()
214
- }), J = t.object({
215
- transactions: t.array(s).optional(),
216
- subsidyStatus: r.optional(),
217
- enrichedFeeEstimation: y.optional(),
218
- isBackendDown: t.boolean().default(!1).optional(),
219
- promotions: l.optional()
220
- }), K = t.object({
221
- transactions: t.array(s).optional(),
222
- subsidyStatus: r.optional(),
206
+ }), h = t.array(B), H = t.object({
207
+ transactions: t.array(u).optional(),
208
+ canSubsidise: t.boolean().optional(),
209
+ subsidyStatus: S.optional(),
210
+ promotions: h.optional()
211
+ }), q = t.object({
212
+ transactions: t.array(u).optional(),
213
+ canSubsidise: t.boolean().optional(),
214
+ subsidyStatus: S.optional(),
223
215
  enrichedFeeEstimation: t.array(f).optional(),
224
216
  isBackendDown: t.boolean().default(!1).optional(),
225
- promotions: l.optional()
217
+ promotions: h.optional()
226
218
  });
227
- function L(a) {
228
- return S.safeParse(a).success;
219
+ function J(a) {
220
+ return d.safeParse(a).success;
229
221
  }
230
- function M(a) {
231
- return h.safeParse(a).success;
222
+ function K(a) {
223
+ return g.safeParse(a).success;
232
224
  }
233
225
  export {
234
- E as actionSchema,
235
- F as assessmentSchema,
236
- J as enrichedSimulateAndReviewSchema,
237
- K as enrichedSimulateAndReviewV2Schema,
238
- N as feeEstimationNativeOrPaymasterSchema,
239
- u as feeEstimationSchema,
240
- _ as feeEstimationTxV1Schema,
241
- V as feeEstimationTxV3Schema,
242
- L as isNotTransactionSimulationError,
243
- M as isTransactionSimulationError,
244
- I as paymasterFeeEstimationSchema,
245
- b as paymasterFeeTokenSchema,
226
+ w as actionSchema,
227
+ E as assessmentSchema,
228
+ q as enrichedSimulateAndReviewSchema,
229
+ i as feeEstimationGasSchema,
230
+ P as feeEstimationNativeOrPaymasterSchema,
231
+ T as feeEstimationResourceBoundSchema,
232
+ b as feeEstimationSchema,
233
+ J as isNotTransactionSimulationError,
234
+ K as isTransactionSimulationError,
235
+ N as paymasterFeeEstimationSchema,
236
+ m as paymasterFeeTokenSchema,
246
237
  B as promotionSchema,
247
- l as promotionsSchema,
248
- c as propertySchema,
249
- x as reviewSchema,
250
- q as simulateAndReviewSchema,
251
- r as subsidyStatusSchema,
252
- D as targetedDappSchema,
253
- U as warningDetailsSchema,
254
- p as warningSchema
238
+ h as promotionsSchema,
239
+ r as propertySchema,
240
+ U as reviewSchema,
241
+ H as simulateAndReviewSchema,
242
+ S as subsidyStatusSchema,
243
+ F as targetedDappSchema,
244
+ D as warningDetailsSchema,
245
+ l as warningSchema
255
246
  };
@@ -8,6 +8,10 @@ interface ApiResourceBounds {
8
8
  maxAmount?: string;
9
9
  maxPricePerUnit?: string;
10
10
  };
11
+ l1DataGas: {
12
+ maxAmount?: string;
13
+ maxPricePerUnit?: string;
14
+ };
11
15
  }
12
16
  export type SwapTransactionParams = UniversalDetails & {
13
17
  type: typeof TransactionType.INVOKE;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("lodash-es"),S=require("starknet"),b=require("../../../transactions/transactionExecuteTypes.cjs"),q=require("../../../../node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.cjs"),w=require("../../../utils/url/urlWithQuery.cjs");class D{constructor(n="",t){this.argentAffiliateUrl=n,this.httpService=t}async execute({paymasterParams:n,transactionParams:t,isSubsidised:y,currency:h}){if(_.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:y}:o={transactions:t==null?void 0:t.map(e=>{var r,c,u,l,a,d,p,f;const 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};return e.version===q.ETransactionVersion.V1?i.maxFee=e.maxFee:(i.resourceBounds={l1Gas:{maxAmount:(c=(r=e.resourceBounds)==null?void 0:r.l1_gas)==null?void 0:c.max_amount,maxPricePerUnit:(l=(u=e.resourceBounds)==null?void 0:u.l1_gas)==null?void 0:l.max_price_per_unit},l2Gas:{maxAmount:(d=(a=e.resourceBounds)==null?void 0:a.l2_gas)==null?void 0:d.max_amount,maxPricePerUnit:(f=(p=e.resourceBounds)==null?void 0:p.l2_gas)==null?void 0:f.max_price_per_unit}},i.nonceDataAvailabilityMode=e.nonceDataAvailabilityMode,i.feeDataAvailabilityMode=e.feeDataAvailabilityMode,i.tip=e.tip),i})};const g={currency:h},v=w.urlWithQuery(this.argentAffiliateUrl,g),A=await this.httpService.post(v,{body:S.json.stringify(o),headers:{"Content-Type":"application/json"}}),s=b.transactionExecutionResponseSchema.safeParse(A);if(!s.success)throw new Error("Invalid response from swap API");return s.data}}exports.SwapTransactionService=D;
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,14 +1,14 @@
1
- import { isEmpty as v } from "lodash-es";
2
- import { json as D } from "starknet";
3
- import { transactionExecutionResponseSchema as w } from "../../../transactions/transactionExecuteTypes.js";
4
- import { ETransactionVersion as b } 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 U } from "../../../utils/url/urlWithQuery.js";
6
- class q {
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
7
  constructor(o = "", n) {
8
8
  this.argentAffiliateUrl = o, this.httpService = n;
9
9
  }
10
- async execute({ paymasterParams: o, transactionParams: n, isSubsidised: h, currency: g }) {
11
- if (v(this.argentAffiliateUrl))
10
+ async execute({ paymasterParams: o, transactionParams: n, isSubsidised: y, currency: v }) {
11
+ if (U(this.argentAffiliateUrl))
12
12
  throw new Error("Argent affiliate URL is not set");
13
13
  let t;
14
14
  o ? t = {
@@ -19,10 +19,10 @@ class q {
19
19
  userAddress: o.accountAddress,
20
20
  typedData: o.typedData
21
21
  },
22
- isSubsidised: h
22
+ isSubsidised: y
23
23
  } : t = {
24
24
  transactions: n == null ? void 0 : n.map((e) => {
25
- var s, c, u, l, p, a, d, f;
25
+ var s, c, u, l, a, p, d, f, _, g, h, A;
26
26
  const i = {
27
27
  type: e.type,
28
28
  calls: e.calls,
@@ -33,31 +33,35 @@ class q {
33
33
  nonce: e.nonce,
34
34
  version: e.version
35
35
  };
36
- return e.version === b.V1 ? i.maxFee = e.maxFee : (i.resourceBounds = {
36
+ return e.version === E.V1 ? i.maxFee = e.maxFee : (i.resourceBounds = {
37
37
  l1Gas: {
38
38
  maxAmount: (c = (s = e.resourceBounds) == null ? void 0 : s.l1_gas) == null ? void 0 : c.max_amount,
39
39
  maxPricePerUnit: (l = (u = e.resourceBounds) == null ? void 0 : u.l1_gas) == null ? void 0 : l.max_price_per_unit
40
40
  },
41
41
  l2Gas: {
42
- maxAmount: (a = (p = e.resourceBounds) == null ? void 0 : p.l2_gas) == null ? void 0 : a.max_amount,
42
+ maxAmount: (p = (a = e.resourceBounds) == null ? void 0 : a.l2_gas) == null ? void 0 : p.max_amount,
43
43
  maxPricePerUnit: (f = (d = e.resourceBounds) == null ? void 0 : d.l2_gas) == null ? void 0 : f.max_price_per_unit
44
+ },
45
+ 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
44
48
  }
45
49
  }, i.nonceDataAvailabilityMode = e.nonceDataAvailabilityMode, i.feeDataAvailabilityMode = e.feeDataAvailabilityMode, i.tip = e.tip), i;
46
50
  })
47
51
  };
48
- const y = {
49
- currency: g
50
- }, A = U(this.argentAffiliateUrl, y), _ = await this.httpService.post(A, {
51
- body: D.stringify(t),
52
+ const D = {
53
+ currency: v
54
+ }, w = R(this.argentAffiliateUrl, D), B = await this.httpService.post(w, {
55
+ body: b.stringify(t),
52
56
  headers: {
53
57
  "Content-Type": "application/json"
54
58
  }
55
- }), r = w.safeParse(_);
59
+ }), r = m.safeParse(B);
56
60
  if (!r.success)
57
61
  throw new Error("Invalid response from swap API");
58
62
  return r.data;
59
63
  }
60
64
  }
61
65
  export {
62
- q as SwapTransactionService
66
+ j as SwapTransactionService
63
67
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),z=require("../utils/starknet/starknet.cjs"),t=require("../chains/starknet/address.cjs"),a=e.z.object({id:e.z.string(),dappId:e.z.string(),productId:e.z.string(),productName:e.z.string(),chain:e.z.string(),name:e.z.string(),description:e.z.string(),iconUrl:e.z.string().url(),learnMoreUrl:e.z.string().url().optional(),riskFactor:e.z.enum(["low"]),metrics:e.z.object({baseApy:e.z.string(),totalApy:e.z.string(),tvl:e.z.string().optional()}),incentives:e.z.array(e.z.object({name:e.z.string(),description:e.z.string(),iconUrl:e.z.string().url(),learnMoreUrl:e.z.string().url(),metric:e.z.object({apy:e.z.string()})})),buyEnabled:e.z.boolean(),sellEnabled:e.z.boolean()}),s=a.extend({category:e.z.literal("staking"),investableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"])}),withdrawableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"])}),fees:e.z.object({depositFees:e.z.object({protocolFee:e.z.string().nullable().optional(),totalFee:e.z.string()}),withdrawalFees:e.z.object({protocolFee:e.z.string().nullable().optional(),totalFee:e.z.string()}),performanceFees:e.z.object({argentFee:e.z.string().nullable().optional(),protocolFee:e.z.string().nullable().optional(),providerFee:e.z.string().nullable().optional(),totalFee:e.z.string()}).optional()})}),o=a.extend({category:e.z.literal("lending"),investableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"])}),withdrawableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"])}),fees:e.z.object({depositFees:e.z.object({totalFee:e.z.string()}),withdrawalFees:e.z.object({totalFee:e.z.string()})})}),n=e.z.object({name:e.z.string().optional(),iconUrl:e.z.string().url().optional(),address:e.z.string().optional()}),r=a.extend({category:e.z.literal("strkDelegatedStaking"),stakerInfo:n,investableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"]),useDecomposedBalances:e.z.boolean().optional()}),withdrawableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"]),useDecomposedBalances:e.z.boolean().optional(),amountsRequirement:e.z.enum(["fullBalance"]).optional(),timelockDuration:e.z.number().optional()}),fees:e.z.object({depositFees:e.z.object({argentFee:e.z.string().nullable().optional(),protocolFee:e.z.string().nullable().optional(),providerFee:e.z.string().nullable().optional(),totalFee:e.z.string()}),withdrawalFees:e.z.object({argentFee:e.z.string().nullable().optional(),protocolFee:e.z.string().nullable().optional(),providerFee:e.z.string().nullable().optional(),totalFee:e.z.string()}),performanceFees:e.z.object({argentFee:e.z.string().nullable().optional(),protocolFee:e.z.string().nullable().optional(),providerFee:e.z.string().nullable().optional(),totalFee:e.z.string()}).optional()}),buyEnabled:e.z.boolean().optional(),sellEnabled:e.z.boolean().optional(),claimEnabled:e.z.boolean().optional()}),l=e.z.discriminatedUnion("category",[s,o,r]),d=e.z.object({investments:e.z.array(l)}),g=e.z.object({calls:e.z.array(z.callSchema)}),m=e.z.object({investmentId:e.z.string(),investmentType:e.z.enum(["staking","lending","strkDelegatedStaking"]).optional(),accountAddress:t.addressSchemaArgentBackend,tokenAddress:t.addressSchemaArgentBackend,stakerInfo:n,amount:e.z.string()}),i=e.z.enum(["deposit","stake","initiateWithdraw","withdraw","claim"]),c=e.z.object({useFullBalance:e.z.boolean().optional(),subsequentTransaction:e.z.boolean().optional()}),b=e.z.object({investmentId:e.z.string().optional(),stakingAction:i,stakerInfo:n,tokenAddress:t.addressSchema,amount:e.z.string(),...c.shape});exports.buildSellOptsSchema=c;exports.investmentMetaSchema=b;exports.investmentSchema=l;exports.investmentsResponseSchema=d;exports.lendingInvestmentSchema=o;exports.liquidStakingInvestmentSchema=s;exports.stakerInfoSchema=n;exports.stakingActionSchema=i;exports.strkDelegatedStakingInvestmentSchema=r;exports.strkStakingCalldataResponseSchema=g;exports.strkStakingCalldataSchema=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),z=require("../utils/starknet/starknet.cjs"),t=require("../chains/starknet/address.cjs"),a=e.z.object({id:e.z.string(),dappId:e.z.string(),productId:e.z.string(),productName:e.z.string(),chain:e.z.string(),name:e.z.string(),description:e.z.string(),iconUrl:e.z.string().url(),learnMoreUrl:e.z.string().url().optional(),riskFactor:e.z.enum(["low"]),metrics:e.z.object({baseApy:e.z.string(),totalApy:e.z.string(),tvl:e.z.string().optional()}),incentives:e.z.array(e.z.object({name:e.z.string(),description:e.z.string(),iconUrl:e.z.string().url(),learnMoreUrl:e.z.string().url(),metric:e.z.object({apy:e.z.string()})})),buyEnabled:e.z.boolean(),sellEnabled:e.z.boolean()}),s=a.extend({category:e.z.literal("staking"),investableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"])}),withdrawableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"])}),fees:e.z.object({depositFees:e.z.object({protocolFee:e.z.string().nullable().optional(),totalFee:e.z.string()}),withdrawalFees:e.z.object({protocolFee:e.z.string().nullable().optional(),totalFee:e.z.string()}),performanceFees:e.z.object({argentFee:e.z.string().nullable().optional(),protocolFee:e.z.string().nullable().optional(),providerFee:e.z.string().nullable().optional(),totalFee:e.z.string()}).optional()})}),o=a.extend({category:e.z.literal("lending"),investableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"])}),withdrawableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"])}),claimRewardsUrl:e.z.string().url().optional(),fees:e.z.object({depositFees:e.z.object({totalFee:e.z.string()}),withdrawalFees:e.z.object({totalFee:e.z.string()})})}),n=e.z.object({name:e.z.string().optional(),iconUrl:e.z.string().url().optional(),address:e.z.string().optional()}),r=a.extend({category:e.z.literal("strkDelegatedStaking"),stakerInfo:n,investableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"]),useDecomposedBalances:e.z.boolean().optional()}),withdrawableAssets:e.z.object({tokenAddresses:e.z.array(t.addressSchemaArgentBackend),tokensRequirement:e.z.enum(["any"]),useDecomposedBalances:e.z.boolean().optional(),amountsRequirement:e.z.enum(["fullBalance"]).optional(),timelockDuration:e.z.number().optional()}),fees:e.z.object({depositFees:e.z.object({argentFee:e.z.string().nullable().optional(),protocolFee:e.z.string().nullable().optional(),providerFee:e.z.string().nullable().optional(),totalFee:e.z.string()}),withdrawalFees:e.z.object({argentFee:e.z.string().nullable().optional(),protocolFee:e.z.string().nullable().optional(),providerFee:e.z.string().nullable().optional(),totalFee:e.z.string()}),performanceFees:e.z.object({argentFee:e.z.string().nullable().optional(),protocolFee:e.z.string().nullable().optional(),providerFee:e.z.string().nullable().optional(),totalFee:e.z.string()}).optional()}),buyEnabled:e.z.boolean().optional(),sellEnabled:e.z.boolean().optional(),claimEnabled:e.z.boolean().optional()}),l=e.z.discriminatedUnion("category",[s,o,r]),d=e.z.object({investments:e.z.array(l)}),g=e.z.object({calls:e.z.array(z.callSchema)}),m=e.z.object({investmentId:e.z.string(),investmentType:e.z.enum(["staking","lending","strkDelegatedStaking"]).optional(),accountAddress:t.addressSchemaArgentBackend,tokenAddress:t.addressSchemaArgentBackend,stakerInfo:n,amount:e.z.string()}),i=e.z.enum(["deposit","stake","initiateWithdraw","withdraw","claim"]),c=e.z.object({useFullBalance:e.z.boolean().optional(),subsequentTransaction:e.z.boolean().optional()}),b=e.z.object({investmentId:e.z.string().optional(),stakingAction:i,stakerInfo:n,tokenAddress:t.addressSchema,amount:e.z.string(),...c.shape});exports.buildSellOptsSchema=c;exports.investmentMetaSchema=b;exports.investmentSchema=l;exports.investmentsResponseSchema=d;exports.lendingInvestmentSchema=o;exports.liquidStakingInvestmentSchema=s;exports.stakerInfoSchema=n;exports.stakingActionSchema=i;exports.strkDelegatedStakingInvestmentSchema=r;exports.strkStakingCalldataResponseSchema=g;exports.strkStakingCalldataSchema=m;
@@ -326,6 +326,7 @@ export declare const lendingInvestmentSchema: z.ZodObject<z.objectUtil.extendSha
326
326
  tokenAddresses: string[];
327
327
  tokensRequirement: "any";
328
328
  }>;
329
+ claimRewardsUrl: z.ZodOptional<z.ZodString>;
329
330
  fees: z.ZodObject<{
330
331
  depositFees: z.ZodObject<{
331
332
  totalFee: z.ZodString;
@@ -400,6 +401,7 @@ export declare const lendingInvestmentSchema: z.ZodObject<z.objectUtil.extendSha
400
401
  };
401
402
  };
402
403
  learnMoreUrl?: string | undefined;
404
+ claimRewardsUrl?: string | undefined;
403
405
  }, {
404
406
  name: string;
405
407
  chain: string;
@@ -444,6 +446,7 @@ export declare const lendingInvestmentSchema: z.ZodObject<z.objectUtil.extendSha
444
446
  };
445
447
  };
446
448
  learnMoreUrl?: string | undefined;
449
+ claimRewardsUrl?: string | undefined;
447
450
  }>;
448
451
  export declare const stakerInfoSchema: z.ZodObject<{
449
452
  name: z.ZodOptional<z.ZodString>;
@@ -1111,6 +1114,7 @@ export declare const investmentSchema: z.ZodDiscriminatedUnion<"category", [z.Zo
1111
1114
  tokenAddresses: string[];
1112
1115
  tokensRequirement: "any";
1113
1116
  }>;
1117
+ claimRewardsUrl: z.ZodOptional<z.ZodString>;
1114
1118
  fees: z.ZodObject<{
1115
1119
  depositFees: z.ZodObject<{
1116
1120
  totalFee: z.ZodString;
@@ -1185,6 +1189,7 @@ export declare const investmentSchema: z.ZodDiscriminatedUnion<"category", [z.Zo
1185
1189
  };
1186
1190
  };
1187
1191
  learnMoreUrl?: string | undefined;
1192
+ claimRewardsUrl?: string | undefined;
1188
1193
  }, {
1189
1194
  name: string;
1190
1195
  chain: string;
@@ -1229,6 +1234,7 @@ export declare const investmentSchema: z.ZodDiscriminatedUnion<"category", [z.Zo
1229
1234
  };
1230
1235
  };
1231
1236
  learnMoreUrl?: string | undefined;
1237
+ claimRewardsUrl?: string | undefined;
1232
1238
  }>, z.ZodObject<z.objectUtil.extendShape<{
1233
1239
  id: z.ZodString;
1234
1240
  dappId: z.ZodString;
@@ -1886,6 +1892,7 @@ export declare const investmentsResponseSchema: z.ZodObject<{
1886
1892
  tokenAddresses: string[];
1887
1893
  tokensRequirement: "any";
1888
1894
  }>;
1895
+ claimRewardsUrl: z.ZodOptional<z.ZodString>;
1889
1896
  fees: z.ZodObject<{
1890
1897
  depositFees: z.ZodObject<{
1891
1898
  totalFee: z.ZodString;
@@ -1960,6 +1967,7 @@ export declare const investmentsResponseSchema: z.ZodObject<{
1960
1967
  };
1961
1968
  };
1962
1969
  learnMoreUrl?: string | undefined;
1970
+ claimRewardsUrl?: string | undefined;
1963
1971
  }, {
1964
1972
  name: string;
1965
1973
  chain: string;
@@ -2004,6 +2012,7 @@ export declare const investmentsResponseSchema: z.ZodObject<{
2004
2012
  };
2005
2013
  };
2006
2014
  learnMoreUrl?: string | undefined;
2015
+ claimRewardsUrl?: string | undefined;
2007
2016
  }>, z.ZodObject<z.objectUtil.extendShape<{
2008
2017
  id: z.ZodString;
2009
2018
  dappId: z.ZodString;
@@ -2427,6 +2436,7 @@ export declare const investmentsResponseSchema: z.ZodObject<{
2427
2436
  };
2428
2437
  };
2429
2438
  learnMoreUrl?: string | undefined;
2439
+ claimRewardsUrl?: string | undefined;
2430
2440
  } | {
2431
2441
  name: string;
2432
2442
  chain: string;
@@ -2591,6 +2601,7 @@ export declare const investmentsResponseSchema: z.ZodObject<{
2591
2601
  };
2592
2602
  };
2593
2603
  learnMoreUrl?: string | undefined;
2604
+ claimRewardsUrl?: string | undefined;
2594
2605
  } | {
2595
2606
  name: string;
2596
2607
  chain: string;
@@ -64,6 +64,7 @@ const n = e.object({
64
64
  tokenAddresses: e.array(t),
65
65
  tokensRequirement: e.enum(["any"])
66
66
  }),
67
+ claimRewardsUrl: e.string().url().optional(),
67
68
  fees: e.object({
68
69
  depositFees: e.object({
69
70
  totalFee: e.string()
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("starknet"),{UINT_256_MAX:e}=n.uint256,i=t=>String(t)===String(e);exports.isUnlimitedAmount=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("starknet"),i=t=>String(t)===String(e.UINT_256_MAX);exports.isUnlimitedAmount=i;
@@ -1,5 +1,5 @@
1
- import { uint256 as n } from "starknet";
2
- const { UINT_256_MAX: i } = n, o = (t) => String(t) === String(i);
1
+ import { UINT_256_MAX as r } from "starknet";
2
+ const n = (t) => String(t) === String(r);
3
3
  export {
4
- o as isUnlimitedAmount
4
+ n as isUnlimitedAmount
5
5
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("starknet"),u=require("zod"),i=require("../bigdecimal/parseUnits.cjs"),r=(e,t=18)=>i.parseUnits(e.replace(",","."),Number(t)),n=u.z.string().trim().refine(e=>e!=="",{message:"Amount is required"}).refine(e=>{try{const t=r(e).value;if(t<0n)throw new Error("Amount must be positive");if(t===0n)throw new Error("Amount can not be zero");if(t>o.uint256.UINT_256_MAX)throw new Error("Amount is too big")}catch{throw new Error("Amount should be a number")}return!0},{message:"Invalid amount"}),s=e=>!!n.parse(e);exports.inputAmountSchema=n;exports.isValidInputAmount=s;exports.parseAmount=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("starknet"),u=require("zod"),s=require("../bigdecimal/parseUnits.cjs"),t=(e,r=18)=>s.parseUnits(e.replace(",","."),Number(r)),n=u.z.string().trim().refine(e=>e!=="",{message:"Amount is required"}).refine(e=>{try{const r=t(e).value;if(r<0n)throw new Error("Amount must be positive");if(r===0n)throw new Error("Amount can not be zero");if(r>o.UINT_256_MAX)throw new Error("Amount is too big")}catch{throw new Error("Amount should be a number")}return!0},{message:"Invalid amount"}),i=e=>!!n.parse(e);exports.inputAmountSchema=n;exports.isValidInputAmount=i;exports.parseAmount=t;
@@ -1,5 +1,5 @@
1
- import { num } from 'starknet';
1
+ import { BigNumberish } from 'starknet';
2
2
  import { z } from 'zod';
3
- export declare const parseAmount: (amount: string, decimals?: num.BigNumberish) => import('..').BigDecimal;
3
+ export declare const parseAmount: (amount: string, decimals?: BigNumberish) => import('..').BigDecimal;
4
4
  export declare const inputAmountSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
5
5
  export declare const isValidInputAmount: (amount: string) => boolean;
@@ -1,24 +1,24 @@
1
- import { uint256 as t } from "starknet";
2
- import { z as n } from "zod";
3
- import { parseUnits as e } from "../bigdecimal/parseUnits.js";
4
- const i = (r, o = 18) => e(r.replace(",", "."), Number(o)), m = n.string().trim().refine((r) => r !== "", {
1
+ import { UINT_256_MAX as t } from "starknet";
2
+ import { z as e } from "zod";
3
+ import { parseUnits as n } from "../bigdecimal/parseUnits.js";
4
+ const m = (r, o = 18) => n(r.replace(",", "."), Number(o)), i = e.string().trim().refine((r) => r !== "", {
5
5
  message: "Amount is required"
6
6
  }).refine((r) => {
7
7
  try {
8
- const o = i(r).value;
8
+ const o = m(r).value;
9
9
  if (o < 0n)
10
10
  throw new Error("Amount must be positive");
11
11
  if (o === 0n)
12
12
  throw new Error("Amount can not be zero");
13
- if (o > t.UINT_256_MAX)
13
+ if (o > t)
14
14
  throw new Error("Amount is too big");
15
15
  } catch {
16
16
  throw new Error("Amount should be a number");
17
17
  }
18
18
  return !0;
19
- }, { message: "Invalid amount" }), p = (r) => !!m.parse(r);
19
+ }, { message: "Invalid amount" }), p = (r) => !!i.parse(r);
20
20
  export {
21
- m as inputAmountSchema,
21
+ i as inputAmountSchema,
22
22
  p as isValidInputAmount,
23
- i as parseAmount
23
+ m as parseAmount
24
24
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=e=>{const t=Math.cbrt(e);return isNaN(t)?Math.cbrt(2):t};exports.calculateCubeRootAdjustment=c;
@@ -0,0 +1,4 @@
1
+ export type FeeAdjustmentFn = (ratio: number) => number;
2
+ export declare const calculateSqrtAdjustment: (ratio: number) => number;
3
+ export declare const calculateCubeRootAdjustment: (ratio: number) => number;
4
+ export declare const calculateNonLinearAdjustment: (ratio: number) => number;
@@ -0,0 +1,7 @@
1
+ const c = (r) => {
2
+ const t = Math.cbrt(r);
3
+ return isNaN(t) ? Math.cbrt(2) : t;
4
+ };
5
+ export {
6
+ c as calculateCubeRootAdjustment
7
+ };
@@ -1,7 +1,7 @@
1
- import { num } from 'starknet';
1
+ import { BigNumberish } from 'starknet';
2
2
  export declare const FEE_OVERHEAD: number;
3
3
  export declare const argentMaxFee: ({ estimatedFee, overheadMultiplier, }: {
4
- estimatedFee: num.BigNumberish;
4
+ estimatedFee: BigNumberish;
5
5
  overheadMultiplier?: number;
6
6
  }) => string;
7
7
  /**
@@ -12,7 +12,7 @@ export declare const argentMaxFee: ({ estimatedFee, overheadMultiplier, }: {
12
12
  * @returns: the maximum fee considering the overhead
13
13
  */
14
14
  export declare const modifySnjsFeeOverhead: ({ suggestedMaxFee, overheadMultiplier, starknetJsOverheadMultiplier, }: {
15
- suggestedMaxFee: num.BigNumberish;
15
+ suggestedMaxFee: BigNumberish;
16
16
  overheadMultiplier?: number;
17
17
  starknetJsOverheadMultiplier?: number;
18
18
  }) => string;
@@ -2,4 +2,3 @@ export * from './argentMaxFee';
2
2
  export * from './error';
3
3
  export * from './model';
4
4
  export * from './utils';
5
- export * from './utilsV2';