@alchemy/smart-accounts 5.0.0-beta.4 → 5.0.0-beta.6

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 (70) hide show
  1. package/README.md +0 -2
  2. package/dist/esm/index.d.ts +0 -6
  3. package/dist/esm/index.js +0 -3
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/esm/light-account/accounts/base.js +0 -1
  6. package/dist/esm/light-account/accounts/base.js.map +1 -1
  7. package/dist/esm/light-account/utils.js +0 -5
  8. package/dist/esm/light-account/utils.js.map +1 -1
  9. package/dist/esm/ma-v1/accounts/base.js +1 -1
  10. package/dist/esm/ma-v1/accounts/base.js.map +1 -1
  11. package/dist/esm/ma-v1/mav1StaticImpl.d.ts +0 -2
  12. package/dist/esm/ma-v1/mav1StaticImpl.js +0 -2
  13. package/dist/esm/ma-v1/mav1StaticImpl.js.map +1 -1
  14. package/dist/esm/ma-v2/accounts/account.js +1 -1
  15. package/dist/esm/ma-v2/accounts/account.js.map +1 -1
  16. package/dist/esm/ma-v2/accounts/base.js +1 -1
  17. package/dist/esm/ma-v2/accounts/base.js.map +1 -1
  18. package/dist/esm/ma-v2/decorators/installValidation.d.ts +8 -20
  19. package/dist/esm/ma-v2/decorators/installValidation.js +7 -58
  20. package/dist/esm/ma-v2/decorators/installValidation.js.map +1 -1
  21. package/dist/esm/ma-v2/mav2StaticImpl.d.ts +0 -4
  22. package/dist/esm/ma-v2/mav2StaticImpl.js +0 -4
  23. package/dist/esm/ma-v2/mav2StaticImpl.js.map +1 -1
  24. package/dist/esm/ma-v2/utils/account.js +0 -2
  25. package/dist/esm/ma-v2/utils/account.js.map +1 -1
  26. package/dist/esm/version.d.ts +1 -1
  27. package/dist/esm/version.js +1 -1
  28. package/dist/esm/version.js.map +1 -1
  29. package/dist/types/index.d.ts +0 -6
  30. package/dist/types/index.d.ts.map +1 -1
  31. package/dist/types/light-account/accounts/base.d.ts.map +1 -1
  32. package/dist/types/light-account/utils.d.ts.map +1 -1
  33. package/dist/types/ma-v1/mav1StaticImpl.d.ts +0 -2
  34. package/dist/types/ma-v1/mav1StaticImpl.d.ts.map +1 -1
  35. package/dist/types/ma-v2/decorators/installValidation.d.ts +8 -20
  36. package/dist/types/ma-v2/decorators/installValidation.d.ts.map +1 -1
  37. package/dist/types/ma-v2/mav2StaticImpl.d.ts +0 -4
  38. package/dist/types/ma-v2/mav2StaticImpl.d.ts.map +1 -1
  39. package/dist/types/ma-v2/utils/account.d.ts.map +1 -1
  40. package/dist/types/version.d.ts +1 -1
  41. package/package.json +4 -4
  42. package/src/index.ts +0 -13
  43. package/src/light-account/accounts/base.ts +0 -1
  44. package/src/light-account/utils.ts +0 -6
  45. package/src/ma-v1/accounts/base.ts +1 -1
  46. package/src/ma-v1/mav1StaticImpl.ts +0 -2
  47. package/src/ma-v2/accounts/account.ts +2 -2
  48. package/src/ma-v2/accounts/base.ts +1 -1
  49. package/src/ma-v2/decorators/installValidation.ts +8 -83
  50. package/src/ma-v2/mav2StaticImpl.ts +0 -4
  51. package/src/ma-v2/utils/account.ts +0 -2
  52. package/src/version.ts +1 -1
  53. package/dist/esm/light-account/decorators/multiOwner.d.ts +0 -17
  54. package/dist/esm/light-account/decorators/multiOwner.js +0 -39
  55. package/dist/esm/light-account/decorators/multiOwner.js.map +0 -1
  56. package/dist/esm/light-account/decorators/singleOwner.d.ts +0 -16
  57. package/dist/esm/light-account/decorators/singleOwner.js +0 -35
  58. package/dist/esm/light-account/decorators/singleOwner.js.map +0 -1
  59. package/dist/esm/ma-v1/decorators/multiOwner.d.ts +0 -17
  60. package/dist/esm/ma-v1/decorators/multiOwner.js +0 -39
  61. package/dist/esm/ma-v1/decorators/multiOwner.js.map +0 -1
  62. package/dist/types/light-account/decorators/multiOwner.d.ts +0 -18
  63. package/dist/types/light-account/decorators/multiOwner.d.ts.map +0 -1
  64. package/dist/types/light-account/decorators/singleOwner.d.ts +0 -17
  65. package/dist/types/light-account/decorators/singleOwner.d.ts.map +0 -1
  66. package/dist/types/ma-v1/decorators/multiOwner.d.ts +0 -18
  67. package/dist/types/ma-v1/decorators/multiOwner.d.ts.map +0 -1
  68. package/src/light-account/decorators/multiOwner.ts +0 -72
  69. package/src/light-account/decorators/singleOwner.ts +0 -63
  70. package/src/ma-v1/decorators/multiOwner.ts +0 -72
