-
Notifications
You must be signed in to change notification settings - Fork 54
/
types.ts
44 lines (39 loc) · 1.25 KB
/
types.ts
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
import { Asset, Cardano, HttpProviderConfigPaths, Point, Provider } from '../..';
export type Handle = string;
/**
* @param policyId a hex encoded policyID
* @param handle a personalized string to identify a user
* @param hasDatum a boolean to indicated whether it contains a datum
* @param cardanoAddress the cardano payment address resolved from the handle
* @param resolvedAt the point at which the Handle was resolved
*/
export interface HandleResolution {
policyId: Cardano.PolicyId;
handle: Handle;
cardanoAddress: Cardano.PaymentAddress;
hasDatum: boolean;
defaultForStakeCredential?: Handle;
defaultForPaymentCredential?: Handle;
image?: Asset.Uri;
backgroundImage?: Asset.Uri;
profilePic?: Asset.Uri;
resolvedAt?: Point;
parentHandle?: Handle;
}
export interface ResolveHandlesArgs {
handles: Handle[];
}
/**
* @param handles array
* @returns
* @param HandleResolution or null
*/
export interface HandleProvider extends Provider {
resolveHandles(args: ResolveHandlesArgs): Promise<Array<HandleResolution | null>>;
getPolicyIds(): Promise<Cardano.PolicyId[]>;
}
export const handleProviderPaths: HttpProviderConfigPaths<HandleProvider> = {
getPolicyIds: '/policyIds',
healthCheck: '/health',
resolveHandles: '/resolve'
};