@argent/x-shared 1.62.1 → 1.62.3
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/src/features/paymaster/IPaymasterService.d.ts +3 -3
- package/dist/src/features/paymaster/PaymasterService.cjs +1 -1
- package/dist/src/features/paymaster/PaymasterService.d.ts +3 -3
- package/dist/src/features/paymaster/PaymasterService.js +31 -27
- package/dist/src/features/paymaster/types.cjs +1 -1
- package/dist/src/features/paymaster/types.d.ts +32 -0
- package/dist/src/features/paymaster/types.js +19 -14
- package/dist/src/features/simulation/fees/schema.d.ts +2 -0
- package/dist/src/features/simulation/transactionReview/schema.cjs +1 -1
- package/dist/src/features/simulation/transactionReview/schema.d.ts +65 -0
- package/dist/src/features/simulation/transactionReview/schema.js +93 -87
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypedData } from 'starknet';
|
|
2
|
-
import { PaymasterExecutionDataParams, PaymasterExecuteParams } from './types';
|
|
2
|
+
import { PaymasterExecutionDataParams, PaymasterExecuteParams, PaymasterOptions } from './types';
|
|
3
3
|
export interface IPaymasterService {
|
|
4
|
-
getExecutionData(params: PaymasterExecutionDataParams,
|
|
5
|
-
execute(params: PaymasterExecuteParams,
|
|
4
|
+
getExecutionData(params: PaymasterExecutionDataParams, options?: PaymasterOptions): Promise<TypedData>;
|
|
5
|
+
execute(params: PaymasterExecuteParams, options?: PaymasterOptions): Promise<string>;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("starknet"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("starknet"),d=require("url-join"),y=require("./types.cjs"),h=require("../../utils/starknet/starknet.cjs");class f{constructor(e="",t){this.argentRelayerUrl=e,this.httpService=t}async getExecutionData(e,t={}){const{useAvnu:n,isSubsidised:a}=t,r=d(n?this.getAvnuUrl(e.networkId):this.argentRelayerUrl,"/build-typed-data"),i={calls:n?e.calls.map(c=>({contractAddress:s.num.toHex(c.contractAddress),calldata:s.CallData.toCalldata(c.calldata).map(p=>s.num.toHex(p)),entrypoint:c.entrypoint})):e.calls,userAddress:e.accountAddress,gasTokenAddress:a?null:s.num.toHex(e.feeTokenAddress),maxGasTokenAmount:a?null:s.num.toHex(e.feeTokenAddress),accountClassHash:e.accountClassHash},o=await this.httpService.post(r,{body:s.json.stringify(i),headers:{"Content-Type":"application/json"}}),u=h.typedDataSchema.safeParse(o);if(!u.success)throw new Error("Invalid response from paymaster");return u.data}getAvnuUrl(e){if(!e)throw new Error("Network id is required for Avnu paymaster");let t="";if(e==="mainnet"||e==="mainnet-alpha")t="starknet";else if(e==="sepolia"||e==="sepolia-alpha")t="sepolia";else throw new Error("Invalid network id");return`https://${t}.api.avnu.fi/paymaster/v1`}async execute(e,t={}){const{useAvnu:n,isSubsidised:a}=t;let r=d(n?this.getAvnuUrl(e.networkId):this.argentRelayerUrl,"/execute");a&&(r=d(r,"?isSubsidised=true"));const l={signature:e.signature,userAddress:e.accountAddress,typedData:n?s.json.stringify(e.typedData):e.typedData,deploymentData:e.deploymentData},i=await this.httpService.post(r,{body:s.json.stringify(l),headers:{"Content-Type":"application/json"}}),o=y.paymasterExecuteResponse.safeParse(i);if(!o.success)throw new Error("Invalid response from paymaster");return o.data.transactionHash}}exports.PaymasterService=f;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TypedData } from '@starknet-io/types-js';
|
|
2
2
|
import { IHttpService } from '../../http';
|
|
3
3
|
import { IPaymasterService } from './IPaymasterService';
|
|
4
|
-
import { PaymasterExecuteParams, PaymasterExecutionDataParams } from './types';
|
|
4
|
+
import { PaymasterOptions, PaymasterExecuteParams, PaymasterExecutionDataParams } from './types';
|
|
5
5
|
export declare class PaymasterService implements IPaymasterService {
|
|
6
6
|
private readonly argentRelayerUrl;
|
|
7
7
|
private readonly httpService;
|
|
8
8
|
constructor(argentRelayerUrl: string | undefined, httpService: IHttpService);
|
|
9
|
-
getExecutionData(params: PaymasterExecutionDataParams,
|
|
9
|
+
getExecutionData(params: PaymasterExecutionDataParams, options?: PaymasterOptions): Promise<TypedData>;
|
|
10
10
|
getAvnuUrl(networkId?: string): string;
|
|
11
|
-
execute(params: PaymasterExecuteParams,
|
|
11
|
+
execute(params: PaymasterExecuteParams, options?: PaymasterOptions): Promise<string>;
|
|
12
12
|
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { CallData as
|
|
2
|
-
import
|
|
3
|
-
import { paymasterExecuteResponse as
|
|
4
|
-
import { typedDataSchema as
|
|
5
|
-
class
|
|
1
|
+
import { CallData as h, num as o, json as l } from "starknet";
|
|
2
|
+
import c from "url-join";
|
|
3
|
+
import { paymasterExecuteResponse as f } from "./types.js";
|
|
4
|
+
import { typedDataSchema as A } from "../../utils/starknet/starknet.js";
|
|
5
|
+
class b {
|
|
6
6
|
constructor(e = "", t) {
|
|
7
7
|
this.argentRelayerUrl = e, this.httpService = t;
|
|
8
8
|
}
|
|
9
|
-
async getExecutionData(e, t =
|
|
10
|
-
const r =
|
|
11
|
-
calls:
|
|
12
|
-
contractAddress:
|
|
13
|
-
calldata:
|
|
14
|
-
entrypoint:
|
|
9
|
+
async getExecutionData(e, t = {}) {
|
|
10
|
+
const { useAvnu: s, isSubsidised: a } = t, r = c(s ? this.getAvnuUrl(e.networkId) : this.argentRelayerUrl, "/build-typed-data"), i = {
|
|
11
|
+
calls: s ? e.calls.map((d) => ({
|
|
12
|
+
contractAddress: o.toHex(d.contractAddress),
|
|
13
|
+
calldata: h.toCalldata(d.calldata).map((y) => o.toHex(y)),
|
|
14
|
+
entrypoint: d.entrypoint
|
|
15
15
|
})) : e.calls,
|
|
16
16
|
userAddress: e.accountAddress,
|
|
17
|
-
gasTokenAddress: a.toHex(e.feeTokenAddress),
|
|
18
|
-
maxGasTokenAmount: a.toHex(e.
|
|
17
|
+
gasTokenAddress: a ? null : o.toHex(e.feeTokenAddress),
|
|
18
|
+
maxGasTokenAmount: a ? null : o.toHex(e.feeTokenAddress),
|
|
19
19
|
accountClassHash: e.accountClassHash
|
|
20
|
-
},
|
|
21
|
-
body:
|
|
20
|
+
}, n = await this.httpService.post(r, {
|
|
21
|
+
body: l.stringify(i),
|
|
22
22
|
headers: {
|
|
23
23
|
"Content-Type": "application/json"
|
|
24
24
|
}
|
|
25
|
-
}),
|
|
26
|
-
if (!
|
|
25
|
+
}), p = A.safeParse(n);
|
|
26
|
+
if (!p.success)
|
|
27
27
|
throw new Error("Invalid response from paymaster");
|
|
28
|
-
return
|
|
28
|
+
return p.data;
|
|
29
29
|
}
|
|
30
30
|
getAvnuUrl(e) {
|
|
31
31
|
if (!e)
|
|
@@ -39,22 +39,26 @@ class A {
|
|
|
39
39
|
throw new Error("Invalid network id");
|
|
40
40
|
return `https://${t}.api.avnu.fi/paymaster/v1`;
|
|
41
41
|
}
|
|
42
|
-
async execute(e, t =
|
|
43
|
-
const
|
|
42
|
+
async execute(e, t = {}) {
|
|
43
|
+
const { useAvnu: s, isSubsidised: a } = t;
|
|
44
|
+
let r = c(s ? this.getAvnuUrl(e.networkId) : this.argentRelayerUrl, "/execute");
|
|
45
|
+
a && (r = c(r, "?isSubsidised=true"));
|
|
46
|
+
const u = {
|
|
44
47
|
signature: e.signature,
|
|
45
48
|
userAddress: e.accountAddress,
|
|
46
|
-
typedData:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
typedData: s ? l.stringify(e.typedData) : e.typedData,
|
|
50
|
+
deploymentData: e.deploymentData
|
|
51
|
+
}, i = await this.httpService.post(r, {
|
|
52
|
+
body: l.stringify(u),
|
|
49
53
|
headers: {
|
|
50
54
|
"Content-Type": "application/json"
|
|
51
55
|
}
|
|
52
|
-
}),
|
|
53
|
-
if (!
|
|
56
|
+
}), n = f.safeParse(i);
|
|
57
|
+
if (!n.success)
|
|
54
58
|
throw new Error("Invalid response from paymaster");
|
|
55
|
-
return
|
|
59
|
+
return n.data.transactionHash;
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
export {
|
|
59
|
-
|
|
63
|
+
b as PaymasterService
|
|
60
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("zod"),e=require("../../chains/starknet/address.cjs"),t=require("../../utils/starknet/starknet.cjs"),r=require("../../backend/schema.cjs"),s=a.z.object({calls:a.z.array(t.callSchema),accountAddress:e.addressSchema,networkId:r.argentNetworkIdSchema.or(r.argentBackendNetworkIdSchema).optional(),feeTokenAddress:e.addressSchema,maxFee:t.bigNumberishSchema,accountClassHash:a.z.string().optional()}),o=a.z.object({signature:a.z.string().array(),accountAddress:e.addressSchema,typedData:t.typedDataSchema,networkId:r.argentNetworkIdSchema.optional(),deploymentData:a.z.object({class_hash:a.z.string().optional(),salt:a.z.string().or(a.z.number()).or(a.z.bigint()).optional(),unique:a.z.string(),calldata:a.z.array(a.z.string())}).optional()}),n=a.z.object({transactionHash:a.z.string()});exports.paymasterExecuteParams=o;exports.paymasterExecuteResponse=n;exports.paymasterExecutionDataParams=s;
|
|
@@ -97,6 +97,22 @@ export declare const paymasterExecuteParams: z.ZodObject<{
|
|
|
97
97
|
domain: Record<string, unknown>;
|
|
98
98
|
}>;
|
|
99
99
|
networkId: z.ZodOptional<z.ZodEnum<["mainnet-alpha", "sepolia-alpha"]>>;
|
|
100
|
+
deploymentData: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
class_hash: z.ZodOptional<z.ZodString>;
|
|
102
|
+
salt: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBigInt]>>;
|
|
103
|
+
unique: z.ZodString;
|
|
104
|
+
calldata: z.ZodArray<z.ZodString, "many">;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
calldata: string[];
|
|
107
|
+
unique: string;
|
|
108
|
+
salt?: string | number | bigint | undefined;
|
|
109
|
+
class_hash?: string | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
calldata: string[];
|
|
112
|
+
unique: string;
|
|
113
|
+
salt?: string | number | bigint | undefined;
|
|
114
|
+
class_hash?: string | undefined;
|
|
115
|
+
}>>;
|
|
100
116
|
}, "strip", z.ZodTypeAny, {
|
|
101
117
|
signature: string[];
|
|
102
118
|
accountAddress: `0x${string}`;
|
|
@@ -118,6 +134,12 @@ export declare const paymasterExecuteParams: z.ZodObject<{
|
|
|
118
134
|
domain: Record<string, unknown>;
|
|
119
135
|
};
|
|
120
136
|
networkId?: "mainnet-alpha" | "sepolia-alpha" | undefined;
|
|
137
|
+
deploymentData?: {
|
|
138
|
+
calldata: string[];
|
|
139
|
+
unique: string;
|
|
140
|
+
salt?: string | number | bigint | undefined;
|
|
141
|
+
class_hash?: string | undefined;
|
|
142
|
+
} | undefined;
|
|
121
143
|
}, {
|
|
122
144
|
signature: string[];
|
|
123
145
|
accountAddress: string;
|
|
@@ -139,6 +161,12 @@ export declare const paymasterExecuteParams: z.ZodObject<{
|
|
|
139
161
|
domain: Record<string, unknown>;
|
|
140
162
|
};
|
|
141
163
|
networkId?: "mainnet-alpha" | "sepolia-alpha" | undefined;
|
|
164
|
+
deploymentData?: {
|
|
165
|
+
calldata: string[];
|
|
166
|
+
unique: string;
|
|
167
|
+
salt?: string | number | bigint | undefined;
|
|
168
|
+
class_hash?: string | undefined;
|
|
169
|
+
} | undefined;
|
|
142
170
|
}>;
|
|
143
171
|
export type PaymasterExecuteParams = z.infer<typeof paymasterExecuteParams>;
|
|
144
172
|
export declare const paymasterExecuteResponse: z.ZodObject<{
|
|
@@ -149,3 +177,7 @@ export declare const paymasterExecuteResponse: z.ZodObject<{
|
|
|
149
177
|
transactionHash: string;
|
|
150
178
|
}>;
|
|
151
179
|
export type PaymasterExecuteResponse = z.infer<typeof paymasterExecuteResponse>;
|
|
180
|
+
export type PaymasterOptions = {
|
|
181
|
+
useAvnu?: boolean;
|
|
182
|
+
isSubsidised?: boolean;
|
|
183
|
+
};
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { z as a } from "zod";
|
|
2
|
-
import { addressSchema as
|
|
2
|
+
import { addressSchema as t } from "../../chains/starknet/address.js";
|
|
3
3
|
import { bigNumberishSchema as r, callSchema as o, typedDataSchema as s } from "../../utils/starknet/starknet.js";
|
|
4
|
-
import { argentNetworkIdSchema as
|
|
5
|
-
const
|
|
4
|
+
import { argentNetworkIdSchema as e, argentBackendNetworkIdSchema as n } from "../../backend/schema.js";
|
|
5
|
+
const d = a.object({
|
|
6
6
|
calls: a.array(o),
|
|
7
|
-
accountAddress:
|
|
8
|
-
networkId:
|
|
9
|
-
feeTokenAddress:
|
|
7
|
+
accountAddress: t,
|
|
8
|
+
networkId: e.or(n).optional(),
|
|
9
|
+
feeTokenAddress: t,
|
|
10
10
|
maxFee: r,
|
|
11
11
|
accountClassHash: a.string().optional()
|
|
12
|
-
}),
|
|
12
|
+
}), l = a.object({
|
|
13
13
|
signature: a.string().array(),
|
|
14
|
-
accountAddress:
|
|
14
|
+
accountAddress: t,
|
|
15
15
|
typedData: s,
|
|
16
|
-
networkId:
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
networkId: e.optional(),
|
|
17
|
+
deploymentData: a.object({
|
|
18
|
+
class_hash: a.string().optional(),
|
|
19
|
+
salt: a.string().or(a.number()).or(a.bigint()).optional(),
|
|
20
|
+
unique: a.string(),
|
|
21
|
+
calldata: a.array(a.string())
|
|
22
|
+
}).optional()
|
|
23
|
+
}), g = a.object({
|
|
19
24
|
transactionHash: a.string()
|
|
20
25
|
});
|
|
21
26
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
l as paymasterExecuteParams,
|
|
28
|
+
g as paymasterExecuteResponse,
|
|
29
|
+
d as paymasterExecutionDataParams
|
|
25
30
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { UnionEvaluate } from '../../../utils/type.utils';
|
|
3
|
+
import { SubsidyStatus } from '../transactionReview/schema';
|
|
3
4
|
export declare const estimatedFeeSchema: z.ZodObject<{
|
|
4
5
|
feeTokenAddress: z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEffects<z.ZodString, string, string>>, `0x${string}`, string>;
|
|
5
6
|
amount: z.ZodBigInt;
|
|
@@ -756,6 +757,7 @@ export type EstimatedFeesV2 = z.infer<typeof estimatedFeesV2Schema>;
|
|
|
756
757
|
export type EstimatedFeesV2Enriched = UnionEvaluate<EstimatedFeesV2 & {
|
|
757
758
|
id: string;
|
|
758
759
|
timestamp: number;
|
|
760
|
+
subsidyStatus?: SubsidyStatus;
|
|
759
761
|
}>;
|
|
760
762
|
export type NativeEstimatedFee = z.infer<typeof nativeEstimatedFeeSchema>;
|
|
761
763
|
export type PaymasterEstimatedFee = z.infer<typeof paymasterEstimatedFeeSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),d=require("../fees/schema.cjs"),p=require("../warning/schema.cjs"),n=require("../../../chains/starknet/address.cjs"),T=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})]),g=e.z.object({name:e.z.string(),properties:e.z.array(i),defaultProperties:e.z.array(i).optional()}),u=e.z.union([e.z.literal("verified"),e.z.literal("neutral"),e.z.literal("partial"),e.z.literal("warn")]),b=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()}),s=e.z.object({reason:p.reasonsSchema,details:b.optional(),severity:p.severitySchema}),S=e.z.object({assessment:u,warnings:e.z.array(s).optional(),assessmentReasons:e.z.array(e.z.string()).optional(),assessmentDetails:e.z.object({contract_address:e.z.string()}).optional(),action:g}),h=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(T)}),y=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(s).optional(),assessmentDetails:e.z.object({contract_address:e.z.string()}).optional(),targetedDapp:h.optional(),reviews:e.z.array(S)}).optional(),f=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()}),D=e.z.object({twitter:e.z.string().optional(),external:e.z.string().optional(),discord:e.z.string().optional()}),r=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:f.optional(),links:D.optional()}),U=e.z.object({tokenAddress:n.addressSchemaArgentBackend,owner:n.addressSchemaArgentBackend,spender:n.addressSchemaArgentBackend,value:e.z.string().optional(),approvalForAll:e.z.boolean(),details:r.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:r.optional()}),t=e.z.union([e.z.string(),e.z.number(),e.z.bigint()]).transform(a=>parseInt(a.toString(),10)),j={overallFee:t,gasPrice:t,gasUsage:t,dataGasPrice:t.optional(),dataGasConsumed:t.optional()},k=e.z.object({...j,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")}),v=e.z.object({...j,unit:e.z.string().transform(a=>a.toUpperCase()).pipe(e.z.literal("FRI")),maxAmount:t,maxPricePerUnit:t,token:l}),w=e.z.object({token:l,overallFee:t,maxFee:t}),c=k.or(v),E=c.or(w),B=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:r,sent:e.z.boolean().optional(),tokenIdDetails:e.z.object({name:e.z.string().optional(),description:e.z.string().optional(),imageUrls:f.optional()}).optional()}),P=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(E),summary:e.z.array(B).optional()}),V=e.z.object({label:e.z.string().optional(),code:e.z.number().optional(),message:e.z.string().optional(),error:e.z.string().optional()}),A=e.z.object({reviewOfTransaction:y,simulation:P,simulationError:e.z.undefined()}),F=e.z.object({reviewOfTransaction:y,simulation:e.z.undefined(),simulationError:V}),z=A.or(F),m=e.z.object({subsidiseDeployment:e.z.boolean(),subsidiseTransaction:e.z.boolean()}),R=e.z.object({transactions:e.z.array(z).optional(),subsidyStatus:m.optional()}),N=e.z.object({transactions:e.z.array(z).optional(),subsidyStatus:m.optional(),enrichedFeeEstimation:d.estimatedFeesSchema.optional(),isBackendDown:e.z.boolean().default(!1).optional()}),_=e.z.object({transactions:e.z.array(z).optional(),subsidyStatus:m.optional(),enrichedFeeEstimation:e.z.array(d.estimatedFeesV2Schema).optional(),isBackendDown:e.z.boolean().default(!1).optional()});function O(a){return A.safeParse(a).success}function I(a){return F.safeParse(a).success}exports.actionSchema=g;exports.assessmentSchema=u;exports.enrichedSimulateAndReviewSchema=N;exports.enrichedSimulateAndReviewV2Schema=_;exports.feeEstimationNativeOrPaymasterSchema=E;exports.feeEstimationSchema=c;exports.feeEstimationTxV1Schema=k;exports.feeEstimationTxV3Schema=v;exports.isNotTransactionSimulationError=O;exports.isTransactionSimulationError=I;exports.paymasterFeeEstimationSchema=w;exports.paymasterFeeTokenSchema=l;exports.propertySchema=i;exports.reviewSchema=S;exports.simulateAndReviewSchema=R;exports.targetedDappSchema=h;exports.warningDetailsSchema=b;exports.warningSchema=s;
|
|
@@ -15347,6 +15347,17 @@ declare const transactionSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
15347
15347
|
} | undefined;
|
|
15348
15348
|
simulation?: undefined;
|
|
15349
15349
|
}>]>;
|
|
15350
|
+
declare const subsidyStatusSchema: z.ZodObject<{
|
|
15351
|
+
subsidiseDeployment: z.ZodBoolean;
|
|
15352
|
+
subsidiseTransaction: z.ZodBoolean;
|
|
15353
|
+
}, "strip", z.ZodTypeAny, {
|
|
15354
|
+
subsidiseDeployment: boolean;
|
|
15355
|
+
subsidiseTransaction: boolean;
|
|
15356
|
+
}, {
|
|
15357
|
+
subsidiseDeployment: boolean;
|
|
15358
|
+
subsidiseTransaction: boolean;
|
|
15359
|
+
}>;
|
|
15360
|
+
export type SubsidyStatus = z.infer<typeof subsidyStatusSchema>;
|
|
15350
15361
|
export declare const simulateAndReviewSchema: z.ZodObject<{
|
|
15351
15362
|
transactions: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
15352
15363
|
reviewOfTransaction: z.ZodOptional<z.ZodObject<{
|
|
@@ -20432,6 +20443,16 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
|
|
|
20432
20443
|
} | undefined;
|
|
20433
20444
|
simulation?: undefined;
|
|
20434
20445
|
}>]>, "many">>;
|
|
20446
|
+
subsidyStatus: z.ZodOptional<z.ZodObject<{
|
|
20447
|
+
subsidiseDeployment: z.ZodBoolean;
|
|
20448
|
+
subsidiseTransaction: z.ZodBoolean;
|
|
20449
|
+
}, "strip", z.ZodTypeAny, {
|
|
20450
|
+
subsidiseDeployment: boolean;
|
|
20451
|
+
subsidiseTransaction: boolean;
|
|
20452
|
+
}, {
|
|
20453
|
+
subsidiseDeployment: boolean;
|
|
20454
|
+
subsidiseTransaction: boolean;
|
|
20455
|
+
}>>;
|
|
20435
20456
|
}, "strip", z.ZodTypeAny, {
|
|
20436
20457
|
transactions?: ({
|
|
20437
20458
|
simulation: {
|
|
@@ -20951,6 +20972,10 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
|
|
|
20951
20972
|
} | undefined;
|
|
20952
20973
|
simulation?: undefined;
|
|
20953
20974
|
})[] | undefined;
|
|
20975
|
+
subsidyStatus?: {
|
|
20976
|
+
subsidiseDeployment: boolean;
|
|
20977
|
+
subsidiseTransaction: boolean;
|
|
20978
|
+
} | undefined;
|
|
20954
20979
|
}, {
|
|
20955
20980
|
transactions?: ({
|
|
20956
20981
|
simulation: {
|
|
@@ -21470,6 +21495,10 @@ export declare const simulateAndReviewSchema: z.ZodObject<{
|
|
|
21470
21495
|
} | undefined;
|
|
21471
21496
|
simulation?: undefined;
|
|
21472
21497
|
})[] | undefined;
|
|
21498
|
+
subsidyStatus?: {
|
|
21499
|
+
subsidiseDeployment: boolean;
|
|
21500
|
+
subsidiseTransaction: boolean;
|
|
21501
|
+
} | undefined;
|
|
21473
21502
|
}>;
|
|
21474
21503
|
export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
|
|
21475
21504
|
transactions: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
@@ -26556,6 +26585,16 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
|
|
|
26556
26585
|
} | undefined;
|
|
26557
26586
|
simulation?: undefined;
|
|
26558
26587
|
}>]>, "many">>;
|
|
26588
|
+
subsidyStatus: z.ZodOptional<z.ZodObject<{
|
|
26589
|
+
subsidiseDeployment: z.ZodBoolean;
|
|
26590
|
+
subsidiseTransaction: z.ZodBoolean;
|
|
26591
|
+
}, "strip", z.ZodTypeAny, {
|
|
26592
|
+
subsidiseDeployment: boolean;
|
|
26593
|
+
subsidiseTransaction: boolean;
|
|
26594
|
+
}, {
|
|
26595
|
+
subsidiseDeployment: boolean;
|
|
26596
|
+
subsidiseTransaction: boolean;
|
|
26597
|
+
}>>;
|
|
26559
26598
|
enrichedFeeEstimation: z.ZodOptional<z.ZodObject<{
|
|
26560
26599
|
deployment: z.ZodOptional<z.ZodObject<{
|
|
26561
26600
|
feeTokenAddress: z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEffects<z.ZodString, string, string>>, `0x${string}`, string>;
|
|
@@ -27226,6 +27265,10 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
|
|
|
27226
27265
|
} | undefined;
|
|
27227
27266
|
simulation?: undefined;
|
|
27228
27267
|
})[] | undefined;
|
|
27268
|
+
subsidyStatus?: {
|
|
27269
|
+
subsidiseDeployment: boolean;
|
|
27270
|
+
subsidiseTransaction: boolean;
|
|
27271
|
+
} | undefined;
|
|
27229
27272
|
enrichedFeeEstimation?: {
|
|
27230
27273
|
transactions: {
|
|
27231
27274
|
amount: bigint;
|
|
@@ -27774,6 +27817,10 @@ export declare const enrichedSimulateAndReviewSchema: z.ZodObject<{
|
|
|
27774
27817
|
} | undefined;
|
|
27775
27818
|
simulation?: undefined;
|
|
27776
27819
|
})[] | undefined;
|
|
27820
|
+
subsidyStatus?: {
|
|
27821
|
+
subsidiseDeployment: boolean;
|
|
27822
|
+
subsidiseTransaction: boolean;
|
|
27823
|
+
} | undefined;
|
|
27777
27824
|
enrichedFeeEstimation?: {
|
|
27778
27825
|
transactions: {
|
|
27779
27826
|
amount: bigint;
|
|
@@ -32889,6 +32936,16 @@ export declare const enrichedSimulateAndReviewV2Schema: z.ZodObject<{
|
|
|
32889
32936
|
} | undefined;
|
|
32890
32937
|
simulation?: undefined;
|
|
32891
32938
|
}>]>, "many">>;
|
|
32939
|
+
subsidyStatus: z.ZodOptional<z.ZodObject<{
|
|
32940
|
+
subsidiseDeployment: z.ZodBoolean;
|
|
32941
|
+
subsidiseTransaction: z.ZodBoolean;
|
|
32942
|
+
}, "strip", z.ZodTypeAny, {
|
|
32943
|
+
subsidiseDeployment: boolean;
|
|
32944
|
+
subsidiseTransaction: boolean;
|
|
32945
|
+
}, {
|
|
32946
|
+
subsidiseDeployment: boolean;
|
|
32947
|
+
subsidiseTransaction: boolean;
|
|
32948
|
+
}>>;
|
|
32892
32949
|
enrichedFeeEstimation: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
32893
32950
|
type: z.ZodLiteral<"native">;
|
|
32894
32951
|
transactions: z.ZodObject<{
|
|
@@ -33616,6 +33673,10 @@ export declare const enrichedSimulateAndReviewV2Schema: z.ZodObject<{
|
|
|
33616
33673
|
} | undefined;
|
|
33617
33674
|
simulation?: undefined;
|
|
33618
33675
|
})[] | undefined;
|
|
33676
|
+
subsidyStatus?: {
|
|
33677
|
+
subsidiseDeployment: boolean;
|
|
33678
|
+
subsidiseTransaction: boolean;
|
|
33679
|
+
} | undefined;
|
|
33619
33680
|
enrichedFeeEstimation?: ({
|
|
33620
33681
|
type: "native";
|
|
33621
33682
|
transactions: {
|
|
@@ -34177,6 +34238,10 @@ export declare const enrichedSimulateAndReviewV2Schema: z.ZodObject<{
|
|
|
34177
34238
|
} | undefined;
|
|
34178
34239
|
simulation?: undefined;
|
|
34179
34240
|
})[] | undefined;
|
|
34241
|
+
subsidyStatus?: {
|
|
34242
|
+
subsidiseDeployment: boolean;
|
|
34243
|
+
subsidiseTransaction: boolean;
|
|
34244
|
+
} | undefined;
|
|
34180
34245
|
enrichedFeeEstimation?: ({
|
|
34181
34246
|
type: "native";
|
|
34182
34247
|
transactions: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z as t } from "zod";
|
|
2
|
-
import { estimatedFeesSchema as h, estimatedFeesV2Schema as
|
|
3
|
-
import { severitySchema as
|
|
4
|
-
import { addressSchemaArgentBackend as n, addressSchema as
|
|
5
|
-
const
|
|
2
|
+
import { estimatedFeesSchema as h, estimatedFeesV2Schema as y } from "../fees/schema.js";
|
|
3
|
+
import { severitySchema as f, reasonsSchema as j } from "../warning/schema.js";
|
|
4
|
+
import { addressSchemaArgentBackend as n, 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 k = t.object({
|
|
|
14
14
|
unknown: t.boolean(),
|
|
15
15
|
iconUrl: t.string().optional(),
|
|
16
16
|
type: t.string()
|
|
17
|
-
}),
|
|
17
|
+
}), l = t.discriminatedUnion("type", [
|
|
18
18
|
t.object({
|
|
19
19
|
type: t.literal("amount"),
|
|
20
20
|
label: t.string(),
|
|
@@ -62,59 +62,59 @@ const k = t.object({
|
|
|
62
62
|
label: t.string(),
|
|
63
63
|
token: o
|
|
64
64
|
})
|
|
65
|
-
]),
|
|
65
|
+
]), w = t.object({
|
|
66
66
|
name: t.string(),
|
|
67
|
-
properties: t.array(
|
|
68
|
-
defaultProperties: t.array(
|
|
69
|
-
}),
|
|
67
|
+
properties: t.array(l),
|
|
68
|
+
defaultProperties: t.array(l).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
|
-
]),
|
|
74
|
+
]), F = t.object({
|
|
75
75
|
unknown_token: t.unknown().optional(),
|
|
76
76
|
date_of_addition: t.string().optional(),
|
|
77
|
-
contract_address:
|
|
77
|
+
contract_address: k.optional(),
|
|
78
78
|
reason: t.string().optional(),
|
|
79
79
|
value: t.string().or(t.number()).optional()
|
|
80
|
-
}),
|
|
81
|
-
reason:
|
|
82
|
-
details:
|
|
83
|
-
severity:
|
|
84
|
-
}),
|
|
85
|
-
assessment:
|
|
86
|
-
warnings: t.array(
|
|
80
|
+
}), c = t.object({
|
|
81
|
+
reason: j,
|
|
82
|
+
details: F.optional(),
|
|
83
|
+
severity: f
|
|
84
|
+
}), U = t.object({
|
|
85
|
+
assessment: E,
|
|
86
|
+
warnings: t.array(c).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:
|
|
92
|
-
}),
|
|
91
|
+
action: w
|
|
92
|
+
}), x = t.object({
|
|
93
93
|
name: t.string(),
|
|
94
94
|
description: t.string(),
|
|
95
95
|
logoUrl: t.string(),
|
|
96
96
|
iconUrl: t.string(),
|
|
97
97
|
argentVerified: t.boolean(),
|
|
98
|
-
links: t.array(
|
|
99
|
-
}),
|
|
98
|
+
links: t.array(v)
|
|
99
|
+
}), m = 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(
|
|
106
|
+
warnings: t.array(c).optional(),
|
|
107
107
|
assessmentDetails: t.object({
|
|
108
108
|
contract_address: t.string()
|
|
109
109
|
}).optional(),
|
|
110
|
-
targetedDapp:
|
|
111
|
-
reviews: t.array(
|
|
112
|
-
}).optional(),
|
|
110
|
+
targetedDapp: x.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(),
|
|
116
116
|
original: t.string().nullable().optional()
|
|
117
|
-
}),
|
|
117
|
+
}), D = t.object({
|
|
118
118
|
twitter: t.string().optional(),
|
|
119
119
|
external: t.string().optional(),
|
|
120
120
|
discord: t.string().optional()
|
|
@@ -128,8 +128,8 @@ const k = t.object({
|
|
|
128
128
|
usdValue: t.string().optional(),
|
|
129
129
|
iconUrl: t.string().optional(),
|
|
130
130
|
unknown: t.boolean().optional(),
|
|
131
|
-
imageUrls:
|
|
132
|
-
links:
|
|
131
|
+
imageUrls: p.optional(),
|
|
132
|
+
links: D.optional()
|
|
133
133
|
}), A = t.object({
|
|
134
134
|
tokenAddress: n,
|
|
135
135
|
owner: n,
|
|
@@ -137,38 +137,38 @@ const k = t.object({
|
|
|
137
137
|
value: t.string().optional(),
|
|
138
138
|
approvalForAll: t.boolean(),
|
|
139
139
|
details: i.optional()
|
|
140
|
-
}),
|
|
140
|
+
}), T = t.object({
|
|
141
141
|
tokenAddress: n,
|
|
142
142
|
from: n,
|
|
143
143
|
to: n,
|
|
144
144
|
tokenId: t.string().optional(),
|
|
145
145
|
value: t.string().optional(),
|
|
146
146
|
details: i.optional()
|
|
147
|
-
}),
|
|
148
|
-
overallFee:
|
|
149
|
-
gasPrice:
|
|
150
|
-
gasUsage:
|
|
151
|
-
dataGasPrice:
|
|
152
|
-
dataGasConsumed:
|
|
147
|
+
}), a = t.union([t.string(), t.number(), t.bigint()]).transform((e) => parseInt(e.toString(), 10)), d = {
|
|
148
|
+
overallFee: a,
|
|
149
|
+
gasPrice: a,
|
|
150
|
+
gasUsage: a,
|
|
151
|
+
dataGasPrice: a.optional(),
|
|
152
|
+
dataGasConsumed: a.optional()
|
|
153
153
|
}, P = t.object({
|
|
154
|
-
...
|
|
155
|
-
unit: t.string().transform((
|
|
156
|
-
maxFee:
|
|
154
|
+
...d,
|
|
155
|
+
unit: t.string().transform((e) => e.toUpperCase()).pipe(t.literal("WEI")),
|
|
156
|
+
maxFee: a
|
|
157
157
|
}), g = t.object({
|
|
158
158
|
address: n,
|
|
159
159
|
unknown: t.boolean(),
|
|
160
160
|
type: t.literal("ERC20")
|
|
161
|
-
}), T = t.object({
|
|
162
|
-
...p,
|
|
163
|
-
unit: t.string().transform((a) => a.toUpperCase()).pipe(t.literal("FRI")),
|
|
164
|
-
maxAmount: e,
|
|
165
|
-
maxPricePerUnit: e,
|
|
166
|
-
token: g
|
|
167
161
|
}), _ = t.object({
|
|
162
|
+
...d,
|
|
163
|
+
unit: t.string().transform((e) => e.toUpperCase()).pipe(t.literal("FRI")),
|
|
164
|
+
maxAmount: a,
|
|
165
|
+
maxPricePerUnit: a,
|
|
166
|
+
token: g
|
|
167
|
+
}), V = t.object({
|
|
168
168
|
token: g,
|
|
169
|
-
overallFee:
|
|
170
|
-
maxFee:
|
|
171
|
-
}),
|
|
169
|
+
overallFee: a,
|
|
170
|
+
maxFee: a
|
|
171
|
+
}), b = P.or(_), I = b.or(V), N = t.object({
|
|
172
172
|
type: t.string(),
|
|
173
173
|
label: t.string(),
|
|
174
174
|
tokenId: t.string().optional(),
|
|
@@ -179,62 +179,68 @@ const k = t.object({
|
|
|
179
179
|
tokenIdDetails: t.object({
|
|
180
180
|
name: t.string().optional(),
|
|
181
181
|
description: t.string().optional(),
|
|
182
|
-
imageUrls:
|
|
182
|
+
imageUrls: p.optional()
|
|
183
183
|
}).optional()
|
|
184
|
-
}),
|
|
184
|
+
}), R = t.object({
|
|
185
185
|
approvals: t.array(A).optional(),
|
|
186
|
-
transfers: t.array(
|
|
186
|
+
transfers: t.array(T).optional(),
|
|
187
187
|
calculatedNonce: t.string().optional(),
|
|
188
|
-
feeEstimation:
|
|
189
|
-
feeEstimations: t.array(
|
|
190
|
-
summary: t.array(
|
|
191
|
-
}),
|
|
188
|
+
feeEstimation: b,
|
|
189
|
+
feeEstimations: t.array(I),
|
|
190
|
+
summary: t.array(N).optional()
|
|
191
|
+
}), C = t.object({
|
|
192
192
|
label: t.string().optional(),
|
|
193
193
|
code: t.number().optional(),
|
|
194
194
|
message: t.string().optional(),
|
|
195
195
|
error: t.string().optional()
|
|
196
|
-
}), b = t.object({
|
|
197
|
-
reviewOfTransaction: c,
|
|
198
|
-
simulation: N,
|
|
199
|
-
simulationError: t.undefined()
|
|
200
196
|
}), u = t.object({
|
|
201
|
-
reviewOfTransaction:
|
|
197
|
+
reviewOfTransaction: m,
|
|
198
|
+
simulation: R,
|
|
199
|
+
simulationError: t.undefined()
|
|
200
|
+
}), S = t.object({
|
|
201
|
+
reviewOfTransaction: m,
|
|
202
202
|
simulation: t.undefined(),
|
|
203
|
-
simulationError:
|
|
204
|
-
}),
|
|
205
|
-
|
|
203
|
+
simulationError: C
|
|
204
|
+
}), s = u.or(S), r = t.object({
|
|
205
|
+
subsidiseDeployment: t.boolean(),
|
|
206
|
+
subsidiseTransaction: t.boolean()
|
|
206
207
|
}), H = t.object({
|
|
207
|
-
transactions: t.array(
|
|
208
|
+
transactions: t.array(s).optional(),
|
|
209
|
+
subsidyStatus: r.optional()
|
|
210
|
+
}), W = t.object({
|
|
211
|
+
transactions: t.array(s).optional(),
|
|
212
|
+
subsidyStatus: r.optional(),
|
|
208
213
|
enrichedFeeEstimation: h.optional(),
|
|
209
214
|
isBackendDown: t.boolean().default(!1).optional()
|
|
210
|
-
}),
|
|
211
|
-
transactions: t.array(
|
|
212
|
-
|
|
215
|
+
}), q = t.object({
|
|
216
|
+
transactions: t.array(s).optional(),
|
|
217
|
+
subsidyStatus: r.optional(),
|
|
218
|
+
enrichedFeeEstimation: t.array(y).optional(),
|
|
213
219
|
isBackendDown: t.boolean().default(!1).optional()
|
|
214
220
|
});
|
|
215
|
-
function
|
|
216
|
-
return
|
|
221
|
+
function J(e) {
|
|
222
|
+
return u.safeParse(e).success;
|
|
217
223
|
}
|
|
218
|
-
function
|
|
219
|
-
return
|
|
224
|
+
function K(e) {
|
|
225
|
+
return S.safeParse(e).success;
|
|
220
226
|
}
|
|
221
227
|
export {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
w as actionSchema,
|
|
229
|
+
E as assessmentSchema,
|
|
230
|
+
W as enrichedSimulateAndReviewSchema,
|
|
231
|
+
q as enrichedSimulateAndReviewV2Schema,
|
|
232
|
+
I as feeEstimationNativeOrPaymasterSchema,
|
|
233
|
+
b as feeEstimationSchema,
|
|
228
234
|
P as feeEstimationTxV1Schema,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
_ as feeEstimationTxV3Schema,
|
|
236
|
+
J as isNotTransactionSimulationError,
|
|
237
|
+
K as isTransactionSimulationError,
|
|
238
|
+
V as paymasterFeeEstimationSchema,
|
|
233
239
|
g as paymasterFeeTokenSchema,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
+
l as propertySchema,
|
|
241
|
+
U as reviewSchema,
|
|
242
|
+
H as simulateAndReviewSchema,
|
|
243
|
+
x as targetedDappSchema,
|
|
244
|
+
F as warningDetailsSchema,
|
|
245
|
+
c as warningSchema
|
|
240
246
|
};
|