-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathindex.ts
238 lines (219 loc) · 5.11 KB
/
index.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
// Type definitions for non-npm package xumm-sdk 0.1
// Project: https://xumm.app
// Definitions by: Wietse Wind <https://github.com/WietseWind>
// Definitions: https://github.com/XRPL-Labs/XUMM-SDK
const XummTxTypes = [
'SignIn',
'PaymentChannelAuthorize'
] as const
const XrplTxTypes = [
'AccountDelete',
'AccountSet',
'CheckCancel',
'CheckCash',
'CheckCreate',
'ClaimReward',
'DepositPreauth',
'EscrowCancel',
'EscrowCreate',
'EscrowFinish',
'Import',
'Invoke',
'NFTokenAcceptOffer',
'NFTokenBurn',
'NFTokenCancelOffer',
'NFTokenCreateOffer',
'NFTokenMint',
'OfferCancel',
'OfferCreate',
'Payment',
'PaymentChannelClaim',
'PaymentChannelCreate',
'PaymentChannelFund',
'Remit',
'SetHook',
'SetRegularKey',
'SignerListSet',
'TicketCreate',
'TrustSet',
'URITokenBurn',
'URITokenBuy',
'URITokenCancelSellOffer',
'URITokenCreateSellOffer',
'URITokenMint'
] as const
export type XummTransactionType = typeof XummTxTypes[number]
export type XrplTransactionType = typeof XrplTxTypes[number]
export type XummCancelReason = 'OK'
| 'ALREADY_CANCELLED'
| 'ALREADY_RESOLVED'
| 'ALREADY_OPENED'
| 'ALREADY_EXPIRED'
export type XummTransactionApprovalType = 'PIN'
| 'BIOMETRIC'
| 'PASSPHRASE'
| 'OTHER'
export type XummQrQuality = 'm' | 'q' | 'h'
export interface XummJsonTransaction extends Record<string, unknown> {
TransactionType: XummTransactionType | XrplTransactionType
}
export interface XummCustomMeta {
identifier?: string | null
blob?: Record<string, unknown> | null
instruction?: string | null
}
export interface XummPayloadMeta {
exists: boolean
uuid: string
multisign: boolean
submit: boolean
pathfinding: boolean
pathfinding_fallback: boolean
force_network?: string
destination: string
resolved_destination: string
resolved: boolean
signed: boolean
cancelled: boolean
expired: boolean
pushed: boolean
app_opened: boolean
opened_by_deeplink: boolean | null
immutable?: boolean
forceAccount?: boolean
return_url_app: string | null
return_url_web: string | null
is_xapp: boolean
signers: string[] | null
}
export interface XummPayloadBodyBase {
options?: {
submit?: boolean
pathfinding?: boolean
pathfinding_fallback?: boolean
multisign?: boolean
expire?: number
signers?: string[]
force_network?: string
return_url?: {
app?: string
web?: string
}
}
custom_meta?: XummCustomMeta
user_token?: string
}
export interface XummPostPayloadBodyJson extends XummPayloadBodyBase {
txjson: XummJsonTransaction
}
export interface XummPostPayloadBodyBlob extends XummPayloadBodyBase {
txblob: string
}
export type CreatePayload = XummPostPayloadBodyJson | XummPostPayloadBodyBlob
export interface XummPostPayloadResponse {
uuid: string
next: {
always: string
no_push_msg_received?: string
}
refs: {
qr_png: string
qr_matrix: string
qr_uri_quality_opts: XummQrQuality[],
websocket_status: string
}
pushed: boolean
}
export interface XummGetPayloadResponse {
meta: XummPayloadMeta
application: {
name: string
description: string
disabled: 0 | 1
uuidv4: string
icon_url: string
issued_user_token: string | null
}
payload: {
tx_type: XummTransactionType | XrplTransactionType
tx_destination: string
tx_destination_tag: number | null
request_json: XummJsonTransaction
origintype: string | null
signmethod: string | null
created_at: string
expires_at: string
expires_in_seconds: number
computed?: Record<string, unknown>
}
response: {
signer_pubkey?: string
hex: string | null
txid: string | null
resolved_at: string | null
dispatched_nodetype: string | null
dispatched_to: string | null
dispatched_result: string | null
dispatched_to_node: boolean | null
environment_nodeuri: string | null
environment_nodetype: string | null
environment_networkid: number | null
multisign_account: string | null
account: string | null
signer: string | null
approved_with?: XummTransactionApprovalType
user: string | null
}
custom_meta: XummCustomMeta
}
export interface XummDeletePayloadResponse {
result: {
cancelled: boolean
reason: XummCancelReason
}
meta: XummPayloadMeta
custom_meta: XummCustomMeta
}
export interface XummWebhookBody {
meta: {
url: string
application_uuidv4: string
payload_uuidv4: string
opened_by_deeplink: boolean
}
custom_meta: XummCustomMeta
payloadResponse: {
payload_uuidv4: string
reference_call_uuidv4: string
signed: boolean
user_token: boolean
return_url: {
app: string | null
web: string | null
}
txid: string
}
userToken: {
user_token: string
token_issued: number
token_expiration: number
} | null
}
export interface XummWebsocketBody {
payload_uuidv4: string
reference_call_uuidv4: string
signed: boolean
user_token: boolean
return_url: {
app: string | null
web: string | null
}
custom_meta: XummCustomMeta
txid: string
}
export interface XummApiError {
error: {
reference: string
code: number
}
}