@metamask/smart-accounts-kit 1.4.0 → 1.6.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 (90) hide show
  1. package/CHANGELOG.md +57 -24
  2. package/dist/actions/index.cjs +9 -6
  3. package/dist/actions/index.cjs.map +1 -1
  4. package/dist/actions/index.d.cts +5 -3
  5. package/dist/actions/index.d.ts +5 -3
  6. package/dist/actions/index.mjs +8 -5
  7. package/dist/{caveats-BhjGBVHX.d.ts → caveats-B2OssjV4.d.ts} +1 -2
  8. package/dist/{caveats-CeHBbmt_.d.cts → caveats-gqMBZKkI.d.cts} +1 -2
  9. package/dist/{chunk-SOFB2MXG.cjs → chunk-2OS36DVV.cjs} +8 -1
  10. package/dist/chunk-2OS36DVV.cjs.map +1 -0
  11. package/dist/{chunk-6CEOFJY5.cjs → chunk-2ZOWIAP3.cjs} +266 -114
  12. package/dist/chunk-2ZOWIAP3.cjs.map +1 -0
  13. package/dist/{chunk-R2WT54GZ.mjs → chunk-AZYTTGON.mjs} +214 -62
  14. package/dist/chunk-AZYTTGON.mjs.map +1 -0
  15. package/dist/{chunk-MVBU3LRV.cjs → chunk-DCI2AN4N.cjs} +15 -17
  16. package/dist/chunk-DCI2AN4N.cjs.map +1 -0
  17. package/dist/{chunk-RR2AMG4A.cjs → chunk-EPU4O7FY.cjs} +158 -151
  18. package/dist/chunk-EPU4O7FY.cjs.map +1 -0
  19. package/dist/{chunk-QCULIK3O.mjs → chunk-GMGJRC3D.mjs} +8 -1
  20. package/dist/chunk-GMGJRC3D.mjs.map +1 -0
  21. package/dist/chunk-IMO6XNDJ.mjs +14 -0
  22. package/dist/chunk-IMO6XNDJ.mjs.map +1 -0
  23. package/dist/chunk-IQT6XFDT.cjs +14 -0
  24. package/dist/chunk-IQT6XFDT.cjs.map +1 -0
  25. package/dist/{chunk-SO5JAXGD.cjs → chunk-JKVSTPEC.cjs} +200 -18
  26. package/dist/chunk-JKVSTPEC.cjs.map +1 -0
  27. package/dist/{chunk-DVJX76J3.mjs → chunk-K7GTZGKJ.mjs} +2 -2
  28. package/dist/{chunk-HQHXGWNJ.mjs → chunk-L3EZCIY6.mjs} +67 -60
  29. package/dist/chunk-L3EZCIY6.mjs.map +1 -0
  30. package/dist/{chunk-XZ7UMCG3.cjs → chunk-PQPAEHJZ.cjs} +12 -12
  31. package/dist/{chunk-XZ7UMCG3.cjs.map → chunk-PQPAEHJZ.cjs.map} +1 -1
  32. package/dist/{chunk-EEIIVBNV.mjs → chunk-TNGQTVSY.mjs} +225 -53
  33. package/dist/chunk-TNGQTVSY.mjs.map +1 -0
  34. package/dist/{chunk-FG2CQGSE.mjs → chunk-UJQ3JN3U.mjs} +4 -6
  35. package/dist/{chunk-FG2CQGSE.mjs.map → chunk-UJQ3JN3U.mjs.map} +1 -1
  36. package/dist/{chunk-TMO23YRP.cjs → chunk-W6HPAK4M.cjs} +262 -90
  37. package/dist/chunk-W6HPAK4M.cjs.map +1 -0
  38. package/dist/{chunk-ZGBFPD4O.mjs → chunk-YVU66KSH.mjs} +188 -6
  39. package/dist/chunk-YVU66KSH.mjs.map +1 -0
  40. package/dist/contracts/index.cjs +5 -6
  41. package/dist/contracts/index.cjs.map +1 -1
  42. package/dist/contracts/index.d.cts +4 -3
  43. package/dist/contracts/index.d.ts +4 -3
  44. package/dist/contracts/index.mjs +4 -5
  45. package/dist/decodeRevertReason-CmmCpmZ_.d.cts +72 -0
  46. package/dist/decodeRevertReason-dOTpJx2h.d.ts +72 -0
  47. package/dist/experimental/index.cjs +364 -9
  48. package/dist/experimental/index.cjs.map +1 -1
  49. package/dist/experimental/index.d.cts +39 -3
  50. package/dist/experimental/index.d.ts +39 -3
  51. package/dist/experimental/index.mjs +357 -2
  52. package/dist/experimental/index.mjs.map +1 -1
  53. package/dist/index-B1Cmezvh.d.cts +61 -0
  54. package/dist/{index-DRKgDSZW.d.ts → index-BkgdU4LI.d.ts} +99 -92
  55. package/dist/{index-Cg-JakqA.d.ts → index-DUJmm8Wz.d.ts} +46 -5
  56. package/dist/{index-DzL9ccjU.d.cts → index-Dv4jPzhe.d.cts} +99 -92
  57. package/dist/index-LqiEgBjV.d.ts +61 -0
  58. package/dist/{index-BToRQKyJ.d.cts → index-X7Qn3JTg.d.cts} +46 -5
  59. package/dist/index.cjs +22 -24
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +8 -7
  62. package/dist/index.d.ts +8 -7
  63. package/dist/index.mjs +9 -11
  64. package/dist/index.mjs.map +1 -1
  65. package/dist/{delegation-CR99q1-n.d.ts → resolveCaveats-A9xC29l8.d.cts} +160 -111
  66. package/dist/{delegation-DoVULGYE.d.cts → resolveCaveats-A9xC29l8.d.ts} +160 -111
  67. package/dist/utils/index.cjs +13 -6
  68. package/dist/utils/index.cjs.map +1 -1
  69. package/dist/utils/index.d.cts +8 -4
  70. package/dist/utils/index.d.ts +8 -4
  71. package/dist/utils/index.mjs +16 -9
  72. package/package.json +7 -6
  73. package/dist/chunk-4QXIOE7F.mjs +0 -79
  74. package/dist/chunk-4QXIOE7F.mjs.map +0 -1
  75. package/dist/chunk-6CEOFJY5.cjs.map +0 -1
  76. package/dist/chunk-EEIIVBNV.mjs.map +0 -1
  77. package/dist/chunk-HQHXGWNJ.mjs.map +0 -1
  78. package/dist/chunk-MOHCTPYQ.cjs +0 -79
  79. package/dist/chunk-MOHCTPYQ.cjs.map +0 -1
  80. package/dist/chunk-MVBU3LRV.cjs.map +0 -1
  81. package/dist/chunk-QCULIK3O.mjs.map +0 -1
  82. package/dist/chunk-R2WT54GZ.mjs.map +0 -1
  83. package/dist/chunk-RR2AMG4A.cjs.map +0 -1
  84. package/dist/chunk-SO5JAXGD.cjs.map +0 -1
  85. package/dist/chunk-SOFB2MXG.cjs.map +0 -1
  86. package/dist/chunk-TMO23YRP.cjs.map +0 -1
  87. package/dist/chunk-ZGBFPD4O.mjs.map +0 -1
  88. package/dist/types-BWaH4KH1.d.cts +0 -155
  89. package/dist/types-BWaH4KH1.d.ts +0 -155
  90. /package/dist/{chunk-DVJX76J3.mjs.map → chunk-K7GTZGKJ.mjs.map} +0 -0
