Skip to content

Commit

Permalink
Merge branch 'alchemyplatform:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
moldy530 authored Feb 10, 2024
2 parents 3b6d38e + a38ee10 commit f098fa1
Show file tree
Hide file tree
Showing 17 changed files with 327 additions and 264 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ coverage
dist
node_modules
tsconfig*.tsbuildinfo
.idea/

# local env files
.env
Expand All @@ -27,4 +28,4 @@ examples/contracts/**/out

site/.vitepress/dist
site/.vitepress/cache
site/**/*.js
site/**/*.js
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/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/custom/using-your-own) implementation, [Signer](https://accountkit.alchemy.com/signers/overview), [Gas Manager API](https://accountkit.alchemy.com/getting-started/overview.html#gas-manager-api) and RPC Provider.

## Getting Started

Expand Down
23 changes: 23 additions & 0 deletions packages/accounts/src/msca/plugins/multi-owner/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ export type MultiOwnerPluginActions<
readOwners: (
params: { pluginAddress?: Address } & GetAccountParameter<TAccount>
) => Promise<ReadonlyArray<Address>>;

isOwnerOf: (
params: {
address: Address;
pluginAddress?: Address;
} & GetAccountParameter<TAccount>
) => Promise<boolean>;
} & (IsUndefined<TAccount> extends false
? {
readOwners: (
Expand Down Expand Up @@ -57,4 +64,20 @@ export const multiOwnerPluginActions: <
const contract = MultiOwnerPlugin.getContract(client, args?.pluginAddress);
return contract.read.ownersOf([account.address]);
},

async isOwnerOf(
args: {
address: Address;
pluginAddress?: Address;
} & GetAccountParameter<TAccount>
) {
const account = args?.account ?? client.account;
if (!account) {
throw new AccountNotFoundError();
}
// TODO: check if the account actually has the plugin installed
// either via account loupe or checking if the supports interface call passes on the account
const contract = MultiOwnerPlugin.getContract(client, args?.pluginAddress);
return contract.read.isOwnerOf([account.address, args.address]);
},
});
13 changes: 4 additions & 9 deletions site/.vitepress/sidebar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@ export const sidebar: DefaultTheme.Sidebar = [
{
text: "Getting Started",
items: [
{ text: "Quick start", link: "/getting-started/setup" },
// I'm leaving these here for now because I'm not sure if we still want them
// There's good content in here so we may want to keep it somewhere
{
text: "What is Account Kit?",
link: "/overview/introduction",
},
{
text: "Why Account Kit?",
link: "/overview/why-account-kit",
text: "Overview",
link: "/getting-started/overview",
},
{ text: "Quick start", link: "/getting-started/setup" },
],
},
{
Expand Down Expand Up @@ -74,6 +68,7 @@ export const sidebar: DefaultTheme.Sidebar = [
{ text: "Particle Network", link: "/particle-network" },
{ text: "Arcana Auth", link: "/arcana-auth" },
{ text: "Dfns", link: "/dfns" },
{ text: "WalletKit", link: "/walletkit" },
{ text: "Externally Owned Account (EOA)", link: "/eoa" },
],
},
Expand Down
66 changes: 36 additions & 30 deletions site/overview/introduction.md → site/getting-started/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,43 @@ outline: deep
head:
- - meta
- property: og:title
content: Introduction
content: Overview
- - meta
- name: description
content: Learn what Account Kit is, how it works, and how you can use it to add support for smart accounts.
content: Learn what Account Kit is, how it works, and how you can use it to integrate smart accounts in your app.
- - meta
- property: og:description
content: Learn what Account Kit is, how it works, and how you can use it to add support for smart accounts.
content: Learn what Account Kit is, how it works, and how you can use it to integrate smart accounts in your app.
- - meta
- name: twitter:title
content: Introduction
content: Overview
- - meta
- name: twitter:description
content: Learn what Account Kit is, how it works, and how you can use it to add support for smart accounts.
content: Learn what Account Kit is, how it works, and how you can use it to integrate smart accounts in your app.
---

# What is Account Kit?
# 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.

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.

**Account Kit** is a framework to embed smart accounts in your web3 app, unlocking [powerful features](/getting-started/setup) like email/social login, gas sponsorship, batched transactions, and more. The `aa-sdk` makes it easy to integrate and deploy smart accounts, send user operations, and sponsor gas with just a few lines of code.
Account Kit makes it easy onboard users with smart accounts -- account abstraction wallets embedded directly in your app with seamless UX. Account Kit unlocks:

- **Your app, your UX:** design every step of the user experience from signup to checkout natively in your app.
- **Familiar, secure login:** Streamline your sign up flow with custom [authentication methods](/signers/choosing-a-signer) including email, social login, SMS, biometrics, passkeys, or self-custodial signers like Metamask.
- **Sponsor gas:** enable users to transact with no gas by [sponsoring gas](/using-smart-accounts/sponsoring-gas/gas-manager) fees through an ERC-4337 paymaster.
- **Batch transactions:** streamline multi-step flows into a single transaction by [batching actions](/using-smart-accounts/batch-user-operations) in a UserOp to the Bundler API.
- **Delightful developer experience:** Account Kit is built on Viem and fully compatible with ethers.js and the EIP-1193 interface to make integration a breeze.

# What is Account Kit?

## What is the Account Kit stack?
**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 is a complete solution for [account abstraction](https://www.alchemy.com/overviews/what-is-account-abstraction/?a=ak-docs). It includes five components:
Account Kit includes five components:

- **aa-sdk**: A simple, powerful interface to integrate, deploy, and use smart accounts. The `aa-sdk` orchestrates everything under the hood to make development easy.
- **Light Account:** Secure, audited smart accounts. Easy to deploy, just when your users need them.
- **Modular Account:** Secure, audited, modular smart accounts. Easy to deploy just when your users need them, and easy to extend with [EIP-6900](https://eips.ethereum.org/EIPS/eip-6900) plugins.
- **Signer:** Integrations with the most popular wallet providers. Secure your accounts with email, social login, passkeys, or a self-custodial wallet Signer.
- **Gas Manager API:** A programmable API to sponsor gas for UserOps that meet your criteria.
- **Bundler API:** The most reliable ERC-4337 Bundler. Land your UserOps onchain, batch operations, and sponsor gas at massive scale.
Expand All @@ -36,7 +48,7 @@ Account Kit is a complete solution for [account abstraction](https://www.alchemy

Let’s dive into each component.

### aa-sdk
## aa-sdk

The `aa-sdk` is a type-safe and performant TypeScript library built on top of [viem](https://viem.sh/) to provide ergonomic methods for sending user operations, sponsoring gas, and deploying smart accounts. It handles all the complexity of ERC-4337 under the hood to make account abstraction simple.

Expand All @@ -46,42 +58,36 @@ 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 guide](/getting-started/setup) or checkout the [open source repo](https://github.com/alchemyplatform/aa-sdk).

### Light Account
## Light Account

`LightAccount` is a secure, gas-optimized, ERC-4337 smart account.
`ModularAccount` is a secure, audited, and modular ERC-4337 smart account.

We started with the Ethereum Foundation’s canonical [SimpleAccount](https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/samples/SimpleAccount.sol) and added key improvements for production app development:
- **Purpose built for AA:** modular account was designed and optimized for ERC-4337 account abstraction. It works seamlessly with the entrypoint contract, bundlers, and paymasters.
- **Extensible:** modular account is the first [EIP-6900](https://eips.ethereum.org/EIPS/eip-6900) account, making it infinitely extensible with custom plugins. Plug and play from a selection of existing plugins including session keys and account recovery, or write your own to customize the account for your app.
- **Secure:** modular account was developed by Alchemy and audited by both Spearbit and Quantstamp.

- Significantly [reduced gas costs](/smart-accounts/#benchmarks)
- ERC-1271 signature support to ensure users can sign messages, such as on Opensea
- Ownership transfer so that users won’t get locked into a single Signer

`LightAccount` was audited by Quantstamp ([report](https://github.com/alchemyplatform/light-account/blob/main/Quantstamp-Audit.pdf)).

`LightAccount` is forward-compatible with [ERC-6900](https://eips.ethereum.org/EIPS/eip-6900), a new standard for **modular** smart accounts. Once we stabilize the ERC with the [community](https://ethereum-magicians.org/t/erc-6900-modular-smart-contract-accounts-and-plugins/13885/35) and publish a reference implementation, we will release an optional upgrade for `LightAccount` to upgrade to modular EIP-6900 compliant accounts. [Join the discussion](https://ethereum-magicians.org/t/erc-6900-modular-smart-contract-accounts-and-plugins/13885/35) on ERC-6900!

To learn how to deploy a `LightAccount`, see [Light Account](/smart-accounts/light-account/).

### Signers
## Signers

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](/signers/choosing-a-signer).

### Gas Manager API
## Gas Manager API

The Gas Manager is a programmable API to sponsor gas for UserOps. You can create programmable gas policies to specify exactly which transactions should be sponsored, set strict spending limits per wallet or globally, and allowlist/blocklist particular wallet addresses. This expressive programmability is available through a REST API and an intuitive dashboard interface.

To learn how to sponsor gas with the Gas Manager API, see the [Sponsoring Gas](/using-smart-accounts/sponsoring-gas/gas-manager) tutorial.

### Bundler API
## Bundler API

The Bundler is a mission-critical piece of secondary infrastructure defined in the ERC-4337 spec that is responsible for submitting UserOps from a smart account onchain. If your Bundler API is unreliable, then User Operations are going to fail or get stuck.
The Bundler submits UserOps from a smart account and executes them onchain. This is a mission-critical operation: if your Bundler is unreliable, then transactions are going to fail or get stuck.

We built our [Bundler in Rust](https://www.alchemy.com/blog/open-sourcing-rundler/?a=ak-docs) to handle the highest loads at production scale. It’s able to handle massive scale because we operate it alongside our fleet of nodes powering the biggest dapps in web3 from Opensea to Circle.

Check out the open source code in our affectionately named [Rundler github repo](https://github.com/alchemyplatform/rundler).

## Start building with Account Kit
# Start building with Account Kit

Account Kit was designed from the ground up to make account abstraction easy. It’s built on top of industry-leading infrastructure that powers applications at massive scale from Opensea to Shopify.

Account Kit was designed from the ground up to make account abstraction easy. It’s built on top of industry-leading infrastructure that powers applications at massive scale from Opensea to Shopify. Start integrating Account Kit today in the [Getting Started guide](/getting-started/setup).
Next, read the [Quick Start guide](/getting-started/setup) to get setup in minutes!
2 changes: 1 addition & 1 deletion site/getting-started/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Since this "Getting Started" example is a simple script, you'll need to consider

In this guide, we initialized an `AlchemyProvider` with the `aa-alchemy` package to send a UO. However, you can do a lot more with Account Kit and its many packages.

1. To learn more about the different packages and their use cases, check out the [Packages Overview](/overview/package-overview) page.
1. To learn more about the different packages and their use cases, check out the [Packages Overview](/packages/) page.

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/).

Expand Down
6 changes: 3 additions & 3 deletions site/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ titleTemplate: :title Documentation
Account Kit is a vertically integrated stack for building apps that support ERC-4337: smart accounts, Signer integrations, sponsoring gas, bundlers, and an SDK.
</div>
<div class="flex flex-row gap-[8px] justify-start items-center">
<a rel="noopener noreferrer" href="./getting-started/deploy-an-account.html">
<a rel="noopener noreferrer" href="./getting-started/setup.html">
<button
class="flex items-center rounded-md px-[12px] py-[12px] text-[16px] font-semibold text-white transition duration-300 ease-in-out hover:scale-105 hover:opacity-90 bg-black dark:bg-white dark:text-black"
>
Explore the docs
</button>
</a>
<a rel="noopener noreferrer" href="./overview/why-account-kit.html">
<a rel="noopener noreferrer" href="./getting-started/overview.html">
<button
class="flex items-center rounded-md px-[12px] py-[12px] text-[16px] font-semibold transition duration-300 ease-in-out hover:scale-105 hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black"
>
Expand Down Expand Up @@ -94,7 +94,7 @@ export const smartAccountClient = await createModularAccountAlchemyClient({
</div>
</div>
<div class="flex max-lg:flex-wrap justify-center gap-[32px]">
<a rel="noopener noreferrer" href="./overview/introduction.html" class="flex-auto basis-1/3 max-lg:max-w-[370px] max-lg:min-w-[370px]">
<a rel="noopener noreferrer" href="./getting-started/overview.html" class="flex-auto basis-1/3 max-lg:max-w-[370px] max-lg:min-w-[370px]">
<div
class="flex flex-col flex-auto p-[24px] gap-[24px] rounded-md text-white overflow-auto bg-gradient-3 group hover:scale-105 hover:opacity-90 transition duration-300 ease-in-out"
>
Expand Down
31 changes: 0 additions & 31 deletions site/overview/contact-us.md

This file was deleted.

Loading

0 comments on commit f098fa1

Please sign in to comment.