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: entry point address as optional to SmartAccountProvider #180

Merged
merged 6 commits into from
Oct 30, 2023

Conversation

denniswon
Copy link
Contributor

@denniswon denniswon commented Oct 29, 2023

app.asana.com/0/1205598840815267/1205773893380310/f

Part of the task linked above, removed entrypoint contract address param from SmartAccountProvider constructor params/class fields and instead, made entry point contract of the linked SCA account to be the source of entry point contract address.

In case the entry point contract address is needed prior to account being connected, entry point contract address defaults to the default entry point contract address from the getDefaultEntryPointContract helper.

Follow up PRs will made to make entry point contract address param for SmartContractAccount class as optional (in case user wants to use their own for some reason).


PR-Codex overview

Detailed summary

  • Added defaults.js and userop.js to the utils directory in packages/core/src/utils.
  • Modified privy.ts, fireblocks.md, and lit.md in the site/snippets and site/smart-accounts/signers directories.
  • Added readonly entryPointAddress: Address to types.ts in packages/core/src/provider.
  • Updated @alchemy/aa-core version in packages/alchemy/package.json and packages/accounts/package.json.
  • Modified introduction.md in site/packages/aa-alchemy/provider, site/packages/aa-alchemy/middleware, site/packages/aa-ethers/provider-adapter, and site/packages/aa-core/client.
  • Updated getDefaultSimpleAccountFactoryAddress and getDefaultLightAccountFactoryAddress imports in index.ts and light-account/__tests__/account.test.ts in packages/accounts/src and light-account/utils.js in packages/core/src/account.
  • Updated @alchemy/aa-accounts, @alchemy/aa-alchemy, and @alchemy/aa-core versions in examples/aa-simple-dapp/package.json and examples/alchemy-daapp/package.json.
  • Modified fromEthersProvider.md in site/packages/aa-ethers/provider-adapter.
  • Modified provider.ts in packages/alchemy/src.
  • Modified introduction.md in site/packages/aa-alchemy/middleware.
  • Updated getDefaultLightAccountFactoryAddress import in index.ts in packages/core/src.
  • Modified simple.test.ts in packages/core/src/account/__tests__.
  • Updated @alchemy/aa-accounts, @alchemy/aa-alchemy, and @alchemy/aa-core versions in examples/aa-simple-dapp/package.json and examples/alchemy-daapp/package.json.
  • Modified connect.md in site/packages/aa-ethers/account-signer.
  • Modified createPublicErc4337Client.md in site/packages/aa-core/client.
  • Modified provider.test.ts in packages/alchemy/src/__tests__.
  • Modified ethers-provider.ts in site/snippets.
  • Modified sponsoring-gas.md in site/smart-accounts.
  • Modified index.tsx in examples/aa-simple-dapp/src/context/wallet.
  • Modified withAlchemyGasManager.md in site/packages/aa-alchemy/middleware.
  • Modified types.ts in packages/core/src/account.
  • Modified userop.ts in packages/core/src/utils.
  • Modified config.ts in site/.vitepress.
  • Modified capsule.md in site/smart-accounts/signers.

The following files were skipped due to too many changes: site/smart-accounts/signers/capsule.md, site/smart-accounts/signers/dynamic.md, site/smart-accounts/signers/web3auth.md, packages/accounts/src/kernel-zerodev/e2e-tests/kernel-account.test.ts, packages/core/src/__tests__/utils.test.ts, packages/alchemy/src/middleware/gas-manager.ts, site/smart-accounts/signers/turnkey.md, packages/core/src/provider/schema.ts, site/packages/aa-core/utils/getDefaultEntryPointAddress.md, site/smart-accounts/signers/magic.md, site/packages/aa-core/utils/getDefaultSimpleAccountFactoryAddress.md, site/packages/aa-accounts/utils/getDefaultLightAccountFactoryAddress.md, site/snippets/ethers-signer.ts, site/snippets/core-provider.ts, packages/accounts/src/kernel-zerodev/README.md, packages/accounts/src/light-account/utils.ts, packages/accounts/src/kernel-zerodev/__tests__/account.test.ts, site/snippets/provider.ts, packages/core/src/provider/__tests__/base.test.ts, yarn.lock, site/snippets/account-ethers.ts, examples/alchemy-daapp/src/surfaces/onboarding/OnboardingDataModels.tsx, site/snippets/account-alchemy.ts, packages/ethers/src/provider-adapter.ts, site/snippets/account-core.ts, packages/core/src/provider/base.ts, packages/ethers/e2e-tests/simple-account.test.ts, packages/ethers/src/__tests__/provider-adapter.test.ts, examples/aa-simple-dapp/src/hooks/useAlchemyProvider.ts, packages/accounts/src/light-account/e2e-tests/light-account.test.ts, packages/core/e2e-tests/simple-account.test.ts, packages/core/src/utils/defaults.ts, site/snippets/light-account.ts, packages/alchemy/e2e-tests/simple-account.test.ts, examples/alchemy-daapp/src/surfaces/onboarding/OnboardingController.ts

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