@@ -1,155 +0,0 @@
1
- import { HybridDeleGator, MultiSigDeleGator, EIP7702StatelessDeleGator } from '@metamask/delegation-abis';
2
- import { Account, Hex, WalletClient, Transport, Chain, PublicClient, NonceManager, OneOf, Address } from 'viem';
3
- import { WebAuthnAccount, SmartAccount, SmartAccountImplementation, entryPoint07Abi } from 'viem/account-abstraction';
4
- import { Prettify } from 'viem/chains';
5
-
6
- declare enum Implementation {
7
- MultiSig = "MultiSig",
8
- Hybrid = "Hybrid",
9
- Stateless7702 = "Stateless7702"
10
- }
11
- declare enum TransferWindow {
12
- Hourly = 3600,
13
- Daily = 86400,
14
- Weekly = 604800,
15
- BiWeekly = 1209600,
16
- Monthly = 2592000,
17
- Quarterly = 7776000,
18
- Yearly = 31536000
19
- }
20
- declare enum ScopeType {
21
- Erc20TransferAmount = "erc20TransferAmount",
22
- Erc20Streaming = "erc20Streaming",
23
- Erc20PeriodTransfer = "erc20PeriodTransfer",
24
- NativeTokenTransferAmount = "nativeTokenTransferAmount",
25
- NativeTokenStreaming = "nativeTokenStreaming",
26
- NativeTokenPeriodTransfer = "nativeTokenPeriodTransfer",
27
- Erc721Transfer = "erc721Transfer",
28
- OwnershipTransfer = "ownershipTransfer",
29
- FunctionCall = "functionCall"
30
- }
31
- declare enum CaveatType {
32
- AllowedMethods = "allowedMethods",
33
- AllowedTargets = "allowedTargets",
34
- Deployed = "deployed",
35
- AllowedCalldata = "allowedCalldata",
36
- Erc20BalanceChange = "erc20BalanceChange",
37
- Erc721BalanceChange = "erc721BalanceChange",
38
- Erc1155BalanceChange = "erc1155BalanceChange",
39
- ValueLte = "valueLte",
40
- LimitedCalls = "limitedCalls",
41
- Id = "id",
42
- Nonce = "nonce",
43
- Timestamp = "timestamp",
44
- BlockNumber = "blockNumber",
45
- Erc20TransferAmount = "erc20TransferAmount",
46
- Erc20Streaming = "erc20Streaming",
47
- NativeTokenStreaming = "nativeTokenStreaming",
48
- Erc721Transfer = "erc721Transfer",
49
- NativeTokenTransferAmount = "nativeTokenTransferAmount",
50
- NativeBalanceChange = "nativeBalanceChange",
51
- Redeemer = "redeemer",
52
- NativeTokenPayment = "nativeTokenPayment",
53
- ArgsEqualityCheck = "argsEqualityCheck",
54
- SpecificActionERC20TransferBatch = "specificActionERC20TransferBatch",
55
- Erc20PeriodTransfer = "erc20PeriodTransfer",
56
- NativeTokenPeriodTransfer = "nativeTokenPeriodTransfer",
57
- ExactCalldataBatch = "exactCalldataBatch",
58
- ExactCalldata = "exactCalldata",
59
- ExactExecution = "exactExecution",
60
- ExactExecutionBatch = "exactExecutionBatch",
61
- MultiTokenPeriod = "multiTokenPeriod",
62
- OwnershipTransfer = "ownershipTransfer"
63
- }
64
-
65
- type Caveat = {
66
- enforcer: Hex;
67
- terms: Hex;
68
- args: Hex;
69
- };
70
- type Delegation = {
71
- delegate: Hex;
72
- delegator: Hex;
73
- authority: Hex;
74
- caveats: Caveat[];
75
- salt: Hex;
76
- signature: Hex;
77
- };
78
- type PermissionContext = Delegation[] | Hex;
79
- type SmartAccountsEnvironment = {
80
- DelegationManager: Hex;
81
- EntryPoint: Hex;
82
- SimpleFactory: Hex;
83
- implementations: {
84
- [implementation: string]: Hex;
85
- };
86
- caveatEnforcers: {
87
- [enforcer: string]: Hex;
88
- };
89
- };
90
- type MultiSigDeleGatorDeployParams = [signers: Hex[], threshold: bigint];
91
- type HybridDeleGatorDeployParams = [
92
- owner: Hex,
93
- keyIds: string[],
94
- xValues: bigint[],
95
- yValues: bigint[]
96
- ];
97
- type DeployParams<TImplementation extends Implementation> = {
98
- [Implementation.MultiSig]: MultiSigDeleGatorDeployParams;
99
- [Implementation.Hybrid]: HybridDeleGatorDeployParams;
100
- [Implementation.Stateless7702]: never;
101
- }[TImplementation];
102
- type ToMetaMaskSmartAccountParameters<TImplementation extends Implementation> = {
103
- client: PublicClient;
104
- implementation: TImplementation;
105
- signer?: SignerConfigByImplementation<TImplementation>;
106
- environment?: SmartAccountsEnvironment;
107
- nonceKeyManager?: NonceManager;
108
- } & OneOf<{
109
- deployParams: DeployParams<TImplementation>;
110
- deploySalt: Hex;
111
- } | {
112
- address: Address;
113
- }>;
114
- type SignUserOperationParams = Parameters<ToMetaMaskSmartAccountReturnType<Implementation>['signUserOperation']>[0];
115
- type SignDelegationParams = {
116
- delegation: Omit<Delegation, 'signature'>;
117
- } & {
118
- chainId?: number;
119
- };
120
- type MetaMaskSmartAccountImplementation<TImplementation extends Implementation> = SmartAccountImplementation<typeof entryPoint07Abi, '0.7', {
121
- abi: {
122
- [Implementation.Hybrid]: typeof HybridDeleGator;
123
- [Implementation.MultiSig]: typeof MultiSigDeleGator;
124
- [Implementation.Stateless7702]: typeof EIP7702StatelessDeleGator;
125
- }[TImplementation];
126
- signDelegation: (params: SignDelegationParams) => Promise<Hex>;
127
- environment: SmartAccountsEnvironment;
128
- }>;
129
- type MetaMaskSmartAccount<TImplementation extends Implementation = Implementation> = ToMetaMaskSmartAccountReturnType<TImplementation>;
130
- type ToMetaMaskSmartAccountReturnType<TImplementation extends Implementation> = Prettify<SmartAccount<MetaMaskSmartAccountImplementation<TImplementation>>>;
131
- type WalletSignerConfig = {
132
- walletClient: WalletClient<Transport, Chain | undefined, Account>;
133
- };
134
- type AccountSignerConfig = {
135
- account: Pick<Account, 'signMessage' | 'signTypedData' | 'address'>;
136
- };
137
- type WebAuthnSignerConfig = {
138
- webAuthnAccount: WebAuthnAccount;
139
- keyId: Hex;
140
- };
141
- type HybridSignerConfig = WalletSignerConfig | AccountSignerConfig | WebAuthnSignerConfig;
142
- type MultiSigSignerConfig = (WalletSignerConfig | AccountSignerConfig)[];
143
- type Stateless7702SignerConfig = WalletSignerConfig | AccountSignerConfig;
144
- type SignerConfigByImplementation<TImplementation extends Implementation> = {
145
- [Implementation.Hybrid]: HybridSignerConfig;
146
- [Implementation.MultiSig]: MultiSigSignerConfig;
147
- [Implementation.Stateless7702]: Stateless7702SignerConfig;
148
- }[TImplementation];
149
- type Call = {
150
- to: Hex;
151
- data?: Hex | undefined;
152
- value?: bigint | undefined;
153
- };
154
-
155
- export { type AccountSignerConfig as A, type Caveat as C, type Delegation as D, type HybridDeleGatorDeployParams as H, Implementation as I, type MetaMaskSmartAccount as M, type PermissionContext as P, type SmartAccountsEnvironment as S, type ToMetaMaskSmartAccountParameters as T, type WalletSignerConfig as W, type ToMetaMaskSmartAccountReturnType as a, CaveatType as b, type HybridSignerConfig as c, type MetaMaskSmartAccountImplementation as d, type MultiSigDeleGatorDeployParams as e, type MultiSigSignerConfig as f, ScopeType as g, type SignDelegationParams as h, type SignUserOperationParams as i, TransferWindow as j, type WebAuthnSignerConfig as k, type Call as l, type DeployParams as m };
@@ -1,155 +0,0 @@
1
- import { HybridDeleGator, MultiSigDeleGator, EIP7702StatelessDeleGator } from '@metamask/delegation-abis';
2
- import { Account, Hex, WalletClient, Transport, Chain, PublicClient, NonceManager, OneOf, Address } from 'viem';
3
- import { WebAuthnAccount, SmartAccount, SmartAccountImplementation, entryPoint07Abi } from 'viem/account-abstraction';
4
- import { Prettify } from 'viem/chains';
5
-
6
- declare enum Implementation {
7
- MultiSig = "MultiSig",
8
- Hybrid = "Hybrid",
9
- Stateless7702 = "Stateless7702"
10
- }
11
- declare enum TransferWindow {
12
- Hourly = 3600,
13
- Daily = 86400,
14
- Weekly = 604800,
15
- BiWeekly = 1209600,
16
- Monthly = 2592000,
17
- Quarterly = 7776000,
18
- Yearly = 31536000
19
- }
20
- declare enum ScopeType {
21
- Erc20TransferAmount = "erc20TransferAmount",
22
- Erc20Streaming = "erc20Streaming",
23
- Erc20PeriodTransfer = "erc20PeriodTransfer",
24
- NativeTokenTransferAmount = "nativeTokenTransferAmount",
25
- NativeTokenStreaming = "nativeTokenStreaming",
26
- NativeTokenPeriodTransfer = "nativeTokenPeriodTransfer",
27
- Erc721Transfer = "erc721Transfer",
28
- OwnershipTransfer = "ownershipTransfer",
29
- FunctionCall = "functionCall"
30
- }
31
- declare enum CaveatType {
32
- AllowedMethods = "allowedMethods",
33
- AllowedTargets = "allowedTargets",
34
- Deployed = "deployed",
35
- AllowedCalldata = "allowedCalldata",
36
- Erc20BalanceChange = "erc20BalanceChange",
37
- Erc721BalanceChange = "erc721BalanceChange",
38
- Erc1155BalanceChange = "erc1155BalanceChange",
39
- ValueLte = "valueLte",
40
- LimitedCalls = "limitedCalls",
41
- Id = "id",
42
- Nonce = "nonce",
43
- Timestamp = "timestamp",
44
- BlockNumber = "blockNumber",
45
- Erc20TransferAmount = "erc20TransferAmount",
46
- Erc20Streaming = "erc20Streaming",
47
- NativeTokenStreaming = "nativeTokenStreaming",
48
- Erc721Transfer = "erc721Transfer",
49
- NativeTokenTransferAmount = "nativeTokenTransferAmount",
50
- NativeBalanceChange = "nativeBalanceChange",
51
- Redeemer = "redeemer",
52
- NativeTokenPayment = "nativeTokenPayment",
53
- ArgsEqualityCheck = "argsEqualityCheck",
54
- SpecificActionERC20TransferBatch = "specificActionERC20TransferBatch",
55
- Erc20PeriodTransfer = "erc20PeriodTransfer",
56
- NativeTokenPeriodTransfer = "nativeTokenPeriodTransfer",
57
- ExactCalldataBatch = "exactCalldataBatch",
58
- ExactCalldata = "exactCalldata",
59
- ExactExecution = "exactExecution",
60
- ExactExecutionBatch = "exactExecutionBatch",
61
- MultiTokenPeriod = "multiTokenPeriod",
62
- OwnershipTransfer = "ownershipTransfer"
63
- }
64
-
65
- type Caveat = {
66
- enforcer: Hex;
67
- terms: Hex;
68
- args: Hex;
69
- };
70
- type Delegation = {
71
- delegate: Hex;
72
- delegator: Hex;
73
- authority: Hex;
74
- caveats: Caveat[];
75
- salt: Hex;
76
- signature: Hex;
77
- };
78
- type PermissionContext = Delegation[] | Hex;
79
- type SmartAccountsEnvironment = {
80
- DelegationManager: Hex;
81
- EntryPoint: Hex;
82
- SimpleFactory: Hex;
83
- implementations: {
84
- [implementation: string]: Hex;
85
- };
86
- caveatEnforcers: {
87
- [enforcer: string]: Hex;
88
- };
89
- };
90
- type MultiSigDeleGatorDeployParams = [signers: Hex[], threshold: bigint];
91
- type HybridDeleGatorDeployParams = [
92
- owner: Hex,
93
- keyIds: string[],
94
- xValues: bigint[],
95
- yValues: bigint[]
96
- ];
97
- type DeployParams<TImplementation extends Implementation> = {
98
- [Implementation.MultiSig]: MultiSigDeleGatorDeployParams;
99
- [Implementation.Hybrid]: HybridDeleGatorDeployParams;
100
- [Implementation.Stateless7702]: never;
101
- }[TImplementation];
102
- type ToMetaMaskSmartAccountParameters<TImplementation extends Implementation> = {
103
- client: PublicClient;
104
- implementation: TImplementation;
105
- signer?: SignerConfigByImplementation<TImplementation>;
106
- environment?: SmartAccountsEnvironment;
107
- nonceKeyManager?: NonceManager;
108
- } & OneOf<{
109
- deployParams: DeployParams<TImplementation>;
110
- deploySalt: Hex;
111
- } | {
112
- address: Address;
113
- }>;
114
- type SignUserOperationParams = Parameters<ToMetaMaskSmartAccountReturnType<Implementation>['signUserOperation']>[0];
115
- type SignDelegationParams = {
116
- delegation: Omit<Delegation, 'signature'>;
117
- } & {
118
- chainId?: number;
119
- };
120
- type MetaMaskSmartAccountImplementation<TImplementation extends Implementation> = SmartAccountImplementation<typeof entryPoint07Abi, '0.7', {
121
- abi: {
122
- [Implementation.Hybrid]: typeof HybridDeleGator;
123
- [Implementation.MultiSig]: typeof MultiSigDeleGator;
124
- [Implementation.Stateless7702]: typeof EIP7702StatelessDeleGator;
125
- }[TImplementation];
126
- signDelegation: (params: SignDelegationParams) => Promise<Hex>;
127
- environment: SmartAccountsEnvironment;
128
- }>;
129
- type MetaMaskSmartAccount<TImplementation extends Implementation = Implementation> = ToMetaMaskSmartAccountReturnType<TImplementation>;
130
- type ToMetaMaskSmartAccountReturnType<TImplementation extends Implementation> = Prettify<SmartAccount<MetaMaskSmartAccountImplementation<TImplementation>>>;
131
- type WalletSignerConfig = {
132
- walletClient: WalletClient<Transport, Chain | undefined, Account>;
133
- };
134
- type AccountSignerConfig = {
135
- account: Pick<Account, 'signMessage' | 'signTypedData' | 'address'>;
136
- };
137
- type WebAuthnSignerConfig = {
138
- webAuthnAccount: WebAuthnAccount;
139
- keyId: Hex;
140
- };
141
- type HybridSignerConfig = WalletSignerConfig | AccountSignerConfig | WebAuthnSignerConfig;
142
- type MultiSigSignerConfig = (WalletSignerConfig | AccountSignerConfig)[];
143
- type Stateless7702SignerConfig = WalletSignerConfig | AccountSignerConfig;
144
- type SignerConfigByImplementation<TImplementation extends Implementation> = {
145
- [Implementation.Hybrid]: HybridSignerConfig;
146
- [Implementation.MultiSig]: MultiSigSignerConfig;
147
- [Implementation.Stateless7702]: Stateless7702SignerConfig;
148
- }[TImplementation];
149
- type Call = {
150
- to: Hex;
151
- data?: Hex | undefined;
152
- value?: bigint | undefined;
153
- };
154
-
155
- export { type AccountSignerConfig as A, type Caveat as C, type Delegation as D, type HybridDeleGatorDeployParams as H, Implementation as I, type MetaMaskSmartAccount as M, type PermissionContext as P, type SmartAccountsEnvironment as S, type ToMetaMaskSmartAccountParameters as T, type WalletSignerConfig as W, type ToMetaMaskSmartAccountReturnType as a, CaveatType as b, type HybridSignerConfig as c, type MetaMaskSmartAccountImplementation as d, type MultiSigDeleGatorDeployParams as e, type MultiSigSignerConfig as f, ScopeType as g, type SignDelegationParams as h, type SignUserOperationParams as i, TransferWindow as j, type WebAuthnSignerConfig as k, type Call as l, type DeployParams as m };