blob: 0dfa0ab98ac57fe11733ac8901e41a63c851e7b0 (
plain)
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
|
import typedHypixelApi from 'typed-hypixel-api'
import { cleanInventory, headIdFromBase64, Item } from './inventory.js'
import { cleanItemId } from './itemId.js'
interface Auction {
id: string
sellerUuid: string
sellerProfileUuid: string
buyerUuid: string
timestamp: number
coins: number
bin: boolean
item: Item
}
export interface EndedAuctions {
lastUpdated: number
auctions: Auction[]
}
export async function cleanEndedAuctions(data: typedHypixelApi.SkyBlockRecentlyEndedAuctionsResponse): Promise<EndedAuctions> {
const auctions: Auction[] = []
for (const auction of data.auctions) {
auctions.push({
id: auction.auction_id,
sellerUuid: auction.seller,
sellerProfileUuid: auction.seller_profile,
buyerUuid: auction.buyer,
timestamp: auction.timestamp,
coins: auction.price,
bin: auction.bin,
item: (await cleanInventory(auction.item_bytes))[0]
})
}
return {
lastUpdated: data.lastUpdated,
auctions
}
}
|