Skip to content

Commit 7cbb4e9

Browse files
committed
feat(sudt): add explorer service
1 parent 0d440b4 commit 7cbb4e9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export class ExplorerService {
2+
constructor(private host = '') {}
3+
4+
updateSUDT = async (params: {
5+
typeHash: string
6+
symbol: string
7+
fullName: string
8+
decimal: string
9+
totalAmount: string
10+
description: string
11+
operatorWebsite: string
12+
iconFile: string
13+
uan: string
14+
displayName: string
15+
email: string
16+
token?: string
17+
}) => {
18+
const res = await fetch(`${this.host}/api/v1/udts/${params.typeHash}`, { method: 'POST', body: JSON.stringify({}) })
19+
if (!res.ok) {
20+
throw new Error('Internal Service Error')
21+
}
22+
23+
switch (Math.ceil(res.status / 100)) {
24+
case 2:
25+
return true
26+
case 3:
27+
throw new Error('Redirect')
28+
case 4:
29+
throw new Error('Client Error')
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)