-
Notifications
You must be signed in to change notification settings - Fork 76
/
getNFTs.cdc
4787 lines (4176 loc) · 176 KB
/
getNFTs.cdc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import NonFungibleToken from 0x1d7e57aa55817448
import CNN_NFT from 0x329feb3ab062d289
import Gaia from 0x8b148183c28ff88f
import Beam from 0x86b4a0010a71cfc3
import Crave from 0x6d008a788fc27265
import CricketMoments from 0xed398881d9bf40fb
import Everbloom from 0xe703f7fee6400754
import Shard from 0x82b54037a8f180cf
import FantastecNFT from 0x2e1ee1e7a96826ce
import Vouchers from 0x444f5ea22c6ea12c
import KOTD from 0x23dddd854fcc8c6f
import KlktnNFT from 0xabd6e80be7e9682c
import KlktnNFT2 from 0xabd6e80be7e9682c
import MusicBlock from 0x5634aefcb76e7d8c
import Mynft from 0xf6fcbef550d97aa5
import NyatheesOVO from 0x75e0b6de94eb05d0
import RaceDay_NFT from 0x329feb3ab062d289
import RareRooms_NFT from 0x329feb3ab062d289
import SportsIconCollectible from 0x8de96244f54db422
import StarlyCard from 0x5b82f21c0edf76e3
import CaaPass from 0x98c9c2e548b84d31
import TuneGO from 0x0d9bc5af3fc0c2e3
import MatrixWorldFlowFestNFT from 0x2d2750f240198f91
import TopShot from 0x0b2a3299cc857e29
import Domains from 0x233eb012d34b0070
import Eternal from 0xc38aea683c0c4d38
import GooberXContract from 0x34f2bf4a80bb0f69
import MintStoreItem from 0x20187093790b9aef
import TFCItems from 0x81e95660ab5308e1
import BnGNFT from 0x7859c48816bfea3c
import GeniaceNFT from 0xabda6627c70c7f52
import Collectible from 0xf5b0eb433389ac3f
import CryptoZooNFT from 0x8ea44ab931cac762
import OneFootballCollectible from 0x6831760534292098
import TheFabricantMysteryBox_FF1 from 0xa0cbe021821c0965
import DieselNFT from 0x497153c597783bc3
import MiamiNFT from 0x429a19abea586a3e
import HaikuNFT from 0xf61e40c19db2a9e2
import FlowChinaBadge from 0x99fed1e8da4c3431
import AllDay from 0xe4cf4bdc1751c65d
import PackNFT from 0xe4cf4bdc1751c65d
import ItemNFT from 0xfc91de5e6566cc7c
import TheFabricantS1ItemNFT from 0x9e03b1f871b3513
import Andbox_NFT from 0x329feb3ab062d289
import ZeedzINO from 0x62b3063fbe672fc8
import Kicks from 0xf3cc54f4d91c2f6c
import BarterYardPackNFT from 0xa95b021cf8a30d80
import BarterYardClubWerewolf from 0x28abb9f291cadaf2
import MetadataViews from 0x1d7e57aa55817448
import DayNFT from 0x1600b04bf033fb99
import Costacos_NFT from 0x329feb3ab062d289
import Canes_Vault_NFT from 0x329feb3ab062d289
import AmericanAirlines_NFT from 0x329feb3ab062d289
import The_Next_Cartel_NFT from 0x329feb3ab062d289
import Atheletes_Unlimited_NFT from 0x329feb3ab062d289
import Art_NFT from 0x329feb3ab062d289
import DGD_NFT from 0x329feb3ab062d289
import NowggNFT from 0x85b8bbf926dcddfa
import GogoroCollectible from 0x8c9bbcdcd7514081
import YahooCollectible from 0x758252ab932a3416
import YahooPartnersCollectible from 0x758252ab932a3416
import BlindBoxRedeemVoucher from 0x910514afa41bfeac
import SomePlaceCollectible from 0x667a16294a089ef8
import ARTIFACTPack from 0x24de869c5e40b2eb
import ARTIFACT from 0x24de869c5e40b2eb
import NftReality from 0x5892036f9111fbb8
import MatrixWorldAssetsNFT from 0xf20df769e658c257
import RacingTime from 0x8d4fa88ffa2d9117
import Momentables from 0x9d21537544d9123d
import GoatedGoats from 0x2068315349bdfce5
import GoatedGoatsTrait from 0x2068315349bdfce5
import DropzToken from 0x2ba17360b76f0143
import Necryptolis from 0x718efe5e88fe48ea
import FLOAT from 0x2d4c3caffbeab845
import BreakingT_NFT from 0x329feb3ab062d289
import Owners from 0x41cad19decccdf25
import Metaverse from 0x256599e1b091be12
import NFTContract from 0x1e075b24abe6eca6
import SwaychainNFT from 0xa4e9020ad21eb30b
import QRLNFT from 0xa4e9020ad21eb30b
import TheFabricantS2ItemNFT from 0x7752ea736384322f
import VnMiss from 0x7c11edb826692404
import AADigital from 0x39eeb4ee6f30fc3f
import DooverseItems from 0x66ad29c7d7465437
import TrartContractNFT from 0x6f01a4b0046c1f87
import SturdyItems from 0x427ceada271aa0b1
import TicalUniverse from 0xfef48806337aabf1
import PartyMansionDrinksContract from 0x34f2bf4a80bb0f69
import CryptoPiggo from 0xd3df824bf81910a4
import Evolution from 0xf4264ac8f3256818
import Moments from 0xd4ad4740ee426334
import MotoGPCard from 0xa49cc0ee46c54bfb
import UFC_NFT from 0x329feb3ab062d289
import MaxarNFT from 0xa4e9020ad21eb30b
import Flovatar from 0x921ea449dffec68a
import FlovatarComponent from 0x921ea449dffec68a
import FlovatarComponentTemplate from 0x921ea449dffec68a
import MetaPanda from 0xf2af175e411dfff8
import ByteNextMedalNFT from 0x3b16cb9f5c036412
import RCRDSHPNFT from 0x6c3ff40b90b928ab
import Seussibles from 0x321d8fcde05f6e8c
import MetaPanda from 0xf2af175e411dfff8
import Flunks from 0x807c3d470888cc48
import LibraryPass from 0x52cbea4e6f616b8e
pub struct NFTCollection {
pub let owner: Address
pub let nfts: [NFTData]
init(owner: Address) {
self.owner = owner
self.nfts = []
}
}
pub struct NFTData {
pub let contract: NFTContractData
pub let id: UInt64
pub let uuid: UInt64?
pub let title: String?
pub let description: String?
pub let external_domain_view_url: String?
pub let token_uri: String?
pub let media: [NFTMedia?]
pub let metadata: {String: String?}
init(
contract: NFTContractData,
id: UInt64,
uuid: UInt64?,
title: String?,
description: String?,
external_domain_view_url: String?,
token_uri: String?,
media: [NFTMedia?],
metadata: {String: String?}
) {
self.contract = contract
self.id = id
self.uuid = uuid
self.title = title
self.description = description
self.external_domain_view_url = external_domain_view_url
self.token_uri = token_uri
self.media = media
self.metadata = metadata
}
}
pub struct NFTContractData {
pub let name: String
pub let address: Address
pub let storage_path: String
pub let public_path: String
pub let public_collection_name: String
pub let external_domain: String
init(
name: String,
address: Address,
storage_path: String,
public_path: String,
public_collection_name: String,
external_domain: String
) {
self.name = name
self.address = address
self.storage_path = storage_path
self.public_path = public_path
self.public_collection_name = public_collection_name
self.external_domain = external_domain
}
}
pub struct NFTMedia {
pub let uri: String?
pub let mimetype: String?
init(
uri: String?,
mimetype: String?
) {
self.uri = uri
self.mimetype = mimetype
}
}
pub fun main(ownerAddress: Address, ids: {String:[UInt64]}): [NFTData?] {
let NFTs: [NFTData?] = []
let owner = getAccount(ownerAddress)
for key in ids.keys {
for id in ids[key]! {
var d: NFTData? = nil
// note: unfortunately dictonairy containing functions is not
// working on mainnet for now so we have to fallback to switch
switch key {
case "CNN": d = getCnnNFT(owner: owner, id: id)
case "Gaia": d = getGaia(owner: owner, id: id)
case "TopShot": d = getTopShot(owner: owner, id: id)
case "MatrixWorldFlowFestNFT": d = getMatrixWorldFlowFest(owner: owner, id: id)
case "StarlyCard": d = getStarlyCard(owner: owner, id: id)
case "EternalShard": d = getEternalShard(owner: owner, id: id)
case "Mynft": d = getMynft(owner: owner, id: id)
case "Vouchers": d = getVoucher(owner: owner, id: id)
case "MusicBlock": d = getMusicBlock(owner: owner, id: id)
case "NyatheesOVO": d = getNyatheesOVO(owner: owner, id: id)
case "RaceDay_NFT": d = getRaceDay(owner: owner, id: id)
case "Andbox_NFT": d = getAndbox_NFT(owner: owner, id: id)
case "FantastecNFT": d = getFantastecNFT(owner: owner, id: id)
case "Everbloom": d = getEverbloom(owner: owner, id: id)
case "Domains": d = getFlownsDomain(owner: owner, id:id)
case "EternalMoment": d = getEternalMoment(owner: owner, id: id)
case "ThingFund": d = getCaaPass(owner: owner, id: id)
case "TFCItems": d = getTFCItems(owner: owner, id: id)
case "Gooberz": d = getGooberz(owner: owner, id: id)
case "MintStoreItem": d = getMintStoreItem(owner: owner, id: id)
case "BiscuitsNGroovy": d = getBiscuitsNGroovy(owner: owner, id: id)
case "GeniaceNFT": d = getGeniaceNFT(owner: owner, id: id)
case "Xtingles": d = getXtinglesNFT(owner: owner, id: id)
case "Beam": d = getBeam(owner: owner, id: id)
case "KOTD": d = getKOTD(owner: owner, id: id)
case "KlktnNFT": d = getKlktnNFT(owner: owner, id: id)
case "KlktnNFT2": d = getKlktnNFT2(owner: owner, id: id)
case "RareRooms_NFT": d = getRareRooms(owner: owner, id: id)
case "Crave": d = getCrave(owner: owner, id: id)
case "CricketMoments": d = getCricketMoments(owner: owner, id: id)
case "SportsIconCollectible": d = getSportsIconCollectible(owner: owner, id: id)
case "InceptionAnimals": d = getInceptionAnimals(owner: owner, id: id)
case "OneFootballCollectible": d = getOneFootballCollectible(owner: owner, id: id)
case "TheFabricantMysteryBox_FF1": d = getTheFabricantMysteryBox_FF1(owner: owner, id: id)
case "DieselNFT": d = getDieselNFT(owner: owner, id: id)
case "MiamiNFT": d = getMiamiNFT(owner: owner, id: id)
case "Bitku": d = getBitku(owner: owner, id: id)
case "FlowFans": d = getFlowFansNFT(owner: owner, id: id)
case "AllDay": d = getAllDay(owner: owner, id: id)
case "PackNFT": d = getAllDayPackNFT(owner: owner, id: id)
case "ItemNFT": d = getItemNFT(owner: owner, id: id)
case "TheFabricantS1ItemNFT": d = getTheFabricantS1ItemNFT(owner: owner, id: id)
case "ZeedzINO" : d = getZeedzINO(owner: owner, id: id)
case "Kicks" : d = getKicksSneaker(owner: owner, id: id)
case "BarterYardPack": d = getBarterYardPack(owner: owner, id: id)
case "BarterYardClubWerewolf": d = getBarterYardClubWerewolf(owner: owner, id: id)
case "DayNFT" : d = getDayNFT(owner: owner, id: id)
case "Costacos_NFT": d = getCostacosNFT(owner: owner, id: id)
case "Canes_Vault_NFT": d = getCanesVaultNFT(owner: owner, id: id)
case "AmericanAirlines_NFT": d = getAmericanAirlinesNFT(owner: owner, id: id)
case "The_Next_Cartel_NFT": d = getTheNextCartelNFT(owner: owner, id: id)
case "Atheletes_Unlimited_NFT": d = getAthletesUnlimitedNFT(owner: owner, id: id)
case "Art_NFT": d = getArtNFT(owner: owner, id: id)
case "DGD_NFT": d = getDGDNFT(owner: owner, id: id)
case "NowggNFT": d = getNowggNFT(owner: owner, id: id)
case "GogoroCollectible": d = getGogoroCollectibleNFT(owner: owner, id: id)
case "YahooCollectible": d = getYahooCollectibleNFT(owner: owner, id: id)
case "YahooPartnersCollectible": d = getYahooPartnersCollectibleNFT(owner: owner, id: id)
case "BlindBoxRedeemVoucher": d = getBlindBoxRedeemVoucherNFT(owner: owner, id: id)
case "SomePlaceCollectible": d = getSomePlaceCollectibleNFT(owner: owner, id: id)
case "ARTIFACTPack": d = getARTIFACTPack(owner: owner, id: id)
case "ARTIFACT": d = getARTIFACT(owner: owner, id: id)
case "NftReality": d = getNftRealityNFT(owner: owner, id: id)
case "MatrixWorldAssetsNFT": d = getNftMatrixWorldAssetsNFT(owner: owner, id: id)
case "TuneGO": d = getTuneGO(owner: owner, id: id)
case "TicalUniverse": d = getTicalUniverse(owner: owner, id: id)
case "RacingTime": d = getRacingTimeNFT(owner: owner, id: id)
case "Momentables": d = getMomentables(owner: owner, id: id)
case "GoatedGoats": d = getGoatedGoats(owner: owner, id: id)
case "GoatedGoatsTrait": d = getGoatedGoatsTrait(owner: owner, id: id)
case "DropzToken": d = getDropzToken(owner: owner, id: id)
case "Necryptolis": d = getNecryptolisNFT(owner: owner, id: id)
case "FLOAT" : d = getFLOAT(owner: owner, id: id)
case "BreakingT_NFT": d = getBreakingTNFT(owner: owner, id: id)
case "Owners": d = getOwnersNFT(owner: owner, id: id)
case "Metaverse": d = getOzoneMetaverseNFT(owner: owner, id: id)
case "NFTContract": d = getNFTContract(owner: owner, id: id)
case "Swaychain": d = getSwaychainNFT(owner: owner, id: id)
case "Maxar": d = getMaxarNFT(owner: owner, id: id)
case "TheFabricantS2ItemNFT": d = getTheFabricantS2ItemNFT(owner: owner, id: id)
case "VnMiss": d = getVnMiss(owner: owner, id: id)
case "AvatarArt": d = getAvatarArt(owner: owner, id: id)
case "Dooverse": d = getDooverseNFT(owner: owner, id: id)
case "TrartContractNFT": d = getTrartContractNFT(owner: owner, id: id)
case "SturdyItems": d = getSturdyItemsNFT(owner: owner, id: id)
case "PartyMansionDrinksContract": d = getPartyMansionDrinksContractNFT(owner: owner, id: id)
case "CryptoPiggo": d = getCryptoPiggoNFT(owner: owner, id: id)
case "Evolution": d = getEvolutionNFT(owner: owner, id: id)
case "Moments": d = getMomentsNFT(owner: owner, id: id)
case "MotoGPCard": d = getMotoGPCardNFT(owner: owner, id: id)
case "UFC_NFT": d = getUFCNFT(owner: owner, id: id)
case "Flovatar": d = getFlovatarNFT(owner: owner, id: id)
case "FlovatarCompoment": d = getFlovatarComponentNFT(owner: owner, id: id)
case "MetaPanda": d = getMetaPandaNFT(owner: owner, id: id)
case "FlovatarComponent": d = getFlovatarComponentNFT(owner: owner, id: id)
case "ByteNextMedalNFT": d = getByteNextMedalNFT(owner: owner, id: id)
case "RCRDSHPNFT": d = getRCRDSHPNFT(owner: owner, id: id)
case "Seussibles": d = getSeussibles(owner: owner, id: id)
case "MetaPanda": d = getMetaPanda(owner: owner, id: id)
case "Flunks": d = getFlunks(owner: owner, id: id)
case "LibraryPass": d = getLibraryPass(owner: owner, id: id)
default:
panic("adapter for NFT not found: ".concat(key))
}
NFTs.append(d)
}
}
return NFTs
}
// https://flow-view-source.com/mainnet/account/0x329feb3ab062d289/contract/CNN_NFT
pub fun getCnnNFT(owner: PublicAccount, id: UInt64): NFTData? {
let contract = NFTContractData(
name: "CNN_NFT",
address: 0x329feb3ab062d289,
storage_path: "CNN_NFT.CollectionStoragePath",
public_path: "CNN_NFT.CollectionPublicPath",
public_collection_name: "CNN_NFT.CNN_NFTCollectionPublic",
external_domain: "https://vault.cnn.com/",
)
let col = owner.getCapability(CNN_NFT.CollectionPublicPath)
.borrow<&{CNN_NFT.CNN_NFTCollectionPublic}>()
if col == nil { return nil }
let nft = col!.borrowCNN_NFT(id: id)
if nft == nil { return nil }
let setMeta = CNN_NFT.getSetMetadata(setId: nft!.setId)!
let seriesMeta = CNN_NFT.getSeriesMetadata(
seriesId: CNN_NFT.getSetSeriesId(setId: nft!.setId)!
)
let seriesId = CNN_NFT.getSetSeriesId(setId: nft!.setId)!
let nftEditions = CNN_NFT.getSetMaxEditions(setId: nft!.setId)!
let externalTokenViewUrl = setMeta!["external_url"]!.concat("tokens/").concat(nft!.id.toString())
var mimeType = "image"
if setMeta!["image_file_type"]!.toLower() == "mp4" {
mimeType = "video/mp4"
} else if setMeta!["image_file_type"]!.toLower() == "glb" {
mimeType = "model/gltf-binary"
}
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: setMeta!["name"],
description: setMeta!["description"],
external_domain_view_url: externalTokenViewUrl,
token_uri: nil,
media: [
NFTMedia(uri: setMeta!["image"], mimetype: mimeType),
NFTMedia(uri: setMeta!["preview"], mimetype: "image")
],
metadata: {
"editionNumber": nft!.editionNum.toString(),
"editionCount": nftEditions!.toString(),
"set_id": nft!.setId.toString(),
"series_id": seriesId!.toString()
},
)
}
// https://flow-view-source.com/mainnet/account/0x8b148183c28ff88f/contract/Gaia
pub fun getGaia(owner: PublicAccount, id: UInt64): NFTData? {
let contract = NFTContractData(
name: "Gaia",
address: 0x8b148183c28ff88f,
storage_path: "Gaia.CollectionStoragePath",
public_path: "Gaia.CollectionPublicPath",
public_collection_name: "Gaia.CollectionPublic",
external_domain: "ballerz.xyz"
)
let col = owner.getCapability(Gaia.CollectionPublicPath)
.borrow<&{Gaia.CollectionPublic}>()
if col == nil { return nil }
let nft = col!.borrowGaiaNFT(id: id)
if nft == nil { return nil }
let metadata = Gaia.getTemplateMetaData(templateID: nft!.data.templateID)
// Populate Gaia NFT data attributes into the metadata
metadata!.insert(key: "setID", nft!.data.setID.toString())
metadata!.insert(key: "templateID", nft!.data.templateID.toString())
metadata!.insert(key: "mintNumber", nft!.data.mintNumber.toString())
let rawMetadata: {String:String?} = {}
for key in metadata!.keys {
rawMetadata.insert(key: key, metadata![key])
}
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: metadata!["title"],
description: metadata!["description"],
external_domain_view_url: metadata!["uri"],
token_uri: nil,
media: [NFTMedia(uri: metadata!["img"], mimetype: "image")],
metadata: rawMetadata,
)
}
pub fun stringStartsWith(string: String, prefix: String): Bool {
if(string.length < prefix.length) {
return false
}
let beginning = string.slice(from: 0, upTo: prefix.length)
let prefixArray = prefix.utf8
let beginningArray = beginning.utf8
for index, element in prefixArray {
if(beginningArray[index] != prefixArray[index]) {
return false
}
}
return true
}
// https://flow-view-source.com/mainnet/account/0x86b4a0010a71cfc3/contract/Beam
pub fun getBeam(owner: PublicAccount, id: UInt64): NFTData? {
let contract = NFTContractData(
name: "Beam",
address: 0x86b4a0010a71cfc3,
storage_path: "Beam.CollectionStoragePath",
public_path: "Beam.CollectionPublicPath",
public_collection_name: "Beam.BeamCollectionPublic",
external_domain: "frightclub.niftory.com"
)
let col = owner.getCapability(Beam.CollectionPublicPath)
.borrow<&{Beam.BeamCollectionPublic}>()
if col == nil { return nil }
let nft = col!.borrowCollectible(id: id)
if nft == nil { return nil }
let metadata = Beam.getCollectibleItemMetaData(collectibleItemID: nft!.data.collectibleItemID)
let ipfsScheme = "ipfs://"
let httpsScheme = "https://"
var mediaUrl: String? = nil
if metadata!["mediaUrl"] != nil {
let metadataUrl = metadata!["mediaUrl"]!
if stringStartsWith(string: metadataUrl, prefix: ipfsScheme) || stringStartsWith(string: metadataUrl, prefix: httpsScheme) {
mediaUrl = metadataUrl
}
else if metadataUrl.length > 0 {
mediaUrl = ipfsScheme.concat(metadataUrl)
}
}
var domainUrl: String? = nil
if metadata!["domainUrl"] != nil {
let metadataDomainUrl = metadata!["domainUrl"]!
if stringStartsWith(string: metadataDomainUrl, prefix: httpsScheme) {
domainUrl = metadataDomainUrl
}
else if metadataDomainUrl.length > 0 {
domainUrl = httpsScheme.concat(metadataDomainUrl)
}
}
let rawMetadata: {String:String?} = {}
for key in metadata!.keys {
rawMetadata.insert(key: key, metadata![key])
}
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: metadata!["title"],
description: metadata!["description"],
external_domain_view_url: domainUrl,
token_uri: nil,
media: [NFTMedia(uri: mediaUrl, mimetype: metadata!["mediaType"]),
NFTMedia(uri: "ipfs://bafybeichtxzrocxo7ec5qybfxxlyod5bbymblitjwb2aalv2iyhe42pk4e/Frightclub.jpg", mimetype:"image/jpeg")],
metadata: rawMetadata,
)
}
// https://flow-view-source.com/mainnet/account/0x6d008a788fc27265/contract/Crave
pub fun getCrave(owner: PublicAccount, id: UInt64): NFTData? {
let contract = NFTContractData(
name: "Crave",
address: 0x6d008a788fc27265,
storage_path: "Crave.CollectionStoragePath",
public_path: "Crave.CollectionPublicPath",
public_collection_name: "Crave.CraveCollectionPublic",
external_domain: "crave.niftory.com"
)
let col = owner.getCapability(Crave.CollectionPublicPath)
.borrow<&{Crave.CraveCollectionPublic}>()
if col == nil { return nil }
let nft = col!.borrowCollectible(id: id)
if nft == nil { return nil }
let metadata = Crave.getCollectibleItemMetaData(collectibleItemID: nft!.data.collectibleItemID)
let ipfsScheme = "ipfs://"
let httpsScheme = "https://"
var mediaUrl: String? = nil
if metadata!["mediaUrl"] != nil {
let metadataUrl = metadata!["mediaUrl"]!
if stringStartsWith(string: metadataUrl, prefix: ipfsScheme) || stringStartsWith(string: metadataUrl, prefix: httpsScheme) {
mediaUrl = metadataUrl
}
else if metadataUrl.length > 0 {
mediaUrl = ipfsScheme.concat(metadataUrl)
}
}
var domainUrl: String? = nil
if metadata!["domainUrl"] != nil {
let metadataDomainUrl = metadata!["domainUrl"]!
if stringStartsWith(string: metadataDomainUrl, prefix: httpsScheme) {
domainUrl = metadataDomainUrl
}
else if metadataDomainUrl.length > 0 {
domainUrl = httpsScheme.concat(metadataDomainUrl)
}
}
let rawMetadata: {String:String?} = {}
for key in metadata!.keys {
rawMetadata.insert(key: key, metadata![key])
}
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: metadata!["title"],
description: metadata!["description"],
external_domain_view_url: domainUrl,
token_uri: nil,
media: [NFTMedia(uri: mediaUrl, mimetype: metadata!["mediaType"]),
NFTMedia(uri: "ipfs://bafybeiedrlfjykj4svmaka7jdxnhr3osigtudyrhitxsf7ska5ljeiwlxa/Crave Critics Banner.jpg", mimetype:"image/jpeg")],
metadata: rawMetadata,
)
}
// https://flow-view-source.com/mainnet/account/0xed398881d9bf40fb/contract/CricketMoments
pub fun getCricketMoments(owner: PublicAccount, id: UInt64): NFTData? {
let col = owner.getCapability(CricketMoments.CollectionPublicPath)
.borrow<&{CricketMoments.CricketMomentsCollectionPublic}>()
if col == nil { return nil }
if let nft = col!.borrowCricketMoment(id: id){
let contract = NFTContractData(
name: "CricketMoments",
address: 0xed398881d9bf40fb,
storage_path: "CricketMoments.CollectionStoragePath",
public_path: "CricketMoments.CollectionPublicPath",
public_collection_name: "CricketMoments.CricketMomentsCollectionPublic",
external_domain: ""
)
let metadata = nft!.getMetadata()
let rawMetadata: {String:String?} = {}
for key in metadata!.keys {
rawMetadata.insert(key: key, metadata![key])
}
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: nil,
description: metadata["description"],
external_domain_view_url: nil,
token_uri: "https://gateway.pinata.cloud/ipfs/".concat(metadata["ipfs"]!),
media: [],
metadata: rawMetadata,
)
}
return nil
}
// https://flow-view-source.com/mainnet/account/0xe703f7fee6400754/contract/Everbloom
pub fun getEverbloom(owner: PublicAccount, id: UInt64): NFTData? {
let col = owner.getCapability(Everbloom.CollectionPublicPath)
.borrow<&{Everbloom.PrintCollectionPublic}>()
if col == nil { return nil }
if let nft = col!.borrowPrint(id: id) {
let metadata = nft.data
let contract = NFTContractData(
name: "Everbloom",
address: 0xe703f7fee6400754,
storage_path: "Everbloom.CollectionStoragePath",
public_path: "Everbloom.CollectionPublicPath",
public_collection_name: "Everbloom.PrintCollectionPublic",
external_domain: "https://web.everbloom.app/"
)
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: nil,
description: nil,
external_domain_view_url: nil,
token_uri: "https://everbloom-fcl-service.herokuapp.com/v1/nft/".concat(nft!.id.toString()),
media: [],
metadata: {},
)
}
return nil
}
// https://flow-view-source.com/mainnet/account/0xc38aea683c0c4d38/contract/Eternal
pub fun getEternalMoment(owner: PublicAccount, id: UInt64): NFTData? {
let contract = NFTContractData(
name: "Eternal",
address: 0xc38aea683c0c4d38,
storage_path: "/storage/EternalMomentCollection",
public_path: "/public/EternalMomentCollection",
public_collection_name: "Eternal.MomentCollectionPublic",
external_domain: "https://eternal.gg/"
)
let col = owner.getCapability(/public/EternalMomentCollection)
.borrow<&{Eternal.MomentCollectionPublic}>()
if col == nil { return nil }
let nft = col!.borrowMoment(id: id)
if nft == nil { return nil }
let metadata = Eternal.getPlayMetaData(playID: nft!.data.playID)
if metadata == nil { return nil }
let rawMetadata: {String:String?} = {}
for key in metadata!.keys {
rawMetadata.insert(key: key, metadata![key])
}
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: metadata!["Title"],
description: metadata!["Game"]!.concat(" - ").concat(metadata!["Influencer"]!),
external_domain_view_url: "https://eternal.gg/moments/".concat(nft!.id.toString()),
token_uri: nil,
media: [NFTMedia(
uri: "https://gateway.pinata.cloud/ipfs/".concat(metadata!["Hash"]!),
mimetype: "video"
)],
metadata: rawMetadata,
)
}
// https://flow-view-source.com/mainnet/account/0x82b54037a8f180cf/contract/Shard
pub fun getEternalShard(owner: PublicAccount, id: UInt64): NFTData? {
let contract = NFTContractData(
name: "Shard",
address: 0x82b54037a8f180cf,
storage_path: "/storage/EternalShardCollection",
public_path: "/public/EternalShardCollection",
public_collection_name: "Shard.ShardCollectionPublic",
external_domain: "https://eternal.gg/"
)
let col = owner.getCapability(/public/EternalShardCollection)
.borrow<&{Shard.ShardCollectionPublic}>()
if col == nil { return nil }
let nft = col!.borrowShardNFT(id: id)
if nft == nil { return nil }
let clip = Shard.getClip(clipID: nft!.clipID)
let clipMetadata = Shard.getClipMetadata(clipID: nft!.clipID)
let momentMetadata = Shard.getMomentMetadata(momentID: clip!.momentID)
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: clipMetadata!["title"],
description: "Deposit your Shard at Eternal.gg to merge them into a Crystal!",
external_domain_view_url: "https://eternal.gg/shards/".concat(nft!.id.toString()),
token_uri: nil,
media: [NFTMedia(uri: clipMetadata!["video_url"], mimetype: "video")],
metadata: {
},
)
}
// https://flow-view-source.com/mainnet/account/0x2e1ee1e7a96826ce/contract/FantastecNFT
pub fun getFantastecNFT(owner: PublicAccount, id: UInt64): NFTData? {
let col = owner.getCapability(FantastecNFT.CollectionPublicPath)
.borrow<&{FantastecNFT.FantastecNFTCollectionPublic}>()
if col == nil { return nil }
if let nft = col!.borrowFantastecNFT(id: id){
//if does not resolve to nil this code will be executed
let contract = NFTContractData(
name: "FantastecNFT",
address: 0x2e1ee1e7a96826ce,
storage_path: "FantastecNFT.CollectionStoragePath",
public_path: "FantastecNFT.CollectionPublicPath",
public_collection_name: "FantastecNFT.FantastecNFTCollectionPublic",
external_domain: ""
)
let rawMetadata: {String:String?} = {}
for key in nft.metadata.keys {
rawMetadata.insert(key: key, nft.metadata[key])
}
return NFTData(
contract: contract,
id: nft.id,
uuid: nft.uuid,
title: nft.metadata["title"],
description: nft.metadata["description"],
external_domain_view_url: nil,
token_uri: nil,
media: [NFTMedia(
uri: nft.metadata["image"],
mimetype: "image/png"
)],
metadata: rawMetadata,
)
}
return nil
}
// https://flow-view-source.com/mainnet/account/0x444f5ea22c6ea12c/contract/Vouchers
pub fun getVoucher(owner: PublicAccount, id: UInt64): NFTData? {
let contract = NFTContractData(
name: "Vouchers",
address: 0x444f5ea22c6ea12c,
storage_path: "Vouchers.CollectionStoragePath",
public_path: "Vouchers.CollectionPublicPath",
public_collection_name: "Vouchers.CollectionPublic",
external_domain: ""
)
let col = owner.getCapability(Vouchers.CollectionPublicPath)
.borrow<&{Vouchers.CollectionPublic}>()
if col == nil { return nil }
let nft = col!.borrowVoucher(id: id)
if nft == nil { return nil }
let metadata = nft!.getMetadata()
if metadata == nil { return nil }
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: metadata!.name,
description: metadata!.description,
external_domain_view_url: nil,
token_uri: nil,
media: [NFTMedia(uri: metadata!.mediaURI, mimetype: metadata!.mediaType)],
metadata: {
"mediaHash": metadata!.mediaURI,
"mediaType": metadata!.mediaType,
"mediaURI": metadata!.mediaURI,
"name": metadata!.name,
"description": metadata!.description,
"typeID": nft!.typeID.toString()
},
)
}
// https://flow-view-source.com/mainnet/account/0x23dddd854fcc8c6f/contract/KOTD
pub fun getKOTD(owner: PublicAccount, id: UInt64): NFTData? {
let contract = NFTContractData(
name: "KOTD",
address: 0x23dddd854fcc8c6f,
storage_path: "KOTD.CollectionStoragePath",
public_path: "KOTD.CollectionPublicPath",
public_collection_name: "KOTD.NiftoryCollectibleCollectionPublic",
external_domain: "kotd.niftory.com"
)
let col = owner.getCapability(KOTD.CollectionPublicPath)
.borrow<&{KOTD.NiftoryCollectibleCollectionPublic}>()
if col == nil { return nil }
let nft = col!.borrowCollectible(id: id)
if nft == nil { return nil }
let metadata = KOTD.getCollectibleItemMetaData(collectibleItemID: nft!.data.collectibleItemID)
let ipfsScheme = "ipfs://"
let httpsScheme = "https://"
var mediaUrl: String? = nil
if metadata!["mediaUrl"] != nil {
let metadataUrl = metadata!["mediaUrl"]!
if stringStartsWith(string: metadataUrl, prefix: ipfsScheme) || stringStartsWith(string: metadataUrl, prefix: httpsScheme) {
mediaUrl = metadataUrl
}
else if metadataUrl.length > 0 {
mediaUrl = ipfsScheme.concat(metadataUrl)
}
}
var domainUrl: String? = nil
if metadata!["domainUrl"] != nil {
let metadataDomainUrl = metadata!["domainUrl"]!
if stringStartsWith(string: metadataDomainUrl, prefix: httpsScheme) {
domainUrl = metadataDomainUrl
}
else if metadataDomainUrl.length > 0 {
domainUrl = httpsScheme.concat(metadataDomainUrl)
}
}
let rawMetadata: {String:String?} = {}
for key in metadata!.keys {
rawMetadata.insert(key: key, metadata![key])
}
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: metadata!["title"],
description: metadata!["description"],
external_domain_view_url: domainUrl,
token_uri: nil,
media: [NFTMedia(uri: mediaUrl, mimetype: metadata!["mediaType"]),
NFTMedia(uri: "ipfs://bafybeidy62mofvdpzr5gujq57kcpm27pciqx33pahxbfuwgzea646k2nay/s1_poster.jpg", mimetype:"image/jpeg")],
metadata: rawMetadata,
)
}
// https://flow-view-source.com/mainnet/account/0xabd6e80be7e9682c/contract/KlktnNFT
pub fun getKlktnNFT(owner: PublicAccount, id: UInt64): NFTData? {
let col = owner.getCapability(KlktnNFT.CollectionPublicPath)
.borrow<&{KlktnNFT.KlktnNFTCollectionPublic}>()
if col == nil { return nil }
if let nft = col!.borrowKlktnNFT(id: id){
let metadata = nft!.getNFTMetadata()
let contract = NFTContractData(
name: "KlktnNFT",
address: 0xabd6e80be7e9682c,
storage_path: "KlktnNFT.CollectionStoragePath",
public_path: "KlktnNFT.CollectionPublicPath",
public_collection_name: "KlktnNFT.KlktnNFTCollectionPublic",
external_domain: ""
)
let rawMetadata: {String:String?} = {}
for key in metadata!.keys {
rawMetadata.insert(key: key, metadata![key])
}
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: metadata["name"],
description:metadata["description"],
external_domain_view_url: nil,
token_uri: nil,
media: [NFTMedia(uri: metadata["media"], mimetype: metadata["mimeType"])],
metadata: rawMetadata,
)
}
return nil
}
// https://flow-view-source.com/mainnet/account/0xabd6e80be7e9682c/contract/KlktnNFT2
pub fun getKlktnNFT2(owner: PublicAccount, id: UInt64): NFTData? {
let col = owner.getCapability(KlktnNFT2.CollectionPublicPath)
.borrow<&{KlktnNFT2.KlktnNFTCollectionPublic}>()
if col == nil { return nil }
if let nft = col!.borrowKlktnNFT(id: id){
let template = nft!.getFullMetadata()
let contract = NFTContractData(
name: "KlktnNFT2",
address: 0xabd6e80be7e9682c,
storage_path: "KlktnNFT2.CollectionStoragePath",
public_path: "KlktnNFT2.CollectionPublicPath",
public_collection_name: "KlktnNFT2.KlktnNFTCollectionPublic",
external_domain: ""
)
let rawMetadata: {String:String?} = {}
for key in template.metadata.keys {
rawMetadata.insert(key: key, template.metadata[key])
}
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: template.metadata["name"] ?? "",
description:template.metadata["description"] ?? "",
external_domain_view_url: nil,
token_uri: template.metadata["uri"] ?? "",
media: [NFTMedia(uri: template.metadata["media"] ?? "", mimetype: template.metadata["mimeType"] ?? "")],
metadata: rawMetadata,
)
}
return nil
}
// https://flow-view-source.com/mainnet/account/0x5634aefcb76e7d8c/contract/MusicBlock
pub fun getMusicBlock(owner: PublicAccount, id: UInt64): NFTData? {
let col = owner.getCapability(MusicBlock.CollectionPublicPath)
.borrow<&{MusicBlock.MusicBlockCollectionPublic}>()
if col == nil { return nil }
let data = col!.getMusicBlockData(id: id)
let nft = col!.borrowNFT(id: id)
let token_uri = col!.getUri(id: id)
let contract = NFTContractData(
name: "MusicBlock",
address: 0x5634aefcb76e7d8c,
storage_path: "MusicBlock.CollectionStoragePath",
public_path: "MusicBlock.CollectionPublicPath",
public_collection_name: "MusicBlock.MusicBlockCollectionPublic",
external_domain: "melos.studio"
)
return NFTData(
contract: contract,
id: id,
uuid: nft.uuid,
title: nil,
description: nil,
external_domain_view_url: nil,
token_uri: token_uri,
media: [],
metadata: {
"creator": data.creator.toString(),
"cpower": data.cpower.toString(),
"cid": data.cid,
"generation": data.generation.toString()
},
)
}
// https://flow-view-source.com/mainnet/account/0xf6fcbef550d97aa5/contract/Mynft
pub fun getMynft(owner: PublicAccount, id: UInt64): NFTData? {
let contract = NFTContractData(
name: "Mynft",
address: 0xf6fcbef550d97aa5,
storage_path: "Mynft.CollectionStoragePath",
public_path: "Mynft.CollectionPublicPath",
public_collection_name: "Mynft.MynftCollectionPublic",
external_domain: ""
)
let col = owner.getCapability(Mynft.CollectionPublicPath)
.borrow<&{Mynft.MynftCollectionPublic}>()
if col == nil { return nil }
let nft = col!.borrowArt(id: id)
if nft == nil { return nil }
return NFTData(
contract: contract,
id: nft!.id,
uuid: nft!.uuid,
title: nft!.metadata!.name,
description: nft!.metadata!.description,
external_domain_view_url: "",
token_uri: nil,
media: [NFTMedia(uri: nft!.metadata!.ipfsLink, mimetype: nft!.metadata!.type)],