From dada969d1198ccd9cbe3c3f9106a96f233e70241 Mon Sep 17 00:00:00 2001 From: danielailie Date: Thu, 5 Sep 2024 15:42:07 +0300 Subject: [PATCH] Fix integretion tests --- src/smartcontracts/codec/managedDecimal.ts | 2 +- src/smartcontracts/interaction.local.net.spec.ts | 6 +++--- src/smartcontracts/typesystem/types.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/smartcontracts/codec/managedDecimal.ts b/src/smartcontracts/codec/managedDecimal.ts index 83f7b529..a8f113cb 100644 --- a/src/smartcontracts/codec/managedDecimal.ts +++ b/src/smartcontracts/codec/managedDecimal.ts @@ -25,7 +25,7 @@ export class ManagedDecimalCodec { return new ManagedDecimalValue(new BigNumber(0), 2); } - const isUsize = type.getMetadata() === "usize"; + const isUsize = type.getMetadata() == "usize"; if (isUsize) { const u32Size = 4; diff --git a/src/smartcontracts/interaction.local.net.spec.ts b/src/smartcontracts/interaction.local.net.spec.ts index e5f4a79d..e809bb1a 100644 --- a/src/smartcontracts/interaction.local.net.spec.ts +++ b/src/smartcontracts/interaction.local.net.spec.ts @@ -240,7 +240,7 @@ describe("test smart contract interactor", function () { // log let mdLnInteraction = contract.methods - .managed_decimal_ln([new ManagedDecimalValue(23, 9)]) + .managed_decimal_ln([new ManagedDecimalValue(23000000000, 9)]) .withGasLimit(10000000) .withChainID(network.ChainID) .withSender(alice.address) @@ -287,7 +287,7 @@ describe("test smart contract interactor", function () { let { bundle: bundleMDLn } = await controller.execute(mdLnInteraction, mdLnTransaction); assert.isTrue(bundleMDLn.returnCode.equals(ReturnCode.Ok)); assert.lengthOf(bundleMDLn.values, 1); - assert.deepEqual(bundleMDLn.values[0], new ManagedDecimalSignedValue(3.135553845, 9)); + assert.deepEqual(bundleMDLn.values[0], new ManagedDecimalSignedValue(3135553845, 9)); // addition with var decimals await signTransaction({ transaction: additionVarTransaction, wallet: alice }); @@ -357,7 +357,7 @@ describe("test smart contract interactor", function () { assert.deepEqual(valueAfterDecrement!.valueOf(), new BigNumber(0)); }); - it("should interact with 'counter' (local testnet) using the SmartContractTransactionsFactory", async function () { + it("should interact with 'basic-features' (local testnet) and use managed Decimal", async function () { this.timeout(120000); let abiRegistry = await loadAbiRegistry("src/testdata/counter.abi.json"); diff --git a/src/smartcontracts/typesystem/types.ts b/src/smartcontracts/typesystem/types.ts index b6bb20b3..00ef65b9 100644 --- a/src/smartcontracts/typesystem/types.ts +++ b/src/smartcontracts/typesystem/types.ts @@ -10,7 +10,7 @@ export class Type { private readonly name: string; private readonly typeParameters: Type[]; - protected readonly metadata: any; + protected readonly metadata: string; private readonly cardinality: TypeCardinality; public constructor(