From cc5bce99cf50f55c856b23ddfceac3f3fc57b25d Mon Sep 17 00:00:00 2001 From: danielailie Date: Mon, 30 Sep 2024 15:56:51 +0300 Subject: [PATCH] Remove network providers package and update dependencies --- package-lock.json | 28 ------------------- package.json | 1 - src/converters/transactionsConverters.spec.ts | 6 ++-- src/index.ts | 1 + src/networkProviders/index.ts | 9 ++++-- src/smartContractQueriesController.spec.ts | 2 +- src/smartcontracts/interaction.spec.ts | 2 +- src/smartcontracts/resultsParser.spec.ts | 18 ++++++------ src/smartcontracts/smartContract.spec.ts | 2 +- src/testutils/mockNetworkProvider.ts | 7 +---- src/testutils/networkProviders.ts | 2 +- src/transactionWatcher.spec.ts | 2 +- ...tContractTransactionsOutcomeParser.spec.ts | 14 +++++----- .../transactionEventsParser.spec.ts | 6 ++-- 14 files changed, 35 insertions(+), 65 deletions(-) diff --git a/package-lock.json b/package-lock.json index d041cb8f1..355a26d58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,6 @@ "keccak": "3.0.2" }, "devDependencies": { - "@multiversx/sdk-network-providers": "2.6.0", "@multiversx/sdk-wallet": "4.5.1", "@types/assert": "1.4.6", "@types/chai": "4.2.11", @@ -161,21 +160,6 @@ "node": ">=8.9.0" } }, - "node_modules/@multiversx/sdk-network-providers": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-2.6.0.tgz", - "integrity": "sha512-fAj7Py3otll00iFunwcDwp7/i7NiHInLN4EhdEFVfKNY5Z+roGI6YwPy3i60l8JApGE6DzmBQ22nVFYv8NzrPA==", - "dev": true, - "dependencies": { - "bech32": "1.1.4", - "bignumber.js": "9.0.1", - "buffer": "6.0.3", - "json-bigint": "1.0.0" - }, - "peerDependencies": { - "axios": "^1.7.4" - } - }, "node_modules/@multiversx/sdk-transaction-decoder": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@multiversx/sdk-transaction-decoder/-/sdk-transaction-decoder-1.0.2.tgz", @@ -5317,18 +5301,6 @@ "integrity": "sha512-c0tIdQUnbBLSt6NYU+OpeGPYdL0+GV547HeHT8Xc0BKQ7Cj0v82QUoA2QRtWrR1G4MNZmLsIacZSsf6DrIS2Bw==", "dev": true }, - "@multiversx/sdk-network-providers": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-2.6.0.tgz", - "integrity": "sha512-fAj7Py3otll00iFunwcDwp7/i7NiHInLN4EhdEFVfKNY5Z+roGI6YwPy3i60l8JApGE6DzmBQ22nVFYv8NzrPA==", - "dev": true, - "requires": { - "bech32": "1.1.4", - "bignumber.js": "9.0.1", - "buffer": "6.0.3", - "json-bigint": "1.0.0" - } - }, "@multiversx/sdk-transaction-decoder": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@multiversx/sdk-transaction-decoder/-/sdk-transaction-decoder-1.0.2.tgz", diff --git a/package.json b/package.json index 0df0f4d38..6fa7815bf 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "keccak": "3.0.2" }, "devDependencies": { - "@multiversx/sdk-network-providers": "2.6.0", "@multiversx/sdk-wallet": "4.5.1", "@types/assert": "1.4.6", "@types/chai": "4.2.11", diff --git a/src/converters/transactionsConverters.spec.ts b/src/converters/transactionsConverters.spec.ts index a61dd3bc8..12d26271b 100644 --- a/src/converters/transactionsConverters.spec.ts +++ b/src/converters/transactionsConverters.spec.ts @@ -2,11 +2,11 @@ import { ContractResultItem, ContractResults, TransactionEventData, - TransactionEvent as TransactionEventOnNetwork, + TransactionEventOnNetwork, TransactionEventTopic, - TransactionLogs as TransactionLogsOnNetwork, + TransactionLogsOnNetwork, TransactionOnNetwork, -} from "@multiversx/sdk-network-providers"; +} from "../networkProviders"; import { assert } from "chai"; import { Address } from "../address"; import { Transaction } from "../transaction"; diff --git a/src/index.ts b/src/index.ts index d244d0e0f..8ef8255b3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,3 +33,4 @@ export * from "./transactionWatcher"; export * from "./transactionsFactories"; export * from "./transactionsOutcomeParsers"; export * from "./utils"; +export * from "./networkProviders"; diff --git a/src/networkProviders/index.ts b/src/networkProviders/index.ts index 804b15b66..16c7fccaa 100644 --- a/src/networkProviders/index.ts +++ b/src/networkProviders/index.ts @@ -4,8 +4,12 @@ export { ProxyNetworkProvider } from "./proxyNetworkProvider"; export { AccountOnNetwork } from "./accounts"; export { ContractQueryResponse } from "./contractQueryResponse"; export { ContractResultItem, ContractResults } from "./contractResults"; -export { TransactionEvent, TransactionEventData, TransactionEventTopic } from "./transactionEvents"; -export { TransactionLogs } from "./transactionLogs"; +export { + TransactionEvent as TransactionEventOnNetwork, + TransactionEventData, + TransactionEventTopic, +} from "./transactionEvents"; +export { TransactionLogs as TransactionLogsOnNetwork } from "./transactionLogs"; export { TransactionReceipt } from "./transactionReceipt"; export { TransactionStatus } from "./transactionStatus"; export { TransactionOnNetwork } from "./transactions"; @@ -17,4 +21,3 @@ export { NetworkConfig } from "./networkConfig"; export { NetworkGeneralStatistics } from "./networkGeneralStatistics"; export { NetworkStake } from "./networkStake"; export { NetworkStatus } from "./networkStatus"; - diff --git a/src/smartContractQueriesController.spec.ts b/src/smartContractQueriesController.spec.ts index c65309833..07bc570d8 100644 --- a/src/smartContractQueriesController.spec.ts +++ b/src/smartContractQueriesController.spec.ts @@ -1,4 +1,4 @@ -import { ContractQueryResponse } from "@multiversx/sdk-network-providers"; +import { ContractQueryResponse } from "./networkProviders"; import BigNumber from "bignumber.js"; import { assert } from "chai"; import { QueryRunnerAdapter } from "./adapters/queryRunnerAdapter"; diff --git a/src/smartcontracts/interaction.spec.ts b/src/smartcontracts/interaction.spec.ts index 4777691cd..e88789a90 100644 --- a/src/smartcontracts/interaction.spec.ts +++ b/src/smartcontracts/interaction.spec.ts @@ -1,4 +1,4 @@ -import { ContractQueryResponse } from "@multiversx/sdk-network-providers"; +import { ContractQueryResponse } from "../networkProviders"; import BigNumber from "bignumber.js"; import { assert } from "chai"; import { Address } from "../address"; diff --git a/src/smartcontracts/resultsParser.spec.ts b/src/smartcontracts/resultsParser.spec.ts index 30757b908..c08bc885b 100644 --- a/src/smartcontracts/resultsParser.spec.ts +++ b/src/smartcontracts/resultsParser.spec.ts @@ -2,12 +2,12 @@ import { ContractQueryResponse, ContractResultItem, ContractResults, - TransactionEvent, + TransactionEventOnNetwork, TransactionEventTopic, - TransactionLogs, + TransactionLogsOnNetwork, TransactionOnNetwork, -} from "@multiversx/sdk-network-providers"; -import { TransactionEventData } from "@multiversx/sdk-network-providers/out/transactionEvents"; + TransactionEventData, +} from "../networkProviders"; import BigNumber from "bignumber.js"; import { assert } from "chai"; import * as fs from "fs"; @@ -220,10 +220,10 @@ describe("test smart contract results parser", () => { it("should parse contract outcome, on signal error", async () => { let transaction = new TransactionOnNetwork({ - logs: new TransactionLogs({ + logs: new TransactionLogsOnNetwork({ address: Address.empty(), events: [ - new TransactionEvent({ + new TransactionEventOnNetwork({ identifier: "signalError", topics: [new TransactionEventTopic(Buffer.from("something happened").toString("base64"))], data: `@${Buffer.from("user error").toString("hex")}@07`, @@ -240,10 +240,10 @@ describe("test smart contract results parser", () => { it("should parse contract outcome, on too much gas warning", async () => { let transaction = new TransactionOnNetwork({ - logs: new TransactionLogs({ + logs: new TransactionLogsOnNetwork({ address: Address.empty(), events: [ - new TransactionEvent({ + new TransactionEventOnNetwork({ identifier: "writeLog", topics: [ new TransactionEventTopic( @@ -269,7 +269,7 @@ describe("test smart contract results parser", () => { const abiRegistry = await loadAbiRegistry("src/testdata/esdt-safe.abi.json"); const eventDefinition = abiRegistry.getEvent("deposit"); - const event = new TransactionEvent({ + const event = new TransactionEventOnNetwork({ topics: [ new TransactionEventTopic("ZGVwb3NpdA=="), new TransactionEventTopic("cmzC1LRt1r10pMhNAnFb+FyudjGMq4G8CefCYdQUmmc="), diff --git a/src/smartcontracts/smartContract.spec.ts b/src/smartcontracts/smartContract.spec.ts index 7fc958b29..bf5e2a132 100644 --- a/src/smartcontracts/smartContract.spec.ts +++ b/src/smartcontracts/smartContract.spec.ts @@ -1,4 +1,4 @@ -import { TransactionStatus } from "@multiversx/sdk-network-providers"; +import { TransactionStatus } from "../networkProviders"; import { assert } from "chai"; import { Address } from "../address"; import { diff --git a/src/testutils/mockNetworkProvider.ts b/src/testutils/mockNetworkProvider.ts index a8e0a1817..988d693f5 100644 --- a/src/testutils/mockNetworkProvider.ts +++ b/src/testutils/mockNetworkProvider.ts @@ -1,9 +1,4 @@ -import { - ContractResultItem, - ContractResults, - TransactionOnNetwork, - TransactionStatus, -} from "@multiversx/sdk-network-providers"; +import { ContractResultItem, ContractResults, TransactionOnNetwork, TransactionStatus } from "../networkProviders"; import { Address } from "../address"; import { AsyncTimer } from "../asyncTimer"; import * as errors from "../errors"; diff --git a/src/testutils/networkProviders.ts b/src/testutils/networkProviders.ts index 736a9bedb..3b27e3eda 100644 --- a/src/testutils/networkProviders.ts +++ b/src/testutils/networkProviders.ts @@ -1,4 +1,4 @@ -import { ApiNetworkProvider, ProxyNetworkProvider } from "@multiversx/sdk-network-providers"; +import { ApiNetworkProvider, ProxyNetworkProvider } from "../networkProviders"; import { IAddress } from "../interface"; import { IAccountOnNetwork, diff --git a/src/transactionWatcher.spec.ts b/src/transactionWatcher.spec.ts index fbcfae2ec..dd223af6d 100644 --- a/src/transactionWatcher.spec.ts +++ b/src/transactionWatcher.spec.ts @@ -1,4 +1,4 @@ -import { TransactionOnNetwork, TransactionStatus } from "@multiversx/sdk-network-providers"; +import { TransactionOnNetwork, TransactionStatus } from "./networkProviders"; import { assert } from "chai"; import { MarkCompleted, MockNetworkProvider, Wait } from "./testutils"; import { TransactionHash } from "./transaction"; diff --git a/src/transactionsOutcomeParsers/smartContractTransactionsOutcomeParser.spec.ts b/src/transactionsOutcomeParsers/smartContractTransactionsOutcomeParser.spec.ts index 5bbcbdd52..e005f1b39 100644 --- a/src/transactionsOutcomeParsers/smartContractTransactionsOutcomeParser.spec.ts +++ b/src/transactionsOutcomeParsers/smartContractTransactionsOutcomeParser.spec.ts @@ -3,9 +3,9 @@ import { ContractResults, TransactionEventTopic, TransactionOnNetwork, - TransactionEvent as TransactionOnNetworkEvent, - TransactionLogs as TransactionOnNetworkLogs, -} from "@multiversx/sdk-network-providers"; + TransactionEventOnNetwork, + TransactionLogsOnNetwork, +} from "../networkProviders"; import BigNumber from "bignumber.js"; import { assert } from "chai"; import { Address } from "../address"; @@ -60,9 +60,9 @@ describe("test smart contract transactions outcome parser", () => { const transactionOnNetwork = new TransactionOnNetwork({ nonce: 7, - logs: new TransactionOnNetworkLogs({ + logs: new TransactionLogsOnNetwork({ events: [ - new TransactionOnNetworkEvent({ + new TransactionEventOnNetwork({ identifier: "SCDeploy", topics: [ new TransactionEventTopic(contract.getPublicKey().toString("base64")), @@ -102,9 +102,9 @@ describe("test smart contract transactions outcome parser", () => { const transactionOnNetwork = new TransactionOnNetwork({ nonce: 7, - logs: new TransactionOnNetworkLogs({ + logs: new TransactionLogsOnNetwork({ events: [ - new TransactionOnNetworkEvent({ + new TransactionEventOnNetwork({ identifier: "signalError", topics: [ new TransactionEventTopic(deployer.getPublicKey().toString("base64")), diff --git a/src/transactionsOutcomeParsers/transactionEventsParser.spec.ts b/src/transactionsOutcomeParsers/transactionEventsParser.spec.ts index 9ed01c91c..cddc8ea3d 100644 --- a/src/transactionsOutcomeParsers/transactionEventsParser.spec.ts +++ b/src/transactionsOutcomeParsers/transactionEventsParser.spec.ts @@ -2,11 +2,11 @@ import { ContractResultItem, ContractResults, TransactionEventData, - TransactionEvent as TransactionEventOnNetwork, + TransactionEventOnNetwork, TransactionEventTopic, - TransactionLogs as TransactionLogsOnNetwork, + TransactionLogsOnNetwork, TransactionOnNetwork, -} from "@multiversx/sdk-network-providers"; +} from "../networkProviders"; import BigNumber from "bignumber.js"; import { assert } from "chai"; import { Address } from "../address";