@lit-protocol/vincent-ability-sdk 2.3.4 → 2.4.0-mma
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/README.md +49 -1
- package/dist/CHANGELOG.md +6 -0
- package/dist/README.md +49 -1
- package/dist/package.json +7 -1
- package/dist/src/gatedSigner.d.ts +2 -0
- package/dist/src/gatedSigner.d.ts.map +1 -0
- package/dist/src/gatedSigner.js +5 -0
- package/dist/src/gatedSigner.js.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.js +1 -1
- package/dist/src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.js.map +1 -1
- package/dist/src/lib/gatedSigner/helpers/eip712.d.ts +34 -0
- package/dist/src/lib/gatedSigner/helpers/eip712.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/eip712.js +30 -0
- package/dist/src/lib/gatedSigner/helpers/eip712.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/hex.d.ts +5 -0
- package/dist/src/lib/gatedSigner/helpers/hex.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/hex.js +16 -0
- package/dist/src/lib/gatedSigner/helpers/hex.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/lifecycleFunctions.d.ts +54 -0
- package/dist/src/lib/gatedSigner/helpers/lifecycleFunctions.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/lifecycleFunctions.js +91 -0
- package/dist/src/lib/gatedSigner/helpers/lifecycleFunctions.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/lowLevelCall.d.ts +13 -0
- package/dist/src/lib/gatedSigner/helpers/lowLevelCall.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/lowLevelCall.js +21 -0
- package/dist/src/lib/gatedSigner/helpers/lowLevelCall.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/schemas.d.ts +925 -0
- package/dist/src/lib/gatedSigner/helpers/schemas.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/schemas.js +64 -0
- package/dist/src/lib/gatedSigner/helpers/schemas.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/signTransaction.d.ts +9 -0
- package/dist/src/lib/gatedSigner/helpers/signTransaction.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/signTransaction.js +30 -0
- package/dist/src/lib/gatedSigner/helpers/signTransaction.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/signUserOperation.d.ts +15 -0
- package/dist/src/lib/gatedSigner/helpers/signUserOperation.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/signUserOperation.js +115 -0
- package/dist/src/lib/gatedSigner/helpers/signUserOperation.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/simulation.d.ts +204 -0
- package/dist/src/lib/gatedSigner/helpers/simulation.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/simulation.js +93 -0
- package/dist/src/lib/gatedSigner/helpers/simulation.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/kernel.d.ts +8 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/kernel.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/kernel.js +177 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/kernel.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/safe.d.ts +26 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/safe.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/safe.js +195 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/safe.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/toLitActionAccount.d.ts +20 -0
- package/dist/src/lib/gatedSigner/helpers/toLitActionAccount.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/toLitActionAccount.js +69 -0
- package/dist/src/lib/gatedSigner/helpers/toLitActionAccount.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/transaction.d.ts +148 -0
- package/dist/src/lib/gatedSigner/helpers/transaction.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/transaction.js +87 -0
- package/dist/src/lib/gatedSigner/helpers/transaction.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/userOperation.d.ts +200 -0
- package/dist/src/lib/gatedSigner/helpers/userOperation.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/userOperation.js +106 -0
- package/dist/src/lib/gatedSigner/helpers/userOperation.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/validation.d.ts +43 -0
- package/dist/src/lib/gatedSigner/helpers/validation.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/validation.js +81 -0
- package/dist/src/lib/gatedSigner/helpers/validation.js.map +1 -0
- package/dist/src/lib/gatedSigner/index.d.ts +12 -0
- package/dist/src/lib/gatedSigner/index.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/index.js +19 -0
- package/dist/src/lib/gatedSigner/index.js.map +1 -0
- package/dist/src/lib/gatedSigner/vincentGatedSignerAbility.d.ts +566 -0
- package/dist/src/lib/gatedSigner/vincentGatedSignerAbility.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/vincentGatedSignerAbility.js +48 -0
- package/dist/src/lib/gatedSigner/vincentGatedSignerAbility.js.map +1 -0
- package/dist/src/type-inference-verification/ability-definition-tests.d.ts +6 -6
- package/dist/src/type-inference-verification/allow-deny-test-cases-ability.d.ts +90 -90
- package/dist/src/type-inference-verification/allow-deny-test-cases.d.ts +8 -8
- package/dist/src/type-inference-verification/context-switching-tests.d.ts +3 -3
- package/dist/src/type-inference-verification/create-vincent-gated-signer-ability.d.ts +533 -0
- package/dist/src/type-inference-verification/create-vincent-gated-signer-ability.d.ts.map +1 -0
- package/dist/src/type-inference-verification/create-vincent-gated-signer-ability.js +19 -0
- package/dist/src/type-inference-verification/create-vincent-gated-signer-ability.js.map +1 -0
- package/dist/src/type-inference-verification/parameter-inference-tests-tool.d.ts +58 -58
- package/dist/src/type-inference-verification/parameter-inference-tests.d.ts +5 -5
- package/dist/src/type-inference-verification/playground.d.ts +8 -8
- package/dist/src/type-inference-verification/schema-test.d.ts +5 -5
- package/package.json +8 -2
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { Address, AccessList, ByteArray, Hex } from 'viem';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const transactionSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
4
|
+
data: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
5
|
+
from: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
6
|
+
to: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
7
|
+
value: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
8
|
+
nonce: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
9
|
+
gas: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
10
|
+
gasLimit: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
11
|
+
gasPrice: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
12
|
+
maxFeePerGas: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
13
|
+
maxPriorityFeePerGas: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
14
|
+
chainId: z.ZodUnion<[z.ZodNumber, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>]>;
|
|
15
|
+
type: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
16
|
+
accessList: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17
|
+
address: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
18
|
+
storageKeys: z.ZodArray<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, "many">;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
address: `0x${string}`;
|
|
21
|
+
storageKeys: `0x${string}`[];
|
|
22
|
+
}, {
|
|
23
|
+
address: string;
|
|
24
|
+
storageKeys: `0x${string}`[];
|
|
25
|
+
}>, "many">>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
value: `0x${string}`;
|
|
28
|
+
nonce: `0x${string}`;
|
|
29
|
+
to: `0x${string}`;
|
|
30
|
+
data: `0x${string}`;
|
|
31
|
+
chainId: number | `0x${string}`;
|
|
32
|
+
from: `0x${string}`;
|
|
33
|
+
type?: string | number | undefined;
|
|
34
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
|
35
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
|
36
|
+
gas?: `0x${string}` | undefined;
|
|
37
|
+
gasLimit?: `0x${string}` | undefined;
|
|
38
|
+
gasPrice?: `0x${string}` | undefined;
|
|
39
|
+
accessList?: {
|
|
40
|
+
address: `0x${string}`;
|
|
41
|
+
storageKeys: `0x${string}`[];
|
|
42
|
+
}[] | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
value: `0x${string}`;
|
|
45
|
+
nonce: `0x${string}`;
|
|
46
|
+
to: string;
|
|
47
|
+
data: `0x${string}`;
|
|
48
|
+
chainId: number | `0x${string}`;
|
|
49
|
+
from: string;
|
|
50
|
+
type?: string | number | undefined;
|
|
51
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
|
52
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
|
53
|
+
gas?: `0x${string}` | undefined;
|
|
54
|
+
gasLimit?: `0x${string}` | undefined;
|
|
55
|
+
gasPrice?: `0x${string}` | undefined;
|
|
56
|
+
accessList?: {
|
|
57
|
+
address: string;
|
|
58
|
+
storageKeys: `0x${string}`[];
|
|
59
|
+
}[] | undefined;
|
|
60
|
+
}>, {
|
|
61
|
+
value: `0x${string}`;
|
|
62
|
+
nonce: `0x${string}`;
|
|
63
|
+
to: `0x${string}`;
|
|
64
|
+
data: `0x${string}`;
|
|
65
|
+
chainId: number | `0x${string}`;
|
|
66
|
+
from: `0x${string}`;
|
|
67
|
+
type?: string | number | undefined;
|
|
68
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
|
69
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
|
70
|
+
gas?: `0x${string}` | undefined;
|
|
71
|
+
gasLimit?: `0x${string}` | undefined;
|
|
72
|
+
gasPrice?: `0x${string}` | undefined;
|
|
73
|
+
accessList?: {
|
|
74
|
+
address: `0x${string}`;
|
|
75
|
+
storageKeys: `0x${string}`[];
|
|
76
|
+
}[] | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
value: `0x${string}`;
|
|
79
|
+
nonce: `0x${string}`;
|
|
80
|
+
to: string;
|
|
81
|
+
data: `0x${string}`;
|
|
82
|
+
chainId: number | `0x${string}`;
|
|
83
|
+
from: string;
|
|
84
|
+
type?: string | number | undefined;
|
|
85
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
|
86
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
|
87
|
+
gas?: `0x${string}` | undefined;
|
|
88
|
+
gasLimit?: `0x${string}` | undefined;
|
|
89
|
+
gasPrice?: `0x${string}` | undefined;
|
|
90
|
+
accessList?: {
|
|
91
|
+
address: string;
|
|
92
|
+
storageKeys: `0x${string}`[];
|
|
93
|
+
}[] | undefined;
|
|
94
|
+
}>, {
|
|
95
|
+
value: `0x${string}`;
|
|
96
|
+
nonce: `0x${string}`;
|
|
97
|
+
to: `0x${string}`;
|
|
98
|
+
data: `0x${string}`;
|
|
99
|
+
chainId: number | `0x${string}`;
|
|
100
|
+
from: `0x${string}`;
|
|
101
|
+
type?: string | number | undefined;
|
|
102
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
|
103
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
|
104
|
+
gas?: `0x${string}` | undefined;
|
|
105
|
+
gasLimit?: `0x${string}` | undefined;
|
|
106
|
+
gasPrice?: `0x${string}` | undefined;
|
|
107
|
+
accessList?: {
|
|
108
|
+
address: `0x${string}`;
|
|
109
|
+
storageKeys: `0x${string}`[];
|
|
110
|
+
}[] | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
value: `0x${string}`;
|
|
113
|
+
nonce: `0x${string}`;
|
|
114
|
+
to: string;
|
|
115
|
+
data: `0x${string}`;
|
|
116
|
+
chainId: number | `0x${string}`;
|
|
117
|
+
from: string;
|
|
118
|
+
type?: string | number | undefined;
|
|
119
|
+
maxFeePerGas?: `0x${string}` | undefined;
|
|
120
|
+
maxPriorityFeePerGas?: `0x${string}` | undefined;
|
|
121
|
+
gas?: `0x${string}` | undefined;
|
|
122
|
+
gasLimit?: `0x${string}` | undefined;
|
|
123
|
+
gasPrice?: `0x${string}` | undefined;
|
|
124
|
+
accessList?: {
|
|
125
|
+
address: string;
|
|
126
|
+
storageKeys: `0x${string}`[];
|
|
127
|
+
}[] | undefined;
|
|
128
|
+
}>;
|
|
129
|
+
export type Transaction = z.infer<typeof transactionSchema>;
|
|
130
|
+
type HexLike = string | number | bigint | boolean | ByteArray;
|
|
131
|
+
export interface GenericTransaction {
|
|
132
|
+
data?: Hex;
|
|
133
|
+
from?: Address;
|
|
134
|
+
to?: Address | null;
|
|
135
|
+
value?: HexLike;
|
|
136
|
+
nonce: HexLike;
|
|
137
|
+
gas?: HexLike;
|
|
138
|
+
gasLimit?: HexLike;
|
|
139
|
+
gasPrice?: HexLike;
|
|
140
|
+
maxFeePerGas?: HexLike;
|
|
141
|
+
maxPriorityFeePerGas?: HexLike;
|
|
142
|
+
chainId: number | HexLike;
|
|
143
|
+
type?: string | number;
|
|
144
|
+
accessList?: AccessList;
|
|
145
|
+
}
|
|
146
|
+
export declare function toVincentTransaction(tx: GenericTransaction): Transaction;
|
|
147
|
+
export {};
|
|
148
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAGhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsC3B,CAAC;AAEJ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAG5D,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,EAAE,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAoBD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,kBAAkB,GAAG,WAAW,CAwBxE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transactionSchema = void 0;
|
|
4
|
+
exports.toVincentTransaction = toVincentTransaction;
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const hex_1 = require("./hex");
|
|
8
|
+
const quantityHexSchema = hex_1.hexSchema.describe('Hex-encoded quantity (for example 0x5208 for gas or 0xde0b6b3a7640000 for value)');
|
|
9
|
+
const chainIdSchema = zod_1.z
|
|
10
|
+
.union([zod_1.z.number().int().nonnegative(), quantityHexSchema])
|
|
11
|
+
.describe('Numeric chain id for the transaction. Can be decimal or hex encoded.');
|
|
12
|
+
const accessListSchema = zod_1.z
|
|
13
|
+
.array(zod_1.z.object({
|
|
14
|
+
address: hex_1.addressSchema,
|
|
15
|
+
storageKeys: zod_1.z.array(hex_1.hexSchema),
|
|
16
|
+
}))
|
|
17
|
+
.describe('EIP-2930/EIP-1559 access list entries');
|
|
18
|
+
exports.transactionSchema = zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
data: hex_1.hexSchema.describe('Calldata for the transaction.'),
|
|
21
|
+
from: hex_1.addressSchema.describe('Sender of the transaction. Must be the delegator PKP.'),
|
|
22
|
+
to: hex_1.addressSchema.describe('Recipient address for the transaction.'),
|
|
23
|
+
value: hex_1.hexSchema.describe('Hex-encoded value to transfer in wei.'),
|
|
24
|
+
nonce: quantityHexSchema.describe('Hex-encoded nonce for the transaction.'),
|
|
25
|
+
gas: quantityHexSchema.optional().describe('Gas limit for the transaction.'),
|
|
26
|
+
gasLimit: quantityHexSchema.optional().describe('Alias for gas limit.'),
|
|
27
|
+
gasPrice: quantityHexSchema.optional().describe('Legacy gas price.'),
|
|
28
|
+
maxFeePerGas: quantityHexSchema.optional().describe('EIP-1559 maxFeePerGas value.'),
|
|
29
|
+
maxPriorityFeePerGas: quantityHexSchema
|
|
30
|
+
.optional()
|
|
31
|
+
.describe('EIP-1559 maxPriorityFeePerGas value.'),
|
|
32
|
+
chainId: chainIdSchema.describe('Chain ID for the transaction. Required.'),
|
|
33
|
+
type: zod_1.z
|
|
34
|
+
.union([zod_1.z.string(), zod_1.z.number()])
|
|
35
|
+
.optional()
|
|
36
|
+
.describe('Optional transaction type identifier.'),
|
|
37
|
+
accessList: accessListSchema.optional(),
|
|
38
|
+
})
|
|
39
|
+
.refine((data) => data.gas !== undefined || data.gasLimit !== undefined, {
|
|
40
|
+
message: 'Either gas or gasLimit must be provided',
|
|
41
|
+
})
|
|
42
|
+
.refine((data) => {
|
|
43
|
+
const hasLegacyGas = data.gasPrice !== undefined;
|
|
44
|
+
const hasEIP1559Gas = data.maxFeePerGas !== undefined && data.maxPriorityFeePerGas !== undefined;
|
|
45
|
+
return hasLegacyGas || hasEIP1559Gas;
|
|
46
|
+
}, {
|
|
47
|
+
message: 'Either gasPrice (for legacy) or both maxFeePerGas and maxPriorityFeePerGas (for EIP-1559) must be provided',
|
|
48
|
+
});
|
|
49
|
+
const txHexValues = [
|
|
50
|
+
'value',
|
|
51
|
+
'nonce',
|
|
52
|
+
'gas',
|
|
53
|
+
'gasLimit',
|
|
54
|
+
'gasPrice',
|
|
55
|
+
'maxFeePerGas',
|
|
56
|
+
'maxPriorityFeePerGas',
|
|
57
|
+
];
|
|
58
|
+
function toQuantityHexSafe(value) {
|
|
59
|
+
if ((0, viem_1.isHex)(value))
|
|
60
|
+
return value;
|
|
61
|
+
if (typeof value === 'string' && /^\d+$/.test(value)) {
|
|
62
|
+
return (0, viem_1.toHex)(BigInt(value));
|
|
63
|
+
}
|
|
64
|
+
return (0, viem_1.toHex)(value);
|
|
65
|
+
}
|
|
66
|
+
function toVincentTransaction(tx) {
|
|
67
|
+
const _tx = { ...tx };
|
|
68
|
+
// Convert quantity-like fields to hex when needed
|
|
69
|
+
for (const key of txHexValues) {
|
|
70
|
+
if (_tx[key] !== undefined) {
|
|
71
|
+
_tx[key] = toQuantityHexSafe(_tx[key]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Convert chainId if provided as a hex-like non-number and not already hex
|
|
75
|
+
if (_tx.chainId !== undefined && typeof _tx.chainId !== 'number') {
|
|
76
|
+
_tx.chainId = toQuantityHexSafe(_tx.chainId);
|
|
77
|
+
}
|
|
78
|
+
// Normalize accessList storage keys
|
|
79
|
+
if (Array.isArray(_tx.accessList)) {
|
|
80
|
+
_tx.accessList = _tx.accessList.map((entry) => ({
|
|
81
|
+
address: entry.address,
|
|
82
|
+
storageKeys: entry.storageKeys.map((k) => toQuantityHexSafe(k)),
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
return _tx;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/transaction.ts"],"names":[],"mappings":";;;AA0GA,oDAwBC;AAhID,+BAAoC;AACpC,6BAAwB;AAExB,+BAAiD;AAEjD,MAAM,iBAAiB,GAAG,eAAS,CAAC,QAAQ,CAC1C,kFAAkF,CACnF,CAAC;AAEF,MAAM,aAAa,GAAG,OAAC;KACpB,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,iBAAiB,CAAC,CAAC;KAC1D,QAAQ,CAAC,sEAAsE,CAAC,CAAC;AAEpF,MAAM,gBAAgB,GAAG,OAAC;KACvB,KAAK,CACJ,OAAC,CAAC,MAAM,CAAC;IACP,OAAO,EAAE,mBAAa;IACtB,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,eAAS,CAAC;CAChC,CAAC,CACH;KACA,QAAQ,CAAC,uCAAuC,CAAC,CAAC;AAExC,QAAA,iBAAiB,GAAG,OAAC;KAC/B,MAAM,CAAC;IACN,IAAI,EAAE,eAAS,CAAC,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QAClC,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAyB,EAAE,EAAE,CAAC,CAAC;YAClE,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;SAChE,CAAC,CAAC,CAAC;IACN,CAAC;IAED,OAAO,GAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { Address, ByteArray, Hex } from 'viem';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const userOpV070Schema: z.ZodObject<{
|
|
4
|
+
sender: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
5
|
+
nonce: z.ZodString;
|
|
6
|
+
callData: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
7
|
+
callGasLimit: z.ZodString;
|
|
8
|
+
verificationGasLimit: z.ZodString;
|
|
9
|
+
preVerificationGas: z.ZodString;
|
|
10
|
+
maxFeePerGas: z.ZodString;
|
|
11
|
+
maxPriorityFeePerGas: z.ZodString;
|
|
12
|
+
signature: z.ZodDefault<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
13
|
+
eip7702Auth: z.ZodOptional<z.ZodObject<{
|
|
14
|
+
chain_id: z.ZodOptional<z.ZodString>;
|
|
15
|
+
address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
16
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
17
|
+
y_parity: z.ZodOptional<z.ZodString>;
|
|
18
|
+
r: z.ZodOptional<z.ZodString>;
|
|
19
|
+
s: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
nonce?: string | undefined;
|
|
22
|
+
chain_id?: string | undefined;
|
|
23
|
+
address?: `0x${string}` | undefined;
|
|
24
|
+
y_parity?: string | undefined;
|
|
25
|
+
r?: string | undefined;
|
|
26
|
+
s?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
nonce?: string | undefined;
|
|
29
|
+
chain_id?: string | undefined;
|
|
30
|
+
address?: string | undefined;
|
|
31
|
+
y_parity?: string | undefined;
|
|
32
|
+
r?: string | undefined;
|
|
33
|
+
s?: string | undefined;
|
|
34
|
+
}>>;
|
|
35
|
+
} & {
|
|
36
|
+
paymaster: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
37
|
+
paymasterData: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
38
|
+
paymasterVerificationGasLimit: z.ZodString;
|
|
39
|
+
factory: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
40
|
+
factoryData: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
41
|
+
paymasterPostOpGasLimit: z.ZodString;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
sender: `0x${string}`;
|
|
44
|
+
nonce: string;
|
|
45
|
+
callData: `0x${string}`;
|
|
46
|
+
callGasLimit: string;
|
|
47
|
+
verificationGasLimit: string;
|
|
48
|
+
preVerificationGas: string;
|
|
49
|
+
maxFeePerGas: string;
|
|
50
|
+
maxPriorityFeePerGas: string;
|
|
51
|
+
signature: `0x${string}`;
|
|
52
|
+
paymasterVerificationGasLimit: string;
|
|
53
|
+
paymasterPostOpGasLimit: string;
|
|
54
|
+
eip7702Auth?: {
|
|
55
|
+
nonce?: string | undefined;
|
|
56
|
+
chain_id?: string | undefined;
|
|
57
|
+
address?: `0x${string}` | undefined;
|
|
58
|
+
y_parity?: string | undefined;
|
|
59
|
+
r?: string | undefined;
|
|
60
|
+
s?: string | undefined;
|
|
61
|
+
} | undefined;
|
|
62
|
+
paymaster?: `0x${string}` | undefined;
|
|
63
|
+
paymasterData?: `0x${string}` | undefined;
|
|
64
|
+
factory?: `0x${string}` | undefined;
|
|
65
|
+
factoryData?: `0x${string}` | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
sender: string;
|
|
68
|
+
nonce: string;
|
|
69
|
+
callData: `0x${string}`;
|
|
70
|
+
callGasLimit: string;
|
|
71
|
+
verificationGasLimit: string;
|
|
72
|
+
preVerificationGas: string;
|
|
73
|
+
maxFeePerGas: string;
|
|
74
|
+
maxPriorityFeePerGas: string;
|
|
75
|
+
paymasterVerificationGasLimit: string;
|
|
76
|
+
paymasterPostOpGasLimit: string;
|
|
77
|
+
signature?: `0x${string}` | undefined;
|
|
78
|
+
eip7702Auth?: {
|
|
79
|
+
nonce?: string | undefined;
|
|
80
|
+
chain_id?: string | undefined;
|
|
81
|
+
address?: string | undefined;
|
|
82
|
+
y_parity?: string | undefined;
|
|
83
|
+
r?: string | undefined;
|
|
84
|
+
s?: string | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
paymaster?: string | undefined;
|
|
87
|
+
paymasterData?: `0x${string}` | undefined;
|
|
88
|
+
factory?: string | undefined;
|
|
89
|
+
factoryData?: `0x${string}` | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
export type UserOpV070 = z.infer<typeof userOpV070Schema>;
|
|
92
|
+
export declare const userOpSchema: z.ZodObject<{
|
|
93
|
+
sender: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
94
|
+
nonce: z.ZodString;
|
|
95
|
+
callData: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
96
|
+
callGasLimit: z.ZodString;
|
|
97
|
+
verificationGasLimit: z.ZodString;
|
|
98
|
+
preVerificationGas: z.ZodString;
|
|
99
|
+
maxFeePerGas: z.ZodString;
|
|
100
|
+
maxPriorityFeePerGas: z.ZodString;
|
|
101
|
+
signature: z.ZodDefault<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
102
|
+
eip7702Auth: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
chain_id: z.ZodOptional<z.ZodString>;
|
|
104
|
+
address: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
105
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
106
|
+
y_parity: z.ZodOptional<z.ZodString>;
|
|
107
|
+
r: z.ZodOptional<z.ZodString>;
|
|
108
|
+
s: z.ZodOptional<z.ZodString>;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
nonce?: string | undefined;
|
|
111
|
+
chain_id?: string | undefined;
|
|
112
|
+
address?: `0x${string}` | undefined;
|
|
113
|
+
y_parity?: string | undefined;
|
|
114
|
+
r?: string | undefined;
|
|
115
|
+
s?: string | undefined;
|
|
116
|
+
}, {
|
|
117
|
+
nonce?: string | undefined;
|
|
118
|
+
chain_id?: string | undefined;
|
|
119
|
+
address?: string | undefined;
|
|
120
|
+
y_parity?: string | undefined;
|
|
121
|
+
r?: string | undefined;
|
|
122
|
+
s?: string | undefined;
|
|
123
|
+
}>>;
|
|
124
|
+
} & {
|
|
125
|
+
paymaster: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
126
|
+
paymasterData: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
127
|
+
paymasterVerificationGasLimit: z.ZodString;
|
|
128
|
+
factory: z.ZodOptional<z.ZodEffects<z.ZodString, `0x${string}`, string>>;
|
|
129
|
+
factoryData: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
130
|
+
paymasterPostOpGasLimit: z.ZodString;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
sender: `0x${string}`;
|
|
133
|
+
nonce: string;
|
|
134
|
+
callData: `0x${string}`;
|
|
135
|
+
callGasLimit: string;
|
|
136
|
+
verificationGasLimit: string;
|
|
137
|
+
preVerificationGas: string;
|
|
138
|
+
maxFeePerGas: string;
|
|
139
|
+
maxPriorityFeePerGas: string;
|
|
140
|
+
signature: `0x${string}`;
|
|
141
|
+
paymasterVerificationGasLimit: string;
|
|
142
|
+
paymasterPostOpGasLimit: string;
|
|
143
|
+
eip7702Auth?: {
|
|
144
|
+
nonce?: string | undefined;
|
|
145
|
+
chain_id?: string | undefined;
|
|
146
|
+
address?: `0x${string}` | undefined;
|
|
147
|
+
y_parity?: string | undefined;
|
|
148
|
+
r?: string | undefined;
|
|
149
|
+
s?: string | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
paymaster?: `0x${string}` | undefined;
|
|
152
|
+
paymasterData?: `0x${string}` | undefined;
|
|
153
|
+
factory?: `0x${string}` | undefined;
|
|
154
|
+
factoryData?: `0x${string}` | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
sender: string;
|
|
157
|
+
nonce: string;
|
|
158
|
+
callData: `0x${string}`;
|
|
159
|
+
callGasLimit: string;
|
|
160
|
+
verificationGasLimit: string;
|
|
161
|
+
preVerificationGas: string;
|
|
162
|
+
maxFeePerGas: string;
|
|
163
|
+
maxPriorityFeePerGas: string;
|
|
164
|
+
paymasterVerificationGasLimit: string;
|
|
165
|
+
paymasterPostOpGasLimit: string;
|
|
166
|
+
signature?: `0x${string}` | undefined;
|
|
167
|
+
eip7702Auth?: {
|
|
168
|
+
nonce?: string | undefined;
|
|
169
|
+
chain_id?: string | undefined;
|
|
170
|
+
address?: string | undefined;
|
|
171
|
+
y_parity?: string | undefined;
|
|
172
|
+
r?: string | undefined;
|
|
173
|
+
s?: string | undefined;
|
|
174
|
+
} | undefined;
|
|
175
|
+
paymaster?: string | undefined;
|
|
176
|
+
paymasterData?: `0x${string}` | undefined;
|
|
177
|
+
factory?: string | undefined;
|
|
178
|
+
factoryData?: `0x${string}` | undefined;
|
|
179
|
+
}>;
|
|
180
|
+
export type UserOp = z.infer<typeof userOpSchema>;
|
|
181
|
+
type HexLike = string | number | bigint | boolean | ByteArray;
|
|
182
|
+
export interface GenericUserOpV070 {
|
|
183
|
+
callData: Hex;
|
|
184
|
+
callGasLimit: HexLike;
|
|
185
|
+
factory?: Address;
|
|
186
|
+
factoryData?: Hex;
|
|
187
|
+
maxFeePerGas: HexLike;
|
|
188
|
+
maxPriorityFeePerGas: HexLike;
|
|
189
|
+
nonce: HexLike;
|
|
190
|
+
paymaster?: Address;
|
|
191
|
+
paymasterData?: Hex;
|
|
192
|
+
paymasterPostOpGasLimit?: HexLike;
|
|
193
|
+
paymasterVerificationGasLimit?: HexLike;
|
|
194
|
+
preVerificationGas: HexLike;
|
|
195
|
+
signature: Hex;
|
|
196
|
+
verificationGasLimit: HexLike;
|
|
197
|
+
}
|
|
198
|
+
export declare function toVincentUserOp(userOp: GenericUserOpV070): UserOp;
|
|
199
|
+
export {};
|
|
200
|
+
//# sourceMappingURL=userOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userOperation.d.ts","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/userOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAGpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgExB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqB3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAG1D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAmB,CAAC;AAC7C,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAGlD,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,GAAG,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,GAAG,CAAC;IACf,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAaD,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUjE"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.userOpSchema = exports.userOpV070Schema = void 0;
|
|
4
|
+
exports.toVincentUserOp = toVincentUserOp;
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const hex_1 = require("./hex");
|
|
8
|
+
const userOpBaseSchema = zod_1.z.object({
|
|
9
|
+
sender: hex_1.addressSchema.describe('The account making the operation'),
|
|
10
|
+
nonce: zod_1.z
|
|
11
|
+
.string()
|
|
12
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]*|0)$/)
|
|
13
|
+
.describe('Account nonce or creation salt'),
|
|
14
|
+
callData: hex_1.hexSchema.describe('Data for operation call'),
|
|
15
|
+
callGasLimit: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,15})|0$/)
|
|
18
|
+
.describe('Gas allocated for call'),
|
|
19
|
+
verificationGasLimit: zod_1.z
|
|
20
|
+
.string()
|
|
21
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,15})|0$/)
|
|
22
|
+
.describe('Gas allocated for verification'),
|
|
23
|
+
preVerificationGas: zod_1.z
|
|
24
|
+
.string()
|
|
25
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,15})|0$/)
|
|
26
|
+
.describe('Gas for pre-verification execution and calldata'),
|
|
27
|
+
maxFeePerGas: zod_1.z
|
|
28
|
+
.string()
|
|
29
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,15})|0$/)
|
|
30
|
+
.describe('Maximum fee per gas (EIP-1559)'),
|
|
31
|
+
maxPriorityFeePerGas: zod_1.z
|
|
32
|
+
.string()
|
|
33
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,15})|0$/)
|
|
34
|
+
.describe('Max priority fee per gas (EIP-1559)'),
|
|
35
|
+
signature: hex_1.hexSchema.default('0x').describe('Data passed during verification.'),
|
|
36
|
+
eip7702Auth: zod_1.z
|
|
37
|
+
.object({
|
|
38
|
+
chain_id: zod_1.z
|
|
39
|
+
.string()
|
|
40
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,15})|0$/)
|
|
41
|
+
.optional()
|
|
42
|
+
.describe('The chain Id of the authorization'),
|
|
43
|
+
address: hex_1.addressSchema.optional().describe('The address of the authorization'),
|
|
44
|
+
nonce: zod_1.z
|
|
45
|
+
.string()
|
|
46
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,15})|0$/)
|
|
47
|
+
.optional()
|
|
48
|
+
.describe('The nonce for the authorization'),
|
|
49
|
+
y_parity: zod_1.z
|
|
50
|
+
.string()
|
|
51
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]*|0)$/)
|
|
52
|
+
.optional()
|
|
53
|
+
.describe('Y parity of signed authorization tuple'),
|
|
54
|
+
r: zod_1.z
|
|
55
|
+
.string()
|
|
56
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,31})|0$/)
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('R of signed authorization tuple'),
|
|
59
|
+
s: zod_1.z
|
|
60
|
+
.string()
|
|
61
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,31})|0$/)
|
|
62
|
+
.optional()
|
|
63
|
+
.describe('S of signed authorization tuple'),
|
|
64
|
+
})
|
|
65
|
+
.optional(),
|
|
66
|
+
});
|
|
67
|
+
exports.userOpV070Schema = userOpBaseSchema.extend({
|
|
68
|
+
paymaster: hex_1.addressSchema.optional().describe('Paymaster contract address'),
|
|
69
|
+
paymasterData: hex_1.hexSchema.optional().describe('Data for paymaster'),
|
|
70
|
+
paymasterVerificationGasLimit: zod_1.z
|
|
71
|
+
.string()
|
|
72
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,15})|0$/)
|
|
73
|
+
.describe('The gas limit for paymaster verification.'),
|
|
74
|
+
factory: hex_1.addressSchema
|
|
75
|
+
.optional()
|
|
76
|
+
.describe('The account factory address (needed if and only if the account is not yet on-chain and needs to be created)'),
|
|
77
|
+
factoryData: hex_1.hexSchema
|
|
78
|
+
.optional()
|
|
79
|
+
.describe('Data for the account factory (only if the account factory exists)'),
|
|
80
|
+
paymasterPostOpGasLimit: zod_1.z
|
|
81
|
+
.string()
|
|
82
|
+
.regex(/^0x([1-9a-fA-F]+[0-9a-fA-F]{0,15})|0$/)
|
|
83
|
+
.describe('The amount of gas to allocate for the paymaster post-op code (only if a paymaster exists)'),
|
|
84
|
+
});
|
|
85
|
+
// Use z.union when adding new userOp versions
|
|
86
|
+
exports.userOpSchema = exports.userOpV070Schema;
|
|
87
|
+
const hexValues = [
|
|
88
|
+
'callGasLimit',
|
|
89
|
+
'maxFeePerGas',
|
|
90
|
+
'maxPriorityFeePerGas',
|
|
91
|
+
'nonce',
|
|
92
|
+
'paymasterPostOpGasLimit',
|
|
93
|
+
'paymasterVerificationGasLimit',
|
|
94
|
+
'preVerificationGas',
|
|
95
|
+
'verificationGasLimit',
|
|
96
|
+
];
|
|
97
|
+
function toVincentUserOp(userOp) {
|
|
98
|
+
const _userOp = { ...userOp };
|
|
99
|
+
for (const key of hexValues) {
|
|
100
|
+
if (hexValues.includes(key) && _userOp[key] && !(0, viem_1.isHex)(_userOp[key])) {
|
|
101
|
+
_userOp[key] = (0, viem_1.toHex)(_userOp[key]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return _userOp;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=userOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userOperation.js","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/userOperation.ts"],"names":[],"mappings":";;;AA+HA,0CAUC;AAvID,+BAAoC;AACpC,6BAAwB;AAExB,+BAAiD;AAEjD,MAAM,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChC,MAAM,EAAE,mBAAa,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAClE,KAAK,EAAE,OAAC;SACL,MAAM,EAAE;SACR,KAAK,CAAC,kCAAkC,CAAC;SACzC,QAAQ,CAAC,gCAAgC,CAAC;IAC7C,QAAQ,EAAE,eAAS,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IACvD,YAAY,EAAE,OAAC;SACZ,MAAM,EAAE;SACR,KAAK,CAAC,uCAAuC,CAAC;SAC9C,QAAQ,CAAC,wBAAwB,CAAC;IACrC,oBAAoB,EAAE,OAAC;SACpB,MAAM,EAAE;SACR,KAAK,CAAC,uCAAuC,CAAC;SAC9C,QAAQ,CAAC,gCAAgC,CAAC;IAC7C,kBAAkB,EAAE,OAAC;SAClB,MAAM,EAAE;SACR,KAAK,CAAC,uCAAuC,CAAC;SAC9C,QAAQ,CAAC,iDA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
|
+
import type { Transaction } from './transaction';
|
|
4
|
+
import type { UserOp } from './userOperation';
|
|
5
|
+
interface AssertIsValidUserOpParams extends LifecycleFunctionSteps {
|
|
6
|
+
alchemyRpcUrl: string;
|
|
7
|
+
entryPointAddress: Address;
|
|
8
|
+
userOp: UserOp;
|
|
9
|
+
}
|
|
10
|
+
export declare const assertIsValidUserOp: ({ alchemyRpcUrl, decodeTransaction, entryPointAddress, userOp, validateSimulation, validateTransaction, }: AssertIsValidUserOpParams) => Promise<{
|
|
11
|
+
symbol: string;
|
|
12
|
+
to: `0x${string}`;
|
|
13
|
+
from: `0x${string}`;
|
|
14
|
+
assetType: import("./simulation").SimulateAssetType;
|
|
15
|
+
changeType: import("./simulation").SimulateChangeType;
|
|
16
|
+
decimals: number;
|
|
17
|
+
tokenId?: string | null | undefined;
|
|
18
|
+
name?: string | null | undefined;
|
|
19
|
+
rawAmount?: string | null | undefined;
|
|
20
|
+
amount?: string | null | undefined;
|
|
21
|
+
contractAddress?: `0x${string}` | null | undefined;
|
|
22
|
+
logo?: string | null | undefined;
|
|
23
|
+
}[]>;
|
|
24
|
+
interface AssertIsValidTransactionParams extends LifecycleFunctionSteps {
|
|
25
|
+
alchemyRpcUrl: string;
|
|
26
|
+
transaction: Transaction;
|
|
27
|
+
}
|
|
28
|
+
export declare function assertIsValidTransaction({ alchemyRpcUrl, decodeTransaction, transaction, validateSimulation, validateTransaction, }: AssertIsValidTransactionParams): Promise<{
|
|
29
|
+
symbol: string;
|
|
30
|
+
to: `0x${string}`;
|
|
31
|
+
from: `0x${string}`;
|
|
32
|
+
assetType: import("./simulation").SimulateAssetType;
|
|
33
|
+
changeType: import("./simulation").SimulateChangeType;
|
|
34
|
+
decimals: number;
|
|
35
|
+
tokenId?: string | null | undefined;
|
|
36
|
+
name?: string | null | undefined;
|
|
37
|
+
rawAmount?: string | null | undefined;
|
|
38
|
+
amount?: string | null | undefined;
|
|
39
|
+
contractAddress?: `0x${string}` | null | undefined;
|
|
40
|
+
logo?: string | null | undefined;
|
|
41
|
+
}[]>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAK9C,UAAU,yBAA0B,SAAQ,sBAAsB;IAChE,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,mBAAmB,GAAU,2GAOvC,yBAAyB;;;;;;;;;;;;;IAyC3B,CAAC;AAEF,UAAU,8BAA+B,SAAQ,sBAAsB;IACrE,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,GACpB,EAAE,8BAA8B;;;;;;;;;;;;;KAqChC"}
|