Skip to content

Commit

Permalink
feat: merge in all of the staged changes to the aa-sdk (#120)
Browse files Browse the repository at this point in the history
* docs: add a vitepress site skeleton (#1)

* docs: add github action to deploy to pages (#2)

* docs: add sidebar skeleton for docs (#3)

* docs: add overview doc for the various packages exported by Account Kit (#7)

* feat: make account class generic on providers

* fix: make account optional except for certain methods

* fix: moldy's comments

* fix: use interface for defining unconnected providers

* fix: use interface account for alchemy gasmanager methods

* fix: use interface account for alchemy gasmanager methods

* fix: use interface account for ethers provider-adapter

* fix: remove account generic for unconnected providers

* docs: add docs for ownership transfer (#8)

* docs: add docs for batching transactions (#9)

* docs: add docs for batching transactions

* docs: fix a typo

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* docs: add using your own account docs (#10)

* refactor: remove ConnectedSmartContractAccountProvider

* fix: moldy's comments

* feat: add light account support

* feat: add unit and e2e tests

* feat: add unit and e2e tests

* feat: add transferownership e2e test

* fix: update on pr yml to run e2e tests just to show

* fix: remove skips

* fix: remove skips

* fix: update on pr yml to remove e2e tests since they passed

* fix: update on pr yml to remove e2e tests since they passed

* fix: address moldy's comments

* fix: make on-chain getOwner call

* fix: remove account generic for unconnected providers

* refactor: remove ConnectedSmartContractAccountProvider

* feat: add light account to index file to export

* feat: add light account to index file to export

* feat: add light account abis

* test: refactor e2e test file

* chore: add undeploed owner to pr action

* docs: add magic link signer docs (#12)

* docs: add sendUserOperation docs as example of how to build package docs (#13)

* docs: add sendUserOperation docs as example of how to build package docs

* style: apply docs nits and fixes

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* fix: create new signer with util for each e2e test

* feat: replace simpleAccount with lightAccount in example dapp

* docs: add bring your own signer docs (#18)

* docs: add dev docs for aa-accounts/light-account

* docs: add dev docs for aa-accounts/light-account

* docs: add dev docs for aa-accounts/light-account

* docs: add dev docs for aa-accounts/light-account

* docs: add dev docs for aa-accounts/light-account

* docs: add dev docs for aa-accounts/light-account

* docs: add dev docs for aa-accounts/light-account

* docs: add getting started page (#14)

* add getting-started page

* fix lint issues

* ran prettier

* add requested changes

* Update site/getting-started.md

accepted the change for "packages overview"

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

---------

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* docs: using smart accounts overview (#15)

* using smart accounts overview

* ran prettier

* add requested changes

* set link directly on choosing a signer

* refactor: rename middleware util methods for alchemy gas manager endpoints

* refactor: rename middleware util methods for alchemy gas manager endpoints

* refactor: rename middleware util methods for alchemy gas manager endpoints

* refactor: rename middleware util methods for alchemy gas manager endpoints

* feat: change param to estimateGas

* feat: change param to estimateGas

* fix: remove timestamp site

* fix: remove deprecated signers

* starting new page waitForUserOperationTransaction. Adding method details. Adding a note to sendUserOperation to clarify the returned hash

* fix: make base provider constructor an object

* feat: update alchemy provider with new types

* Update site/packages/aa-core/provider/waitForUserOperationTransaction.md

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* Update site/packages/aa-core/provider/waitForUserOperationTransaction.md

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* fix: fixing nits

* fix: running prettier

* fix: don't require provider input for alchemy provider

* test: refactor tests in aa-ethers

* test: refactor tests in aa-accounts

* test: refactor tests in aa-core

* test: refactor tests in aa-alchemy

* fix: move back package.json

* fix: remove package.jsonc hange

* test: refactor tests in aa-core

* docs: add web3auth docs (#28)

* docs: add some more helpful links to contributing (#22)

* docs: add some more helpful links to contributing

* style: address pr comments

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* docs: add benchmarks for light account (#32)

* docs: add docs for EOA signers (#34)

* feat: add support for LocalAcount to the LocalAccountSigner (#36)

* docs: add code docs for aa-core/getUserOperationByHash (#31)

* fix: nit typo fix in code from 337 to 4337

* docs: add aa-core signer docs

* docs: adds Turnkey to the list of signing providers (#35)

* docs: adds Turnkey to the list of signing providers

* docs: uses LocalAccountSigner instead of WalletClientSigner

* docs: start adding utils docs

* fix: fix a lint issue I missed

* docs: add more utils docs for aa-core

* chore: add denniswon to OWNERS

* feat: document and update the client types in core (#43)

* fix: site deploy was using node 18.18 not 18.10

* docs: update the docs on byosca to use LightAccount

* fix: actually use node 18.10 in the workflow

* docs: add docs for erc4337ClientActions

* docs: add aa-alchemy docs

* docs: more updates, still wip

* docs: docs for aa-alchemy

* docs: docs for aa-alchemy

* docs: docs for aa-alchemy

* docs: docs for aa-alchemy

* docs: docs for aa-alchemy

* docs: docs for aa-alchemy

* docs: docs for aa-alchemy

* docs: docs for aa-alchemy

* docs: docs for aa-alchemy

* docs: docs for aa-alchemy

* docs: docs for aa-ethers (wip)

* docs: docs for aa-ethers (wip)

* docs: docs for aa-ethers (wip)

* docs: docs for aa-ethers (wip)

* docs: docs for aa-ethers (wip)

* docs: docs for aa-ethers (wip)

* docs: docs for aa-ethers (wip)

* docs: docs for aa-ethers

* docs: docs for aa-ethers

* docs: docs for aa-ethers

* docs: docs for aa-ethers

* docs: docs for aa-ethers

* docs: docs for aa-ethers

* docs: docs for aa-ethers

* docs: add docs for using Light Account (#16)

* add light-account doc

* update config

* ran prettier

* add requested changes

* add link on choosing an account section directly

* remove simple account from choosing account overview

* add page on modular account

* update overview for accounts

* add requested changes and re-worded for google style guideline

* add benchmarks in the overview page

* docs: add doc for sponsoring gas (#17)

* add doc on sponsoring gas

* add docs for sponsoring gas

* add requested changes

* put alchemyprovider in provider.ts and use it in sponsoring-gas doc

* add requested changes and follow google style guidelines

* Update site/smart-accounts/sponsoring-gas.md

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* fix: update site/snippets/provider.ts

---------

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* docs: docs for aa-ethers

* docs: update a few docs to match styles of other docs (#52)

* docs: finish adding aa-core utils docs (#53)

* docs: finish adding aa-core utils docs

* docs: apply suggestions from PR

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* docs: fix a typo in a code example

* docs: fix comment in code snippet

* docs: add Capsule to the list of signers (#57)

* add capsule signer docs

* Update site/smart-accounts/signers/capsule.md

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* minor copy change to match capsule docs

---------

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* docs: provider/getUserOperationReceipt (#48)

* docs: provider/getUserOperationReceipt

* Update site/packages/aa-core/provider/getUserOperationReceipt.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* docs: aa-core sendTransaction and sendTransactions (#49)

* docs: provider/getUserOperationReceipt

* docs: providers api funcs sitebar sections

* docs: sendTransaction

* docs: sendTransactions

* Update site/packages/aa-core/provider/sendTransaction.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/packages/aa-core/provider/sendTransactions.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* docs: aa-core providers request method (#50)

* docs: provider/getUserOperationReceipt

* docs: providers api funcs sitebar sections

* docs: sendTransaction

* docs: sendTransactions

* docs: aa-core providers request method

* Update site/packages/aa-core/provider/request.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/packages/aa-core/provider/request.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/packages/aa-core/provider/request.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* docs: aa-core providers connection methods (#51)

* docs: provider/getUserOperationReceipt

* docs: providers api funcs sitebar sections

* docs: sendTransaction

* docs: sendTransactions

* docs: aa-core providers request method

* docs: aa-core providers connection methods

* Update site/packages/aa-core/provider/getAddress.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/packages/aa-core/provider/isConnected.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* fix: fix lint

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* docs: add web3auth direct link

* docs: updates to transferring-ownership (#54)

* docs: updates to batching-transactions (#55)

* chore: attempt to disable setting basepath for github pages (#59)

* moldy/pages base path (#60)

* chore: attempt to disable setting basepath for github pages

* chore: oops put this in the wrong place

* refactor: remove getFeeData and use viem method (#58)

* fix: override getAccountInitCode in LightAccount (#61)

* docs: aa-core providers sign methods (#62)

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* docs: aa-core providers build user op methods (#64)

* docs: add erc-6900 page (#69)

* chore: update (#66)

* docs: format capsule doc (#71)

* chore: add links to git repo, audit report (#72)

* feat: create6492Signature at BaseSCA level using account init code parsing (#79)

* feat: la factory util + docs + example (#82)

* chore: fix up viem versioning and light account integration into daapp (#84)

* docs: add search (#87)

* feat: add drop and replace to the uo logic (#85)

Co-authored-by: therealharpaljadeja <jadejaharpal14@gmail.com>

* feat: add lit signer docs (#70)

* feat: add lit signer docs

* fix: updates for testnet version

* refactor: remove unused var

* refactor: pr comments

* refactor: pr comments

* docs: apply nits to lit signer docs

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

---------

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>
Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* docs: adding portal (#65)

* Adding Portal

* Update site/smart-accounts/signers/portal.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/smart-accounts/signers/portal.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/smart-accounts/signers/portal.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/smart-accounts/signers/portal.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/smart-accounts/signers/portal.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/snippets/portal.ts

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* feat: add portal as a signer option

* docs: add PR nits

---------

Co-authored-by: Jong Hyuck Won <denniswon@users.noreply.github.com>
Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* docs: add privy guide (#63)

* Initial version of Privy guide

* PR comments

* docs: address PR feedback

* docs: add note about React

* docs: apply pr nits

---------

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* docs: fix some lint errors (#90)

* docs: update sponsoring-gas.md (#83)

* fix: general improvements to the examples section (#111)

* chore: fix license specification for Alchemy (#116)

* Update sponsoring-gas.md

* Update sponsoring-gas.md

* docs(images): add image and complete paragraph on sending userops

---------

Co-authored-by: Igor Shadurin <haletskaya@gmail.com>
Co-authored-by: Rohan Thomare <rohanthomare@gmail.com>
Co-authored-by: Sahil Aujla <sahilaujla15@gmail.com>

* docs: add withCustomMiddleware (#81)

* docs: add withCustomMiddleware

* mention customMiddleware

* update meta tags

* update description for withCustomMiddleware

* add the more detailed code example

* use async await with builduserop

* docs: apply suggestions from PRs

---------

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* docs: add withFeeDataGetter (#80)

* docs: add withFeeDataGetter

* add meta tags

* update withFeeDataGetter

* mention feeDataGetter readonly field

* Update site/packages/aa-core/provider/withFeeDataGetter.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/packages/aa-core/provider/withFeeDataGetter.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* add detailed code example

* update description

* docs: update with PR feedback

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* docs: add why account kit doc (#74)

* docs: add why account kit page

* add links

* update batching txs link

* incorporated feedback

* docs: updates to choosing smart account (#56)

* docs: updates to choosing smart account

* docs: updates to choosing smart account

* docs: updates to choosing smart account

* docs: updates to choosing smart account

---------

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* docs: fix lint formatting

* feat: landing page (#67)

* chore: update the publish package job to include deploying the site (#91)

* chore: update the publish package job to include deploying the site

* chore: remove the prerelease config from lerna

* docs: update lit snippet (#92)

* refactor: remove unnecessary extra client on alchemy provider (#93)

* docs: aa-core accounts (#68)

* docs: aa-core accounts

* docs: erc-6900 update

* Update site/packages/aa-core/accounts/simple-smart-contract-account.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/packages/aa-core/accounts/base-smart-contract-account.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/packages/aa-core/accounts/base-smart-contract-account.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/packages/aa-core/accounts/base-smart-contract-account.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/packages/aa-core/accounts/base-smart-contract-account.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* Update site/packages/aa-core/accounts/base-smart-contract-account.md

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>

* docs: base smart account and simple account doc section complete

* Update site/packages/aa-core/accounts/required/getDummySignature.md

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* Update site/.vitepress/config.ts

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* Update site/.vitepress/config.ts

Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
Co-authored-by: Michael Moldoveanu <moldy530@gmail.com>

* feat: add account and signer type log into the headers of public client (#76)

* docs: update choosing a signer docs (#89)

* add heap analytics (#94)

* docs: add intro doc (#75)

* docs: add intro doc

* remove the confusing diagram

* fix image sizing

* docs: add fireblocks signer (#88)

* chore: fix the setup node version in github actions

* docs: add favicon (#96)

---------

Co-authored-by: avasisht23 <ajay@alchemy.com>
Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
Co-authored-by: Sahil Aujla <sahilaujla15@gmail.com>
Co-authored-by: Ava Robinson <avamrobinson@gmail.com>
Co-authored-by: avarobinson <45052879+avarobinson@users.noreply.github.com>
Co-authored-by: Jong Hyuck Won <jhwon0820@gmail.com>
Co-authored-by: Max Blaushild <blaushmild@gmail.com>
Co-authored-by: Jong Hyuck Won <denniswon@users.noreply.github.com>
Co-authored-by: Dennis Won <denniswon@Denniss-MacBook-Pro.local>
Co-authored-by: Nitya Subramanian <nityas.subramanian@gmail.com>
Co-authored-by: howy <132113803+howydev@users.noreply.github.com>
Co-authored-by: Rohan Thomare <rohanthomare@gmail.com>
Co-authored-by: therealharpaljadeja <jadejaharpal14@gmail.com>
Co-authored-by: Bean <josh@litprotocol.com>
Co-authored-by: parsaattari <attari.parsa@gmail.com>
Co-authored-by: Ankush Swarnakar <ankushswar1@gmail.com>
Co-authored-by: Will Hennessy <hennessywill@gmail.com>
Co-authored-by: Igor Shadurin <haletskaya@gmail.com>
  • Loading branch information
19 people committed Oct 10, 2023
1 parent 603ef4e commit 7a9effa
Show file tree
Hide file tree
Showing 221 changed files with 11,480 additions and 685 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Deploy VitePress site to Pages
on:
workflow_dispatch:
inputs:
no_base_path:
required: false
default: false
type: boolean

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
name: Build
env:
NO_BASE_PATH: ${{ inputs.no_base_path }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18.10"
cache: yarn

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Install dependencies
run: yarn

- name: Build with VitePress
working-directory: site
run: |
yarn build
touch .vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: site/.vitepress/dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
env:
NO_BASE_PATH: ${{ inputs.no_base_path }}
8 changes: 4 additions & 4 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
- uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: "16.20"
node-version: "18.10"
cache: "yarn"

- name: Install dependencies
Expand All @@ -28,9 +28,9 @@ jobs:
- uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: "16.20"
node-version: "18.10"
cache: "yarn"

- name: Install dependencies
Expand Down
63 changes: 49 additions & 14 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,33 @@ on:
default: false
type: boolean

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

# If we ever migrate this to not be manual, we HAVE to check that the commit
# it is running against DOES NOT contain [skip-ci] in the commit message
jobs:
build_test_and_deploy:
name: Build, Test, and Deploy
build_and_test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ALCHEMY_BOT_PAT }}

- name: Set Github User Details
run: |
git config --global user.name "Alchemy Bot"
git config --global user.email "alchemy-bot@alchemy.com"
- name: Set NPM Permissions
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc

- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: "16.20"
node-version: "18.10"
cache: "yarn"

- name: Install dependencies
Expand All @@ -54,9 +56,42 @@ jobs:
API_KEY: ${{ secrets.API_KEY }}
OWNER_MNEMONIC: ${{ secrets.OWNER_MNEMONIC }}
PAYMASTER_POLICY_ID: ${{ secrets.PAYMASTER_POLICY_ID }}
UNDEPLOYED_OWNER_MNEMONIC: ${{ secrets.UNDEPLOYED_OWNER_MNEMONIC }}
LIGHT_ACCOUNT_OWNER_MNEMONIC: ${{ secrets.LIGHT_ACCOUNT_OWNER_MNEMONIC }}
run: yarn test:e2e

deploy:
name: Deploy
needs: build_and_test
runs-on: ubuntu-latest
if: inputs.publish
steps:
- name: Set Github User Details
run: |
git config --global user.name "Alchemy Bot"
git config --global user.email "alchemy-bot@alchemy.com"
- name: Set NPM Permissions
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc

# Lerna publish will, compute the new version, update files, run precommit hooks, tag, publish, and push change log
- name: Publish using Lerna
if: inputs.publish
run: yarn lerna publish --no-private --yes --no-verify-access

publish_site:
name: Publish Docs Site
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: deploy
runs-on: ubuntu-latest
if: inputs.publish
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
env:
# TODO(moldy): just remove this altogether once we're live
NO_BASE_PATH: true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ lerna-debug.log
.tool-versions

# example ignores
examples/contracts/**/out
examples/contracts/**/out

docs/.vitepress/dist
docs/.vitepress/cache
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @moldy530 @rthomare @dancoombs @mokok123 @avasisht23
* @moldy530 @rthomare @dancoombs @mokok123 @avasisht23 @denniswon
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

⚠️ This repo is actively being developed and certain features might not be fully implemented yet or are subject to change ⚠️

Alchemy's Account Abstraction Kit is an SDK that enables easy interactions with ERC-4337 compliant smart accounts. It supports bringing your own Account Contracts or using any of the currently available accounts. The SDK is built on top of `viem` to enable a lighter-weight bundle and is published with ESM default exports though also supports CJS.
Alchemy's Account Abstraction Kit is an SDK that enables easy interactions with [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) compliant smart accounts. It supports bringing your own Account Contracts or using any of the currently available accounts. The SDK is built on top of `viem` to enable a lighter-weight bundle and is published with ESM default exports though also supports CJS.

## Getting Started

Expand Down Expand Up @@ -73,13 +73,13 @@ const owner: SmartAccountSigner =
LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC);

// 2. initialize the provider and connect it to the account
const provider = new SmartAccountProvider(
const provider = new SmartAccountProvider({
// the demo key below is public and rate-limited, it's better to create a new one
// you can get started with a free account @ https://www.alchemy.com/
"https://polygon-mumbai.g.alchemy.com/v2/demo", // rpcUrl
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", // entryPointAddress
polygonMumbai // chain
).connect(
rpcProvider: "https://polygon-mumbai.g.alchemy.com/v2/demo",
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
chain: polygonMumbai,
}).connect(
(rpcClient) =>
new SimpleSmartContractAccount({
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
Expand Down Expand Up @@ -139,7 +139,7 @@ let provider = new AlchemyProvider({
);

// [OPTIONAL] Use Alchemy Gas Manager
provider = provider.withAlchemyGasManager({
provider.withAlchemyGasManager({
policyId: PAYMASTER_POLICY_ID,
entryPoint: ENTRYPOINT_ADDRESS,
});
Expand Down Expand Up @@ -208,16 +208,16 @@ const { hash } = await signer.sendUserOperation({

The primary interfaces are the `SmartAccountProvider` and `BaseSmartContractAccount`.

The `SmartAccountProvider` is an ERC-1193 compliant Provider that wraps JSON RPC methods and some Wallet Methods (signing, sendTransaction, etc). It also provides two utility methods for sending UserOperations:
The `SmartAccountProvider` is an [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) compliant Provider that wraps JSON RPC methods and some Wallet Methods (signing, sendTransaction, etc). It also provides two utility methods for sending UserOperations:

1. `sendUserOperation` -- this takes in `target`, `callData`, and an optional `value` which then constructs a UserOperation (UO), sends it, and returns the `hash` of the UO. It handles estimating gas, fetching fee data, (optionally) requesting paymasterAndData, and lastly signing. This is done via a middleware stack that runs in a specific order. The middleware order is `getDummyPaymasterData` => `estimateGas` => `getFeeData` => `getPaymasterAndData`. The paymaster fields are set to `0x` by default. They can be changed using `provider.withPaymasterMiddleware`.
2. `sendTransaction` -- this takes in a traditional Transaction Request object which then gets converted into a UO. Currently, the only data being used from the Transaction Request object is `from`, `to`, `data` and `value`. Support for other fields is coming soon.
2. `sendTransaction` -- this takes in a traditional Transaction Request object which then gets converted into a UO. Note that `to` field of transaction is required, and among other fields of transaction, only `data`, `value`, `maxFeePerGas`, `maxPriorityFeePerGas` fields are considered if given. Support for other fields is coming soon.

If you want to add support for your own `SmartAccounts` then you will need to provide an implementation of `BaseSmartContractAccount`. You can see an example of this in [SimpleSmartContractAccount](packages/core/src/account/simple.ts). You will need to implement 4 methods:

1. `getDummySignature` -- this method should return a signature that will not `revert` during validation. It does not have to pass validation, just not cause the contract to revert. This is required for gas estimation so that the gas estimate are accurate.
2. `encodeExecute` -- this method should return the abi encoded function data for a call to your contract's `execute` method
3. `signMessage` -- this should return an ERC-191 compliant message and is used to sign UO Hashes
3. `signMessage` -- this should return an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) compliant message and is used to sign UO Hashes
4. `getAccountInitCode` -- this should return the init code that will be used to create an account if one does not exist. Usually this is the concatenation of the account's factory address and the abi encoded function data of the account factory's `createAccount` method.

### Paymaster Middleware
Expand Down
5 changes: 5 additions & 0 deletions examples/aa-simple-dapp/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
8 changes: 4 additions & 4 deletions examples/alchemy-daapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ export const alchemyApiKey = "<your-api-key>";
export const serverConfigs: Record<number, ServerConfiguration> = {
[polygonMumbai.id]: {
nftContractAddress: "<your-nft-contract-address>",
simpleAccountFactoryAddress: "<your-simple-account-factory-address>",
lightAccountFactoryAddress: "<your-light-account-factory-address>",
gasManagerPolicyId: "<your-gas-manager-policy-id>",
chain: polygonMumbai,
},
// Repeat for other chains as needed
};
```
### **🗒️ Notes:** for `nftContractAddress` and `simpleAccountFactoryAddress`
### **🗒️ Notes:** for `nftContractAddress` and `lightAccountFactoryAddress`
- There are already contract addresses deployed for them across [various chains here](https://github.com/alchemyplatform/aa-sdk/blob/main/examples/alchemy-daapp/src/configs/clientConfigs.ts).
- We used eth-infinitism's [simpleAccountFactory here](https://github.com/eth-infinitism/account-abstraction/blob/main/contracts/samples/SimpleAccountFactory.sol).
- We used Alchemy's [lightAccountFactory here]. todo(ajay): post the repo when live
- Finally, the contracts sibling package has the copy of the [NFT contract](https://github.com/alchemyplatform/aa-sdk/tree/main/examples/contracts/DAAppNFT/src) along instructions on [how to deploy it](https://github.com/alchemyplatform/aa-sdk/blob/main/examples/contracts/README.md).

4. Update the serverConfigs.ts file with your alchemy API keys:
Expand All @@ -60,7 +60,7 @@ yarn dev
## How This Works
The [`onboarding-controller.ts`](https://github.com/alchemyplatform/aa-sdk/blob/master/examples/alchemy-daapp/src/surfaces/onboarding/OnboardingController.ts) file contains the onboarding controller, which handles the onboarding process for new users. The controller uses the Alchemy SDK to create a new account and mint an NFT.

In the [`clientConfigs.ts`](https://github.com/alchemyplatform/aa-sdk/blob/main/examples/alchemy-daapp/src/configs/clientConfigs.ts) file, you will find the configuration for the DAApp, including the nft contract address, simple account factory address, gas manager policy id, rpc url, and chain. You'll also find an example NFT contract in [`examples/contracts/DAAppNFT`](https://github.com/alchemyplatform/aa-sdk/tree/main/examples/contracts/DAAppNFT)
In the [`clientConfigs.ts`](https://github.com/alchemyplatform/aa-sdk/blob/main/examples/alchemy-daapp/src/configs/clientConfigs.ts) file, you will find the configuration for the DAApp, including the nft contract address, light account factory address, gas manager policy id, rpc url, and chain. You'll also find an example NFT contract in [`examples/contracts/DAAppNFT`](https://github.com/alchemyplatform/aa-sdk/tree/main/examples/contracts/DAAppNFT)

You can replace the default values with your contract addresses and policy ids and add or remove chains as needed.

Expand Down
3 changes: 2 additions & 1 deletion examples/alchemy-daapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@alchemy/aa-accounts": "latest",
"@alchemy/aa-alchemy": "latest",
"@alchemy/aa-core": "latest",
"@chakra-ui/react": "^2.6.1",
Expand All @@ -24,7 +25,7 @@
"next": "^13.4.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"viem": "^1.10.9",
"viem": "^1.16.2",
"wagmi": "^1.3.11",
"zod": "^3.21.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useCallback } from "react";
import { toHex } from "viem";
import { useWalletClient } from "wagmi";

type SimpleSmartAccountSignerResult =
type LightSmartAccountSignerResult =
| {
isLoading: false;
owner: SmartAccountSigner;
Expand All @@ -13,8 +13,9 @@ type SimpleSmartAccountSignerResult =
owner: undefined;
};

export function useSimpleAccountSigner(): SimpleSmartAccountSignerResult {
export function useLightAccountSigner(): LightSmartAccountSignerResult {
const walletClientQuery = useWalletClient();
const signerType = "json-rpc"
// We need this to by pass a viem bug https://github.com/wagmi-dev/viem/issues/606
const signMessage = useCallback(
(data: string | Uint8Array) =>
Expand Down Expand Up @@ -48,5 +49,5 @@ export function useSimpleAccountSigner(): SimpleSmartAccountSignerResult {
owner: undefined,
};
}
return { isLoading: false, owner: { signMessage, signTypedData, getAddress } };
return { isLoading: false, owner: { signerType, signMessage, signTypedData, getAddress } };
}

0 comments on commit 7a9effa

Please sign in to comment.