-
Notifications
You must be signed in to change notification settings - Fork 1
/
window-message.ts
76 lines (68 loc) · 1.6 KB
/
window-message.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
70
71
72
73
74
75
76
import { WALLET_MESSAGES, WINDOW_MESSAGES } from '../constants/window-message';
export type MessageParams = {
origin: string;
keychainAccountName?: string;
isWindow?: string;
address?: string;
};
export type AtsQueryParams = {
atsVersion?: string;
};
export type TransactionParams = {
[key: string]: string | string[] | undefined;
msgAnyB64: string | string[];
memo?: string;
estimatedValue?: string;
};
export type QueryParams = {
[key: string]: string | undefined;
msgAnyB64: string;
memo?: string;
estimatedValue?: string;
} & MessageParams;
export type SignQueryParams = {
payload: string | Uint8Array;
description: string;
title?: string;
id?: string;
} & MessageParams;
export type ConnectedMessageData = {
address: string;
keychainAccountName?: string;
publicKeyB64?: string;
randomB64?: string;
signedB64?: string;
walletType?: string;
txCallbackUrl?: string;
};
export type WalletMessage = {
message: WALLET_MESSAGES.PAYLOAD;
payload: string | Uint8Array;
};
export type WindowMessage =
| {
message: WINDOW_MESSAGES.TRANSACTION_COMPLETE;
txhash: string;
}
| {
message: WINDOW_MESSAGES.TRANSACTION_FAILED;
}
| {
message: WINDOW_MESSAGES.READY_FOR_POST_MESSAGE;
}
| {
message: WINDOW_MESSAGES.SIGNATURE_COMPLETE;
signedPayload: string | Uint8Array;
id?: string;
}
| {
message: WINDOW_MESSAGES.CLOSE;
redirectUrl?: string;
}
| {
message: WINDOW_MESSAGES.REPORT_HEIGHT;
height: number;
}
| ({
message: WINDOW_MESSAGES.CONNECTED;
} & ConnectedMessageData);