Skip to content

Commit

Permalink
feat: add entry point as optional parameter (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAustrian authored Dec 26, 2023
1 parent 77bfb06 commit ae0cfcb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/gasless-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ export class GaslessProvider extends ProviderWrapper {
bundlerClient: PimlicoBundlerClient,
paymasterClient: PimlicoPaymasterClient,
publicClient: ReturnType<typeof createPublicClient>,
customEntryPoint: `0x${string}` | undefined,
) {
const entryPoint = '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789';
const entryPoint = customEntryPoint !== undefined ? customEntryPoint : '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789';
const simpleAccountFactoryAddress = '0x9406Cc6185a346906296840746125a0E44976454';
const owner = privateKeyToAccount(_signerPk);

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

it('Should add the sponsoredUrl to the config', 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 ae0cfcb

Please sign in to comment.