Skip to content

Commit

Permalink
feat: add aa-signers package
Browse files Browse the repository at this point in the history
  • Loading branch information
avasisht23 committed Nov 8, 2023
1 parent d5264e2 commit 0788f39
Show file tree
Hide file tree
Showing 11 changed files with 520 additions and 9 deletions.
168 changes: 168 additions & 0 deletions packages/signers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# 0.2.0 (2023-11-03)

### Features

- merge development into main for new version release ([#207](https://github.com/alchemyplatform/aa-sdk/issues/207)) ([f06fd2a](https://github.com/alchemyplatform/aa-sdk/commit/f06fd2adf5e4aaf90214435d32f9d566d8502099))

## 0.1.1 (2023-10-20)

### Bug Fixes

- bad deploy script again ([2da8de2](https://github.com/alchemyplatform/aa-sdk/commit/2da8de2f4feb4c82fd454050e66f6203b61bcc2c))

# [0.1.0](https://github.com/alchemyplatform/aa-sdk/compare/v0.1.0-alpha.32...v0.1.0) (2023-10-10)

### Features

- merge in all of the staged changes to the aa-sdk ([#120](https://github.com/alchemyplatform/aa-sdk/issues/120)) ([7a9effa](https://github.com/alchemyplatform/aa-sdk/commit/7a9effaa07c03a6a50c9cf856b5935e735adae3a)), closes [#1](https://github.com/alchemyplatform/aa-sdk/issues/1) [#2](https://github.com/alchemyplatform/aa-sdk/issues/2) [#3](https://github.com/alchemyplatform/aa-sdk/issues/3) [#7](https://github.com/alchemyplatform/aa-sdk/issues/7) [#8](https://github.com/alchemyplatform/aa-sdk/issues/8) [#9](https://github.com/alchemyplatform/aa-sdk/issues/9)

# 0.1.0-alpha.32 (2023-09-18)

### Bug Fixes

- `baseGoerli` chainId in `chains.ts` ([#104](https://github.com/alchemyplatform/aa-sdk/issues/104)) ([2dda5dd](https://github.com/alchemyplatform/aa-sdk/commit/2dda5dd729124338ddf529c11bbf24afaea05dd4))

# 0.1.0-alpha.31 (2023-09-13)

### Bug Fixes

- remove all references to `SimpleSmartAccountOwner` ([#101](https://github.com/alchemyplatform/aa-sdk/issues/101)) ([a8f101d](https://github.com/alchemyplatform/aa-sdk/commit/a8f101dff7fbbd10598467ddaaa1c3c55f707e6d))

# 0.1.0-alpha.30 (2023-09-11)

### Features

- add base support to alchemy provider ([#100](https://github.com/alchemyplatform/aa-sdk/issues/100)) ([a5dc65c](https://github.com/alchemyplatform/aa-sdk/commit/a5dc65c4208614b935943ebdd8eececf3de03d29))

# 0.1.0-alpha.29 (2023-08-29)

### Bug Fixes

- **core:** add missing `null` return type of `eth_getUserOperation*` ([#93](https://github.com/alchemyplatform/aa-sdk/issues/93)) ([cba9a0c](https://github.com/alchemyplatform/aa-sdk/commit/cba9a0c79807612b37c9d8c300b494312c9bd752))

# 0.1.0-alpha.28 (2023-08-25)

### Bug Fixes

- pass overrides from tx to user op ([#88](https://github.com/alchemyplatform/aa-sdk/issues/88)) ([985cb99](https://github.com/alchemyplatform/aa-sdk/commit/985cb997691f5b251337ea0fbe6bd23e6b3fb455))

# 0.1.0-alpha.27 (2023-08-24)

**Note:** Version bump only for package @alchemy/aa-accounts

# 0.1.0-alpha.26 (2023-08-23)

### Features

- add utils for getting the intermediary UO struct ([#86](https://github.com/alchemyplatform/aa-sdk/issues/86)) ([0e1a701](https://github.com/alchemyplatform/aa-sdk/commit/0e1a70174c0eeff2eedce4379914cad75f0629b2))

# 0.1.0-alpha.25 (2023-08-17)

### Features

- add jwt support for Alchemy providers ([#81](https://github.com/alchemyplatform/aa-sdk/issues/81)) ([af85aa4](https://github.com/alchemyplatform/aa-sdk/commit/af85aa41441825ca6545e850cbc7e834879cf236))

# 0.1.0-alpha.24 (2023-08-16)

### Features

- add utils for verifying 6492 sigs and ensip-11 utils ([#80](https://github.com/alchemyplatform/aa-sdk/issues/80)) ([52231b6](https://github.com/alchemyplatform/aa-sdk/commit/52231b6b4a521ee0713c4d3d3126ac4e5d66f14c))

# 0.1.0-alpha.23 (2023-08-14)

### Features

- **alchemy:** modify fee defaults ([0a0a65c](https://github.com/alchemyplatform/aa-sdk/commit/0a0a65c03a6991a1c57473ae9e65c4b727d937e2))

# 0.1.0-alpha.22 (2023-08-11)

**Note:** Version bump only for package @alchemy/aa-accounts

# 0.1.0-alpha.21 (2023-08-08)

### Features

- allow overriding alchemy provider rpc url ([#70](https://github.com/alchemyplatform/aa-sdk/issues/70)) ([6b7c4b9](https://github.com/alchemyplatform/aa-sdk/commit/6b7c4b911b97dfcd1cfb00b2892548644fbe2fc6))

# 0.1.0-alpha.20 (2023-08-05)

### Features

- add signTypedData to providers ([#66](https://github.com/alchemyplatform/aa-sdk/issues/66)) ([e0a99f6](https://github.com/alchemyplatform/aa-sdk/commit/e0a99f694a6ed6e88b15d6cc73f99e74fd985667))

# 0.1.0-alpha.19 (2023-08-03)

### Features

- add event emitter to the provider so that we can listen to connected events in dapps ([#65](https://github.com/alchemyplatform/aa-sdk/issues/65)) ([35ee990](https://github.com/alchemyplatform/aa-sdk/commit/35ee990afa1c8be7c4685631af6654ac51b094cd))

# 0.1.0-alpha.18 (2023-07-28)

**Note:** Version bump only for package @alchemy/aa-accounts

# 0.1.0-alpha.17 (2023-07-19)

### Features

- add support for fetch options when creating public clients ([#59](https://github.com/alchemyplatform/aa-sdk/issues/59)) ([5028e7b](https://github.com/alchemyplatform/aa-sdk/commit/5028e7b21a208ad8f88e81d455c2c8e24d57d953))

# 0.1.0-alpha.16 (2023-07-06)

### Bug Fixes

- always import with file extension ([#48](https://github.com/alchemyplatform/aa-sdk/issues/48)) ([4776d74](https://github.com/alchemyplatform/aa-sdk/commit/4776d7476f8cb622416c8846afa9bc17d16b97a6))

# 0.1.0-alpha.15 (2023-07-05)

### Features

- kernel batch transactions and gas estimation fixes ([#39](https://github.com/alchemyplatform/aa-sdk/issues/39)) ([f2a3d3d](https://github.com/alchemyplatform/aa-sdk/commit/f2a3d3d093ddbe1b564c0242c28b67487554f1ba))

# 0.1.0-alpha.14 (2023-06-29)

### Bug Fixes

- npm 404 error ([f34f581](https://github.com/alchemyplatform/aa-sdk/commit/f34f581a0399a2e30f33161d8b4cc1d778122b1f))

# 0.1.0-alpha.13 (2023-06-29)

### Bug Fixes

- add github user details to publish script ([2b812d3](https://github.com/alchemyplatform/aa-sdk/commit/2b812d34c041e11ba7d4c11a72c26da8f8e7af21))

# [0.1.0-alpha.11](https://github.com/alchemyplatform/aa-sdk/compare/v0.1.0-alpha.10...v0.1.0-alpha.11) (2023-06-26)

**Note:** Version bump only for package @alchemy/aa-accounts

# [0.1.0-alpha.10](https://github.com/alchemyplatform/aa-sdk/compare/v0.1.0-alpha.8...v0.1.0-alpha.10) (2023-06-26)

### Bug Fixes

- types changed when updating to latest viem ([0aec96d](https://github.com/alchemyplatform/aa-sdk/commit/0aec96d184b5bcc3787ce9123260cf287f27f037))

# [0.1.0-alpha.9](https://github.com/alchemyplatform/aa-sdk/compare/v0.1.0-alpha.8...v0.1.0-alpha.9) (2023-06-26)

**Note:** Version bump only for package @alchemy/aa-accounts

# [0.1.0-alpha.8](https://github.com/alchemyplatform/aa-sdk/compare/v0.1.0-alpha.7...v0.1.0-alpha.8) (2023-06-23)

**Note:** Version bump only for package @alchemy/aa-accounts

# [0.1.0-alpha.7](https://github.com/alchemyplatform/aa-sdk/compare/v0.1.0-alpha.6...v0.1.0-alpha.7) (2023-06-20)

**Note:** Version bump only for package @alchemy/aa-accounts

# [0.1.0-alpha.5](https://github.com/alchemyplatform/aa-sdk/compare/v0.1.0-alpha.4...v0.1.0-alpha.5) (2023-06-16)

**Note:** Version bump only for package @alchemy/aa-accounts

# [0.1.0-alpha.4](https://github.com/alchemyplatform/aa-sdk/compare/v0.1.0-alpha.3...v0.1.0-alpha.4) (2023-06-14)

### Features

- add aa-accounts subpackage ([#23](https://github.com/alchemyplatform/aa-sdk/issues/23)) ([a7fd5da](https://github.com/alchemyplatform/aa-sdk/commit/a7fd5da8600b0a346627df3a4b5cc338210aa256))
34 changes: 34 additions & 0 deletions packages/signers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# `@alchemy/aa-signers`

This package contains various implementations of the [`SmartAccountSigner`](../core/src/signer/types.ts) and [`AuthSmartAccountSigner`](../core/src/signer/types.ts) classes defined in `aa-core`. This repo is community maintained and we welcome contributions!

## Getting started

If you are already using the `@alchemy/aa-core` package, you can simply install this package and start using the accounts. If you are not using `@alchemy/aa-core`, you can install it and follow the instructions in the [README](../../README.md) to get started.

via `yarn`

```bash
yarn add @alchemy/aa-signers
```

via `npm`

```bash
npm i -s @alchemy/aa-signers
```

## Contributing

If you are looking to add a new account type, please follow the following structure.

1. Create a new folder in `src` with the name of your account type in `kebab-case` (we're following kebab casing for files throughout the project).
2. Create a new file in the folder you just created called `signer.ts` and add your implementation for `SmartAccountSigner`, along with any additional types or utils files.
3. If you need to extend the [`SmartAccountSigner`](../core/src/provider/base.ts) or [`AuthSmartAccountSigner`](../core/src/signer/types.ts) class, add a file called `signer.ts` in a new sub-folder under this package and add your implementation for.

- Ideally, your `SmartAccountSigner` impl should _just_ work with the base provider provided by `aa-core` and whatever peer dependencies you install.
- If not, consider generalizing the use case and updating SmartAccountSigner

5. Add some tests for your account and provider (if created) by creating a subfolder in your `signer/my-signer` called `__tests__` and make sure your files end with the `.test.ts` suffix
6. export the classes and types you've defined in `src/index.ts`
7. Open a PR and we'll review it as soon as possible!
64 changes: 64 additions & 0 deletions packages/signers/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "@alchemy/aa-signers",
"version": "0.2.0",
"description": "A collection of signers used to create ERC-4337 smart accounts",
"author": "Alchemy",
"license": "MIT",
"private": false,
"type": "module",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"typings": "./dist/types/index.d.ts",
"sideEffects": false,
"files": [
"dist",
"src/**/*.ts",
"!dist/**/*.tsbuildinfo",
"!vitest.config.ts",
"!.env",
"!src/**/*.test.ts",
"!src/__tests__/**/*"
],
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"default": "./dist/cjs/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"build": "yarn clean && yarn build:cjs && yarn build:esm && yarn build:types",
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir ./dist/cjs --removeComments --verbatimModuleSyntax false && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir ./dist/esm --removeComments && echo > ./dist/esm/package.json '{\"type\":\"module\"}'",
"build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
"clean": "rm -rf ./dist",
"test": "vitest",
"test:run": "vitest run",
"test:run-e2e": "vitest run --config vitest.config.e2e.ts"
},
"devDependencies": {
"jsdom": "^22.1.0",
"typescript": "^5.0.4",
"typescript-template": "*",
"vitest": "^0.31.0"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/alchemyplatform/aa-sdk.git"
},
"bugs": {
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
},
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
"gitHead": "ee46e8bb857de3b631044fa70714ea706d9e317d",
"dependencies": {
"@alchemy/aa-core": "^0.2.0",
"viem": "^1.16.2"
}
}
5 changes: 5 additions & 0 deletions packages/signers/src/__tests__/signer.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe("Signer Tests", () => {
it("should work", async () => {
expect(true).toBe(true);
});
});
5 changes: 5 additions & 0 deletions packages/signers/src/e2e-tests/signer.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe("Signer Tests", () => {
it("should work", async () => {
expect(true).toBe(true);
});
});
Empty file added packages/signers/src/index.ts
Empty file.
8 changes: 8 additions & 0 deletions packages/signers/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "typescript-template/build.json",
"exclude": ["node_modules", "**/*/__tests__", "vitest.config.ts"],
"include": ["src"],
"compilerOptions": {
"sourceMap": true
}
}
3 changes: 3 additions & 0 deletions packages/signers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "typescript-template/base.json"
}
12 changes: 12 additions & 0 deletions packages/signers/vitest.config.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { configDefaults, defineProject } from "vitest/config";

export default defineProject({
test: {
singleThread: true,
globals: true,
setupFiles: ["../../.vitest/setupTests.ts"],
exclude: [...configDefaults.exclude, "**/__tests__/**/*.test.ts"],
name: "signers",
environment: "jsdom",
},
});
12 changes: 12 additions & 0 deletions packages/signers/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { configDefaults, defineProject } from "vitest/config";

export default defineProject({
test: {
singleThread: true,
globals: true,
setupFiles: ["../../.vitest/setupTests.ts"],
exclude: [...configDefaults.exclude, "**/e2e-tests/**/*.test.ts"],
name: "signers",
environment: "jsdom",
},
});
Loading

0 comments on commit 0788f39

Please sign in to comment.