@@ -46,7 +46,6 @@ describe('PersonalWallet.assets/nft', () => {
4646 let policyId : Cardano . PolicyId ;
4747 let policyScript : Cardano . NativeScript ;
4848 let assetIds : Cardano . AssetId [ ] ;
49- let fingerprints : Cardano . AssetFingerprint [ ] ;
5049 const assetNames = [ '4e46542d66696c6573' , '4e46542d303031' , '4e46542d303032' ] ;
5150 let walletAddress : Cardano . PaymentAddress ;
5251 const coins = 10_000_000n ; // number of coins to use in each transaction
@@ -101,12 +100,6 @@ describe('PersonalWallet.assets/nft', () => {
101100 [ assetIds [ TOKEN_BURN_INDEX ] , 1n ]
102101 ] ) ;
103102
104- fingerprints = [
105- Cardano . AssetFingerprint . fromParts ( policyId , Cardano . AssetName ( assetNames [ TOKEN_METADATA_1_INDEX ] ) ) ,
106- Cardano . AssetFingerprint . fromParts ( policyId , Cardano . AssetName ( assetNames [ TOKEN_METADATA_2_INDEX ] ) ) ,
107- Cardano . AssetFingerprint . fromParts ( policyId , Cardano . AssetName ( assetNames [ TOKEN_BURN_INDEX ] ) )
108- ] ;
109-
110103 walletAddress = ( await firstValueFrom ( wallet . addresses$ ) ) [ 0 ] . address ;
111104
112105 const txMetadatum = metadatum . jsonToMetadatum ( {
@@ -199,23 +192,13 @@ describe('PersonalWallet.assets/nft', () => {
199192 // Check balance here because asset info will not be re-fetched when balance changes due to minting and burning
200193 expect ( walletAssetBalance ?. get ( assetIds [ TOKEN_METADATA_2_INDEX ] ) ) . toBe ( 1n ) ;
201194
202- expect ( nfts . find ( ( nft ) => nft . assetId === assetIds [ TOKEN_METADATA_2_INDEX ] ) ) . toMatchObject ( {
203- assetId : assetIds [ TOKEN_METADATA_2_INDEX ] ,
204- fingerprint : fingerprints [ TOKEN_METADATA_2_INDEX ] ,
205- name : assetNames [ TOKEN_METADATA_2_INDEX ] ,
206- nftMetadata : {
207- image : 'ipfs://some_hash1' ,
208- name : 'One' ,
209- otherProperties : new Map ( [ [ 'version' , '1.0' ] ] ) ,
210- version : '1.0'
211- } ,
212- policyId,
213- // in case of repeated tests on the same network, total asset supply is not updated due to
214- // the limitation that asset info is not refreshed on wallet balance changes
215- quantity : expect . anything ( ) ,
216- supply : expect . anything ( ) ,
217- tokenMetadata : null
195+ const secondTokenMetadata = nfts . find ( ( nft ) => nft . assetId === assetIds [ TOKEN_METADATA_2_INDEX ] ) ?. nftMetadata ;
196+ expect ( secondTokenMetadata ) . toMatchObject ( {
197+ image : 'ipfs://some_hash1' ,
198+ name : 'One' ,
199+ version : '1.0'
218200 } ) ;
201+
219202 expect ( nfts . find ( ( nft ) => nft . assetId === assetIds [ TOKEN_METADATA_1_INDEX ] ) ) . toBeDefined ( ) ;
220203 } ) ;
221204
@@ -225,37 +208,20 @@ describe('PersonalWallet.assets/nft', () => {
225208 // Check balance here because asset info will not be re-fetched when balance changes due to minting and burning
226209 expect ( walletAssetBalance ?. get ( assetIds [ TOKEN_METADATA_1_INDEX ] ) ) . toBe ( 1n ) ;
227210
228- expect ( nfts . find ( ( nft ) => nft . assetId === assetIds [ TOKEN_METADATA_1_INDEX ] ) ) . toMatchObject ( {
229- assetId : assetIds [ TOKEN_METADATA_1_INDEX ] ,
230- fingerprint : fingerprints [ TOKEN_METADATA_1_INDEX ] ,
231- name : assetNames [ TOKEN_METADATA_1_INDEX ] ,
232- nftMetadata : {
233- description : 'NFT with different types of files' ,
234- files : [
235- {
236- mediaType : 'video/mp4' ,
237- name : 'some name' ,
238- src : 'ipfs://Qmb78QQ4RXxKQrteRn4X3WaMXXfmi2BU2dLjfWxuJoF2N5'
239- } ,
240- {
241- mediaType : 'audio/mpeg' ,
242- name : 'some name' ,
243- src : 'ipfs://Qmb78QQ4RXxKQrteRn4X3WaMXXfmi2BU2dLjfWxuJoF2Ny'
244- }
245- ] ,
246- image : 'ipfs://somehash' ,
247- mediaType : 'image/png' ,
248- name : 'NFT with files' ,
249- otherProperties : new Map ( [
250- [ 'id' , '1' ] ,
251- [ 'version' , '1.0' ]
252- ] ) ,
253- version : '1.0'
254- } as Asset . NftMetadata ,
255- policyId,
256- supply : expect . anything ( ) ,
257- tokenMetadata : null
258- } ) ;
211+ const nftMetadata = nfts . find ( ( nft ) => nft . assetId === assetIds [ TOKEN_METADATA_1_INDEX ] ) ?. nftMetadata ;
212+ expect ( nftMetadata ?. otherProperties ?. get ( 'id' ) ) . toBe ( '1' ) ;
213+ expect ( nftMetadata ?. files ) . toEqual ( [
214+ expect . objectContaining ( {
215+ mediaType : 'video/mp4' ,
216+ name : 'some name' ,
217+ src : 'ipfs://Qmb78QQ4RXxKQrteRn4X3WaMXXfmi2BU2dLjfWxuJoF2N5'
218+ } ) ,
219+ expect . objectContaining ( {
220+ mediaType : 'audio/mpeg' ,
221+ name : 'some name' ,
222+ src : 'ipfs://Qmb78QQ4RXxKQrteRn4X3WaMXXfmi2BU2dLjfWxuJoF2Ny'
223+ } )
224+ ] ) ;
259225 } ) ;
260226
261227 it ( 'supports burning tokens' , async ( ) => {
@@ -313,7 +279,6 @@ describe('PersonalWallet.assets/nft', () => {
313279
314280 const assetNameHex = Buffer . from ( assetName ) . toString ( 'hex' ) ;
315281 const assetId = Cardano . AssetId ( `${ policyId } ${ assetNameHex } ` ) ;
316- const fingerprint = Cardano . AssetFingerprint . fromParts ( policyId , Cardano . AssetName ( assetNameHex ) ) ;
317282 const tokens = new Map ( [ [ assetId , 1n ] ] ) ;
318283
319284 const txDataMetadatum = new Map ( [
@@ -325,7 +290,7 @@ describe('PersonalWallet.assets/nft', () => {
325290 metadatum . jsonToMetadatum ( {
326291 image : [ 'ipfs://some_hash1' ] ,
327292 name : assetName ,
328- version : '1.0'
293+ version
329294 } )
330295 ]
331296 ] )
@@ -369,26 +334,18 @@ describe('PersonalWallet.assets/nft', () => {
369334
370335 // try remove the asset.nftMetadata filter
371336 const [ , nfts ] = await firstValueFromTimed ( walletBalanceAssetsAndNfts ( wallet ) ) ;
337+ const nftMetadata = nfts . find ( ( nft ) => nft . assetId === assetId ) ?. nftMetadata ;
372338
373- expect ( nfts . find ( ( nft ) => nft . assetId === assetId ) ) . toMatchObject ( {
374- assetId,
375- fingerprint,
376- name : assetNameHex ,
377- nftMetadata : {
378- image : 'ipfs://some_hash1' ,
379- name : assetName ,
380- otherProperties : new Map ( [ [ 'version' , '1.0' ] ] ) ,
381- version : '1.0'
382- } ,
383- policyId,
384- quantity : expect . anything ( ) ,
385- supply : expect . anything ( ) ,
386- tokenMetadata : null
387- } ) ;
339+ expect ( nftMetadata ?. image ) . toBe ( 'ipfs://some_hash1' ) ;
340+ expect ( nftMetadata ?. name ) . toBe ( assetName ) ;
388341 } ) ;
389342
390343 CIP0025Test ( 'supports CIP-25 v1, assetName hex encoded' , 'CIP-0025-v1-hex' , 1 , 'hex' ) ;
391344 CIP0025Test ( 'supports CIP-25 v1, assetName utf8 encoded' , 'CIP-0025-v1-utf8' , 1 , 'utf8' ) ;
392- CIP0025Test ( 'supports CIP-25 v2' , 'CIP-0025-v2' , 2 ) ;
345+
346+ // https://input-output-rnd.slack.com/archives/C06J663L2A2/p1731505470694659
347+ env . TEST_CLIENT_ASSET_PROVIDER !== 'blockfrost'
348+ ? CIP0025Test ( 'supports CIP-25 v2' , 'CIP-0025-v2' , 2 )
349+ : test . todo ( '"supports CIP-25 v2" test is disabled when running with Blockfrost asset provider' ) ;
393350 } ) ;
394351} ) ;
0 commit comments