Skip to content

Commit

Permalink
fix: remove sdk-network-providers and use sdk-core for everything, fi…
Browse files Browse the repository at this point in the history
…x tests
  • Loading branch information
newbreedofgeek committed Nov 8, 2024
1 parent aca7fd2 commit f449a5b
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 59 deletions.
48 changes: 13 additions & 35 deletions package-lock.json

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

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
},
Expand Down
7 changes: 4 additions & 3 deletions src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -35,7 +35,8 @@ export abstract class Contract {
this.networkProvider = new ApiNetworkProvider(
networkConfig.networkProvider,
{
timeout: timeout
timeout: timeout,
clientName: 'ithuemDataNftSDK'
}
);
this.contract = new SmartContract({
Expand Down
7 changes: 4 additions & 3 deletions src/marketplace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions src/minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
34 changes: 21 additions & 13 deletions tests/environment.test.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand All @@ -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'
})
);
});
Expand All @@ -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'
})
);
});
Expand All @@ -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'
})
);
});
Expand All @@ -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'
})
);
});
Expand Down

0 comments on commit f449a5b

Please sign in to comment.