Skip to content

Commit

Permalink
v1.4.20-beta.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ppedziwiatr committed Oct 13, 2023
1 parent acc0413 commit a8a4741
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
23 changes: 10 additions & 13 deletions src/__tests__/integration/basic/pst.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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);
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/core/modules/impl/DefaultStateEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a8a4741

Please sign in to comment.