File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,15 @@ import {
36
36
import { computeZoom , getZoom } from './zoom'
37
37
38
38
const DEFAULT_PROFILE = 'default'
39
+ const QUANTITY_OF_PARTS_ON_SHORTENED_ITEMS_URN = 6
40
+
41
+ function getTokenIdAndAssetUrn ( completeUrn : string ) : { assetUrn : string ; tokenId : string | undefined } {
42
+ const lastIndex = completeUrn . lastIndexOf ( ':' )
43
+
44
+ return lastIndex !== - 1 && completeUrn . split ( ':' ) . length > QUANTITY_OF_PARTS_ON_SHORTENED_ITEMS_URN
45
+ ? { assetUrn : completeUrn . substring ( 0 , lastIndex ) , tokenId : completeUrn . substring ( lastIndex + 1 ) }
46
+ : { assetUrn : completeUrn , tokenId : undefined }
47
+ }
39
48
40
49
async function fetchItem ( urn : string , peerUrl : string ) {
41
50
const [ wearables , emotes ] = await fetchURNs ( [ urn ] , peerUrl )
@@ -86,7 +95,10 @@ async function fetchURNs(urns: string[], peerUrl: string): Promise<[WearableDefi
86
95
if ( urns . length === 0 ) {
87
96
return [ [ ] , [ ] ]
88
97
}
89
- return peerApi . fetchItems ( urns , peerUrl )
98
+
99
+ const sanitizedAssetUrns = urns . map ( ( urn : string ) => getTokenIdAndAssetUrn ( urn ) . assetUrn )
100
+
101
+ return peerApi . fetchItems ( sanitizedAssetUrns , peerUrl )
90
102
}
91
103
92
104
async function fetchURLs ( urls : string [ ] ) : Promise < [ WearableDefinition [ ] , EmoteDefinition [ ] ] > {
You can’t perform that action at this time.
0 commit comments