@denniswon denniswon force-pushed the denniswon/abstract-entrypoint branch 4 times, most recently from 79efd67 to bc2e02b Compare October 29, 2023 20:52
@denniswon
Copy link
Contributor Author

Screenshot 2023-10-29 at 1 48 30 PM
Screenshot 2023-10-29 at 1 48 38 PM
Screenshot 2023-10-29 at 1 48 46 PM

@denniswon denniswon force-pushed the denniswon/abstract-entrypoint branch from bc2e02b to f2717f8 Compare October 30, 2023 02:59
@denniswon denniswon changed the base branch from development to denniswon/chore October 30, 2023 03:00
@denniswon denniswon force-pushed the denniswon/abstract-entrypoint branch 2 times, most recently from 8ff1972 to 1b90588 Compare October 30, 2023 03:32
@denniswon denniswon changed the title feat: abstract out entry point contract address from SCA provider params feat: entry point address as optional to SmartAccountProvider Oct 30, 2023
Copy link
Collaborator

@moldy530 moldy530 left a comment

Choose a reason for hiding this comment

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

couple nits, but LGTM otherwise

packages/accounts/package.json Show resolved Hide resolved
packages/alchemy/package.json Show resolved Hide resolved
packages/core/src/utils/defaults.ts Outdated Show resolved Hide resolved
packages/core/src/utils/defaults.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@avasisht23 avasisht23 left a comment

Choose a reason for hiding this comment

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

wanted to discuss current approach re: escape in the opts param vs. if you considered just having the entrypoint be an optional constructor param with a default value if not present.

thanks for reflecting the change across all surfaces 🙏

packages/core/src/utils/index.ts Outdated Show resolved Hide resolved
* @returns a {@link abi.Address} for the given chain
* @throws if the chain doesn't have an address currently deployed
*/
export const getDefaultEntryPointContract = (chain: Chain): Address => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit(naming): to me the method name implies retrieving an object containing details about a contract, not just the address.

should we name it: getDefaultEntryPointAddress

packages/core/src/utils/defaults.ts Outdated Show resolved Hide resolved
packages/core/src/provider/base.ts Outdated Show resolved Hide resolved
@@ -87,7 +96,6 @@ export type SmartAccountProviderConfig<
> = {
rpcProvider: string | PublicErc4337Client<TTransport>;
chain: Chain;
entryPointAddress: Address;
Copy link
Contributor

Choose a reason for hiding this comment

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

see above re: question on why we can't just make this optional with a default value,

packages/accounts/src/light-account/utils.ts Show resolved Hide resolved
Base automatically changed from denniswon/chore to development October 30, 2023 18:12
@denniswon denniswon force-pushed the denniswon/abstract-entrypoint branch 2 times, most recently from 424329d to 68628f2 Compare October 30, 2023 21:17
@denniswon denniswon force-pushed the denniswon/abstract-entrypoint branch from 68628f2 to a05006f Compare October 30, 2023 21:19
@denniswon denniswon merged commit 96a3f8c into development Oct 30, 2023
3 checks passed
@denniswon denniswon deleted the denniswon/abstract-entrypoint branch October 30, 2023 21:25
avasisht23 added a commit that referenced this pull request Nov 3, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
avasisht23 added a commit that referenced this pull request Nov 3, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
avasisht23 added a commit that referenced this pull request Nov 3, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
@moldy530 moldy530 mentioned this pull request Nov 10, 2023
moldy530 pushed a commit that referenced this pull request Nov 10, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
moldy530 pushed a commit that referenced this pull request Nov 10, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
avasisht23 added a commit that referenced this pull request Nov 14, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
avasisht23 added a commit that referenced this pull request Nov 14, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
avasisht23 added a commit that referenced this pull request Nov 14, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
avasisht23 added a commit that referenced this pull request Nov 14, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
denniswon added a commit that referenced this pull request Nov 16, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
denniswon added a commit that referenced this pull request Nov 16, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
moldy530 pushed a commit that referenced this pull request Nov 16, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
moldy530 pushed a commit that referenced this pull request Nov 16, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
@moldy530 moldy530 mentioned this pull request Nov 17, 2023
7 tasks
@moldy530 moldy530 mentioned this pull request Dec 1, 2023
8 tasks
avasisht23 added a commit that referenced this pull request Dec 3, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
avasisht23 added a commit that referenced this pull request Dec 3, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
avasisht23 added a commit that referenced this pull request Dec 3, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
avasisht23 added a commit that referenced this pull request Dec 3, 2023
* feat: abstract out entry point contract address from SCA provider params

* feat: make entry point address as an optional param to SCA provider class

* feat: update docs for the new utils methods

* Update site/packages/aa-core/utils/getDefaultEntryPointContract.md

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

* Update site/packages/aa-core/utils/getDefaultSimpleAccountFactory.md

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

* chore: nit error message update and refactoring

---------

Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
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