From 57a31a745b3cf9fedfeee0b1bf157ed813bfb2c1 Mon Sep 17 00:00:00 2001 From: excaliborr <124819095+excaliborr@users.noreply.github.com> Date: Thu, 28 Dec 2023 10:30:41 -0500 Subject: [PATCH] chore: getting entry point dynamically (#11) * chore: getting entry point dynamically * chore: comment --- src/constants.ts | 2 -- src/gasless-provider.ts | 4 ++-- src/index.ts | 1 - src/type-extensions.ts | 2 -- test/fixture-projects/hardhat-project/hardhat.config.ts | 1 - test/project.test.ts | 4 ---- 6 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 2c23f6e..d73f533 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,5 +1,3 @@ -export const entryPoint = '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789'; - export const simpleAccountFactoryAddress = '0x9406Cc6185a346906296840746125a0E44976454'; export const dummySignature = '0xa15569dd8f8324dbeabf8023fdec36d4b754f53ce5901e283c6de79af177dc94557fa3c9922cd7af2a96ca94402d35c39f266925ee6407aeb32b31d76978d4ba1c'; \ No newline at end of file diff --git a/src/gasless-provider.ts b/src/gasless-provider.ts index ba3fe61..344e39f 100644 --- a/src/gasless-provider.ts +++ b/src/gasless-provider.ts @@ -42,9 +42,9 @@ export class GaslessProvider extends ProviderWrapper { bundlerClient: PimlicoBundlerClient, paymasterClient: PimlicoPaymasterClient, publicClient: ReturnType, - customEntryPoint: `0x${string}` | undefined, ) { - const entryPoint = customEntryPoint !== undefined ? customEntryPoint : constants.entryPoint; + // NOTE: Bundlers can support many entry points, but currently they only support one, we use this method so if they ever add a new one the entry point will still work + const entryPoint = (await bundlerClient.supportedEntryPoints())[0]; const simpleAccountFactoryAddress = constants.simpleAccountFactoryAddress; const owner = privateKeyToAccount(_signerPk); diff --git a/src/index.ts b/src/index.ts index fe936a8..c674755 100644 --- a/src/index.ts +++ b/src/index.ts @@ -54,6 +54,5 @@ extendProvider(async (provider, config, networkName) => { bundlerClient, paymasterClient, publicClient, - netConfig.entryPoint, ); }); diff --git a/src/type-extensions.ts b/src/type-extensions.ts index 935e94f..aebb7dd 100644 --- a/src/type-extensions.ts +++ b/src/type-extensions.ts @@ -4,11 +4,9 @@ import 'hardhat/types/runtime'; declare module 'hardhat/types/config' { export interface HttpNetworkUserConfig { pimlicoApiKey?: string; - entryPoint?: `0x${string}`; } export interface HttpNetworkConfig { pimlicoApiKey?: string; - entryPoint?: `0x${string}`; } } diff --git a/test/fixture-projects/hardhat-project/hardhat.config.ts b/test/fixture-projects/hardhat-project/hardhat.config.ts index 429f8e4..5aa3d20 100644 --- a/test/fixture-projects/hardhat-project/hardhat.config.ts +++ b/test/fixture-projects/hardhat-project/hardhat.config.ts @@ -9,7 +9,6 @@ const config: HardhatUserConfig = { networks: { localhost: { pimlicoApiKey: 'foo', - entryPoint: '0x0576a174D229E3cFA37253523E645A78A0C91B57', }, }, }; diff --git a/test/project.test.ts b/test/project.test.ts index 8fac992..a4f4a5f 100644 --- a/test/project.test.ts +++ b/test/project.test.ts @@ -9,9 +9,5 @@ describe('Integration tests examples', function () { it('Should add the pimlicoApiKey to the config', function () { assert.equal(this.hre.config.networks.localhost.pimlicoApiKey, 'foo'); }); - - it('Should add the entryPoint to the config', function () { - assert.equal(this.hre.config.networks.localhost.entryPoint, '0x0576a174D229E3cFA37253523E645A78A0C91B57'); - }); }); });