@metamask/smart-accounts-kit 1.4.0 → 1.5.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/CHANGELOG.md +12 -1
- package/dist/actions/index.cjs +8 -4
- package/dist/actions/index.cjs.map +1 -1
- package/dist/actions/index.d.cts +4 -2
- package/dist/actions/index.d.ts +4 -2
- package/dist/actions/index.mjs +7 -3
- package/dist/{caveats-CeHBbmt_.d.cts → caveats-CaSt_VHs.d.cts} +1 -1
- package/dist/{caveats-BhjGBVHX.d.ts → caveats-DQ6HoAHe.d.ts} +1 -1
- package/dist/{chunk-XZ7UMCG3.cjs → chunk-7FYDQNJ3.cjs} +12 -12
- package/dist/{chunk-XZ7UMCG3.cjs.map → chunk-7FYDQNJ3.cjs.map} +1 -1
- package/dist/{chunk-R2WT54GZ.mjs → chunk-BGOSYTKV.mjs} +179 -57
- package/dist/chunk-BGOSYTKV.mjs.map +1 -0
- package/dist/{chunk-RR2AMG4A.cjs → chunk-DN4O5VOP.cjs} +102 -102
- package/dist/{chunk-RR2AMG4A.cjs.map → chunk-DN4O5VOP.cjs.map} +1 -1
- package/dist/{chunk-SO5JAXGD.cjs → chunk-FH6HZCHI.cjs} +11 -11
- package/dist/{chunk-SO5JAXGD.cjs.map → chunk-FH6HZCHI.cjs.map} +1 -1
- package/dist/{chunk-TMO23YRP.cjs → chunk-IBZSNB7D.cjs} +64 -20
- package/dist/chunk-IBZSNB7D.cjs.map +1 -0
- package/dist/{chunk-EEIIVBNV.mjs → chunk-MV2KHN75.mjs} +64 -20
- package/dist/{chunk-EEIIVBNV.mjs.map → chunk-MV2KHN75.mjs.map} +1 -1
- package/dist/{chunk-DVJX76J3.mjs → chunk-N66VAWMO.mjs} +2 -2
- package/dist/{chunk-MVBU3LRV.cjs → chunk-SCS3CFRE.cjs} +10 -10
- package/dist/{chunk-MVBU3LRV.cjs.map → chunk-SCS3CFRE.cjs.map} +1 -1
- package/dist/{chunk-HQHXGWNJ.mjs → chunk-TBHT26BV.mjs} +4 -4
- package/dist/{chunk-ZGBFPD4O.mjs → chunk-W7O2UQL5.mjs} +2 -2
- package/dist/{chunk-6CEOFJY5.cjs → chunk-XEOE25DE.cjs} +229 -107
- package/dist/chunk-XEOE25DE.cjs.map +1 -0
- package/dist/{chunk-FG2CQGSE.mjs → chunk-YXHUT56Z.mjs} +3 -3
- package/dist/contracts/index.cjs +5 -5
- package/dist/contracts/index.d.cts +3 -2
- package/dist/contracts/index.d.ts +3 -2
- package/dist/contracts/index.mjs +4 -4
- package/dist/delegation-BKkEyxZY.d.cts +64 -0
- package/dist/delegation-DbPGWKfP.d.ts +64 -0
- package/dist/experimental/index.cjs +7 -7
- package/dist/experimental/index.mjs +1 -1
- package/dist/{index-DRKgDSZW.d.ts → index-DXdlz7t4.d.ts} +2 -1
- package/dist/{index-BToRQKyJ.d.cts → index-DfDAuvr5.d.cts} +37 -4
- package/dist/{index-Cg-JakqA.d.ts → index-G78z6nwi.d.ts} +37 -4
- package/dist/{index-DzL9ccjU.d.cts → index-yU3olCJV.d.cts} +2 -1
- package/dist/index.cjs +19 -19
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.mjs +6 -6
- package/dist/{delegation-CR99q1-n.d.ts → resolveCaveats-DiqGB-T5.d.cts} +3 -52
- package/dist/{delegation-DoVULGYE.d.cts → resolveCaveats-s2snaFEo.d.ts} +3 -52
- package/dist/utils/index.cjs +4 -4
- package/dist/utils/index.d.cts +3 -2
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.mjs +3 -3
- package/package.json +2 -2
- package/dist/chunk-6CEOFJY5.cjs.map +0 -1
- package/dist/chunk-R2WT54GZ.mjs.map +0 -1
- package/dist/chunk-TMO23YRP.cjs.map +0 -1
- /package/dist/{chunk-DVJX76J3.mjs.map → chunk-N66VAWMO.mjs.map} +0 -0
- /package/dist/{chunk-HQHXGWNJ.mjs.map → chunk-TBHT26BV.mjs.map} +0 -0
- /package/dist/{chunk-ZGBFPD4O.mjs.map → chunk-W7O2UQL5.mjs.map} +0 -0
- /package/dist/{chunk-FG2CQGSE.mjs.map → chunk-YXHUT56Z.mjs.map} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk7FYDQNJ3cjs = require('./chunk-7FYDQNJ3.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -21,11 +21,15 @@ var _chunkMOHCTPYQcjs = require('./chunk-MOHCTPYQ.cjs');
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
var _chunkIBZSNB7Dcjs = require('./chunk-IBZSNB7D.cjs');
|
|
25
29
|
|
|
26
30
|
// src/actions/index.ts
|
|
27
31
|
var actions_exports = {};
|
|
28
|
-
|
|
32
|
+
_chunkIBZSNB7Dcjs.__export.call(void 0, actions_exports, {
|
|
29
33
|
caveatEnforcerActions: () => caveatEnforcerActions,
|
|
30
34
|
erc7710BundlerActions: () => erc7710BundlerActions,
|
|
31
35
|
erc7710WalletActions: () => erc7710WalletActions,
|
|
@@ -38,6 +42,8 @@ _chunkTMO23YRPcjs.__export.call(void 0, actions_exports, {
|
|
|
38
42
|
getNativeTokenStreamingEnforcerAvailableAmount: () => getNativeTokenStreamingEnforcerAvailableAmount,
|
|
39
43
|
getSupportedExecutionPermissions: () => erc7715GetSupportedExecutionPermissionsAction,
|
|
40
44
|
isValid7702Implementation: () => isValid7702Implementation,
|
|
45
|
+
redelegatePermissionContextAction: () => redelegatePermissionContextAction,
|
|
46
|
+
redelegatePermissionContextOpenAction: () => redelegatePermissionContextOpenAction,
|
|
41
47
|
requestExecutionPermissions: () => erc7715RequestExecutionPermissionsAction,
|
|
42
48
|
signDelegation: () => signDelegation,
|
|
43
49
|
signDelegationActions: () => signDelegationActions,
|
|
@@ -49,7 +55,7 @@ _chunkTMO23YRPcjs.__export.call(void 0, actions_exports, {
|
|
|
49
55
|
var _delegationabis = require('@metamask/delegation-abis');
|
|
50
56
|
var _viem = require('viem');
|
|
51
57
|
async function sendTransactionWithDelegationAction(client, args) {
|
|
52
|
-
|
|
58
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0, "sendTransactionWithDelegationAction", {
|
|
53
59
|
chainId: _nullishCoalesce(_optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]), () => ( null))
|
|
54
60
|
});
|
|
55
61
|
if (!args.to) {
|
|
@@ -78,7 +84,7 @@ async function sendTransactionWithDelegationAction(client, args) {
|
|
|
78
84
|
abi: _delegationabis.DelegationManager,
|
|
79
85
|
functionName: "redeemDelegations",
|
|
80
86
|
args: [
|
|
81
|
-
[
|
|
87
|
+
[_chunkIBZSNB7Dcjs.encodeDelegations.call(void 0, args.permissionContext)],
|
|
82
88
|
["0x0000000000000000000000000000000000000000000000000000000000000000" /* SingleDefault */],
|
|
83
89
|
_chunkMOHCTPYQcjs.encodeExecutionCalldatas.call(void 0, [executions])
|
|
84
90
|
]
|
|
@@ -97,7 +103,7 @@ async function sendTransactionWithDelegationAction(client, args) {
|
|
|
97
103
|
return hash;
|
|
98
104
|
}
|
|
99
105
|
async function sendUserOperationWithDelegationAction(client, parameters) {
|
|
100
|
-
|
|
106
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0, "sendUserOperationWithDelegationAction", {
|
|
101
107
|
chainId: _nullishCoalesce(_optionalChain([client, 'access', _5 => _5.chain, 'optionalAccess', _6 => _6.id]), () => ( null)),
|
|
102
108
|
callCount: parameters.calls.length,
|
|
103
109
|
hasDependencies: parameters.dependencies !== void 0
|
|
@@ -152,7 +158,7 @@ async function sendUserOperationWithDelegationAction(client, parameters) {
|
|
|
152
158
|
}
|
|
153
159
|
return {
|
|
154
160
|
...call,
|
|
155
|
-
permissionContext:
|
|
161
|
+
permissionContext: _chunkIBZSNB7Dcjs.encodeDelegations.call(void 0, permissionContext)
|
|
156
162
|
};
|
|
157
163
|
});
|
|
158
164
|
return client.sendUserOperation(
|
|
@@ -168,7 +174,7 @@ function permissionRequestToRpc(parameters) {
|
|
|
168
174
|
parameters.permission.type
|
|
169
175
|
);
|
|
170
176
|
const rules = [];
|
|
171
|
-
if (
|
|
177
|
+
if (_chunkIBZSNB7Dcjs.isDefined.call(void 0, expiry)) {
|
|
172
178
|
rules.push({
|
|
173
179
|
type: "expiry",
|
|
174
180
|
data: {
|
|
@@ -176,7 +182,7 @@ function permissionRequestToRpc(parameters) {
|
|
|
176
182
|
}
|
|
177
183
|
});
|
|
178
184
|
}
|
|
179
|
-
if (
|
|
185
|
+
if (_chunkIBZSNB7Dcjs.isDefined.call(void 0, redeemer)) {
|
|
180
186
|
if (redeemer.length === 0) {
|
|
181
187
|
throw new Error(
|
|
182
188
|
"Invalid redeemers: must specify at least one redeemer address"
|
|
@@ -194,7 +200,7 @@ function permissionRequestToRpc(parameters) {
|
|
|
194
200
|
data: { addresses }
|
|
195
201
|
});
|
|
196
202
|
}
|
|
197
|
-
if (
|
|
203
|
+
if (_chunkIBZSNB7Dcjs.isDefined.call(void 0, payee)) {
|
|
198
204
|
if (payee.length === 0) {
|
|
199
205
|
throw new Error(
|
|
200
206
|
"Invalid payees: must specify at least one payee address"
|
|
@@ -269,13 +275,13 @@ function nativeTokenStreamPermissionToRpc(permission) {
|
|
|
269
275
|
isAdjustmentAllowed
|
|
270
276
|
} = permission;
|
|
271
277
|
const optionalFields = {
|
|
272
|
-
...
|
|
273
|
-
initialAmount:
|
|
278
|
+
..._chunkIBZSNB7Dcjs.isDefined.call(void 0, initialAmount) && {
|
|
279
|
+
initialAmount: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, initialAmount, "initialAmount")
|
|
274
280
|
},
|
|
275
|
-
...
|
|
276
|
-
maxAmount:
|
|
281
|
+
..._chunkIBZSNB7Dcjs.isDefined.call(void 0, maxAmount) && {
|
|
282
|
+
maxAmount: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, maxAmount, "maxAmount")
|
|
277
283
|
},
|
|
278
|
-
...
|
|
284
|
+
..._chunkIBZSNB7Dcjs.isDefined.call(void 0, startTime) && {
|
|
279
285
|
startTime: Number(startTime)
|
|
280
286
|
},
|
|
281
287
|
...justification ? { justification } : {}
|
|
@@ -283,7 +289,7 @@ function nativeTokenStreamPermissionToRpc(permission) {
|
|
|
283
289
|
return {
|
|
284
290
|
type: "native-token-stream",
|
|
285
291
|
data: {
|
|
286
|
-
amountPerSecond:
|
|
292
|
+
amountPerSecond: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, amountPerSecond, "amountPerSecond"),
|
|
287
293
|
...optionalFields
|
|
288
294
|
},
|
|
289
295
|
isAdjustmentAllowed
|
|
@@ -302,13 +308,13 @@ function erc20TokenStreamPermissionToRpc(permission) {
|
|
|
302
308
|
isAdjustmentAllowed
|
|
303
309
|
} = permission;
|
|
304
310
|
const optionalFields = {
|
|
305
|
-
...
|
|
306
|
-
initialAmount:
|
|
311
|
+
..._chunkIBZSNB7Dcjs.isDefined.call(void 0, initialAmount) && {
|
|
312
|
+
initialAmount: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, initialAmount, "initialAmount")
|
|
307
313
|
},
|
|
308
|
-
...
|
|
309
|
-
maxAmount:
|
|
314
|
+
..._chunkIBZSNB7Dcjs.isDefined.call(void 0, maxAmount) && {
|
|
315
|
+
maxAmount: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, maxAmount, "maxAmount")
|
|
310
316
|
},
|
|
311
|
-
...
|
|
317
|
+
..._chunkIBZSNB7Dcjs.isDefined.call(void 0, startTime) && {
|
|
312
318
|
startTime: Number(startTime)
|
|
313
319
|
},
|
|
314
320
|
...justification ? { justification } : {}
|
|
@@ -316,8 +322,8 @@ function erc20TokenStreamPermissionToRpc(permission) {
|
|
|
316
322
|
return {
|
|
317
323
|
type: "erc20-token-stream",
|
|
318
324
|
data: {
|
|
319
|
-
tokenAddress:
|
|
320
|
-
amountPerSecond:
|
|
325
|
+
tokenAddress: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, tokenAddress, "tokenAddress"),
|
|
326
|
+
amountPerSecond: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, amountPerSecond, "amountPerSecond"),
|
|
321
327
|
...optionalFields
|
|
322
328
|
},
|
|
323
329
|
isAdjustmentAllowed
|
|
@@ -329,7 +335,7 @@ function nativeTokenPeriodicPermissionToRpc(permission) {
|
|
|
329
335
|
isAdjustmentAllowed
|
|
330
336
|
} = permission;
|
|
331
337
|
const optionalFields = {
|
|
332
|
-
...
|
|
338
|
+
..._chunkIBZSNB7Dcjs.isDefined.call(void 0, startTime) && {
|
|
333
339
|
startTime: Number(startTime)
|
|
334
340
|
},
|
|
335
341
|
...justification ? { justification } : {}
|
|
@@ -337,7 +343,7 @@ function nativeTokenPeriodicPermissionToRpc(permission) {
|
|
|
337
343
|
return {
|
|
338
344
|
type: "native-token-periodic",
|
|
339
345
|
data: {
|
|
340
|
-
periodAmount:
|
|
346
|
+
periodAmount: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, periodAmount, "periodAmount"),
|
|
341
347
|
periodDuration: Number(periodDuration),
|
|
342
348
|
...optionalFields
|
|
343
349
|
},
|
|
@@ -356,7 +362,7 @@ function erc20TokenPeriodicPermissionToRpc(permission) {
|
|
|
356
362
|
isAdjustmentAllowed
|
|
357
363
|
} = permission;
|
|
358
364
|
const optionalFields = {
|
|
359
|
-
...
|
|
365
|
+
..._chunkIBZSNB7Dcjs.isDefined.call(void 0, startTime) && {
|
|
360
366
|
startTime: Number(startTime)
|
|
361
367
|
},
|
|
362
368
|
...justification ? { justification } : {}
|
|
@@ -364,8 +370,8 @@ function erc20TokenPeriodicPermissionToRpc(permission) {
|
|
|
364
370
|
return {
|
|
365
371
|
type: "erc20-token-periodic",
|
|
366
372
|
data: {
|
|
367
|
-
tokenAddress:
|
|
368
|
-
periodAmount:
|
|
373
|
+
tokenAddress: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, tokenAddress, "tokenAddress"),
|
|
374
|
+
periodAmount: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, periodAmount, "periodAmount"),
|
|
369
375
|
periodDuration: Number(periodDuration),
|
|
370
376
|
...optionalFields
|
|
371
377
|
},
|
|
@@ -378,7 +384,7 @@ function nativeTokenAllowancePermissionToRpc(permission) {
|
|
|
378
384
|
isAdjustmentAllowed
|
|
379
385
|
} = permission;
|
|
380
386
|
const optionalFields = {
|
|
381
|
-
...
|
|
387
|
+
..._chunkIBZSNB7Dcjs.isDefined.call(void 0, startTime) && {
|
|
382
388
|
startTime: Number(startTime)
|
|
383
389
|
},
|
|
384
390
|
...justification ? { justification } : {}
|
|
@@ -386,7 +392,7 @@ function nativeTokenAllowancePermissionToRpc(permission) {
|
|
|
386
392
|
return {
|
|
387
393
|
type: "native-token-allowance",
|
|
388
394
|
data: {
|
|
389
|
-
allowanceAmount:
|
|
395
|
+
allowanceAmount: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, allowanceAmount, "allowanceAmount"),
|
|
390
396
|
...optionalFields
|
|
391
397
|
},
|
|
392
398
|
isAdjustmentAllowed
|
|
@@ -398,7 +404,7 @@ function erc20TokenAllowancePermissionToRpc(permission) {
|
|
|
398
404
|
isAdjustmentAllowed
|
|
399
405
|
} = permission;
|
|
400
406
|
const optionalFields = {
|
|
401
|
-
...
|
|
407
|
+
..._chunkIBZSNB7Dcjs.isDefined.call(void 0, startTime) && {
|
|
402
408
|
startTime: Number(startTime)
|
|
403
409
|
},
|
|
404
410
|
...justification ? { justification } : {}
|
|
@@ -406,8 +412,8 @@ function erc20TokenAllowancePermissionToRpc(permission) {
|
|
|
406
412
|
return {
|
|
407
413
|
type: "erc20-token-allowance",
|
|
408
414
|
data: {
|
|
409
|
-
tokenAddress:
|
|
410
|
-
allowanceAmount:
|
|
415
|
+
tokenAddress: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, tokenAddress, "tokenAddress"),
|
|
416
|
+
allowanceAmount: _chunkIBZSNB7Dcjs.toHexOrThrow.call(void 0, allowanceAmount, "allowanceAmount"),
|
|
411
417
|
...optionalFields
|
|
412
418
|
},
|
|
413
419
|
isAdjustmentAllowed
|
|
@@ -498,7 +504,7 @@ function rpcSupportedPermissionsToDeveloper(result) {
|
|
|
498
504
|
|
|
499
505
|
// src/actions/erc7715GetGrantedExecutionPermissionsAction.ts
|
|
500
506
|
async function erc7715GetGrantedExecutionPermissionsAction(client) {
|
|
501
|
-
|
|
507
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
502
508
|
"erc7715GetGrantedExecutionPermissionsAction",
|
|
503
509
|
{
|
|
504
510
|
chainId: _nullishCoalesce(_optionalChain([client, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.id]), () => ( null))
|
|
@@ -519,7 +525,7 @@ async function erc7715GetGrantedExecutionPermissionsAction(client) {
|
|
|
519
525
|
|
|
520
526
|
// src/actions/erc7715GetSupportedExecutionPermissionsAction.ts
|
|
521
527
|
async function erc7715GetSupportedExecutionPermissionsAction(client) {
|
|
522
|
-
|
|
528
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
523
529
|
"erc7715GetSupportedExecutionPermissionsAction",
|
|
524
530
|
{
|
|
525
531
|
chainId: _nullishCoalesce(_optionalChain([client, 'access', _13 => _13.chain, 'optionalAccess', _14 => _14.id]), () => ( null))
|
|
@@ -540,7 +546,7 @@ async function erc7715GetSupportedExecutionPermissionsAction(client) {
|
|
|
540
546
|
|
|
541
547
|
// src/actions/erc7715RequestExecutionPermissionsAction.ts
|
|
542
548
|
async function erc7715RequestExecutionPermissionsAction(client, parameters) {
|
|
543
|
-
|
|
549
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
544
550
|
"erc7715RequestExecutionPermissionsAction",
|
|
545
551
|
{
|
|
546
552
|
chainId: _nullishCoalesce(_optionalChain([client, 'access', _15 => _15.chain, 'optionalAccess', _16 => _16.id]), () => ( null)),
|
|
@@ -561,6 +567,164 @@ async function erc7715RequestExecutionPermissionsAction(client, parameters) {
|
|
|
561
567
|
return permissionResponsesFromRpc(result);
|
|
562
568
|
}
|
|
563
569
|
|
|
570
|
+
// src/actions/redelegatePermissionContext.ts
|
|
571
|
+
|
|
572
|
+
var _accounts = require('viem/accounts');
|
|
573
|
+
|
|
574
|
+
// src/actions/signDelegation.ts
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
async function signDelegation(client, parameters) {
|
|
578
|
+
const {
|
|
579
|
+
account: accountParam = client.account,
|
|
580
|
+
delegation,
|
|
581
|
+
delegationManager,
|
|
582
|
+
chainId,
|
|
583
|
+
name = "DelegationManager",
|
|
584
|
+
version = "1",
|
|
585
|
+
allowInsecureUnrestrictedDelegation = false
|
|
586
|
+
} = parameters;
|
|
587
|
+
if (!accountParam) {
|
|
588
|
+
throw new (0, _viem.BaseError)("Account not found. Please provide an account.");
|
|
589
|
+
}
|
|
590
|
+
const account = _accounts.parseAccount.call(void 0, accountParam);
|
|
591
|
+
const typedData = _chunkIBZSNB7Dcjs.prepareSignDelegationTypedData.call(void 0, {
|
|
592
|
+
delegation,
|
|
593
|
+
delegationManager,
|
|
594
|
+
chainId,
|
|
595
|
+
name,
|
|
596
|
+
version,
|
|
597
|
+
allowInsecureUnrestrictedDelegation
|
|
598
|
+
});
|
|
599
|
+
return client.signTypedData({
|
|
600
|
+
account,
|
|
601
|
+
...typedData
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
function signDelegationActions() {
|
|
605
|
+
return (client) => ({
|
|
606
|
+
signDelegation: async (parameters) => signDelegation(client, {
|
|
607
|
+
chainId: _nullishCoalesce(parameters.chainId, () => ( (() => {
|
|
608
|
+
if (!_optionalChain([client, 'access', _17 => _17.chain, 'optionalAccess', _18 => _18.id])) {
|
|
609
|
+
throw new (0, _viem.BaseError)(
|
|
610
|
+
"Chain ID is required. Either provide it in parameters or configure the client with a chain."
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
return client.chain.id;
|
|
614
|
+
})())),
|
|
615
|
+
...parameters
|
|
616
|
+
})
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
// src/actions/redelegatePermissionContext.ts
|
|
621
|
+
async function signAndPrependRedelegation(client, options) {
|
|
622
|
+
const { account, environment, delegations, unsignedDelegation, chainId } = options;
|
|
623
|
+
const signature = await signDelegation(client, {
|
|
624
|
+
account,
|
|
625
|
+
delegation: unsignedDelegation,
|
|
626
|
+
delegationManager: environment.DelegationManager,
|
|
627
|
+
chainId,
|
|
628
|
+
// Redelegations always inherit from a parent delegation (enforced by
|
|
629
|
+
// `resolveRedelegationArgs`), so the parent's caveats provide the
|
|
630
|
+
// restriction even when the redelegation itself adds no extra caveats.
|
|
631
|
+
// This mirrors `resolveCaveats`, which also allows empty caveats in this
|
|
632
|
+
// case.
|
|
633
|
+
allowInsecureUnrestrictedDelegation: true
|
|
634
|
+
});
|
|
635
|
+
const signedDelegation = {
|
|
636
|
+
...unsignedDelegation,
|
|
637
|
+
signature
|
|
638
|
+
};
|
|
639
|
+
const newPermissionContext = _chunkIBZSNB7Dcjs.encodeDelegations.call(void 0, [
|
|
640
|
+
signedDelegation,
|
|
641
|
+
...delegations
|
|
642
|
+
]);
|
|
643
|
+
return {
|
|
644
|
+
delegation: signedDelegation,
|
|
645
|
+
permissionContext: newPermissionContext
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
function resolveRedelegationArgs(client, parameters) {
|
|
649
|
+
const { account: accountParam = client.account, permissionContext } = parameters;
|
|
650
|
+
if (!accountParam) {
|
|
651
|
+
throw new (0, _viem.BaseError)("Account not found. Please provide an account.");
|
|
652
|
+
}
|
|
653
|
+
const account = _accounts.parseAccount.call(void 0, accountParam);
|
|
654
|
+
const delegations = _chunkIBZSNB7Dcjs.decodeDelegations.call(void 0, permissionContext);
|
|
655
|
+
const parentDelegation = delegations[0];
|
|
656
|
+
if (!parentDelegation) {
|
|
657
|
+
throw new (0, _viem.BaseError)(
|
|
658
|
+
"Permission context must contain at least one delegation"
|
|
659
|
+
);
|
|
660
|
+
}
|
|
661
|
+
const isParentOpenDelegation = parentDelegation.delegate.toLowerCase() === _chunkIBZSNB7Dcjs.ANY_BENEFICIARY.toLowerCase();
|
|
662
|
+
const from = isParentOpenDelegation ? account.address : parentDelegation.delegate;
|
|
663
|
+
return { account, delegations, parentDelegation, from };
|
|
664
|
+
}
|
|
665
|
+
async function redelegatePermissionContextAction(client, parameters) {
|
|
666
|
+
const { environment, scope, caveats, salt, to } = parameters;
|
|
667
|
+
const chainId = resolveChainId(client, parameters.chainId);
|
|
668
|
+
const { account, delegations, parentDelegation, from } = resolveRedelegationArgs(client, parameters);
|
|
669
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0, "redelegatePermissionContext", {
|
|
670
|
+
chainId,
|
|
671
|
+
hasScope: scope !== void 0,
|
|
672
|
+
hasCaveats: caveats !== void 0
|
|
673
|
+
});
|
|
674
|
+
const unsignedDelegation = _chunkIBZSNB7Dcjs.createDelegation.call(void 0, {
|
|
675
|
+
environment,
|
|
676
|
+
from,
|
|
677
|
+
to,
|
|
678
|
+
scope,
|
|
679
|
+
caveats,
|
|
680
|
+
parentDelegation,
|
|
681
|
+
salt
|
|
682
|
+
});
|
|
683
|
+
return signAndPrependRedelegation(client, {
|
|
684
|
+
account,
|
|
685
|
+
environment,
|
|
686
|
+
delegations,
|
|
687
|
+
unsignedDelegation,
|
|
688
|
+
chainId
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
async function redelegatePermissionContextOpenAction(client, parameters) {
|
|
692
|
+
const { environment, scope, caveats, salt } = parameters;
|
|
693
|
+
const chainId = resolveChainId(client, parameters.chainId);
|
|
694
|
+
const { account, delegations, parentDelegation, from } = resolveRedelegationArgs(client, parameters);
|
|
695
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0, "redelegatePermissionContextOpen", {
|
|
696
|
+
chainId,
|
|
697
|
+
hasScope: scope !== void 0,
|
|
698
|
+
hasCaveats: caveats !== void 0
|
|
699
|
+
});
|
|
700
|
+
const unsignedDelegation = _chunkIBZSNB7Dcjs.createOpenDelegation.call(void 0, {
|
|
701
|
+
environment,
|
|
702
|
+
from,
|
|
703
|
+
scope,
|
|
704
|
+
caveats,
|
|
705
|
+
parentDelegation,
|
|
706
|
+
salt
|
|
707
|
+
});
|
|
708
|
+
return signAndPrependRedelegation(client, {
|
|
709
|
+
account,
|
|
710
|
+
environment,
|
|
711
|
+
delegations,
|
|
712
|
+
unsignedDelegation,
|
|
713
|
+
chainId
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
function resolveChainId(client, chainId) {
|
|
717
|
+
if (chainId !== void 0) {
|
|
718
|
+
return chainId;
|
|
719
|
+
}
|
|
720
|
+
if (!_optionalChain([client, 'access', _19 => _19.chain, 'optionalAccess', _20 => _20.id])) {
|
|
721
|
+
throw new (0, _viem.BaseError)(
|
|
722
|
+
"Chain ID is required. Either provide it in parameters or configure the client with a chain."
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
return client.chain.id;
|
|
726
|
+
}
|
|
727
|
+
|
|
564
728
|
// src/actions/getCaveatAvailableAmount.ts
|
|
565
729
|
function findMatchingCaveat({
|
|
566
730
|
delegation,
|
|
@@ -601,10 +765,10 @@ function getEnforcerAddress({
|
|
|
601
765
|
return enforcerAddress;
|
|
602
766
|
}
|
|
603
767
|
async function getErc20PeriodTransferEnforcerAvailableAmount(client, environment, params) {
|
|
604
|
-
|
|
768
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
605
769
|
"getErc20PeriodTransferEnforcerAvailableAmount",
|
|
606
770
|
{
|
|
607
|
-
chainId: _nullishCoalesce(_optionalChain([client, 'access',
|
|
771
|
+
chainId: _nullishCoalesce(_optionalChain([client, 'access', _21 => _21.chain, 'optionalAccess', _22 => _22.id]), () => ( null))
|
|
608
772
|
}
|
|
609
773
|
);
|
|
610
774
|
const enforcerName = "ERC20PeriodTransferEnforcer";
|
|
@@ -613,13 +777,13 @@ async function getErc20PeriodTransferEnforcerAvailableAmount(client, environment
|
|
|
613
777
|
enforcerName,
|
|
614
778
|
environment
|
|
615
779
|
});
|
|
616
|
-
const delegationHash =
|
|
780
|
+
const delegationHash = _chunkIBZSNB7Dcjs.hashDelegation.call(void 0, params.delegation);
|
|
617
781
|
const { terms } = findMatchingCaveat({
|
|
618
782
|
delegation: params.delegation,
|
|
619
783
|
enforcerAddress,
|
|
620
784
|
enforcerName
|
|
621
785
|
});
|
|
622
|
-
return
|
|
786
|
+
return _chunk7FYDQNJ3cjs.read_exports.getAvailableAmount({
|
|
623
787
|
client,
|
|
624
788
|
contractAddress: enforcerAddress,
|
|
625
789
|
delegationHash,
|
|
@@ -628,10 +792,10 @@ async function getErc20PeriodTransferEnforcerAvailableAmount(client, environment
|
|
|
628
792
|
});
|
|
629
793
|
}
|
|
630
794
|
async function getErc20StreamingEnforcerAvailableAmount(client, environment, params) {
|
|
631
|
-
|
|
795
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
632
796
|
"getErc20StreamingEnforcerAvailableAmount",
|
|
633
797
|
{
|
|
634
|
-
chainId: _nullishCoalesce(_optionalChain([client, 'access',
|
|
798
|
+
chainId: _nullishCoalesce(_optionalChain([client, 'access', _23 => _23.chain, 'optionalAccess', _24 => _24.id]), () => ( null))
|
|
635
799
|
}
|
|
636
800
|
);
|
|
637
801
|
const enforcerName = "ERC20StreamingEnforcer";
|
|
@@ -640,13 +804,13 @@ async function getErc20StreamingEnforcerAvailableAmount(client, environment, par
|
|
|
640
804
|
enforcerName,
|
|
641
805
|
environment
|
|
642
806
|
});
|
|
643
|
-
const delegationHash =
|
|
807
|
+
const delegationHash = _chunkIBZSNB7Dcjs.hashDelegation.call(void 0, params.delegation);
|
|
644
808
|
const { terms } = findMatchingCaveat({
|
|
645
809
|
delegation: params.delegation,
|
|
646
810
|
enforcerAddress,
|
|
647
811
|
enforcerName
|
|
648
812
|
});
|
|
649
|
-
return
|
|
813
|
+
return _chunk7FYDQNJ3cjs.read_exports2.getAvailableAmount({
|
|
650
814
|
client,
|
|
651
815
|
contractAddress: enforcerAddress,
|
|
652
816
|
delegationManager,
|
|
@@ -655,10 +819,10 @@ async function getErc20StreamingEnforcerAvailableAmount(client, environment, par
|
|
|
655
819
|
});
|
|
656
820
|
}
|
|
657
821
|
async function getMultiTokenPeriodEnforcerAvailableAmount(client, environment, params) {
|
|
658
|
-
|
|
822
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
659
823
|
"getMultiTokenPeriodEnforcerAvailableAmount",
|
|
660
824
|
{
|
|
661
|
-
chainId: _nullishCoalesce(_optionalChain([client, 'access',
|
|
825
|
+
chainId: _nullishCoalesce(_optionalChain([client, 'access', _25 => _25.chain, 'optionalAccess', _26 => _26.id]), () => ( null))
|
|
662
826
|
}
|
|
663
827
|
);
|
|
664
828
|
const enforcerName = "MultiTokenPeriodEnforcer";
|
|
@@ -667,13 +831,13 @@ async function getMultiTokenPeriodEnforcerAvailableAmount(client, environment, p
|
|
|
667
831
|
enforcerName,
|
|
668
832
|
environment
|
|
669
833
|
});
|
|
670
|
-
const delegationHash =
|
|
834
|
+
const delegationHash = _chunkIBZSNB7Dcjs.hashDelegation.call(void 0, params.delegation);
|
|
671
835
|
const { terms, args } = findMatchingCaveat({
|
|
672
836
|
delegation: params.delegation,
|
|
673
837
|
enforcerAddress,
|
|
674
838
|
enforcerName
|
|
675
839
|
});
|
|
676
|
-
return
|
|
840
|
+
return _chunk7FYDQNJ3cjs.read_exports3.getAvailableAmount({
|
|
677
841
|
client,
|
|
678
842
|
contractAddress: enforcerAddress,
|
|
679
843
|
delegationHash,
|
|
@@ -683,10 +847,10 @@ async function getMultiTokenPeriodEnforcerAvailableAmount(client, environment, p
|
|
|
683
847
|
});
|
|
684
848
|
}
|
|
685
849
|
async function getNativeTokenPeriodTransferEnforcerAvailableAmount(client, environment, params) {
|
|
686
|
-
|
|
850
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
687
851
|
"getNativeTokenPeriodTransferEnforcerAvailableAmount",
|
|
688
852
|
{
|
|
689
|
-
chainId: _nullishCoalesce(_optionalChain([client, 'access',
|
|
853
|
+
chainId: _nullishCoalesce(_optionalChain([client, 'access', _27 => _27.chain, 'optionalAccess', _28 => _28.id]), () => ( null))
|
|
690
854
|
}
|
|
691
855
|
);
|
|
692
856
|
const enforcerName = "NativeTokenPeriodTransferEnforcer";
|
|
@@ -695,13 +859,13 @@ async function getNativeTokenPeriodTransferEnforcerAvailableAmount(client, envir
|
|
|
695
859
|
enforcerName,
|
|
696
860
|
environment
|
|
697
861
|
});
|
|
698
|
-
const delegationHash =
|
|
862
|
+
const delegationHash = _chunkIBZSNB7Dcjs.hashDelegation.call(void 0, params.delegation);
|
|
699
863
|
const { terms } = findMatchingCaveat({
|
|
700
864
|
delegation: params.delegation,
|
|
701
865
|
enforcerAddress,
|
|
702
866
|
enforcerName
|
|
703
867
|
});
|
|
704
|
-
return
|
|
868
|
+
return _chunk7FYDQNJ3cjs.read_exports4.getAvailableAmount({
|
|
705
869
|
client,
|
|
706
870
|
contractAddress: enforcerAddress,
|
|
707
871
|
delegationHash,
|
|
@@ -710,10 +874,10 @@ async function getNativeTokenPeriodTransferEnforcerAvailableAmount(client, envir
|
|
|
710
874
|
});
|
|
711
875
|
}
|
|
712
876
|
async function getNativeTokenStreamingEnforcerAvailableAmount(client, environment, params) {
|
|
713
|
-
|
|
877
|
+
_chunkIBZSNB7Dcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
714
878
|
"getNativeTokenStreamingEnforcerAvailableAmount",
|
|
715
879
|
{
|
|
716
|
-
chainId: _nullishCoalesce(_optionalChain([client, 'access',
|
|
880
|
+
chainId: _nullishCoalesce(_optionalChain([client, 'access', _29 => _29.chain, 'optionalAccess', _30 => _30.id]), () => ( null))
|
|
717
881
|
}
|
|
718
882
|
);
|
|
719
883
|
const enforcerName = "NativeTokenStreamingEnforcer";
|
|
@@ -722,13 +886,13 @@ async function getNativeTokenStreamingEnforcerAvailableAmount(client, environmen
|
|
|
722
886
|
enforcerName,
|
|
723
887
|
environment
|
|
724
888
|
});
|
|
725
|
-
const delegationHash =
|
|
889
|
+
const delegationHash = _chunkIBZSNB7Dcjs.hashDelegation.call(void 0, params.delegation);
|
|
726
890
|
const { terms } = findMatchingCaveat({
|
|
727
891
|
delegation: params.delegation,
|
|
728
892
|
enforcerAddress,
|
|
729
893
|
enforcerName
|
|
730
894
|
});
|
|
731
|
-
return
|
|
895
|
+
return _chunk7FYDQNJ3cjs.read_exports5.getAvailableAmount({
|
|
732
896
|
client,
|
|
733
897
|
contractAddress: enforcerAddress,
|
|
734
898
|
delegationManager,
|
|
@@ -809,7 +973,7 @@ var caveatEnforcerActions = ({ environment }) => (client) => ({
|
|
|
809
973
|
var _actions = require('viem/actions');
|
|
810
974
|
var DELEGATION_PREFIX = "0xef0100";
|
|
811
975
|
function extractDelegatedAddress(code) {
|
|
812
|
-
if (_optionalChain([code, 'optionalAccess',
|
|
976
|
+
if (_optionalChain([code, 'optionalAccess', _31 => _31.length]) !== 48) {
|
|
813
977
|
return null;
|
|
814
978
|
}
|
|
815
979
|
if (!code.toLowerCase().startsWith(DELEGATION_PREFIX.toLowerCase())) {
|
|
@@ -841,52 +1005,6 @@ async function isValid7702Implementation({
|
|
|
841
1005
|
}
|
|
842
1006
|
}
|
|
843
1007
|
|
|
844
|
-
// src/actions/signDelegation.ts
|
|
845
|
-
|
|
846
|
-
var _accounts = require('viem/accounts');
|
|
847
|
-
async function signDelegation(client, parameters) {
|
|
848
|
-
const {
|
|
849
|
-
account: accountParam = client.account,
|
|
850
|
-
delegation,
|
|
851
|
-
delegationManager,
|
|
852
|
-
chainId,
|
|
853
|
-
name = "DelegationManager",
|
|
854
|
-
version = "1",
|
|
855
|
-
allowInsecureUnrestrictedDelegation = false
|
|
856
|
-
} = parameters;
|
|
857
|
-
if (!accountParam) {
|
|
858
|
-
throw new (0, _viem.BaseError)("Account not found. Please provide an account.");
|
|
859
|
-
}
|
|
860
|
-
const account = _accounts.parseAccount.call(void 0, accountParam);
|
|
861
|
-
const typedData = _chunkTMO23YRPcjs.prepareSignDelegationTypedData.call(void 0, {
|
|
862
|
-
delegation,
|
|
863
|
-
delegationManager,
|
|
864
|
-
chainId,
|
|
865
|
-
name,
|
|
866
|
-
version,
|
|
867
|
-
allowInsecureUnrestrictedDelegation
|
|
868
|
-
});
|
|
869
|
-
return client.signTypedData({
|
|
870
|
-
account,
|
|
871
|
-
...typedData
|
|
872
|
-
});
|
|
873
|
-
}
|
|
874
|
-
function signDelegationActions() {
|
|
875
|
-
return (client) => ({
|
|
876
|
-
signDelegation: async (parameters) => signDelegation(client, {
|
|
877
|
-
chainId: _nullishCoalesce(parameters.chainId, () => ( (() => {
|
|
878
|
-
if (!_optionalChain([client, 'access', _28 => _28.chain, 'optionalAccess', _29 => _29.id])) {
|
|
879
|
-
throw new (0, _viem.BaseError)(
|
|
880
|
-
"Chain ID is required. Either provide it in parameters or configure the client with a chain."
|
|
881
|
-
);
|
|
882
|
-
}
|
|
883
|
-
return client.chain.id;
|
|
884
|
-
})())),
|
|
885
|
-
...parameters
|
|
886
|
-
})
|
|
887
|
-
});
|
|
888
|
-
}
|
|
889
|
-
|
|
890
1008
|
// src/actions/signUserOperation.ts
|
|
891
1009
|
|
|
892
1010
|
|
|
@@ -921,7 +1039,7 @@ function signUserOperationActions() {
|
|
|
921
1039
|
return (client) => ({
|
|
922
1040
|
signUserOperation: async (parameters) => signUserOperation(client, {
|
|
923
1041
|
chainId: _nullishCoalesce(parameters.chainId, () => ( (() => {
|
|
924
|
-
if (!_optionalChain([client, 'access',
|
|
1042
|
+
if (!_optionalChain([client, 'access', _32 => _32.chain, 'optionalAccess', _33 => _33.id])) {
|
|
925
1043
|
throw new (0, _viem.BaseError)(
|
|
926
1044
|
"Chain ID is required. Either provide it in parameters or configure the client with a chain."
|
|
927
1045
|
);
|
|
@@ -953,7 +1071,9 @@ var erc7715ProviderActions = () => (client) => ({
|
|
|
953
1071
|
}
|
|
954
1072
|
});
|
|
955
1073
|
var erc7710WalletActions = () => (client) => ({
|
|
956
|
-
sendTransactionWithDelegation: async (args) => sendTransactionWithDelegationAction(client, args)
|
|
1074
|
+
sendTransactionWithDelegation: async (args) => sendTransactionWithDelegationAction(client, args),
|
|
1075
|
+
redelegatePermissionContext: async (parameters) => redelegatePermissionContextAction(client, parameters),
|
|
1076
|
+
redelegatePermissionContextOpen: async (parameters) => redelegatePermissionContextOpenAction(client, parameters)
|
|
957
1077
|
});
|
|
958
1078
|
var erc7710BundlerActions = () => (client) => ({
|
|
959
1079
|
sendUserOperationWithDelegation: async (args) => sendUserOperationWithDelegationAction(client, args)
|
|
@@ -978,5 +1098,7 @@ var erc7710BundlerActions = () => (client) => ({
|
|
|
978
1098
|
|
|
979
1099
|
|
|
980
1100
|
|
|
981
|
-
|
|
982
|
-
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
exports.isValid7702Implementation = isValid7702Implementation; exports.erc7715GetGrantedExecutionPermissionsAction = erc7715GetGrantedExecutionPermissionsAction; exports.erc7715GetSupportedExecutionPermissionsAction = erc7715GetSupportedExecutionPermissionsAction; exports.erc7715RequestExecutionPermissionsAction = erc7715RequestExecutionPermissionsAction; exports.signDelegation = signDelegation; exports.signDelegationActions = signDelegationActions; exports.redelegatePermissionContextAction = redelegatePermissionContextAction; exports.redelegatePermissionContextOpenAction = redelegatePermissionContextOpenAction; exports.getErc20PeriodTransferEnforcerAvailableAmount = getErc20PeriodTransferEnforcerAvailableAmount; exports.getErc20StreamingEnforcerAvailableAmount = getErc20StreamingEnforcerAvailableAmount; exports.getMultiTokenPeriodEnforcerAvailableAmount = getMultiTokenPeriodEnforcerAvailableAmount; exports.getNativeTokenPeriodTransferEnforcerAvailableAmount = getNativeTokenPeriodTransferEnforcerAvailableAmount; exports.getNativeTokenStreamingEnforcerAvailableAmount = getNativeTokenStreamingEnforcerAvailableAmount; exports.caveatEnforcerActions = caveatEnforcerActions; exports.signUserOperation = signUserOperation; exports.signUserOperationActions = signUserOperationActions; exports.erc7715ProviderActions = erc7715ProviderActions; exports.erc7710WalletActions = erc7710WalletActions; exports.erc7710BundlerActions = erc7710BundlerActions; exports.actions_exports = actions_exports;
|
|
1104
|
+
//# sourceMappingURL=chunk-XEOE25DE.cjs.map
|