Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply new Api endpoint for top NFT collections #21

Merged
merged 1 commit into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -239,37 +239,18 @@ class MainViewModel(private val marketKit: MarketKit) : ViewModel() {
fun runNftCollections() {
Log.w("AAA", "doCollections")
viewModelScope.launch {
val collections = marketKit.nftCollections()
val collections = marketKit.nftTopCollections()

Log.w("AAA", "collections count: ${collections.size}")
Log.w("AAA", "first collection: ${collections.firstOrNull()}")
}
}

fun runNftCollection() {
Log.w("AAA", "doCollection")
viewModelScope.launch {
val collection = marketKit.nftCollection("goblintownwtf")

Log.w("AAA", "collection: ${collection}")
}
}

fun runNftCollectionEvents() {
Log.w("AAA", "doNftCollectionEvents")
viewModelScope.launch {
val nftEvents = marketKit.nftCollectionEvents("cryptopunks", NftEvent.EventType.Sale, null)

Log.w("AAA", "runNftCollectionEvents: $nftEvents")
}
}

fun runNftAssetEvents() {
Log.w("AAA", "doRunNftAssetEvents")
viewModelScope.launch {
val nftEvents = marketKit.nftAssetEvents("0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb", "9872", null)

Log.w("AAA", "runNftAssetEvents: $nftEvents")
collections.firstOrNull()?.let { collection ->
Log.w("AAA", "${collection.blockchainType}")
Log.w("AAA", "${collection.providerUid}")
Log.w("AAA", "${collection.name}")
Log.w("AAA", "${collection.thumbnailImageUrl}")
Log.w("AAA", "${collection.floorPrice}")
Log.w("AAA", "${collection.volumes}")
Log.w("AAA", "${collection.changes}")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,26 +265,7 @@ class MarketKit(

// NFT

suspend fun nftAssetCollection(address: String): NftAssetCollection =
nftManager.assetCollection(address)

suspend fun nftCollection(uid: String): NftCollection =
nftManager.collection(uid)

suspend fun nftCollections(): List<NftCollection> =
nftManager.collections()

suspend fun nftAsset(contractAddress: String, tokenId: String): NftAsset =
nftManager.asset(contractAddress, tokenId)

suspend fun nftAssets(collectionUid: String, cursor: String? = null): PagedNftAssets =
nftManager.assets(collectionUid, cursor)

suspend fun nftCollectionEvents(collectionUid: String, eventType: NftEvent.EventType?, cursor: String? = null): PagedNftEvents =
nftManager.collectionEvents(collectionUid, eventType, cursor)

suspend fun nftAssetEvents(contractAddress: String, tokenId: String, eventType: NftEvent.EventType?, cursor: String? = null): PagedNftEvents =
nftManager.assetEvents(contractAddress, tokenId, eventType, cursor)
suspend fun nftTopCollections(): List<NftTopCollection> = nftManager.topCollections()

//Misc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class MarketOverviewManager(
coinCategories = response.coinCategories,
topPlatforms = response.topPlatforms.map { it.topPlatform },
nftCollections = mapOf(
HsTimePeriod.Day1 to nftManager.collectionsFromResponses(response.nft.one_day),
HsTimePeriod.Week1 to nftManager.collectionsFromResponses(response.nft.seven_day),
HsTimePeriod.Month1 to nftManager.collectionsFromResponses(response.nft.thirty_day)
HsTimePeriod.Day1 to nftManager.topCollections(response.nft.one_day),
HsTimePeriod.Week1 to nftManager.topCollections(response.nft.seven_day),
HsTimePeriod.Month1 to nftManager.topCollections(response.nft.thirty_day)
)
)

Expand Down
Loading