Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds MAv2 client #1212

Draft
wants to merge 12 commits into
base: howy/add-get-nonce
Choose a base branch
from
Draft

feat: adds MAv2 client #1212

wants to merge 12 commits into from

Conversation

linnall
Copy link
Collaborator

@linnall linnall commented Dec 13, 2024

Pull Request Checklist


PR-Codex overview

This PR introduces the createSMAV2AccountClient function, enhancing the smart account client functionality by allowing the creation of a MAv2 account client with specified configuration parameters. It also updates the related test file to reflect these changes.

Detailed summary

  • Added createSMAV2AccountClient function to create a MAv2 account client.
  • Introduced CreateSMAV2AccountClientParams type for client configuration.
  • Updated the test file to use createSMAV2AccountClient and improve the test structure.
  • Removed deprecated or unused imports in the test file.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Dec 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aa-sdk-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 11:28pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 11:28pm

Copy link

graphite-app bot commented Dec 13, 2024

How to use the Graphite Merge Queue

Add the label graphite-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

"transport" | "account" | "chain"
>;

export function createSMAV2SignerAccountClient<
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: don't think we need "Signer" in the param/function name

Copy link
Collaborator

howydev commented Dec 13, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label graphite-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

const instance = local070InstanceOptSep;
const client = instance.getClient().extend(publicActions);
custom,
keccak256,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <@typescript-eslint/no-unused-vars> reported by reviewdog 🐶
'keccak256' is defined but never used.

keccak256,
parseEther,
publicActions,
toHex,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <@typescript-eslint/no-unused-vars> reported by reviewdog 🐶
'toHex' is defined but never used.

parseEther,
publicActions,
toHex,
type Address,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <@typescript-eslint/no-unused-vars> reported by reviewdog 🐶
'Address' is defined but never used.

toHex,
type Address,
} from "viem";
import { privateKeyToAccount } from "viem/accounts";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <@typescript-eslint/no-unused-vars> reported by reviewdog 🐶
'privateKeyToAccount' is defined but never used.


const target = "0x000000000000000000000000000000000000dEaD";

const startBalance = await client.getBalance({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <@typescript-eslint/no-unused-vars> reported by reviewdog 🐶
'startBalance' is assigned a value but never used.

address: target,
});

const result2 = provider.sendUserOperation({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <@typescript-eslint/no-unused-vars> reported by reviewdog 🐶
'result2' is assigned a value but never used.

howydev and others added 12 commits December 13, 2024 18:04
# Pull Request Checklist

- [x] Did you add new tests and confirm existing tests pass? (`yarn test`)
- [ ] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md))
- [ ] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [ ] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`)
- [ ] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`)
- [ ] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)?

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on renaming and restructuring several ABI files and exports in the smart contracts directory, enhancing clarity and consistency in the codebase.

### Detailed summary
- Renamed `MAV2FactoryAbi` to `accountFactoryAbi` in `accountFactoryAbi.ts`.
- Renamed `smaV2Abi` to `semiModularAccountBytecodeAbi` in `semiModularAccountBytecodeAbi.ts`.
- Renamed `singleSignerValidationAbi` to `singleSignerValidationModuleAbi` in `singleSignerValidationModule.ts`.
- Updated import statements to reflect the new names.
- Added a new `addresses` export containing various module addresses in `utils.ts`.
- Introduced new ABI definitions for `paymasterGuardModule`, `timeRangeModule`, `webauthnValidationModule`, `nativeTokenLimitModule`, and `allowlistModule`.
- Added ABI definitions for events and error types in the newly created ABI files.

> The following files were skipped due to too many changes: `account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountStorageAbi.ts`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
uses a placeholder signer for now

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new smart contract account type called `SMAV2Account`, along with its creation function `createSMAV2Account`. It includes types, parameters, and logic for initializing accounts using a bundler client, handling initial owners, and generating account addresses.

### Detailed summary
- Added type `SMAV2Account` for smart contract accounts.
- Introduced type `CreateSMAV2AccountParams` for account creation parameters.
- Implemented `createSMAV2Account` function to create a new account.
- Added logic to handle account initialization and owner address retrieval.
- Utilized `createBundlerClient` for client creation.
- Integrated `standardExecutor` and `multiOwnerMessageSigner` for account functionality.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
- [ ] Did you add new tests and confirm existing tests pass? (`yarn test`)
- [ ] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md))
- [ ] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [ ] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`)
- [ ] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`)
- [ ] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)?

<!-- start pr-codex -->

---

This PR introduces a new module for single signer validation in the `account-kit` smart contracts. It adds functionality for packing signatures and validating user operations, along with defining the ABI for the single signer validation module and related contracts.

- Added `PackSignatureParams` type and `packSignature` utility in `utils.ts`.
- Created `SingleSignerValidationModule` with metadata and encoding functions in `single-signer-validation/module.ts`.
- Implemented `singleSignerMessageSigner` function in `single-signer-validation/signer.ts` for signing operations.
- Defined the ABI for `singleSignerValidation` in `abis/singleSignerValidation.ts`.
- Added ABI for `MAV2Factory` and `smaV2` in their respective files.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
- [x] Did you add new tests and confirm existing tests pass? (`yarn test`)
- [ ] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md))
- [ ] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [ ] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`)
- [ ] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`)
- [ ] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)?

<!-- start pr-codex -->

---

This PR focuses on renaming and restructuring various ABI exports and imports in the `account-kit/smart-contracts` project, enhancing clarity and organization in the codebase.

- Renamed `MAV2FactoryAbi` to `accountFactoryAbi` in `accountFactoryAbi.ts`.
- Renamed `smaV2Abi` to `semiModularAccountBytecodeAbi` in `semiModularAccountBytecodeAbi.ts`.
- Renamed `singleSignerValidationAbi` to `singleSignerValidationModuleAbi` in `singleSignerValidationModule.ts`.
- Updated import statement in `module.ts` for `singleSignerValidationModuleAbi`.
- Added new `addresses` export with various module addresses in `utils.ts`.
- Introduced `paymasterGuardModuleAbi` in `paymasterGuardModule.ts`.
- Added `timeRangeModuleAbi` in `timeRangeModule.ts`.
- Added `webauthnValidationModuleAbi` in `webauthnValidation.ts`.
- Added `nativeTokenLimitModuleAbi` in `nativeTokenLimitModule.ts`.
- Added `allowlistModuleAbi` in `allowlistModule.ts`.
- Introduced `modularAccountAbi` in `modularAccountAbi.ts`.
- Introduced `semiModularAccountStorageAbi` in `semiModularAccountStorageAbi.ts`.

> The following files were skipped due to too many changes: `account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountStorageAbi.ts`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
# Pull Request Checklist

- [x] Did you add new tests and confirm existing tests pass? (`yarn test`)
- [ ] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md))
- [ ] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [ ] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard?
- [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`)
- [ ] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`)
- [ ] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)?

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces several new smart contract ABIs and address constants for a modular account system, enhancing functionality for various modules, including validation and execution.

### Detailed summary
- Added `addresses` constant with various module addresses in `addresses.ts`.
- Introduced ABIs for `paymasterGuardModule`, `timeRangeModule`, `webauthnValidation`, `nativeTokenLimitModule`, `allowlistModule`, and `maV2`.
- Each ABI includes functions, events, and errors relevant to their respective modules.

> The following files were skipped due to too many changes: `account-kit/smart-contracts/src/ma-v2/abis/smaStorage.ts`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants