@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.
- package/README.md +0 -2
- package/dist/esm/index.d.ts +0 -6
- package/dist/esm/index.js +0 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/light-account/accounts/base.js +0 -1
- package/dist/esm/light-account/accounts/base.js.map +1 -1
- package/dist/esm/light-account/utils.js +0 -5
- package/dist/esm/light-account/utils.js.map +1 -1
- package/dist/esm/ma-v1/accounts/base.js +1 -1
- package/dist/esm/ma-v1/accounts/base.js.map +1 -1
- package/dist/esm/ma-v1/mav1StaticImpl.d.ts +0 -2
- package/dist/esm/ma-v1/mav1StaticImpl.js +0 -2
- package/dist/esm/ma-v1/mav1StaticImpl.js.map +1 -1
- package/dist/esm/ma-v2/accounts/account.js +1 -1
- package/dist/esm/ma-v2/accounts/account.js.map +1 -1
- package/dist/esm/ma-v2/accounts/base.js +1 -1
- package/dist/esm/ma-v2/accounts/base.js.map +1 -1
- package/dist/esm/ma-v2/decorators/installValidation.d.ts +8 -20
- package/dist/esm/ma-v2/decorators/installValidation.js +7 -58
- package/dist/esm/ma-v2/decorators/installValidation.js.map +1 -1
- package/dist/esm/ma-v2/mav2StaticImpl.d.ts +0 -4
- package/dist/esm/ma-v2/mav2StaticImpl.js +0 -4
- package/dist/esm/ma-v2/mav2StaticImpl.js.map +1 -1
- package/dist/esm/ma-v2/utils/account.js +0 -2
- package/dist/esm/ma-v2/utils/account.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/light-account/accounts/base.d.ts.map +1 -1
- package/dist/types/light-account/utils.d.ts.map +1 -1
- package/dist/types/ma-v1/mav1StaticImpl.d.ts +0 -2
- package/dist/types/ma-v1/mav1StaticImpl.d.ts.map +1 -1
- package/dist/types/ma-v2/decorators/installValidation.d.ts +8 -20
- package/dist/types/ma-v2/decorators/installValidation.d.ts.map +1 -1
- package/dist/types/ma-v2/mav2StaticImpl.d.ts +0 -4
- package/dist/types/ma-v2/mav2StaticImpl.d.ts.map +1 -1
- package/dist/types/ma-v2/utils/account.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/src/index.ts +0 -13
- package/src/light-account/accounts/base.ts +0 -1
- package/src/light-account/utils.ts +0 -6
- package/src/ma-v1/accounts/base.ts +1 -1
- package/src/ma-v1/mav1StaticImpl.ts +0 -2
- package/src/ma-v2/accounts/account.ts +2 -2
- package/src/ma-v2/accounts/base.ts +1 -1
- package/src/ma-v2/decorators/installValidation.ts +8 -83
- package/src/ma-v2/mav2StaticImpl.ts +0 -4
- package/src/ma-v2/utils/account.ts +0 -2
- package/src/version.ts +1 -1
- package/dist/esm/light-account/decorators/multiOwner.d.ts +0 -17
- package/dist/esm/light-account/decorators/multiOwner.js +0 -39
- package/dist/esm/light-account/decorators/multiOwner.js.map +0 -1
- package/dist/esm/light-account/decorators/singleOwner.d.ts +0 -16
- package/dist/esm/light-account/decorators/singleOwner.js +0 -35
- package/dist/esm/light-account/decorators/singleOwner.js.map +0 -1
- package/dist/esm/ma-v1/decorators/multiOwner.d.ts +0 -17
- package/dist/esm/ma-v1/decorators/multiOwner.js +0 -39
- package/dist/esm/ma-v1/decorators/multiOwner.js.map +0 -1
- package/dist/types/light-account/decorators/multiOwner.d.ts +0 -18
- package/dist/types/light-account/decorators/multiOwner.d.ts.map +0 -1
- package/dist/types/light-account/decorators/singleOwner.d.ts +0 -17
- package/dist/types/light-account/decorators/singleOwner.d.ts.map +0 -1
- package/dist/types/ma-v1/decorators/multiOwner.d.ts +0 -18
- package/dist/types/ma-v1/decorators/multiOwner.d.ts.map +0 -1
- package/src/light-account/decorators/multiOwner.ts +0 -72
- package/src/light-account/decorators/singleOwner.ts +0 -63
- 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
|
-
}
|