@@ -1,72 +0,0 @@
1
- import type { Address, Chain, Client, Hex, IsUndefined, Transport } from "viem";
2
- import { sendUserOperation, type SmartAccount } from "viem/account-abstraction";
3
- import { getAction } from "viem/utils";
4
- import type { GetAccountParameter } from "../../types.js";
5
- import { AccountNotFoundError } from "@alchemy/common";
6
- import type { MultiOwnerModularAccountV1 } from "../accounts/multi-owner-account.js";
7
-
8
- export type MultiOwnerModularAccountV1Actions<
9
- TAccount extends MultiOwnerModularAccountV1 | undefined =
10
- | MultiOwnerModularAccountV1
11
- | undefined,
12
- > = {
13
- updateOwners: (
14
- args: {
15
- ownersToAdd: Address[];
16
- ownersToRemove: Address[];
17
- } & GetAccountParameter<TAccount, MultiOwnerModularAccountV1>,
18
- ) => Promise<Hex>;
19
- };
20
-
21
- function isMultiOwnerModularAccountV1(
22
- account: SmartAccount,
23
- ): account is MultiOwnerModularAccountV1 {
24
- return (
25
- "smartAccountType" in account &&
26
- account.smartAccountType === "MultiOwnerModularAccountV1"
27
- );
28
- }
29
-
30
- /**
31
- * Generates client actions for a multi-owner MAv1 account, including the ability to update owners.
32
- *
33
- * @param {Client<TTransport, TChain, TAccount>} client The client instance used to interact with the account
34
- * @returns {MultiOwnerLightAccountActions<TAccount>} An object containing the client actions specifically for a multi-owner modular account
35
- */
36
- export function multiOwnerModularAccountV1Actions<
37
- TTransport extends Transport = Transport,
38
- TChain extends Chain | undefined = Chain | undefined,
39
- TAccount extends SmartAccount | undefined = SmartAccount | undefined,
40
- >(
41
- client: Client<TTransport, TChain, TAccount>,
42
- ): MultiOwnerModularAccountV1Actions<
43
- IsUndefined<TAccount> extends true ? undefined : MultiOwnerModularAccountV1
44
- > {
45
- return {
46
- // TODO(v5): Another pattern I think we should consider deprecating for v5 - actions that
47
- // implicitly do a sendUserOperation internally. These are non-composable with batching
48
- // and have a number of other issues that are solved with viem writeContract.
49
- updateOwners: async (args) => {
50
- const { ownersToAdd, ownersToRemove, account = client.account } = args;
51
-
52
- if (!account || !isMultiOwnerModularAccountV1(account)) {
53
- throw new AccountNotFoundError();
54
- }
55
-
56
- const data = account.encodeUpdateOwners(ownersToAdd, ownersToRemove);
57
-
58
- const action = getAction(client, sendUserOperation, "sendUserOperation");
59
- const result = await action({
60
- calls: [
61
- {
62
- to: account.address,
63
- data,
64
- },
65
- ],
66
- account,
67
- });
68
-
69
- return result;
70
- },
71
- };
72
- }