diff --git a/CHANGELOG.md b/CHANGELOG.md index eb10b9de..7625afb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ## Unreleased - TBD +## 10.2.5 + - [Minor refactoring](https://github.com/ElrondNetwork/elrond-sdk-erdjs/pull/214) + ## 10.2.4 - [Fix for loops](https://github.com/ElrondNetwork/elrond-sdk-erdjs/pull/212) diff --git a/package-lock.json b/package-lock.json index 6ee2e65e..5a1f72dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@elrondnetwork/erdjs", - "version": "10.2.4", + "version": "10.2.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@elrondnetwork/erdjs", - "version": "10.2.4", + "version": "10.2.5", "license": "GPL-3.0-or-later", "dependencies": { "@elrondnetwork/transaction-decoder": "0.1.0", @@ -557,9 +557,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.10", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.10.tgz", - "integrity": "sha512-Q0YbBd6OTsXm8Y21+YUSDXupHnodNC2M4O18jtd3iwJ3+vMZNdKGols0a9G6JOK0dcJ3IdUUHoh908ZI6qhk8Q==", + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz", + "integrity": "sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", @@ -1556,9 +1556,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001339", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001339.tgz", - "integrity": "sha512-Es8PiVqCe+uXdms0Gu5xP5PF2bxLR7OBp3wUzUnuO7OHzhOfCyg3hdiGWVPVxhiuniOzng+hTc1u3fEQ0TlkSQ==", + "version": "1.0.30001341", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001341.tgz", + "integrity": "sha512-2SodVrFFtvGENGCv0ChVJIDQ0KPaS1cg7/qtfMaICgeMolDdo/Z2OD32F0Aq9yl6F4YFwGPBS5AaPqNYiW4PoA==", "dev": true, "funding": [ { @@ -2491,15 +2491,13 @@ "dev": true }, "node_modules/falafel": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.4.tgz", - "integrity": "sha512-0HXjo8XASWRmsS0X1EkhwEMZaD3Qvp7FfURwjLKjG1ghfRm/MGZl2r4cWUTv41KdNghTw4OUMmVtdGQp3+H+uQ==", + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.5.tgz", + "integrity": "sha512-HuC1qF9iTnHDnML9YZAdCDQwT0yKl/U55K4XSUXqGAA2GLoafFgWRqdAbhWJxXaYD4pyoVxAJ8wH670jMpI9DQ==", "dev": true, "dependencies": { "acorn": "^7.1.1", - "foreach": "^2.0.5", - "isarray": "^2.0.1", - "object-keys": "^1.0.6" + "isarray": "^2.0.1" }, "engines": { "node": ">=0.4.0" @@ -2580,11 +2578,14 @@ } } }, - "node_modules/foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", - "dev": true + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } }, "node_modules/from2": { "version": "2.3.0", @@ -2722,15 +2723,15 @@ } }, "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, @@ -3288,15 +3289,15 @@ } }, "node_modules/is-typed-array": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", - "integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", + "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", "has-tostringtag": "^1.0.0" }, "engines": { @@ -3857,6 +3858,38 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/mocha/node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/mocha/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -5555,17 +5588,17 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz", - "integrity": "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", + "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.7" + "is-typed-array": "^1.1.9" }, "engines": { "node": ">= 0.4" @@ -6154,9 +6187,9 @@ "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.10", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.10.tgz", - "integrity": "sha512-Q0YbBd6OTsXm8Y21+YUSDXupHnodNC2M4O18jtd3iwJ3+vMZNdKGols0a9G6JOK0dcJ3IdUUHoh908ZI6qhk8Q==", + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz", + "integrity": "sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w==", "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", @@ -7027,9 +7060,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001339", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001339.tgz", - "integrity": "sha512-Es8PiVqCe+uXdms0Gu5xP5PF2bxLR7OBp3wUzUnuO7OHzhOfCyg3hdiGWVPVxhiuniOzng+hTc1u3fEQ0TlkSQ==", + "version": "1.0.30001341", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001341.tgz", + "integrity": "sha512-2SodVrFFtvGENGCv0ChVJIDQ0KPaS1cg7/qtfMaICgeMolDdo/Z2OD32F0Aq9yl6F4YFwGPBS5AaPqNYiW4PoA==", "dev": true }, "chai": { @@ -7835,15 +7868,13 @@ } }, "falafel": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.4.tgz", - "integrity": "sha512-0HXjo8XASWRmsS0X1EkhwEMZaD3Qvp7FfURwjLKjG1ghfRm/MGZl2r4cWUTv41KdNghTw4OUMmVtdGQp3+H+uQ==", + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.5.tgz", + "integrity": "sha512-HuC1qF9iTnHDnML9YZAdCDQwT0yKl/U55K4XSUXqGAA2GLoafFgWRqdAbhWJxXaYD4pyoVxAJ8wH670jMpI9DQ==", "dev": true, "requires": { "acorn": "^7.1.1", - "foreach": "^2.0.5", - "isarray": "^2.0.1", - "object-keys": "^1.0.6" + "isarray": "^2.0.1" }, "dependencies": { "isarray": { @@ -7897,11 +7928,14 @@ "integrity": "sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==", "dev": true }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", - "dev": true + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } }, "from2": { "version": "2.3.0", @@ -8005,15 +8039,15 @@ } }, "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } @@ -8405,15 +8439,15 @@ } }, "is-typed-array": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", - "integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", + "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", "dev": true, "requires": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", "has-tostringtag": "^1.0.0" } }, @@ -8851,6 +8885,31 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -10226,17 +10285,17 @@ } }, "which-typed-array": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz", - "integrity": "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", + "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", "dev": true, "requires": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", - "es-abstract": "^1.18.5", - "foreach": "^2.0.5", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.7" + "is-typed-array": "^1.1.9" } }, "word-wrap": { diff --git a/package.json b/package.json index d5200f45..ac733820 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@elrondnetwork/erdjs", - "version": "10.2.4", + "version": "10.2.5", "description": "Smart Contracts interaction framework", "main": "out/index.js", "types": "out/index.d.js", diff --git a/src/transactionWatcher.ts b/src/transactionWatcher.ts index ddf7d8c1..40917b57 100644 --- a/src/transactionWatcher.ts +++ b/src/transactionWatcher.ts @@ -22,9 +22,9 @@ export class TransactionWatcher { static NoopOnStatusReceived = (_: ITransactionStatus) => { }; - private readonly fetcher: ITransactionFetcher; - private readonly pollingInterval: number; - private readonly timeout: number; + protected readonly fetcher: ITransactionFetcher; + protected readonly pollingInterval: number; + protected readonly timeout: number; /** * @@ -46,9 +46,9 @@ export class TransactionWatcher { * Waits until the transaction reaches the "pending" status. */ public async awaitPending(transaction: ITransaction): Promise { - let isPending = (transaction: ITransactionOnNetwork) => transaction.status.isPending(); - let doFetch = async () => await this.fetcher.getTransaction(transaction.getHash().hex()); - let errorProvider = () => new ErrExpectedTransactionStatusNotReached(); + const isPending = (transaction: ITransactionOnNetwork) => transaction.status.isPending(); + const doFetch = async () => await this.fetcher.getTransaction(transaction.getHash().hex()); + const errorProvider = () => new ErrExpectedTransactionStatusNotReached(); return this.awaitConditionally( isPending, @@ -61,9 +61,9 @@ export class TransactionWatcher { * Waits until the transaction is completely processed. */ public async awaitCompleted(transaction: ITransaction): Promise { - let isCompleted = (transactionOnNetwork: ITransactionOnNetwork) => transactionOnNetwork.isCompleted; - let doFetch = async () => await this.fetcher.getTransaction(transaction.getHash().hex()); - let errorProvider = () => new ErrExpectedTransactionStatusNotReached(); + const isCompleted = (transactionOnNetwork: ITransactionOnNetwork) => transactionOnNetwork.isCompleted; + const doFetch = async () => await this.fetcher.getTransaction(transaction.getHash().hex()); + const errorProvider = () => new ErrExpectedTransactionStatusNotReached(); return this.awaitConditionally( isCompleted, @@ -73,14 +73,14 @@ export class TransactionWatcher { } public async awaitAllEvents(transaction: ITransaction, events: string[]): Promise { - let foundAllEvents = (transactionOnNetwork: ITransactionOnNetwork) => { - let allEventIdentifiers = this.getAllTransactionEvents(transactionOnNetwork).map(event => event.identifier); - let allAreFound = events.every(event => allEventIdentifiers.includes(event)); + const foundAllEvents = (transactionOnNetwork: ITransactionOnNetwork) => { + const allEventIdentifiers = this.getAllTransactionEvents(transactionOnNetwork).map(event => event.identifier); + const allAreFound = events.every(event => allEventIdentifiers.includes(event)); return allAreFound; }; - let doFetch = async () => await this.fetcher.getTransaction(transaction.getHash().hex()); - let errorProvider = () => new ErrExpectedTransactionEventsNotFound(); + const doFetch = async () => await this.fetcher.getTransaction(transaction.getHash().hex()); + const errorProvider = () => new ErrExpectedTransactionEventsNotFound(); return this.awaitConditionally( foundAllEvents, @@ -90,14 +90,14 @@ export class TransactionWatcher { } public async awaitAnyEvent(transaction: ITransaction, events: string[]): Promise { - let foundAnyEvent = (transactionOnNetwork: ITransactionOnNetwork) => { - let allEventIdentifiers = this.getAllTransactionEvents(transactionOnNetwork).map(event => event.identifier); - let anyIsFound = events.find(event => allEventIdentifiers.includes(event)) != undefined; + const foundAnyEvent = (transactionOnNetwork: ITransactionOnNetwork) => { + const allEventIdentifiers = this.getAllTransactionEvents(transactionOnNetwork).map(event => event.identifier); + const anyIsFound = events.find(event => allEventIdentifiers.includes(event)) != undefined; return anyIsFound; }; - let doFetch = async () => await this.fetcher.getTransaction(transaction.getHash().hex()); - let errorProvider = () => new ErrExpectedTransactionEventsNotFound(); + const doFetch = async () => await this.fetcher.getTransaction(transaction.getHash().hex()); + const errorProvider = () => new ErrExpectedTransactionEventsNotFound(); return this.awaitConditionally( foundAnyEvent, @@ -107,8 +107,8 @@ export class TransactionWatcher { } public async awaitOnCondition(transaction: ITransaction, condition: (data: ITransactionOnNetwork) => boolean): Promise { - let doFetch = async () => await this.fetcher.getTransaction(transaction.getHash().hex()); - let errorProvider = () => new ErrExpectedTransactionStatusNotReached(); + const doFetch = async () => await this.fetcher.getTransaction(transaction.getHash().hex()); + const errorProvider = () => new ErrExpectedTransactionStatusNotReached(); return this.awaitConditionally( condition, @@ -117,19 +117,19 @@ export class TransactionWatcher { ); } - private async awaitConditionally( + protected async awaitConditionally( isSatisfied: (data: TData) => boolean, doFetch: () => Promise, createError: () => Err ): Promise { - let periodicTimer = new AsyncTimer("watcher:periodic"); - let timeoutTimer = new AsyncTimer("watcher:timeout"); + const periodicTimer = new AsyncTimer("watcher:periodic"); + const timeoutTimer = new AsyncTimer("watcher:timeout"); let stop = false; let fetchedData: TData | undefined = undefined; let satisfied: boolean = false; - let _ = timeoutTimer.start(this.timeout).finally(() => { + timeoutTimer.start(this.timeout).finally(() => { timeoutTimer.stop(); stop = true; }); @@ -157,15 +157,14 @@ export class TransactionWatcher { } if (!fetchedData || !satisfied) { - let error = createError(); - throw error; + throw createError(); } return fetchedData; } - private getAllTransactionEvents(transaction: ITransactionOnNetwork): ITransactionEvent[] { - let result = [...transaction.logs.events]; + protected getAllTransactionEvents(transaction: ITransactionOnNetwork): ITransactionEvent[] { + const result = [...transaction.logs.events]; for (const resultItem of transaction.contractResults.items) { result.push(...resultItem.logs.events);