@cofhe/sdk 0.0.0-alpha-20260409113701
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/CHANGELOG.md +146 -0
- package/adapters/ethers5.test.ts +174 -0
- package/adapters/ethers5.ts +36 -0
- package/adapters/ethers6.test.ts +169 -0
- package/adapters/ethers6.ts +36 -0
- package/adapters/hardhat-node.ts +167 -0
- package/adapters/hardhat.hh2.test.ts +159 -0
- package/adapters/hardhat.ts +36 -0
- package/adapters/index.test.ts +20 -0
- package/adapters/index.ts +5 -0
- package/adapters/smartWallet.ts +99 -0
- package/adapters/test-utils.ts +53 -0
- package/adapters/types.ts +6 -0
- package/adapters/wagmi.test.ts +156 -0
- package/adapters/wagmi.ts +17 -0
- package/chains/chains/arbSepolia.ts +14 -0
- package/chains/chains/baseSepolia.ts +14 -0
- package/chains/chains/hardhat.ts +15 -0
- package/chains/chains/localcofhe.ts +14 -0
- package/chains/chains/sepolia.ts +14 -0
- package/chains/chains.test.ts +50 -0
- package/chains/defineChain.ts +18 -0
- package/chains/index.ts +35 -0
- package/chains/types.ts +32 -0
- package/core/baseBuilder.ts +119 -0
- package/core/client.test.ts +429 -0
- package/core/client.ts +341 -0
- package/core/clientTypes.ts +119 -0
- package/core/config.test.ts +242 -0
- package/core/config.ts +225 -0
- package/core/consts.ts +22 -0
- package/core/decrypt/MockThresholdNetworkAbi.ts +179 -0
- package/core/decrypt/cofheMocksDecryptForTx.ts +84 -0
- package/core/decrypt/cofheMocksDecryptForView.ts +48 -0
- package/core/decrypt/decryptForTxBuilder.ts +359 -0
- package/core/decrypt/decryptForViewBuilder.ts +332 -0
- package/core/decrypt/decryptUtils.ts +28 -0
- package/core/decrypt/pollCallbacks.test.ts +194 -0
- package/core/decrypt/polling.ts +14 -0
- package/core/decrypt/tnDecryptUtils.ts +65 -0
- package/core/decrypt/tnDecryptV1.ts +171 -0
- package/core/decrypt/tnDecryptV2.ts +365 -0
- package/core/decrypt/tnSealOutputV1.ts +59 -0
- package/core/decrypt/tnSealOutputV2.ts +324 -0
- package/core/decrypt/verifyDecryptResult.ts +52 -0
- package/core/encrypt/MockZkVerifierAbi.ts +106 -0
- package/core/encrypt/cofheMocksZkVerifySign.ts +281 -0
- package/core/encrypt/encryptInputsBuilder.test.ts +747 -0
- package/core/encrypt/encryptInputsBuilder.ts +583 -0
- package/core/encrypt/encryptUtils.ts +67 -0
- package/core/encrypt/zkPackProveVerify.ts +335 -0
- package/core/error.ts +168 -0
- package/core/fetchKeys.test.ts +195 -0
- package/core/fetchKeys.ts +144 -0
- package/core/index.ts +106 -0
- package/core/keyStore.test.ts +226 -0
- package/core/keyStore.ts +154 -0
- package/core/permits.test.ts +493 -0
- package/core/permits.ts +201 -0
- package/core/types.ts +419 -0
- package/core/utils.ts +130 -0
- package/dist/adapters.cjs +88 -0
- package/dist/adapters.d.cts +14576 -0
- package/dist/adapters.d.ts +14576 -0
- package/dist/adapters.js +83 -0
- package/dist/chains.cjs +111 -0
- package/dist/chains.d.cts +121 -0
- package/dist/chains.d.ts +121 -0
- package/dist/chains.js +1 -0
- package/dist/chunk-36FBWLUS.js +3310 -0
- package/dist/chunk-7HLGHV67.js +990 -0
- package/dist/chunk-TBLR7NNE.js +102 -0
- package/dist/clientTypes-AVSCBet7.d.cts +998 -0
- package/dist/clientTypes-flH1ju82.d.ts +998 -0
- package/dist/core.cjs +4362 -0
- package/dist/core.d.cts +138 -0
- package/dist/core.d.ts +138 -0
- package/dist/core.js +3 -0
- package/dist/node.cjs +4225 -0
- package/dist/node.d.cts +22 -0
- package/dist/node.d.ts +22 -0
- package/dist/node.js +91 -0
- package/dist/permit-jRirYqFt.d.cts +376 -0
- package/dist/permit-jRirYqFt.d.ts +376 -0
- package/dist/permits.cjs +1025 -0
- package/dist/permits.d.cts +353 -0
- package/dist/permits.d.ts +353 -0
- package/dist/permits.js +1 -0
- package/dist/types-YiAC4gig.d.cts +33 -0
- package/dist/types-YiAC4gig.d.ts +33 -0
- package/dist/web.cjs +4434 -0
- package/dist/web.d.cts +42 -0
- package/dist/web.d.ts +42 -0
- package/dist/web.js +256 -0
- package/dist/zkProve.worker.cjs +93 -0
- package/dist/zkProve.worker.d.cts +2 -0
- package/dist/zkProve.worker.d.ts +2 -0
- package/dist/zkProve.worker.js +91 -0
- package/node/client.test.ts +159 -0
- package/node/config.test.ts +68 -0
- package/node/encryptInputs.test.ts +155 -0
- package/node/index.ts +97 -0
- package/node/storage.ts +51 -0
- package/package.json +121 -0
- package/permits/index.ts +68 -0
- package/permits/localstorage.test.ts +113 -0
- package/permits/onchain-utils.ts +221 -0
- package/permits/permit.test.ts +534 -0
- package/permits/permit.ts +386 -0
- package/permits/sealing.test.ts +84 -0
- package/permits/sealing.ts +131 -0
- package/permits/signature.ts +79 -0
- package/permits/store.test.ts +88 -0
- package/permits/store.ts +156 -0
- package/permits/test-utils.ts +28 -0
- package/permits/types.ts +204 -0
- package/permits/utils.ts +58 -0
- package/permits/validation.test.ts +361 -0
- package/permits/validation.ts +327 -0
- package/web/client.web.test.ts +159 -0
- package/web/config.web.test.ts +69 -0
- package/web/const.ts +2 -0
- package/web/encryptInputs.web.test.ts +172 -0
- package/web/index.ts +166 -0
- package/web/storage.ts +49 -0
- package/web/worker.builder.web.test.ts +148 -0
- package/web/worker.config.web.test.ts +329 -0
- package/web/worker.output.web.test.ts +84 -0
- package/web/workerManager.test.ts +80 -0
- package/web/workerManager.ts +214 -0
- package/web/workerManager.web.test.ts +114 -0
- package/web/zkProve.worker.ts +133 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { P as Permit, V as ValidationResult, a as PermitSignaturePrimaryType, b as Permission, E as EIP712Types, c as EIP712Message, S as SerializedPermit } from './permit-jRirYqFt.cjs';
|
|
2
|
+
export { C as CreateSelfPermitOptions, d as CreateSharingPermitOptions, f as EIP712Domain, j as EIP712Type, i as EthEncryptedData, p as Expand, G as GenerateSealingKey, I as ImportPermitOptions, I as ImportSharedPermitOptions, o as PermitHashFields, e as PermitMetadata, l as PermitOf, k as PermitType, g as PermitUtils, R as RecipientPermit, h as SealingKey, m as SelfPermit, C as SelfPermitOptions, n as SharingPermit, d as SharingPermitOptions } from './permit-jRirYqFt.cjs';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import * as zustand_middleware from 'zustand/middleware';
|
|
5
|
+
import * as zustand_vanilla from 'zustand/vanilla';
|
|
6
|
+
import 'viem';
|
|
7
|
+
|
|
8
|
+
declare const addressSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
9
|
+
declare const addressNotZeroSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
10
|
+
declare const bytesSchema: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
11
|
+
declare const bytesNotEmptySchema: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
12
|
+
/**
|
|
13
|
+
* Validator for self permit creation options
|
|
14
|
+
*/
|
|
15
|
+
declare const SelfPermitOptionsValidator: z.ZodObject<{
|
|
16
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"self">>>;
|
|
17
|
+
issuer: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
18
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
19
|
+
expiration: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
20
|
+
recipient: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
21
|
+
validatorId: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
22
|
+
validatorContract: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
23
|
+
issuerSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
24
|
+
recipientSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
/**
|
|
27
|
+
* Validator for fully formed self permits
|
|
28
|
+
*/
|
|
29
|
+
declare const SelfPermitValidator: z.ZodObject<{
|
|
30
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
31
|
+
type: z.ZodEnum<{
|
|
32
|
+
self: "self";
|
|
33
|
+
sharing: "sharing";
|
|
34
|
+
recipient: "recipient";
|
|
35
|
+
}>;
|
|
36
|
+
issuer: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
37
|
+
expiration: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
38
|
+
recipient: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
39
|
+
validatorId: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
40
|
+
validatorContract: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
41
|
+
issuerSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
42
|
+
recipientSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
43
|
+
sealingPair: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
privateKey: z.ZodString;
|
|
45
|
+
publicKey: z.ZodString;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
/**
|
|
49
|
+
* Validator for sharing permit creation options
|
|
50
|
+
*/
|
|
51
|
+
declare const SharingPermitOptionsValidator: z.ZodObject<{
|
|
52
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"sharing">>>;
|
|
53
|
+
issuer: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
54
|
+
recipient: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
55
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
56
|
+
expiration: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
57
|
+
validatorId: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
58
|
+
validatorContract: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
59
|
+
issuerSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
60
|
+
recipientSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
/**
|
|
63
|
+
* Validator for fully formed sharing permits
|
|
64
|
+
*/
|
|
65
|
+
declare const SharingPermitValidator: z.ZodObject<{
|
|
66
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
67
|
+
type: z.ZodEnum<{
|
|
68
|
+
self: "self";
|
|
69
|
+
sharing: "sharing";
|
|
70
|
+
recipient: "recipient";
|
|
71
|
+
}>;
|
|
72
|
+
issuer: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
73
|
+
expiration: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
74
|
+
recipient: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
75
|
+
validatorId: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
76
|
+
validatorContract: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
77
|
+
issuerSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
78
|
+
recipientSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
79
|
+
sealingPair: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
privateKey: z.ZodString;
|
|
81
|
+
publicKey: z.ZodString;
|
|
82
|
+
}, z.core.$strip>>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
/**
|
|
85
|
+
* Validator for import permit creation options (recipient receiving shared permit)
|
|
86
|
+
*/
|
|
87
|
+
declare const ImportPermitOptionsValidator: z.ZodObject<{
|
|
88
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"recipient">>>;
|
|
89
|
+
issuer: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
90
|
+
recipient: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
91
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
92
|
+
expiration: z.ZodInt;
|
|
93
|
+
validatorId: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
94
|
+
validatorContract: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
95
|
+
issuerSignature: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
96
|
+
recipientSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
/**
|
|
99
|
+
* Validator for fully formed import/recipient permits
|
|
100
|
+
*/
|
|
101
|
+
declare const ImportPermitValidator: z.ZodObject<{
|
|
102
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
103
|
+
type: z.ZodEnum<{
|
|
104
|
+
self: "self";
|
|
105
|
+
sharing: "sharing";
|
|
106
|
+
recipient: "recipient";
|
|
107
|
+
}>;
|
|
108
|
+
issuer: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
109
|
+
expiration: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
110
|
+
recipient: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
111
|
+
validatorId: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
112
|
+
validatorContract: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
113
|
+
issuerSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
114
|
+
recipientSignature: z.ZodDefault<z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>>;
|
|
115
|
+
sealingPair: z.ZodOptional<z.ZodObject<{
|
|
116
|
+
privateKey: z.ZodString;
|
|
117
|
+
publicKey: z.ZodString;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
/**
|
|
121
|
+
* Validates self permit creation options
|
|
122
|
+
*/
|
|
123
|
+
declare const validateSelfPermitOptions: (options: any) => {
|
|
124
|
+
type: "self";
|
|
125
|
+
issuer: `0x${string}`;
|
|
126
|
+
name: string;
|
|
127
|
+
expiration: number;
|
|
128
|
+
recipient: `0x${string}`;
|
|
129
|
+
validatorId: number;
|
|
130
|
+
validatorContract: `0x${string}`;
|
|
131
|
+
issuerSignature: `0x${string}`;
|
|
132
|
+
recipientSignature: `0x${string}`;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Validates sharing permit creation options
|
|
136
|
+
*/
|
|
137
|
+
declare const validateSharingPermitOptions: (options: any) => {
|
|
138
|
+
type: "sharing";
|
|
139
|
+
issuer: `0x${string}`;
|
|
140
|
+
recipient: `0x${string}`;
|
|
141
|
+
name: string;
|
|
142
|
+
expiration: number;
|
|
143
|
+
validatorId: number;
|
|
144
|
+
validatorContract: `0x${string}`;
|
|
145
|
+
issuerSignature: `0x${string}`;
|
|
146
|
+
recipientSignature: `0x${string}`;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Validates import permit creation options
|
|
150
|
+
*/
|
|
151
|
+
declare const validateImportPermitOptions: (options: any) => {
|
|
152
|
+
type: "recipient";
|
|
153
|
+
issuer: `0x${string}`;
|
|
154
|
+
recipient: `0x${string}`;
|
|
155
|
+
name: string;
|
|
156
|
+
expiration: number;
|
|
157
|
+
validatorId: number;
|
|
158
|
+
validatorContract: `0x${string}`;
|
|
159
|
+
issuerSignature: `0x${string}`;
|
|
160
|
+
recipientSignature: `0x${string}`;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Validates a fully formed self permit
|
|
164
|
+
*/
|
|
165
|
+
declare const validateSelfPermit: (permit: any) => {
|
|
166
|
+
name: string;
|
|
167
|
+
type: "self" | "sharing" | "recipient";
|
|
168
|
+
issuer: `0x${string}`;
|
|
169
|
+
expiration: number;
|
|
170
|
+
recipient: `0x${string}`;
|
|
171
|
+
validatorId: number;
|
|
172
|
+
validatorContract: `0x${string}`;
|
|
173
|
+
issuerSignature: `0x${string}`;
|
|
174
|
+
recipientSignature: `0x${string}`;
|
|
175
|
+
sealingPair?: {
|
|
176
|
+
privateKey: string;
|
|
177
|
+
publicKey: string;
|
|
178
|
+
} | undefined;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Validates a fully formed sharing permit
|
|
182
|
+
*/
|
|
183
|
+
declare const validateSharingPermit: (permit: any) => {
|
|
184
|
+
name: string;
|
|
185
|
+
type: "self" | "sharing" | "recipient";
|
|
186
|
+
issuer: `0x${string}`;
|
|
187
|
+
expiration: number;
|
|
188
|
+
recipient: `0x${string}`;
|
|
189
|
+
validatorId: number;
|
|
190
|
+
validatorContract: `0x${string}`;
|
|
191
|
+
issuerSignature: `0x${string}`;
|
|
192
|
+
recipientSignature: `0x${string}`;
|
|
193
|
+
sealingPair?: {
|
|
194
|
+
privateKey: string;
|
|
195
|
+
publicKey: string;
|
|
196
|
+
} | undefined;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Validates a fully formed import/recipient permit
|
|
200
|
+
*/
|
|
201
|
+
declare const validateImportPermit: (permit: any) => {
|
|
202
|
+
name: string;
|
|
203
|
+
type: "self" | "sharing" | "recipient";
|
|
204
|
+
issuer: `0x${string}`;
|
|
205
|
+
expiration: number;
|
|
206
|
+
recipient: `0x${string}`;
|
|
207
|
+
validatorId: number;
|
|
208
|
+
validatorContract: `0x${string}`;
|
|
209
|
+
issuerSignature: `0x${string}`;
|
|
210
|
+
recipientSignature: `0x${string}`;
|
|
211
|
+
sealingPair?: {
|
|
212
|
+
privateKey: string;
|
|
213
|
+
publicKey: string;
|
|
214
|
+
} | undefined;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Simple validation functions for common checks
|
|
218
|
+
*/
|
|
219
|
+
declare const ValidationUtils: {
|
|
220
|
+
/**
|
|
221
|
+
* Check if permit is expired
|
|
222
|
+
*/
|
|
223
|
+
isExpired: (permit: Permit) => boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Check if permit is signed by the active party
|
|
226
|
+
*/
|
|
227
|
+
isSigned: (permit: Permit) => boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Checks that a permit is signed and not expired.
|
|
230
|
+
*/
|
|
231
|
+
isSignedAndNotExpired: (permit: Permit) => ValidationResult;
|
|
232
|
+
/**
|
|
233
|
+
* Asserts that a permit is signed and not expired.
|
|
234
|
+
*
|
|
235
|
+
* Throws `Error` with message:
|
|
236
|
+
* - `Permit is expired`
|
|
237
|
+
* - `Permit is not signed`
|
|
238
|
+
*/
|
|
239
|
+
assertSignedAndNotExpired: (permit: Permit) => void;
|
|
240
|
+
isValid: (permit: Permit) => ValidationResult;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
declare const PermitSignatureAllFields: readonly [{
|
|
244
|
+
readonly name: "issuer";
|
|
245
|
+
readonly type: "address";
|
|
246
|
+
}, {
|
|
247
|
+
readonly name: "expiration";
|
|
248
|
+
readonly type: "uint64";
|
|
249
|
+
}, {
|
|
250
|
+
readonly name: "recipient";
|
|
251
|
+
readonly type: "address";
|
|
252
|
+
}, {
|
|
253
|
+
readonly name: "validatorId";
|
|
254
|
+
readonly type: "uint256";
|
|
255
|
+
}, {
|
|
256
|
+
readonly name: "validatorContract";
|
|
257
|
+
readonly type: "address";
|
|
258
|
+
}, {
|
|
259
|
+
readonly name: "sealingKey";
|
|
260
|
+
readonly type: "bytes32";
|
|
261
|
+
}, {
|
|
262
|
+
readonly name: "issuerSignature";
|
|
263
|
+
readonly type: "bytes";
|
|
264
|
+
}];
|
|
265
|
+
type PermitSignatureFieldOption = (typeof PermitSignatureAllFields)[number]['name'];
|
|
266
|
+
declare const SignatureTypes: {
|
|
267
|
+
readonly PermissionedV2IssuerSelf: ("recipient" | "issuer" | "expiration" | "validatorId" | "validatorContract" | "sealingKey")[];
|
|
268
|
+
readonly PermissionedV2IssuerShared: ("recipient" | "issuer" | "expiration" | "validatorId" | "validatorContract")[];
|
|
269
|
+
readonly PermissionedV2Recipient: ("issuerSignature" | "sealingKey")[];
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Get signature types and message for EIP712 signing
|
|
273
|
+
*/
|
|
274
|
+
declare const getSignatureTypesAndMessage: <T extends PermitSignatureFieldOption>(primaryType: PermitSignaturePrimaryType, fields: T[] | readonly T[], values: Pick<Permission, T> & Partial<Permission>) => {
|
|
275
|
+
types: EIP712Types;
|
|
276
|
+
primaryType: string;
|
|
277
|
+
message: EIP712Message;
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Signature utilities for permit operations
|
|
281
|
+
*/
|
|
282
|
+
declare const SignatureUtils: {
|
|
283
|
+
/**
|
|
284
|
+
* Get signature parameters for a permit
|
|
285
|
+
*/
|
|
286
|
+
getSignatureParams: (permit: Permission, primaryType: PermitSignaturePrimaryType) => {
|
|
287
|
+
types: EIP712Types;
|
|
288
|
+
primaryType: string;
|
|
289
|
+
message: EIP712Message;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Determine the required signature type based on permit type
|
|
293
|
+
*/
|
|
294
|
+
getPrimaryType: (permitType: "self" | "sharing" | "recipient") => PermitSignaturePrimaryType;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
type ChainRecord<T> = Record<number, T>;
|
|
298
|
+
type AccountRecord<T> = Record<string, T>;
|
|
299
|
+
type HashRecord<T> = Record<string, T>;
|
|
300
|
+
type PermitsStore = {
|
|
301
|
+
permits: ChainRecord<AccountRecord<HashRecord<SerializedPermit | undefined>>>;
|
|
302
|
+
activePermitHash: ChainRecord<AccountRecord<string | undefined>>;
|
|
303
|
+
};
|
|
304
|
+
declare const PERMIT_STORE_DEFAULTS: PermitsStore;
|
|
305
|
+
declare const _permitStore: Omit<zustand_vanilla.StoreApi<PermitsStore>, "setState" | "persist"> & {
|
|
306
|
+
setState(partial: PermitsStore | Partial<PermitsStore> | ((state: PermitsStore) => PermitsStore | Partial<PermitsStore>), replace?: false | undefined): unknown;
|
|
307
|
+
setState(state: PermitsStore | ((state: PermitsStore) => PermitsStore), replace: true): unknown;
|
|
308
|
+
persist: {
|
|
309
|
+
setOptions: (options: Partial<zustand_middleware.PersistOptions<PermitsStore, PermitsStore, unknown>>) => void;
|
|
310
|
+
clearStorage: () => void;
|
|
311
|
+
rehydrate: () => Promise<void> | void;
|
|
312
|
+
hasHydrated: () => boolean;
|
|
313
|
+
onHydrate: (fn: (state: PermitsStore) => void) => () => void;
|
|
314
|
+
onFinishHydration: (fn: (state: PermitsStore) => void) => () => void;
|
|
315
|
+
getOptions: () => Partial<zustand_middleware.PersistOptions<PermitsStore, PermitsStore, unknown>>;
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
declare const clearStaleStore: () => void;
|
|
319
|
+
declare const getPermit: (chainId: number | undefined, account: string | undefined, hash: string | undefined) => Permit | undefined;
|
|
320
|
+
declare const getActivePermit: (chainId: number | undefined, account: string | undefined) => Permit | undefined;
|
|
321
|
+
declare const getPermits: (chainId: number | undefined, account: string | undefined) => Record<string, Permit>;
|
|
322
|
+
declare const setPermit: (chainId: number, account: string, permit: Permit) => void;
|
|
323
|
+
declare const removePermit: (chainId: number, account: string, hash: string) => void;
|
|
324
|
+
declare const getActivePermitHash: (chainId: number | undefined, account: string | undefined) => string | undefined;
|
|
325
|
+
declare const setActivePermitHash: (chainId: number, account: string, hash: string) => void;
|
|
326
|
+
declare const removeActivePermitHash: (chainId: number, account: string) => void;
|
|
327
|
+
declare const resetStore: () => void;
|
|
328
|
+
declare const permitStore: {
|
|
329
|
+
store: Omit<zustand_vanilla.StoreApi<PermitsStore>, "setState" | "persist"> & {
|
|
330
|
+
setState(partial: PermitsStore | Partial<PermitsStore> | ((state: PermitsStore) => PermitsStore | Partial<PermitsStore>), replace?: false | undefined): unknown;
|
|
331
|
+
setState(state: PermitsStore | ((state: PermitsStore) => PermitsStore), replace: true): unknown;
|
|
332
|
+
persist: {
|
|
333
|
+
setOptions: (options: Partial<zustand_middleware.PersistOptions<PermitsStore, PermitsStore, unknown>>) => void;
|
|
334
|
+
clearStorage: () => void;
|
|
335
|
+
rehydrate: () => Promise<void> | void;
|
|
336
|
+
hasHydrated: () => boolean;
|
|
337
|
+
onHydrate: (fn: (state: PermitsStore) => void) => () => void;
|
|
338
|
+
onFinishHydration: (fn: (state: PermitsStore) => void) => () => void;
|
|
339
|
+
getOptions: () => Partial<zustand_middleware.PersistOptions<PermitsStore, PermitsStore, unknown>>;
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
getPermit: (chainId: number | undefined, account: string | undefined, hash: string | undefined) => Permit | undefined;
|
|
343
|
+
getActivePermit: (chainId: number | undefined, account: string | undefined) => Permit | undefined;
|
|
344
|
+
getPermits: (chainId: number | undefined, account: string | undefined) => Record<string, Permit>;
|
|
345
|
+
setPermit: (chainId: number, account: string, permit: Permit) => void;
|
|
346
|
+
removePermit: (chainId: number, account: string, hash: string) => void;
|
|
347
|
+
getActivePermitHash: (chainId: number | undefined, account: string | undefined) => string | undefined;
|
|
348
|
+
setActivePermitHash: (chainId: number, account: string, hash: string) => void;
|
|
349
|
+
removeActivePermitHash: (chainId: number, account: string) => void;
|
|
350
|
+
resetStore: () => void;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
export { EIP712Message, EIP712Types, ImportPermitOptionsValidator, ImportPermitValidator, PERMIT_STORE_DEFAULTS, Permission, Permit, PermitSignaturePrimaryType, SelfPermitOptionsValidator, SelfPermitValidator, SerializedPermit, SharingPermitOptionsValidator, SharingPermitValidator, SignatureTypes, SignatureUtils, ValidationResult, ValidationUtils, _permitStore, addressNotZeroSchema, addressSchema, bytesNotEmptySchema, bytesSchema, clearStaleStore, getActivePermit, getActivePermitHash, getPermit, getPermits, getSignatureTypesAndMessage, permitStore, removeActivePermitHash, removePermit, resetStore, setActivePermitHash, setPermit, validateImportPermit, validateImportPermitOptions, validateSelfPermit, validateSelfPermitOptions, validateSharingPermit, validateSharingPermitOptions };
|