diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fb88893..65134ed0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## [1.1.6] - 2023-08-24 +### Bug Fixes +- Fixes on User hash was created before initialising the paymaster response if given which leads to "Invalid signature or paymaster signature" + ## [1.1.4] - 2023-08-21 ### Breaking Changes - Changed the way of initialising the Paymaster url to string as before it was unreachable code to get VerifyingPaymasterApi class to pass on to the Prime-Sdk diff --git a/package-lock.json b/package-lock.json index c262d356..4bf299c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@etherspot/prime-sdk", - "version": "1.1.5", + "version": "1.1.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@etherspot/prime-sdk", - "version": "1.1.5", + "version": "1.1.6", "license": "MIT", "dependencies": { "@thehubbleproject/bls": "0.5.1", diff --git a/package.json b/package.json index cd949cad..a70d60f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@etherspot/prime-sdk", - "version": "1.1.5", + "version": "1.1.6", "description": "Etherspot Prime (Account Abstraction) SDK", "keywords": [ "ether", diff --git a/src/sdk/base/BaseAccountAPI.ts b/src/sdk/base/BaseAccountAPI.ts index a8f44da3..b6268a07 100644 --- a/src/sdk/base/BaseAccountAPI.ts +++ b/src/sdk/base/BaseAccountAPI.ts @@ -498,12 +498,13 @@ export abstract class BaseAccountAPI { * @param userOp the UserOperation to sign (with signature field ignored) */ async signUserOp(userOp: UserOperationStruct): Promise { - const userOpHash = await this.getUserOpHash(userOp); if (this.paymasterAPI != null) { const paymasterAndData = await this.paymasterAPI.getPaymasterAndData(userOp); userOp.paymasterAndData = paymasterAndData.paymasterAndData; userOp.verificationGasLimit = BigNumber.from(paymasterAndData.verificationGasLimit); + userOp.preVerificationGas = paymasterAndData.preVerificationGas; } + const userOpHash = await this.getUserOpHash(userOp); const signature = await this.signUserOpHash(userOpHash); return { ...userOp, diff --git a/src/sdk/base/VerifyingPaymasterAPI.ts b/src/sdk/base/VerifyingPaymasterAPI.ts index 0b54a556..f9327be2 100644 --- a/src/sdk/base/VerifyingPaymasterAPI.ts +++ b/src/sdk/base/VerifyingPaymasterAPI.ts @@ -12,6 +12,7 @@ const DUMMY_PAYMASTER_AND_DATA = export interface paymasterResponse { paymasterAndData: string; verificationGasLimit: string; + preVerificationGas?: string; } export class VerifyingPaymasterAPI extends PaymasterAPI { @@ -49,7 +50,7 @@ export class VerifyingPaymasterAPI extends PaymasterAPI { op.preVerificationGas = calcPreVerificationGas(op); // Ask the paymaster to sign the transaction and return a valid paymasterAndData value. - const paymasterAndData = axios + const paymasterAndData = await axios .post(this.paymasterUrl, { jsonrpc: '2.0', id: 1, @@ -60,7 +61,7 @@ export class VerifyingPaymasterAPI extends PaymasterAPI { return res.data }); - return paymasterAndData; + return {paymasterAndData: paymasterAndData.paymasterAndData, verificationGasLimit: paymasterAndData.verificationGasLimit, preVerificationGas: op.preVerificationGas.toString()}; } }