Skip to content

Commit

Permalink
chore: getting entry point dynamically (#11)
Browse files Browse the repository at this point in the history
* chore: getting entry point dynamically

* chore: comment
  • Loading branch information
excaliborr authored Dec 28, 2023
1 parent e811774 commit 57a31a7
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export const entryPoint = '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789';

export const simpleAccountFactoryAddress = '0x9406Cc6185a346906296840746125a0E44976454';

export const dummySignature = '0xa15569dd8f8324dbeabf8023fdec36d4b754f53ce5901e283c6de79af177dc94557fa3c9922cd7af2a96ca94402d35c39f266925ee6407aeb32b31d76978d4ba1c';
4 changes: 2 additions & 2 deletions src/gasless-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ export class GaslessProvider extends ProviderWrapper {
bundlerClient: PimlicoBundlerClient,
paymasterClient: PimlicoPaymasterClient,
publicClient: ReturnType<typeof createPublicClient>,
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);

Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ extendProvider(async (provider, config, networkName) => {
bundlerClient,
paymasterClient,
publicClient,
netConfig.entryPoint,
);
});
2 changes: 0 additions & 2 deletions src/type-extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}
}
1 change: 0 additions & 1 deletion test/fixture-projects/hardhat-project/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const config: HardhatUserConfig = {
networks: {
localhost: {
pimlicoApiKey: 'foo',
entryPoint: '0x0576a174D229E3cFA37253523E645A78A0C91B57',
},
},
};
Expand Down
4 changes: 0 additions & 4 deletions test/project.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
});

0 comments on commit 57a31a7

Please sign in to comment.