From a8a47419941bd4b5fcb4f11bdca907771ac2dccb Mon Sep 17 00:00:00 2001 From: ppedziwiatr Date: Fri, 13 Oct 2023 12:56:01 +0200 Subject: [PATCH] v1.4.20-beta.0 --- package.json | 2 +- src/__tests__/integration/basic/pst.test.ts | 23 ++++++++----------- .../modules/impl/DefaultStateEvaluator.ts | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index fd0d33f0..584c0bc9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "warp-contracts", - "version": "1.4.19", + "version": "1.4.20-beta.0", "description": "An implementation of the SmartWeave smart contract protocol.", "types": "./lib/types/index.d.ts", "main": "./lib/cjs/index.js", diff --git a/src/__tests__/integration/basic/pst.test.ts b/src/__tests__/integration/basic/pst.test.ts index c85a5332..ab993ace 100644 --- a/src/__tests__/integration/basic/pst.test.ts +++ b/src/__tests__/integration/basic/pst.test.ts @@ -7,12 +7,12 @@ import path from 'path'; import { mineBlock } from '../_helpers'; import { PstState, PstContract } from '../../../contract/PstContract'; import { InteractionResult } from '../../../core/modules/impl/HandlerExecutorFactory'; -import { Warp } from "../../../core/Warp"; +import { Warp } from '../../../core/Warp'; import { WarpFactory } from '../../../core/WarpFactory'; import { LoggerFactory } from '../../../logging/LoggerFactory'; import { DeployPlugin } from 'warp-contracts-plugin-deploy'; import { VM2Plugin } from 'warp-contracts-plugin-vm2'; -import { InteractionCompleteEvent } from "../../../core/modules/StateEvaluator"; +import { InteractionCompleteEvent } from '../../../core/modules/StateEvaluator'; describe('Testing the Profit Sharing Token', () => { let contractSrc: string; @@ -118,14 +118,13 @@ describe('Testing the Profit Sharing Token', () => { }); it('should properly dispatch en event', async () => { - let handlerCalled = false; const interactionResult = await pst.writeInteraction({ - function: 'dispatchEvent', + function: 'dispatchEvent' }); await mineBlock(warp); - warp.eventTarget.addEventListener("interactionCompleted", interactionCompleteHandler); + warp.eventTarget.addEventListener('interactionCompleted', interactionCompleteHandler); await pst.readState(); expect(handlerCalled).toBeTruthy(); @@ -136,16 +135,14 @@ describe('Testing the Profit Sharing Token', () => { expect(event.detail.caller).toEqual(walletAddress); expect(event.detail.transactionId).toEqual(interactionResult.originalTxId); expect(event.detail.data).toEqual({ - value1: "foo", - value2: "bar" - } - ); + value1: 'foo', + value2: 'bar' + }); expect(event.detail.input).toEqual({ - function: 'dispatchEvent' - } - ); + function: 'dispatchEvent' + }); handlerCalled = true; - warp.eventTarget.removeEventListener("interactionCompleted", interactionCompleteHandler); + warp.eventTarget.removeEventListener('interactionCompleted', interactionCompleteHandler); } }); diff --git a/src/core/modules/impl/DefaultStateEvaluator.ts b/src/core/modules/impl/DefaultStateEvaluator.ts index ea7f0d0d..5217eb33 100644 --- a/src/core/modules/impl/DefaultStateEvaluator.ts +++ b/src/core/modules/impl/DefaultStateEvaluator.ts @@ -366,7 +366,7 @@ export abstract class DefaultStateEvaluator implements StateEvaluator { } } - private parseInput(inputTag: GQLTagInterface): unknown | null { + private parseInput(inputTag: GQLTagInterface): { function: string } | null { try { return JSON.parse(inputTag.value); } catch (e) {