From 9a227bdc95db143d4e174d8a977ebc8564802724 Mon Sep 17 00:00:00 2001 From: Bucur David Date: Mon, 30 Oct 2023 09:28:08 +0200 Subject: [PATCH 1/4] fix: multiple collection support Refs: #62 --- src/datanft.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/datanft.ts b/src/datanft.ts index 1585879..c5d2771 100644 --- a/src/datanft.ts +++ b/src/datanft.ts @@ -203,16 +203,20 @@ export class DataNft { /** * Returns an array of `DataNft` objects owned by the address * @param address the address to query - * @param identifier the Data NFT-FT token identifier (default = `DATA-NFT-FT` token identifier based on the {@link EnvironmentsEnum}) + * @param collections the collection identifiers to query. If not provided, the default collection identifier based on the {@link EnvironmentsEnum} */ static async ownedByAddress( address: string, - identifier = dataNftTokenIdentifier[this.env as EnvironmentsEnum] + collections?: string[] ): Promise { this.ensureNetworkConfigSet(); + const identifiersMap = + collections?.join(',') || + dataNftTokenIdentifier[this.env as EnvironmentsEnum]; + const res = await fetch( - `${this.apiConfiguration}/accounts/${address}/nfts?size=10000&collections=${identifier}&withSupply=true` + `${this.apiConfiguration}/accounts/${address}/nfts?size=10000&collections=${identifiersMap}&withSupply=true` ); checkStatus(res); From 98bb4f0b1c6abb3577443ed5ac6071df81ccc32d Mon Sep 17 00:00:00 2001 From: Bucur David Date: Thu, 2 Nov 2023 08:33:47 +0200 Subject: [PATCH 2/4] chore: update contracts and tickers for devnet migration --- src/config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.ts b/src/config.ts index efe9e28..088299a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -25,26 +25,26 @@ const testnetNetworkConfig: Config = { }; export const itheumTokenIdentifier: { [key in EnvironmentsEnum]: string } = { - devnet: 'ITHEUM-a61317', + devnet: 'ITHEUM-fce905', mainnet: 'ITHEUM-df6f26', testnet: '' }; export const dataNftTokenIdentifier: { [key in EnvironmentsEnum]: string } = { - devnet: 'DATANFTFT4-3ba099', + devnet: 'DATANFTFT-e0b917', mainnet: 'DATANFTFT-e936d4', testnet: '' }; //[future] list of whitelisted tokens as Data NFTs export const marketPlaceContractAddress: { [key in EnvironmentsEnum]: string } = { - devnet: 'erd1qqqqqqqqqqqqqpgqrwtl03qdxjv2e52ta5ry4rg0z7l95neqfsxsp4y4xh', + devnet: 'erd1qqqqqqqqqqqqqpgqlhewm06p4c9qhq32p239hs45dvry948tfsxshx3e0l', mainnet: 'erd1qqqqqqqqqqqqqpgqay2r64l9nhhvmaqw4qanywfd0954w2m3c77qm7drxc', testnet: '' }; export const minterContractAddress: { [key in EnvironmentsEnum]: string } = { - devnet: 'erd1qqqqqqqqqqqqqpgqpd9qxrq5a03jrneafmlmckmlj5zgdj55fsxsqa7jsm', + devnet: 'erd1qqqqqqqqqqqqqpgq7thwlde9hvc5ty7lx2j3l9tvy3wgkwu7fsxsvz9rat', mainnet: 'erd1qqqqqqqqqqqqqpgqmuzgkurn657afd3r2aldqy2snsknwvrhc77q3lj8l6', testnet: '' }; From 3878f59e32dc99f6c7eaef779fedc3831a07a823 Mon Sep 17 00:00:00 2001 From: Bucur David Date: Thu, 2 Nov 2023 09:02:56 +0200 Subject: [PATCH 3/4] test: fix tests for migration --- tests/datanft.test.ts | 6 ------ tests/sftminter.test.ts | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/datanft.test.ts b/tests/datanft.test.ts index dd53aff..f37f037 100644 --- a/tests/datanft.test.ts +++ b/tests/datanft.test.ts @@ -53,12 +53,6 @@ describe('Data NFT test', () => { const nonceToSign = await dataNft.getMessageToSign(); expect(typeof nonceToSign).toBe('string'); - const nft = await DataNft.createFromApi({ - nonce: 62, - tokenIdentifier: 'DATANFTFT3-d0978e' - }); - - expect(nft).toBeInstanceOf(DataNft); }, 10000); test('#getOwnedByAddress', async () => { diff --git a/tests/sftminter.test.ts b/tests/sftminter.test.ts index 11ad11a..8c1f311 100644 --- a/tests/sftminter.test.ts +++ b/tests/sftminter.test.ts @@ -6,7 +6,7 @@ describe('Data Nft Minter Test', () => { const dataNftMarket = new SftMinter('devnet'); expect(dataNftMarket.getContractAddress()).toBeInstanceOf(Address); expect(dataNftMarket.getContractAddress().bech32()).toStrictEqual( - 'erd1qqqqqqqqqqqqqpgqpd9qxrq5a03jrneafmlmckmlj5zgdj55fsxsqa7jsm' + 'erd1qqqqqqqqqqqqqpgq7thwlde9hvc5ty7lx2j3l9tvy3wgkwu7fsxsvz9rat' ); }); From 9b94a53c92ba40ee59cc13900ea27b6cdc1376db Mon Sep 17 00:00:00 2001 From: Mark Paul Date: Thu, 2 Nov 2023 18:24:48 +1100 Subject: [PATCH 4/4] version bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 70f8bfd..1ec569b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@itheum/sdk-mx-data-nft", - "version": "2.1.5", + "version": "2.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@itheum/sdk-mx-data-nft", - "version": "2.1.5", + "version": "2.2.0", "license": "GPL-3.0-only", "dependencies": { "@multiversx/sdk-core": "12.11.0", diff --git a/package.json b/package.json index 37205f4..d42af6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@itheum/sdk-mx-data-nft", - "version": "2.1.5", + "version": "2.2.0", "description": "SDK for Itheum's Data NFT Technology on MultiversX Blockchain", "main": "out/index.js", "types": "out/index.d.js",