1
1
import { Buffer } from 'buffer' ;
2
2
import Joi from 'joi' ;
3
3
import { SystemWithToolkit , SystemWithWallet } from '../system' ;
4
- import { hash as nftAssetHash } from './code/fa2_tzip16_compat_multi_nft_asset' ;
5
4
import select from '../util/selectObjectByKeys' ;
6
5
import { ipfsUriToCid } from '../util/ipfs' ;
7
6
@@ -136,7 +135,7 @@ export async function getNftAssetContract(
136
135
137
136
const metaBigMap = await system . betterCallDev . getBigMapKeys ( metadataBigMapId ) ;
138
137
const metaUri = select ( metaBigMap , { key_string : '' } ) ?. value . value ;
139
- const { metadata } = await system . resolveMetadata ( metaUri ) ;
138
+ const { metadata } = await system . resolveMetadata ( fromHexString ( metaUri ) ) ;
140
139
141
140
const { error } = metadataSchema . validate ( metadata , { allowUnknown : true } ) ;
142
141
if ( error ) {
@@ -149,7 +148,13 @@ export async function getWalletNftAssetContracts(system: SystemWithWallet) {
149
148
const bcd = system . betterCallDev ;
150
149
const response = await bcd . getWalletContracts ( system . tzPublicKey ) ;
151
150
const assetContracts = response . items . filter (
152
- ( i : any ) => i . body . hash === nftAssetHash
151
+ ( i : any ) => Object . keys ( i . body ) . includes ( "tags" ) &&
152
+ i . body . tags . includes ( "fa2" ) &&
153
+ Object . keys ( i . body ) . includes ( "entrypoints" ) &&
154
+ i . body . entrypoints . includes ( "balance_of" ) &&
155
+ i . body . entrypoints . includes ( "mint" ) &&
156
+ i . body . entrypoints . includes ( "transfer" ) &&
157
+ i . body . entrypoints . includes ( "update_operators" )
153
158
) ;
154
159
155
160
const results = [ ] ;
0 commit comments