Skip to content

Commit

Permalink
Merge pull request #189 from ElrondNetwork/ref-network-providers
Browse files Browse the repository at this point in the history
Reference new network-providers in tests. Also adjust interface of TransactionOnNetwork
  • Loading branch information
andreibancioiu authored Apr 8, 2022
2 parents b373c59 + b9d13bf commit f8b2eda
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/interfaceOfNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export interface INetworkConfig {
}

export interface ITransactionOnNetwork {
isCompleted: boolean;

hash: IHash;
type: string;
value: ITransactionValue;
Expand All @@ -23,8 +25,6 @@ export interface ITransactionOnNetwork {
receipt: ITransactionReceipt;
contractResults: IContractResults;
logs: ITransactionLogs;

isCompleted(): boolean;
}

export interface ITransactionStatus {
Expand Down
4 changes: 2 additions & 2 deletions src/testutils/mockProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/transactionWatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class TransactionWatcher {
* Waits until the transaction is completely processed.
*/
public async awaitCompleted(transaction: ITransaction): Promise<ITransactionOnNetwork> {
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();

Expand Down

0 comments on commit f8b2eda

Please sign in to comment.