From c67a5b7322c12ce5fb35e2be34b99532aee197ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Fri, 8 Apr 2022 16:23:53 +0300 Subject: [PATCH] Reference new network-providers in tests. Also adjust interface of TransactionOnNetwork. --- package-lock.json | 14 +++++++------- package.json | 2 +- src/interfaceOfNetwork.ts | 4 ++-- src/testutils/mockProvider.ts | 4 ++-- src/transactionWatcher.ts | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 306221ed..d9eefe41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "protobufjs": "6.10.2" }, "devDependencies": { - "@elrondnetwork/erdjs-network-providers": "0.1.1", + "@elrondnetwork/erdjs-network-providers": "0.1.2", "@elrondnetwork/erdjs-walletcore": "1.0.0", "@types/assert": "1.4.6", "@types/chai": "4.2.11", @@ -425,9 +425,9 @@ } }, "node_modules/@elrondnetwork/erdjs-network-providers": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@elrondnetwork/erdjs-network-providers/-/erdjs-network-providers-0.1.1.tgz", - "integrity": "sha512-qV0FuE++/QiIqqBvALCnu+p0sJVzhwQwqNkWSoAjBNs84+ErVOA8aAFYhHeW8xKovbJ0Wj+/yPm2/cpLs/odow==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@elrondnetwork/erdjs-network-providers/-/erdjs-network-providers-0.1.2.tgz", + "integrity": "sha512-6xlyoWHP2kLqsJr9hV5LgqDIrRo8YcF9xCUad/fP0cEyaJej6naeEC/TysGghWyfgpqQ4uUtkpSYFOlCJyL3zQ==", "dev": true, "dependencies": { "axios": "0.24.0", @@ -5974,9 +5974,9 @@ } }, "@elrondnetwork/erdjs-network-providers": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@elrondnetwork/erdjs-network-providers/-/erdjs-network-providers-0.1.1.tgz", - "integrity": "sha512-qV0FuE++/QiIqqBvALCnu+p0sJVzhwQwqNkWSoAjBNs84+ErVOA8aAFYhHeW8xKovbJ0Wj+/yPm2/cpLs/odow==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@elrondnetwork/erdjs-network-providers/-/erdjs-network-providers-0.1.2.tgz", + "integrity": "sha512-6xlyoWHP2kLqsJr9hV5LgqDIrRo8YcF9xCUad/fP0cEyaJej6naeEC/TysGghWyfgpqQ4uUtkpSYFOlCJyL3zQ==", "dev": true, "requires": { "axios": "0.24.0", diff --git a/package.json b/package.json index 3e3d839b..774059e9 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "protobufjs": "6.10.2" }, "devDependencies": { - "@elrondnetwork/erdjs-network-providers": "0.1.1", + "@elrondnetwork/erdjs-network-providers": "0.1.2", "@elrondnetwork/erdjs-walletcore": "1.0.0", "@types/assert": "1.4.6", "@types/chai": "4.2.11", diff --git a/src/interfaceOfNetwork.ts b/src/interfaceOfNetwork.ts index 495878d1..a4f4d443 100644 --- a/src/interfaceOfNetwork.ts +++ b/src/interfaceOfNetwork.ts @@ -13,6 +13,8 @@ export interface INetworkConfig { } export interface ITransactionOnNetwork { + isCompleted: boolean; + hash: IHash; type: string; value: ITransactionValue; @@ -23,8 +25,6 @@ export interface ITransactionOnNetwork { receipt: ITransactionReceipt; contractResults: IContractResults; logs: ITransactionLogs; - - isCompleted(): boolean; } export interface ITransactionStatus { diff --git a/src/testutils/mockProvider.ts b/src/testutils/mockProvider.ts index 9537cca4..4a3d00c2 100644 --- a/src/testutils/mockProvider.ts +++ b/src/testutils/mockProvider.ts @@ -71,7 +71,7 @@ export class MockProvider { let response = new TransactionOnNetwork({ status: new TransactionStatus("executed"), contractResults: new ContractResults([contractResult]), - isCompleted: () => true + isCompleted: true }); this.getTransactionResponders.unshift(new GetTransactionResponder(predicate, response)); @@ -105,7 +105,7 @@ export class MockProvider { }); } else if (point instanceof MarkCompleted) { this.mockUpdateTransaction(hash, (transaction) => { - transaction.isCompleted = () => true; + transaction.isCompleted = true; }); } else if (point instanceof Wait) { await timeline.start(point.milliseconds); diff --git a/src/transactionWatcher.ts b/src/transactionWatcher.ts index 56506d2d..7f2e97e3 100644 --- a/src/transactionWatcher.ts +++ b/src/transactionWatcher.ts @@ -62,7 +62,7 @@ export class TransactionWatcher { * Waits until the transaction is completely processed. */ public async awaitCompleted(transaction: ITransaction): Promise { - let isCompleted = (transactionOnNetwork: ITransactionOnNetwork) => transactionOnNetwork.isCompleted(); + let isCompleted = (transactionOnNetwork: ITransactionOnNetwork) => transactionOnNetwork.isCompleted; let doFetch = async () => await this.fetcher.getTransaction(transaction.getHash(), undefined, true); let errorProvider = () => new ErrExpectedTransactionStatusNotReached();