@@ -369,6 +369,128 @@ fetchRandomArtworkWithUser().then((result) => {
369
369
})
370
370
```
371
371
372
+ ### Fetching random communities without full metadata
373
+
374
+ ** Signature** :
375
+ ` fetchRandomCommunities = async (): Promise<TokenMetadataLookUp> `
376
+
377
+ ** Usage** :
378
+ ``` typescript
379
+ import { fetchRandomCommunities } from ' verto-cache-interface' ;
380
+
381
+ fetchRandomCommunities ().then ((result ) => {
382
+ const communities = result .entities ;
383
+ communities .forEach ((com ) => {
384
+ console .log (com .contractId );
385
+ console .log (com .type );
386
+ console .log (com .lister );
387
+ console .log (com .id );
388
+ })
389
+ })
390
+ ```
391
+
392
+ ### Fetching random communities with full metadata
393
+
394
+ ** Signature** :
395
+ ` fetchRandomCommunitiesWithMetadata = async (): Promise<Array<RandomCommunities>> `
396
+
397
+ ** Usage** :
398
+ ``` typescript
399
+ import { fetchRandomCommunitiesWithMetadata } from ' verto-cache-interface' ;
400
+
401
+ fetchRandomCommunitiesWithMetadata ().then ((result ) => {
402
+ result .forEach ((com ) => {
403
+ console .log (com .id );
404
+ console .log (com .name );
405
+ console .log (com .ticker );
406
+ console .log (com .logo );
407
+ console .log (com .description );
408
+ })
409
+ })
410
+ ```
411
+
412
+ ### Fetching top communities with full metadata
413
+
414
+ ** Signature** :
415
+ ` fetchTopCommunities = async (): Promise<Array<RandomCommunities>> `
416
+
417
+ ** Usage** :
418
+ ``` typescript
419
+ import { fetchTopCommunities } from ' verto-cache-interface' ;
420
+
421
+ fetchTopCommunities ().then ((result ) => {
422
+ result .forEach ((com ) => {
423
+ console .log (com .id );
424
+ console .log (com .name );
425
+ console .log (com .ticker );
426
+ console .log (com .logo );
427
+ console .log (com .description );
428
+ })
429
+ })
430
+ ```
431
+
432
+ ### Fetching full metadata for given communities
433
+
434
+ ** Signature** :
435
+ ` fetchCommunitiesMetadata = async (communityContractIds: Array<string> | string): Promise<Array<RandomCommunities>> `
436
+
437
+ ** Usage** :
438
+ ``` typescript
439
+ import { fetchCommunitiesMetadata } from ' verto-cache-interface' ;
440
+
441
+ fetchCommunitiesMetadata ([" MY-community-id1" , " MY-community-id2" ]).then ((result ) => {
442
+ result .forEach ((com ) => {
443
+ console .log (com .id );
444
+ console .log (com .name );
445
+ console .log (com .ticker );
446
+ console .log (com .logo );
447
+ console .log (com .description );
448
+ })
449
+ })
450
+ ```
451
+
452
+ ### Fetching artwork metadata
453
+
454
+ ** Signature** :
455
+ ` fetchArtworkMetadata = async (): Promise<ArtworkMetadata | undefined> `
456
+
457
+ ** Usage** :
458
+ ``` typescript
459
+ import { fetchArtworkMetadata } from ' verto-cache-interface' ;
460
+
461
+ fetchArtworkMetadata ().then ((result ) => {
462
+ console .log (result .id );
463
+ console .log (result .name );
464
+ console .log (result .lister ); // Object (username, name, addresses, bio, links, image)
465
+ console .log (result .lister .addresses );
466
+ console .log (result .lister .bio );
467
+ console .log (result .lister .links );
468
+ })
469
+ ```
470
+
471
+ ### Fetching token by id and optional filtering
472
+
473
+ ** Signature** :
474
+ ` fetchTokenById = async (tokenId: string, filter?: (val: CommunityContractToken) => boolean): Promise<CommunityContractToken | undefined> `
475
+
476
+ ** Usage** :
477
+ ``` typescript
478
+ import { fetchTokenById } from ' verto-cache-interface' ;
479
+
480
+ fetchTokenById (" ABC" ).then ((result ) => {
481
+ console .log (result .id );
482
+ console .log (result .type );
483
+ console .log (result .lister );
484
+ });
485
+
486
+
487
+ fetchTokenById (" ABC" , (filterData ) => filterData .type === " community" ).then ((result ) => {
488
+ console .log (result .id );
489
+ console .log (result .type );
490
+ console .log (result .lister );
491
+ });
492
+ ```
493
+
372
494
## Hooks
373
495
Hooks are a way to invoke functions and then invoke certain behaviors inside the cache system.
374
496
0 commit comments