Skip to content

Commit

Permalink
docs: clean up the signer docs to match the new interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
moldy530 committed Feb 1, 2024
1 parent db73c89 commit 2c1073c
Show file tree
Hide file tree
Showing 25 changed files with 68 additions and 193 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ There are currently 5 SDKs that are part of the `aa-sdk` suite:

The core SDK also implements an EIP-1193 provider interface to easily plug into any popular dapp or wallet connect libraries such as RainbowKit, Wagmi, and Web3Modal. It also includes [`ethers.js`](https://docs.ethers.org/v5/) adapters to provide full support for `ethers.js`` apps.

The `aa-sdk` is modular at every layer of the stack and can be easily extended to fit your custom needs. You can plug in any [smart account](https://accountkit.alchemy.com/smart-accounts/accounts/using-your-own) implementation, [Signer](https://accountkit.alchemy.com/smart-accounts/signers/overview), [Gas Manager API](https://accountkit.alchemy.com/overview/introduction.html#gas-manager-api) and RPC Provider.
The `aa-sdk` is modular at every layer of the stack and can be easily extended to fit your custom needs. You can plug in any [smart account](https://accountkit.alchemy.com/smart-accounts/accounts/using-your-own) implementation, [Signer](https://accountkit.alchemy.com/signers/overview), [Gas Manager API](https://accountkit.alchemy.com/overview/introduction.html#gas-manager-api) and RPC Provider.

## Getting Started

Expand Down
1 change: 0 additions & 1 deletion packages/alchemy/src/client/smartAccountClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export type AlchemySmartAccountClientConfig<
> = {
account?: account;
useSimulation?: boolean;
// TODO: this is missing the current gas manager fallback stuff
gasManagerConfig?: AlchemyGasManagerConfig;
} & AlchemyProviderConfig &
Pick<
Expand Down
4 changes: 2 additions & 2 deletions site/.vitepress/sidebar/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ export const newSidebar: DefaultTheme.Sidebar = [
},
{
text: "Choosing a Signer",
base: "/smart-accounts/signers",
base: "/signers",
items: [
{ text: "Introduction", link: "/choosing-a-signer" },
{
text: "Signer Guides",
base: "/smart-accounts/signers/guides",
base: "/signers/guides",
collapsed: true,
items: [
{ text: "Magic", link: "/magic" },
Expand Down
2 changes: 1 addition & 1 deletion site/getting-started/deploy-an-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The `LightAccount` implementation is not [ERC-6900](/smart-accounts/modular-acco

## 3. Choosing a Signer

A Signer is the entity that signs transactions (User Operations) on behalf of the smart account. It can be an EOA, a custodial service, or a multi-party computation (MPC) service. We explain the different types of signers in detail in the [overview](/smart-accounts/signers/choosing-a-signer) section on choosing a Signer and offer integration guides in these docs, many of which use our `aa-signers` SDK.
A Signer is the entity that signs transactions (User Operations) on behalf of the smart account. It can be an EOA, a custodial service, or a multi-party computation (MPC) service. We explain the different types of signers in detail in the [overview](/signers/choosing-a-signer) section on choosing a Signer and offer integration guides in these docs, many of which use our `aa-signers` SDK.

At this point you should be able to integrate smart accounts in your application. However, there are a few advanced features that can help you improve the user experience and save on gas costs. Information about these can be found in the `Guides` section.

Expand Down
2 changes: 1 addition & 1 deletion site/getting-started/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ In this guide, we initialized an `AlchemyProvider` with the `aa-alchemy` package

2. To learn about the end-to-end process of integrating smart accounts in your applications, check out the section on [Smart Accounts](/smart-accounts/).

3. To learn about the `owner` field on your smart account, check out the section on [Choosing a Signer](/smart-accounts/signers/choosing-a-signer) to own the smart account.
3. To learn about the `owner` field on your smart account, check out the section on [Choosing a Signer](/signers/choosing-a-signer) to own the smart account.

4. To learn more about different User Operations you can send with different `target` and `data` fields in the `sendUserOperation` function above, look at our [How to Send a User Operation](/using-smart-accounts/send-user-operations) guide for an example using NFT mints.

Expand Down
2 changes: 1 addition & 1 deletion site/glossary/terms.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ head:

## Account Kit

Account Kit is a framework designed to embed smart accounts in web3 applications. It includes a set of tools such as [Signer integrations](https://accountkit.alchemy.com/smart-accounts/signers/choosing-a-signer.html), [Gas Manager](https://docs.alchemy.com/docs/gas-manager-services) and [Bundler](https://docs.alchemy.com/docs/bundler-services) utilities that unlock features such as [gas sponsorship](https://accountkit.alchemy.com/using-smart-accounts/sponsoring-gas/gas-manager.html), [batched transactions](https://accountkit.alchemy.com/using-smart-accounts/batch-user-operations.html) and email/social login. With its user-friendly suite of SDKs, known as [aa-sdk](https://github.com/alchemyplatform/aa-sdk), Account Kit makes it easy to deploy smart accounts, manage `UserOperation`s, and handle gas sponsorship, streamlining the entire process with minimal coding effort.
Account Kit is a framework designed to embed smart accounts in web3 applications. It includes a set of tools such as [Signer integrations](https://accountkit.alchemy.com/signers/choosing-a-signer.html), [Gas Manager](https://docs.alchemy.com/docs/gas-manager-services) and [Bundler](https://docs.alchemy.com/docs/bundler-services) utilities that unlock features such as [gas sponsorship](https://accountkit.alchemy.com/using-smart-accounts/sponsoring-gas/gas-manager.html), [batched transactions](https://accountkit.alchemy.com/using-smart-accounts/batch-user-operations.html) and email/social login. With its user-friendly suite of SDKs, known as [aa-sdk](https://github.com/alchemyplatform/aa-sdk), Account Kit makes it easy to deploy smart accounts, manage `UserOperation`s, and handle gas sponsorship, streamlining the entire process with minimal coding effort.

## Bundler

Expand Down
4 changes: 2 additions & 2 deletions site/overview/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The `aa-sdk` is a type-safe and performant TypeScript library built on top of [v

The SDK also implements an EIP-1193 provider interface to easily plug into any popular dapp or wallet connect libraries such as RainbowKit, Wagmi, and Web3Modal. It also includes ethers.js adapters to provide full support for ethers.js apps.

The `aa-sdk` is modular at every layer of the stack and can be easily extended to fit your custom needs. You can plug in any [smart account](/smart-accounts/custom/using-your-own) implementation, [Signer](/smart-accounts/signers/choosing-a-signer), Gas Manager API, RPC provider.
The `aa-sdk` is modular at every layer of the stack and can be easily extended to fit your custom needs. You can plug in any [smart account](/smart-accounts/custom/using-your-own) implementation, [Signer](/signers/choosing-a-signer), Gas Manager API, RPC provider.

Get started with `aa-sdk` in our [Getting Started guide](/getting-started/setup) or checkout the [open source repo](https://github.com/alchemyplatform/aa-sdk).

Expand All @@ -66,7 +66,7 @@ To learn how to deploy a `LightAccount`, see [Light Account](/smart-accounts/lig

A Signer is responsible for securely managing the private key and signing transaction requests on the smart account. Account Kit supports many popular wallet signers. It also supports self-custodial wallets like MetaMask or Ledger.

To get started with a Signer, read the doc: [How to Choose a Signer](/smart-accounts/signers/choosing-a-signer).
To get started with a Signer, read the doc: [How to Choose a Signer](/signers/choosing-a-signer).

### Gas Manager API

Expand Down
4 changes: 2 additions & 2 deletions site/overview/why-account-kit.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ Streamline your sign up flow with simple web2 login options supported by Account
- Self-custodial wallets like MetaMask or Ledger
- and more

Account Kit integrates all the leading wallet Signers with integration guides that you can find [here](/smart-accounts/signers/choosing-a-signer). Account Kit even supports self-custodial wallets like MetaMask or Ledger. Users can even change their Signer later via Account Kit’s [ownership transfer](/using-smart-accounts/transfer-ownership/light-account) functionality.
Account Kit integrates all the leading wallet Signers with integration guides that you can find [here](/signers/choosing-a-signer). Account Kit even supports self-custodial wallets like MetaMask or Ledger. Users can even change their Signer later via Account Kit’s [ownership transfer](/using-smart-accounts/transfer-ownership/light-account) functionality.

Learn [how to choose and integrate the right Signer for your use case in this doc](/smart-accounts/signers/choosing-a-signer).
Learn [how to choose and integrate the right Signer for your use case in this doc](/signers/choosing-a-signer).

## Sponsor gas

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The Signer plays a crucial role in your app because it controls the user’s sma

Account Kit is compatible with any EIP-1193 provider. Many of the most popular signers can be configured in minutes through our integration signer guides.

If you want to use another Signer, you can integrate any other Signer by wrapping it in an [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) provider or using [`SmartAccountSigner`](/smart-accounts/signers/guides/custom-signer#implementing-smartaccountsigner) to adapt non-standard Signer.
If you want to use another Signer, you can integrate any other Signer by wrapping it in an [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) provider or using [`SmartAccountSigner`](/signers/guides/custom-signer#implementing-smartaccountsigner) to adapt non-standard Signer.

## Criteria to consider

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To ensure the best developer experience for anyone using Account Kit, we ask tha

There, you'll be able to implement [`SmartAccountAuthenticator`](https://github.com/alchemyplatform/aa-sdk/blob/main/packages/core/src/signer/types.ts#L15) interface from `aa-core` which offers a wrapper for any SDKs, `inner`, that you may use to call upon for implementation details. You may also wish to build your Signer implementation from scratch.

In either case, if your `Signer` or library exports an `EIP-1193` compliant provider, you may find it helpful to use [`WalletClientSigner`](/packages/aa-core/signers/wallet-client) from `aa-core` to easily integrate your Signer in `aa-signers`. See the ["Using Your Own Signer"](/smart-accounts/signers/guides/custom-signer) guide for more details.
In either case, if your `Signer` or library exports an `EIP-1193` compliant provider, you may find it helpful to use [`WalletClientSigner`](/packages/aa-core/signers/wallet-client) from `aa-core` to easily integrate your Signer in `aa-signers`. See the ["Using Your Own Signer"](/signers/guides/custom-signer) guide for more details.

Make sure to include unit tests along with your implementation! Take a look at these PRs from [Magic](https://github.com/alchemyplatform/aa-sdk/pull/229) and [Web3Auth](https://github.com/alchemyplatform/aa-sdk/pull/247) for reference.

Expand Down Expand Up @@ -99,12 +99,12 @@ Find the `Choosing a Signer` item in the `sidebar` and add a new entry in `items
// ... other entries
{
text: "Choosing a Signer",
base: "/smart-accounts/signers",
base: "/signers",
items: [
{ text: "Introduction", link: "/choosing-a-signer" },
{
text: "Signer Guides",
base: "/smart-accounts/signers/guides",
base: "/signers/guides",
collapsed: true,
items: [
// ... other signers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,19 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a
::: code-group

```ts [example.ts]
import { AlchemyProvider } from "@alchemy/aa-alchemy";
import {
LightSmartContractAccount,
getDefaultLightAccountFactoryAddress,
} from "@alchemy/aa-accounts";
import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy";
import { sepolia } from "@alchemy/aa-core";
import { createArcanaAuthSigner } from "./arcana-auth";

const chain = sepolia;

export async function getProvider() {
const signer = await createArcanaAuthSigner();
return new AlchemyProvider({
return createModularAccountAlchemyClient({
apiKey: "ALCHEMY_API_KEY",
chain,
}).connect(
(rpcClient) =>
new LightSmartContractAccount({
chain,
owner: signer,
factoryAddress: getDefaultLightAccountFactoryAddress(chain),
rpcClient,
})
);
owner: signer,
});
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,17 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a
::: code-group

```ts [alchemy.ts]
import { AlchemyProvider } from "@alchemy/aa-alchemy";
import {
LightSmartContractAccount,
getDefaultLightAccountFactoryAddress,
} from "@alchemy/aa-accounts";
import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy";
import { sepolia } from "@alchemy/aa-core";
import { createCapsuleSigner } from "./capsule";

const chain = sepolia;

const provider = new AlchemyProvider({
const provider = await createModularAccountAlchemyClient({
apiKey: "ALCHEMY_API_KEY",
chain,
}).connect(
(rpcClient) =>
new LightSmartContractAccount({
chain,
owner: await createCapsuleSigner(),
factoryAddress: getDefaultLightAccountFactoryAddress(chain),
rpcClient,
})
);
owner: await createCapsuleSigner(),
});
```

<<< @/snippets/signers/capsule.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Account Kit is designed to be flexible and allow you to use any Signer you want.
2. If your Signer is an [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) compliant provider, you can leverage `viem`'s `WalletClient` and the [`WalletClientSigner`](/packages/aa-core/signers/wallet-client) (exported in `aa-core`).

:::tip Note
If you want to add your Signer implementation to Account Kit's codebase, take a look at the [contibuting](/smart-accounts/signers/contributing) docs. We welcome Pull Requests onto the Github repo for [`aa-sdk`](https://github.com/alchemyplatform/aa-sdk)!
If you want to add your Signer implementation to Account Kit's codebase, take a look at the [contibuting](/signers/contributing) docs. We welcome Pull Requests onto the Github repo for [`aa-sdk`](https://github.com/alchemyplatform/aa-sdk)!
:::

## 1. Implementing `SmartAccountAuthenticator` or `SmartAccountSigner`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,20 @@ Setup the Dfns Web3 Provider and wrap it in an `AlchemyProvider`.
::: code-group

```ts [example.ts]
import { AlchemyProvider } from "@alchemy/aa-alchemy";
import {
LightSmartContractAccount,
getDefaultLightAccountFactoryAddress,
} from "@alchemy/aa-accounts";
import { encodeFunctionData, parseAbi } from "viem";
import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy";
import { sepolia } from "@alchemy/aa-core";
import { createDfnsSigner } from "./dfns";

// Remember to replace "ALCHEMY_API_KEY" with your own Alchemy API key, get one here: https://dashboard.alchemy.com/
const ALCHEMY_API_KEY = "API_KEY";
const chain = sepolia;

const createAlchemyProvider = async (): Promise<AlchemyProvider> => {
return new AlchemyProvider({
const createAlchemyProvider = async () => {
return createModularAccountAlchemyClient({
apiKey: ALCHEMY_API_KEY,
chain,
}).connect(
(rpcClient) =>
new LightSmartContractAccount({
chain,
owner: await createDfnsSigner(),
factoryAddress: getDefaultLightAccountFactoryAddress(chain),
rpcClient,
})
);
owner: await createDfnsSigner(),
});
};
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,17 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a
::: code-group

```ts [example.ts]
import { AlchemyProvider } from "@alchemy/aa-alchemy";
import {
LightSmartContractAccount,
getDefaultLightAccountFactoryAddress,
} from "@alchemy/aa-accounts";
import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy";
import { sepolia } from "@alchemy/aa-core";
import { dynamicSigner } from "./dynamic";

const chain = sepolia;

const provider = new AlchemyProvider({
const provider = await createModularAccountAlchemyClient({
apiKey: "ALCHEMY_API_KEY",
chain,
}).connect(
(rpcClient) =>
new LightSmartContractAccount({
chain,
owner: dynamicSigner,
factoryAddress: getDefaultLightAccountFactoryAddress(chain),
rpcClient,
})
);
owner: dynamicSigner,
});
```

<<< @/snippets/signers/dynamic.ts
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,16 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a
::: code-group

```ts [example.ts]
import { AlchemyProvider } from "@alchemy/aa-alchemy";
import {
LightSmartContractAccount,
getDefaultLightAccountFactoryAddress,
} from "@alchemy/aa-accounts";
import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy";
import { sepolia } from "@alchemy/aa-core";
import { createFireblocksSigner } from "./fireblocks";

const chain = sepolia;
const provider = new AlchemyProvider({
const provider = await createModularAccountAlchemyClient({
apiKey: "ALCHEMY_API_KEY",
chain,
}).connect(
(rpcClient) =>
new LightSmartContractAccount({
chain: rpcClient.chain,
owner: await createFireblocksSigner(),
factoryAddress: getDefaultLightAccountFactoryAddress(chain),
rpcClient,
})
);
owner: await createFireblocksSigner(),
});
```

<<< @/snippets/signers/fireblocks.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,16 @@ We can link our `SmartAccountSigner` to a `LightSmartContractAccount` from `aa-a
::: code-group

```ts [example.ts]
import { AlchemyProvider } from "@alchemy/aa-alchemy";
import {
LightSmartContractAccount,
getDefaultLightAccountFactoryAddress,
} from "@alchemy/aa-accounts";
import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy";
import { sepolia } from "@alchemy/aa-core";
import { createLitSigner } from "./lit";
const chain = sepolia;

const provider = new AlchemyProvider({
const provider = await createModularAccountAlchemyClient({
apiKey: "ALCHEMY_API_KEY",
chain,
}).connect(
(rpcClient) =>
new LightSmartContractAccount({
chain,
owner: await createLitSigner(AUTH_METHOD),
factoryAddress: getDefaultLightAccountFactoryAddress(chain),
rpcClient,
})
);
owner: await createLitSigner(AUTH_METHOD),
});
```

:::
Original file line number Diff line number Diff line change
Expand Up @@ -56,31 +56,19 @@ Let's see it in action with `aa-alchemy` and `LightSmartContractAccount` from `a
::: code-group

```ts [example.ts]
import { AlchemyProvider } from "@alchemy/aa-alchemy";
import {
LightSmartContractAccount,
getDefaultLightAccountFactoryAddress,
} from "@alchemy/aa-accounts";
import { createModularAccountAlchemyClient } from "@alchemy/aa-alchemy";
import { sepolia } from "@alchemy/aa-core";
import { createMagicSigner } from "./magic";

const chain = sepolia;

// NOTE: the below is async because it depends on creating a magic Signer. You can choose to break that up how you want
// e.g. use a useEffect + useState to create the Signer and then pass it down to the provider
const provider = new AlchemyProvider({
const provider = await createModularAccountAlchemyClient({
apiKey: "ALCHEMY_API_KEY",
chain,
}).connect(
(rpcClient) =>
new LightSmartContractAccount({
entryPointAddress,
chain: rpcClient.chain,
owner: await createMagicSigner(),
factoryAddress: getDefaultLightAccountFactoryAddress(chain),
rpcClient,
})
);
owner: await createMagicSigner(),
});
```

<<< @/snippets/signers/magic.ts
Expand Down
Loading

0 comments on commit 2c1073c

Please sign in to comment.