From f449a5b7ace76acf212a3abaee653e399a0d9e5d Mon Sep 17 00:00:00 2001 From: Mark Paul Date: Sat, 9 Nov 2024 10:47:04 +1100 Subject: [PATCH] fix: remove sdk-network-providers and use sdk-core for everything, fix tests --- package-lock.json | 48 +++++++++++---------------------------- package.json | 5 ++-- src/contract.ts | 7 +++--- src/marketplace.ts | 7 +++--- src/minter.ts | 4 ++-- tests/environment.test.ts | 34 ++++++++++++++++----------- 6 files changed, 46 insertions(+), 59 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6ff8e94..3da6b31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,15 @@ { "name": "@itheum/sdk-mx-data-nft", - "version": "3.7.0-alpha.7", + "version": "3.8.0-alpha.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@itheum/sdk-mx-data-nft", - "version": "3.7.0-alpha.7", + "version": "3.8.0-alpha.2", "license": "GPL-3.0-only", "dependencies": { - "@multiversx/sdk-core": "13.2.2", - "@multiversx/sdk-network-providers": "^2.8.0", + "@multiversx/sdk-core": "13.9.0", "bignumber.js": "9.1.2", "nft.storage": "7.2.0" }, @@ -1943,9 +1942,9 @@ } }, "node_modules/@multiversx/sdk-core": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-13.2.2.tgz", - "integrity": "sha512-ABQuy7PcFBnl5f9yFczgaq7tX72X0M836Ky9h4HRCQd5Mao3OJ3TrgHEvxZe9SVYXtwOm337iPsbkZzVslxu9A==", + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-13.9.0.tgz", + "integrity": "sha512-WYA5fssMt/jTRTT+dkZW6V0ykCrkczhJ3BbZni6LhHjwFti7lMboVdoUMCIyPbecWZIEdmLq0OTcjOLy9tZX0g==", "dependencies": { "@multiversx/sdk-transaction-decoder": "1.0.2", "bech32": "1.1.4", @@ -1955,32 +1954,11 @@ "keccak": "3.0.2" }, "peerDependencies": { + "axios": "^1.7.4", "bignumber.js": "^9.0.1", "protobufjs": "^7.2.6" } }, - "node_modules/@multiversx/sdk-network-providers": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-2.8.0.tgz", - "integrity": "sha512-p28NVS+uKpfPH4O0yR2LJtCNBHi1o95a3L51pCco1F4UN5seYEXYqOgP0GBxPd0WtajMXR1r5dnCrX9CFHDGcA==", - "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-network-providers/node_modules/bignumber.js": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", - "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", - "engines": { - "node": "*" - } - }, "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", @@ -7736,9 +7714,9 @@ } }, "node_modules/node-gyp-build": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz", - "integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.2.tgz", + "integrity": "sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==", "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", @@ -10858,9 +10836,9 @@ "dev": true }, "node_modules/protobufjs": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.3.2.tgz", - "integrity": "sha512-RXyHaACeqXeqAKGLDl68rQKbmObRsTIn4TYVUUug1KfS47YWCo5MacGITEryugIgZqORCvJWEk4l449POg5Txg==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", + "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", "hasInstallScript": true, "peer": true, "dependencies": { diff --git a/package.json b/package.json index f2a5737..10c064d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@itheum/sdk-mx-data-nft", - "version": "3.8.0-alpha.1", + "version": "3.8.0-alpha.2", "description": "SDK for Itheum's Data NFT Technology on MultiversX Blockchain", "main": "out/index.js", "types": "out/index.d.js", @@ -17,8 +17,7 @@ "author": "Itheum Protocol", "license": "GPL-3.0-only", "dependencies": { - "@multiversx/sdk-core": "13.2.2", - "@multiversx/sdk-network-providers": "2.8.0", + "@multiversx/sdk-core": "13.9.0", "bignumber.js": "9.1.2", "nft.storage": "7.2.0" }, diff --git a/src/contract.ts b/src/contract.ts index e7e6702..2be73f1 100644 --- a/src/contract.ts +++ b/src/contract.ts @@ -2,9 +2,9 @@ import { AbiRegistry, ErrContract, IAddress, - SmartContract + SmartContract, + ApiNetworkProvider } from '@multiversx/sdk-core/out'; -import { ApiNetworkProvider } from '@multiversx/sdk-network-providers/out'; import { EnvironmentsEnum, networkConfiguration } from './config'; import { ErrContractAddressNotSet, ErrNetworkConfig } from './errors'; @@ -35,7 +35,8 @@ export abstract class Contract { this.networkProvider = new ApiNetworkProvider( networkConfig.networkProvider, { - timeout: timeout + timeout: timeout, + clientName: 'ithuemDataNftSDK' } ); this.contract = new SmartContract({ diff --git a/src/marketplace.ts b/src/marketplace.ts index 9b108f3..fb9d627 100644 --- a/src/marketplace.ts +++ b/src/marketplace.ts @@ -14,9 +14,9 @@ import { Transaction, U64Value, U8Value, - VariadicValue + VariadicValue, + ApiNetworkProvider } from '@multiversx/sdk-core/out'; -import { ApiNetworkProvider } from '@multiversx/sdk-network-providers/out'; import dataMarketAbi from './abis/data_market.abi.json'; import { parseOffer } from './common/utils'; import { @@ -53,7 +53,8 @@ export class DataNftMarket { this.networkProvider = new ApiNetworkProvider( networkConfig.networkProvider, { - timeout: timeout + timeout: timeout, + clientName: 'ithuemDataNftSDK' } ); const contractAddress = marketPlaceContractAddress[env as EnvironmentsEnum]; diff --git a/src/minter.ts b/src/minter.ts index e167d6a..e82bb39 100644 --- a/src/minter.ts +++ b/src/minter.ts @@ -12,9 +12,9 @@ import { StringValue, TokenIdentifierValue, Transaction, - U64Value + U64Value, + ApiNetworkProvider } from '@multiversx/sdk-core/out'; -import { ApiNetworkProvider } from '@multiversx/sdk-network-providers/out'; import { EnvironmentsEnum, dataNftTokenIdentifier, diff --git a/tests/environment.test.ts b/tests/environment.test.ts index 6d89ac3..40de54b 100644 --- a/tests/environment.test.ts +++ b/tests/environment.test.ts @@ -1,4 +1,4 @@ -import { ApiNetworkProvider } from '@multiversx/sdk-network-providers/out'; +import { ApiNetworkProvider } from '@multiversx/sdk-core/out'; import { DataNftMarket, SftMinter } from '../src/index'; describe('testing environment market', () => { @@ -8,7 +8,8 @@ describe('testing environment market', () => { expect(datanft.chainID).toStrictEqual('D'); expect(datanft.networkProvider).toStrictEqual( new ApiNetworkProvider('https://devnet-api.multiversx.com', { - timeout: 20000 + timeout: 20000, + clientName: 'ithuemDataNftSDK' }) ); }); @@ -19,29 +20,32 @@ describe('testing environment market', () => { expect(datanft.chainID).toStrictEqual('1'); expect(datanft.networkProvider).toStrictEqual( new ApiNetworkProvider('https://api.multiversx.com', { - timeout: 20000 + timeout: 20000, + clientName: 'ithuemDataNftSDK' }) ); }); test('#devnet-custom-timeout', async () => { - const datanft = new DataNftMarket('devnet', 5000); + const datanft = new DataNftMarket('devnet', 20000); expect(datanft.chainID).toStrictEqual('D'); expect(datanft.networkProvider).toStrictEqual( new ApiNetworkProvider('https://devnet-api.multiversx.com', { - timeout: 5000 + timeout: 20000, + clientName: 'ithuemDataNftSDK' }) ); }); test('#mainnet-custom-timeout', async () => { - const datanft = new DataNftMarket('mainnet', 5000); + const datanft = new DataNftMarket('mainnet', 20000); expect(datanft.chainID).toStrictEqual('1'); expect(datanft.networkProvider).toStrictEqual( new ApiNetworkProvider('https://api.multiversx.com', { - timeout: 5000 + timeout: 20000, + clientName: 'ithuemDataNftSDK' }) ); }); @@ -54,7 +58,8 @@ describe('testing environment minter', () => { expect(datanft.chainID).toStrictEqual('D'); expect(datanft.networkProvider).toStrictEqual( new ApiNetworkProvider('https://devnet-api.multiversx.com', { - timeout: 20000 + timeout: 20000, + clientName: 'ithuemDataNftSDK' }) ); }); @@ -65,29 +70,32 @@ describe('testing environment minter', () => { expect(datanft.chainID).toStrictEqual('1'); expect(datanft.networkProvider).toStrictEqual( new ApiNetworkProvider('https://api.multiversx.com', { - timeout: 20000 + timeout: 20000, + clientName: 'ithuemDataNftSDK' }) ); }); test('#devnet-custom-timeout', async () => { - const datanft = new SftMinter('devnet', 5000); + const datanft = new SftMinter('devnet', 20000); expect(datanft.chainID).toStrictEqual('D'); expect(datanft.networkProvider).toStrictEqual( new ApiNetworkProvider('https://devnet-api.multiversx.com', { - timeout: 5000 + timeout: 20000, + clientName: 'ithuemDataNftSDK' }) ); }); test('#mainnet-custom-timeout', async () => { - const datanft = new SftMinter('mainnet', 5000); + const datanft = new SftMinter('mainnet', 20000); expect(datanft.chainID).toStrictEqual('1'); expect(datanft.networkProvider).toStrictEqual( new ApiNetworkProvider('https://api.multiversx.com', { - timeout: 5000 + timeout: 20000, + clientName: 'ithuemDataNftSDK' }) ); });