@argent/x-shared 1.59.0 → 1.60.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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +224 -214
- package/dist/simulation.cjs +1 -1
- package/dist/simulation.js +68 -55
- package/dist/src/features/simulation/fees/schema.cjs +1 -1
- package/dist/src/features/simulation/fees/schema.d.ts +848 -0
- package/dist/src/features/simulation/fees/schema.js +36 -4
- package/dist/src/features/simulation/transactionReview/schema.cjs +1 -1
- package/dist/src/features/simulation/transactionReview/schema.d.ts +8264 -148
- package/dist/src/features/simulation/transactionReview/schema.js +105 -85
- package/dist/src/staking/schema.d.ts +24 -24
- package/dist/src/transactions/estimate/index.d.ts +1 -0
- package/dist/src/transactions/estimate/utilsV2.cjs +1 -0
- package/dist/src/transactions/estimate/utilsV2.d.ts +14 -0
- package/dist/src/transactions/estimate/utilsV2.js +96 -0
- package/dist/src/transactions/getTransactionVersion.cjs +1 -1
- package/dist/src/transactions/getTransactionVersion.d.ts +6 -0
- package/dist/src/transactions/getTransactionVersion.js +15 -12
- package/dist/src/transactions/txv3.cjs +1 -1
- package/dist/src/transactions/txv3.js +4 -4
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/type.utils.d.ts +215 -0
- package/package.json +3 -3
|
@@ -1,20 +1,52 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
2
|
import { addressSchema as i } from "../../../chains/starknet/address.js";
|
|
3
|
-
const
|
|
3
|
+
const s = e.object({
|
|
4
4
|
amount: e.bigint(),
|
|
5
5
|
pricePerUnit: e.bigint()
|
|
6
6
|
}).or(e.object({ maxFee: e.bigint() })), t = e.object({
|
|
7
7
|
feeTokenAddress: i,
|
|
8
8
|
amount: e.bigint(),
|
|
9
9
|
pricePerUnit: e.bigint(),
|
|
10
|
-
max:
|
|
10
|
+
max: s.optional(),
|
|
11
11
|
dataGasConsumed: e.bigint().optional(),
|
|
12
12
|
dataGasPrice: e.bigint().optional()
|
|
13
|
-
}),
|
|
13
|
+
}), p = e.object({
|
|
14
14
|
deployment: t.optional(),
|
|
15
15
|
transactions: t
|
|
16
|
+
}), m = t.extend({
|
|
17
|
+
type: e.literal("native")
|
|
18
|
+
}), a = e.object({
|
|
19
|
+
type: e.literal("paymaster"),
|
|
20
|
+
feeTokenAddress: i,
|
|
21
|
+
maxFee: e.bigint(),
|
|
22
|
+
overallFee: e.bigint()
|
|
23
|
+
// might not be needed, maybe remove?
|
|
24
|
+
}), d = e.discriminatedUnion("type", [
|
|
25
|
+
m,
|
|
26
|
+
a
|
|
27
|
+
]), o = e.object({
|
|
28
|
+
type: e.literal("native"),
|
|
29
|
+
transactions: t,
|
|
30
|
+
deployment: t.optional()
|
|
31
|
+
}), n = e.object({
|
|
32
|
+
type: e.literal("paymaster"),
|
|
33
|
+
transactions: a.omit({ type: !0 }),
|
|
34
|
+
deployment: a.omit({ type: !0 }).optional()
|
|
35
|
+
}), l = e.discriminatedUnion("type", [
|
|
36
|
+
o,
|
|
37
|
+
n
|
|
38
|
+
]), y = e.object({
|
|
39
|
+
native: o.omit({ type: !0 }),
|
|
40
|
+
paymaster: n.omit({ type: !0 }).optional()
|
|
16
41
|
});
|
|
17
42
|
export {
|
|
18
43
|
t as estimatedFeeSchema,
|
|
19
|
-
|
|
44
|
+
d as estimatedFeeV2Schema,
|
|
45
|
+
p as estimatedFeesSchema,
|
|
46
|
+
l as estimatedFeesV2Schema,
|
|
47
|
+
y as feeEstimationResultV2Schema,
|
|
48
|
+
m as nativeEstimatedFeeSchema,
|
|
49
|
+
o as nativeEstimatedFeesSchema,
|
|
50
|
+
a as paymasterEstimatedFeeSchema,
|
|
51
|
+
n as paymasterEstimatedFeesSchema
|
|
20
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),p=require("../fees/schema.cjs"),m=require("../warning/schema.cjs"),n=require("../../../chains/starknet/address.cjs"),F=e.z.object({name:e.z.string(),url:e.z.string(),position:e.z.number()}),o=e.z.object({address:e.z.string(),name:e.z.string(),symbol:e.z.string().optional(),decimals:e.z.number().optional(),unknown:e.z.boolean(),iconUrl:e.z.string().optional(),type:e.z.string()}),i=e.z.discriminatedUnion("type",[e.z.object({type:e.z.literal("amount"),label:e.z.string(),token:o,amount:e.z.string(),usd:e.z.string(),editable:e.z.boolean()}),e.z.object({type:e.z.literal("address"),label:e.z.string(),address:e.z.string(),addressName:e.z.string().optional(),verified:e.z.boolean().optional()}),e.z.object({type:e.z.literal("timestamp"),label:e.z.string(),value:e.z.string()}),e.z.object({type:e.z.literal("token_address"),label:e.z.string(),token:o}),e.z.object({type:e.z.literal("calldata"),label:e.z.string(),entrypoint:e.z.string(),calldata:e.z.array(e.z.string())}),e.z.object({type:e.z.literal("class_hash"),label:e.z.string(),classHash:e.z.string()}),e.z.object({type:e.z.literal("text"),label:e.z.string(),text:e.z.string()}),e.z.object({type:e.z.literal("nft"),label:e.z.string(),token:o})]),d=e.z.object({name:e.z.string(),properties:e.z.array(i),defaultProperties:e.z.array(i).optional()}),g=e.z.union([e.z.literal("verified"),e.z.literal("neutral"),e.z.literal("partial"),e.z.literal("warn")]),u=e.z.object({unknown_token:e.z.unknown().optional(),date_of_addition:e.z.string().optional(),contract_address:n.addressSchema.optional(),reason:e.z.string().optional(),value:e.z.string().or(e.z.number()).optional()}),r=e.z.object({reason:m.reasonsSchema,details:u.optional(),severity:m.severitySchema}),b=e.z.object({assessment:g,warnings:e.z.array(r).optional(),assessmentReasons:e.z.array(e.z.string()).optional(),assessmentDetails:e.z.object({contract_address:e.z.string()}).optional(),action:d}),S=e.z.object({name:e.z.string(),description:e.z.string(),logoUrl:e.z.string(),iconUrl:e.z.string(),argentVerified:e.z.boolean(),links:e.z.array(F)}),h=e.z.object({assessment:e.z.union([e.z.literal("verified"),e.z.literal("neutral"),e.z.literal("partial"),e.z.literal("warn")]),warnings:e.z.array(r).optional(),assessmentDetails:e.z.object({contract_address:e.z.string()}).optional(),targetedDapp:S.optional(),reviews:e.z.array(b)}).optional(),y=e.z.object({banner:e.z.string().nullable().optional(),preview:e.z.string().nullable().optional(),full:e.z.string().nullable().optional(),original:e.z.string().nullable().optional()}),T=e.z.object({twitter:e.z.string().optional(),external:e.z.string().optional(),discord:e.z.string().optional()}),s=e.z.object({address:n.addressSchemaArgentBackend,decimals:e.z.number().optional(),symbol:e.z.string().optional(),name:e.z.string(),description:e.z.string().optional(),type:e.z.string().optional(),usdValue:e.z.string().optional(),iconUrl:e.z.string().optional(),unknown:e.z.boolean().optional(),imageUrls:y.optional(),links:T.optional()}),U=e.z.object({tokenAddress:n.addressSchemaArgentBackend,owner:n.addressSchemaArgentBackend,spender:n.addressSchemaArgentBackend,value:e.z.string().optional(),approvalForAll:e.z.boolean(),details:s.optional()}),x=e.z.object({tokenAddress:n.addressSchemaArgentBackend,from:n.addressSchemaArgentBackend,to:n.addressSchemaArgentBackend,tokenId:e.z.string().optional(),value:e.z.string().optional(),details:s.optional()}),t=e.z.union([e.z.string(),e.z.number(),e.z.bigint()]).transform(a=>parseInt(a.toString(),10)),f={overallFee:t,gasPrice:t,gasUsage:t,dataGasPrice:t.optional(),dataGasConsumed:t.optional()},j=e.z.object({...f,unit:e.z.string().transform(a=>a.toUpperCase()).pipe(e.z.literal("WEI")),maxFee:t}),l=e.z.object({address:n.addressSchemaArgentBackend,unknown:e.z.boolean(),type:e.z.literal("ERC20")}),k=e.z.object({...f,unit:e.z.string().transform(a=>a.toUpperCase()).pipe(e.z.literal("FRI")),maxAmount:t,maxPricePerUnit:t,token:l}),v=e.z.object({token:l,overallFee:t,maxFee:t}),c=j.or(k),w=c.or(v),D=e.z.object({type:e.z.string(),label:e.z.string(),tokenId:e.z.string().optional(),value:e.z.string().optional(),usdValue:e.z.string().optional(),token:s,sent:e.z.boolean().optional(),tokenIdDetails:e.z.object({name:e.z.string().optional(),description:e.z.string().optional(),imageUrls:y.optional()}).optional()}),B=e.z.object({approvals:e.z.array(U).optional(),transfers:e.z.array(x).optional(),calculatedNonce:e.z.string().optional(),feeEstimation:c,feeEstimations:e.z.array(w),summary:e.z.array(D).optional()}),P=e.z.object({label:e.z.string().optional(),code:e.z.number().optional(),message:e.z.string().optional(),error:e.z.string().optional()}),E=e.z.object({reviewOfTransaction:h,simulation:B,simulationError:e.z.undefined()}),A=e.z.object({reviewOfTransaction:h,simulation:e.z.undefined(),simulationError:P}),z=E.or(A),V=e.z.object({transactions:e.z.array(z).optional()}),R=e.z.object({transactions:e.z.array(z).optional(),enrichedFeeEstimation:p.estimatedFeesSchema.optional(),isBackendDown:e.z.boolean().default(!1).optional()}),N=e.z.object({transactions:e.z.array(z).optional(),enrichedFeeEstimation:e.z.array(p.estimatedFeesV2Schema).optional(),isBackendDown:e.z.boolean().default(!1).optional()});function _(a){return E.safeParse(a).success}function O(a){return A.safeParse(a).success}exports.actionSchema=d;exports.assessmentSchema=g;exports.enrichedSimulateAndReviewSchema=R;exports.enrichedSimulateAndReviewV2Schema=N;exports.feeEstimationNativeOrPaymasterSchema=w;exports.feeEstimationSchema=c;exports.feeEstimationTxV1Schema=j;exports.feeEstimationTxV3Schema=k;exports.isNotTransactionSimulationError=_;exports.isTransactionSimulationError=O;exports.paymasterFeeEstimationSchema=v;exports.paymasterFeeTokenSchema=l;exports.propertySchema=i;exports.reviewSchema=b;exports.simulateAndReviewSchema=V;exports.targetedDappSchema=S;exports.warningDetailsSchema=u;exports.warningSchema=r;
|