From 95d23a662f0aeaba645be164515e5284336e6d46 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Sun, 11 Feb 2024 14:01:41 +0000 Subject: [PATCH] chore: fix linting and tests --- jest.config.js | 3 +- .../contracts/BaseContract/BaseContract.ts | 44 +++++++++---------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/jest.config.js b/jest.config.js index 3fb65370..00cec43c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -13,7 +13,8 @@ module.exports = { }, rootDir: '.', setupFilesAfterEnv: ['/test/setup.ts'], - testEnvironment: 'jest-environment-node', + // testEnvironment: 'jest-environment-node', // TODO: this is required for the ARC0200Contract tests, otherwise the algosdk fails + testEnvironment: 'jsdom', transform: { '^.+\\.tsx?$': [ 'ts-jest', diff --git a/src/extension/contracts/BaseContract/BaseContract.ts b/src/extension/contracts/BaseContract/BaseContract.ts index 8c32bae7..3aa48bec 100644 --- a/src/extension/contracts/BaseContract/BaseContract.ts +++ b/src/extension/contracts/BaseContract/BaseContract.ts @@ -252,30 +252,26 @@ export default class BaseContract { ); let request: algosdk.modelsv2.SimulateRequest; - try { - assignGroupID(transactions); - - request = new algosdk.modelsv2.SimulateRequest({ - allowUnnamedResources: true, - allowEmptySignatures: true, - txnGroups: [ - new algosdk.modelsv2.SimulateRequestTransactionGroup({ - txns: transactions.map( - (value) => - decodeObj( - encodeUnsignedSimulateTransaction(value) - ) as EncodedSignedTransaction - ), - }), - ], - }); - return await this.algodClient - .simulateTransactions(request) - .setIntDecoding(IntDecoding.BIGINT) - .do(); - } catch (error) { - throw error; - } + assignGroupID(transactions); + + request = new algosdk.modelsv2.SimulateRequest({ + allowUnnamedResources: true, + allowEmptySignatures: true, + txnGroups: [ + new algosdk.modelsv2.SimulateRequestTransactionGroup({ + txns: transactions.map( + (value) => + decodeObj( + encodeUnsignedSimulateTransaction(value) + ) as EncodedSignedTransaction + ), + }), + ], + }); + return await this.algodClient + .simulateTransactions(request) + .setIntDecoding(IntDecoding.BIGINT) + .do(); } /**