diff --git a/README.md b/README.md index 8b6a0a9..534f0fd 100644 --- a/README.md +++ b/README.md @@ -183,13 +183,11 @@ This plugin adds additional JSON-RPC methods to be able to interact and get data ### `aa_getSmartAccountAddress` **Description:** Returns the address for the smart account that is being used by the provider. - - Parameters: - - `signerAddress: 0x${string}` - The signer of the transactions - Example: ```js const smartAccountAddress = await network.provider.request({ method: 'aa_getSmartAccountAddress', - params: [signer.address], + params: [], }); console.log(`Smart account address: ${smartAccountAddress}`); ``` diff --git a/src/gasless-provider.ts b/src/gasless-provider.ts index 8bea902..6efd0f2 100644 --- a/src/gasless-provider.ts +++ b/src/gasless-provider.ts @@ -109,12 +109,11 @@ export class GaslessProvider extends ProviderWrapper { * @returns Unknown, as it depends on the request being made */ public request(args: RequestArguments): Promise { - if (args.params !== undefined) { - if (args.method === 'aa_getSmartAccountAddress') { - const params = this._getParams(args); - return this._getSmartAccountAddress(params[0]); - } + if (args.method === 'aa_getSmartAccountAddress') { + return this._getSmartAccountAddress(); + } + if (args.params !== undefined) { // Need to override this for plugins that check receipt for deployment addresses if (args.method === 'eth_getTransactionReceipt') { const params = this._getParams(args); @@ -540,11 +539,10 @@ export class GaslessProvider extends ProviderWrapper { /** * Determines address for a smart account already deployed or to be deployed - * @param owner The owner of the smart account * @returns A promise that resolves to sender address * @dev Needs to be async so it returns a promise for the request method */ - private async _getSmartAccountAddress(owner: `0x${string}`): Promise<`0x${string}`> { + private async _getSmartAccountAddress(): Promise<`0x${string}`> { return this.senderAddress; } } diff --git a/test/integration/deployment.test.ts b/test/integration/deployment.test.ts index c441985..27b0ed1 100644 --- a/test/integration/deployment.test.ts +++ b/test/integration/deployment.test.ts @@ -25,7 +25,7 @@ describe('Integration deployments', function () { const smartAccount = await this.hre.network.provider.request({ method: 'aa_getSmartAccountAddress', - params: [await signer.getAddress()], + params: [], }); const ownableContract = await this.hre.ethers.deployContract('OwnableContract'); diff --git a/test/integration/transactions.test.ts b/test/integration/transactions.test.ts index 2f64f3c..34fc1ec 100644 --- a/test/integration/transactions.test.ts +++ b/test/integration/transactions.test.ts @@ -21,7 +21,7 @@ describe('Integration transactions', function () { it('Should send a transaction', async function () { const smartAccount = await this.hre.network.provider.request({ method: 'aa_getSmartAccountAddress', - params: [signerAddress], + params: [], }); const amountToMint = this.hre.ethers.parseEther('6.9');