forked from Colm3na/polkastats-backend-v3
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathopalAPI.ts
More file actions
37 lines (30 loc) · 1.02 KB
/
opalAPI.ts
File metadata and controls
37 lines (30 loc) · 1.02 KB
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
import { UpDataStructsCollectionLimits, UpDataStructsRpcCollection } from '@unique-nft/quartz-mainnet-types';
import { ImplementOpalAPI } from '../implement/implementOpalAPI';
import AbstractAPI from './abstractAPI';
type CollectionData = {
collection: UpDataStructsRpcCollection | null,
effectiveCollectionLimits: UpDataStructsCollectionLimits | null
};
export class OpalAPI extends AbstractAPI {
impl: ImplementOpalAPI;
async getCollection(id): Promise<CollectionData> {
const [collection, effectiveCollectionLimits] = await Promise.all([
this.impl.impGetCollection(id),
this.impl.impGetEffectiveCollectionLimits(id),
]);
return {
collection,
effectiveCollectionLimits,
};
}
async getToken(collectionId, tokenId) {
const token = await this.impl.impGetToken(collectionId, tokenId);
return token || null;
}
getCollectionCount() {
return this.impl.impGetCollectionCount();
}
getTokenCount(collectionId) {
return this.impl.impGetTokenCount(collectionId);
}
}