-
Notifications
You must be signed in to change notification settings - Fork 0
/
royalty.ts
69 lines (63 loc) · 1.84 KB
/
royalty.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
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
const isTestnet = window.location.host != process.env.VUE_APP_MAINNET_HOST;
export interface RoyaltyEntity {
code: string;
name?: string;
address: string;
}
const mainnetCodes: RoyaltyEntity[] = [
{
code: "hiya",
address: "xch19tq8q0tkm2660mfpjqv9y94j7fcdfpx860a9ymskeulafk9d653qu8wkyk",
},
{
code: "hezuoshe",
address: "xch1k3vuxal2s9sl2w3v5dgrckq02tg0uvnswsfmj40j52apkxfagg9q3yrgym",
},
{
code: "seasonshome",
address: "xch1p4xeecj35avsjf94y0cysq59swuzgw5544pxym3kmn6qjg67tttqlw0g6a",
},
{
code: "tanggang",
address: "xch1f2cwxnrg4lu33xxqqmx74qgzy9e84clxew4cqzczmlu2r96a6g8qjvl6j8",
},
{
code: "spacescan.io",
address: "xch1a6cd558gqsz2hch5pt0l8mx7zhavf32q5lyde09zjtqcmkelr9ns59k0j8",
},
{
code: "ozonewallet",
name: "OzoneWallet",
address: "xch1hh9phcc8tt703dla70qthlhrxswy88va04zvc7vd8cx2v6a5ywyst8mgul",
},
{
code: "hemadao",
address: "xch14t3qkv323ahrx3zfc0qgzyg8ufwt3exmww7ez2krhj2emw0upmmq6ny7nm",
},
];
const testnetCodes: RoyaltyEntity[] = [
{
code: "hiya",
address: "txch1tanqtjx2lymsjuyy4af23p598ksnnwc8gd98zmynfraa088kewlqq62rt2",
},
{
code: "test",
address: "txch1uvsfhdev6xwgqnfwxpm32cc6r8npvcgfn2850qpsfut40j2ulmhst6h82h",
},
{
code: "ultimate",
name: "Ultimate Test",
address: "txch1uvsfhdev6xwgqnfwxpm32cc6r8npvcgfn2850qpsfut40j2ulmhst6h82h",
},
];
export function getRoyaltyAddress(code: string | null): string {
const ent = getRoyaltyEntity(code);
if (ent?.address) return ent.address;
return process.env.VUE_APP_ROYALTY_ADDRESS ?? "";
}
export function getRoyaltyEntity(code: string | null): RoyaltyEntity | undefined {
if (!code) return undefined;
let codes = isTestnet ? testnetCodes : mainnetCodes;
codes = testnetCodes;
return codes.find((_) => _.code.toLocaleLowerCase() == code.toLocaleLowerCase());
}