@account-kit/smart-contracts 4.0.0-alpha.0 → 4.0.0-alpha.1
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/dist/cjs/src/index.d.ts +3 -3
- package/dist/cjs/src/index.js +15 -15
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/light-account/accounts/account.js +1 -1
- package/dist/cjs/src/light-account/accounts/account.js.map +1 -1
- package/dist/cjs/src/light-account/accounts/multiOwner.js +2 -4
- package/dist/cjs/src/light-account/accounts/multiOwner.js.map +1 -1
- package/dist/cjs/src/light-account/actions/transferOwnership.d.ts +1 -1
- package/dist/cjs/src/light-account/actions/transferOwnership.js +2 -1
- package/dist/cjs/src/light-account/actions/transferOwnership.js.map +1 -1
- package/dist/cjs/src/light-account/actions/updateOwners.js.map +1 -1
- package/dist/cjs/src/light-account/clients/alchemyClient.js.map +1 -1
- package/dist/cjs/src/light-account/clients/client.js +2 -1
- package/dist/cjs/src/light-account/clients/client.js.map +1 -1
- package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
- package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js +2 -1
- package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/decorators/lightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/utils.d.ts +3 -2
- package/dist/cjs/src/light-account/utils.js +14 -5
- package/dist/cjs/src/light-account/utils.js.map +1 -1
- package/dist/cjs/src/msca/account/multiOwnerAccount.js +2 -1
- package/dist/cjs/src/msca/account/multiOwnerAccount.js.map +1 -1
- package/dist/cjs/src/msca/account/multisigAccount.js +4 -3
- package/dist/cjs/src/msca/account/multisigAccount.js.map +1 -1
- package/dist/cjs/src/msca/account-loupe/decorator.js.map +1 -1
- package/dist/cjs/src/msca/client/alchemyClient.js.map +1 -1
- package/dist/cjs/src/msca/client/client.js.map +1 -1
- package/dist/cjs/src/msca/client/multiSigAlchemyClient.js.map +1 -1
- package/dist/cjs/src/msca/errors.js.map +1 -1
- package/dist/cjs/src/msca/plugin-manager/decorator.d.ts +1 -1
- package/dist/cjs/src/msca/plugin-manager/decorator.js +6 -4
- package/dist/cjs/src/msca/plugin-manager/decorator.js.map +1 -1
- package/dist/cjs/src/msca/plugin-manager/installPlugin.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multi-owner/extension.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multi-owner/index.d.ts +1 -1
- package/dist/cjs/src/msca/plugins/multi-owner/index.js +2 -1
- package/dist/cjs/src/msca/plugins/multi-owner/index.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/actions/proposeUserOperation.js +2 -2
- package/dist/cjs/src/msca/plugins/multisig/actions/proposeUserOperation.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/actions/signMultisigUserOperation.js +1 -1
- package/dist/cjs/src/msca/plugins/multisig/actions/signMultisigUserOperation.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/extension.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/index.d.ts +1 -8
- package/dist/cjs/src/msca/plugins/multisig/index.js +1 -16
- package/dist/cjs/src/msca/plugins/multisig/index.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/middleware.d.ts +1 -1
- package/dist/cjs/src/msca/plugins/multisig/middleware.js +1 -1
- package/dist/cjs/src/msca/plugins/multisig/middleware.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.d.ts +3 -2
- package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.js +2 -2
- package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/utils/getSignerType.d.ts +2 -2
- package/dist/cjs/src/msca/plugins/multisig/utils/getSignerType.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/utils/index.d.ts +4 -0
- package/dist/cjs/src/msca/plugins/multisig/utils/index.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/extension.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/index.d.ts +1 -1
- package/dist/cjs/src/msca/plugins/session-key/index.js +3 -1
- package/dist/cjs/src/msca/plugins/session-key/index.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/permissions.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/signer.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/utils.d.ts +4 -2
- package/dist/cjs/src/msca/plugins/session-key/utils.js +3 -2
- package/dist/cjs/src/msca/plugins/session-key/utils.js.map +1 -1
- package/dist/cjs/src/msca/utils.d.ts +6 -4
- package/dist/cjs/src/msca/utils.js.map +1 -1
- package/dist/esm/src/index.d.ts +3 -3
- package/dist/esm/src/index.js +2 -2
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/light-account/accounts/account.js +2 -2
- package/dist/esm/src/light-account/accounts/account.js.map +1 -1
- package/dist/esm/src/light-account/accounts/multiOwner.js +3 -5
- package/dist/esm/src/light-account/accounts/multiOwner.js.map +1 -1
- package/dist/esm/src/light-account/actions/transferOwnership.d.ts +1 -1
- package/dist/esm/src/light-account/actions/transferOwnership.js +2 -1
- package/dist/esm/src/light-account/actions/transferOwnership.js.map +1 -1
- package/dist/esm/src/light-account/actions/updateOwners.js.map +1 -1
- package/dist/esm/src/light-account/clients/alchemyClient.js.map +1 -1
- package/dist/esm/src/light-account/clients/client.js +2 -1
- package/dist/esm/src/light-account/clients/client.js.map +1 -1
- package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
- package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js +2 -1
- package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
- package/dist/esm/src/light-account/decorators/lightAccount.js.map +1 -1
- package/dist/esm/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
- package/dist/esm/src/light-account/utils.d.ts +3 -2
- package/dist/esm/src/light-account/utils.js +12 -4
- package/dist/esm/src/light-account/utils.js.map +1 -1
- package/dist/esm/src/msca/account/multiOwnerAccount.js +2 -1
- package/dist/esm/src/msca/account/multiOwnerAccount.js.map +1 -1
- package/dist/esm/src/msca/account/multisigAccount.js +4 -3
- package/dist/esm/src/msca/account/multisigAccount.js.map +1 -1
- package/dist/esm/src/msca/account-loupe/decorator.js.map +1 -1
- package/dist/esm/src/msca/client/alchemyClient.js.map +1 -1
- package/dist/esm/src/msca/client/client.js.map +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.js.map +1 -1
- package/dist/esm/src/msca/errors.js.map +1 -1
- package/dist/esm/src/msca/plugin-manager/decorator.d.ts +1 -1
- package/dist/esm/src/msca/plugin-manager/decorator.js +6 -4
- package/dist/esm/src/msca/plugin-manager/decorator.js.map +1 -1
- package/dist/esm/src/msca/plugin-manager/installPlugin.js.map +1 -1
- package/dist/esm/src/msca/plugins/multi-owner/extension.js.map +1 -1
- package/dist/esm/src/msca/plugins/multi-owner/index.d.ts +1 -1
- package/dist/esm/src/msca/plugins/multi-owner/index.js +1 -1
- package/dist/esm/src/msca/plugins/multi-owner/index.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/actions/proposeUserOperation.js +1 -1
- package/dist/esm/src/msca/plugins/multisig/actions/proposeUserOperation.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/actions/signMultisigUserOperation.js +1 -1
- package/dist/esm/src/msca/plugins/multisig/actions/signMultisigUserOperation.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/extension.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/index.d.ts +1 -8
- package/dist/esm/src/msca/plugins/multisig/index.js +0 -7
- package/dist/esm/src/msca/plugins/multisig/index.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/middleware.d.ts +1 -1
- package/dist/esm/src/msca/plugins/multisig/middleware.js +2 -1
- package/dist/esm/src/msca/plugins/multisig/middleware.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.d.ts +3 -2
- package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.js +2 -2
- package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/utils/getSignerType.d.ts +2 -2
- package/dist/esm/src/msca/plugins/multisig/utils/getSignerType.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/utils/index.d.ts +4 -0
- package/dist/esm/src/msca/plugins/multisig/utils/index.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/extension.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/index.d.ts +1 -1
- package/dist/esm/src/msca/plugins/session-key/index.js +1 -1
- package/dist/esm/src/msca/plugins/session-key/index.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/permissions.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/signer.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/utils.d.ts +4 -2
- package/dist/esm/src/msca/plugins/session-key/utils.js +3 -2
- package/dist/esm/src/msca/plugins/session-key/utils.js.map +1 -1
- package/dist/esm/src/msca/utils.d.ts +6 -4
- package/dist/esm/src/msca/utils.js.map +1 -1
- package/dist/types/src/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/light-account/accounts/account.d.ts.map +1 -1
- package/dist/types/src/light-account/accounts/multiOwner.d.ts.map +1 -1
- package/dist/types/src/light-account/actions/transferOwnership.d.ts +26 -1
- package/dist/types/src/light-account/actions/transferOwnership.d.ts.map +1 -1
- package/dist/types/src/light-account/actions/updateOwners.d.ts +24 -0
- package/dist/types/src/light-account/actions/updateOwners.d.ts.map +1 -1
- package/dist/types/src/light-account/decorators/lightAccount.d.ts +19 -0
- package/dist/types/src/light-account/decorators/lightAccount.d.ts.map +1 -1
- package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts +19 -0
- package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts.map +1 -1
- package/dist/types/src/light-account/utils.d.ts +11 -4
- package/dist/types/src/light-account/utils.d.ts.map +1 -1
- package/dist/types/src/msca/account/multisigAccount.d.ts.map +1 -1
- package/dist/types/src/msca/account-loupe/decorator.d.ts +15 -0
- package/dist/types/src/msca/account-loupe/decorator.d.ts.map +1 -1
- package/dist/types/src/msca/client/client.d.ts.map +1 -1
- package/dist/types/src/msca/errors.d.ts +12 -0
- package/dist/types/src/msca/errors.d.ts.map +1 -1
- package/dist/types/src/msca/plugin-manager/decorator.d.ts +16 -1
- package/dist/types/src/msca/plugin-manager/decorator.d.ts.map +1 -1
- package/dist/types/src/msca/plugin-manager/installPlugin.d.ts +21 -0
- package/dist/types/src/msca/plugin-manager/installPlugin.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multi-owner/extension.d.ts +15 -0
- package/dist/types/src/msca/plugins/multi-owner/extension.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multi-owner/index.d.ts +1 -1
- package/dist/types/src/msca/plugins/multi-owner/index.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/actions/proposeUserOperation.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/actions/signMultisigUserOperation.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/extension.d.ts +13 -0
- package/dist/types/src/msca/plugins/multisig/extension.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/index.d.ts +1 -8
- package/dist/types/src/msca/plugins/multisig/index.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/middleware.d.ts +1 -1
- package/dist/types/src/msca/plugins/multisig/middleware.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/utils/combineSignatures.d.ts +28 -2
- package/dist/types/src/msca/plugins/multisig/utils/combineSignatures.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/utils/getSignerType.d.ts +21 -2
- package/dist/types/src/msca/plugins/multisig/utils/getSignerType.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/utils/index.d.ts +4 -0
- package/dist/types/src/msca/plugins/multisig/utils/index.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/extension.d.ts +13 -0
- package/dist/types/src/msca/plugins/session-key/extension.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/index.d.ts +1 -1
- package/dist/types/src/msca/plugins/session-key/index.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/permissions.d.ts +3 -0
- package/dist/types/src/msca/plugins/session-key/permissions.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/signer.d.ts +1 -1
- package/dist/types/src/msca/plugins/session-key/signer.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/utils.d.ts +22 -2
- package/dist/types/src/msca/plugins/session-key/utils.d.ts.map +1 -1
- package/dist/types/src/msca/utils.d.ts +43 -5
- package/dist/types/src/msca/utils.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +2 -3
- package/src/light-account/accounts/account.ts +22 -3
- package/src/light-account/accounts/multiOwner.ts +26 -5
- package/src/light-account/actions/transferOwnership.ts +28 -5
- package/src/light-account/actions/updateOwners.ts +24 -0
- package/src/light-account/clients/alchemyClient.ts +20 -0
- package/src/light-account/clients/client.ts +27 -6
- package/src/light-account/clients/multiOwnerAlchemyClient.ts +20 -0
- package/src/light-account/clients/multiOwnerLightAccount.ts +27 -6
- package/src/light-account/decorators/lightAccount.ts +19 -0
- package/src/light-account/decorators/multiOwnerLightAccount.ts +19 -0
- package/src/light-account/utils.ts +29 -6
- package/src/msca/account/multiOwnerAccount.ts +36 -11
- package/src/msca/account/multisigAccount.ts +40 -14
- package/src/msca/account-loupe/decorator.ts +15 -0
- package/src/msca/client/alchemyClient.ts +20 -0
- package/src/msca/client/client.ts +46 -0
- package/src/msca/client/multiSigAlchemyClient.ts +22 -0
- package/src/msca/errors.ts +12 -0
- package/src/msca/plugin-manager/decorator.ts +22 -5
- package/src/msca/plugin-manager/installPlugin.ts +21 -0
- package/src/msca/plugins/multi-owner/extension.ts +15 -0
- package/src/msca/plugins/multi-owner/index.ts +3 -0
- package/src/msca/plugins/multisig/actions/proposeUserOperation.ts +1 -1
- package/src/msca/plugins/multisig/actions/signMultisigUserOperation.ts +1 -1
- package/src/msca/plugins/multisig/extension.ts +13 -0
- package/src/msca/plugins/multisig/index.ts +1 -12
- package/src/msca/plugins/multisig/middleware.ts +2 -2
- package/src/msca/plugins/multisig/utils/combineSignatures.ts +36 -9
- package/src/msca/plugins/multisig/utils/getSignerType.ts +23 -4
- package/src/msca/plugins/multisig/utils/index.ts +4 -0
- package/src/msca/plugins/session-key/extension.ts +13 -0
- package/src/msca/plugins/session-key/index.ts +7 -1
- package/src/msca/plugins/session-key/permissions.ts +3 -0
- package/src/msca/plugins/session-key/signer.ts +1 -2
- package/src/msca/plugins/session-key/utils.ts +33 -12
- package/src/msca/utils.ts +64 -9
|
@@ -23,6 +23,7 @@ import type {
|
|
|
23
23
|
import {
|
|
24
24
|
AccountVersionRegistry,
|
|
25
25
|
defaultLightAccountVersion,
|
|
26
|
+
getDefaultMultiOwnerLightAccountFactoryAddress,
|
|
26
27
|
} from "../utils.js";
|
|
27
28
|
import {
|
|
28
29
|
createLightAccountBase,
|
|
@@ -105,6 +106,26 @@ export async function createMultiOwnerLightAccount<
|
|
|
105
106
|
MultiOwnerLightAccount<TSigner, TLightAccountVersion, TEntryPointVersion>
|
|
106
107
|
>;
|
|
107
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Creates a multi-owner light account using the provided parameters, including transport, chain, signer, initialization code, version, account address, factory address, salt, and owners. Ensures the owners list is deduplicated, ordered, and valid.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* import { createMultiOwnerLightAccount } from "@account-kit/smart-contracts";
|
|
115
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
116
|
+
* import { sepolia } from "viem/chains";
|
|
117
|
+
* import { http, generatePrivateKey } from "viem"
|
|
118
|
+
*
|
|
119
|
+
* const account = await createMultiOwnerLightAccount({
|
|
120
|
+
* chain: sepolia,
|
|
121
|
+
* transport: http("RPC_URL"),
|
|
122
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @param {CreateMultiOwnerLightAccountParams} config The parameters for creating a multi-owner light account
|
|
127
|
+
* @returns {Promise<MultiOwnerLightAccount>} A promise that resolves to a `MultiOwnerLightAccount` object containing the created account information and methods
|
|
128
|
+
*/
|
|
108
129
|
export async function createMultiOwnerLightAccount({
|
|
109
130
|
transport,
|
|
110
131
|
chain,
|
|
@@ -112,13 +133,13 @@ export async function createMultiOwnerLightAccount({
|
|
|
112
133
|
initCode,
|
|
113
134
|
version = defaultLightAccountVersion("MultiOwnerLightAccount"),
|
|
114
135
|
entryPoint = getEntryPoint(chain, {
|
|
115
|
-
version:
|
|
116
|
-
AccountVersionRegistry["MultiOwnerLightAccount"][version]
|
|
117
|
-
.entryPointVersion,
|
|
136
|
+
version: "0.7.0",
|
|
118
137
|
}),
|
|
119
138
|
accountAddress,
|
|
120
|
-
factoryAddress =
|
|
121
|
-
|
|
139
|
+
factoryAddress = getDefaultMultiOwnerLightAccountFactoryAddress(
|
|
140
|
+
chain,
|
|
141
|
+
version
|
|
142
|
+
),
|
|
122
143
|
salt: salt_ = 0n,
|
|
123
144
|
owners = [],
|
|
124
145
|
}: CreateMultiOwnerLightAccountParams): Promise<MultiOwnerLightAccount> {
|
|
@@ -22,7 +22,32 @@ export type TransferLightAccountOwnershipParams<
|
|
|
22
22
|
} & GetAccountParameter<TAccount, LightAccount<TSigner>> &
|
|
23
23
|
UserOperationOverridesParameter<TEntryPointVersion>;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Transfers the ownership of a light account to a new owner.
|
|
27
|
+
* This function ensures that the client is a compatible smart acccount client and that a Light Account is provided.
|
|
28
|
+
* If the waitForTxn parameter is true, it will wait for the transaction to be completed before returning.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { transferOwnership, createLightAccountClient } from "@account-kit/smart-contracts";
|
|
33
|
+
*
|
|
34
|
+
* const lightAccountClient = createLightAccountClient({
|
|
35
|
+
* signer,
|
|
36
|
+
* transport,
|
|
37
|
+
* chain,
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* const txHash = await transferOwnership(lightAccountClient, {
|
|
41
|
+
* newOwner: newOwnerSigner,
|
|
42
|
+
* waitForTxn: true, // set to false to return a uoHash instead
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @param {Client<TTransport, TChain, TAccount>} client The smart account client instance used to execute the transfer
|
|
47
|
+
* @param {TransferLightAccountOwnershipParams<TSigner, TAccount>} args The parameters for transferring ownership
|
|
48
|
+
* @returns {Promise<Hex>} The transaction or UO hash as a Hex string
|
|
49
|
+
*/
|
|
50
|
+
export const transferOwnership = async <
|
|
26
51
|
TTransport extends Transport = Transport,
|
|
27
52
|
TChain extends Chain | undefined = Chain | undefined,
|
|
28
53
|
TSigner extends SmartAccountSigner = SmartAccountSigner,
|
|
@@ -32,10 +57,8 @@ export const transferOwnership: <
|
|
|
32
57
|
>(
|
|
33
58
|
client: Client<TTransport, TChain, TAccount>,
|
|
34
59
|
args: TransferLightAccountOwnershipParams<TSigner, TAccount>
|
|
35
|
-
)
|
|
36
|
-
client
|
|
37
|
-
{ newOwner, waitForTxn, overrides, account = client.account }
|
|
38
|
-
) => {
|
|
60
|
+
): Promise<Hex> => {
|
|
61
|
+
const { newOwner, waitForTxn, overrides, account = client.account } = args;
|
|
39
62
|
if (!account) {
|
|
40
63
|
throw new AccountNotFoundError();
|
|
41
64
|
}
|
|
@@ -23,6 +23,30 @@ export type UpdateMultiOwnerLightAccountOwnersParams<
|
|
|
23
23
|
} & GetAccountParameter<TAccount, MultiOwnerLightAccount<TSigner>> &
|
|
24
24
|
UserOperationOverridesParameter<TEntryPointVersion>;
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Updates the owners of a multi-owner light account. This includes adding new owners and removing existing ones.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { updateOwners, createLightAccountClient } from "@account-kit/smart-contracts";
|
|
32
|
+
*
|
|
33
|
+
* const lightAccountClient = createLightAccountClient({
|
|
34
|
+
* signer,
|
|
35
|
+
* transport,
|
|
36
|
+
* chain,
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* const txHash = await updateOwners(lightAccountClient, {
|
|
40
|
+
* ownerstoAdd: [newOwnerAddress], // or empty if you just want to remove owners
|
|
41
|
+
* ownersToRemove: [oldOwnerAddress], // or empty if you just want to add owners
|
|
42
|
+
* waitForTxn: true, // set to false to return a uoHash instead
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @param {Client<TTransport, TChain, TAccount>} client The client instance used to interact with the account
|
|
47
|
+
* @param {UpdateMultiOwnerLightAccountOwnersParams<TSigner, TAccount>} args The parameters for updating the account owners
|
|
48
|
+
* @returns {Promise<Hex>} A promise that resolves to the transaction hash or the full transaction result if `waitForTxn` is `true`
|
|
49
|
+
*/
|
|
26
50
|
export const updateOwners: <
|
|
27
51
|
TTransport extends Transport = Transport,
|
|
28
52
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -39,6 +39,26 @@ export async function createLightAccountAlchemyClient<
|
|
|
39
39
|
>
|
|
40
40
|
>;
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Creates an Alchemy smart account client connected to a Light Account instance.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { createLightAccountAlchemyClient } from "@account-kit/smart-contracts";
|
|
48
|
+
* import { sepolia } from "@account-kit/infra/chains";
|
|
49
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
50
|
+
* import { generatePrivateKey } from "viem"
|
|
51
|
+
*
|
|
52
|
+
* const lightAccountClient = await createLightAccountAlchemyClient({
|
|
53
|
+
* apiKey: "your-api-key",
|
|
54
|
+
* chain: sepolia,
|
|
55
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @param {AlchemyLightAccountClientConfig} config The configuration for setting up the Alchemy Light Account Client
|
|
60
|
+
* @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created client
|
|
61
|
+
*/
|
|
42
62
|
export async function createLightAccountAlchemyClient(
|
|
43
63
|
config: AlchemyLightAccountClientConfig
|
|
44
64
|
): Promise<AlchemySmartAccountClient> {
|
|
@@ -48,12 +48,33 @@ export function createLightAccountClient<
|
|
|
48
48
|
>
|
|
49
49
|
>;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Creates a light account client using the provided parameters, including account information, transport mechanism, blockchain chain, and additional client configurations. This function first creates a light account and then uses it to create a smart account client, extending it with light account client actions.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { createLightAccountClient } from "@account-kit/smart-contracts";
|
|
57
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
58
|
+
* import { sepolia } from "viem/chains";
|
|
59
|
+
* import { http, generatePrivateKey } from "viem"
|
|
60
|
+
*
|
|
61
|
+
* const account = await createLightAccountClient({
|
|
62
|
+
* chain: sepolia,
|
|
63
|
+
* transport: http("RPC_URL"),
|
|
64
|
+
* account: {
|
|
65
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
66
|
+
* }
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @param {CreateLightAccountClientParams} params The parameters for creating a light account client
|
|
71
|
+
* @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` object containing the created account information and methods
|
|
72
|
+
*/
|
|
73
|
+
export async function createLightAccountClient(
|
|
74
|
+
params: CreateLightAccountClientParams
|
|
75
|
+
): Promise<SmartAccountClient> {
|
|
76
|
+
const { account, transport, chain, ...clientConfig } = params;
|
|
77
|
+
|
|
57
78
|
const lightAccount = await createLightAccount({
|
|
58
79
|
...account,
|
|
59
80
|
transport,
|
|
@@ -43,6 +43,26 @@ export async function createMultiOwnerLightAccountAlchemyClient<
|
|
|
43
43
|
>
|
|
44
44
|
>;
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Creates a multi-owner light account Alchemy client using the provided configuration.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { createMultiOwnerLightAccountAlchemyClient } from "@account-kit/smart-contracts";
|
|
52
|
+
* import { sepolia } from "@account-kit/infra/chains";
|
|
53
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
54
|
+
* import { generatePrivateKey } from "viem"
|
|
55
|
+
*
|
|
56
|
+
* const lightAccountClient = await createMultiOwnerLightAccountAlchemyClient({
|
|
57
|
+
* apiKey: "your-api-key",
|
|
58
|
+
* chain: sepolia,
|
|
59
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @param {AlchemyMultiOwnerLightAccountClientConfig} config The configuration for creating the Alchemy client
|
|
64
|
+
* @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created account information and methods
|
|
65
|
+
*/
|
|
46
66
|
export async function createMultiOwnerLightAccountAlchemyClient(
|
|
47
67
|
config: AlchemyMultiOwnerLightAccountClientConfig
|
|
48
68
|
): Promise<AlchemySmartAccountClient> {
|
|
@@ -54,12 +54,33 @@ export function createMultiOwnerLightAccountClient<
|
|
|
54
54
|
>
|
|
55
55
|
>;
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Creates a multi-owner light account client using the provided parameters. It first creates a multi-owner light account and then creates a smart account client with the provided configurations.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* import { createMultiOwnerLightAccountClient } from "@account-kit/smart-contracts";
|
|
63
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
64
|
+
* import { sepolia } from "viem/chains";
|
|
65
|
+
* import { http, generatePrivateKey } from "viem"
|
|
66
|
+
*
|
|
67
|
+
* const account = await createMultiOwnerLightAccountClient({
|
|
68
|
+
* chain: sepolia,
|
|
69
|
+
* transport: http("RPC_URL"),
|
|
70
|
+
* account: {
|
|
71
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
72
|
+
* }
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @param {CreateMultiOwnerLightAccountClientParams} params the configuration for creating the multi-owner light account client
|
|
77
|
+
* @returns {Promise<SmartAccountClient>} a promise that resolves to a `SmartAccountClient` containing the created account client and relevant methods
|
|
78
|
+
*/
|
|
79
|
+
export async function createMultiOwnerLightAccountClient(
|
|
80
|
+
params: CreateMultiOwnerLightAccountClientParams
|
|
81
|
+
): Promise<SmartAccountClient> {
|
|
82
|
+
const { account, transport, chain, ...clientConfig } = params;
|
|
83
|
+
|
|
63
84
|
const lightAccount = await createMultiOwnerLightAccount({
|
|
64
85
|
...account,
|
|
65
86
|
transport,
|
|
@@ -17,6 +17,25 @@ export type LightAccountClientActions<
|
|
|
17
17
|
) => Promise<Hex>;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Provides a set of actions for managing a light account client, including transferring ownership.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { lightAccountClientActions, createLightAccount } from "@account-kit/smart-contracts";
|
|
26
|
+
* import { createAlchemySmartAccountClient } from "@account-kit/infra";
|
|
27
|
+
* import { sepolia } from "@account-kit/infra/chains";
|
|
28
|
+
*
|
|
29
|
+
* const smartAccountClient = createAlchemySmartAccountClient({
|
|
30
|
+
* account: await createLightAccount(...),
|
|
31
|
+
* apiKey: "your-api-key",
|
|
32
|
+
* chain: sepolia,
|
|
33
|
+
* }).extend(lightAccountClientActions);
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param {Client<TTransport, TChain, TAccount>} client The client instance for which to provide the light account actions
|
|
37
|
+
* @returns {LightAccountClientActions<TSigner, TAccount>} An object containing the available light account client actions
|
|
38
|
+
*/
|
|
20
39
|
export const lightAccountClientActions: <
|
|
21
40
|
TTransport extends Transport = Transport,
|
|
22
41
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -17,6 +17,25 @@ export type MultiOwnerLightAccountClientActions<
|
|
|
17
17
|
) => Promise<Hex>;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Generates client actions for a multi-owner light account, including the ability to update owners.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { multiOwnerLightAccountClientActions, createMultiOwnerLightAccount } from "@account-kit/smart-contracts";
|
|
26
|
+
* import { createAlchemySmartAccountClient } from "@account-kit/infra";
|
|
27
|
+
* import { sepolia } from "@account-kit/infra/chains";
|
|
28
|
+
*
|
|
29
|
+
* const smartAccountClient = createAlchemySmartAccountClient({
|
|
30
|
+
* account: await createMultiOwnerLightAccount(...),
|
|
31
|
+
* apiKey: "your-api-key",
|
|
32
|
+
* chain: sepolia,
|
|
33
|
+
* }).extend(multiOwnerLightAccountClientActions);
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param {Client<TTransport, TChain, TAccount>} client the client for interacting with the multi-owner light account
|
|
37
|
+
* @returns {MultiOwnerLightAccountClientActions<TSigner, TAccount>} an object containing the client actions specifically for a multi-owner light account
|
|
38
|
+
*/
|
|
20
39
|
export const multiOwnerLightAccountClientActions: <
|
|
21
40
|
TTransport extends Transport = Transport,
|
|
22
41
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -168,21 +168,45 @@ export const defaultLightAccountVersion = <
|
|
|
168
168
|
*/
|
|
169
169
|
export const getDefaultLightAccountFactoryAddress = (
|
|
170
170
|
chain: Chain,
|
|
171
|
-
version:
|
|
171
|
+
version: GetLightAccountVersion<"LightAccount">
|
|
172
172
|
): Address => {
|
|
173
173
|
const address =
|
|
174
|
-
AccountVersionRegistry.LightAccount[version].address[chain.id]
|
|
174
|
+
AccountVersionRegistry.LightAccount[version].address[chain.id] ??
|
|
175
|
+
AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];
|
|
175
176
|
if (!address)
|
|
176
177
|
throw new DefaultFactoryNotDefinedError("LightAccount", chain, "0.6.0");
|
|
177
178
|
return address.factory;
|
|
178
179
|
};
|
|
179
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Utility method returning the default multi owner light account factory address given a {@link Chain} object
|
|
183
|
+
*
|
|
184
|
+
* @param chain - a {@link Chain} object
|
|
185
|
+
* @param version - the version of the light account to get the factory address for
|
|
186
|
+
* @returns a {@link Address} for the given chain
|
|
187
|
+
* @throws if the chain doesn't have an address currently deployed
|
|
188
|
+
*/
|
|
189
|
+
export const getDefaultMultiOwnerLightAccountFactoryAddress = (
|
|
190
|
+
chain: Chain,
|
|
191
|
+
version: GetLightAccountVersion<"MultiOwnerLightAccount">
|
|
192
|
+
) => {
|
|
193
|
+
const address =
|
|
194
|
+
AccountVersionRegistry.LightAccount[version].address[chain.id] ??
|
|
195
|
+
AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];
|
|
196
|
+
if (!address)
|
|
197
|
+
throw new DefaultFactoryNotDefinedError(
|
|
198
|
+
"MultiOwnerLightAccount",
|
|
199
|
+
chain,
|
|
200
|
+
"0.7.0"
|
|
201
|
+
);
|
|
202
|
+
return address.factory;
|
|
203
|
+
};
|
|
204
|
+
|
|
180
205
|
/**
|
|
181
206
|
* Can be used to check if the account with one of the following implementation addresses
|
|
182
207
|
* to not support 1271 signing.
|
|
183
208
|
*
|
|
184
209
|
* Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.
|
|
185
|
-
*
|
|
186
210
|
*/
|
|
187
211
|
export const LightAccountUnsupported1271Impls = [
|
|
188
212
|
AccountVersionRegistry.LightAccount["v1.0.1"],
|
|
@@ -194,7 +218,6 @@ export const LightAccountUnsupported1271Impls = [
|
|
|
194
218
|
* to not support 1271 signing.
|
|
195
219
|
*
|
|
196
220
|
* Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.
|
|
197
|
-
*
|
|
198
221
|
*/
|
|
199
222
|
export const LightAccountUnsupported1271Factories = new Set(
|
|
200
223
|
LightAccountUnsupported1271Impls.map((x) =>
|
|
@@ -266,7 +289,7 @@ export async function getLightAccountVersionDef<
|
|
|
266
289
|
];
|
|
267
290
|
return chain.id in def.address
|
|
268
291
|
? [def.address[chain.id].impl, version]
|
|
269
|
-
: [
|
|
292
|
+
: [def.address[supportedChains[0].id].impl, version];
|
|
270
293
|
})
|
|
271
294
|
.filter(([impl]) => impl !== null) as [
|
|
272
295
|
Address,
|
|
@@ -283,7 +306,7 @@ export async function getLightAccountVersionDef<
|
|
|
283
306
|
];
|
|
284
307
|
return chain.id in def.address
|
|
285
308
|
? [def.address[chain.id].factory, version]
|
|
286
|
-
: [
|
|
309
|
+
: [def.address[supportedChains[0].id].factory, version];
|
|
287
310
|
})
|
|
288
311
|
.filter(([impl]) => impl !== null) as [
|
|
289
312
|
Address,
|
|
@@ -62,17 +62,42 @@ export async function createMultiOwnerModularAccount<
|
|
|
62
62
|
config: CreateMultiOwnerModularAccountParams<TTransport, TSigner>
|
|
63
63
|
): Promise<MultiOwnerModularAccount<TSigner>>;
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Creates a multi-owner modular account with the given parameters, including transport, chain, signer, account address, initialization code, entry point, factory address, owners, and salt.
|
|
67
|
+
* Ensures that the owners are unique, ordered, and non-zero.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { createMultiOwnerModularAccount } from "@account-kit/smart-contracts";
|
|
72
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
73
|
+
* import { sepolia } from "viem/chains";
|
|
74
|
+
* import { http, generatePrivateKey } from "viem"
|
|
75
|
+
*
|
|
76
|
+
* const account = await createMultiOwnerModularAccount({
|
|
77
|
+
* chain: sepolia,
|
|
78
|
+
* transport: http("RPC_URL"),
|
|
79
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @param {CreateMultiOwnerModularAccountParams} config Configuration parameters for creating a multi-owner modular account
|
|
84
|
+
* @returns {Promise<MultiOwnerModularAccount>} A promise that resolves to a `MultiOwnerModularAccount` object containing the created account information and methods
|
|
85
|
+
*/
|
|
86
|
+
export async function createMultiOwnerModularAccount(
|
|
87
|
+
config: CreateMultiOwnerModularAccountParams
|
|
88
|
+
): Promise<MultiOwnerModularAccount> {
|
|
89
|
+
const {
|
|
90
|
+
transport,
|
|
91
|
+
chain,
|
|
92
|
+
signer,
|
|
93
|
+
accountAddress,
|
|
94
|
+
initCode,
|
|
95
|
+
entryPoint = getEntryPoint(chain, { version: "0.6.0" }),
|
|
96
|
+
factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(chain),
|
|
97
|
+
owners = [],
|
|
98
|
+
salt = 0n,
|
|
99
|
+
} = config;
|
|
100
|
+
|
|
76
101
|
const client = createBundlerClient({
|
|
77
102
|
transport,
|
|
78
103
|
chain,
|
|
@@ -64,18 +64,44 @@ export async function createMultisigModularAccount<
|
|
|
64
64
|
config: CreateMultisigModularAccountParams<TTransport, TSigner>
|
|
65
65
|
): Promise<MultisigModularAccount<TSigner>>;
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Creates a multisig modular account using the provided parameters, including transport, chain, signer, account address, and other account settings. It configures the account with multiple owners and the specified threshold.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { createMultisigModularAccount } from "@account-kit/smart-contracts";
|
|
73
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
74
|
+
* import { sepolia } from "viem/chains";
|
|
75
|
+
* import { http, generatePrivateKey } from "viem"
|
|
76
|
+
*
|
|
77
|
+
* const account = await createMultisigModularAccount({
|
|
78
|
+
* chain: sepolia,
|
|
79
|
+
* transport: http("RPC_URL"),
|
|
80
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
|
|
81
|
+
* owners: [...], // other owners on the account
|
|
82
|
+
* threshold: 2, // 2 of N signatures
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @param {CreateMultisigModularAccountParams} config The parameters for creating a multisig modular account.
|
|
87
|
+
* @returns {Promise<MultisigModularAccount>} A promise that resolves to a `MultisigModularAccount` object containing the created account information and methods.
|
|
88
|
+
*/
|
|
89
|
+
export async function createMultisigModularAccount(
|
|
90
|
+
config: CreateMultisigModularAccountParams
|
|
91
|
+
): Promise<MultisigModularAccount> {
|
|
92
|
+
const {
|
|
93
|
+
transport,
|
|
94
|
+
chain,
|
|
95
|
+
signer,
|
|
96
|
+
accountAddress: accountAddress_,
|
|
97
|
+
initCode,
|
|
98
|
+
entryPoint = getEntryPoint(chain, { version: "0.6.0" }),
|
|
99
|
+
factoryAddress = getDefaultMultisigModularAccountFactoryAddress(chain),
|
|
100
|
+
owners = [],
|
|
101
|
+
salt = 0n,
|
|
102
|
+
threshold,
|
|
103
|
+
} = config;
|
|
104
|
+
|
|
79
105
|
const client = createBundlerClient({
|
|
80
106
|
transport,
|
|
81
107
|
chain,
|
|
@@ -108,10 +134,10 @@ export async function createMultisigModularAccount({
|
|
|
108
134
|
]);
|
|
109
135
|
};
|
|
110
136
|
|
|
111
|
-
accountAddress = await getAccountAddress({
|
|
137
|
+
const accountAddress = await getAccountAddress({
|
|
112
138
|
client,
|
|
113
139
|
entryPoint,
|
|
114
|
-
accountAddress:
|
|
140
|
+
accountAddress: accountAddress_,
|
|
115
141
|
getAccountInitCode,
|
|
116
142
|
});
|
|
117
143
|
|
|
@@ -51,6 +51,21 @@ export type AccountLoupeActions<
|
|
|
51
51
|
): Promise<ReadonlyArray<Address>>;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Provides a set of actions for account loupe operations using the specified client.
|
|
56
|
+
* NOTE: this is already added to the client when using any of the Modular Account Clients.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* import { accountLoupeActions } from "@account-kit/smart-contracts";
|
|
61
|
+
* import { createSmartAccountClient } from "@aa-sdk/core";
|
|
62
|
+
*
|
|
63
|
+
* const client = createSmartAccountClient(...).extend(accountLoupeActions);
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @param {Client<TTransport, TChain, TAccount>} client the client to be used for executing the account loupe actions
|
|
67
|
+
* @returns {AccountLoupeActions<TAccount>} an object containing account loupe actions like `getExecutionFunctionConfig`, `getExecutionHooks`, `getPreValidationHooks`, and `getInstalledPlugins`
|
|
68
|
+
*/
|
|
54
69
|
export const accountLoupeActions: <
|
|
55
70
|
TTransport extends Transport = Transport,
|
|
56
71
|
TChain extends Chain | undefined = Chain | undefined,
|
|
@@ -52,6 +52,26 @@ export function createModularAccountAlchemyClient<
|
|
|
52
52
|
>
|
|
53
53
|
>;
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Creates a modular account Alchemy client with the provided configuration.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* import { createModularAccountAlchemyClient } from "@account-kit/smart-contracts";
|
|
61
|
+
* import { sepolia } from "@account-kit/infra/chains";
|
|
62
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
63
|
+
* import { generatePrivateKey } from "viem"
|
|
64
|
+
*
|
|
65
|
+
* const alchemyAccountClient = await createModularAccountAlchemyClient({
|
|
66
|
+
* apiKey: "your-api-key",
|
|
67
|
+
* chain: sepolia,
|
|
68
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @param {AlchemyModularAccountClientConfig} config The configuration for creating the Alchemy client
|
|
73
|
+
* @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` configured with the desired plugins and actions
|
|
74
|
+
*/
|
|
55
75
|
export async function createModularAccountAlchemyClient(
|
|
56
76
|
config: AlchemyModularAccountClientConfig
|
|
57
77
|
): Promise<AlchemySmartAccountClient> {
|
|
@@ -80,6 +80,28 @@ export function createMultiOwnerModularAccountClient<
|
|
|
80
80
|
>
|
|
81
81
|
>;
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Creates a multi-owner modular account client with the provided parameters including account, transport, chain, and additional client configuration. This function uses a modular account and extends it with various plugin actions.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { createMultiOwnerModularAccountClient } from "@account-kit/smart-contracts";
|
|
89
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
90
|
+
* import { sepolia } from "viem/chains";
|
|
91
|
+
* import { http, generatePrivateKey } from "viem"
|
|
92
|
+
*
|
|
93
|
+
* const accountClient = await createMultiOwnerModularAccountClient({
|
|
94
|
+
* chain: sepolia,
|
|
95
|
+
* transport: http("RPC_URL"),
|
|
96
|
+
* account: {
|
|
97
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())
|
|
98
|
+
* }
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @param {CreateMultiOwnerModularAccountClientParams} config The parameters for creating the multi-owner modular account client
|
|
103
|
+
* @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` instance with extended plugin actions
|
|
104
|
+
*/
|
|
83
105
|
export async function createMultiOwnerModularAccountClient({
|
|
84
106
|
account,
|
|
85
107
|
transport,
|
|
@@ -121,6 +143,30 @@ export function createMultisigModularAccountClient<
|
|
|
121
143
|
>
|
|
122
144
|
>;
|
|
123
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Creates a multisig modular account client using the provided parameters including account details, transport, chain, and additional client configuration. This function constructs the multisig modular account and extends it with various actions to create a comprehensive client.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* import { createMultisigModularAccountClient } from "@account-kit/smart-contracts";
|
|
152
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
153
|
+
* import { sepolia } from "viem/chains";
|
|
154
|
+
* import { http, generatePrivateKey } from "viem"
|
|
155
|
+
*
|
|
156
|
+
* const accountClient = await createMultisigModularAccountClient({
|
|
157
|
+
* chain: sepolia,
|
|
158
|
+
* transport: http("RPC_URL"),
|
|
159
|
+
* account: {
|
|
160
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
|
|
161
|
+
* owners: [...], // other owners on the account
|
|
162
|
+
* threshold: 2, // 2 of N signatures
|
|
163
|
+
* }
|
|
164
|
+
* });
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* @param {CreateMultisigModularAccountClientParams} config the parameters for configuring the multisig modular account client
|
|
168
|
+
* @returns {Promise<SmartAccountClient<Transport, Chain, MultisigModularAccount<SmartAccountSigner>, {}, SmartAccountClientRpcSchema, MultisigUserOperationContext>>} a promise that resolves to a `SmartAccountClient` object extended with the multisig modular account and additional actions
|
|
169
|
+
*/
|
|
124
170
|
export async function createMultisigModularAccountClient({
|
|
125
171
|
account,
|
|
126
172
|
transport,
|
|
@@ -65,6 +65,28 @@ export function createMultisigAccountAlchemyClient<
|
|
|
65
65
|
>
|
|
66
66
|
>;
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Creates an Alchemy client for a multisig account using the provided configuration.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { createMultisigAccountAlchemyClient } from "@account-kit/smart-contracts";
|
|
74
|
+
* import { sepolia } from "@account-kit/infra/chains";
|
|
75
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
76
|
+
* import { generatePrivateKey } from "viem"
|
|
77
|
+
*
|
|
78
|
+
* const alchemyAccountClient = await createMultisigAccountAlchemyClient({
|
|
79
|
+
* apiKey: "your-api-key",
|
|
80
|
+
* chain: sepolia,
|
|
81
|
+
* signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
|
|
82
|
+
* owners: [...], // other owners on the account
|
|
83
|
+
* threshold: 2, // 2 of N signatures
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @param {AlchemyMultisigAccountClientConfig} config The configuration for the Alchemy multisig account client
|
|
88
|
+
* @returns {Promise<AlchemySmartAccountClient<Transport, Chain | undefined, MultisigModularAccount<SmartAccountSigner>, MultisigPluginActions<MultisigModularAccount<SmartAccountSigner>> & PluginManagerActions<MultisigModularAccount<SmartAccountSigner>> & AccountLoupeActions<MultisigModularAccount<SmartAccountSigner>>, MultisigUserOperationContext>>} A promise that resolves to an Alchemy Smart Account Client for multisig accounts with extended functionalities.
|
|
89
|
+
*/
|
|
68
90
|
export async function createMultisigAccountAlchemyClient(
|
|
69
91
|
config: AlchemyMultisigAccountClientConfig
|
|
70
92
|
): Promise<
|