@msafe/sui3-sdk 0.0.72 → 0.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +45 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/backend/BackendImpl.ts +20 -0
- package/src/backend/interface.ts +7 -0
- package/src/backend/types/notification.ts +39 -0
- package/src/core/index.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@msafe/sui3-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"description": "SDK for MSafe SUI V3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@msafe/sui-app-store": ">0.0.100",
|
|
71
71
|
"@msafe/sui3-utils": ">3.0.0",
|
|
72
|
-
"@mysten/sui.js": "
|
|
72
|
+
"@mysten/sui.js": "^0.54.1",
|
|
73
73
|
"@mysten/wallet-standard": ">0.11.0"
|
|
74
|
-
}
|
|
74
|
+
},
|
|
75
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
75
76
|
}
|
|
@@ -43,6 +43,8 @@ import axios, { AxiosError, AxiosRequestConfig, AxiosRequestTransformer, AxiosRe
|
|
|
43
43
|
import { IBackend } from '@/backend/interface';
|
|
44
44
|
import { addPrefix } from '@/utils';
|
|
45
45
|
|
|
46
|
+
import { NotificationInfo, NotificationSubscribeDto, NotificationUpdateDto } from './types/notification';
|
|
47
|
+
|
|
46
48
|
export class BackendImpl implements IBackend {
|
|
47
49
|
private _token: JWTToken;
|
|
48
50
|
|
|
@@ -51,6 +53,24 @@ export class BackendImpl implements IBackend {
|
|
|
51
53
|
private readonly mockAddress?: string,
|
|
52
54
|
) {}
|
|
53
55
|
|
|
56
|
+
getNotificationInfo(): Promise<NotificationInfo> {
|
|
57
|
+
return this.get<NotificationInfo>(`/notification`, {
|
|
58
|
+
headers: this.headers(),
|
|
59
|
+
}).then((res) => res.data);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
subscribeNotification(input: NotificationSubscribeDto): Promise<void> {
|
|
63
|
+
return this.post(`/notification/subscribe`, input, {
|
|
64
|
+
headers: this.headers(),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
updateNotificationSubscription(input: NotificationUpdateDto): Promise<void> {
|
|
69
|
+
return this.post(`/notification/update`, input, {
|
|
70
|
+
headers: this.headers(),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
54
74
|
async authSign(input: IAuthLoginReq): Promise<JWTToken> {
|
|
55
75
|
const res = await this.post<IAuthLoginResp>(`/auth/login`, input);
|
|
56
76
|
|
package/src/backend/interface.ts
CHANGED
|
@@ -31,6 +31,8 @@ import {
|
|
|
31
31
|
} from '@msafe/sui3-utils';
|
|
32
32
|
import { PublicKey, SerializedSignature } from '@mysten/sui.js/cryptography';
|
|
33
33
|
|
|
34
|
+
import { NotificationInfo, NotificationSubscribeDto, NotificationUpdateDto } from './types/notification';
|
|
35
|
+
|
|
34
36
|
export interface IBackend {
|
|
35
37
|
authSign(input: IAuthLoginReq): Promise<JWTToken>;
|
|
36
38
|
verifyToken(jwt?: JWTToken): Promise<boolean>;
|
|
@@ -70,4 +72,9 @@ export interface IBackend {
|
|
|
70
72
|
submitReport(report: Report): Promise<void>;
|
|
71
73
|
|
|
72
74
|
getDashboard(input: IGetDashboardReq): Promise<IGetDashboardResp>;
|
|
75
|
+
|
|
76
|
+
// Notification APIs
|
|
77
|
+
getNotificationInfo(): Promise<NotificationInfo>;
|
|
78
|
+
subscribeNotification(input: NotificationSubscribeDto): Promise<void>;
|
|
79
|
+
updateNotificationSubscription(input: NotificationUpdateDto): Promise<void>;
|
|
73
80
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export enum InfoTypeKey {
|
|
2
|
+
receive = 'info_type_receive',
|
|
3
|
+
send = 'info_type_send',
|
|
4
|
+
invitation = 'info_type_invitation',
|
|
5
|
+
awaitApproval = 'info_type_await_approval',
|
|
6
|
+
}
|
|
7
|
+
export interface NotificationInfo {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
data?: NotificationData;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface NotificationData {
|
|
13
|
+
email: string;
|
|
14
|
+
infoTypes: { infoType: InfoTypeKey; enabled: boolean }[];
|
|
15
|
+
msafeEnabled: { msafeAddress: string; enabled: boolean }[];
|
|
16
|
+
}
|
|
17
|
+
export class NotificationSubscribeDto {
|
|
18
|
+
email: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class NotificationUpdateDto {
|
|
22
|
+
email?: string;
|
|
23
|
+
|
|
24
|
+
infoTypes?: InfoTypeEnabledDto[];
|
|
25
|
+
|
|
26
|
+
msafeEnabled?: MSafeEnabledDto[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class InfoTypeEnabledDto {
|
|
30
|
+
infoType: InfoTypeKey;
|
|
31
|
+
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class MSafeEnabledDto {
|
|
36
|
+
msafeAddress: string;
|
|
37
|
+
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
}
|
package/src/core/index.ts
CHANGED