diff --git a/packages/api-kit/src/SafeApiKit.ts b/packages/api-kit/src/SafeApiKit.ts index 5e6babc8a..a553bae02 100644 --- a/packages/api-kit/src/SafeApiKit.ts +++ b/packages/api-kit/src/SafeApiKit.ts @@ -262,10 +262,10 @@ class SafeApiKit { // FIXME remove when the transaction service returns the singleton property instead of masterCopy if (!response?.singleton) { const { masterCopy, ...rest } = response - return { ...rest, singleton: masterCopy } as SafeInfoResponse + return { ...rest, singleton: masterCopy, nonce: Number(response.nonce) } as SafeInfoResponse } - return response as SafeInfoResponse + return { ...response, nonce: Number(response.nonce) } as SafeInfoResponse }) } @@ -851,6 +851,16 @@ class SafeApiKit { return sendRequest({ url: `${this.#txServiceBaseUrl}/v1/safe-operations/${safeOperationHash}/`, method: HttpMethod.Get + }).then((response: any) => { + return { + ...response, + nonce: Number(response.nonce), + callGasLimit: Number(response.callGasLimit), + verificationGasLimit: Number(response.verificationcallGasLimit), + preVerificationGas: Number(response.preVerificationGas), + maxFeePerGas: Number(response.maxFeePerGas), + maxPriorityFeePerGas: Number(response.maxPriorityFeePerGas) + } as SafeOperationResponse }) } diff --git a/packages/api-kit/tests/e2e/getSafeOperationsByAddress.test.ts b/packages/api-kit/tests/e2e/getSafeOperationsByAddress.test.ts index 95a283d9b..da7202eca 100644 --- a/packages/api-kit/tests/e2e/getSafeOperationsByAddress.test.ts +++ b/packages/api-kit/tests/e2e/getSafeOperationsByAddress.test.ts @@ -56,14 +56,23 @@ describe('getSafeOperationsByAddress', () => { chai.expect(safeOperation.userOperation).to.have.property('ethereumTxHash') chai.expect(safeOperation.userOperation).to.have.property('sender').to.eq(SAFE_ADDRESS) chai.expect(safeOperation.userOperation).to.have.property('userOperationHash') - chai.expect(safeOperation.userOperation).to.have.property('nonce') + chai.expect(safeOperation.userOperation).to.have.property('nonce').to.be.a('number') chai.expect(safeOperation.userOperation).to.have.property('initCode') chai.expect(safeOperation.userOperation).to.have.property('callData') - chai.expect(safeOperation.userOperation).to.have.property('callGasLimit') - chai.expect(safeOperation.userOperation).to.have.property('verificationGasLimit') - chai.expect(safeOperation.userOperation).to.have.property('preVerificationGas') - chai.expect(safeOperation.userOperation).to.have.property('maxFeePerGas') - chai.expect(safeOperation.userOperation).to.have.property('maxPriorityFeePerGas') + chai.expect(safeOperation.userOperation).to.have.property('callGasLimit').to.be.a('number') + chai + .expect(safeOperation.userOperation) + .to.have.property('verificationGasLimit') + .to.be.a('number') + chai + .expect(safeOperation.userOperation) + .to.have.property('preVerificationGas') + .to.be.a('number') + chai.expect(safeOperation.userOperation).to.have.property('maxFeePerGas').to.be.a('number') + chai + .expect(safeOperation.userOperation) + .to.have.property('maxPriorityFeePerGas') + .to.be.a('number') chai.expect(safeOperation.userOperation).to.have.property('paymaster') chai.expect(safeOperation.userOperation).to.have.property('paymasterData') chai.expect(safeOperation.userOperation).to.have.property('signature')