-
Notifications
You must be signed in to change notification settings - Fork 14
/
orchestration.ts
77 lines (71 loc) · 1.98 KB
/
orchestration.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
77
/**
* Enum representing different types of orchestration events.
*/
export enum OrchestrationEventType {
REQUEST_CONNECT = 'request-connect',
REQUEST_WALLET = 'request-wallet',
REQUEST_SWAP = 'request-swap',
REQUEST_BRIDGE = 'request-bridge',
REQUEST_ONRAMP = 'request-onramp',
}
/**
* Represents the connect event object when the connect widget is requested.
* @property {string} walletProviderName
*/
export type RequestConnectEvent = {
/** The wallet provider name. */
walletProviderName: string;
};
/**
* Represents the wallet event object when the wallet widget is requested.
* @property {string} walletProviderName
*/
export type RequestWalletEvent = {
/** The wallet provider name. */
walletProviderName: string;
};
/**
* Represents the swap event object when the swap widget is requested.
* @property {string} fromTokenAddress
* @property {string} toTokenAddress
* @property {string} amount
*/
export type RequestSwapEvent = {
/** The address of the token to swap from. */
fromTokenAddress: string;
/** The address of the token to swap to. */
toTokenAddress: string;
/** The amount of from tokens to swap. */
amount: string;
};
/**
* Represents the bridge event object when the bridge widget is requested.
* @property {string} tokenAddress
* @property {string} amount
*/
export type RequestBridgeEvent = {
/** The address of the token to bridge. */
tokenAddress: string;
/** The amount of tokens to bridge. */
amount: string;
};
/**
* Represents the onramp event object when the onramp widget is requested.
* @property {string} tokenAddress
* @property {string} amount
*/
export type RequestOnrampEvent = {
/** The address of the token to be used for onramp. */
tokenAddress: string;
/** The amount of tokens to onramp. */
amount: string;
};
/*
* Type representing the orchestration events.
*/
export type OrchestrationEventData =
RequestConnectEvent
| RequestWalletEvent
| RequestSwapEvent
| RequestBridgeEvent
| RequestOnrampEvent;