Skip to content

Commit

Permalink
chore: fix linting and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kieranroneill committed Feb 11, 2024
1 parent 0f3127e commit 95d23a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 25 deletions.
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ module.exports = {
},
rootDir: '.',
setupFilesAfterEnv: ['<rootDir>/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',
Expand Down
44 changes: 20 additions & 24 deletions src/extension/contracts/BaseContract/BaseContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down

0 comments on commit 95d23a6

Please sign in to comment.