@metamask/smart-accounts-kit 0.1.0 → 0.2.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/actions/index.cjs +5 -5
  3. package/dist/actions/index.d.cts +1 -1
  4. package/dist/actions/index.d.ts +1 -1
  5. package/dist/actions/index.mjs +4 -4
  6. package/dist/{chunk-6RN5RBOR.mjs → chunk-3OQKCVQC.mjs} +4 -4
  7. package/dist/{chunk-2EIX7ZYT.cjs → chunk-4WKZQUP4.cjs} +102 -102
  8. package/dist/{chunk-2EIX7ZYT.cjs.map → chunk-4WKZQUP4.cjs.map} +1 -1
  9. package/dist/{chunk-HD4O6IVC.cjs → chunk-AAYEHQXN.cjs} +8 -8
  10. package/dist/{chunk-HD4O6IVC.cjs.map → chunk-AAYEHQXN.cjs.map} +1 -1
  11. package/dist/{chunk-BFDBNFIP.cjs → chunk-CE3ZQE3P.cjs} +3 -3
  12. package/dist/{chunk-BFDBNFIP.cjs.map → chunk-CE3ZQE3P.cjs.map} +1 -1
  13. package/dist/{chunk-TEI2NRPU.mjs → chunk-DR5QAW34.mjs} +2 -2
  14. package/dist/{chunk-RB4SOJM3.mjs → chunk-K5C42JZ2.mjs} +44 -22
  15. package/dist/chunk-K5C42JZ2.mjs.map +1 -0
  16. package/dist/{chunk-KUEXI4ME.mjs → chunk-LCNP5VYR.mjs} +2 -2
  17. package/dist/{chunk-HLCOMYYU.cjs → chunk-MAPUND7S.cjs} +5 -15
  18. package/dist/chunk-MAPUND7S.cjs.map +1 -0
  19. package/dist/{chunk-MVKT5CLQ.mjs → chunk-PSERHFRY.mjs} +2 -2
  20. package/dist/{chunk-WA2O2K3K.cjs → chunk-PTIEXLLP.cjs} +58 -36
  21. package/dist/chunk-PTIEXLLP.cjs.map +1 -0
  22. package/dist/{chunk-D4ILRL6Z.cjs → chunk-PZM5E7L3.cjs} +12 -12
  23. package/dist/{chunk-D4ILRL6Z.cjs.map → chunk-PZM5E7L3.cjs.map} +1 -1
  24. package/dist/{chunk-UUDQWENY.mjs → chunk-Q6ZTEHYY.mjs} +44 -54
  25. package/dist/{chunk-HLCOMYYU.cjs.map → chunk-Q6ZTEHYY.mjs.map} +1 -1
  26. package/dist/{chunk-7MRTROLV.mjs → chunk-XHKSMZ7G.mjs} +2 -2
  27. package/dist/{chunk-662KDAAG.cjs → chunk-XU72WGZA.cjs} +11 -11
  28. package/dist/{chunk-662KDAAG.cjs.map → chunk-XU72WGZA.cjs.map} +1 -1
  29. package/dist/contracts/index.cjs +5 -5
  30. package/dist/contracts/index.mjs +4 -4
  31. package/dist/experimental/index.cjs +3 -3
  32. package/dist/experimental/index.mjs +1 -1
  33. package/dist/{index-CLkk7zr4.d.cts → index-DYq7aOEN.d.cts} +7 -1
  34. package/dist/{index-18Alar1P.d.ts → index-Do0GpCXe.d.ts} +7 -1
  35. package/dist/index.cjs +19 -19
  36. package/dist/index.d.cts +2 -2
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.mjs +7 -7
  39. package/dist/utils/index.cjs +5 -5
  40. package/dist/utils/index.mjs +4 -4
  41. package/package.json +4 -4
  42. package/dist/chunk-RB4SOJM3.mjs.map +0 -1
  43. package/dist/chunk-UUDQWENY.mjs.map +0 -1
  44. package/dist/chunk-WA2O2K3K.cjs.map +0 -1
  45. /package/dist/{chunk-6RN5RBOR.mjs.map → chunk-3OQKCVQC.mjs.map} +0 -0
  46. /package/dist/{chunk-TEI2NRPU.mjs.map → chunk-DR5QAW34.mjs.map} +0 -0
  47. /package/dist/{chunk-KUEXI4ME.mjs.map → chunk-LCNP5VYR.mjs.map} +0 -0
  48. /package/dist/{chunk-MVKT5CLQ.mjs.map → chunk-PSERHFRY.mjs.map} +0 -0
  49. /package/dist/{chunk-7MRTROLV.mjs.map → chunk-XHKSMZ7G.mjs.map} +0 -0
package/dist/index.cjs CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkWA2O2K3Kcjs = require('./chunk-WA2O2K3K.cjs');
5
+ var _chunkPTIEXLLPcjs = require('./chunk-PTIEXLLP.cjs');
6
6
 
7
7
 
8
8
 
9
- var _chunk2EIX7ZYTcjs = require('./chunk-2EIX7ZYT.cjs');
10
- require('./chunk-D4ILRL6Z.cjs');
9
+ var _chunk4WKZQUP4cjs = require('./chunk-4WKZQUP4.cjs');
10
+ require('./chunk-PZM5E7L3.cjs');
11
11
 
12
12
 
13
13
 
@@ -15,15 +15,15 @@ require('./chunk-D4ILRL6Z.cjs');
15
15
 
16
16
 
17
17
 
18
- var _chunkHD4O6IVCcjs = require('./chunk-HD4O6IVC.cjs');
18
+ var _chunkAAYEHQXNcjs = require('./chunk-AAYEHQXN.cjs');
19
19
 
20
20
 
21
21
 
22
22
 
23
23
 
24
24
 
25
- var _chunkBFDBNFIPcjs = require('./chunk-BFDBNFIP.cjs');
26
- require('./chunk-662KDAAG.cjs');
25
+ var _chunkCE3ZQE3Pcjs = require('./chunk-CE3ZQE3P.cjs');
26
+ require('./chunk-XU72WGZA.cjs');
27
27
 
28
28
 
29
29
 
@@ -38,7 +38,7 @@ var _chunkT6PSFUOZcjs = require('./chunk-T6PSFUOZ.cjs');
38
38
 
39
39
 
40
40
 
41
- var _chunkHLCOMYYUcjs = require('./chunk-HLCOMYYU.cjs');
41
+ var _chunkMAPUND7Scjs = require('./chunk-MAPUND7S.cjs');
42
42
 
43
43
  // src/toMetaMaskSmartAccount.ts
44
44
 
