From 8def14ec8dc4de9b3ce8540f796859b222b7d27a Mon Sep 17 00:00:00 2001 From: Michael Moldoveanu Date: Tue, 13 Feb 2024 18:20:06 -0500 Subject: [PATCH 01/12] refactor: change index to be called salt (#450) --- packages/accounts/src/light-account/account.ts | 10 +++++----- .../accounts/src/msca/account/multiOwnerAccount.ts | 6 +++--- packages/core/src/account/schema.ts | 2 +- packages/core/src/account/simple.ts | 2 +- site/migration-guide.md | 4 ++++ 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/accounts/src/light-account/account.ts b/packages/accounts/src/light-account/account.ts index 23d0d10a0b..e99e45ae40 100644 --- a/packages/accounts/src/light-account/account.ts +++ b/packages/accounts/src/light-account/account.ts @@ -50,7 +50,7 @@ export type CreateLightAccountParams< "transport" | "chain" | "entryPoint" | "accountAddress" > & { owner: TOwner; - index?: bigint; + salt?: bigint; factoryAddress?: Address; initCode?: Hex; version?: LightAccountVersion; @@ -72,7 +72,7 @@ export async function createLightAccount({ entryPoint = getVersion060EntryPoint(chain), accountAddress, factoryAddress = getDefaultLightAccountFactoryAddress(chain, version), - index: index_ = 0n, + salt: salt_ = 0n, }: CreateLightAccountParams): Promise { let owner = owner_; const client = createBundlerClient({ @@ -83,18 +83,18 @@ export async function createLightAccount({ const getAccountInitCode = async () => { if (initCode) return initCode; - const index = LightAccountUnsupported1271Factories.has( + const salt = LightAccountUnsupported1271Factories.has( factoryAddress.toLowerCase() as Address ) ? 0n - : index_; + : salt_; return concatHex([ factoryAddress, encodeFunctionData({ abi: LightAccountFactoryAbi, functionName: "createAccount", - args: [await owner.getAddress(), index], + args: [await owner.getAddress(), salt], }), ]); }; diff --git a/packages/accounts/src/msca/account/multiOwnerAccount.ts b/packages/accounts/src/msca/account/multiOwnerAccount.ts index 804de793c0..7d9c779249 100644 --- a/packages/accounts/src/msca/account/multiOwnerAccount.ts +++ b/packages/accounts/src/msca/account/multiOwnerAccount.ts @@ -33,7 +33,7 @@ export type CreateMultiOwnerModularAccountParams< transport: TTransport; chain: Chain; owner: TOwner; - index?: bigint; + salt?: bigint; factoryAddress?: Address; owners?: Address[]; entryPoint?: EntryPointDef; @@ -57,7 +57,7 @@ export async function createMultiOwnerModularAccount({ entryPoint = getVersion060EntryPoint(chain), factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(chain), owners = [], - index = 0n, + salt = 0n, }: CreateMultiOwnerModularAccountParams): Promise { let owner = owner_; const client = createBundlerClient({ @@ -85,7 +85,7 @@ export async function createMultiOwnerModularAccount({ encodeFunctionData({ abi: MultiOwnerModularAccountFactoryAbi, functionName: "createAccount", - args: [index, owners_], + args: [salt, owners_], }), ]); }; diff --git a/packages/core/src/account/schema.ts b/packages/core/src/account/schema.ts index 8484145f28..7a3fc33c3d 100644 --- a/packages/core/src/account/schema.ts +++ b/packages/core/src/account/schema.ts @@ -42,5 +42,5 @@ export const SimpleSmartAccountParamsSchema = < .extend({ transport: z.custom(), owner: z.custom(isSigner), - index: z.bigint().optional(), + salt: z.bigint().optional(), }); diff --git a/packages/core/src/account/simple.ts b/packages/core/src/account/simple.ts index 56a0f8f65d..a78d0afb8c 100644 --- a/packages/core/src/account/simple.ts +++ b/packages/core/src/account/simple.ts @@ -39,7 +39,7 @@ class SimpleSmartContractAccount< }); super({ ...params, rpcClient: client }); this.owner = params.owner as TOwner; - this.index = params.index ?? 0n; + this.index = params.salt ?? 0n; } getDummySignature(): `0x${string}` { diff --git a/site/migration-guide.md b/site/migration-guide.md index 0697350153..bf69fff834 100644 --- a/site/migration-guide.md +++ b/site/migration-guide.md @@ -237,6 +237,10 @@ type toSmartContractAccount = < `chain` and `transport` have been added to the constructor and `rpcClient` has been removed. +### Account: SimpleAccount and LightAccount intialization params + +`index` is now called `salt` + ### Signer: `signTypedData` signature change The `signTypedData` method found on `SmartAccountSigner` has been updated to match the signature found on `SmartContractAccount` and viem's `Account`. From 21d2f6a60f2244813cca1f20e7d820e808f40971 Mon Sep 17 00:00:00 2001 From: Michael Moldoveanu Date: Tue, 13 Feb 2024 23:23:10 -0500 Subject: [PATCH 02/12] docs: remove signer doc routing (#453) --- site/.vitepress/sidebar/index.ts | 2 +- .../.vitepress/sidebar/packages/aa-alchemy.ts | 94 +++++++++---------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/site/.vitepress/sidebar/index.ts b/site/.vitepress/sidebar/index.ts index 6b40af6999..f44557a66f 100644 --- a/site/.vitepress/sidebar/index.ts +++ b/site/.vitepress/sidebar/index.ts @@ -51,7 +51,7 @@ export const sidebar: DefaultTheme.Sidebar = [ base: "/signers", items: [ { text: "Introduction", link: "/choosing-a-signer" }, - { text: "Alchemy Signer", link: "/alchemy-signer" }, + // { text: "Alchemy Signer", link: "/alchemy-signer" }, { text: "Signer guides", base: "/signers/guides", diff --git a/site/.vitepress/sidebar/packages/aa-alchemy.ts b/site/.vitepress/sidebar/packages/aa-alchemy.ts index c2da0f37cc..cae05e4b43 100644 --- a/site/.vitepress/sidebar/packages/aa-alchemy.ts +++ b/site/.vitepress/sidebar/packages/aa-alchemy.ts @@ -51,54 +51,54 @@ export const aaAlchemySidebar: DefaultTheme.SidebarItem = { }, ], }, - { - text: "Alchemy Signer", - base: "/packages/aa-alchemy/signer", - collapsed: true, - items: [ - { - text: "Overview", - link: "/overview", - }, - { - text: "authenticate", - link: "/authenticate", - }, - { - text: "disconnect", - link: "/disconnect", - }, - { - text: "getAuthDetails", - link: "/getAuthDetails", - }, + // { + // text: "Alchemy Signer", + // base: "/packages/aa-alchemy/signer", + // collapsed: true, + // items: [ + // { + // text: "Overview", + // link: "/overview", + // }, + // { + // text: "authenticate", + // link: "/authenticate", + // }, + // { + // text: "disconnect", + // link: "/disconnect", + // }, + // { + // text: "getAuthDetails", + // link: "/getAuthDetails", + // }, - { - text: "getAddress", - link: "/getAddress", - }, - { - text: "signMessage", - link: "/signMessage", - }, - { - text: "signTypedData", - link: "/signTypedData", - }, - { - text: "getUser", - link: "/getUser", - }, - { - text: "addPasskey", - link: "/addPasskey", - }, - { - text: "exportWallet", - link: "/exportWallet", - }, - ], - }, + // { + // text: "getAddress", + // link: "/getAddress", + // }, + // { + // text: "signMessage", + // link: "/signMessage", + // }, + // { + // text: "signTypedData", + // link: "/signTypedData", + // }, + // { + // text: "getUser", + // link: "/getUser", + // }, + // { + // text: "addPasskey", + // link: "/addPasskey", + // }, + // { + // text: "exportWallet", + // link: "/exportWallet", + // }, + // ], + // }, { text: "Utils", collapsed: true, From fb2a5417c19b4f9c335ed86438b7ba81fbb8472d Mon Sep 17 00:00:00 2001 From: Michael Moldoveanu Date: Wed, 14 Feb 2024 14:30:57 -0500 Subject: [PATCH 03/12] fix: update the docs for using a custom account (#456) --- site/smart-accounts/custom/using-your-own.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/site/smart-accounts/custom/using-your-own.md b/site/smart-accounts/custom/using-your-own.md index 2582081ad8..c31b54c1a3 100644 --- a/site/smart-accounts/custom/using-your-own.md +++ b/site/smart-accounts/custom/using-your-own.md @@ -22,7 +22,21 @@ head: You are not limited to the accounts defined in `@alchemy/aa-accounts`. The `SmartAccountClient` can be used with any smart account because it only relies on the [`SmartContractAccount`](/packages/aa-core/accounts/index.md) interface. This means you can use your own smart account implementation with Account Kit. - + + +To use your account, you'll need to pass it into a `SmartAccountClient`. + +```ts +import { createAlchemySmartAccountClient } from "@alchemy/aa-alchemy"; +import { sepolia } from "@alchemy/aa-core"; + +const client = createAlchemySmartAccountClient({ + // created above + account: myAccount, + chain: sepolia, + transport: http("RPC_URL"), +}); +``` ## `LightSmartContractAccount` as an Example From f4fd272c70a6590e6a1804406be0a4297d628a89 Mon Sep 17 00:00:00 2001 From: Michael Moldoveanu Date: Wed, 14 Feb 2024 15:00:55 -0500 Subject: [PATCH 04/12] refactor: use signable message everywhere (#455) --- .../accounts/src/light-account/account.ts | 6 ++--- .../src/msca/plugins/multi-owner/signer.ts | 3 +-- .../src/msca/plugins/session-key/signer.ts | 3 ++- packages/accounts/src/nani-account/account.ts | 12 ++++------ packages/alchemy/src/signer/signer.ts | 13 +++------- packages/core/src/account/simple.ts | 12 ++++------ .../signer/__tests__/local-account.test.ts | 16 +++++++++---- packages/core/src/signer/local-account.ts | 18 ++++---------- packages/core/src/signer/types.ts | 9 +++++-- packages/core/src/signer/wallet-client.ts | 24 +++++-------------- packages/ethers/src/account-signer.ts | 4 ++-- packages/ethers/src/utils.ts | 14 +++++++---- packages/signers/src/arcana-auth/signer.ts | 3 ++- packages/signers/src/capsule/signer.ts | 3 ++- packages/signers/src/fireblocks/signer.ts | 3 ++- packages/signers/src/lit-protocol/signer.ts | 19 ++++++++------- packages/signers/src/magic/signer.ts | 3 ++- packages/signers/src/particle/signer.ts | 3 ++- packages/signers/src/portal/signer.ts | 3 ++- packages/signers/src/turnkey/signer.ts | 3 ++- packages/signers/src/web3auth/signer.ts | 3 ++- 21 files changed, 83 insertions(+), 94 deletions(-) diff --git a/packages/accounts/src/light-account/account.ts b/packages/accounts/src/light-account/account.ts index e99e45ae40..bd719dabc5 100644 --- a/packages/accounts/src/light-account/account.ts +++ b/packages/accounts/src/light-account/account.ts @@ -196,15 +196,13 @@ export async function createLightAccount({ }); }, signUserOperationHash: async (uoHash: Hex) => { - return owner.signMessage(uoHash); + return owner.signMessage({ raw: uoHash }); }, async signMessage({ message }) { const version = await getLightAccountVersion(account); switch (version) { case "v1.0.1": - return owner.signMessage( - typeof message === "string" ? message : message.raw - ); + return owner.signMessage(message); case "v1.0.2": throw new Error( `Version ${version} of LightAccount doesn't support 1271` diff --git a/packages/accounts/src/msca/plugins/multi-owner/signer.ts b/packages/accounts/src/msca/plugins/multi-owner/signer.ts index 604e1ad8b4..2963b9119c 100644 --- a/packages/accounts/src/msca/plugins/multi-owner/signer.ts +++ b/packages/accounts/src/msca/plugins/multi-owner/signer.ts @@ -6,7 +6,6 @@ import type { import { hashMessage, hashTypedData, - hexToBytes, type Hash, type Hex, type SignableMessage, @@ -58,7 +57,7 @@ export const multiOwnerMessageSigner = < }, signUserOperationHash: (uoHash: `0x${string}`): Promise<`0x${string}`> => { - return owner().signMessage(hexToBytes(uoHash)); + return owner().signMessage({ raw: uoHash }); }, signMessage({ diff --git a/packages/accounts/src/msca/plugins/session-key/signer.ts b/packages/accounts/src/msca/plugins/session-key/signer.ts index 86427dd707..b25351d4cf 100644 --- a/packages/accounts/src/msca/plugins/session-key/signer.ts +++ b/packages/accounts/src/msca/plugins/session-key/signer.ts @@ -2,6 +2,7 @@ import { LocalAccountSigner, type SmartAccountSigner } from "@alchemy/aa-core"; import type { Hex, PrivateKeyAccount, + SignableMessage, TypedData, TypedDataDefinition, } from "viem"; @@ -61,7 +62,7 @@ export class SessionKeySigner return this.inner.getAddress(); }; - signMessage: (msg: string | Uint8Array) => Promise<`0x${string}`> = async ( + signMessage: (msg: SignableMessage) => Promise<`0x${string}`> = async ( msg ) => { return this.inner.signMessage(msg); diff --git a/packages/accounts/src/nani-account/account.ts b/packages/accounts/src/nani-account/account.ts index f7485bdb68..5c94649850 100644 --- a/packages/accounts/src/nani-account/account.ts +++ b/packages/accounts/src/nani-account/account.ts @@ -15,7 +15,7 @@ import { concatHex, decodeFunctionResult, encodeFunctionData, - hexToBytes, + isHex, numberToHex, type Address, type Chain, @@ -128,13 +128,9 @@ class NaniAccount_< } signMessage(msg: Uint8Array | string): Promise { - if (typeof msg === "string" && msg.startsWith("0x")) { - msg = hexToBytes(msg as Hex); - } else if (typeof msg === "string") { - msg = new TextEncoder().encode(msg); - } - - return this.owner.signMessage(msg); + return this.owner.signMessage( + typeof msg === "string" && !isHex(msg) ? msg : { raw: msg } + ); } async encodeExecute(target: Hex, value: bigint, data: Hex): Promise { diff --git a/packages/alchemy/src/signer/signer.ts b/packages/alchemy/src/signer/signer.ts index 8bf530392b..bef26da664 100644 --- a/packages/alchemy/src/signer/signer.ts +++ b/packages/alchemy/src/signer/signer.ts @@ -2,9 +2,8 @@ import type { SmartAccountAuthenticator } from "@alchemy/aa-core"; import { hashMessage, hashTypedData, - isHex, - toHex, type Hex, + type SignableMessage, type TypedData, type TypedDataDefinition, } from "viem"; @@ -112,16 +111,10 @@ export class AlchemySigner return address; }; - signMessage: (msg: string | Uint8Array) => Promise<`0x${string}`> = async ( + signMessage: (msg: SignableMessage) => Promise<`0x${string}`> = async ( msg ) => { - const messageHash = hashMessage( - typeof msg === "string" && !isHex(msg) - ? msg - : { - raw: isHex(msg) ? msg : toHex(msg), - } - ); + const messageHash = hashMessage(msg); return this.inner.signRawMessage(messageHash); }; diff --git a/packages/core/src/account/simple.ts b/packages/core/src/account/simple.ts index a78d0afb8c..c0214e7b43 100644 --- a/packages/core/src/account/simple.ts +++ b/packages/core/src/account/simple.ts @@ -2,7 +2,7 @@ import type { Address } from "abitype"; import { concatHex, encodeFunctionData, - hexToBytes, + isHex, type FallbackTransport, type Hex, type Transport, @@ -79,13 +79,9 @@ class SimpleSmartContractAccount< } signMessage(msg: Uint8Array | string): Promise<`0x${string}`> { - if (typeof msg === "string" && msg.startsWith("0x")) { - msg = hexToBytes(msg as Hex); - } else if (typeof msg === "string") { - msg = new TextEncoder().encode(msg); - } - - return this.owner.signMessage(msg); + return this.owner.signMessage( + typeof msg === "string" && !isHex(msg) ? msg : { raw: msg } + ); } setOwner(owner: TOwner): void { diff --git a/packages/core/src/signer/__tests__/local-account.test.ts b/packages/core/src/signer/__tests__/local-account.test.ts index f4d321e76f..453be01627 100644 --- a/packages/core/src/signer/__tests__/local-account.test.ts +++ b/packages/core/src/signer/__tests__/local-account.test.ts @@ -8,7 +8,9 @@ describe("Local Account Signer Tests", () => { it("should sign a hex message properly", async () => { const signer = LocalAccountSigner.mnemonicToAccountSigner(dummyMnemonic); expect( - await signer.signMessage("0xabcfC3DB1e0f5023F5a4f40c03D149f316E6A5cc") + await signer.signMessage({ + raw: "0xabcfC3DB1e0f5023F5a4f40c03D149f316E6A5cc", + }) ).toMatchInlineSnapshot( '"0x35761512143ffd8da07c93c5a0136424fe935b48e77076f501a57745c16268bf0d9a5d6209b12d5f8b62f96f0991372e046092fd6b1e3bfa610eb51607a28f7e1b"' ); @@ -32,7 +34,9 @@ describe("Local Account Signer Tests", () => { it("should sign a byte array correctly", async () => { const signer = LocalAccountSigner.mnemonicToAccountSigner(dummyMnemonic); expect( - await signer.signMessage(new TextEncoder().encode("hello, I'm moldy")) + await signer.signMessage({ + raw: new TextEncoder().encode("hello, I'm moldy"), + }) ).toEqual(await signer.signMessage("hello, I'm moldy")); }); }); @@ -45,7 +49,9 @@ describe("Local Account Signer Tests", () => { const signer = LocalAccountSigner.privateKeyToAccountSigner(dummyPrivateKey); expect( - await signer.signMessage("0xabcfC3DB1e0f5023F5a4f40c03D149f316E6A5cc") + await signer.signMessage({ + raw: "0xabcfC3DB1e0f5023F5a4f40c03D149f316E6A5cc", + }) ).toMatchInlineSnapshot( '"0x91b6680c8f442f46ca71fee15cdd8c9e25693baeb4006d1908a453fd145315ce21a5e7f2ce9760fc993d65e8450fa5225d8dee12972886bdacbb989ca0b09c6c1b"' ); @@ -71,7 +77,9 @@ describe("Local Account Signer Tests", () => { const signer = LocalAccountSigner.privateKeyToAccountSigner(dummyPrivateKey); expect( - await signer.signMessage(new TextEncoder().encode("hello, I'm moldy")) + await signer.signMessage({ + raw: new TextEncoder().encode("hello, I'm moldy"), + }) ).toEqual(await signer.signMessage("hello, I'm moldy")); }); }); diff --git a/packages/core/src/signer/local-account.ts b/packages/core/src/signer/local-account.ts index 06c2443f44..f587d3702e 100644 --- a/packages/core/src/signer/local-account.ts +++ b/packages/core/src/signer/local-account.ts @@ -1,9 +1,9 @@ import { - isHex, type HDAccount, type Hex, type LocalAccount, type PrivateKeyAccount, + type SignableMessage, type TypedData, type TypedDataDefinition, } from "viem"; @@ -22,20 +22,10 @@ export class LocalAccountSigner< this.signerType = inner.type; // type: "local" } - readonly signMessage: (msg: string | Uint8Array) => Promise<`0x${string}`> = ( - msg + readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> = ( + message ) => { - if (typeof msg === "string" && !isHex(msg)) { - return this.inner.signMessage({ - message: msg, - }); - } else { - return this.inner.signMessage({ - message: { - raw: msg, - }, - }); - } + return this.inner.signMessage({ message }); }; readonly signTypedData = async < diff --git a/packages/core/src/signer/types.ts b/packages/core/src/signer/types.ts index 63c8353d36..99d5ffb158 100644 --- a/packages/core/src/signer/types.ts +++ b/packages/core/src/signer/types.ts @@ -1,5 +1,10 @@ import type { Address } from "abitype"; -import type { Hex, TypedData, TypedDataDefinition } from "viem"; +import type { + Hex, + SignableMessage, + TypedData, + TypedDataDefinition, +} from "viem"; /** * Extends the @interface SmartAccountSigner interface with authentication. @@ -36,7 +41,7 @@ export interface SmartAccountSigner { getAddress: () => Promise
; - signMessage: (msg: Uint8Array | Hex | string) => Promise; + signMessage: (message: SignableMessage) => Promise; signTypedData: < const TTypedData extends TypedData | { [key: string]: unknown }, diff --git a/packages/core/src/signer/wallet-client.ts b/packages/core/src/signer/wallet-client.ts index 7fb5785cf6..ffbd67862b 100644 --- a/packages/core/src/signer/wallet-client.ts +++ b/packages/core/src/signer/wallet-client.ts @@ -1,8 +1,7 @@ import { getAddress, - isHex, - type ByteArray, type Hex, + type SignableMessage, type TypedData, type TypedDataDefinition, type WalletClient, @@ -27,23 +26,12 @@ export class WalletClientSigner implements SmartAccountSigner { return getAddress(addresses[0]); }; - readonly signMessage: ( - message: string | Hex | ByteArray - ) => Promise<`0x${string}`> = async (message) => { - const account = this.inner.account ?? (await this.getAddress()); + readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> = + async (message) => { + const account = this.inner.account ?? (await this.getAddress()); - if (typeof message === "string" && !isHex(message)) { - return this.inner.signMessage({ - account, - message, - }); - } else { - return this.inner.signMessage({ - account, - message: { raw: message }, - }); - } - }; + return this.inner.signMessage({ message, account }); + }; signTypedData = async < const TTypedData extends TypedData | { [key: string]: unknown }, diff --git a/packages/ethers/src/account-signer.ts b/packages/ethers/src/account-signer.ts index 079f11a4b4..2bcf275b93 100644 --- a/packages/ethers/src/account-signer.ts +++ b/packages/ethers/src/account-signer.ts @@ -14,7 +14,7 @@ import { type TransactionRequest, type TransactionResponse, } from "@ethersproject/providers"; -import { isHex } from "viem"; +import { isHex, toBytes } from "viem"; import { EthersProviderAdapter } from "./provider-adapter.js"; const hexlifyOptional = (value: any): `0x${string}` | undefined => { @@ -70,7 +70,7 @@ export class AccountSigner< message: typeof message === "string" && !isHex(message) ? message - : { raw: message }, + : { raw: isHex(message) ? toBytes(message) : message }, }); } diff --git a/packages/ethers/src/utils.ts b/packages/ethers/src/utils.ts index 69c9d43eaa..bbd642d414 100644 --- a/packages/ethers/src/utils.ts +++ b/packages/ethers/src/utils.ts @@ -1,7 +1,7 @@ import type { Address, SmartAccountSigner } from "@alchemy/aa-core"; import type { Signer } from "@ethersproject/abstract-signer"; import { Wallet } from "@ethersproject/wallet"; -import type { TypedData, TypedDataDefinition } from "viem"; +import type { SignableMessage, TypedData, TypedDataDefinition } from "viem"; /** * Converts a ethersjs Wallet to a SmartAccountSigner @@ -15,8 +15,10 @@ export const convertWalletToAccountSigner = ( inner: wallet, signerType: "local", getAddress: async () => Promise.resolve(wallet.address as `0x${string}`), - signMessage: async (msg: Uint8Array | string) => - (await wallet.signMessage(msg)) as `0x${string}`, + signMessage: async (msg: SignableMessage) => + (await wallet.signMessage( + typeof msg === "string" ? msg : msg.raw + )) as `0x${string}`, signTypedData: async < const TTypedData extends TypedData | { [key: string]: unknown }, TPrimaryType extends string = string @@ -45,8 +47,10 @@ export const convertEthersSignerToAccountSigner = ( inner: signer, signerType: "json-rpc", getAddress: async () => signer.getAddress() as Promise
, - signMessage: async (msg: Uint8Array | string) => - (await signer.signMessage(msg)) as `0x${string}`, + signMessage: async (msg: SignableMessage) => + (await signer.signMessage( + typeof msg === "string" ? msg : msg.raw + )) as `0x${string}`, signTypedData: async < const TTypedData extends TypedData | { [key: string]: unknown }, TPrimaryType extends string = string diff --git a/packages/signers/src/arcana-auth/signer.ts b/packages/signers/src/arcana-auth/signer.ts index 54f0278f88..6124f535ff 100644 --- a/packages/signers/src/arcana-auth/signer.ts +++ b/packages/signers/src/arcana-auth/signer.ts @@ -11,6 +11,7 @@ import { createWalletClient, custom, type Hash, + type SignableMessage, type TypedData, type TypedDataDefinition, } from "viem"; @@ -57,7 +58,7 @@ export class ArcanaAuthSigner return address as Hash; }; - signMessage = async (msg: Uint8Array | string) => { + signMessage = async (msg: SignableMessage) => { if (!this.signer) throw new Error("Not authenticated"); return this.signer.signMessage(msg); diff --git a/packages/signers/src/capsule/signer.ts b/packages/signers/src/capsule/signer.ts index b04985fa3e..fce72c9c5d 100644 --- a/packages/signers/src/capsule/signer.ts +++ b/packages/signers/src/capsule/signer.ts @@ -7,6 +7,7 @@ import { createWalletClient, custom, type Hash, + type SignableMessage, type TypedData, type TypedDataDefinition, type WalletClient, @@ -64,7 +65,7 @@ export class CapsuleSigner return address as Hash; }; - signMessage = async (msg: Uint8Array | string) => { + signMessage = async (msg: SignableMessage) => { if (!this.signer) throw new Error("Not authenticated"); return this.signer.signMessage(msg); diff --git a/packages/signers/src/fireblocks/signer.ts b/packages/signers/src/fireblocks/signer.ts index 266ec0c427..eee1edde78 100644 --- a/packages/signers/src/fireblocks/signer.ts +++ b/packages/signers/src/fireblocks/signer.ts @@ -10,6 +10,7 @@ import { createWalletClient, custom, type Hash, + type SignableMessage, type TypedData, type TypedDataDefinition, } from "viem"; @@ -58,7 +59,7 @@ export class FireblocksSigner return address as Hash; }; - signMessage = async (msg: Uint8Array | string) => { + signMessage = async (msg: SignableMessage) => { if (!this.signer) throw new Error("Not authenticated"); return this.signer.signMessage(msg); diff --git a/packages/signers/src/lit-protocol/signer.ts b/packages/signers/src/lit-protocol/signer.ts index f8bf0ced14..309a612ffd 100644 --- a/packages/signers/src/lit-protocol/signer.ts +++ b/packages/signers/src/lit-protocol/signer.ts @@ -9,12 +9,13 @@ import { type LITEVMChain, type SessionSigsMap, } from "@lit-protocol/types"; -import type { - Address, - Hex, - TypedData, - TypedDataDefinition, - TypedDataDomain, +import { + type Address, + type Hex, + type SignableMessage, + type TypedData, + type TypedDataDefinition, + type TypedDataDomain, } from "viem"; import { signerTypePrefix } from "../constants.js"; import { @@ -92,10 +93,12 @@ export class LitSigner return this.signer?.getAddress() as Promise
; }; - signMessage = async (msg: Uint8Array | string) => { + signMessage = async (msg: SignableMessage) => { this._checkInternals(); - return this.signer?.signMessage(msg) as Promise; + return this.signer?.signMessage( + typeof msg === "string" ? msg : msg.raw + ) as Promise; }; signTypedData = async < diff --git a/packages/signers/src/magic/signer.ts b/packages/signers/src/magic/signer.ts index 7fab1c9e91..4d7db5c000 100644 --- a/packages/signers/src/magic/signer.ts +++ b/packages/signers/src/magic/signer.ts @@ -7,6 +7,7 @@ import { createWalletClient, custom, type Hash, + type SignableMessage, type TypedData, type TypedDataDefinition, } from "viem"; @@ -46,7 +47,7 @@ export class MagicSigner return address as Hash; }; - signMessage = async (msg: Uint8Array | string) => { + signMessage = async (msg: SignableMessage) => { if (!this.signer) throw new Error("Not authenticated"); return this.signer.signMessage(msg); diff --git a/packages/signers/src/particle/signer.ts b/packages/signers/src/particle/signer.ts index 8a8c32adbf..ed38b2e7d3 100644 --- a/packages/signers/src/particle/signer.ts +++ b/packages/signers/src/particle/signer.ts @@ -12,6 +12,7 @@ import { createWalletClient, custom, type Hash, + type SignableMessage, type TypedData, type TypedDataDefinition, } from "viem"; @@ -85,7 +86,7 @@ export class ParticleSigner return address as Hash; }; - signMessage = async (msg: Uint8Array | string) => { + signMessage = async (msg: SignableMessage) => { if (!this.signer) throw new Error("Not authenticated"); return this.signer.signMessage(msg); diff --git a/packages/signers/src/portal/signer.ts b/packages/signers/src/portal/signer.ts index dc491ec36e..444dc77b80 100644 --- a/packages/signers/src/portal/signer.ts +++ b/packages/signers/src/portal/signer.ts @@ -7,6 +7,7 @@ import { createWalletClient, custom, type Hash, + type SignableMessage, type TypedData, type TypedDataDefinition, } from "viem"; @@ -50,7 +51,7 @@ export class PortalSigner return address as Hash; }; - signMessage = async (msg: Uint8Array | string) => { + signMessage = async (msg: SignableMessage) => { if (!this.signer) throw new Error("Not authenticated"); return this.signer.signMessage(msg); diff --git a/packages/signers/src/turnkey/signer.ts b/packages/signers/src/turnkey/signer.ts index ffb5ec0538..5e4eb6c27b 100644 --- a/packages/signers/src/turnkey/signer.ts +++ b/packages/signers/src/turnkey/signer.ts @@ -7,6 +7,7 @@ import { createAccount } from "@turnkey/viem"; import { createWalletClient, type LocalAccount, + type SignableMessage, type TypedData, type TypedDataDefinition, } from "viem"; @@ -54,7 +55,7 @@ export class TurnkeySigner return this.signer.getAddress(); }; - signMessage = async (msg: Uint8Array | string) => { + signMessage = async (msg: SignableMessage) => { if (!this.signer) throw new Error("Not authenticated"); return this.signer.signMessage(msg); diff --git a/packages/signers/src/web3auth/signer.ts b/packages/signers/src/web3auth/signer.ts index d7cffd5ddd..60c0673b02 100644 --- a/packages/signers/src/web3auth/signer.ts +++ b/packages/signers/src/web3auth/signer.ts @@ -7,6 +7,7 @@ import { createWalletClient, custom, type Hash, + type SignableMessage, type TypedData, type TypedDataDefinition, } from "viem"; @@ -54,7 +55,7 @@ export class Web3AuthSigner return address as Hash; }; - signMessage = async (msg: Uint8Array | string) => { + signMessage = async (msg: SignableMessage) => { if (!this.signer) throw new Error("Not authenticated"); return this.signer.signMessage(msg); From 1771432d6e14af2d4d9f451fa4aaac6befc59af9 Mon Sep 17 00:00:00 2001 From: Will Hennessy Date: Wed, 14 Feb 2024 12:24:41 -0800 Subject: [PATCH 05/12] docs: copy edits (#457) * edits, lowercase sidebar, move eoa signer doc * change title --------- Co-authored-by: Michael Moldoveanu --- site/.vitepress/sidebar/index.ts | 38 ++++++++++++++++---------------- site/getting-started/overview.md | 6 ++--- site/getting-started/setup.md | 22 +++++++++--------- site/signers/{guides => }/eoa.md | 0 site/third-party/paymasters.md | 2 +- 5 files changed, 34 insertions(+), 34 deletions(-) rename site/signers/{guides => }/eoa.md (100%) diff --git a/site/.vitepress/sidebar/index.ts b/site/.vitepress/sidebar/index.ts index f44557a66f..8831e98c1a 100644 --- a/site/.vitepress/sidebar/index.ts +++ b/site/.vitepress/sidebar/index.ts @@ -13,7 +13,7 @@ export const sidebar: DefaultTheme.Sidebar = [ ], }, { - text: "Choosing a Smart Account", + text: "Choosing a smart account", items: [ { text: "Introduction", link: "/smart-accounts/" }, { @@ -25,7 +25,7 @@ export const sidebar: DefaultTheme.Sidebar = [ { text: "Getting started", link: "/getting-started" }, { text: "Deployments", link: "/deployments" }, { - text: "Upgrading to a Modular Account", + text: "Upgrading to Modular Account", link: "/upgrade-la-to-ma", }, ], @@ -35,7 +35,7 @@ export const sidebar: DefaultTheme.Sidebar = [ link: "/smart-accounts/light-account/", }, { - text: "Custom Accounts", + text: "Custom accounts", collapsed: true, base: "/smart-accounts/custom", items: [ @@ -47,13 +47,13 @@ export const sidebar: DefaultTheme.Sidebar = [ ], }, { - text: "Choosing a Signer", + text: "Choosing a signer", base: "/signers", items: [ { text: "Introduction", link: "/choosing-a-signer" }, - // { text: "Alchemy Signer", link: "/alchemy-signer" }, + // { text: "Alchemy signer", link: "/alchemy-signer" }, { - text: "Signer guides", + text: "Third-party signers", base: "/signers/guides", collapsed: true, items: [ @@ -70,11 +70,11 @@ export const sidebar: DefaultTheme.Sidebar = [ { text: "Arcana Auth", link: "/arcana-auth" }, { text: "Dfns", link: "/dfns" }, { text: "WalletKit", link: "/walletkit" }, - { text: "Externally Owned Account (EOA)", link: "/eoa" }, ], }, + { text: "EOA signer", link: "/eoa" }, { - text: "Custom Signer", + text: "Custom signer", collapsed: true, items: [ { @@ -82,7 +82,7 @@ export const sidebar: DefaultTheme.Sidebar = [ link: "/guides/custom-signer", }, { - text: "Contribute your Signer", + text: "Contribute your signer", link: "/contributing", }, ], @@ -90,7 +90,7 @@ export const sidebar: DefaultTheme.Sidebar = [ ], }, { - text: "Using Smart Accounts", + text: "Using smart accounts", base: "/using-smart-accounts", items: [ { text: "Send user operations", link: "/send-user-operations" }, @@ -100,13 +100,13 @@ export const sidebar: DefaultTheme.Sidebar = [ collapsed: false, base: "/using-smart-accounts/sponsoring-gas", items: [ - { text: "Alchemy Gas Manager", link: "/gas-manager" }, + { text: "Use the Gas Manager", link: "/gas-manager" }, { text: "Check eligibility", link: "/checking-eligibility" }, ], }, - { text: "Simulate User Operations", link: "/simulate-user-operations" }, + { text: "Simulate user ops", link: "/simulate-user-operations" }, { - text: "Session Keys", + text: "Session keys", base: "/using-smart-accounts/session-keys", collapsed: false, items: [ @@ -130,21 +130,21 @@ export const sidebar: DefaultTheme.Sidebar = [ ], }, { - text: "Alchemy Enhanced Apis", + text: "Alchemy enhanced APIs", base: "/using-smart-accounts/enhanced-apis", collapsed: false, items: [ { - text: "Get Account's NFTs", + text: "Get account NFTs", link: "/nft", }, - { text: "Get Account's tokens", link: "/token" }, + { text: "Get account tokens", link: "/token" }, ], }, ], }, { - text: "Extending Smart Accounts", + text: "Extending smart accounts", base: "/extending-smart-accounts", items: [ { @@ -161,8 +161,8 @@ export const sidebar: DefaultTheme.Sidebar = [ text: "Custom infra", base: "/third-party", items: [ - { text: "Bundlers", link: "/bundlers" }, - { text: "Paymasters", link: "/paymasters" }, + { text: "Use custom bundler", link: "/bundlers" }, + { text: "Use custom paymaster", link: "/paymasters" }, ], }, packagesSidebar, diff --git a/site/getting-started/overview.md b/site/getting-started/overview.md index 0765405ab3..187e9f198e 100644 --- a/site/getting-started/overview.md +++ b/site/getting-started/overview.md @@ -20,7 +20,7 @@ head: # Why Account Kit? -It’s way too hard for new users to start using web3 apps. They have to jump through hoops like downloading an extension, backing up a seed phrase, funding their wallet with ETH to pay gas, and signing a transaction. +Onboarding to web3 should be as easy as a web2 app. Traditional wallets make you jump through hoops like downloading an extension, backing up a seed phrase, and funding a wallet with ETH. Each of these steps adds friction. As a result, most new users drop off before they ever reach the magic moment in your app! We need to make wallets, seed phrases, and gas costs disappear in order to onboard the next billion users. @@ -34,7 +34,7 @@ Account Kit makes it easy onboard users with smart accounts -- account abstracti # What is Account Kit? -**Account Kit** is a toolkit to embed smart accounts in your web3 app, unlocking powerful features like social login, gas sponsorship, and batched transactions. Integrate [account abstraction](https://www.alchemy.com/overviews/what-is-account-abstraction/?a=ak-docs) with just a few lines of code to deploy your first smart accounts and start sending user operations! +**Account Kit** provides all the tools you need to build smart accounts in your web3 app, unlocking powerful features like social login, gas sponsorship, and batched transactions. Integrate [account abstraction](https://www.alchemy.com/overviews/what-is-account-abstraction/?a=ak-docs) with just a few lines of code to deploy your first smart accounts and start sending user operations! Account Kit includes five components: @@ -58,7 +58,7 @@ The `aa-sdk` is modular at every layer of the stack and can be easily extended t Get started with `aa-sdk` in our [Getting started](/getting-started/setup) guide or checkout the [open source repo](https://github.com/alchemyplatform/aa-sdk). -## Light Account +## Modular Account `ModularAccount` is a secure, audited, and modular ERC-4337 smart account. diff --git a/site/getting-started/setup.md b/site/getting-started/setup.md index 459d4d6c4e..988fbe9ec4 100644 --- a/site/getting-started/setup.md +++ b/site/getting-started/setup.md @@ -18,13 +18,13 @@ head: content: Learn how to get started with Alchemy's Account Kit, a vertically integrated stack for building apps that support ERC-4337 and ERC-6900. --- -# Quick Start +# Quick start -This guide will help you get started with Account Kit by setting up your environment, creating a smart account, and sending a `UserOperation` (UO) on its behalf. By the end of this guide, you'll have a basic understanding of how to use the SDK and where to look for more advanced use cases. +This guide will help you get started with Account Kit by setting up your environment, creating a smart account, and sending a User Operation (UO). By the end of this guide, you'll have a basic understanding of how to use the SDK and where to look for more advanced use cases. ## 1. Install the packages -In your project directory, you'll need to run the following to install the required packages: +Run the following command in your project directory to install the required packages: ::: code-group @@ -42,11 +42,11 @@ yarn add @alchemy/aa-alchemy @alchemy/aa-core @alchemy/aa-accounts @alchemy/aa-s ::: tip Note -We're installing [viem](https://viem.sh/) as well. Viem contains helpful abstractions and modules that will come in handy when using Account Kit. Additionally, many Account Kit modules use `viem` themselves. +Next, install [viem](https://viem.sh/) by running the below command. Viem contains helpful abstractions and modules that will come in handy when using Account Kit. Additionally, many Account Kit modules use `viem` themselves. ::: -Make sure your new `package.json` file looks something like the following. Note that we have `"type": module` in `package.json` for this example: +Make sure your new `package.json` file looks similar to the below. Note that we have `"type": module` in `package.json` for this example: ```json [package.json] { @@ -68,7 +68,7 @@ Make sure your new `package.json` file looks something like the following. Note } ``` -You'll also want to make sure your `Node` version is _18.16.0_ using your version manager: +Also make sure your `Node` version is _18.16.0_ using your version manager: ::: code-group @@ -95,7 +95,7 @@ To read or write any data to a blockchain, you'll need an Alchemy API Key and RP ## 3. Query your Smart Account Address -Using the SDK in the following example, we'll use the Account Kit to generate the address of your smart account from which to eventually send a UO. +Using the SDK in the following example, we'll use Account Kit to generate the address of your smart account from which to eventually send a UO. <<< @/snippets/getting-started/client.ts @@ -105,7 +105,7 @@ Copy the above into `index.ts`. To run the script, do: npx tsx index.ts ``` -You'll get a response like this on your terminal: +You'll get a response like this in your terminal: ``` Smart Account Address: 0xYOUR_SMART_ACCOUNT_ADDRESS @@ -113,15 +113,15 @@ Smart Account Address: 0xYOUR_SMART_ACCOUNT_ADDRESS ## 4. Fund your Smart Account -To deploy the smart account and send UOs on its behalf, you'll need to add native token to your smart account. +At scale, you can use our Gas Manager to [sponsor User Operations](/using-smart-accounts/sponsoring-gas/gas-manager) for smart accounts so the user doesn't need to fund their account. -At scale, you might consider using our Gas Manager to [sponsor UserOperations](/using-smart-accounts/sponsoring-gas/gas-manager) for smart accounts. But for the purpose of this example, and because we're using a testnet, let's fund the account using the [Alchemy Faucet](https://sepoliafaucet.com). Make sure to log in with Alchemy to receive your testnet tokens. +But for this quickstart guide, and because we're developing on a testnet, let's fund the account using the [Alchemy Faucet](https://sepoliafaucet.com). Simply log in with Alchemy and claim your testnet tokens for free. Account Kit Overview ## 5. Send a User Operation using Account Kit -Finally, let's deploy the newly funded smart account and send a UO on its behalf. +Finally, deploy the newly funded smart account and send a UO on its behalf. <<< @/snippets/getting-started/send-user-operation.ts diff --git a/site/signers/guides/eoa.md b/site/signers/eoa.md similarity index 100% rename from site/signers/guides/eoa.md rename to site/signers/eoa.md diff --git a/site/third-party/paymasters.md b/site/third-party/paymasters.md index 1eade63bbb..186518a0f1 100644 --- a/site/third-party/paymasters.md +++ b/site/third-party/paymasters.md @@ -18,7 +18,7 @@ head: content: Learn how to use a 3rd party Paymaster with Account Kit --- -# Using a 3rd party Paymaster +# Using a third-party paymaster The `SmartAccountClient` within `@alchemy/aa-core` is unopinionated about which paymaster you use, so you can connect to any paymaster really simply. Configuration is done using the the `paymasterAndData` config option when you call `createSmartAccountClient`. From d8417cd79c27f02686cbed3bd43a8aff5bec8fb2 Mon Sep 17 00:00:00 2001 From: Alchemy Bot Date: Wed, 14 Feb 2024 20:33:37 +0000 Subject: [PATCH 06/12] chore(release): publish v3.0.0-alpha.10 [skip-ci] --- CHANGELOG.md | 6 ++++++ lerna.json | 2 +- packages/accounts/CHANGELOG.md | 4 ++++ packages/accounts/package.json | 4 ++-- packages/alchemy/CHANGELOG.md | 4 ++++ packages/alchemy/package.json | 4 ++-- packages/alchemy/src/version.ts | 2 +- packages/core/CHANGELOG.md | 4 ++++ packages/core/package.json | 2 +- packages/core/src/version.ts | 2 +- packages/ethers/CHANGELOG.md | 4 ++++ packages/ethers/package.json | 4 ++-- packages/signers/CHANGELOG.md | 4 ++++ packages/signers/package.json | 4 ++-- 14 files changed, 38 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d1b012238..0e0fee4baf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0-alpha.10](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.9...v3.0.0-alpha.10) (2024-02-14) + +### Bug Fixes + +- update the docs for using a custom account ([#456](https://github.com/alchemyplatform/aa-sdk/issues/456)) ([fb2a541](https://github.com/alchemyplatform/aa-sdk/commit/fb2a5417c19b4f9c335ed86438b7ba81fbb8472d)) + # [3.0.0-alpha.9](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.8...v3.0.0-alpha.9) (2024-02-13) ### Features diff --git a/lerna.json b/lerna.json index 72fe10b24f..082a53c135 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "3.0.0-alpha.9", + "version": "3.0.0-alpha.10", "npmClient": "yarn", "conventionalCommits": true, "conventionalPrerelease": true, diff --git a/packages/accounts/CHANGELOG.md b/packages/accounts/CHANGELOG.md index 05079cbfb3..c22afba409 100644 --- a/packages/accounts/CHANGELOG.md +++ b/packages/accounts/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0-alpha.10](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.9...v3.0.0-alpha.10) (2024-02-14) + +**Note:** Version bump only for package @alchemy/aa-accounts + # [3.0.0-alpha.9](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.8...v3.0.0-alpha.9) (2024-02-13) ### Features diff --git a/packages/accounts/package.json b/packages/accounts/package.json index 534795ce2b..993a79ba8b 100644 --- a/packages/accounts/package.json +++ b/packages/accounts/package.json @@ -1,6 +1,6 @@ { "name": "@alchemy/aa-accounts", - "version": "3.0.0-alpha.9", + "version": "3.0.0-alpha.10", "description": "A collection of ERC-4337 compliant smart contract account interfaces", "author": "Alchemy", "license": "MIT", @@ -74,7 +74,7 @@ "homepage": "https://github.com/alchemyplatform/aa-sdk#readme", "gitHead": "ee46e8bb857de3b631044fa70714ea706d9e317d", "dependencies": { - "@alchemy/aa-core": "^3.0.0-alpha.9", + "@alchemy/aa-core": "^3.0.0-alpha.10", "viem": "^2.7.8" } } diff --git a/packages/alchemy/CHANGELOG.md b/packages/alchemy/CHANGELOG.md index da34c53352..025d5a81b7 100644 --- a/packages/alchemy/CHANGELOG.md +++ b/packages/alchemy/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0-alpha.10](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.9...v3.0.0-alpha.10) (2024-02-14) + +**Note:** Version bump only for package @alchemy/aa-alchemy + # [3.0.0-alpha.9](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.8...v3.0.0-alpha.9) (2024-02-13) ### Features diff --git a/packages/alchemy/package.json b/packages/alchemy/package.json index 6ad9abc74e..62e2e5af5c 100644 --- a/packages/alchemy/package.json +++ b/packages/alchemy/package.json @@ -1,6 +1,6 @@ { "name": "@alchemy/aa-alchemy", - "version": "3.0.0-alpha.9", + "version": "3.0.0-alpha.10", "description": "adapters for @alchemy/aa-core for interacting with alchemy services", "author": "Alchemy", "license": "MIT", @@ -46,7 +46,7 @@ "vitest": "^0.31.0" }, "dependencies": { - "@alchemy/aa-core": "^3.0.0-alpha.9", + "@alchemy/aa-core": "^3.0.0-alpha.10", "@turnkey/http": "^2.6.2", "@turnkey/iframe-stamper": "^1.0.0", "@turnkey/viem": "^0.4.8", diff --git a/packages/alchemy/src/version.ts b/packages/alchemy/src/version.ts index 6f6e174211..6042052809 100644 --- a/packages/alchemy/src/version.ts +++ b/packages/alchemy/src/version.ts @@ -1,3 +1,3 @@ // This file is autogenerated by inject-version.ts. Any changes will be // overwritten on commit! -export const VERSION = "3.0.0-alpha.9"; +export const VERSION = "3.0.0-alpha.10"; diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 5cc9327d19..938083e98a 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0-alpha.10](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.9...v3.0.0-alpha.10) (2024-02-14) + +**Note:** Version bump only for package @alchemy/aa-core + # [3.0.0-alpha.9](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.8...v3.0.0-alpha.9) (2024-02-13) ### Features diff --git a/packages/core/package.json b/packages/core/package.json index 6ca21e8363..65ca042c93 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@alchemy/aa-core", "license": "MIT", - "version": "3.0.0-alpha.9", + "version": "3.0.0-alpha.10", "description": "viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts", "author": "Alchemy", "type": "module", diff --git a/packages/core/src/version.ts b/packages/core/src/version.ts index 6f6e174211..6042052809 100644 --- a/packages/core/src/version.ts +++ b/packages/core/src/version.ts @@ -1,3 +1,3 @@ // This file is autogenerated by inject-version.ts. Any changes will be // overwritten on commit! -export const VERSION = "3.0.0-alpha.9"; +export const VERSION = "3.0.0-alpha.10"; diff --git a/packages/ethers/CHANGELOG.md b/packages/ethers/CHANGELOG.md index a5b457c3d0..37aeb7307e 100644 --- a/packages/ethers/CHANGELOG.md +++ b/packages/ethers/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0-alpha.10](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.9...v3.0.0-alpha.10) (2024-02-14) + +**Note:** Version bump only for package @alchemy/aa-ethers + # [3.0.0-alpha.9](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.8...v3.0.0-alpha.9) (2024-02-13) ### Features diff --git a/packages/ethers/package.json b/packages/ethers/package.json index be86f6bab0..e4fad1dbd2 100644 --- a/packages/ethers/package.json +++ b/packages/ethers/package.json @@ -1,7 +1,7 @@ { "name": "@alchemy/aa-ethers", "license": "MIT", - "version": "3.0.0-alpha.9", + "version": "3.0.0-alpha.10", "description": "Ethers.js wrapper for @alchemy/aa-core", "author": "Alchemy", "type": "module", @@ -49,7 +49,7 @@ "vitest": "^0.31.0" }, "dependencies": { - "@alchemy/aa-core": "^3.0.0-alpha.9", + "@alchemy/aa-core": "^3.0.0-alpha.10", "@ethersproject/abi": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/bytes": "^5.7.0", diff --git a/packages/signers/CHANGELOG.md b/packages/signers/CHANGELOG.md index 9dddabf19d..1ee15928b6 100644 --- a/packages/signers/CHANGELOG.md +++ b/packages/signers/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0-alpha.10](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.9...v3.0.0-alpha.10) (2024-02-14) + +**Note:** Version bump only for package @alchemy/aa-signers + # [3.0.0-alpha.9](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.8...v3.0.0-alpha.9) (2024-02-13) ### Features diff --git a/packages/signers/package.json b/packages/signers/package.json index 5769c85377..10f77802ac 100644 --- a/packages/signers/package.json +++ b/packages/signers/package.json @@ -1,6 +1,6 @@ { "name": "@alchemy/aa-signers", - "version": "3.0.0-alpha.9", + "version": "3.0.0-alpha.10", "description": "A collection of signers used to create ERC-4337 smart accounts", "author": "Alchemy", "license": "MIT", @@ -114,7 +114,7 @@ "homepage": "https://github.com/alchemyplatform/aa-sdk#readme", "gitHead": "ee46e8bb857de3b631044fa70714ea706d9e317d", "dependencies": { - "@alchemy/aa-core": "^3.0.0-alpha.9", + "@alchemy/aa-core": "^3.0.0-alpha.10", "viem": "^2.7.8" }, "optionalDependencies": { From 266c9757cd721ef0bd97d04c0b592a329f8a9da5 Mon Sep 17 00:00:00 2001 From: Dan Nolan Date: Wed, 14 Feb 2024 15:40:25 -0500 Subject: [PATCH 07/12] docs: signer guides switch from la to ma (#454) --- site/signers/guides/arcana-auth.md | 4 ++-- site/signers/guides/capsule.md | 5 +++-- site/signers/guides/dynamic.md | 4 ++-- site/signers/guides/fireblocks.md | 5 +++-- site/signers/guides/lit.md | 5 +++-- site/signers/guides/magic.md | 5 +++-- site/signers/guides/portal.md | 5 +++-- site/signers/guides/web3auth.md | 5 +++-- 8 files changed, 22 insertions(+), 16 deletions(-) diff --git a/site/signers/guides/arcana-auth.md b/site/signers/guides/arcana-auth.md index 1f0d25c255..a51bcf0e2b 100644 --- a/site/signers/guides/arcana-auth.md +++ b/site/signers/guides/arcana-auth.md @@ -50,9 +50,9 @@ Use the **clientId** assigned to your app via the dashboard and integrate with t <<< @/snippets/signers/arcana-auth.ts -### Use it with LightAccount +### Use it with Modular Account -Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `aa-accounts`: +Let's see it in action with `aa-alchemy`: ::: code-group diff --git a/site/signers/guides/capsule.md b/site/signers/guides/capsule.md index d48c823cc1..3a48cdc47e 100644 --- a/site/signers/guides/capsule.md +++ b/site/signers/guides/capsule.md @@ -71,9 +71,10 @@ Next, setup the Capsule SDK and create an authenticated `CapsuleSigner` using th <<< @/snippets/signers/capsule.ts -### Use it with Light Account +### Use it with Modular Account + +Let's see it in action with `aa-alchemy`: -Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `aa-accounts`: ::: code-group ```ts [alchemy.ts] diff --git a/site/signers/guides/dynamic.md b/site/signers/guides/dynamic.md index 49c7f8b9d3..65dcf37506 100644 --- a/site/signers/guides/dynamic.md +++ b/site/signers/guides/dynamic.md @@ -76,9 +76,9 @@ Next, inside any component which is wrapped by the above DynamicContextProvider, <<< @/snippets/signers/dynamic.ts -### Use it with Light Account +### Use it with Modular Account -Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `aa-accounts`: +Let's see it in action with `aa-alchemy`: ::: code-group ```ts [example.ts] diff --git a/site/signers/guides/fireblocks.md b/site/signers/guides/fireblocks.md index d3d45057a2..0029e216c0 100644 --- a/site/signers/guides/fireblocks.md +++ b/site/signers/guides/fireblocks.md @@ -52,9 +52,10 @@ Next, setup the Fireblocks SDK and create an authenticated `FireblocksSigner` us <<< @/snippets/signers/fireblocks.ts -### Use it with Light Account +### Use it with Modular Account + +Let's see it in action with `aa-alchemy`: -Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `aa-accounts`: ::: code-group ```ts [example.ts] diff --git a/site/signers/guides/lit.md b/site/signers/guides/lit.md index 616486c831..97b2b6492c 100644 --- a/site/signers/guides/lit.md +++ b/site/signers/guides/lit.md @@ -73,9 +73,10 @@ See documentation [here](https://developer.litprotocol.com/v3/sdk/wallets/mintin <<< @/snippets/signers/lit.ts -### Use it with Light Account +### Use it with Modular Account + +We can link our `SmartAccountSigner` to a Modular Account using `createModularAccountAlchemyClient` from `aa-alchemy`: -We can link our `SmartAccountSigner` to a `LightSmartContractAccount` from `aa-accounts`: ::: code-group ```ts [example.ts] diff --git a/site/signers/guides/magic.md b/site/signers/guides/magic.md index 8f532243a3..232a899241 100644 --- a/site/signers/guides/magic.md +++ b/site/signers/guides/magic.md @@ -50,9 +50,10 @@ Next, setup the magic sdk and create an authenticated `MagicSigner` using the `a <<< @/snippets/signers/magic.ts -### Use it with Light Account +### Use it with Modular Account + +Let's see it in action with `aa-alchemy`: -Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `aa-accounts`: ::: code-group ```ts [example.ts] diff --git a/site/signers/guides/portal.md b/site/signers/guides/portal.md index 2440c43ddc..ea9564b629 100644 --- a/site/signers/guides/portal.md +++ b/site/signers/guides/portal.md @@ -50,9 +50,10 @@ Next, setup the Portal SDK and create an authenticated `PortalSigner` using the <<< @/snippets/signers/portal.ts -### Use it with Light Account +### Use it with Modular Account + +Let's see it in action with `aa-alchemy`: -Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `aa-accounts`: ::: code-group ```ts [example.ts] diff --git a/site/signers/guides/web3auth.md b/site/signers/guides/web3auth.md index ab3cc4b0dc..b2068047d6 100644 --- a/site/signers/guides/web3auth.md +++ b/site/signers/guides/web3auth.md @@ -50,9 +50,10 @@ Next, setup the web3auth sdk and create a `SmartAccountSigner` using the `aa-sig <<< @/snippets/signers/web3auth.ts -### Use it with Light Account +### Use it with Modular Account + +Let's see it in action with `aa-alchemy`: -Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `aa-accounts`: ::: code-group ```ts [example.ts] From dc5536c8565de216d0c1ca16d72ca4bfdefe7147 Mon Sep 17 00:00:00 2001 From: Michael Moldoveanu Date: Wed, 14 Feb 2024 16:51:37 -0500 Subject: [PATCH 08/12] fix: session key extension was missing plugin overrides (#458) --- .../src/msca/plugins/session-key/extension.ts | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/accounts/src/msca/plugins/session-key/extension.ts b/packages/accounts/src/msca/plugins/session-key/extension.ts index b50427ae10..47d4edc72a 100644 --- a/packages/accounts/src/msca/plugins/session-key/extension.ts +++ b/packages/accounts/src/msca/plugins/session-key/extension.ts @@ -1,6 +1,7 @@ import { AccountNotFoundError, type GetAccountParameter, + type IsUndefined, type SendUserOperationResult, type SmartContractAccount, type UserOperationOverrides, @@ -50,6 +51,7 @@ export type SessionKeyPluginActions< key: Address; permissions: Hex[]; tag: Hex; + pluginAddress?: Address; overrides?: UserOperationOverrides; } & GetAccountParameter ) => Promise; @@ -67,10 +69,19 @@ export type SessionKeyPluginActions< args: { key: Address; permissions: Hex[]; + pluginAddress?: Address; overrides?: UserOperationOverrides; } & GetAccountParameter ) => Promise; -}; +} & (IsUndefined extends false + ? { + getAccountSessionKeys: ( + args?: { + pluginAddress?: Address; + } & GetAccountParameter + ) => Promise>; + } + : {}); export const sessionKeyPluginActions: < TTransport extends Transport = Transport, @@ -111,13 +122,16 @@ export const sessionKeyPluginActions: < return await contract.read.isSessionKeyOf([account.address, key]); }, - getAccountSessionKeys: async ({ - pluginAddress, - account = client.account, - }) => { + getAccountSessionKeys: async ( + args: { pluginAddress?: Address } & GetAccountParameter + ) => { + const account = args?.account ?? client.account; if (!account) throw new AccountNotFoundError(); - const contract = SessionKeyPlugin.getContract(client, pluginAddress); + const contract = SessionKeyPlugin.getContract( + client, + args?.pluginAddress + ); return await contract.read.sessionKeysOf([account.address]); }, @@ -148,6 +162,7 @@ export const sessionKeyPluginActions: < tag, permissions, overrides, + pluginAddress, account = client.account, }) => { if (!account) throw new AccountNotFoundError(); @@ -156,6 +171,7 @@ export const sessionKeyPluginActions: < args: [key, tag, permissions], overrides, account, + pluginAddress, }); }, @@ -179,6 +195,7 @@ export const sessionKeyPluginActions: < args: [oldKey, predecessor, newKey], overrides, account, + pluginAddress, }); }, @@ -186,6 +203,7 @@ export const sessionKeyPluginActions: < key, permissions, overrides, + pluginAddress, account = client.account, }) => { if (!account) throw new AccountNotFoundError(); @@ -194,6 +212,7 @@ export const sessionKeyPluginActions: < args: [key, permissions], overrides, account, + pluginAddress, }); }, }; From 0a4648883f3ee50ae8e886257ef0f2b3e86aac3c Mon Sep 17 00:00:00 2001 From: Alchemy Bot Date: Wed, 14 Feb 2024 21:56:01 +0000 Subject: [PATCH 09/12] chore(release): publish v3.0.0-alpha.11 [skip-ci] --- CHANGELOG.md | 6 ++++++ lerna.json | 2 +- packages/accounts/CHANGELOG.md | 6 ++++++ packages/accounts/package.json | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e0fee4baf..22a09f2437 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0-alpha.11](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.10...v3.0.0-alpha.11) (2024-02-14) + +### Bug Fixes + +- session key extension was missing plugin overrides ([#458](https://github.com/alchemyplatform/aa-sdk/issues/458)) ([dc5536c](https://github.com/alchemyplatform/aa-sdk/commit/dc5536c8565de216d0c1ca16d72ca4bfdefe7147)) + # [3.0.0-alpha.10](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.9...v3.0.0-alpha.10) (2024-02-14) ### Bug Fixes diff --git a/lerna.json b/lerna.json index 082a53c135..8e609dcd67 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "3.0.0-alpha.10", + "version": "3.0.0-alpha.11", "npmClient": "yarn", "conventionalCommits": true, "conventionalPrerelease": true, diff --git a/packages/accounts/CHANGELOG.md b/packages/accounts/CHANGELOG.md index c22afba409..5b33edaf88 100644 --- a/packages/accounts/CHANGELOG.md +++ b/packages/accounts/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0-alpha.11](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.10...v3.0.0-alpha.11) (2024-02-14) + +### Bug Fixes + +- session key extension was missing plugin overrides ([#458](https://github.com/alchemyplatform/aa-sdk/issues/458)) ([dc5536c](https://github.com/alchemyplatform/aa-sdk/commit/dc5536c8565de216d0c1ca16d72ca4bfdefe7147)) + # [3.0.0-alpha.10](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.9...v3.0.0-alpha.10) (2024-02-14) **Note:** Version bump only for package @alchemy/aa-accounts diff --git a/packages/accounts/package.json b/packages/accounts/package.json index 993a79ba8b..35a6a052f6 100644 --- a/packages/accounts/package.json +++ b/packages/accounts/package.json @@ -1,6 +1,6 @@ { "name": "@alchemy/aa-accounts", - "version": "3.0.0-alpha.10", + "version": "3.0.0-alpha.11", "description": "A collection of ERC-4337 compliant smart contract account interfaces", "author": "Alchemy", "license": "MIT", From bd9d75e0b0b93acdf8e0dce8f461157a0832500b Mon Sep 17 00:00:00 2001 From: moldy Date: Wed, 14 Feb 2024 17:47:38 -0500 Subject: [PATCH 10/12] fix: export the session key ACL type enum --- packages/accounts/src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/accounts/src/index.ts b/packages/accounts/src/index.ts index ab494d907c..9173f34a2b 100644 --- a/packages/accounts/src/index.ts +++ b/packages/accounts/src/index.ts @@ -42,7 +42,10 @@ export { export type * from "./msca/plugins/session-key/index.js"; export { sessionKeyPluginActions } from "./msca/plugins/session-key/index.js"; export type * from "./msca/plugins/session-key/permissions.js"; -export { SessionKeyPermissionsBuilder } from "./msca/plugins/session-key/permissions.js"; +export { + SessionKeyAccessListType, + SessionKeyPermissionsBuilder, +} from "./msca/plugins/session-key/permissions.js"; export { SessionKeyPlugin, SessionKeyPluginAbi, From 6bbf3d14565351d27826159df15f1f6dd2ba0f9a Mon Sep 17 00:00:00 2001 From: moldy Date: Wed, 14 Feb 2024 17:50:15 -0500 Subject: [PATCH 11/12] refactor: rename the ACL for session key type NONE --- packages/accounts/src/msca/plugins/session-key/permissions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/accounts/src/msca/plugins/session-key/permissions.ts b/packages/accounts/src/msca/plugins/session-key/permissions.ts index 5323bf6802..736ba6ec3d 100644 --- a/packages/accounts/src/msca/plugins/session-key/permissions.ts +++ b/packages/accounts/src/msca/plugins/session-key/permissions.ts @@ -4,7 +4,7 @@ import { SessionKeyPermissionsUpdatesAbi } from "./SessionKeyPermissionsUpdatesA export enum SessionKeyAccessListType { ALLOWLIST = 0, DENYLIST = 1, - NONE = 2, + ALLOW_ALL_ACCESS = 2, } export type ContractAccessEntry = { From 947f3ff4cd9bc7c17c755ef445cb05a662666d3d Mon Sep 17 00:00:00 2001 From: Alchemy Bot Date: Wed, 14 Feb 2024 22:56:05 +0000 Subject: [PATCH 12/12] chore(release): publish v3.0.0-alpha.12 [skip-ci] --- CHANGELOG.md | 6 ++++++ lerna.json | 2 +- packages/accounts/CHANGELOG.md | 6 ++++++ packages/accounts/package.json | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22a09f2437..debf66880c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0-alpha.12](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.11...v3.0.0-alpha.12) (2024-02-14) + +### Bug Fixes + +- export the session key ACL type enum ([bd9d75e](https://github.com/alchemyplatform/aa-sdk/commit/bd9d75e0b0b93acdf8e0dce8f461157a0832500b)) + # [3.0.0-alpha.11](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.10...v3.0.0-alpha.11) (2024-02-14) ### Bug Fixes diff --git a/lerna.json b/lerna.json index 8e609dcd67..fffc97bacc 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "3.0.0-alpha.11", + "version": "3.0.0-alpha.12", "npmClient": "yarn", "conventionalCommits": true, "conventionalPrerelease": true, diff --git a/packages/accounts/CHANGELOG.md b/packages/accounts/CHANGELOG.md index 5b33edaf88..f6f2cb8141 100644 --- a/packages/accounts/CHANGELOG.md +++ b/packages/accounts/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [3.0.0-alpha.12](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.11...v3.0.0-alpha.12) (2024-02-14) + +### Bug Fixes + +- export the session key ACL type enum ([bd9d75e](https://github.com/alchemyplatform/aa-sdk/commit/bd9d75e0b0b93acdf8e0dce8f461157a0832500b)) + # [3.0.0-alpha.11](https://github.com/alchemyplatform/aa-sdk/compare/v3.0.0-alpha.10...v3.0.0-alpha.11) (2024-02-14) ### Bug Fixes diff --git a/packages/accounts/package.json b/packages/accounts/package.json index 35a6a052f6..4b24246704 100644 --- a/packages/accounts/package.json +++ b/packages/accounts/package.json @@ -1,6 +1,6 @@ { "name": "@alchemy/aa-accounts", - "version": "3.0.0-alpha.11", + "version": "3.0.0-alpha.12", "description": "A collection of ERC-4337 compliant smart contract account interfaces", "author": "Alchemy", "license": "MIT",