Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
excaliborr committed Feb 7, 2024
1 parent c2da0de commit 27ab5b4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
```
Expand Down
12 changes: 5 additions & 7 deletions src/gasless-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,11 @@ export class GaslessProvider extends ProviderWrapper {
* @returns Unknown, as it depends on the request being made
*/
public request(args: RequestArguments): Promise<unknown> {
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);
Expand Down Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion test/integration/deployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion test/integration/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 27ab5b4

Please sign in to comment.