@@ -114,7 +114,7 @@ var resolveHybridSigner = (config) => {
114
114
  if (webAuthnAccount.type !== "webAuthn") {
115
115
  throw new Error("Account is not a webAuthn account");
116
116
  }
117
- const encodeSignature = ({ signature, webauthn }) => _chunkHD4O6IVCcjs.encodeDeleGatorSignature.call(void 0,
117
+ const encodeSignature = ({ signature, webauthn }) => _chunkAAYEHQXNcjs.encodeDeleGatorSignature.call(void 0,
118
118
  keyId,
119
119
  signature,
120
120
  webauthn.clientDataJSON,
@@ -122,7 +122,7 @@ var resolveHybridSigner = (config) => {
122
122
  );
123
123
  const signMessage = async (args) => webAuthnAccount.signMessage(args).then(encodeSignature);
124
124
  const signTypedData = async (typedDataDefinition) => webAuthnAccount.signTypedData(typedDataDefinition).then(encodeSignature);
125
- const getStubSignature = async () => _chunkHD4O6IVCcjs.createDummyWebAuthnSignature.call(void 0, keyId);
125
+ const getStubSignature = async () => _chunkAAYEHQXNcjs.createDummyWebAuthnSignature.call(void 0, keyId);
126
126
  return {
127
127
  signMessage,
128
128
  signTypedData,
@@ -238,7 +238,7 @@ async function toMetaMaskSmartAccount(params) {
238
238
  implementation,
239
239
  signer: params.signer
240
240
  });
241
- const environment = _nullishCoalesce(params.environment, () => ( _chunkBFDBNFIPcjs.getSmartAccountsEnvironment.call(void 0, chain.id)));
241
+ const environment = _nullishCoalesce(params.environment, () => ( _chunkCE3ZQE3Pcjs.getSmartAccountsEnvironment.call(void 0, chain.id)));
242
242
  let address, factoryData;
243
243
  if (params.address) {
244
244
  factoryData = void 0;
@@ -247,7 +247,7 @@ async function toMetaMaskSmartAccount(params) {
247
247
  if (implementation === "Stateless7702" /* Stateless7702 */) {
248
248
  throw new Error("Stateless7702 does not support counterfactual accounts");
249
249
  }
250
- const accountData = await _chunkHD4O6IVCcjs.getCounterfactualAccountData.call(void 0, {
250
+ const accountData = await _chunkAAYEHQXNcjs.getCounterfactualAccountData.call(void 0, {
251
251
  factory: environment.SimpleFactory,
252
252
  implementations: environment.implementations,
253
253
  implementation,
@@ -289,7 +289,7 @@ async function toMetaMaskSmartAccount(params) {
289
289
  };
290
290
  const signDelegation2 = async (delegationParams) => {
291
291
  const { delegation, chainId } = delegationParams;
292
- const delegationStruct = _chunkHLCOMYYUcjs.toDelegationStruct.call(void 0, {
292
+ const delegationStruct = _chunkMAPUND7Scjs.toDelegationStruct.call(void 0, {
293
293
  ...delegation,
294
294
  signature: "0x"
295
295
  });
@@ -300,7 +300,7 @@ async function toMetaMaskSmartAccount(params) {
300
300
  version: "1",
301
301
  verifyingContract: environment.DelegationManager
302
302
  },
303
- types: _chunkHLCOMYYUcjs.SIGNABLE_DELEGATION_TYPED_DATA,
303
+ types: _chunkMAPUND7Scjs.SIGNABLE_DELEGATION_TYPED_DATA,
304
304
  primaryType: "Delegation",
305
305
  message: delegationStruct
306
306
  });
@@ -320,20 +320,20 @@ async function toMetaMaskSmartAccount(params) {
320
320
  version: "1",
321
321
  verifyingContract: address
322
322
  },
323
- types: _chunkBFDBNFIPcjs.SIGNABLE_USER_OP_TYPED_DATA,
323
+ types: _chunkCE3ZQE3Pcjs.SIGNABLE_USER_OP_TYPED_DATA,
324
324
  primaryType: "PackedUserOperation",
325
325
  message: { ...packedUserOp, entryPoint: entryPoint.address }
326
326
  });
327
327
  return signature;
328
328
  };
329
329
  const getAddress = async () => address;
330
- const getNonce = async () => _chunk2EIX7ZYTcjs.read.call(void 0, {
330
+ const getNonce = async () => _chunk4WKZQUP4cjs.read.call(void 0, {
331
331
  client,
332
332
  entryPoint: environment.EntryPoint,
333
333
  contractAddress: address,
334
334
  key: 0n
335
335
  });
336
- const encodeCalls = async (calls) => _chunkHD4O6IVCcjs.encodeCallsForCaller.call(void 0, address, calls);
336
+ const encodeCalls = async (calls) => _chunkAAYEHQXNcjs.encodeCallsForCaller.call(void 0, address, calls);
337
337
  const smartAccount = await _accountabstraction.toSmartAccount.call(void 0, {
338
338
  abi,
339
339
  client,
@@ -350,7 +350,7 @@ async function toMetaMaskSmartAccount(params) {
350
350
  if (implementation === "Stateless7702" /* Stateless7702 */) {
351
351
  return {
352
352
  ...smartAccount,
353
- isDeployed: async () => _chunkWA2O2K3Kcjs.isValid7702Implementation.call(void 0, {
353
+ isDeployed: async () => _chunkPTIEXLLPcjs.isValid7702Implementation.call(void 0, {
354
354
  client,
355
355
  accountAddress: address,
356
356
  environment
@@ -365,7 +365,7 @@ function createCaveatEnforcerClient({
365
365
  client,
366
366
  environment
367
367
  }) {
368
- return client.extend(_chunkWA2O2K3Kcjs.caveatEnforcerActions.call(void 0, { environment }));
368
+ return client.extend(_chunkPTIEXLLPcjs.caveatEnforcerActions.call(void 0, { environment }));
369
369
  }
370
370
 
371
371
  // src/actions/infuraBundlerClient.ts
@@ -420,5 +420,5 @@ function createInfuraBundlerClient(config) {
420
420
 
421
421
 
422
422
 
423
- exports.ANY_BENEFICIARY = _chunkHLCOMYYUcjs.ANY_BENEFICIARY; exports.BalanceChangeType = _chunkHLCOMYYUcjs.BalanceChangeType; exports.ExecutionMode = _chunkT6PSFUOZcjs.ExecutionMode; exports.Implementation = _chunkHD4O6IVCcjs.Implementation; exports.PREFERRED_VERSION = _chunkBFDBNFIPcjs.PREFERRED_VERSION; exports.ROOT_AUTHORITY = _chunkHLCOMYYUcjs.ROOT_AUTHORITY; exports.TransferWindow = _chunkHD4O6IVCcjs.TransferWindow; exports.actions = _chunkWA2O2K3Kcjs.actions_exports; exports.aggregateSignature = aggregateSignature; exports.contracts = _chunk2EIX7ZYTcjs.contracts_exports; exports.createCaveat = _chunkHLCOMYYUcjs.createCaveat; exports.createCaveatEnforcerClient = createCaveatEnforcerClient; exports.createDelegation = _chunkHLCOMYYUcjs.createDelegation; exports.createExecution = _chunkT6PSFUOZcjs.createExecution; exports.createInfuraBundlerClient = createInfuraBundlerClient; exports.createOpenDelegation = _chunkHLCOMYYUcjs.createOpenDelegation; exports.getSmartAccountsEnvironment = _chunkBFDBNFIPcjs.getSmartAccountsEnvironment; exports.redeemDelegations = _chunkBFDBNFIPcjs.redeemDelegations; exports.signDelegation = _chunkHLCOMYYUcjs.signDelegation; exports.signUserOperation = _chunkBFDBNFIPcjs.signUserOperation; exports.toMetaMaskSmartAccount = toMetaMaskSmartAccount;
423
+ exports.ANY_BENEFICIARY = _chunkMAPUND7Scjs.ANY_BENEFICIARY; exports.BalanceChangeType = _chunkMAPUND7Scjs.BalanceChangeType; exports.ExecutionMode = _chunkT6PSFUOZcjs.ExecutionMode; exports.Implementation = _chunkAAYEHQXNcjs.Implementation; exports.PREFERRED_VERSION = _chunkCE3ZQE3Pcjs.PREFERRED_VERSION; exports.ROOT_AUTHORITY = _chunkMAPUND7Scjs.ROOT_AUTHORITY; exports.TransferWindow = _chunkAAYEHQXNcjs.TransferWindow; exports.actions = _chunkPTIEXLLPcjs.actions_exports; exports.aggregateSignature = aggregateSignature; exports.contracts = _chunk4WKZQUP4cjs.contracts_exports; exports.createCaveat = _chunkMAPUND7Scjs.createCaveat; exports.createCaveatEnforcerClient = createCaveatEnforcerClient; exports.createDelegation = _chunkMAPUND7Scjs.createDelegation; exports.createExecution = _chunkT6PSFUOZcjs.createExecution; exports.createInfuraBundlerClient = createInfuraBundlerClient; exports.createOpenDelegation = _chunkMAPUND7Scjs.createOpenDelegation; exports.getSmartAccountsEnvironment = _chunkCE3ZQE3Pcjs.getSmartAccountsEnvironment; exports.redeemDelegations = _chunkCE3ZQE3Pcjs.redeemDelegations; exports.signDelegation = _chunkMAPUND7Scjs.signDelegation; exports.signUserOperation = _chunkCE3ZQE3Pcjs.signUserOperation; exports.toMetaMaskSmartAccount = toMetaMaskSmartAccount;
424
424
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -5,8 +5,8 @@ export { P as PREFERRED_VERSION, g as getSmartAccountsEnvironment } from './smar
5
5
  import { Hex, Address, WalletClient, PublicClient, Transport, Chain, Account, Client } from 'viem';
6
6
  export { s as signUserOperation } from './userOp-CFv4wNkl.cjs';
7
7
  export { i as contracts } from './index-0-B0YlEP.cjs';
8
- import { c as caveatEnforcerActions } from './index-CLkk7zr4.cjs';
9
- export { i as actions } from './index-CLkk7zr4.cjs';
8
+ import { c as caveatEnforcerActions } from './index-DYq7aOEN.cjs';
9
+ export { i as actions } from './index-DYq7aOEN.cjs';
10
10
  import { SmartAccount, BundlerClientConfig, BundlerClient } from 'viem/account-abstraction';
11
11
  export { ANY_BENEFICIARY, ROOT_AUTHORITY } from '@metamask/delegation-core';
12
12
  import '@metamask/delegation-abis';
package/dist/index.d.ts CHANGED
@@ -5,8 +5,8 @@ export { P as PREFERRED_VERSION, g as getSmartAccountsEnvironment } from './smar
5
5
  import { Hex, Address, WalletClient, PublicClient, Transport, Chain, Account, Client } from 'viem';
6
6
  export { s as signUserOperation } from './userOp-CFv4wNkl.js';
7
7
  export { i as contracts } from './index-D1WbhKCc.js';
8
- import { c as caveatEnforcerActions } from './index-18Alar1P.js';
9
- export { i as actions } from './index-18Alar1P.js';
8
+ import { c as caveatEnforcerActions } from './index-Do0GpCXe.js';
9
+ export { i as actions } from './index-Do0GpCXe.js';
10
10
  import { SmartAccount, BundlerClientConfig, BundlerClient } from 'viem/account-abstraction';
11
11
  export { ANY_BENEFICIARY, ROOT_AUTHORITY } from '@metamask/delegation-core';
12
12
  import '@metamask/delegation-abis';
package/dist/index.mjs CHANGED
@@ -2,12 +2,12 @@ import {
2
2
  actions_exports,
3
3
  caveatEnforcerActions,
4
4
  isValid7702Implementation
5
- } from "./chunk-RB4SOJM3.mjs";
5
+ } from "./chunk-K5C42JZ2.mjs";
6
6
  import {
7
7
  contracts_exports,
8
8
  read
9
- } from "./chunk-6RN5RBOR.mjs";
10
- import "./chunk-KUEXI4ME.mjs";
9
+ } from "./chunk-3OQKCVQC.mjs";
10
+ import "./chunk-LCNP5VYR.mjs";
11
11
  import {
12
12
  Implementation,
13
13
  TransferWindow,
@@ -15,15 +15,15 @@ import {
15
15
  encodeCallsForCaller,
16
16
  encodeDeleGatorSignature,
17
17
  getCounterfactualAccountData
18
- } from "./chunk-7MRTROLV.mjs";
18
+ } from "./chunk-XHKSMZ7G.mjs";
19
19
  import {
20
20
  PREFERRED_VERSION,
21
21
  SIGNABLE_USER_OP_TYPED_DATA,
22
22
  getSmartAccountsEnvironment,
23
23
  redeemDelegations,
24
24
  signUserOperation
25
- } from "./chunk-MVKT5CLQ.mjs";
26
- import "./chunk-TEI2NRPU.mjs";
25
+ } from "./chunk-PSERHFRY.mjs";
26
+ import "./chunk-DR5QAW34.mjs";
27
27
  import {
28
28
  ExecutionMode,
29
29
  createExecution
@@ -38,7 +38,7 @@ import {
38
38
  createOpenDelegation,
39
39
  signDelegation,
40
40
  toDelegationStruct
41
- } from "./chunk-UUDQWENY.mjs";
41
+ } from "./chunk-Q6ZTEHYY.mjs";
42
42
 
43
43
  // src/toMetaMaskSmartAccount.ts
44
44
  import {
@@ -3,13 +3,13 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkHD4O6IVCcjs = require('../chunk-HD4O6IVC.cjs');
6
+ var _chunkAAYEHQXNcjs = require('../chunk-AAYEHQXN.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
- var _chunkBFDBNFIPcjs = require('../chunk-BFDBNFIP.cjs');
12
- require('../chunk-662KDAAG.cjs');
11
+ var _chunkCE3ZQE3Pcjs = require('../chunk-CE3ZQE3P.cjs');
12
+ require('../chunk-XU72WGZA.cjs');
13
13
 
14
14
 
15
15
 
@@ -30,7 +30,7 @@ var _chunkT6PSFUOZcjs = require('../chunk-T6PSFUOZ.cjs');
30
30
 
31
31
 
32
32
 
33
- var _chunkHLCOMYYUcjs = require('../chunk-HLCOMYYU.cjs');
33
+ var _chunkMAPUND7Scjs = require('../chunk-MAPUND7S.cjs');
34
34
 
35
35
 
36
36
 
@@ -56,5 +56,5 @@ var _chunkHLCOMYYUcjs = require('../chunk-HLCOMYYU.cjs');
56
56
 
57
57
 
58
58
 
59
- exports.CaveatBuilder = _chunkHLCOMYYUcjs.CaveatBuilder; exports.DELEGATION_ABI_TYPE_COMPONENTS = _chunkHLCOMYYUcjs.DELEGATION_ABI_TYPE_COMPONENTS; exports.DELEGATION_ARRAY_ABI_TYPE = _chunkHLCOMYYUcjs.DELEGATION_ARRAY_ABI_TYPE; exports.DELEGATION_TYPEHASH = _chunkHLCOMYYUcjs.DELEGATION_TYPEHASH; exports.SIGNABLE_DELEGATION_TYPED_DATA = _chunkHLCOMYYUcjs.SIGNABLE_DELEGATION_TYPED_DATA; exports.SIGNABLE_USER_OP_TYPED_DATA = _chunkBFDBNFIPcjs.SIGNABLE_USER_OP_TYPED_DATA; exports.SIGNATURE_ABI_PARAMS = _chunkHD4O6IVCcjs.SIGNATURE_ABI_PARAMS; exports.createCaveatBuilder = _chunkHLCOMYYUcjs.createCaveatBuilder; exports.decodeDelegations = _chunkHLCOMYYUcjs.decodeDelegations; exports.decodePermissionContexts = _chunkHLCOMYYUcjs.decodePermissionContexts; exports.deploySmartAccountsEnvironment = _chunkBFDBNFIPcjs.deploySmartAccountsEnvironment; exports.encodeBatchExecution = _chunkT6PSFUOZcjs.encodeBatchExecution; exports.encodeCalls = _chunkHD4O6IVCcjs.encodeCalls; exports.encodeCallsForCaller = _chunkHD4O6IVCcjs.encodeCallsForCaller; exports.encodeDelegations = _chunkHLCOMYYUcjs.encodeDelegations; exports.encodeExecutionCalldata = _chunkT6PSFUOZcjs.encodeExecutionCalldata; exports.encodeExecutionCalldatas = _chunkT6PSFUOZcjs.encodeExecutionCalldatas; exports.encodePermissionContexts = _chunkHLCOMYYUcjs.encodePermissionContexts; exports.encodeSingleExecution = _chunkT6PSFUOZcjs.encodeSingleExecution; exports.getCounterfactualAccountData = _chunkHD4O6IVCcjs.getCounterfactualAccountData; exports.getDelegationHashOffchain = _chunkHLCOMYYUcjs.getDelegationHashOffchain; exports.overrideDeployedEnvironment = _chunkBFDBNFIPcjs.overrideDeployedEnvironment; exports.toDelegation = _chunkHLCOMYYUcjs.toDelegation; exports.toDelegationStruct = _chunkHLCOMYYUcjs.toDelegationStruct;
59
+ exports.CaveatBuilder = _chunkMAPUND7Scjs.CaveatBuilder; exports.DELEGATION_ABI_TYPE_COMPONENTS = _chunkMAPUND7Scjs.DELEGATION_ABI_TYPE_COMPONENTS; exports.DELEGATION_ARRAY_ABI_TYPE = _chunkMAPUND7Scjs.DELEGATION_ARRAY_ABI_TYPE; exports.DELEGATION_TYPEHASH = _chunkMAPUND7Scjs.DELEGATION_TYPEHASH; exports.SIGNABLE_DELEGATION_TYPED_DATA = _chunkMAPUND7Scjs.SIGNABLE_DELEGATION_TYPED_DATA; exports.SIGNABLE_USER_OP_TYPED_DATA = _chunkCE3ZQE3Pcjs.SIGNABLE_USER_OP_TYPED_DATA; exports.SIGNATURE_ABI_PARAMS = _chunkAAYEHQXNcjs.SIGNATURE_ABI_PARAMS; exports.createCaveatBuilder = _chunkMAPUND7Scjs.createCaveatBuilder; exports.decodeDelegations = _chunkMAPUND7Scjs.decodeDelegations; exports.decodePermissionContexts = _chunkMAPUND7Scjs.decodePermissionContexts; exports.deploySmartAccountsEnvironment = _chunkCE3ZQE3Pcjs.deploySmartAccountsEnvironment; exports.encodeBatchExecution = _chunkT6PSFUOZcjs.encodeBatchExecution; exports.encodeCalls = _chunkAAYEHQXNcjs.encodeCalls; exports.encodeCallsForCaller = _chunkAAYEHQXNcjs.encodeCallsForCaller; exports.encodeDelegations = _chunkMAPUND7Scjs.encodeDelegations; exports.encodeExecutionCalldata = _chunkT6PSFUOZcjs.encodeExecutionCalldata; exports.encodeExecutionCalldatas = _chunkT6PSFUOZcjs.encodeExecutionCalldatas; exports.encodePermissionContexts = _chunkMAPUND7Scjs.encodePermissionContexts; exports.encodeSingleExecution = _chunkT6PSFUOZcjs.encodeSingleExecution; exports.getCounterfactualAccountData = _chunkAAYEHQXNcjs.getCounterfactualAccountData; exports.getDelegationHashOffchain = _chunkMAPUND7Scjs.getDelegationHashOffchain; exports.overrideDeployedEnvironment = _chunkCE3ZQE3Pcjs.overrideDeployedEnvironment; exports.toDelegation = _chunkMAPUND7Scjs.toDelegation; exports.toDelegationStruct = _chunkMAPUND7Scjs.toDelegationStruct;
60
60
  //# sourceMappingURL=index.cjs.map
@@ -3,13 +3,13 @@ import {
3
3
  encodeCalls,
4
4
  encodeCallsForCaller,
5
5
  getCounterfactualAccountData
6
- } from "../chunk-7MRTROLV.mjs";
6
+ } from "../chunk-XHKSMZ7G.mjs";
7
7
  import {
8
8
  SIGNABLE_USER_OP_TYPED_DATA,
9
9
  deploySmartAccountsEnvironment,
10
10
  overrideDeployedEnvironment
11
- } from "../chunk-MVKT5CLQ.mjs";
12
- import "../chunk-TEI2NRPU.mjs";
11
+ } from "../chunk-PSERHFRY.mjs";
12
+ import "../chunk-DR5QAW34.mjs";
13
13
  import {
14
14
  encodeBatchExecution,
15
15
  encodeExecutionCalldata,
@@ -30,7 +30,7 @@ import {
30
30
  getDelegationHashOffchain,
31
31
  toDelegation,
32
32
  toDelegationStruct
33
- } from "../chunk-UUDQWENY.mjs";
33
+ } from "../chunk-Q6ZTEHYY.mjs";
34
34
  export {
35
35
  CaveatBuilder,
36
36
  DELEGATION_ABI_TYPE_COMPONENTS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/smart-accounts-kit",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Toolkit for managing and interacting with MetaMask Smart Accounts, built on Viem",
6
6
  "license": "(MIT-0 OR Apache-2.0)",
@@ -113,10 +113,10 @@
113
113
  }
114
114
  },
115
115
  "dependencies": {
116
- "@metamask/7715-permission-types": "^0.3.0",
116
+ "@metamask/7715-permission-types": "^0.4.0",
117
117
  "@metamask/delegation-abis": "^0.11.0",
118
- "@metamask/delegation-core": "^0.2.0",
119
- "@metamask/delegation-deployments": "^0.14.0",
118
+ "@metamask/delegation-core": "^0.3.0",
119
+ "@metamask/delegation-deployments": "^0.15.0",
120
120
  "buffer": "^6.0.3",
121
121
  "webauthn-p256": "^0.0.10"
122
122
  },
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/actions/index.ts","../src/actions/erc7710RedeemDelegationAction.ts","../src/actions/erc7715RequestExecutionPermissionsAction.ts","../src/actions/getCaveatAvailableAmount.ts","../src/actions/isValid7702Implementation.ts","../src/actions/signDelegation.ts","../src/actions/signUserOperation.ts"],"sourcesContent":["import type { Client, WalletClient } from 'viem';\nimport type { BundlerClient } from 'viem/account-abstraction';\n\nimport type {\n SendTransactionWithDelegationParameters,\n SendUserOperationWithDelegationParameters,\n} from './erc7710RedeemDelegationAction';\nimport {\n sendTransactionWithDelegationAction,\n sendUserOperationWithDelegationAction,\n} from './erc7710RedeemDelegationAction';\nimport { erc7715RequestExecutionPermissionsAction } from './erc7715RequestExecutionPermissionsAction';\nimport type {\n MetaMaskExtensionClient,\n RequestExecutionPermissionsParameters,\n} from './erc7715RequestExecutionPermissionsAction';\n\nexport {\n // Individual action functions\n getErc20PeriodTransferEnforcerAvailableAmount,\n getErc20StreamingEnforcerAvailableAmount,\n getMultiTokenPeriodEnforcerAvailableAmount,\n getNativeTokenPeriodTransferEnforcerAvailableAmount,\n getNativeTokenStreamingEnforcerAvailableAmount,\n // Action builder\n caveatEnforcerActions,\n // Parameter types\n type CaveatEnforcerParams,\n // Result types\n type PeriodTransferResult,\n type StreamingResult,\n} from './getCaveatAvailableAmount';\n\nexport { isValid7702Implementation } from './isValid7702Implementation';\n\n// Signing actions\nexport {\n signDelegation,\n signDelegationActions,\n type SignDelegationParameters,\n type SignDelegationReturnType,\n} from './signDelegation';\n\nexport {\n signUserOperation,\n signUserOperationActions,\n type SignUserOperationParameters,\n type SignUserOperationReturnType,\n} from './signUserOperation';\n\nexport {\n erc7715RequestExecutionPermissionsAction as requestExecutionPermissions,\n type MetaMaskExtensionClient,\n type MetaMaskExtensionSchema,\n type RequestExecutionPermissionsParameters,\n type RequestExecutionPermissionsReturnType,\n} from './erc7715RequestExecutionPermissionsAction';\n\nexport type { DelegatedCall } from './erc7710RedeemDelegationAction';\n\nexport const erc7715ProviderActions = () => (client: Client) => ({\n requestExecutionPermissions: async (\n parameters: RequestExecutionPermissionsParameters,\n ) => {\n return erc7715RequestExecutionPermissionsAction(\n client as MetaMaskExtensionClient,\n parameters,\n );\n },\n});\n\nexport const erc7710WalletActions = () => (client: WalletClient) => ({\n sendTransactionWithDelegation: async (\n args: SendTransactionWithDelegationParameters,\n ) => sendTransactionWithDelegationAction(client, args),\n});\n\nexport const erc7710BundlerActions = () => (client: Client) => ({\n sendUserOperationWithDelegation: async (\n args: SendUserOperationWithDelegationParameters,\n ) => sendUserOperationWithDelegationAction(client as BundlerClient, args),\n});\n","import { DelegationManager } from '@metamask/delegation-abis';\nimport type {\n Account,\n Chain,\n Hex,\n OneOf,\n PublicClient,\n SendTransactionParameters,\n SendTransactionRequest,\n Transport,\n WalletClient,\n} from 'viem';\nimport { concat, encodeFunctionData, isAddressEqual } from 'viem';\nimport type {\n BundlerClient,\n SendUserOperationParameters,\n SmartAccount,\n} from 'viem/account-abstraction';\n\nimport {\n createExecution,\n encodeExecutionCalldatas,\n ExecutionMode,\n} from '../executions';\nimport { getSmartAccountsEnvironment } from '../smartAccountsEnvironment';\nimport type { Call } from '../types';\n\nexport type DelegatedCall = Call &\n OneOf<{ permissionsContext: Hex; delegationManager: Hex } | object>;\n\nexport type SendTransactionWithDelegationParameters<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends Account | undefined = Account | undefined,\n TChainOverride extends Chain | undefined = Chain | undefined,\n TRequest extends SendTransactionRequest<\n TChain,\n TChainOverride\n > = SendTransactionRequest<TChain, TChainOverride>,\n> = SendTransactionParameters<TChain, TAccount, TChainOverride, TRequest> & {\n permissionsContext: Hex;\n delegationManager: Hex;\n};\n\n/**\n * Sends a transaction using delegation to execute operations on behalf of another account.\n *\n * @param client - The wallet client to use for sending the transaction.\n * @param args - Transaction parameters with delegation details.\n * @returns Transaction hash of the executed transaction.\n */\nexport async function sendTransactionWithDelegationAction<\n TChain extends Chain | undefined,\n TAccount extends Account | undefined,\n>(\n client: WalletClient<Transport, TChain, TAccount>,\n args: SendTransactionWithDelegationParameters<TChain, TAccount>,\n) {\n if (!args.to) {\n throw new Error(\n '`to` is required. `sendTransactionWithDelegation` cannot be used to deploy contracts.',\n );\n }\n\n const executions = [\n createExecution({\n target: args.to,\n value: args.value,\n callData: args.data,\n }),\n ];\n\n const calldata = encodeFunctionData({\n abi: DelegationManager.abi,\n functionName: 'redeemDelegations',\n args: [\n [args.permissionsContext],\n [ExecutionMode.SingleDefault],\n encodeExecutionCalldatas([executions]),\n ],\n });\n\n const {\n value: _value,\n permissionsContext: _permissionsContext,\n delegationManager: _delegationManager,\n ...rest\n } = args;\n\n const hash = await client.sendTransaction({\n ...rest,\n to: args.delegationManager,\n data: calldata,\n } as unknown as SendTransactionParameters);\n\n return hash;\n}\n\nexport type SendUserOperationWithDelegationParameters<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n TAccountOverride extends SmartAccount | undefined = SmartAccount | undefined,\n> = SendUserOperationParameters<TAccount, TAccountOverride, DelegatedCall[]> & {\n accountMetadata?: { factory: Hex; factoryData: Hex }[];\n calls: DelegatedCall[];\n publicClient: PublicClient<Transport, Chain>;\n};\n\n/**\n * Broadcasts a User Operation with delegation to the Bundler.\n *\n * @param client - Client to use for sending the user operation.\n * @param parameters - Parameters for the user operation with delegation.\n * @returns The User Operation hash of the broadcasted operation.\n * @example\n * import { createBundlerClient, http } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const bundlerClient = createBundlerClient({\n * chain: mainnet,\n * transport: http(),\n * })\n *\n * const userOpHash = await sendUserOperationWithDelegationAction(bundlerClient, {\n * account: bobSmartAccount,\n * calls: [\n * {\n * to: aliceCounterContractAddress,\n * data: encodeFunctionData({\n * abi: CounterMetadata.abi,\n * functionName: 'increment',\n * }),\n * value: 0n,\n * permissionsContext: '0x...',\n * delegationManager: '0x...',\n * },\n * ],\n * accountMetadata: [{ factory: '0x...', factoryData: '0x...' }], // Optional: for deploying accounts\n * })\n */\nexport async function sendUserOperationWithDelegationAction<\n TAccount extends SmartAccount | undefined,\n TAccountOverride extends SmartAccount | undefined = undefined,\n>(\n client: BundlerClient<Transport, Chain | undefined, TAccount>,\n parameters: SendUserOperationWithDelegationParameters<\n TAccount,\n TAccountOverride\n >,\n) {\n if (parameters.accountMetadata) {\n const { publicClient } = parameters;\n\n const includedAccountKeys: Record<Hex, boolean> = {};\n\n const chainId = publicClient.chain?.id;\n\n if (!chainId) {\n throw new Error('Chain ID is not set');\n }\n\n const { SimpleFactory } = getSmartAccountsEnvironment(chainId);\n\n const uniqueAccountMetadatas = parameters.accountMetadata.filter(\n (accountMetadata) => {\n if (!isAddressEqual(accountMetadata.factory, SimpleFactory)) {\n throw new Error(\n `Invalid accountMetadata: ${accountMetadata.factory} is not allowed.`,\n );\n }\n\n // ensure that factory calls are not duplicated\n const accountKey = concat([\n accountMetadata.factory,\n accountMetadata.factoryData,\n ]);\n const isDuplicate = includedAccountKeys[accountKey];\n\n includedAccountKeys[accountKey] = true;\n return !isDuplicate;\n },\n );\n\n const factoryCalls = (\n await Promise.all(\n uniqueAccountMetadatas.map(async ({ factory, factoryData }) => {\n const isDeployed = await publicClient\n .call({\n to: factory,\n data: factoryData,\n })\n .then(() => false)\n .catch(() => true);\n\n if (isDeployed) {\n return undefined;\n }\n return {\n to: factory,\n value: 0n,\n data: factoryData,\n };\n }),\n )\n ).filter((call: Call | undefined) => call !== undefined) as Call[];\n\n parameters.calls = [\n ...(factoryCalls as DelegatedCall[]),\n ...parameters.calls,\n ];\n }\n\n return client.sendUserOperation(\n parameters as unknown as SendUserOperationParameters,\n );\n}\n","import type {\n AccountSigner,\n Erc20TokenPeriodicPermission,\n Erc20TokenStreamPermission,\n NativeTokenPeriodicPermission,\n NativeTokenStreamPermission,\n PermissionRequest,\n PermissionResponse,\n PermissionTypes,\n Rule,\n} from '@metamask/7715-permission-types';\nimport { isHex, toHex } from 'viem';\nimport type {\n Client,\n Account,\n RpcSchema,\n Transport,\n Chain,\n Address,\n} from 'viem';\n\n/**\n * RPC schema for MetaMask related methods.\n *\n * Extends the base RPC schema with methods specific to interacting with EIP-7715:\n * - `wallet_invokeSnap`: Invokes a method on a specific Snap.\n */\nexport type MetaMaskExtensionSchema = RpcSchema &\n [\n {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Method: 'wallet_requestExecutionPermissions';\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Params: PermissionRequest<AccountSigner, PermissionTypes>[];\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ReturnType: PermissionResponse<AccountSigner, PermissionTypes>[];\n },\n ];\n\n/**\n * A Viem client extended with MetaMask Snap-specific RPC methods.\n *\n * This client type allows for interaction with MetaMask Snaps through\n * the standard Viem client interface, with added type safety for\n * Snap-specific methods.\n */\nexport type MetaMaskExtensionClient = Client<\n Transport,\n Chain | undefined,\n Account | undefined,\n MetaMaskExtensionSchema\n>;\n\ntype PermissionParameter = {\n type: string;\n data: Record<string, unknown>;\n};\n\n/**\n * Represents a native token stream permission.\n * This allows for continuous token streaming with defined parameters.\n */\nexport type NativeTokenStreamPermissionParameter = PermissionParameter & {\n type: 'native-token-stream';\n data: {\n amountPerSecond: bigint;\n initialAmount?: bigint;\n maxAmount?: bigint;\n startTime?: number;\n justification?: string;\n };\n};\n\n/**\n * Represents an ERC-20 token stream permission.\n * This allows for continuous ERC-20 token streaming with defined parameters.\n */\nexport type Erc20TokenStreamPermissionParameter = PermissionParameter & {\n type: 'erc20-token-stream';\n data: {\n tokenAddress: Address;\n amountPerSecond: bigint;\n initialAmount?: bigint;\n maxAmount?: bigint;\n startTime?: number;\n justification?: string;\n };\n};\n\n/**\n * Represents a native token periodic permission.\n * This allows for periodic native token transfers with defined parameters.\n */\nexport type NativeTokenPeriodicPermissionParameter = PermissionParameter & {\n type: 'native-token-periodic';\n data: {\n periodAmount: bigint;\n periodDuration: number;\n startTime?: number;\n justification?: string;\n };\n};\n\n/**\n * Represents an ERC-20 token periodic permission.\n * This allows for periodic ERC-20 token transfers with defined parameters.\n */\nexport type Erc20TokenPeriodicPermissionParameter = PermissionParameter & {\n type: 'erc20-token-periodic';\n data: {\n tokenAddress: Address;\n periodAmount: bigint;\n periodDuration: number;\n startTime?: number;\n justification?: string;\n };\n};\n\nexport type SupportedPermissionParams =\n | NativeTokenStreamPermissionParameter\n | Erc20TokenStreamPermissionParameter\n | NativeTokenPeriodicPermissionParameter\n | Erc20TokenPeriodicPermissionParameter;\n\nexport type SignerParam = Address | AccountSigner;\n\n/**\n * Represents a single permission request.\n */\nexport type PermissionRequestParameter = {\n chainId: number;\n // The permission to grant to the user.\n permission: SupportedPermissionParams;\n // Whether the caller allows the permission to be adjusted.\n isAdjustmentAllowed: boolean;\n // Account to assign the permission to.\n signer: SignerParam;\n // address from which the permission should be granted.\n address?: Address;\n // Timestamp (in seconds) that specifies the time by which this permission MUST expire.\n expiry: number;\n};\n\n/**\n * Parameters for the RequestExecutionPermissions action.\n *\n * @template Signer - The type of the signer, either an Address or Account.\n */\nexport type RequestExecutionPermissionsParameters =\n PermissionRequestParameter[];\n\n/**\n * Return type for the request execution permissions action.\n */\nexport type RequestExecutionPermissionsReturnType = PermissionResponse<\n AccountSigner,\n PermissionTypes\n>[];\n\n/**\n * Grants permissions according to EIP-7715 specification.\n *\n * @template Signer - The type of the signer, either an Address or Account.\n * @param client - The client to use for the request.\n * @param parameters - The permissions requests to grant.\n * @returns A promise that resolves to the permission responses.\n * @description\n * This function formats the permissions requests and invokes the wallet method to grant permissions.\n * It will throw an error if the permissions could not be granted.\n */\nexport async function erc7715RequestExecutionPermissionsAction(\n client: MetaMaskExtensionClient,\n parameters: RequestExecutionPermissionsParameters,\n): Promise<RequestExecutionPermissionsReturnType> {\n const formattedPermissionRequest = parameters.map(formatPermissionsRequest);\n\n const result = await client.request(\n {\n method: 'wallet_requestExecutionPermissions',\n params: formattedPermissionRequest,\n },\n { retryCount: 0 },\n );\n\n if (!result) {\n throw new Error('Failed to grant permissions');\n }\n\n return result;\n}\n\n/**\n * Formats a permissions request for submission to the wallet.\n *\n * @param parameters - The permissions request to format.\n * @returns The formatted permissions request.\n * @internal\n */\nfunction formatPermissionsRequest(\n parameters: PermissionRequestParameter,\n): PermissionRequest<AccountSigner, PermissionTypes> {\n const { chainId, address, expiry, isAdjustmentAllowed } = parameters;\n\n const permissionFormatter = getPermissionFormatter(\n parameters.permission.type,\n );\n\n const signerAddress =\n typeof parameters.signer === 'string'\n ? parameters.signer\n : parameters.signer.data.address;\n\n const rules: Rule[] = [\n {\n type: 'expiry',\n isAdjustmentAllowed,\n data: {\n timestamp: expiry,\n },\n },\n ];\n\n const optionalFields = {\n ...(address ? { address } : {}),\n };\n\n return {\n ...optionalFields,\n chainId: toHex(chainId),\n permission: permissionFormatter({\n permission: parameters.permission,\n isAdjustmentAllowed,\n }),\n signer: {\n // MetaMask 7715 implementation only supports AccountSigner\n type: 'account',\n data: {\n address: signerAddress,\n },\n },\n rules,\n };\n}\n\n/**\n * Checks if a value is defined (not null or undefined).\n *\n * @param value - The value to check.\n * @returns A boolean indicating whether the value is defined.\n */\nfunction isDefined<TValue>(value: TValue | null | undefined): value is TValue {\n return value !== undefined && value !== null;\n}\n\n/**\n * Asserts that a value is defined (not null or undefined).\n *\n * @param value - The value to check.\n * @param message - Optional custom error message to throw if the value is not defined.\n * @throws {Error} If the value is null or undefined.\n */\nfunction assertIsDefined<TValue>(\n value: TValue | null | undefined,\n message?: string,\n): asserts value is TValue {\n if (!isDefined(value)) {\n throw new Error(message ?? 'Invalid parameters: value is required');\n }\n}\n\n/**\n * Converts a value to a hex string or throws an error if the value is invalid.\n *\n * @param value - The value to convert to hex.\n * @param message - Optional custom error message.\n * @returns The value as a hex string.\n */\nfunction toHexOrThrow(\n value: Parameters<typeof toHex>[0] | undefined,\n message?: string,\n) {\n assertIsDefined(value, message);\n\n if (typeof value === 'string') {\n if (!isHex(value)) {\n throw new Error('Invalid parameters: invalid hex value');\n }\n return value;\n }\n\n return toHex(value);\n}\n\ntype PermissionFormatter = (params: {\n permission: PermissionParameter;\n isAdjustmentAllowed: boolean;\n}) => PermissionTypes;\n\n/**\n * Gets the appropriate formatter function for a specific permission type.\n *\n * @param permissionType - The type of permission to format.\n * @returns A formatter function for the specified permission type.\n */\nfunction getPermissionFormatter(permissionType: string): PermissionFormatter {\n switch (permissionType) {\n case 'native-token-stream':\n return ({ permission, isAdjustmentAllowed }) =>\n formatNativeTokenStreamPermission({\n permission: permission as NativeTokenStreamPermissionParameter,\n isAdjustmentAllowed,\n });\n case 'erc20-token-stream':\n return ({ permission, isAdjustmentAllowed }) =>\n formatErc20TokenStreamPermission({\n permission: permission as Erc20TokenStreamPermissionParameter,\n isAdjustmentAllowed,\n });\n\n case 'native-token-periodic':\n return ({ permission, isAdjustmentAllowed }) =>\n formatNativeTokenPeriodicPermission({\n permission: permission as NativeTokenPeriodicPermissionParameter,\n isAdjustmentAllowed,\n });\n case 'erc20-token-periodic':\n return ({ permission, isAdjustmentAllowed }) =>\n formatErc20TokenPeriodicPermission({\n permission: permission as Erc20TokenPeriodicPermissionParameter,\n isAdjustmentAllowed,\n });\n default:\n throw new Error(`Unsupported permission type: ${permissionType}`);\n }\n}\n\n/**\n * Formats a native token stream permission for the wallet.\n *\n * @param permission - The native token stream permission to format.\n * @param permission.permission - The native token stream permission to format.\n * @param permission.isAdjustmentAllowed - Whether the permission is allowed to be adjusted.\n * @returns The formatted permission object.\n */\nfunction formatNativeTokenStreamPermission({\n permission,\n isAdjustmentAllowed,\n}: {\n permission: NativeTokenStreamPermissionParameter;\n isAdjustmentAllowed: boolean;\n}): NativeTokenStreamPermission {\n const {\n data: {\n initialAmount,\n justification,\n maxAmount,\n startTime,\n amountPerSecond,\n },\n } = permission;\n\n const optionalFields = {\n ...(isDefined(initialAmount) && {\n initialAmount: toHexOrThrow(initialAmount),\n }),\n ...(isDefined(maxAmount) && {\n maxAmount: toHexOrThrow(maxAmount),\n }),\n ...(isDefined(startTime) && {\n startTime: Number(startTime),\n }),\n ...(justification ? { justification } : {}),\n };\n\n return {\n type: 'native-token-stream',\n data: {\n amountPerSecond: toHexOrThrow(\n amountPerSecond,\n 'Invalid parameters: amountPerSecond is required',\n ),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Formats an ERC-20 token stream permission parameter into the required\n * Erc20TokenStreamPermission object, converting numeric values to hex strings\n * and including only specified optional fields.\n *\n * @param params - The parameters for formatting the ERC-20 token stream permission.\n * @param params.permission - The ERC-20 token stream permission parameter to format.\n * @param params.isAdjustmentAllowed - Whether adjustment of the stream is allowed.\n * @returns The formatted Erc20TokenStreamPermission object.\n */\nfunction formatErc20TokenStreamPermission({\n permission,\n isAdjustmentAllowed,\n}: {\n permission: Erc20TokenStreamPermissionParameter;\n isAdjustmentAllowed: boolean;\n}): Erc20TokenStreamPermission {\n const {\n data: {\n tokenAddress,\n amountPerSecond,\n initialAmount,\n startTime,\n maxAmount,\n justification,\n },\n } = permission;\n\n const optionalFields = {\n ...(isDefined(initialAmount) && {\n initialAmount: toHexOrThrow(initialAmount),\n }),\n ...(isDefined(maxAmount) && {\n maxAmount: toHexOrThrow(maxAmount),\n }),\n ...(isDefined(startTime) && {\n startTime: Number(startTime),\n }),\n ...(justification ? { justification } : {}),\n };\n\n return {\n type: 'erc20-token-stream',\n data: {\n tokenAddress: toHexOrThrow(tokenAddress),\n amountPerSecond: toHexOrThrow(amountPerSecond),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Formats a native token periodic permission for submission to the wallet.\n *\n * @param params - The parameters for formatting the native token periodic permission.\n * @param params.permission - The native token periodic permission parameter to format.\n * @param params.isAdjustmentAllowed - Whether the permission is allowed to be adjusted.\n * @returns The formatted NativeTokenPeriodicPermission object.\n */\nfunction formatNativeTokenPeriodicPermission({\n permission,\n isAdjustmentAllowed,\n}: {\n permission: NativeTokenPeriodicPermissionParameter;\n isAdjustmentAllowed: boolean;\n}): NativeTokenPeriodicPermission {\n const {\n data: { periodAmount, periodDuration, startTime, justification },\n } = permission;\n\n const optionalFields = {\n ...(isDefined(startTime) && {\n startTime: Number(startTime),\n }),\n ...(justification ? { justification } : {}),\n };\n\n return {\n type: 'native-token-periodic',\n data: {\n periodAmount: toHexOrThrow(periodAmount),\n periodDuration: Number(periodDuration),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n\n/**\n * Formats an ERC20 token periodic permission for submission to the wallet.\n *\n * @param params - The parameters for formatting the ERC20 token periodic permission.\n * @param params.permission - The ERC20 token periodic permission parameter to format.\n * @param params.isAdjustmentAllowed - Whether the permission is allowed to be adjusted.\n * @returns The formatted Erc20TokenPeriodicPermission object.\n */\nfunction formatErc20TokenPeriodicPermission({\n permission,\n isAdjustmentAllowed,\n}: {\n permission: Erc20TokenPeriodicPermissionParameter;\n isAdjustmentAllowed: boolean;\n}): Erc20TokenPeriodicPermission {\n const {\n data: {\n tokenAddress,\n periodAmount,\n periodDuration,\n startTime,\n justification,\n },\n } = permission;\n\n const optionalFields = {\n ...(isDefined(startTime) && {\n startTime: Number(startTime),\n }),\n ...(justification ? { justification } : {}),\n };\n\n return {\n type: 'erc20-token-periodic',\n data: {\n tokenAddress: toHexOrThrow(tokenAddress),\n periodAmount: toHexOrThrow(periodAmount),\n periodDuration: Number(periodDuration),\n ...optionalFields,\n },\n isAdjustmentAllowed,\n };\n}\n","import type { Address, Hex, Client } from 'viem';\n\nimport { getDelegationHashOffchain } from '../delegation';\nimport * as ERC20PeriodTransferEnforcer from '../DelegationFramework/ERC20PeriodTransferEnforcer';\nimport * as ERC20StreamingEnforcer from '../DelegationFramework/ERC20StreamingEnforcer';\nimport * as MultiTokenPeriodEnforcer from '../DelegationFramework/MultiTokenPeriodEnforcer';\nimport * as NativeTokenPeriodTransferEnforcer from '../DelegationFramework/NativeTokenPeriodTransferEnforcer';\nimport * as NativeTokenStreamingEnforcer from '../DelegationFramework/NativeTokenStreamingEnforcer';\nimport type { SmartAccountsEnvironment, Delegation } from '../types';\n\n/**\n * Parameters for all caveat enforcer actions.\n */\nexport type CaveatEnforcerParams = {\n delegation: Delegation;\n};\n\n/**\n * Return type for period-based transfer enforcers\n */\nexport type PeriodTransferResult = {\n availableAmount: bigint;\n isNewPeriod: boolean;\n currentPeriod: bigint;\n};\n\n/**\n * Return type for streaming enforcers\n */\nexport type StreamingResult = {\n availableAmount: bigint;\n};\n\n/**\n * Finds a caveat that matches the specified enforcer address.\n * @param config - The configuration object.\n * @param config.delegation - The delegation to search.\n * @param config.enforcerAddress - The enforcer address to match.\n * @param config.enforcerName - The name of the enforcer.\n * @returns The matching caveat.\n * @throws Error if no matching caveat is found.\n * @throws Error if multiple matching caveats are found.\n */\nfunction findMatchingCaveat({\n delegation,\n enforcerAddress,\n enforcerName,\n}: {\n delegation: Delegation;\n enforcerAddress: Address;\n enforcerName: keyof SmartAccountsEnvironment['caveatEnforcers'];\n}): { terms: Hex; args: Hex } {\n const matchingCaveats = delegation.caveats.filter(\n (caveat) => caveat.enforcer.toLowerCase() === enforcerAddress.toLowerCase(),\n );\n\n if (matchingCaveats.length === 0) {\n throw new Error(`No caveat found with enforcer matching ${enforcerName}`);\n }\n\n if (matchingCaveats.length > 1) {\n throw new Error(\n `Multiple caveats found with enforcer matching ${enforcerName}`,\n );\n }\n\n const [{ terms, args }] = matchingCaveats as unknown as [\n { terms: Hex; args: Hex },\n ];\n\n return {\n terms,\n args,\n };\n}\n\n/**\n * Gets the delegation manager address from environment.\n *\n * @param environment - The SmartAccountsEnvironment.\n * @returns The delegation manager address.\n */\nfunction getDelegationManager(environment: SmartAccountsEnvironment): Address {\n if (!environment.DelegationManager) {\n throw new Error('Delegation manager address not found');\n }\n\n return environment.DelegationManager;\n}\n\n/**\n * Gets the enforcer address from environment.\n *\n * @param config - The configuration object.\n * @param config.enforcerName - The name of the enforcer.\n * @param config.environment - The SmartAccountsEnvironment.\n * @returns The enforcer address.\n */\nfunction getEnforcerAddress({\n enforcerName,\n environment,\n}: {\n enforcerName: keyof SmartAccountsEnvironment['caveatEnforcers'];\n environment: SmartAccountsEnvironment;\n}): Address {\n const enforcerAddress = environment.caveatEnforcers[enforcerName];\n if (!enforcerAddress) {\n throw new Error(`${enforcerName} not found in environment`);\n }\n\n return enforcerAddress;\n}\n\n/**\n * Get available amount for ERC20 period transfer enforcer.\n *\n * @param client - The viem client.\n * @param environment - The SmartAccountsEnvironment.\n * @param params - The parameters for the ERC20 period transfer enforcer.\n * @returns Promise resolving to the period transfer result.\n */\nexport async function getErc20PeriodTransferEnforcerAvailableAmount(\n client: Client,\n environment: SmartAccountsEnvironment,\n params: CaveatEnforcerParams,\n): Promise<PeriodTransferResult> {\n const enforcerName = 'ERC20PeriodTransferEnforcer';\n\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = getDelegationHashOffchain(params.delegation);\n const { terms } = findMatchingCaveat({\n delegation: params.delegation,\n enforcerAddress,\n enforcerName,\n });\n\n return ERC20PeriodTransferEnforcer.read.getAvailableAmount({\n client,\n contractAddress: enforcerAddress,\n delegationHash,\n delegationManager,\n terms,\n });\n}\n\n/**\n * Get available amount for ERC20 streaming enforcer.\n *\n * @param client - The viem client.\n * @param environment - The SmartAccountsEnvironment.\n * @param params - The parameters for the ERC20 streaming enforcer.\n * @returns Promise resolving to the streaming result.\n */\nexport async function getErc20StreamingEnforcerAvailableAmount(\n client: Client,\n environment: SmartAccountsEnvironment,\n params: CaveatEnforcerParams,\n): Promise<StreamingResult> {\n const enforcerName = 'ERC20StreamingEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = getDelegationHashOffchain(params.delegation);\n const { terms } = findMatchingCaveat({\n delegation: params.delegation,\n enforcerAddress,\n enforcerName,\n });\n\n return ERC20StreamingEnforcer.read.getAvailableAmount({\n client,\n contractAddress: enforcerAddress,\n delegationManager,\n delegationHash,\n terms,\n });\n}\n\n/**\n * Get available amount for multi-token period enforcer.\n *\n * @param client - The viem client.\n * @param environment - The SmartAccountsEnvironment.\n * @param params - The parameters for the multi-token period enforcer.\n * @returns Promise resolving to the period transfer result.\n */\nexport async function getMultiTokenPeriodEnforcerAvailableAmount(\n client: Client,\n environment: SmartAccountsEnvironment,\n params: CaveatEnforcerParams,\n): Promise<PeriodTransferResult> {\n const enforcerName = 'MultiTokenPeriodEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = getDelegationHashOffchain(params.delegation);\n const { terms, args } = findMatchingCaveat({\n delegation: params.delegation,\n enforcerAddress,\n enforcerName,\n });\n\n return MultiTokenPeriodEnforcer.read.getAvailableAmount({\n client,\n contractAddress: enforcerAddress,\n delegationHash,\n delegationManager,\n terms,\n args,\n });\n}\n\n/**\n * Get available amount for native token period transfer enforcer.\n *\n * @param client - The viem client.\n * @param environment - The SmartAccountsEnvironment.\n * @param params - The parameters for the native token period transfer enforcer.\n * @returns Promise resolving to the period transfer result.\n */\nexport async function getNativeTokenPeriodTransferEnforcerAvailableAmount(\n client: Client,\n environment: SmartAccountsEnvironment,\n params: CaveatEnforcerParams,\n): Promise<PeriodTransferResult> {\n const enforcerName = 'NativeTokenPeriodTransferEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = getDelegationHashOffchain(params.delegation);\n const { terms } = findMatchingCaveat({\n delegation: params.delegation,\n enforcerAddress,\n enforcerName,\n });\n\n return NativeTokenPeriodTransferEnforcer.read.getAvailableAmount({\n client,\n contractAddress: enforcerAddress,\n delegationHash,\n delegationManager,\n terms,\n });\n}\n\n/**\n * Get available amount for native token streaming enforcer.\n *\n * @param client - The viem client.\n * @param environment - The SmartAccountsEnvironment.\n * @param params - The parameters for the native token streaming enforcer.\n * @returns Promise resolving to the streaming result.\n */\nexport async function getNativeTokenStreamingEnforcerAvailableAmount(\n client: Client,\n environment: SmartAccountsEnvironment,\n params: CaveatEnforcerParams,\n): Promise<StreamingResult> {\n const enforcerName = 'NativeTokenStreamingEnforcer';\n const delegationManager = getDelegationManager(environment);\n const enforcerAddress = getEnforcerAddress({\n enforcerName,\n environment,\n });\n\n const delegationHash = getDelegationHashOffchain(params.delegation);\n const { terms } = findMatchingCaveat({\n delegation: params.delegation,\n enforcerAddress,\n enforcerName,\n });\n\n return NativeTokenStreamingEnforcer.read.getAvailableAmount({\n client,\n contractAddress: enforcerAddress,\n delegationManager,\n delegationHash,\n terms,\n });\n}\n\n/**\n * Caveat enforcer actions for extending viem clients.\n *\n * @param params - The parameters object.\n * @param params.environment - The SmartAccountsEnvironment.\n * @returns A function that takes a client and returns the client extension with caveat enforcer actions.\n */\nexport const caveatEnforcerActions =\n ({ environment }: { environment: SmartAccountsEnvironment }) =>\n (client: Client) => ({\n /**\n * Get available amount for ERC20 period transfer enforcer.\n *\n * @param params - The parameters for the ERC20 period transfer enforcer.\n * @returns Promise resolving to the period transfer result.\n */\n getErc20PeriodTransferEnforcerAvailableAmount: async (\n params: CaveatEnforcerParams,\n ): Promise<PeriodTransferResult> => {\n return getErc20PeriodTransferEnforcerAvailableAmount(\n client,\n environment,\n params,\n );\n },\n\n /**\n * Get available amount for ERC20 streaming enforcer.\n *\n * @param params - The parameters for the ERC20 streaming enforcer.\n * @returns Promise resolving to the streaming result.\n */\n getErc20StreamingEnforcerAvailableAmount: async (\n params: CaveatEnforcerParams,\n ): Promise<StreamingResult> => {\n return getErc20StreamingEnforcerAvailableAmount(\n client,\n environment,\n params,\n );\n },\n\n /**\n * Get available amount for multi-token period enforcer.\n *\n * @param params - The parameters for the multi-token period enforcer.\n * @returns Promise resolving to the period transfer result.\n */\n getMultiTokenPeriodEnforcerAvailableAmount: async (\n params: CaveatEnforcerParams,\n ): Promise<PeriodTransferResult> => {\n return getMultiTokenPeriodEnforcerAvailableAmount(\n client,\n environment,\n params,\n );\n },\n\n /**\n * Get available amount for native token period transfer enforcer.\n *\n * @param params - The parameters for the native token period transfer enforcer.\n * @returns Promise resolving to the period transfer result.\n */\n getNativeTokenPeriodTransferEnforcerAvailableAmount: async (\n params: CaveatEnforcerParams,\n ): Promise<PeriodTransferResult> => {\n return getNativeTokenPeriodTransferEnforcerAvailableAmount(\n client,\n environment,\n params,\n );\n },\n\n /**\n * Get available amount for native token streaming enforcer.\n *\n * @param params - The parameters for the native token streaming enforcer.\n * @returns Promise resolving to the streaming result.\n */\n getNativeTokenStreamingEnforcerAvailableAmount: async (\n params: CaveatEnforcerParams,\n ): Promise<StreamingResult> => {\n return getNativeTokenStreamingEnforcerAvailableAmount(\n client,\n environment,\n params,\n );\n },\n });\n","import type { Client, Address, Hex } from 'viem';\nimport { isAddressEqual } from 'viem';\nimport { getCode } from 'viem/actions';\n\nimport type { SmartAccountsEnvironment } from '../types';\n\n// EIP-7702 delegation prefix (0xef0100)\nconst DELEGATION_PREFIX = '0xef0100' as const;\n\n/**\n * Parameters for checking if an account is delegated to the EIP-7702 implementation.\n */\nexport type IsValid7702ImplementationParameters = {\n /** The client to use for the query. */\n client: Client;\n /** The address to check for proper delegation. */\n accountAddress: Address;\n /** The SmartAccountsEnvironment containing contract addresses. */\n environment: SmartAccountsEnvironment;\n};\n\n/**\n * Extracts the delegated contract address from EIP-7702 delegation code.\n *\n * @param code - The code returned from getCode for a delegated account.\n * @returns The delegated contract address or null if not a valid delegation.\n */\nfunction extractDelegatedAddress(code: Hex | undefined): Address | null {\n if (code?.length !== 48) {\n // 0x (2 chars) + ef0100 (6 chars) + address (40 chars) = 48 chars\n return null;\n }\n\n if (!code.toLowerCase().startsWith(DELEGATION_PREFIX.toLowerCase())) {\n return null;\n }\n\n // Extract the 20-byte address after the delegation prefix\n const addressHex = code.slice(8); // Remove '0xef0100' prefix (8 chars)\n return `0x${addressHex}`;\n}\n\n/**\n * Checks if an account is properly delegated to the EIP-7702 implementation.\n *\n * This function validates EIP-7702 delegations by checking if the EOA has a 7702\n * contract assigned to it and comparing the delegated address against the 7702\n * implementation found in the environment.\n *\n * @param params - The parameters for checking the delegation.\n * @param params.client - The client to use for the query.\n * @param params.accountAddress - The address to check for proper delegation.\n * @param params.environment - The SmartAccountsEnvironment containing contract addresses.\n * @returns A promise that resolves to true if the account is properly delegated to the 7702 implementation, false otherwise.\n * @example\n * ```typescript\n * const isValid = await isValid7702Implementation({\n * client: publicClient,\n * accountAddress: '0x...',\n * environment: smartAccountEnvironment,\n * });\n *\n * if (isValid) {\n * console.log('Account is properly delegated to EIP-7702 implementation');\n * } else {\n * console.log('Account is not properly delegated');\n * }\n * ```\n */\nexport async function isValid7702Implementation({\n client,\n accountAddress,\n environment,\n}: IsValid7702ImplementationParameters): Promise<boolean> {\n try {\n // Get the code at the account address\n const code = await getCode(client, {\n address: accountAddress,\n });\n\n // Extract the delegated contract address from the EIP-7702 delegation code\n const delegatedAddress = extractDelegatedAddress(code);\n\n // If no valid delegation found, return false\n if (!delegatedAddress) {\n return false;\n }\n\n // Compare the delegated address with the 7702 implementation in the environment\n const expectedImplementation =\n environment.implementations.EIP7702StatelessDeleGatorImpl;\n if (!expectedImplementation) {\n return false;\n }\n\n return isAddressEqual(delegatedAddress, expectedImplementation);\n } catch (error) {\n // If the call fails (e.g., no code at address, network error),\n // then it's not properly delegated to our implementation\n return false;\n }\n}\n","import type {\n Account,\n Address,\n Chain,\n Client,\n Hex,\n Transport,\n WalletClient,\n} from 'viem';\nimport { BaseError } from 'viem';\nimport { parseAccount } from 'viem/accounts';\n\nimport { prepareSignDelegationTypedData } from '../delegation';\nimport type { Delegation } from '../types';\n\nexport type SignDelegationParameters = {\n /** Account to sign with */\n account?: Account | Address;\n /** The delegation to sign */\n delegation: Omit<Delegation, 'signature'>;\n /** The address of the delegation manager contract */\n delegationManager: Address;\n /** The chain ID for the signature */\n chainId: number;\n /** The name of the contract */\n name?: string;\n /** The version of the contract */\n version?: string;\n /** Whether to allow insecure unrestricted delegation */\n allowInsecureUnrestrictedDelegation?: boolean;\n};\n\nexport type SignDelegationReturnType = Hex;\n\n/**\n * Signs a delegation using a wallet client.\n * @param client - The wallet client to use for signing.\n * @param parameters - The parameters for signing the delegation.\n * @returns The signature of the delegation.\n * @example\n * ```ts\n * const signature = await signDelegation(walletClient, {\n * delegation: {\n * delegate: '0x...',\n * delegator: '0x...',\n * authority: '0x...',\n * caveats: [],\n * salt: '0x'\n * },\n * delegationManager: '0x...',\n * chainId: 1\n * });\n * ```\n */\nexport async function signDelegation<\n TChain extends Chain | undefined,\n TAccount extends Account | undefined,\n>(\n client: Client<Transport, TChain, TAccount> & {\n signTypedData: WalletClient['signTypedData'];\n },\n parameters: SignDelegationParameters,\n): Promise<SignDelegationReturnType> {\n const {\n account: accountParam = client.account,\n delegation,\n delegationManager,\n chainId,\n name = 'DelegationManager',\n version = '1',\n allowInsecureUnrestrictedDelegation = false,\n } = parameters;\n\n if (!accountParam) {\n throw new BaseError('Account not found. Please provide an account.');\n }\n\n const account = parseAccount(accountParam);\n\n const typedData = prepareSignDelegationTypedData({\n delegation,\n delegationManager,\n chainId,\n name,\n version,\n allowInsecureUnrestrictedDelegation,\n });\n\n return client.signTypedData({\n account,\n ...typedData,\n });\n}\n\n/**\n * Creates a sign delegation action that can be used to extend a wallet client.\n * @returns A function that can be used with wallet client extend method.\n * @example\n * ```ts\n * const walletClient = createWalletClient({\n * chain: mainnet,\n * transport: http()\n * }).extend(signDelegationActions());\n * ```\n */\nexport function signDelegationActions() {\n return <\n TChain extends Chain | undefined,\n TAccount extends Account | undefined,\n >(\n client: Client<Transport, TChain, TAccount> & {\n signTypedData: WalletClient['signTypedData'];\n },\n ) => ({\n signDelegation: async (\n parameters: Omit<SignDelegationParameters, 'chainId'> & {\n chainId?: number;\n },\n ) =>\n signDelegation(client, {\n chainId:\n parameters.chainId ??\n (() => {\n if (!client.chain?.id) {\n throw new BaseError(\n 'Chain ID is required. Either provide it in parameters or configure the client with a chain.',\n );\n }\n return client.chain.id;\n })(),\n ...parameters,\n }),\n });\n}\n","import type {\n Account,\n Address,\n Chain,\n Client,\n Hex,\n Transport,\n WalletClient,\n} from 'viem';\nimport { BaseError } from 'viem';\nimport { parseAccount } from 'viem/accounts';\n\nimport { prepareSignUserOperationTypedData } from '../userOp';\nimport type { UserOperationV07 } from '../userOp';\n\nexport type SignUserOperationParameters = {\n /** Account to sign with */\n account?: Account | Address;\n /** The user operation to sign */\n userOperation: Omit<UserOperationV07, 'signature'>;\n /** The entry point contract address */\n entryPoint: { address: Address };\n /** The chain ID that the entry point is deployed on */\n chainId: number;\n /** The address of the smart account */\n address: Address;\n /** The name of the domain of the implementation contract */\n name: 'HybridDeleGator' | 'MultiSigDeleGator';\n /** The version of the domain of the implementation contract */\n version?: string;\n};\n\nexport type SignUserOperationReturnType = Hex;\n\n/**\n * Signs a user operation using a wallet client.\n * @param client - The wallet client to use for signing.\n * @param parameters - The parameters for signing the user operation.\n * @returns The signature of the user operation.\n * @example\n * ```ts\n * const signature = await signUserOperation(walletClient, {\n * userOperation: {\n * sender: '0x...',\n * nonce: 0n,\n * callData: '0x',\n * callGasLimit: 1000000n,\n * verificationGasLimit: 1000000n,\n * preVerificationGas: 21000n,\n * maxFeePerGas: 1000000000n,\n * maxPriorityFeePerGas: 1000000000n\n * },\n * entryPoint: { address: '0x...' },\n * chainId: 1,\n * address: '0x...',\n * name: 'HybridDeleGator'\n * });\n * ```\n */\nexport async function signUserOperation<\n TChain extends Chain | undefined,\n TAccount extends Account | undefined,\n>(\n client: Client<Transport, TChain, TAccount> & {\n signTypedData: WalletClient['signTypedData'];\n },\n parameters: SignUserOperationParameters,\n): Promise<SignUserOperationReturnType> {\n const {\n account: accountParam = client.account,\n userOperation,\n entryPoint,\n chainId,\n name,\n address,\n version = '1',\n } = parameters;\n\n if (!accountParam) {\n throw new BaseError('Account not found. Please provide an account.');\n }\n\n const account = parseAccount(accountParam);\n\n const typedData = prepareSignUserOperationTypedData({\n userOperation,\n entryPoint,\n chainId,\n name,\n address,\n version,\n });\n\n return client.signTypedData({\n account,\n ...typedData,\n });\n}\n\n/**\n * Creates a sign user operation action that can be used to extend a wallet client.\n * @returns A function that can be used with wallet client extend method.\n * @example\n * ```ts\n * const walletClient = createWalletClient({\n * chain: mainnet,\n * transport: http()\n * }).extend(signUserOperationActions());\n * ```\n */\nexport function signUserOperationActions() {\n return <\n TChain extends Chain | undefined,\n TAccount extends Account | undefined,\n >(\n client: Client<Transport, TChain, TAccount> & {\n signTypedData: WalletClient['signTypedData'];\n },\n ) => ({\n signUserOperation: async (\n parameters: Omit<SignUserOperationParameters, 'chainId'> & {\n chainId?: number;\n },\n ) =>\n signUserOperation(client, {\n chainId:\n parameters.chainId ??\n (() => {\n if (!client.chain?.id) {\n throw new BaseError(\n 'Chain ID is required. Either provide it in parameters or configure the client with a chain.',\n );\n }\n return client.chain.id;\n })(),\n ...parameters,\n }),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,SAAS,yBAAyB;AAYlC,SAAS,QAAQ,oBAAoB,sBAAsB;AAsC3D,eAAsB,oCAIpB,QACA,MACA;AACA,MAAI,CAAC,KAAK,IAAI;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,aAAa;AAAA,IACjB,gBAAgB;AAAA,MACd,QAAQ,KAAK;AAAA,MACb,OAAO,KAAK;AAAA,MACZ,UAAU,KAAK;AAAA,IACjB,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,mBAAmB;AAAA,IAClC,KAAK,kBAAkB;AAAA,IACvB,cAAc;AAAA,IACd,MAAM;AAAA,MACJ,CAAC,KAAK,kBAAkB;AAAA,MACxB,yFAA4B;AAAA,MAC5B,yBAAyB,CAAC,UAAU,CAAC;AAAA,IACvC;AAAA,EACF,CAAC;AAED,QAAM;AAAA,IACJ,OAAO;AAAA,IACP,oBAAoB;AAAA,IACpB,mBAAmB;AAAA,IACnB,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,OAAO,MAAM,OAAO,gBAAgB;AAAA,IACxC,GAAG;AAAA,IACH,IAAI,KAAK;AAAA,IACT,MAAM;AAAA,EACR,CAAyC;AAEzC,SAAO;AACT;AA2CA,eAAsB,sCAIpB,QACA,YAIA;AACA,MAAI,WAAW,iBAAiB;AAC9B,UAAM,EAAE,aAAa,IAAI;AAEzB,UAAM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;AAAA,IACJ,mBAAmB,OACjB,eAIA,kBAAkB,QAAQ;AAAA,MACxB,SACE,WAAW,YACV,MAAM;AACL,YAAI,CAAC,OAAO,OAAO,IAAI;AACrB,gBAAM,IAAID;AAAA,YACR;AAAA,UACF;AAAA,QACF;AACA,eAAO,OAAO,MAAM;AAAA,MACtB,GAAG;AAAA,MACL,GAAG;AAAA,IACL,CAAC;AAAA,EACL;AACF;;;AN9EO,IAAM,yBAAyB,MAAM,CAAC,YAAoB;AAAA,EAC/D,6BAA6B,OAC3B,eACG;AACH,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,uBAAuB,MAAM,CAAC,YAA0B;AAAA,EACnE,+BAA+B,OAC7B,SACG,oCAAoC,QAAQ,IAAI;AACvD;AAEO,IAAM,wBAAwB,MAAM,CAAC,YAAoB;AAAA,EAC9D,iCAAiC,OAC/B,SACG,sCAAsC,QAAyB,IAAI;AAC1E;","names":["read_exports","isAddressEqual","BaseError","parseAccount","BaseError","parseAccount"]}