@reown/appkit-experimental 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/dist/esm/exports/index.js +2 -0
- package/dist/esm/exports/index.js.map +1 -0
- package/dist/esm/exports/smart-session/index.js +2 -0
- package/dist/esm/exports/smart-session/index.js.map +1 -0
- package/dist/esm/src/smart-session/grantPermissions.js +77 -0
- package/dist/esm/src/smart-session/grantPermissions.js.map +1 -0
- package/dist/esm/src/smart-session/helper/index.js +79 -0
- package/dist/esm/src/smart-session/helper/index.js.map +1 -0
- package/dist/esm/src/smart-session/schema/index.js +92 -0
- package/dist/esm/src/smart-session/schema/index.js.map +1 -0
- package/dist/esm/src/smart-session/utils/ConstantUtils.js +5 -0
- package/dist/esm/src/smart-session/utils/ConstantUtils.js.map +1 -0
- package/dist/esm/src/smart-session/utils/CosignerService.js +62 -0
- package/dist/esm/src/smart-session/utils/CosignerService.js.map +1 -0
- package/dist/esm/src/smart-session/utils/ERC5792Types.js +2 -0
- package/dist/esm/src/smart-session/utils/ERC5792Types.js.map +1 -0
- package/dist/esm/src/smart-session/utils/TypeUtils.js +12 -0
- package/dist/esm/src/smart-session/utils/TypeUtils.js.map +1 -0
- package/dist/esm/tests/data/abi.js +16 -0
- package/dist/esm/tests/data/abi.js.map +1 -0
- package/dist/esm/tests/smart-session/CosignerService.test.js +130 -0
- package/dist/esm/tests/smart-session/CosignerService.test.js.map +1 -0
- package/dist/esm/tests/smart-session/grantPermissions.test.js +252 -0
- package/dist/esm/tests/smart-session/grantPermissions.test.js.map +1 -0
- package/dist/esm/tests/smart-session/requestValidation.test.js +423 -0
- package/dist/esm/tests/smart-session/requestValidation.test.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/types/exports/index.d.ts +0 -0
- package/dist/types/exports/smart-session/index.d.ts +2 -0
- package/dist/types/src/smart-session/grantPermissions.d.ts +5 -0
- package/dist/types/src/smart-session/helper/index.d.ts +61 -0
- package/dist/types/src/smart-session/schema/index.d.ts +265 -0
- package/dist/types/src/smart-session/utils/ConstantUtils.d.ts +4 -0
- package/dist/types/src/smart-session/utils/CosignerService.d.ts +19 -0
- package/dist/types/src/smart-session/utils/ERC5792Types.d.ts +20 -0
- package/dist/types/src/smart-session/utils/TypeUtils.d.ts +80 -0
- package/dist/types/tests/data/abi.d.ts +11 -0
- package/dist/types/tests/smart-session/CosignerService.test.d.ts +1 -0
- package/dist/types/tests/smart-session/grantPermissions.test.d.ts +1 -0
- package/dist/types/tests/smart-session/requestValidation.test.d.ts +1 -0
- package/package.json +70 -0
- package/readme.md +23 -0
|
File without changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SmartSessionGrantPermissionsRequest, SmartSessionGrantPermissionsResponse } from './utils/TypeUtils.js';
|
|
2
|
+
import type { PermissionsCapability } from './utils/ERC5792Types.js';
|
|
3
|
+
export declare function grantPermissions(request: SmartSessionGrantPermissionsRequest): Promise<SmartSessionGrantPermissionsResponse>;
|
|
4
|
+
export declare function validateRequestForSupportedPermissionsCapability(request: SmartSessionGrantPermissionsRequest, capabilities: PermissionsCapability): void;
|
|
5
|
+
export declare function isSmartSessionSupported(): boolean;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type AddPermissionResponse, type KeyType, type SmartSessionGrantPermissionsRequest, type WalletGrantPermissionsResponse } from '../utils/TypeUtils.js';
|
|
2
|
+
export declare function validateRequest(request: SmartSessionGrantPermissionsRequest): {
|
|
3
|
+
chainId: string;
|
|
4
|
+
expiry: number;
|
|
5
|
+
signer: {
|
|
6
|
+
type: "keys";
|
|
7
|
+
data: {
|
|
8
|
+
keys: {
|
|
9
|
+
type: "secp256r1" | "secp256k1";
|
|
10
|
+
publicKey: string;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
permissions: [{
|
|
15
|
+
type: "contract-call";
|
|
16
|
+
data: {
|
|
17
|
+
address: string;
|
|
18
|
+
abi: Record<string, unknown>[];
|
|
19
|
+
functions: {
|
|
20
|
+
functionName: string;
|
|
21
|
+
args?: {
|
|
22
|
+
value: string;
|
|
23
|
+
operator: import("../utils/TypeUtils.js").ParamOperator;
|
|
24
|
+
}[] | undefined;
|
|
25
|
+
valueLimit?: string | undefined;
|
|
26
|
+
operation?: import("../utils/TypeUtils.js").Operation | undefined;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
}, ...{
|
|
30
|
+
type: "contract-call";
|
|
31
|
+
data: {
|
|
32
|
+
address: string;
|
|
33
|
+
abi: Record<string, unknown>[];
|
|
34
|
+
functions: {
|
|
35
|
+
functionName: string;
|
|
36
|
+
args?: {
|
|
37
|
+
value: string;
|
|
38
|
+
operator: import("../utils/TypeUtils.js").ParamOperator;
|
|
39
|
+
}[] | undefined;
|
|
40
|
+
valueLimit?: string | undefined;
|
|
41
|
+
operation?: import("../utils/TypeUtils.js").Operation | undefined;
|
|
42
|
+
}[];
|
|
43
|
+
};
|
|
44
|
+
}[]];
|
|
45
|
+
policies: {
|
|
46
|
+
type: string;
|
|
47
|
+
data: Record<string, unknown>;
|
|
48
|
+
}[];
|
|
49
|
+
address?: string | undefined;
|
|
50
|
+
};
|
|
51
|
+
export declare function isValidSupportedCaipAddress(value: unknown): value is `eip155:${string}:${string}` | `eip155:${number}:${string}`;
|
|
52
|
+
export declare function extractChainAndAddress(caipAddress: unknown): {
|
|
53
|
+
chain: string;
|
|
54
|
+
address: `0x${string}`;
|
|
55
|
+
} | undefined;
|
|
56
|
+
export declare function assertWalletGrantPermissionsResponse(response: unknown): WalletGrantPermissionsResponse;
|
|
57
|
+
export declare function updateRequestSigner(request: SmartSessionGrantPermissionsRequest, cosignerKey: {
|
|
58
|
+
type: KeyType;
|
|
59
|
+
publicKey: `0x${string}`;
|
|
60
|
+
}): void;
|
|
61
|
+
export declare function assertAddPermissionResponse(response: unknown): asserts response is AddPermissionResponse;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Operation, ParamOperator } from '../utils/TypeUtils.js';
|
|
3
|
+
export declare const ERROR_MESSAGES: {
|
|
4
|
+
UNSUPPORTED_NAMESPACE: string;
|
|
5
|
+
NO_RESPONSE_RECEIVED: string;
|
|
6
|
+
INVALID_REQUEST: string;
|
|
7
|
+
INVALID_CHAIN_ID_FORMAT: string;
|
|
8
|
+
INVALID_CHAIN_ID_DATA: string;
|
|
9
|
+
INVALID_ADDRESS: string;
|
|
10
|
+
INVALID_EXPIRY: string;
|
|
11
|
+
INVALID_KEYS_SIGNER: string;
|
|
12
|
+
UNSUPPORTED_SIGNER_TYPE: string;
|
|
13
|
+
UNSUPPORTED_KEY_TYPE: string;
|
|
14
|
+
INVALID_PUBLIC_KEY_FORMAT: string;
|
|
15
|
+
INVALID_PERMISSIONS: string;
|
|
16
|
+
INVALID_PERMISSIONS_TYPE: string;
|
|
17
|
+
INVALID_PERMISSIONS_TYPE_LITERALS: string;
|
|
18
|
+
INVALID_POLICIES: string;
|
|
19
|
+
INVALID_POLICIES_TYPE: string;
|
|
20
|
+
INVALID_GRANT_PERMISSIONS_RESPONSE: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const SmartSessionGrantPermissionsRequestSchema: z.ZodObject<{
|
|
23
|
+
chainId: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
24
|
+
address: z.ZodOptional<z.ZodString>;
|
|
25
|
+
expiry: z.ZodEffects<z.ZodNumber, number, number>;
|
|
26
|
+
signer: z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"keys">;
|
|
28
|
+
data: z.ZodObject<{
|
|
29
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
30
|
+
type: z.ZodEnum<["secp256r1", "secp256k1"]>;
|
|
31
|
+
publicKey: z.ZodEffects<z.ZodString, string, string>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
type: "secp256r1" | "secp256k1";
|
|
34
|
+
publicKey: string;
|
|
35
|
+
}, {
|
|
36
|
+
type: "secp256r1" | "secp256k1";
|
|
37
|
+
publicKey: string;
|
|
38
|
+
}>, "many">;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
keys: {
|
|
41
|
+
type: "secp256r1" | "secp256k1";
|
|
42
|
+
publicKey: string;
|
|
43
|
+
}[];
|
|
44
|
+
}, {
|
|
45
|
+
keys: {
|
|
46
|
+
type: "secp256r1" | "secp256k1";
|
|
47
|
+
publicKey: string;
|
|
48
|
+
}[];
|
|
49
|
+
}>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
type: "keys";
|
|
52
|
+
data: {
|
|
53
|
+
keys: {
|
|
54
|
+
type: "secp256r1" | "secp256k1";
|
|
55
|
+
publicKey: string;
|
|
56
|
+
}[];
|
|
57
|
+
};
|
|
58
|
+
}, {
|
|
59
|
+
type: "keys";
|
|
60
|
+
data: {
|
|
61
|
+
keys: {
|
|
62
|
+
type: "secp256r1" | "secp256k1";
|
|
63
|
+
publicKey: string;
|
|
64
|
+
}[];
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
68
|
+
type: z.ZodEffects<z.ZodLiteral<"contract-call">, "contract-call", "contract-call">;
|
|
69
|
+
data: z.ZodObject<{
|
|
70
|
+
address: z.ZodString;
|
|
71
|
+
abi: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
72
|
+
functions: z.ZodArray<z.ZodObject<{
|
|
73
|
+
functionName: z.ZodString;
|
|
74
|
+
args: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
75
|
+
operator: z.ZodNativeEnum<typeof ParamOperator>;
|
|
76
|
+
value: z.ZodString;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
value: string;
|
|
79
|
+
operator: ParamOperator;
|
|
80
|
+
}, {
|
|
81
|
+
value: string;
|
|
82
|
+
operator: ParamOperator;
|
|
83
|
+
}>, "many">>;
|
|
84
|
+
valueLimit: z.ZodOptional<z.ZodString>;
|
|
85
|
+
operation: z.ZodOptional<z.ZodNativeEnum<typeof Operation>>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
functionName: string;
|
|
88
|
+
args?: {
|
|
89
|
+
value: string;
|
|
90
|
+
operator: ParamOperator;
|
|
91
|
+
}[] | undefined;
|
|
92
|
+
valueLimit?: string | undefined;
|
|
93
|
+
operation?: Operation | undefined;
|
|
94
|
+
}, {
|
|
95
|
+
functionName: string;
|
|
96
|
+
args?: {
|
|
97
|
+
value: string;
|
|
98
|
+
operator: ParamOperator;
|
|
99
|
+
}[] | undefined;
|
|
100
|
+
valueLimit?: string | undefined;
|
|
101
|
+
operation?: Operation | undefined;
|
|
102
|
+
}>, "many">;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
address: string;
|
|
105
|
+
abi: Record<string, unknown>[];
|
|
106
|
+
functions: {
|
|
107
|
+
functionName: string;
|
|
108
|
+
args?: {
|
|
109
|
+
value: string;
|
|
110
|
+
operator: ParamOperator;
|
|
111
|
+
}[] | undefined;
|
|
112
|
+
valueLimit?: string | undefined;
|
|
113
|
+
operation?: Operation | undefined;
|
|
114
|
+
}[];
|
|
115
|
+
}, {
|
|
116
|
+
address: string;
|
|
117
|
+
abi: Record<string, unknown>[];
|
|
118
|
+
functions: {
|
|
119
|
+
functionName: string;
|
|
120
|
+
args?: {
|
|
121
|
+
value: string;
|
|
122
|
+
operator: ParamOperator;
|
|
123
|
+
}[] | undefined;
|
|
124
|
+
valueLimit?: string | undefined;
|
|
125
|
+
operation?: Operation | undefined;
|
|
126
|
+
}[];
|
|
127
|
+
}>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
type: "contract-call";
|
|
130
|
+
data: {
|
|
131
|
+
address: string;
|
|
132
|
+
abi: Record<string, unknown>[];
|
|
133
|
+
functions: {
|
|
134
|
+
functionName: string;
|
|
135
|
+
args?: {
|
|
136
|
+
value: string;
|
|
137
|
+
operator: ParamOperator;
|
|
138
|
+
}[] | undefined;
|
|
139
|
+
valueLimit?: string | undefined;
|
|
140
|
+
operation?: Operation | undefined;
|
|
141
|
+
}[];
|
|
142
|
+
};
|
|
143
|
+
}, {
|
|
144
|
+
type: "contract-call";
|
|
145
|
+
data: {
|
|
146
|
+
address: string;
|
|
147
|
+
abi: Record<string, unknown>[];
|
|
148
|
+
functions: {
|
|
149
|
+
functionName: string;
|
|
150
|
+
args?: {
|
|
151
|
+
value: string;
|
|
152
|
+
operator: ParamOperator;
|
|
153
|
+
}[] | undefined;
|
|
154
|
+
valueLimit?: string | undefined;
|
|
155
|
+
operation?: Operation | undefined;
|
|
156
|
+
}[];
|
|
157
|
+
};
|
|
158
|
+
}>, "atleastone">;
|
|
159
|
+
policies: z.ZodArray<z.ZodObject<{
|
|
160
|
+
type: z.ZodString;
|
|
161
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
162
|
+
}, "strip", z.ZodTypeAny, {
|
|
163
|
+
type: string;
|
|
164
|
+
data: Record<string, unknown>;
|
|
165
|
+
}, {
|
|
166
|
+
type: string;
|
|
167
|
+
data: Record<string, unknown>;
|
|
168
|
+
}>, "many">;
|
|
169
|
+
}, "strict", z.ZodTypeAny, {
|
|
170
|
+
chainId: string;
|
|
171
|
+
expiry: number;
|
|
172
|
+
signer: {
|
|
173
|
+
type: "keys";
|
|
174
|
+
data: {
|
|
175
|
+
keys: {
|
|
176
|
+
type: "secp256r1" | "secp256k1";
|
|
177
|
+
publicKey: string;
|
|
178
|
+
}[];
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
permissions: [{
|
|
182
|
+
type: "contract-call";
|
|
183
|
+
data: {
|
|
184
|
+
address: string;
|
|
185
|
+
abi: Record<string, unknown>[];
|
|
186
|
+
functions: {
|
|
187
|
+
functionName: string;
|
|
188
|
+
args?: {
|
|
189
|
+
value: string;
|
|
190
|
+
operator: ParamOperator;
|
|
191
|
+
}[] | undefined;
|
|
192
|
+
valueLimit?: string | undefined;
|
|
193
|
+
operation?: Operation | undefined;
|
|
194
|
+
}[];
|
|
195
|
+
};
|
|
196
|
+
}, ...{
|
|
197
|
+
type: "contract-call";
|
|
198
|
+
data: {
|
|
199
|
+
address: string;
|
|
200
|
+
abi: Record<string, unknown>[];
|
|
201
|
+
functions: {
|
|
202
|
+
functionName: string;
|
|
203
|
+
args?: {
|
|
204
|
+
value: string;
|
|
205
|
+
operator: ParamOperator;
|
|
206
|
+
}[] | undefined;
|
|
207
|
+
valueLimit?: string | undefined;
|
|
208
|
+
operation?: Operation | undefined;
|
|
209
|
+
}[];
|
|
210
|
+
};
|
|
211
|
+
}[]];
|
|
212
|
+
policies: {
|
|
213
|
+
type: string;
|
|
214
|
+
data: Record<string, unknown>;
|
|
215
|
+
}[];
|
|
216
|
+
address?: string | undefined;
|
|
217
|
+
}, {
|
|
218
|
+
chainId: string;
|
|
219
|
+
expiry: number;
|
|
220
|
+
signer: {
|
|
221
|
+
type: "keys";
|
|
222
|
+
data: {
|
|
223
|
+
keys: {
|
|
224
|
+
type: "secp256r1" | "secp256k1";
|
|
225
|
+
publicKey: string;
|
|
226
|
+
}[];
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
permissions: [{
|
|
230
|
+
type: "contract-call";
|
|
231
|
+
data: {
|
|
232
|
+
address: string;
|
|
233
|
+
abi: Record<string, unknown>[];
|
|
234
|
+
functions: {
|
|
235
|
+
functionName: string;
|
|
236
|
+
args?: {
|
|
237
|
+
value: string;
|
|
238
|
+
operator: ParamOperator;
|
|
239
|
+
}[] | undefined;
|
|
240
|
+
valueLimit?: string | undefined;
|
|
241
|
+
operation?: Operation | undefined;
|
|
242
|
+
}[];
|
|
243
|
+
};
|
|
244
|
+
}, ...{
|
|
245
|
+
type: "contract-call";
|
|
246
|
+
data: {
|
|
247
|
+
address: string;
|
|
248
|
+
abi: Record<string, unknown>[];
|
|
249
|
+
functions: {
|
|
250
|
+
functionName: string;
|
|
251
|
+
args?: {
|
|
252
|
+
value: string;
|
|
253
|
+
operator: ParamOperator;
|
|
254
|
+
}[] | undefined;
|
|
255
|
+
valueLimit?: string | undefined;
|
|
256
|
+
operation?: Operation | undefined;
|
|
257
|
+
}[];
|
|
258
|
+
};
|
|
259
|
+
}[]];
|
|
260
|
+
policies: {
|
|
261
|
+
type: string;
|
|
262
|
+
data: Record<string, unknown>;
|
|
263
|
+
}[];
|
|
264
|
+
address?: string | undefined;
|
|
265
|
+
}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ActivatePermissionsRequest, AddPermissionRequest, AddPermissionResponse } from './TypeUtils.js';
|
|
2
|
+
export declare class CoSignerApiError extends Error {
|
|
3
|
+
status: number;
|
|
4
|
+
constructor(status: number, message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare function sendCoSignerRequest<TRequest, TResponse, TQueryParams extends Record<string, string>>({ url, request, queryParams, headers, transformRequest }: {
|
|
7
|
+
url: string;
|
|
8
|
+
request: TRequest;
|
|
9
|
+
queryParams?: TQueryParams;
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
transformRequest?: (data: TRequest) => unknown;
|
|
12
|
+
}): Promise<TResponse>;
|
|
13
|
+
export declare class CosignerService {
|
|
14
|
+
private baseUrl;
|
|
15
|
+
private projectId;
|
|
16
|
+
constructor(projectId: string);
|
|
17
|
+
addPermission(address: string, data: AddPermissionRequest): Promise<AddPermissionResponse>;
|
|
18
|
+
activatePermissions(address: string, updateData: ActivatePermissionsRequest): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type BaseCapability = {
|
|
2
|
+
supported: boolean;
|
|
3
|
+
};
|
|
4
|
+
export type AtomicBatchCapability = BaseCapability;
|
|
5
|
+
export type PaymasterServiceCapability = BaseCapability & {
|
|
6
|
+
url: string;
|
|
7
|
+
context: Record<string, unknown> | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type PermissionsCapability = BaseCapability & {
|
|
10
|
+
signerTypes: string[];
|
|
11
|
+
permissionTypes: string[];
|
|
12
|
+
policyTypes: string[];
|
|
13
|
+
};
|
|
14
|
+
export type ChainCapabilities = {
|
|
15
|
+
atomicBatch?: AtomicBatchCapability;
|
|
16
|
+
paymasterService?: PaymasterServiceCapability;
|
|
17
|
+
permissions?: PermissionsCapability;
|
|
18
|
+
};
|
|
19
|
+
export type WalletCapabilities = Record<`0x${string}`, ChainCapabilities>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export type KeyType = 'secp256r1' | 'secp256k1';
|
|
2
|
+
export type MultiKeySigner = {
|
|
3
|
+
type: 'keys';
|
|
4
|
+
data: {
|
|
5
|
+
keys: {
|
|
6
|
+
type: KeyType;
|
|
7
|
+
publicKey: `0x${string}`;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type Signer = MultiKeySigner;
|
|
12
|
+
export type SmartSessionGrantPermissionsRequest = {
|
|
13
|
+
chainId: `0x${string}`;
|
|
14
|
+
address?: `0x${string}`;
|
|
15
|
+
expiry: number;
|
|
16
|
+
signer: Signer;
|
|
17
|
+
permissions: Permission[];
|
|
18
|
+
policies: {
|
|
19
|
+
type: string;
|
|
20
|
+
data: Record<string, unknown>;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
export type WalletGrantPermissionsResponse = SmartSessionGrantPermissionsRequest & {
|
|
24
|
+
context: `0x${string}`;
|
|
25
|
+
accountMeta?: {
|
|
26
|
+
factory: `0x${string}`;
|
|
27
|
+
factoryData: `0x${string}`;
|
|
28
|
+
};
|
|
29
|
+
signerMeta?: {
|
|
30
|
+
userOpBuilder?: `0x${string}`;
|
|
31
|
+
delegationManager?: `0x${string}`;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export type SmartSessionGrantPermissionsResponse = {
|
|
35
|
+
chainId: `0x${string}`;
|
|
36
|
+
address: `0x${string}`;
|
|
37
|
+
expiry: number;
|
|
38
|
+
permissions: Permission[];
|
|
39
|
+
context: string;
|
|
40
|
+
};
|
|
41
|
+
export declare enum ParamOperator {
|
|
42
|
+
EQUAL = "EQUAL",
|
|
43
|
+
GREATER_THAN = "GREATER_THAN",
|
|
44
|
+
LESS_THAN = "LESS_THAN"
|
|
45
|
+
}
|
|
46
|
+
export declare enum Operation {
|
|
47
|
+
Call = "Call",
|
|
48
|
+
DelegateCall = "DelegateCall"
|
|
49
|
+
}
|
|
50
|
+
export type ArgumentCondition = {
|
|
51
|
+
operator: ParamOperator;
|
|
52
|
+
value: `0x${string}`;
|
|
53
|
+
};
|
|
54
|
+
export type FunctionPermission = {
|
|
55
|
+
functionName: string;
|
|
56
|
+
args?: ArgumentCondition[];
|
|
57
|
+
valueLimit?: `0x${string}`;
|
|
58
|
+
operation?: Operation;
|
|
59
|
+
};
|
|
60
|
+
export type ContractCallPermission = {
|
|
61
|
+
type: 'contract-call';
|
|
62
|
+
data: {
|
|
63
|
+
address: `0x${string}`;
|
|
64
|
+
abi: Record<string, unknown>[];
|
|
65
|
+
functions: FunctionPermission[];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export type Permission = ContractCallPermission;
|
|
69
|
+
export type AddPermissionRequest = SmartSessionGrantPermissionsRequest;
|
|
70
|
+
export type AddPermissionResponse = {
|
|
71
|
+
pci: string;
|
|
72
|
+
key: {
|
|
73
|
+
type: KeyType;
|
|
74
|
+
publicKey: `0x${string}`;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export type ActivatePermissionsRequest = {
|
|
78
|
+
pci: string;
|
|
79
|
+
context: `0x${string}`;
|
|
80
|
+
} & AddPermissionRequest;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reown/appkit-experimental",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/esm/exports/index.js",
|
|
6
|
+
"types": "./dist/types/exports/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"!tsconfig.tsbuildinfo"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/types/exports/index.d.ts",
|
|
14
|
+
"import": "./dist/esm/exports/index.js",
|
|
15
|
+
"default": "./dist/esm/exports/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./smart-session": {
|
|
18
|
+
"types": "./dist/types/exports/smart-session/index.d.ts",
|
|
19
|
+
"import": "./dist/esm/exports/smart-session/index.js",
|
|
20
|
+
"default": "./dist/esm/exports/smart-session/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"typesVersions": {
|
|
24
|
+
"*": {
|
|
25
|
+
"smart-session": [
|
|
26
|
+
"./dist/types/exports/smart-session/index.d.ts"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"axios": "1.7.2",
|
|
32
|
+
"zod": "3.22.4",
|
|
33
|
+
"@reown/appkit": "1.1.0",
|
|
34
|
+
"@reown/appkit-core": "1.1.0",
|
|
35
|
+
"@reown/appkit-common": "1.1.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/axios-mock-adapter": "1.10.0",
|
|
39
|
+
"@vitest/coverage-v8": "2.0.5",
|
|
40
|
+
"axios-mock-adapter": "2.0.0",
|
|
41
|
+
"vitest": "2.0.5"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"web3",
|
|
45
|
+
"crypto",
|
|
46
|
+
"ethereum",
|
|
47
|
+
"appkit",
|
|
48
|
+
"reown",
|
|
49
|
+
"lit",
|
|
50
|
+
"experimental"
|
|
51
|
+
],
|
|
52
|
+
"author": "Reown <support@reown.com> (https://reown.com)",
|
|
53
|
+
"license": "Apache-2.0",
|
|
54
|
+
"homepage": "https://github.com/reown-com/appkit",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/reown-com/appkit.git"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/reown-com/appkit/issues"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build:clean": "rm -rf dist",
|
|
64
|
+
"build": "tsc --build",
|
|
65
|
+
"watch": "tsc --watch",
|
|
66
|
+
"typecheck": "tsc --noEmit",
|
|
67
|
+
"test": "vitest run --dir tests --coverage.enabled=true --coverage.reporter=json --coverage.reporter=json-summary --coverage.reportOnFailure=true",
|
|
68
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#### 📚 [Documentation](https://docs.reown.com/2.0/appkit/about)
|
|
2
|
+
|
|
3
|
+
#### 🔗 [Website](https://reown.com/appkit)
|
|
4
|
+
|
|
5
|
+
# AppKit Experimental (@reown/appkit-experimental)
|
|
6
|
+
|
|
7
|
+
The @reown/appkit-experimental package provides a set of cutting-edge, experimental features for Web3 developers. This package serves as a testing ground for innovative concepts and implementations that are not yet widely adopted or standardized in the blockchain ecosystem.
|
|
8
|
+
|
|
9
|
+
## Key Characteristics
|
|
10
|
+
|
|
11
|
+
- **Experimental Nature**: Features in this package are considered experimental and may undergo significant changes.
|
|
12
|
+
- **EIP Implementation**: Includes implementations of non-finalized Ethereum Improvement Proposals (EIPs).
|
|
13
|
+
- **Ecosystem Exploration**: Offers functionalities that are not yet widely adopted in the broader Web3 ecosystem.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @reown/appkit-experimental
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Smart Session
|
|
22
|
+
|
|
23
|
+
The `@reown/appkit-experimental/smart-session` allows developers to easily integrate session-based permission handling within their dApps. Using the `grantPermissions` method, dApps can send permission requests to connected wallets.
|