edge-core-js 2.44.0 → 2.46.0
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/CHANGELOG.md +12 -1
- package/README.md +4 -4
- package/android/src/main/assets/edge-core-js/edge-core.js +1 -1
- package/android/src/main/assets/edge-core-js/fbcba1e9b05cb4dd9870.js +2 -0
- package/android/src/main/assets/edge-core-js/web-worker-0.js +1 -1
- package/lib/core/account/account-api.js +35 -1
- package/lib/core/account/memory-wallet.js +2 -1
- package/lib/core/actions.js +15 -0
- package/lib/core/currency/wallet/currency-wallet-api.js +16 -0
- package/lib/core/currency/wallet/currency-wallet-cleaners.js +4 -0
- package/lib/core/currency/wallet/currency-wallet-files.js +57 -3
- package/lib/core/currency/wallet/currency-wallet-pixie.js +36 -6
- package/lib/core/currency/wallet/currency-wallet-reducer.js +14 -0
- package/lib/core/login/splitting.js +5 -9
- package/lib/node/index.js +3934 -3805
- package/lib/types/types.js +9 -0
- package/package.json +6 -11
- package/src/types/types.ts +9 -0
- package/types.js +90 -90
- package/android/src/main/assets/edge-core-js/27cab3e7ba7549594ad5.js +0 -2
- package/lib/flow/error.js +0 -448
- package/lib/flow/exports.js +0 -140
- package/lib/flow/fake-types.js +0 -187
- package/lib/flow/server-cleaners.js +0 -444
- package/lib/flow/server-types.js +0 -342
- package/lib/flow/type-helpers.js +0 -60
- package/lib/flow/types.js +0 -2250
- package/lib/node/index.js.flow +0 -4
- package/types.js.flow +0 -4
- /package/android/src/main/assets/edge-core-js/{27cab3e7ba7549594ad5.js.LICENSE.txt → fbcba1e9b05cb4dd9870.js.LICENSE.txt} +0 -0
package/lib/flow/types.js
DELETED
|
@@ -1,2250 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import type { Disklet } from "disklet";
|
|
4
|
-
import type { FetchHeaders, FetchOptions, FetchResponse } from "serverlet";
|
|
5
|
-
import type { Subscriber } from "yaob";
|
|
6
|
-
|
|
7
|
-
export * from "./error";
|
|
8
|
-
export * from "./fake-types";
|
|
9
|
-
export * from "./server-cleaners";
|
|
10
|
-
export * from "./server-types";
|
|
11
|
-
|
|
12
|
-
// ---------------------------------------------------------------------
|
|
13
|
-
// helper types
|
|
14
|
-
// ---------------------------------------------------------------------
|
|
15
|
-
|
|
16
|
-
/** A JSON object (as opposed to an array or primitive). */
|
|
17
|
-
export type JsonObject = {
|
|
18
|
-
[name: string]: any; // TODO: this needs to become `mixed`
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** When we return errors explicitly instead of throwing them */
|
|
22
|
-
export type EdgeResult<T> =
|
|
23
|
-
| { ok: true; result: T }
|
|
24
|
-
| { ok: false; error: mixed };
|
|
25
|
-
|
|
26
|
-
/** A collection of mixed extra methods exposed by a plugin. */
|
|
27
|
-
export type EdgeOtherMethods = {
|
|
28
|
-
+[name: string]: any;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** We frequently index things by pluginId, so provide a helper. */
|
|
32
|
-
export type EdgePluginMap<Value> = {
|
|
33
|
-
[pluginId: string]: Value;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// ---------------------------------------------------------------------
|
|
37
|
-
// io types
|
|
38
|
-
// ---------------------------------------------------------------------
|
|
39
|
-
|
|
40
|
-
// Node.js randomBytes function:
|
|
41
|
-
export type EdgeRandomFunction = (bytes: number) => Uint8Array;
|
|
42
|
-
|
|
43
|
-
// The scrypt function Edge expects:
|
|
44
|
-
export type EdgeScryptFunction = (
|
|
45
|
-
data: Uint8Array,
|
|
46
|
-
salt: Uint8Array,
|
|
47
|
-
n: number,
|
|
48
|
-
r: number,
|
|
49
|
-
p: number,
|
|
50
|
-
dklen: number,
|
|
51
|
-
) => Promise<Uint8Array>;
|
|
52
|
-
|
|
53
|
-
// The subset of the fetch function Edge expects:
|
|
54
|
-
export type EdgeFetchOptions = FetchOptions & {
|
|
55
|
-
privacy?: "none" | "nym";
|
|
56
|
-
corsBypass?: "auto" | "always" | "never";
|
|
57
|
-
};
|
|
58
|
-
export type EdgeFetchHeaders = FetchHeaders;
|
|
59
|
-
export type EdgeFetchResponse = FetchResponse;
|
|
60
|
-
export type EdgeFetchFunction = (
|
|
61
|
-
uri: string,
|
|
62
|
-
opts?: EdgeFetchOptions,
|
|
63
|
-
) => Promise<EdgeFetchResponse>;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Access to platform-specific resources.
|
|
67
|
-
* The core never talks to the outside world on its own,
|
|
68
|
-
* but always goes through this object.
|
|
69
|
-
*/
|
|
70
|
-
export type EdgeIo = {
|
|
71
|
-
// Crypto:
|
|
72
|
-
+random: EdgeRandomFunction;
|
|
73
|
-
+scrypt: EdgeScryptFunction;
|
|
74
|
-
|
|
75
|
-
// Local io:
|
|
76
|
-
+disklet: Disklet;
|
|
77
|
-
+fetch: EdgeFetchFunction;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* This is like `fetch`, but will try to avoid CORS limitations
|
|
81
|
-
* on platforms where that may be a problem.
|
|
82
|
-
*
|
|
83
|
-
* @deprecated Use EdgeIo.fetch instead, which now includes CORS avoidance by default
|
|
84
|
-
*/
|
|
85
|
-
+fetchCors: EdgeFetchFunction;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// logging -------------------------------------------------------------
|
|
89
|
-
|
|
90
|
-
export type EdgeLogMethod = (...args: any[]) => void;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Logs a message.
|
|
94
|
-
*
|
|
95
|
-
* Call `log(message)` for normal information messages,
|
|
96
|
-
* or `log.warn(message)` / `log.error(message)` for something more severe.
|
|
97
|
-
* To record crash information, use `log.crash(error, json)` for errors,
|
|
98
|
-
* and `log.breadcrumb(message, json)` for data leading up to crashes.
|
|
99
|
-
*/
|
|
100
|
-
export type EdgeLog = EdgeLogMethod & {
|
|
101
|
-
// Crash logging:
|
|
102
|
-
+breadcrumb: (message: string, metadata: JsonObject) => void;
|
|
103
|
-
+crash: (error: mixed, metadata: JsonObject) => void;
|
|
104
|
-
|
|
105
|
-
// Message logging:
|
|
106
|
-
+warn: EdgeLogMethod;
|
|
107
|
-
+error: EdgeLogMethod;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export type EdgeLogType = "info" | "warn" | "error";
|
|
111
|
-
|
|
112
|
-
export type EdgeLogSettings = {
|
|
113
|
-
sources: { [pluginId: string]: EdgeLogType | "silent" };
|
|
114
|
-
defaultLogLevel: EdgeLogType | "silent";
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* The EdgeLog function stringifies its arguments and adds
|
|
119
|
-
* some extra information to form this event type.
|
|
120
|
-
*/
|
|
121
|
-
export type EdgeLogEvent = {
|
|
122
|
-
message: string;
|
|
123
|
-
source: string;
|
|
124
|
-
time: Date;
|
|
125
|
-
type: EdgeLogType;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export type EdgeBreadcrumbEvent = {
|
|
129
|
-
message: string;
|
|
130
|
-
metadata: JsonObject;
|
|
131
|
-
source: string;
|
|
132
|
-
time: Date;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export type EdgeCrashEvent = {
|
|
136
|
-
error: mixed;
|
|
137
|
-
metadata: JsonObject;
|
|
138
|
-
source: string;
|
|
139
|
-
time: Date;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Receives crash reports.
|
|
144
|
-
* The app should implement this interface and pass it to the context.
|
|
145
|
-
*/
|
|
146
|
-
export type EdgeCrashReporter = {
|
|
147
|
-
+logBreadcrumb: (breadcrumb: EdgeBreadcrumbEvent) => void;
|
|
148
|
-
+logCrash: (crash: EdgeCrashEvent) => void;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Receives log messages.
|
|
153
|
-
* The app should implement this function and pass it to the context.
|
|
154
|
-
*/
|
|
155
|
-
export type EdgeOnLog = (event: EdgeLogEvent) => void;
|
|
156
|
-
|
|
157
|
-
// plugins -------------------------------------------------------------
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* On React Native, each plugin can provide a bridge to whatever native
|
|
161
|
-
* io it needs.
|
|
162
|
-
*/
|
|
163
|
-
export type EdgeNativeIo = {
|
|
164
|
-
[packageName: string]: EdgeOtherMethods;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* All core plugins receive these options at creation time.
|
|
169
|
-
*/
|
|
170
|
-
export type EdgeCorePluginOptions = {
|
|
171
|
-
/** Load-time options (like API keys) passed into the context */
|
|
172
|
-
initOptions: JsonObject;
|
|
173
|
-
|
|
174
|
-
/** Data provided by the info server */
|
|
175
|
-
infoPayload: JsonObject;
|
|
176
|
-
|
|
177
|
-
// Access to the world outside the plugin:
|
|
178
|
-
io: EdgeIo;
|
|
179
|
-
log: EdgeLog; // Plugin-scoped logging
|
|
180
|
-
nativeIo: EdgeNativeIo; // Only filled in on React Native
|
|
181
|
-
pluginDisklet: Disklet; // Plugin-scoped local storage
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// ---------------------------------------------------------------------
|
|
185
|
-
// key types
|
|
186
|
-
// ---------------------------------------------------------------------
|
|
187
|
-
|
|
188
|
-
export type EdgeWalletInfo = {
|
|
189
|
-
id: string;
|
|
190
|
-
type: string;
|
|
191
|
-
keys: JsonObject;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export type EdgeWalletInfoFull = EdgeWalletInfo & {
|
|
195
|
-
appIds: string[];
|
|
196
|
-
archived: boolean;
|
|
197
|
-
created?: Date;
|
|
198
|
-
deleted: boolean;
|
|
199
|
-
hidden: boolean;
|
|
200
|
-
imported?: boolean;
|
|
201
|
-
migratedFromWalletId?: string;
|
|
202
|
-
sortIndex: number;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
export type EdgeWalletState = {
|
|
206
|
-
archived?: boolean;
|
|
207
|
-
deleted?: boolean;
|
|
208
|
-
hidden?: boolean;
|
|
209
|
-
migratedFromWalletId?: string;
|
|
210
|
-
sortIndex?: number;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export type EdgeWalletStates = {
|
|
214
|
-
[walletId: string]: EdgeWalletState;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// ---------------------------------------------------------------------
|
|
218
|
-
// currency types
|
|
219
|
-
// ---------------------------------------------------------------------
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Different currencies support different types of on-chain memos,
|
|
223
|
-
* so this structure describes the options that are available,
|
|
224
|
-
* along with the applicable limits.
|
|
225
|
-
*/
|
|
226
|
-
export type EdgeMemoOption =
|
|
227
|
-
| {
|
|
228
|
-
type: "text";
|
|
229
|
-
hidden?: boolean;
|
|
230
|
-
memoName?: string;
|
|
231
|
-
|
|
232
|
-
/** Maximum number of text characters */
|
|
233
|
-
maxLength?: number;
|
|
234
|
-
}
|
|
235
|
-
| {
|
|
236
|
-
type: "number";
|
|
237
|
-
hidden?: boolean;
|
|
238
|
-
memoName?: string;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Maximum numerical value.
|
|
242
|
-
* Numbers are passed as decimal strings.
|
|
243
|
-
*/
|
|
244
|
-
maxValue?: string;
|
|
245
|
-
}
|
|
246
|
-
| {
|
|
247
|
-
type: "hex";
|
|
248
|
-
hidden?: boolean;
|
|
249
|
-
memoName?: string;
|
|
250
|
-
|
|
251
|
-
/** Number of hexadecimal bytes. */
|
|
252
|
-
maxBytes?: number;
|
|
253
|
-
minBytes?: number;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
export type EdgeMemo = {
|
|
257
|
-
type: "text" | "number" | "hex";
|
|
258
|
-
value: string;
|
|
259
|
-
|
|
260
|
-
/** Should we hide this from the user, such as for OP_RETURN? */
|
|
261
|
-
hidden?: boolean;
|
|
262
|
-
|
|
263
|
-
/** What does the chain call this? Defaults to "memo". */
|
|
264
|
-
memoName?: string;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export type EdgeAssetAmount = {
|
|
268
|
-
pluginId: string;
|
|
269
|
-
tokenId: EdgeTokenId;
|
|
270
|
-
nativeAmount?: string;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export type EdgeFiatAmount = {
|
|
274
|
-
// core-js style fiat code including 'iso:'
|
|
275
|
-
fiatCurrencyCode: string;
|
|
276
|
-
fiatAmount: string;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export type EdgeTxActionSwap = {
|
|
280
|
-
actionType: "swap";
|
|
281
|
-
swapInfo: EdgeSwapInfo;
|
|
282
|
-
orderId?: string;
|
|
283
|
-
orderUri?: string;
|
|
284
|
-
isEstimate?: boolean;
|
|
285
|
-
canBePartial?: boolean;
|
|
286
|
-
fromAsset: EdgeAssetAmount;
|
|
287
|
-
toAsset: EdgeAssetAmount;
|
|
288
|
-
payoutAddress: string;
|
|
289
|
-
payoutWalletId: string;
|
|
290
|
-
refundAddress?: string;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export type EdgeTxActionStake = {
|
|
294
|
-
actionType: "stake";
|
|
295
|
-
pluginId: string;
|
|
296
|
-
stakeAssets: EdgeAssetAmount[];
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
export type EdgeTxActionFiat = {
|
|
300
|
-
actionType: "fiat";
|
|
301
|
-
|
|
302
|
-
orderId: string;
|
|
303
|
-
orderUri?: string;
|
|
304
|
-
isEstimate: boolean;
|
|
305
|
-
|
|
306
|
-
fiatPlugin: {
|
|
307
|
-
providerId: string;
|
|
308
|
-
providerDisplayName: string;
|
|
309
|
-
supportEmail?: string;
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
payinAddress?: string;
|
|
313
|
-
payoutAddress?: string;
|
|
314
|
-
fiatAsset: EdgeFiatAmount;
|
|
315
|
-
cryptoAsset: EdgeAssetAmount;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
export type EdgeTxActionTokenApproval = {
|
|
319
|
-
actionType: "tokenApproval";
|
|
320
|
-
tokenApproved: EdgeAssetAmount;
|
|
321
|
-
tokenContractAddress: string;
|
|
322
|
-
contractAddress: string;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
export type EdgeTxActionGiftCard = {
|
|
326
|
-
actionType: "giftCard";
|
|
327
|
-
orderId: string;
|
|
328
|
-
orderUri?: string;
|
|
329
|
-
productId?: string;
|
|
330
|
-
quoteId?: string;
|
|
331
|
-
|
|
332
|
-
provider: {
|
|
333
|
-
providerId: string;
|
|
334
|
-
displayName: string;
|
|
335
|
-
supportEmail?: string;
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
card: {
|
|
339
|
-
name: string;
|
|
340
|
-
imageUrl?: string;
|
|
341
|
-
fiatAmount: string;
|
|
342
|
-
fiatCurrencyCode: string;
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
redemption?: {
|
|
346
|
-
code?: string;
|
|
347
|
-
url?: string;
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
export type EdgeTxAction =
|
|
352
|
-
| EdgeTxActionSwap
|
|
353
|
-
| EdgeTxActionStake
|
|
354
|
-
| EdgeTxActionFiat
|
|
355
|
-
| EdgeTxActionTokenApproval
|
|
356
|
-
| EdgeTxActionGiftCard;
|
|
357
|
-
|
|
358
|
-
export type EdgeTxAmount = {
|
|
359
|
-
tokenId: EdgeTokenId;
|
|
360
|
-
nativeAmount: string;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
export type EdgeAssetActionType =
|
|
364
|
-
| "claim"
|
|
365
|
-
| "claimOrder"
|
|
366
|
-
| "stake"
|
|
367
|
-
| "stakeNetworkFee"
|
|
368
|
-
| "stakeOrder"
|
|
369
|
-
| "unstake"
|
|
370
|
-
| "unstakeNetworkFee"
|
|
371
|
-
| "unstakeOrder"
|
|
372
|
-
| "swap"
|
|
373
|
-
| "swapNetworkFee"
|
|
374
|
-
| "swapOrderPost"
|
|
375
|
-
| "swapOrderFill"
|
|
376
|
-
| "swapOrderCancel"
|
|
377
|
-
| "buy"
|
|
378
|
-
| "sell"
|
|
379
|
-
| "sellNetworkFee"
|
|
380
|
-
| "tokenApproval"
|
|
381
|
-
| "transfer"
|
|
382
|
-
| "transferNetworkFee"
|
|
383
|
-
| "giftCard";
|
|
384
|
-
|
|
385
|
-
export type EdgeAssetAction = {
|
|
386
|
-
assetActionType: EdgeAssetActionType;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// token info ----------------------------------------------------------
|
|
390
|
-
|
|
391
|
-
export type EdgeDenomination = {
|
|
392
|
-
// Multiply a display amount by this number to get the native amount.
|
|
393
|
-
// BTC would use "100000000", for instance:
|
|
394
|
-
multiplier: string;
|
|
395
|
-
|
|
396
|
-
// A display name for this denomination, like "BTC", "bits", or "sats":
|
|
397
|
-
name: string;
|
|
398
|
-
|
|
399
|
-
// A prefix to add to the formatted number, like "₿", "ƀ", or "s":
|
|
400
|
-
symbol?: string;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Information used to display a token or currency to the user.
|
|
405
|
-
*/
|
|
406
|
-
export type EdgeToken = {
|
|
407
|
-
// The short code used on exchanges, such as "BTC":
|
|
408
|
-
currencyCode: string;
|
|
409
|
-
|
|
410
|
-
// How many decimal places to shift the native amount.
|
|
411
|
-
// The first item in this array is always the default for exchanges:
|
|
412
|
-
denominations: EdgeDenomination[];
|
|
413
|
-
|
|
414
|
-
// The full marketing name, such as "Bitcoin":
|
|
415
|
-
displayName: string;
|
|
416
|
-
|
|
417
|
-
// Each currency plugin decides what this contains,
|
|
418
|
-
// such as a contract address.
|
|
419
|
-
// This may be `undefined` for special built-in tokens
|
|
420
|
-
// such as staking balances.
|
|
421
|
-
networkLocation: JsonObject | void;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* A normal tokenId (chosen by the currency plugin),
|
|
426
|
-
* or `null` to indicate the parent currency (such as "ETH").
|
|
427
|
-
*/
|
|
428
|
-
export type EdgeTokenId = string | null;
|
|
429
|
-
|
|
430
|
-
export type EdgeTokenMap = {
|
|
431
|
-
// Each currency plugin decides how to generate this ID,
|
|
432
|
-
// such as by using the contract address:
|
|
433
|
-
[tokenId: string]: EdgeToken;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Available tokens stored in the `EdgeCurrencyInfo`,
|
|
438
|
-
* or parsed out of URI's.
|
|
439
|
-
*/
|
|
440
|
-
export type EdgeMetaToken = {
|
|
441
|
-
currencyCode: string;
|
|
442
|
-
currencyName: string;
|
|
443
|
-
contractAddress?: string;
|
|
444
|
-
|
|
445
|
-
denominations: EdgeDenomination[];
|
|
446
|
-
symbolImage?: string;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Tokens passed to `addCustomToken`.
|
|
451
|
-
*/
|
|
452
|
-
export type EdgeTokenInfo = {
|
|
453
|
-
currencyCode: string;
|
|
454
|
-
currencyName: string;
|
|
455
|
-
contractAddress: string;
|
|
456
|
-
|
|
457
|
-
multiplier: string;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
export type EdgeSubscribedAddress = {
|
|
461
|
-
address: string;
|
|
462
|
-
checkpoint?: string;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* The search parameter for {@link EdgeCurrencyConfig.getTokenDetails} and
|
|
467
|
-
* {@link EdgeCurrencyTools.getTokenDetails}.
|
|
468
|
-
*/
|
|
469
|
-
export type EdgeGetTokenDetailsFilter = {
|
|
470
|
-
/** Contract address or other unique onchain identifier. */
|
|
471
|
-
contractAddress?: string;
|
|
472
|
-
/** Ticker symbol for the currency. */
|
|
473
|
-
currencyCode?: string;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
// currency info -------------------------------------------------------
|
|
477
|
-
|
|
478
|
-
export type EdgeObjectTemplate = Array<
|
|
479
|
-
| {
|
|
480
|
-
// Displayed as a decimal number, but saved as an integer string.
|
|
481
|
-
// The multiplier gives the position of the display decimal point.
|
|
482
|
-
// This is only used for custom fees.
|
|
483
|
-
// It is *not* supported for custom tokens:
|
|
484
|
-
type: "nativeAmount";
|
|
485
|
-
key: string;
|
|
486
|
-
displayName: string;
|
|
487
|
-
displayMultiplier: string;
|
|
488
|
-
}
|
|
489
|
-
| {
|
|
490
|
-
// An integer, saved as a JavaScript `number` type:
|
|
491
|
-
type: "number";
|
|
492
|
-
key: string;
|
|
493
|
-
displayName: string;
|
|
494
|
-
}
|
|
495
|
-
| {
|
|
496
|
-
type: "string";
|
|
497
|
-
key: string;
|
|
498
|
-
displayName: string;
|
|
499
|
-
}
|
|
500
|
-
>;
|
|
501
|
-
|
|
502
|
-
export type EdgeCurrencyInfo = {
|
|
503
|
-
// Basic currency information:
|
|
504
|
-
+pluginId: string;
|
|
505
|
-
|
|
506
|
-
/** deprecated: refers to chain, use chainDisplayName instead */
|
|
507
|
-
displayName: string;
|
|
508
|
-
|
|
509
|
-
chainDisplayName: string;
|
|
510
|
-
assetDisplayName: string;
|
|
511
|
-
walletType: string;
|
|
512
|
-
|
|
513
|
-
// Native token information:
|
|
514
|
-
currencyCode: string;
|
|
515
|
-
denominations: EdgeDenomination[];
|
|
516
|
-
|
|
517
|
-
// Chain information:
|
|
518
|
-
canAdjustFees?: boolean; // Defaults to true
|
|
519
|
-
canImportKeys?: boolean; // Defaults to false
|
|
520
|
-
canReplaceByFee?: boolean; // Defaults to false
|
|
521
|
-
customFeeTemplate?: EdgeObjectTemplate; // Indicates custom fee support
|
|
522
|
-
customTokenTemplate?: EdgeObjectTemplate; // Indicates custom token support
|
|
523
|
-
requiredConfirmations?: number; // Block confirmations required for a tx
|
|
524
|
-
|
|
525
|
-
/** EVM chain id */
|
|
526
|
-
evmChainId?: number;
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Lists the types of memos this chain supports.
|
|
530
|
-
* A missing or empty list means no memo support.
|
|
531
|
-
*/
|
|
532
|
-
memoOptions?: EdgeMemoOption[];
|
|
533
|
-
|
|
534
|
-
/** True if the transaction can have multiple memos at once: */
|
|
535
|
-
multipleMemos?: boolean;
|
|
536
|
-
|
|
537
|
-
// Explorers:
|
|
538
|
-
addressExplorer: string;
|
|
539
|
-
blockExplorer?: string;
|
|
540
|
-
transactionExplorer: string;
|
|
541
|
-
xpubExplorer?: string;
|
|
542
|
-
|
|
543
|
-
// Flags:
|
|
544
|
-
unsafeBroadcastTx?: boolean;
|
|
545
|
-
unsafeMakeSpend?: boolean;
|
|
546
|
-
unsafeSyncNetwork?: boolean;
|
|
547
|
-
usesChangeServer?: boolean;
|
|
548
|
-
|
|
549
|
-
/** Show the total sync percentage with this many decimal digits */
|
|
550
|
-
syncDisplayPrecision?: number;
|
|
551
|
-
|
|
552
|
-
/** @deprecated The default user settings are always `{}` */
|
|
553
|
-
defaultSettings?: JsonObject;
|
|
554
|
-
|
|
555
|
-
/** @deprecated Use EdgeCurrencyPlugin.getBuiltinTokens instead */
|
|
556
|
-
metaTokens?: EdgeMetaToken[];
|
|
557
|
-
|
|
558
|
-
/** @deprecated Use memoOptions instead. */
|
|
559
|
-
memoMaxLength?: number; // Max number of text characters, if supported
|
|
560
|
-
|
|
561
|
-
/** @deprecated Use memoOptions instead. */
|
|
562
|
-
memoMaxValue?: string; // Max numerical value, if supported
|
|
563
|
-
|
|
564
|
-
/** @deprecated Use memoOptions instead. */
|
|
565
|
-
memoType?: "text" | "number" | "hex" | "other"; // undefined means no memo support
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
// spending ------------------------------------------------------------
|
|
569
|
-
|
|
570
|
-
export type EdgeMetadata = {
|
|
571
|
-
bizId?: number;
|
|
572
|
-
category?: string;
|
|
573
|
-
exchangeAmount?: { [fiatCurrencyCode: string]: number };
|
|
574
|
-
name?: string;
|
|
575
|
-
notes?: string;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
/**
|
|
579
|
-
* Like EdgeMetadata, but passing `null` will delete a saved value,
|
|
580
|
-
* while passing `undefined` will leave the value unchanged.
|
|
581
|
-
*/
|
|
582
|
-
export type EdgeMetadataChange = {
|
|
583
|
-
bizId?: number | null;
|
|
584
|
-
category?: string | null;
|
|
585
|
-
exchangeAmount?: { [fiatCurrencyCode: string]: number | null };
|
|
586
|
-
name?: string | null;
|
|
587
|
-
notes?: string | null;
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
export type EdgeTxSwap = {
|
|
591
|
-
orderId?: string;
|
|
592
|
-
orderUri?: string;
|
|
593
|
-
isEstimate: boolean;
|
|
594
|
-
|
|
595
|
-
// The EdgeSwapInfo from the swap plugin:
|
|
596
|
-
plugin: {
|
|
597
|
-
pluginId: string;
|
|
598
|
-
displayName: string;
|
|
599
|
-
supportEmail?: string;
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
// Address information:
|
|
603
|
-
payoutAddress: string;
|
|
604
|
-
payoutCurrencyCode: string;
|
|
605
|
-
payoutNativeAmount: string;
|
|
606
|
-
payoutTokenId?: EdgeTokenId;
|
|
607
|
-
payoutWalletId: string;
|
|
608
|
-
refundAddress?: string;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
export type EdgeConfirmationState =
|
|
612
|
-
// More than `EdgeCurrencyInfo.requiredConfirmations`:
|
|
613
|
-
| "confirmed"
|
|
614
|
-
// Dropped from the network without confirmations:
|
|
615
|
-
| "dropped"
|
|
616
|
-
// Confirmed, but failed on-chain execution (exceeded gas limit,
|
|
617
|
-
// smart-contract failure, etc):
|
|
618
|
-
| "failed"
|
|
619
|
-
// We don't know the chain height yet:
|
|
620
|
-
| "syncing"
|
|
621
|
-
// No confirmations yet:
|
|
622
|
-
| "unconfirmed"
|
|
623
|
-
// Something between 1 and `requiredConfirmations`.
|
|
624
|
-
// Currency engines can always return a number,
|
|
625
|
-
// and the core will translate it into one of the other states:
|
|
626
|
-
| number;
|
|
627
|
-
|
|
628
|
-
export type EdgeTransaction = {
|
|
629
|
-
/**
|
|
630
|
-
* The asset used to query this transaction.
|
|
631
|
-
* The amounts and metadata will reflect the chosen asset.
|
|
632
|
-
*/
|
|
633
|
-
tokenId: EdgeTokenId;
|
|
634
|
-
|
|
635
|
-
// Amounts:
|
|
636
|
-
nativeAmount: string;
|
|
637
|
-
networkFees: EdgeTxAmount[];
|
|
638
|
-
|
|
639
|
-
// Confirmation status:
|
|
640
|
-
confirmations?: EdgeConfirmationState;
|
|
641
|
-
blockHeight: number;
|
|
642
|
-
date: number;
|
|
643
|
-
|
|
644
|
-
// Transaction info:
|
|
645
|
-
txid: string;
|
|
646
|
-
signedTx: string;
|
|
647
|
-
memos: EdgeMemo[];
|
|
648
|
-
ourReceiveAddresses: string[];
|
|
649
|
-
|
|
650
|
-
/** App-provided per-asset action data */
|
|
651
|
-
assetAction?: EdgeAssetAction;
|
|
652
|
-
|
|
653
|
-
/** Plugin-provided action data for all assets in a transaction */
|
|
654
|
-
chainAction?: EdgeTxAction;
|
|
655
|
-
|
|
656
|
-
/** Plugin-provided per-asset action data */
|
|
657
|
-
chainAssetAction?: EdgeAssetAction;
|
|
658
|
-
|
|
659
|
-
/** App-provided action data for all assets in a transaction */
|
|
660
|
-
savedAction?: EdgeTxAction;
|
|
661
|
-
|
|
662
|
-
/** This has the same format as the `customNetworkFee` */
|
|
663
|
-
feeRateUsed?: JsonObject;
|
|
664
|
-
|
|
665
|
-
// Spend-specific metadata:
|
|
666
|
-
deviceDescription?: string;
|
|
667
|
-
networkFeeOption?: "high" | "standard" | "low" | "custom";
|
|
668
|
-
requestedCustomFee?: JsonObject;
|
|
669
|
-
spendTargets?: Array<{
|
|
670
|
-
+currencyCode: string; // Saved for future reference
|
|
671
|
-
+nativeAmount: string;
|
|
672
|
-
+publicAddress: string;
|
|
673
|
-
|
|
674
|
-
/** @deprecated Use `EdgeTransaction.memos` instead */
|
|
675
|
-
+memo: string | void;
|
|
676
|
-
|
|
677
|
-
/** @deprecated Use `EdgeTransaction.memos` instead */
|
|
678
|
-
+uniqueIdentifier: string | void;
|
|
679
|
-
}>;
|
|
680
|
-
swapData?: EdgeTxSwap;
|
|
681
|
-
txSecret?: string; // Monero decryption key
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* True if the user themselves signed & sent this transaction.
|
|
685
|
-
* This will not be true for transactions created by other users,
|
|
686
|
-
* smart contracts, assets becoming unstaked, or anything else automatic.
|
|
687
|
-
* A send doesn't necessarily spend money, although it often does.
|
|
688
|
-
*/
|
|
689
|
-
isSend: boolean;
|
|
690
|
-
|
|
691
|
-
// Core:
|
|
692
|
-
metadata?: EdgeMetadata;
|
|
693
|
-
walletId: string;
|
|
694
|
-
otherParams?: JsonObject;
|
|
695
|
-
|
|
696
|
-
/** @deprecated Use tokenId instead */
|
|
697
|
-
currencyCode: string;
|
|
698
|
-
|
|
699
|
-
/** @deprecated Use networkFees instead */
|
|
700
|
-
networkFee: string;
|
|
701
|
-
|
|
702
|
-
/** @deprecated Use networkFees instead */
|
|
703
|
-
parentNetworkFee?: string;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
export type EdgeTransactionEvent = {
|
|
707
|
-
isNew: boolean;
|
|
708
|
-
transaction: EdgeTransaction;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
export type EdgeSpendTarget = {
|
|
712
|
-
nativeAmount?: string;
|
|
713
|
-
otherParams?: JsonObject;
|
|
714
|
-
publicAddress?: string;
|
|
715
|
-
|
|
716
|
-
/** @deprecated. Use `EdgeSpendInfo.memos` instead. */
|
|
717
|
-
memo?: string;
|
|
718
|
-
|
|
719
|
-
/** @deprecated. Use `EdgeSpendInfo.memos` instead. */
|
|
720
|
-
uniqueIdentifier?: string; // Use memo instead.
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
export type EdgePaymentProtocolInfo = {
|
|
724
|
-
domain: string;
|
|
725
|
-
memo: string;
|
|
726
|
-
merchant: string;
|
|
727
|
-
nativeAmount: string;
|
|
728
|
-
spendTargets: EdgeSpendTarget[];
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
export type EdgeSpendInfo = {
|
|
732
|
-
// Basic information:
|
|
733
|
-
tokenId: EdgeTokenId;
|
|
734
|
-
privateKeys?: string[];
|
|
735
|
-
spendTargets: EdgeSpendTarget[];
|
|
736
|
-
memos?: EdgeMemo[];
|
|
737
|
-
|
|
738
|
-
// Options:
|
|
739
|
-
noUnconfirmed?: boolean;
|
|
740
|
-
networkFeeOption?: "high" | "standard" | "low" | "custom";
|
|
741
|
-
customNetworkFee?: JsonObject; // Some kind of currency-specific JSON
|
|
742
|
-
/** Enables RBF on chains where RBF is optional */
|
|
743
|
-
enableRbf?: boolean;
|
|
744
|
-
pendingTxs?: EdgeTransaction[];
|
|
745
|
-
/** @deprecated Use EdgeCurrencyWallet.accelerate instead */
|
|
746
|
-
rbfTxid?: string;
|
|
747
|
-
skipChecks?: boolean;
|
|
748
|
-
|
|
749
|
-
// Core:
|
|
750
|
-
assetAction?: EdgeAssetAction;
|
|
751
|
-
savedAction?: EdgeTxAction;
|
|
752
|
-
metadata?: EdgeMetadata;
|
|
753
|
-
swapData?: EdgeTxSwap;
|
|
754
|
-
otherParams?: JsonObject;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
// query data ----------------------------------------------------------
|
|
758
|
-
|
|
759
|
-
export type EdgeDataDump = {
|
|
760
|
-
walletId: string;
|
|
761
|
-
walletType: string;
|
|
762
|
-
data: {
|
|
763
|
-
[dataCache: string]: JsonObject;
|
|
764
|
-
};
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
/**
|
|
768
|
-
* Addresses may appear in any order that the plugin chooses,
|
|
769
|
-
* based on how the user should see them. If you need a specific address type,
|
|
770
|
-
* use the `addressType` to find what you need.
|
|
771
|
-
*/
|
|
772
|
-
export type EdgeAddress = {
|
|
773
|
-
addressType: string; // 'publicAddress' | 'segwitAddress' | 'legacyAddress' | 'fooAddress'
|
|
774
|
-
publicAddress: string;
|
|
775
|
-
nativeBalance?: string;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
/** @deprecated */
|
|
779
|
-
export type EdgeFreshAddress = {
|
|
780
|
-
publicAddress: string;
|
|
781
|
-
segwitAddress?: string;
|
|
782
|
-
legacyAddress?: string;
|
|
783
|
-
nativeBalance?: string;
|
|
784
|
-
segwitNativeBalance?: string;
|
|
785
|
-
legacyNativeBalance?: string;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
/**
|
|
789
|
-
* Balances, unlock dates, and other information about staked funds.
|
|
790
|
-
*
|
|
791
|
-
* The currency engine is responsible for keeping this up to date.
|
|
792
|
-
* For instance, if the user submits a transaction to unlock funds,
|
|
793
|
-
* the engine should update this data once it detects that transaction,
|
|
794
|
-
* and then again once the funds actually unlock some time later.
|
|
795
|
-
*
|
|
796
|
-
* As with wallet balances, this data may not be reliable until the
|
|
797
|
-
* `syncRatio` hits 1.
|
|
798
|
-
*/
|
|
799
|
-
export type EdgeStakingStatus = {
|
|
800
|
-
// Funds can be in various stages of being locked or unlocked,
|
|
801
|
-
// so each row can describe a single batch of locked coins.
|
|
802
|
-
// Adding together the rows in this array should give the
|
|
803
|
-
// total amount of locked-up funds in the wallet:
|
|
804
|
-
stakedAmounts: Array<{
|
|
805
|
-
nativeAmount: string;
|
|
806
|
-
|
|
807
|
-
// Maybe these funds are not the chain's parent currency:
|
|
808
|
-
// tokenId?: string,
|
|
809
|
-
|
|
810
|
-
// Maybe these funds are being unlocked?
|
|
811
|
-
unlockDate?: Date;
|
|
812
|
-
|
|
813
|
-
// Feel free to add other weird coin states here.
|
|
814
|
-
// We can standardize them later if they are common:
|
|
815
|
-
otherParams?: JsonObject;
|
|
816
|
-
}>;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
/**
|
|
820
|
-
* Reports a currency wallet's blockchain syncing progress.
|
|
821
|
-
*/
|
|
822
|
-
export type EdgeSyncStatus = {
|
|
823
|
-
/** A single "overview" value of the sync state from 0 to 1. */
|
|
824
|
-
totalRatio: number;
|
|
825
|
-
|
|
826
|
-
/** How far along the chain we are, for chains that scan by blocks. */
|
|
827
|
-
blockRatio?: [number, number]; // [ourHeight: number, chainHeight: number]
|
|
828
|
-
|
|
829
|
-
/**
|
|
830
|
-
* Free-form values to show the user, for engines with unusual info.
|
|
831
|
-
* For example: `{ "donwload speed": "1 KB/s" }`
|
|
832
|
-
*/
|
|
833
|
-
otherParams?: { [name: string]: string }; // Record<string, string>
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
export type EdgeTxidMap = {
|
|
837
|
-
[txid: string]: number;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
// URI -----------------------------------------------------------------
|
|
841
|
-
|
|
842
|
-
export type WalletConnect = {
|
|
843
|
-
uri: string;
|
|
844
|
-
topic: string;
|
|
845
|
-
version?: string;
|
|
846
|
-
bridge?: string;
|
|
847
|
-
key?: string;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
export type EdgeParsedUri = {
|
|
851
|
-
bitIDCallbackUri?: string;
|
|
852
|
-
bitIDDomain?: string;
|
|
853
|
-
bitidKycProvider?: string; // Experimental
|
|
854
|
-
bitidKycRequest?: string; // Experimental
|
|
855
|
-
bitidPaymentAddress?: string; // Experimental
|
|
856
|
-
bitIDURI?: string;
|
|
857
|
-
expireDate?: Date;
|
|
858
|
-
legacyAddress?: string;
|
|
859
|
-
metadata?: EdgeMetadata;
|
|
860
|
-
minNativeAmount?: string;
|
|
861
|
-
nativeAmount?: string;
|
|
862
|
-
paymentProtocolUrl?: string;
|
|
863
|
-
privateKeys?: string[];
|
|
864
|
-
publicAddress?: string;
|
|
865
|
-
returnUri?: string;
|
|
866
|
-
segwitAddress?: string;
|
|
867
|
-
token?: EdgeMetaToken;
|
|
868
|
-
tokenId?: EdgeTokenId;
|
|
869
|
-
uniqueIdentifier?: string; // Ripple payment id
|
|
870
|
-
walletConnect?: WalletConnect;
|
|
871
|
-
|
|
872
|
-
/** @deprecated Use tokenId instead */
|
|
873
|
-
currencyCode?: string;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
export type EdgeEncodeUri = {
|
|
877
|
-
publicAddress: string;
|
|
878
|
-
nativeAmount?: string;
|
|
879
|
-
label?: string;
|
|
880
|
-
message?: string;
|
|
881
|
-
currencyCode?: string;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
// options -------------------------------------------------------------
|
|
885
|
-
|
|
886
|
-
export type EdgeTokenIdOptions = {
|
|
887
|
-
tokenId: EdgeTokenId;
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
export type EdgeGetTransactionsOptions = {
|
|
891
|
-
// Filtering:
|
|
892
|
-
startDate?: Date;
|
|
893
|
-
endDate?: Date;
|
|
894
|
-
searchString?: string;
|
|
895
|
-
spamThreshold?: string;
|
|
896
|
-
tokenId: EdgeTokenId;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
export type EdgeStreamTransactionOptions = {
|
|
900
|
-
/**
|
|
901
|
-
* The number of entries to return in each batch.
|
|
902
|
-
* Defaults to something reasonable, like 10.
|
|
903
|
-
*/
|
|
904
|
-
batchSize?: number;
|
|
905
|
-
|
|
906
|
-
/**
|
|
907
|
-
* The number entries to return on the first batch.
|
|
908
|
-
* Defaults to `batchSize`.
|
|
909
|
-
*/
|
|
910
|
-
firstBatchSize?: number;
|
|
911
|
-
|
|
912
|
-
/** Only return transactions newer than this date */
|
|
913
|
-
afterDate?: Date;
|
|
914
|
-
|
|
915
|
-
/** Only return transactions older than this date */
|
|
916
|
-
beforeDate?: Date;
|
|
917
|
-
|
|
918
|
-
/** Only return transactions matching this string */
|
|
919
|
-
searchString?: string;
|
|
920
|
-
|
|
921
|
-
/** Filter incoming transactions with a `nativeAmount` below this */
|
|
922
|
-
spamThreshold?: string;
|
|
923
|
-
|
|
924
|
-
/** The token to query, or undefined for the main currency */
|
|
925
|
-
tokenId: EdgeTokenId;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
export type EdgeGetReceiveAddressOptions = EdgeTokenIdOptions & {
|
|
929
|
-
forceIndex?: number;
|
|
930
|
-
};
|
|
931
|
-
|
|
932
|
-
export type EdgeEngineActivationOptions = {
|
|
933
|
-
// If null, activate parent wallet:
|
|
934
|
-
activateTokenIds: EdgeTokenId[];
|
|
935
|
-
|
|
936
|
-
// Wallet if the user is paying with a different currency:
|
|
937
|
-
paymentInfo?: {
|
|
938
|
-
wallet: EdgeCurrencyWallet;
|
|
939
|
-
tokenId: EdgeTokenId;
|
|
940
|
-
};
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
export type EdgeEngineGetActivationAssetsOptions = {
|
|
944
|
-
// All wallets in the users account. This allows the engine to choose
|
|
945
|
-
// which wallets can fulfill this activation request
|
|
946
|
-
currencyWallets: { [walletId: string]: EdgeCurrencyWallet };
|
|
947
|
-
|
|
948
|
-
// If null, activate parent wallet:
|
|
949
|
-
activateTokenIds: EdgeTokenId[];
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
export type EdgeEnginePrivateKeyOptions = {
|
|
953
|
-
privateKeys?: JsonObject;
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
export type EdgeEngineSyncNetworkOptions = {
|
|
957
|
-
subscribeParam?: {
|
|
958
|
-
address: string;
|
|
959
|
-
/**
|
|
960
|
-
* The checkpoint from the change-server. Mempool transactions are an
|
|
961
|
-
* example of updates without checkpoints.
|
|
962
|
-
* */
|
|
963
|
-
checkpoint?: string;
|
|
964
|
-
/**
|
|
965
|
-
* This explicitly denotes that the wallet needs to sync the network.
|
|
966
|
-
* If undefined, assumed to be `true` (default is `true`).
|
|
967
|
-
*/
|
|
968
|
-
needsSync?: boolean;
|
|
969
|
-
};
|
|
970
|
-
privateKeys?: JsonObject;
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
export type EdgeSaveTxActionOptions = {
|
|
974
|
-
txid: string;
|
|
975
|
-
tokenId: EdgeTokenId;
|
|
976
|
-
assetAction: EdgeAssetAction;
|
|
977
|
-
savedAction: EdgeTxAction;
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
export type EdgeSaveTxMetadataOptions = {
|
|
981
|
-
txid: string;
|
|
982
|
-
tokenId: EdgeTokenId;
|
|
983
|
-
metadata: EdgeMetadataChange;
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
export type EdgeSignMessageOptions = {
|
|
987
|
-
otherParams?: JsonObject;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
// engine --------------------------------------------------------------
|
|
991
|
-
|
|
992
|
-
export type EdgeCurrencyEngineCallbacks = {
|
|
993
|
-
+onAddressChanged: () => void;
|
|
994
|
-
+onNewTokens: (tokenIds: string[]) => void;
|
|
995
|
-
+onSeenTxCheckpoint: (checkpoint: string) => void;
|
|
996
|
-
+onStakingStatusChanged: (status: EdgeStakingStatus) => void;
|
|
997
|
-
+onSubscribeAddresses: (
|
|
998
|
-
paramsOrAddresses:
|
|
999
|
-
| EdgeSubscribedAddress[]
|
|
1000
|
-
/** @deprecated Use the array of EdgeSubscribedAddress objects instead. */
|
|
1001
|
-
| string[],
|
|
1002
|
-
) => void;
|
|
1003
|
-
+onSyncStatusChanged: (syncStatus: EdgeSyncStatus) => void;
|
|
1004
|
-
+onTokenBalanceChanged: (
|
|
1005
|
-
tokenId: EdgeTokenId,
|
|
1006
|
-
balance: string,
|
|
1007
|
-
) => void;
|
|
1008
|
-
+onTransactions: (transactionEvents: EdgeTransactionEvent[]) => void;
|
|
1009
|
-
+onTxidsChanged: (txids: EdgeTxidMap) => void;
|
|
1010
|
-
+onUnactivatedTokenIdsChanged: (
|
|
1011
|
-
unactivatedTokenIds: string[],
|
|
1012
|
-
) => void;
|
|
1013
|
-
+onWcNewContractCall: (payload: JsonObject) => void;
|
|
1014
|
-
|
|
1015
|
-
/** @deprecated Use onSyncStatusChanged */
|
|
1016
|
-
+onAddressesChecked: (progressRatio: number) => void;
|
|
1017
|
-
|
|
1018
|
-
/** @deprecated onTransactionsChanged handles confirmation changes */
|
|
1019
|
-
+onBlockHeightChanged: (blockHeight: number) => void;
|
|
1020
|
-
|
|
1021
|
-
/** @deprecated Use onTokenBalanceChanged instead */
|
|
1022
|
-
+onBalanceChanged: (
|
|
1023
|
-
currencyCode: string,
|
|
1024
|
-
nativeBalance: string,
|
|
1025
|
-
) => void;
|
|
1026
|
-
|
|
1027
|
-
/** @deprecated Use onTransactions */
|
|
1028
|
-
+onTransactionsChanged: (transactions: EdgeTransaction[]) => void;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
export type EdgeCurrencyEngineOptions = {
|
|
1032
|
-
callbacks: EdgeCurrencyEngineCallbacks;
|
|
1033
|
-
|
|
1034
|
-
// Engine state kept by the core:
|
|
1035
|
-
seenTxCheckpoint?: string;
|
|
1036
|
-
subscribedAddresses?: EdgeSubscribedAddress[];
|
|
1037
|
-
|
|
1038
|
-
/** True if we only need a balance and the ability to spend it. */
|
|
1039
|
-
lightMode?: boolean;
|
|
1040
|
-
|
|
1041
|
-
// Wallet-scoped IO objects:
|
|
1042
|
-
log: EdgeLog;
|
|
1043
|
-
walletLocalDisklet: Disklet;
|
|
1044
|
-
walletLocalEncryptedDisklet: Disklet;
|
|
1045
|
-
|
|
1046
|
-
// User settings:
|
|
1047
|
-
customTokens: EdgeTokenMap;
|
|
1048
|
-
enabledTokenIds: string[];
|
|
1049
|
-
userSettings: JsonObject | void;
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
export type EdgeCurrencyEngine = {
|
|
1053
|
-
+changeUserSettings: (settings: JsonObject) => Promise<void>;
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
* Starts any persistent resources the engine needs, such as WebSockets.
|
|
1057
|
-
* Engines should use `syncNetwork` for periodic tasks (polling),
|
|
1058
|
-
* rather than trying to manage those by itself.
|
|
1059
|
-
*/
|
|
1060
|
-
+startEngine: () => Promise<void>;
|
|
1061
|
-
|
|
1062
|
-
/**
|
|
1063
|
-
* Shut down the engine, including open sockets, timers,
|
|
1064
|
-
* and any in-progress tasks that support cancellation.
|
|
1065
|
-
*/
|
|
1066
|
-
+killEngine: () => Promise<void>;
|
|
1067
|
-
|
|
1068
|
-
/**
|
|
1069
|
-
* Polls the blockchain for updates.
|
|
1070
|
-
* The return value is the delay (in ms) that the engine wants to wait
|
|
1071
|
-
* before its next poll. For engines with active address subscriptions,
|
|
1072
|
-
* the core will ignore this number and simply wait for the next
|
|
1073
|
-
* on-chain update.
|
|
1074
|
-
* Engines with `EdgeCurrencyInfo.unsafeSyncNetwork`
|
|
1075
|
-
* will receive their private keys in the arguments.
|
|
1076
|
-
*/
|
|
1077
|
-
+syncNetwork?: (
|
|
1078
|
-
opts: EdgeEngineSyncNetworkOptions,
|
|
1079
|
-
) => Promise<number>;
|
|
1080
|
-
|
|
1081
|
-
// Engine status:
|
|
1082
|
-
+resyncBlockchain: () => Promise<void>;
|
|
1083
|
-
+dumpData: () => Promise<EdgeDataDump>;
|
|
1084
|
-
|
|
1085
|
-
// Chain state:
|
|
1086
|
-
+getBlockHeight: () => number;
|
|
1087
|
-
+getBalance: (opts: EdgeTokenIdOptions) => string;
|
|
1088
|
-
+getNumTransactions: (opts: EdgeTokenIdOptions) => number;
|
|
1089
|
-
+getTransactions: (
|
|
1090
|
-
opts: EdgeTokenIdOptions,
|
|
1091
|
-
) => Promise<EdgeTransaction[]>;
|
|
1092
|
-
+getTxids?: () => EdgeTxidMap;
|
|
1093
|
-
|
|
1094
|
-
// Tokens:
|
|
1095
|
-
+changeCustomTokens?: (tokens: EdgeTokenMap) => Promise<void>;
|
|
1096
|
-
+changeEnabledTokenIds?: (tokenIds: string[]) => Promise<void>;
|
|
1097
|
-
|
|
1098
|
-
// Asset activation:
|
|
1099
|
-
+engineGetActivationAssets?: (
|
|
1100
|
-
options: EdgeEngineGetActivationAssetsOptions,
|
|
1101
|
-
) => Promise<EdgeGetActivationAssetsResults>;
|
|
1102
|
-
+engineActivateWallet?: (
|
|
1103
|
-
options: EdgeEngineActivationOptions,
|
|
1104
|
-
) => Promise<EdgeActivationQuote>;
|
|
1105
|
-
|
|
1106
|
-
// Addresses:
|
|
1107
|
-
+getAddresses?: (
|
|
1108
|
-
opts: EdgeGetReceiveAddressOptions,
|
|
1109
|
-
) => Promise<EdgeAddress[]>;
|
|
1110
|
-
|
|
1111
|
-
/** @deprecated */
|
|
1112
|
-
+getFreshAddress: (
|
|
1113
|
-
opts: EdgeGetReceiveAddressOptions,
|
|
1114
|
-
) => Promise<EdgeFreshAddress>;
|
|
1115
|
-
+addGapLimitAddresses: (addresses: string[]) => Promise<void>;
|
|
1116
|
-
+isAddressUsed: (address: string) => Promise<boolean>;
|
|
1117
|
-
|
|
1118
|
-
// Spending:
|
|
1119
|
-
+getMaxSpendable?: (
|
|
1120
|
-
spendInfo: EdgeSpendInfo,
|
|
1121
|
-
opts?: EdgeEnginePrivateKeyOptions,
|
|
1122
|
-
) => Promise<string>;
|
|
1123
|
-
+makeSpend: (
|
|
1124
|
-
spendInfo: EdgeSpendInfo,
|
|
1125
|
-
opts?: EdgeEnginePrivateKeyOptions,
|
|
1126
|
-
) => Promise<EdgeTransaction>;
|
|
1127
|
-
+signTx: (
|
|
1128
|
-
transaction: EdgeTransaction,
|
|
1129
|
-
privateKeys: JsonObject,
|
|
1130
|
-
) => Promise<EdgeTransaction>;
|
|
1131
|
-
+broadcastTx: (
|
|
1132
|
-
transaction: EdgeTransaction,
|
|
1133
|
-
opts?: EdgeEnginePrivateKeyOptions,
|
|
1134
|
-
) => Promise<EdgeTransaction>;
|
|
1135
|
-
+saveTx: (transaction: EdgeTransaction) => Promise<void>;
|
|
1136
|
-
+sweepPrivateKeys?: (
|
|
1137
|
-
spendInfo: EdgeSpendInfo,
|
|
1138
|
-
) => Promise<EdgeTransaction>;
|
|
1139
|
-
+getPaymentProtocolInfo?: (
|
|
1140
|
-
paymentProtocolUrl: string,
|
|
1141
|
-
) => Promise<EdgePaymentProtocolInfo>;
|
|
1142
|
-
|
|
1143
|
-
// Signing:
|
|
1144
|
-
+signBytes?: (
|
|
1145
|
-
bytes: Uint8Array,
|
|
1146
|
-
privateKeys: JsonObject,
|
|
1147
|
-
opts: EdgeSignMessageOptions,
|
|
1148
|
-
) => Promise<string>;
|
|
1149
|
-
|
|
1150
|
-
// Accelerating:
|
|
1151
|
-
+accelerate?: (
|
|
1152
|
-
tx: EdgeTransaction,
|
|
1153
|
-
) => Promise<EdgeTransaction | null>;
|
|
1154
|
-
|
|
1155
|
-
// Staking:
|
|
1156
|
-
+getStakingStatus?: () => Promise<EdgeStakingStatus>;
|
|
1157
|
-
|
|
1158
|
-
// Escape hatch:
|
|
1159
|
-
+otherMethods?: EdgeOtherMethods;
|
|
1160
|
-
+otherMethodsWithKeys?: EdgeOtherMethods;
|
|
1161
|
-
|
|
1162
|
-
/** @deprecated Replaced by changeEnabledTokenIds */
|
|
1163
|
-
+enableTokens?: (tokens: string[]) => Promise<void>;
|
|
1164
|
-
|
|
1165
|
-
/** @deprecated Replaced by changeEnabledTokenIds */
|
|
1166
|
-
+disableTokens?: (tokens: string[]) => Promise<void>;
|
|
1167
|
-
|
|
1168
|
-
/** @deprecated Replaced by changeCustomTokens */
|
|
1169
|
-
+addCustomToken?: (token: EdgeTokenInfo & EdgeToken) => Promise<void>;
|
|
1170
|
-
|
|
1171
|
-
/** @deprecated Provide EdgeCurrencyTools.getDisplayPrivateKey: */
|
|
1172
|
-
+getDisplayPrivateSeed?: (privateKeys: JsonObject) => string | null;
|
|
1173
|
-
|
|
1174
|
-
/** @deprecated Provide EdgeCurrencyTools.getDisplayPublicKey: */
|
|
1175
|
-
+getDisplayPublicSeed?: () => string | null;
|
|
1176
|
-
|
|
1177
|
-
/**
|
|
1178
|
-
* @deprecated Replaced by `signBytes`.
|
|
1179
|
-
* Various plugins implement this function with inconsistent encodings.
|
|
1180
|
-
*/
|
|
1181
|
-
+signMessage?: (
|
|
1182
|
-
message: string,
|
|
1183
|
-
privateKeys: JsonObject,
|
|
1184
|
-
opts: EdgeSignMessageOptions,
|
|
1185
|
-
) => Promise<string>;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
// currency plugin -----------------------------------------------------
|
|
1189
|
-
|
|
1190
|
-
export type EdgeCurrencyTools = {
|
|
1191
|
-
// Keys:
|
|
1192
|
-
+checkPublicKey?: (publicKey: JsonObject) => Promise<boolean>;
|
|
1193
|
-
+createPrivateKey: (
|
|
1194
|
-
walletType: string,
|
|
1195
|
-
opts?: JsonObject,
|
|
1196
|
-
) => Promise<JsonObject>;
|
|
1197
|
-
+derivePublicKey: (
|
|
1198
|
-
privateWalletInfo: EdgeWalletInfo,
|
|
1199
|
-
) => Promise<JsonObject>;
|
|
1200
|
-
+getDisplayPrivateKey?: (
|
|
1201
|
-
privateWalletInfo: EdgeWalletInfo,
|
|
1202
|
-
) => Promise<string>;
|
|
1203
|
-
+getDisplayPublicKey?: (
|
|
1204
|
-
publicWalletInfo: EdgeWalletInfo,
|
|
1205
|
-
) => Promise<string>;
|
|
1206
|
-
+getDisplayPublicKeys?: (publicWalletInfo: EdgeWalletInfo) => {
|
|
1207
|
-
[key: string]: string;
|
|
1208
|
-
};
|
|
1209
|
-
+getSplittableTypes?: (
|
|
1210
|
-
publicWalletInfo: EdgeWalletInfo,
|
|
1211
|
-
) => string[] | Promise<string[]>;
|
|
1212
|
-
+importPrivateKey?: (
|
|
1213
|
-
key: string,
|
|
1214
|
-
opts?: JsonObject,
|
|
1215
|
-
) => Promise<JsonObject>;
|
|
1216
|
-
+getTokenDetails?: (
|
|
1217
|
-
filter: EdgeGetTokenDetailsFilter,
|
|
1218
|
-
) => Promise<EdgeToken[]>;
|
|
1219
|
-
|
|
1220
|
-
// Derives a tokenId string from a token's network information:
|
|
1221
|
-
+getTokenId?: (token: EdgeToken) => Promise<string>;
|
|
1222
|
-
|
|
1223
|
-
// URIs:
|
|
1224
|
-
+parseUri: (
|
|
1225
|
-
uri: string,
|
|
1226
|
-
currencyCode?: string,
|
|
1227
|
-
customTokens?: EdgeMetaToken[],
|
|
1228
|
-
) => Promise<EdgeParsedUri>;
|
|
1229
|
-
+encodeUri: (
|
|
1230
|
-
obj: EdgeEncodeUri,
|
|
1231
|
-
customTokens?: EdgeMetaToken[],
|
|
1232
|
-
) => Promise<string>;
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
export type EdgeCurrencyPlugin = {
|
|
1236
|
-
+currencyInfo: EdgeCurrencyInfo;
|
|
1237
|
-
|
|
1238
|
-
+getBuiltinTokens?: () => Promise<EdgeTokenMap>;
|
|
1239
|
-
+makeCurrencyTools: () => Promise<EdgeCurrencyTools>;
|
|
1240
|
-
+makeCurrencyEngine: (
|
|
1241
|
-
walletInfo: EdgeWalletInfo,
|
|
1242
|
-
opts: EdgeCurrencyEngineOptions,
|
|
1243
|
-
) => Promise<EdgeCurrencyEngine>;
|
|
1244
|
-
+updateInfoPayload?: (infoPayload: JsonObject) => Promise<void>;
|
|
1245
|
-
|
|
1246
|
-
// Escape hatch:
|
|
1247
|
-
+otherMethods?: EdgeOtherMethods;
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
// wallet --------------------------------------------------------------
|
|
1251
|
-
|
|
1252
|
-
export type EdgeBalances = {
|
|
1253
|
-
[currencyCode: string]: string;
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
export type EdgeBalanceMap = Map<EdgeTokenId, string>;
|
|
1257
|
-
|
|
1258
|
-
export type EdgeReceiveAddress = EdgeFreshAddress & {
|
|
1259
|
-
metadata: EdgeMetadata;
|
|
1260
|
-
nativeAmount: string;
|
|
1261
|
-
};
|
|
1262
|
-
|
|
1263
|
-
export type EdgeCurrencyWalletEvents = {
|
|
1264
|
-
addressChanged: void;
|
|
1265
|
-
close: void;
|
|
1266
|
-
enabledDetectedTokens: string[];
|
|
1267
|
-
newTransactions: EdgeTransaction[];
|
|
1268
|
-
transactionsChanged: EdgeTransaction[];
|
|
1269
|
-
|
|
1270
|
-
/**
|
|
1271
|
-
* Something has removed transactions,
|
|
1272
|
-
* so the GUI should refresh the transaction list.
|
|
1273
|
-
*
|
|
1274
|
-
* We may pass dropped txid's as `string[]` in the future.
|
|
1275
|
-
* A missing array means "check everything", such with resync.
|
|
1276
|
-
*/
|
|
1277
|
-
transactionsRemoved: void;
|
|
1278
|
-
|
|
1279
|
-
wcNewContractCall: JsonObject;
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
export type EdgeGetActivationAssetsOptions = {
|
|
1283
|
-
activateWalletId: string;
|
|
1284
|
-
// If null, activate parent wallet:
|
|
1285
|
-
activateTokenIds: EdgeTokenId[];
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
export type EdgeGetActivationAssetsResults = {
|
|
1289
|
-
assetOptions: Array<{
|
|
1290
|
-
paymentWalletId?: string; // If walletId is present, use MUST activate with this wallet
|
|
1291
|
-
currencyPluginId: string;
|
|
1292
|
-
tokenId: EdgeTokenId;
|
|
1293
|
-
}>;
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
export type EdgeActivationOptions = {
|
|
1297
|
-
activateWalletId: string;
|
|
1298
|
-
// If null, activate parent wallet:
|
|
1299
|
-
activateTokenIds: EdgeTokenId[];
|
|
1300
|
-
|
|
1301
|
-
// Wallet if the user is paying with a different currency:
|
|
1302
|
-
paymentInfo?: {
|
|
1303
|
-
walletId: string;
|
|
1304
|
-
tokenId: EdgeTokenId;
|
|
1305
|
-
};
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
export type EdgeActivationApproveOptions = {
|
|
1309
|
-
metadata?: EdgeMetadata;
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
export type EdgeActivationResult = {
|
|
1313
|
-
+transactions: EdgeTransaction[];
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
export type EdgeActivationQuote = {
|
|
1317
|
-
+paymentWalletId: string;
|
|
1318
|
-
+paymentTokenId: EdgeTokenId;
|
|
1319
|
-
|
|
1320
|
-
+fromNativeAmount: string;
|
|
1321
|
-
+networkFee: EdgeTxAmount & {
|
|
1322
|
-
/** @deprecated use contextual APIs to get the currency's pluginId */
|
|
1323
|
-
+currencyPluginId: string;
|
|
1324
|
-
};
|
|
1325
|
-
|
|
1326
|
-
+approve: (
|
|
1327
|
-
opts?: EdgeActivationApproveOptions,
|
|
1328
|
-
) => Promise<EdgeActivationResult>;
|
|
1329
|
-
close: () => Promise<void>;
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
export type EdgeCurrencyWallet = {
|
|
1333
|
-
+on: Subscriber<EdgeCurrencyWalletEvents>;
|
|
1334
|
-
+watch: Subscriber<EdgeCurrencyWallet>;
|
|
1335
|
-
|
|
1336
|
-
// Data store:
|
|
1337
|
-
+created: Date | void;
|
|
1338
|
-
+disklet: Disklet;
|
|
1339
|
-
+id: string;
|
|
1340
|
-
+localDisklet: Disklet;
|
|
1341
|
-
+publicWalletInfo: EdgeWalletInfo;
|
|
1342
|
-
+sync: () => Promise<void>;
|
|
1343
|
-
+type: string;
|
|
1344
|
-
|
|
1345
|
-
// Wallet name:
|
|
1346
|
-
+name: string | null;
|
|
1347
|
-
+renameWallet: (name: string) => Promise<void>;
|
|
1348
|
-
|
|
1349
|
-
// Fiat currency option:
|
|
1350
|
-
+fiatCurrencyCode: string;
|
|
1351
|
-
+setFiatCurrencyCode: (fiatCurrencyCode: string) => Promise<void>;
|
|
1352
|
-
|
|
1353
|
-
// Currency info:
|
|
1354
|
-
+currencyConfig: EdgeCurrencyConfig; // eslint-disable-line no-use-before-define
|
|
1355
|
-
+currencyInfo: EdgeCurrencyInfo;
|
|
1356
|
-
|
|
1357
|
-
// Chain state:
|
|
1358
|
-
+balanceMap: EdgeBalanceMap;
|
|
1359
|
-
+balances: EdgeBalances;
|
|
1360
|
-
+blockHeight: number;
|
|
1361
|
-
+syncStatus: EdgeSyncStatus;
|
|
1362
|
-
+unactivatedTokenIds: string[];
|
|
1363
|
-
|
|
1364
|
-
// Running state:
|
|
1365
|
-
+changePaused: (paused: boolean) => Promise<void>;
|
|
1366
|
-
+paused: boolean;
|
|
1367
|
-
|
|
1368
|
-
// Token management:
|
|
1369
|
-
// Available tokens can be found in `EdgeCurrencyConfig`.
|
|
1370
|
-
// This list is allowed to include missing or deleted `tokenIds`:
|
|
1371
|
-
+changeEnabledTokenIds: (tokenIds: string[]) => Promise<void>;
|
|
1372
|
-
+enabledTokenIds: string[];
|
|
1373
|
-
|
|
1374
|
-
/* Tokens detected on chain */
|
|
1375
|
-
+detectedTokenIds: string[];
|
|
1376
|
-
|
|
1377
|
-
// Transaction history:
|
|
1378
|
-
+getNumTransactions: (opts: EdgeTokenIdOptions) => Promise<number>;
|
|
1379
|
-
+getTransactions: (
|
|
1380
|
-
opts: EdgeGetTransactionsOptions,
|
|
1381
|
-
) => Promise<EdgeTransaction[]>;
|
|
1382
|
-
+streamTransactions: (
|
|
1383
|
-
opts: EdgeStreamTransactionOptions,
|
|
1384
|
-
) => AsyncGenerator<EdgeTransaction[]>;
|
|
1385
|
-
|
|
1386
|
-
// Addresses:
|
|
1387
|
-
+getAddresses: (
|
|
1388
|
-
opts: EdgeGetReceiveAddressOptions,
|
|
1389
|
-
) => Promise<EdgeAddress[]>;
|
|
1390
|
-
|
|
1391
|
-
// Sending:
|
|
1392
|
-
+broadcastTx: (tx: EdgeTransaction) => Promise<EdgeTransaction>;
|
|
1393
|
-
+getMaxSpendable: (spendInfo: EdgeSpendInfo) => Promise<string>;
|
|
1394
|
-
+getPaymentProtocolInfo: (
|
|
1395
|
-
paymentProtocolUrl: string,
|
|
1396
|
-
) => Promise<EdgePaymentProtocolInfo>;
|
|
1397
|
-
+makeSpend: (spendInfo: EdgeSpendInfo) => Promise<EdgeTransaction>;
|
|
1398
|
-
+saveTx: (tx: EdgeTransaction) => Promise<void>;
|
|
1399
|
-
+saveTxAction: (opts: EdgeSaveTxActionOptions) => Promise<void>;
|
|
1400
|
-
+saveTxMetadata: (opts: EdgeSaveTxMetadataOptions) => Promise<void>;
|
|
1401
|
-
+signTx: (tx: EdgeTransaction) => Promise<EdgeTransaction>;
|
|
1402
|
-
+sweepPrivateKeys: (
|
|
1403
|
-
edgeSpendInfo: EdgeSpendInfo,
|
|
1404
|
-
) => Promise<EdgeTransaction>;
|
|
1405
|
-
|
|
1406
|
-
// Signing:
|
|
1407
|
-
+signBytes: (
|
|
1408
|
-
buf: Uint8Array,
|
|
1409
|
-
opts?: EdgeSignMessageOptions,
|
|
1410
|
-
) => Promise<string>;
|
|
1411
|
-
|
|
1412
|
-
// Accelerating:
|
|
1413
|
-
+accelerate: (tx: EdgeTransaction) => Promise<EdgeTransaction | null>;
|
|
1414
|
-
|
|
1415
|
-
// Staking:
|
|
1416
|
-
+stakingStatus: EdgeStakingStatus;
|
|
1417
|
-
|
|
1418
|
-
// Wallet management:
|
|
1419
|
-
+dumpData: () => Promise<EdgeDataDump>;
|
|
1420
|
-
+resyncBlockchain: () => Promise<void>;
|
|
1421
|
-
+split: (
|
|
1422
|
-
splitWallets: EdgeSplitCurrencyWallet[],
|
|
1423
|
-
) => Promise<Array<EdgeResult<EdgeCurrencyWallet>>>;
|
|
1424
|
-
|
|
1425
|
-
// URI handling:
|
|
1426
|
-
+encodeUri: (obj: EdgeEncodeUri) => Promise<string>;
|
|
1427
|
-
+parseUri: (
|
|
1428
|
-
uri: string,
|
|
1429
|
-
currencyCode?: string,
|
|
1430
|
-
) => Promise<EdgeParsedUri>;
|
|
1431
|
-
|
|
1432
|
-
// Generic:
|
|
1433
|
-
+otherMethods: EdgeOtherMethods;
|
|
1434
|
-
|
|
1435
|
-
/** @deprecated Use the information in EdgeCurrencyInfo / EdgeToken. */
|
|
1436
|
-
+denominationToNative: (
|
|
1437
|
-
denominatedAmount: string,
|
|
1438
|
-
currencyCode: string,
|
|
1439
|
-
) => Promise<string>;
|
|
1440
|
-
|
|
1441
|
-
/** @deprecated Use the information in EdgeCurrencyInfo / EdgeToken. */
|
|
1442
|
-
+nativeToDenomination: (
|
|
1443
|
-
nativeAmount: string,
|
|
1444
|
-
currencyCode: string,
|
|
1445
|
-
) => Promise<string>;
|
|
1446
|
-
|
|
1447
|
-
/** @deprecated Use `EdgeCurrencyWallet.getAddresses` instead */
|
|
1448
|
-
+getReceiveAddress: (
|
|
1449
|
-
opts: EdgeGetReceiveAddressOptions,
|
|
1450
|
-
) => Promise<EdgeReceiveAddress>;
|
|
1451
|
-
|
|
1452
|
-
/** @deprecated This was never implemented. */
|
|
1453
|
-
+lockReceiveAddress: (
|
|
1454
|
-
receiveAddress: EdgeReceiveAddress,
|
|
1455
|
-
) => Promise<void>;
|
|
1456
|
-
|
|
1457
|
-
/** @deprecated This was never implemented. */
|
|
1458
|
-
+saveReceiveAddress: (
|
|
1459
|
-
receiveAddress: EdgeReceiveAddress,
|
|
1460
|
-
) => Promise<void>;
|
|
1461
|
-
|
|
1462
|
-
/** @deprecated Use `signBytes` instead. */
|
|
1463
|
-
+signMessage: (
|
|
1464
|
-
message: string,
|
|
1465
|
-
opts?: EdgeSignMessageOptions,
|
|
1466
|
-
) => Promise<string>;
|
|
1467
|
-
|
|
1468
|
-
/** @deprecated Use `syncStatus` instead */
|
|
1469
|
-
+syncRatio: number;
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
export type EdgeMemoryWallet = {
|
|
1473
|
-
+watch: Subscriber<EdgeMemoryWallet>;
|
|
1474
|
-
+balanceMap: EdgeBalanceMap;
|
|
1475
|
-
+detectedTokenIds: string[];
|
|
1476
|
-
+syncStatus: EdgeSyncStatus;
|
|
1477
|
-
+changeEnabledTokenIds: (tokenIds: string[]) => Promise<void>;
|
|
1478
|
-
+startEngine: () => Promise<void>;
|
|
1479
|
-
+getMaxSpendable: (spendInfo: EdgeSpendInfo) => Promise<string>;
|
|
1480
|
-
+makeSpend: (spendInfo: EdgeSpendInfo) => Promise<EdgeTransaction>;
|
|
1481
|
-
+signTx: (tx: EdgeTransaction) => Promise<EdgeTransaction>;
|
|
1482
|
-
+broadcastTx: (tx: EdgeTransaction) => Promise<EdgeTransaction>;
|
|
1483
|
-
+saveTx: (tx: EdgeTransaction) => Promise<void>;
|
|
1484
|
-
+otherMethods: EdgeOtherMethods;
|
|
1485
|
-
+close: () => Promise<void>;
|
|
1486
|
-
|
|
1487
|
-
/** @deprecated Use syncStatus */
|
|
1488
|
-
+syncRatio: number;
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
// ---------------------------------------------------------------------
|
|
1492
|
-
// swap plugin
|
|
1493
|
-
// ---------------------------------------------------------------------
|
|
1494
|
-
|
|
1495
|
-
export type EdgeSwapPluginType = "DEX" | "CEX";
|
|
1496
|
-
|
|
1497
|
-
/**
|
|
1498
|
-
* Static data about a swap plugin.
|
|
1499
|
-
*/
|
|
1500
|
-
export type EdgeSwapInfo = {
|
|
1501
|
-
+pluginId: string;
|
|
1502
|
-
+displayName: string;
|
|
1503
|
-
+isDex?: boolean;
|
|
1504
|
-
|
|
1505
|
-
/** @deprecated Use orderUri in EdgeTxAction */
|
|
1506
|
-
+orderUri?: string; // The orderId would be appended to this
|
|
1507
|
-
+supportEmail: string;
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
export type EdgeSwapRequest = {
|
|
1511
|
-
// Where?
|
|
1512
|
-
fromWallet: EdgeCurrencyWallet;
|
|
1513
|
-
toWallet: EdgeCurrencyWallet;
|
|
1514
|
-
|
|
1515
|
-
// What?
|
|
1516
|
-
fromTokenId: EdgeTokenId;
|
|
1517
|
-
toTokenId: EdgeTokenId;
|
|
1518
|
-
|
|
1519
|
-
// How much?
|
|
1520
|
-
nativeAmount: string;
|
|
1521
|
-
quoteFor: "from" | "max" | "to";
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
/**
|
|
1525
|
-
* If the user approves a quote, the plugin performs the transaction
|
|
1526
|
-
* and returns this as the result.
|
|
1527
|
-
*/
|
|
1528
|
-
export type EdgeSwapResult = {
|
|
1529
|
-
+orderId?: string;
|
|
1530
|
-
+destinationAddress?: string;
|
|
1531
|
-
+transaction: EdgeTransaction;
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
export type EdgeSwapApproveOptions = {
|
|
1535
|
-
metadata?: EdgeMetadata;
|
|
1536
|
-
savedAction?: EdgeTxAction;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
/**
|
|
1540
|
-
* If a provider can satisfy a request, what is their price?
|
|
1541
|
-
*/
|
|
1542
|
-
export type EdgeSwapQuote = {
|
|
1543
|
-
+swapInfo: EdgeSwapInfo;
|
|
1544
|
-
+request: EdgeSwapRequest;
|
|
1545
|
-
|
|
1546
|
-
+isEstimate: boolean;
|
|
1547
|
-
|
|
1548
|
-
/**
|
|
1549
|
-
* This quote may be partially fulfilled with remaining source funds left
|
|
1550
|
-
* in wallet
|
|
1551
|
-
*/
|
|
1552
|
-
+canBePartial?: boolean;
|
|
1553
|
-
|
|
1554
|
-
/**
|
|
1555
|
-
* Maximum amount of time this quote will take to be fulfilled (in seconds)
|
|
1556
|
-
*/
|
|
1557
|
-
+maxFulfillmentSeconds?: number;
|
|
1558
|
-
|
|
1559
|
-
/** Worst-case receive amount */
|
|
1560
|
-
+minReceiveAmount?: string;
|
|
1561
|
-
|
|
1562
|
-
+fromNativeAmount: string;
|
|
1563
|
-
+toNativeAmount: string;
|
|
1564
|
-
+networkFee: EdgeTxAmount & {
|
|
1565
|
-
/** @deprecated use tokenId */
|
|
1566
|
-
currencyCode: string;
|
|
1567
|
-
};
|
|
1568
|
-
|
|
1569
|
-
+pluginId: string;
|
|
1570
|
-
+expirationDate?: Date;
|
|
1571
|
-
|
|
1572
|
-
+approve: (opts?: EdgeSwapApproveOptions) => Promise<EdgeSwapResult>;
|
|
1573
|
-
+close: () => Promise<void>;
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
export type EdgeSwapPluginStatus = {
|
|
1577
|
-
needsActivation?: boolean;
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
export type EdgeSwapPlugin = {
|
|
1581
|
-
+swapInfo: EdgeSwapInfo;
|
|
1582
|
-
|
|
1583
|
-
+checkSettings?: (userSettings: JsonObject) => EdgeSwapPluginStatus;
|
|
1584
|
-
+fetchSwapQuote: (
|
|
1585
|
-
request: EdgeSwapRequest,
|
|
1586
|
-
userSettings: JsonObject | void,
|
|
1587
|
-
opts: { infoPayload: JsonObject; promoCode?: string },
|
|
1588
|
-
) => Promise<EdgeSwapQuote>;
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
// ---------------------------------------------------------------------
|
|
1592
|
-
// account
|
|
1593
|
-
// ---------------------------------------------------------------------
|
|
1594
|
-
|
|
1595
|
-
export type EdgeAccountOptions = {
|
|
1596
|
-
/**
|
|
1597
|
-
* If the login server returns a ChallengeError,
|
|
1598
|
-
* the user needs to visit the challenge URL and answer the question.
|
|
1599
|
-
* If the user succeeds, the challengeId will allow them to log in:
|
|
1600
|
-
*/
|
|
1601
|
-
challengeId?: string;
|
|
1602
|
-
|
|
1603
|
-
/**
|
|
1604
|
-
* The current time, if different from `new Date()`.
|
|
1605
|
-
* Useful for unit testing.
|
|
1606
|
-
*/
|
|
1607
|
-
now?: Date;
|
|
1608
|
-
|
|
1609
|
-
/** The user's OTP secret. */
|
|
1610
|
-
otpKey?: string;
|
|
1611
|
-
|
|
1612
|
-
/** A 6-digit OTP derived from the OTP secret. */
|
|
1613
|
-
otp?: string;
|
|
1614
|
-
|
|
1615
|
-
/** True to start wallets in the paused state. */
|
|
1616
|
-
pauseWallets?: boolean;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
/**
|
|
1620
|
-
* A pending request to log in from a new device.
|
|
1621
|
-
*/
|
|
1622
|
-
export type EdgePendingVoucher = {
|
|
1623
|
-
voucherId: string;
|
|
1624
|
-
activates: Date;
|
|
1625
|
-
created: Date;
|
|
1626
|
-
deviceDescription?: string;
|
|
1627
|
-
ip: string;
|
|
1628
|
-
ipDescription: string;
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
// credentials ---------------------------------------------------------
|
|
1632
|
-
|
|
1633
|
-
export type ChangePinOptions = {
|
|
1634
|
-
/** Keeps the existing PIN if unspecified */
|
|
1635
|
-
pin?: string;
|
|
1636
|
-
|
|
1637
|
-
/** Defaults to true if unspecified */
|
|
1638
|
-
enableLogin?: boolean;
|
|
1639
|
-
|
|
1640
|
-
/**
|
|
1641
|
-
* True to configure the pin for the duress account.
|
|
1642
|
-
* Default is false.
|
|
1643
|
-
*/
|
|
1644
|
-
forDuressAccount?: boolean;
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
export type ChangeUsernameOptions = {
|
|
1648
|
-
username: string;
|
|
1649
|
-
|
|
1650
|
-
/**
|
|
1651
|
-
* Changing the username requires passing the password, if present.
|
|
1652
|
-
* If the account has no password, providing this will create one.
|
|
1653
|
-
*/
|
|
1654
|
-
password?: string;
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
// currencies ----------------------------------------------------------
|
|
1658
|
-
|
|
1659
|
-
export type EdgeCreateCurrencyWalletOptions = {
|
|
1660
|
-
enabledTokenIds?: string[];
|
|
1661
|
-
fiatCurrencyCode?: string;
|
|
1662
|
-
name?: string;
|
|
1663
|
-
|
|
1664
|
-
// Create a private key from some text:
|
|
1665
|
-
importText?: string;
|
|
1666
|
-
|
|
1667
|
-
// Used to tell the currency plugin what keys to create:
|
|
1668
|
-
keyOptions?: JsonObject;
|
|
1669
|
-
|
|
1670
|
-
// Used to copy wallet keys between accounts:
|
|
1671
|
-
keys?: JsonObject;
|
|
1672
|
-
|
|
1673
|
-
// Set if we are sweeping one wallet into another:
|
|
1674
|
-
migratedFromWalletId?: string;
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
export type EdgeCreateCurrencyWallet = EdgeCreateCurrencyWalletOptions & {
|
|
1678
|
-
walletType: string;
|
|
1679
|
-
};
|
|
1680
|
-
|
|
1681
|
-
export type EdgeSplitCurrencyWallet = {
|
|
1682
|
-
fiatCurrencyCode?: string;
|
|
1683
|
-
name?: string;
|
|
1684
|
-
walletType: string;
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
export type EdgeCurrencyConfig = {
|
|
1688
|
-
+watch: Subscriber<EdgeCurrencyConfig>;
|
|
1689
|
-
|
|
1690
|
-
+currencyInfo: EdgeCurrencyInfo;
|
|
1691
|
-
|
|
1692
|
-
// Tokens:
|
|
1693
|
-
+allTokens: EdgeTokenMap;
|
|
1694
|
-
+builtinTokens: EdgeTokenMap;
|
|
1695
|
-
+customTokens: EdgeTokenMap;
|
|
1696
|
-
+getTokenDetails: (
|
|
1697
|
-
filter: EdgeGetTokenDetailsFilter,
|
|
1698
|
-
) => Promise<EdgeToken[]>;
|
|
1699
|
-
+getTokenId: (token: EdgeToken) => Promise<string>;
|
|
1700
|
-
+addCustomToken: (token: EdgeToken) => Promise<string>;
|
|
1701
|
-
+changeCustomToken: (
|
|
1702
|
-
tokenId: string,
|
|
1703
|
-
token: EdgeToken,
|
|
1704
|
-
) => Promise<void>;
|
|
1705
|
-
+removeCustomToken: (tokenId: string) => Promise<void>;
|
|
1706
|
-
|
|
1707
|
-
// Always-enabled tokens:
|
|
1708
|
-
+alwaysEnabledTokenIds: string[];
|
|
1709
|
-
+changeAlwaysEnabledTokenIds: (tokenIds: string[]) => Promise<void>;
|
|
1710
|
-
|
|
1711
|
-
// User settings for this plugin:
|
|
1712
|
-
+userSettings: JsonObject | void;
|
|
1713
|
-
+changeUserSettings: (settings: JsonObject) => Promise<void>;
|
|
1714
|
-
|
|
1715
|
-
// Utility methods:
|
|
1716
|
-
+importKey: (
|
|
1717
|
-
userInput: string,
|
|
1718
|
-
opts?: { keyOptions?: JsonObject },
|
|
1719
|
-
) => Promise<JsonObject>;
|
|
1720
|
-
+otherMethods: EdgeOtherMethods;
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
// swap ----------------------------------------------------------------
|
|
1724
|
-
|
|
1725
|
-
/**
|
|
1726
|
-
* Information and settings for a currency swap plugin.
|
|
1727
|
-
*/
|
|
1728
|
-
export type EdgeSwapConfig = {
|
|
1729
|
-
+watch: Subscriber<EdgeSwapConfig>;
|
|
1730
|
-
|
|
1731
|
-
+enabled: boolean;
|
|
1732
|
-
+needsActivation: boolean;
|
|
1733
|
-
+swapInfo: EdgeSwapInfo;
|
|
1734
|
-
+userSettings: JsonObject | void;
|
|
1735
|
-
|
|
1736
|
-
+changeEnabled: (enabled: boolean) => Promise<void>;
|
|
1737
|
-
+changeUserSettings: (settings: JsonObject) => Promise<void>;
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
export type EdgeSwapRequestOptions = {
|
|
1741
|
-
preferPluginId?: string;
|
|
1742
|
-
preferType?: EdgeSwapPluginType;
|
|
1743
|
-
disabled?: EdgePluginMap<true>;
|
|
1744
|
-
promoCodes?: EdgePluginMap<string>;
|
|
1745
|
-
|
|
1746
|
-
/**
|
|
1747
|
-
* If we have some quotes already, how long should we wait
|
|
1748
|
-
* for stragglers before we give up? Defaults to 20000ms.
|
|
1749
|
-
*/
|
|
1750
|
-
slowResponseMs?: number;
|
|
1751
|
-
|
|
1752
|
-
/**
|
|
1753
|
-
* If don't have any quotes yet, how long should we wait
|
|
1754
|
-
* before we give up? Defaults to Infinity.
|
|
1755
|
-
*/
|
|
1756
|
-
noResponseMs?: number;
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
// edge login ----------------------------------------------------------
|
|
1760
|
-
|
|
1761
|
-
export type EdgeLoginRequest = {
|
|
1762
|
-
+appId: string;
|
|
1763
|
-
|
|
1764
|
-
+displayName: string;
|
|
1765
|
-
+displayImageDarkUrl?: string;
|
|
1766
|
-
+displayImageLightUrl?: string;
|
|
1767
|
-
|
|
1768
|
-
+approve: () => Promise<void>;
|
|
1769
|
-
+close: () => Promise<void>;
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
export type EdgeLobby = {
|
|
1773
|
-
+loginRequest: EdgeLoginRequest | void;
|
|
1774
|
-
// walletRequest: EdgeWalletRequest | void
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
// storage -------------------------------------------------------------
|
|
1778
|
-
|
|
1779
|
-
export type EdgeDataStore = {
|
|
1780
|
-
+deleteItem: (storeId: string, itemId: string) => Promise<void>;
|
|
1781
|
-
+deleteStore: (storeId: string) => Promise<void>;
|
|
1782
|
-
|
|
1783
|
-
+listItemIds: (storeId: string) => Promise<string[]>;
|
|
1784
|
-
+listStoreIds: () => Promise<string[]>;
|
|
1785
|
-
|
|
1786
|
-
+getItem: (storeId: string, itemId: string) => Promise<string>;
|
|
1787
|
-
+setItem: (
|
|
1788
|
-
storeId: string,
|
|
1789
|
-
itemId: string,
|
|
1790
|
-
value: string,
|
|
1791
|
-
) => Promise<void>;
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
// account -------------------------------------------------------------
|
|
1795
|
-
|
|
1796
|
-
export type EdgeAccountEvents = {
|
|
1797
|
-
close: void;
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
export type EdgeAccount = {
|
|
1801
|
-
+on: Subscriber<EdgeAccountEvents>;
|
|
1802
|
-
+watch: Subscriber<EdgeAccount>;
|
|
1803
|
-
|
|
1804
|
-
// Data store:
|
|
1805
|
-
+id: string;
|
|
1806
|
-
+type: string;
|
|
1807
|
-
+disklet: Disklet;
|
|
1808
|
-
+localDisklet: Disklet;
|
|
1809
|
-
+sync: () => Promise<void>;
|
|
1810
|
-
|
|
1811
|
-
// Basic login information:
|
|
1812
|
-
+appId: string;
|
|
1813
|
-
+created: Date | void; // Not always known
|
|
1814
|
-
+lastLogin: Date;
|
|
1815
|
-
+loggedIn: boolean;
|
|
1816
|
-
+recoveryKey: string | void; // base58, for email backup
|
|
1817
|
-
+rootLoginId: string; // base58
|
|
1818
|
-
+username: string | void;
|
|
1819
|
-
|
|
1820
|
-
// Duress mode:
|
|
1821
|
-
+canDuressLogin: boolean;
|
|
1822
|
-
+isDuressAccount: boolean;
|
|
1823
|
-
|
|
1824
|
-
/** Gets the base58 decryption key for biometric login */
|
|
1825
|
-
+getLoginKey: () => Promise<string>; // base58
|
|
1826
|
-
|
|
1827
|
-
// Special-purpose API's:
|
|
1828
|
-
+currencyConfig: EdgePluginMap<EdgeCurrencyConfig>;
|
|
1829
|
-
+swapConfig: EdgePluginMap<EdgeSwapConfig>;
|
|
1830
|
-
+dataStore: EdgeDataStore;
|
|
1831
|
-
|
|
1832
|
-
// What login method was used?
|
|
1833
|
-
+edgeLogin: boolean;
|
|
1834
|
-
+keyLogin: boolean;
|
|
1835
|
-
+newAccount: boolean;
|
|
1836
|
-
+passwordLogin: boolean;
|
|
1837
|
-
+pinLogin: boolean;
|
|
1838
|
-
+recoveryLogin: boolean;
|
|
1839
|
-
|
|
1840
|
-
// Change or create credentials:
|
|
1841
|
-
+changePassword: (password: string) => Promise<void>;
|
|
1842
|
-
+changePin: (opts: ChangePinOptions) => Promise<string>;
|
|
1843
|
-
+changeRecovery: (
|
|
1844
|
-
questions: string[],
|
|
1845
|
-
answers: string[],
|
|
1846
|
-
) => Promise<string>;
|
|
1847
|
-
+changeUsername: (opts: ChangeUsernameOptions) => Promise<void>;
|
|
1848
|
-
|
|
1849
|
-
// Verify existing credentials:
|
|
1850
|
-
+checkPassword: (password: string) => Promise<boolean>;
|
|
1851
|
-
+checkPin: (
|
|
1852
|
-
pin: string,
|
|
1853
|
-
opts?: { forDuressAccount?: boolean },
|
|
1854
|
-
) => Promise<boolean>;
|
|
1855
|
-
+getPin: () => Promise<string | void>;
|
|
1856
|
-
|
|
1857
|
-
// Remove credentials:
|
|
1858
|
-
+deletePassword: () => Promise<void>;
|
|
1859
|
-
+deletePin: () => Promise<void>;
|
|
1860
|
-
+deleteRecovery: () => Promise<void>;
|
|
1861
|
-
|
|
1862
|
-
// OTP:
|
|
1863
|
-
+otpKey: string | void; // OTP is enabled if this exists
|
|
1864
|
-
+otpResetDate: Date | void; // A reset is requested if this exists
|
|
1865
|
-
+cancelOtpReset: () => Promise<void>;
|
|
1866
|
-
+disableOtp: () => Promise<void>;
|
|
1867
|
-
+enableOtp: (timeout?: number) => Promise<void>;
|
|
1868
|
-
+repairOtp: (otpKey: string) => Promise<void>;
|
|
1869
|
-
|
|
1870
|
-
// 2fa bypass voucher approval / rejection:
|
|
1871
|
-
+pendingVouchers: EdgePendingVoucher[];
|
|
1872
|
-
+approveVoucher: (voucherId: string) => Promise<void>;
|
|
1873
|
-
+rejectVoucher: (voucherId: string) => Promise<void>;
|
|
1874
|
-
|
|
1875
|
-
// Edge login approval:
|
|
1876
|
-
+fetchLobby: (lobbyId: string) => Promise<EdgeLobby>;
|
|
1877
|
-
|
|
1878
|
-
// Login management:
|
|
1879
|
-
+deleteRemoteAccount: () => Promise<void>;
|
|
1880
|
-
+logout: () => Promise<void>;
|
|
1881
|
-
|
|
1882
|
-
// Master wallet list:
|
|
1883
|
-
+allKeys: EdgeWalletInfoFull[];
|
|
1884
|
-
+changeWalletStates: (
|
|
1885
|
-
walletStates: EdgeWalletStates,
|
|
1886
|
-
) => Promise<void>;
|
|
1887
|
-
+createWallet: (type: string, keys?: JsonObject) => Promise<string>;
|
|
1888
|
-
+getFirstWalletInfo: (type: string) => EdgeWalletInfoFull | void;
|
|
1889
|
-
+getWalletInfo: (id: string) => EdgeWalletInfoFull | void;
|
|
1890
|
-
+listWalletIds: () => string[];
|
|
1891
|
-
+listSplittableWalletTypes: (walletId: string) => Promise<string[]>;
|
|
1892
|
-
|
|
1893
|
-
// Key access:
|
|
1894
|
-
+getDisplayPrivateKey: (walletId: string) => Promise<string>;
|
|
1895
|
-
+getDisplayPublicKey: (walletId: string) => Promise<string>;
|
|
1896
|
-
+getRawPrivateKey: (walletId: string) => Promise<JsonObject>;
|
|
1897
|
-
+getRawPublicKey: (walletId: string) => Promise<JsonObject>;
|
|
1898
|
-
|
|
1899
|
-
// Currency wallets:
|
|
1900
|
-
+activeWalletIds: string[];
|
|
1901
|
-
+archivedWalletIds: string[];
|
|
1902
|
-
+hiddenWalletIds: string[];
|
|
1903
|
-
+currencyWallets: { [walletId: string]: EdgeCurrencyWallet };
|
|
1904
|
-
+currencyWalletErrors: { [walletId: string]: Error };
|
|
1905
|
-
+createCurrencyWallet: (
|
|
1906
|
-
walletType: string,
|
|
1907
|
-
opts?: EdgeCreateCurrencyWalletOptions,
|
|
1908
|
-
) => Promise<EdgeCurrencyWallet>;
|
|
1909
|
-
+createCurrencyWallets: (
|
|
1910
|
-
createWallets: EdgeCreateCurrencyWallet[],
|
|
1911
|
-
) => Promise<Array<EdgeResult<EdgeCurrencyWallet>>>;
|
|
1912
|
-
+waitForCurrencyWallet: (
|
|
1913
|
-
walletId: string,
|
|
1914
|
-
) => Promise<EdgeCurrencyWallet>;
|
|
1915
|
-
+waitForAllWallets: () => Promise<void>;
|
|
1916
|
-
+makeMemoryWallet: (
|
|
1917
|
-
walletType: string,
|
|
1918
|
-
opts?: EdgeCreateCurrencyWalletOptions,
|
|
1919
|
-
) => Promise<EdgeMemoryWallet>;
|
|
1920
|
-
|
|
1921
|
-
// Token & wallet activation:
|
|
1922
|
-
+getActivationAssets: (
|
|
1923
|
-
options: EdgeGetActivationAssetsOptions,
|
|
1924
|
-
) => Promise<EdgeGetActivationAssetsResults>;
|
|
1925
|
-
+activateWallet: (
|
|
1926
|
-
options: EdgeActivationOptions,
|
|
1927
|
-
) => Promise<EdgeActivationQuote>;
|
|
1928
|
-
|
|
1929
|
-
// Swapping:
|
|
1930
|
-
+fetchSwapQuote: (
|
|
1931
|
-
request: EdgeSwapRequest,
|
|
1932
|
-
opts?: EdgeSwapRequestOptions,
|
|
1933
|
-
) => Promise<EdgeSwapQuote>;
|
|
1934
|
-
+fetchSwapQuotes: (
|
|
1935
|
-
request: EdgeSwapRequest,
|
|
1936
|
-
opts?: EdgeSwapRequestOptions,
|
|
1937
|
-
) => Promise<EdgeSwapQuote[]>;
|
|
1938
|
-
|
|
1939
|
-
/** @deprecated Use `EdgeCurrencyWallet.split` instead */
|
|
1940
|
-
+splitWalletInfo: (
|
|
1941
|
-
walletId: string,
|
|
1942
|
-
newWalletType: string,
|
|
1943
|
-
) => Promise<string>;
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
// ---------------------------------------------------------------------
|
|
1947
|
-
// context types
|
|
1948
|
-
// ---------------------------------------------------------------------
|
|
1949
|
-
|
|
1950
|
-
export type EdgeCorePlugin = EdgeCurrencyPlugin | EdgeSwapPlugin;
|
|
1951
|
-
|
|
1952
|
-
export type EdgeCorePluginFactory = (
|
|
1953
|
-
env: EdgeCorePluginOptions,
|
|
1954
|
-
) => EdgeCorePlugin;
|
|
1955
|
-
|
|
1956
|
-
export type EdgeCorePlugins = EdgePluginMap<
|
|
1957
|
-
EdgeCorePlugin | EdgeCorePluginFactory
|
|
1958
|
-
>;
|
|
1959
|
-
|
|
1960
|
-
export type EdgeCorePluginsInit = EdgePluginMap<boolean | JsonObject>;
|
|
1961
|
-
|
|
1962
|
-
export type EdgeContextOptions = {
|
|
1963
|
-
apiKey?: string;
|
|
1964
|
-
apiSecret?: Uint8Array;
|
|
1965
|
-
appId: string;
|
|
1966
|
-
|
|
1967
|
-
/** The application version (e.g., "1.0.0") */
|
|
1968
|
-
appVersion?: string;
|
|
1969
|
-
|
|
1970
|
-
/** The operating system type (e.g., "ios", "android") */
|
|
1971
|
-
osType?: string;
|
|
1972
|
-
|
|
1973
|
-
/** The OS version (e.g., "17.0", "14") */
|
|
1974
|
-
osVersion?: string;
|
|
1975
|
-
|
|
1976
|
-
/**
|
|
1977
|
-
* Switches to a different login server, such as for testing.
|
|
1978
|
-
* Do not include `/api` in the path.
|
|
1979
|
-
*/
|
|
1980
|
-
loginServer?: string | string[];
|
|
1981
|
-
|
|
1982
|
-
changeServer?: string | string[];
|
|
1983
|
-
infoServer?: string | string[];
|
|
1984
|
-
syncServer?: string | string[];
|
|
1985
|
-
hideKeys?: boolean;
|
|
1986
|
-
|
|
1987
|
-
// Intercepts crash reports:
|
|
1988
|
-
crashReporter?: EdgeCrashReporter;
|
|
1989
|
-
|
|
1990
|
-
// A string to describe this phone or app:
|
|
1991
|
-
deviceDescription?: string;
|
|
1992
|
-
|
|
1993
|
-
// Intercepts all console logging:
|
|
1994
|
-
onLog?: EdgeOnLog;
|
|
1995
|
-
logSettings?: $Rest<EdgeLogSettings, { ... }>;
|
|
1996
|
-
|
|
1997
|
-
path?: string; // Only used on node.js
|
|
1998
|
-
plugins?: EdgeCorePluginsInit;
|
|
1999
|
-
|
|
2000
|
-
/** True to load Airbitz user files from disk */
|
|
2001
|
-
airbitzSupport?: boolean;
|
|
2002
|
-
|
|
2003
|
-
/**
|
|
2004
|
-
* True to skip updating the `EdgeCurrencyWallet.blockHeight` property.
|
|
2005
|
-
* This may improve performance by reducing bridge traffic,
|
|
2006
|
-
* but there will be no way to query the overall chain height.
|
|
2007
|
-
* The core will continue updating individual transactions
|
|
2008
|
-
* as their confirmation status changes.
|
|
2009
|
-
*/
|
|
2010
|
-
skipBlockHeight?: boolean;
|
|
2011
|
-
|
|
2012
|
-
/** @deprecated Use `loginServer` instead. */
|
|
2013
|
-
authServer?: string;
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
// parameters ----------------------------------------------------------
|
|
2017
|
-
|
|
2018
|
-
export type EdgeCreateAccountOptions = {
|
|
2019
|
-
username?: string;
|
|
2020
|
-
password?: string;
|
|
2021
|
-
pin?: string;
|
|
2022
|
-
}
|
|
2023
|
-
|
|
2024
|
-
export type EdgeLoginMessage = {
|
|
2025
|
-
loginId: string; // base64
|
|
2026
|
-
otpResetPending: boolean;
|
|
2027
|
-
pendingVouchers: EdgePendingVoucher[];
|
|
2028
|
-
recovery2Corrupt: boolean;
|
|
2029
|
-
username?: string;
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2032
|
-
export type EdgePasswordRules = {
|
|
2033
|
-
secondsToCrack: number;
|
|
2034
|
-
tooShort: boolean;
|
|
2035
|
-
noNumber: boolean;
|
|
2036
|
-
noLowerCase: boolean;
|
|
2037
|
-
noUpperCase: boolean;
|
|
2038
|
-
passed: boolean;
|
|
2039
|
-
}
|
|
2040
|
-
|
|
2041
|
-
/**
|
|
2042
|
-
* A barcode login request.
|
|
2043
|
-
*
|
|
2044
|
-
* The process begins by showing the user a QR code with the request id,
|
|
2045
|
-
* in the format `edge://edge/${id}`.
|
|
2046
|
-
*
|
|
2047
|
-
* Once the user sends their response, the state will move from "pending"
|
|
2048
|
-
* to "started" and the "username" property will hold the received username.
|
|
2049
|
-
*
|
|
2050
|
-
* Once the login finishes, the state will move from "started" to "done",
|
|
2051
|
-
* and the "account" property will hold the new account object.
|
|
2052
|
-
*
|
|
2053
|
-
* Otherwise, if something goes wrong, the state will move from "started"
|
|
2054
|
-
* to "error", and the "error" property will hold the error.
|
|
2055
|
-
*
|
|
2056
|
-
* Calling "cancelRequest" stops the process and sets the state to "closed".
|
|
2057
|
-
* This method is only callable in the "pending" and "started" states.
|
|
2058
|
-
*
|
|
2059
|
-
* Use the `watch('state', callback)` method to subscribe to state changes.
|
|
2060
|
-
*/
|
|
2061
|
-
export type EdgePendingEdgeLogin = {
|
|
2062
|
-
+watch: Subscriber<EdgePendingEdgeLogin>;
|
|
2063
|
-
+id: string;
|
|
2064
|
-
|
|
2065
|
-
+state: "pending" | "started" | "done" | "error" | "closed";
|
|
2066
|
-
+username?: string; // Set in the "started" state
|
|
2067
|
-
+account?: EdgeAccount; // Set in the "done" state
|
|
2068
|
-
+error?: mixed; // Set in the "error" state
|
|
2069
|
-
|
|
2070
|
-
+cancelRequest: () => Promise<void>;
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
export type EdgeUserInfo = {
|
|
2074
|
-
keyLoginEnabled: boolean;
|
|
2075
|
-
lastLogin?: Date;
|
|
2076
|
-
loginId: string; // base58
|
|
2077
|
-
pinLoginEnabled: boolean;
|
|
2078
|
-
recovery2Key?: string; // base58
|
|
2079
|
-
username?: string;
|
|
2080
|
-
voucherId?: string;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
// context -------------------------------------------------------------
|
|
2084
|
-
|
|
2085
|
-
export type EdgeContextEvents = {
|
|
2086
|
-
close: void;
|
|
2087
|
-
error: any; // Will change to `mixed`
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
export type EdgeContext = {
|
|
2091
|
-
+on: Subscriber<EdgeContextEvents>;
|
|
2092
|
-
+watch: Subscriber<EdgeContext>;
|
|
2093
|
-
+close: () => Promise<void>;
|
|
2094
|
-
|
|
2095
|
-
+appId: string;
|
|
2096
|
-
+clientId: string; // Unique base58 ID for each app installation
|
|
2097
|
-
|
|
2098
|
-
// Local user management:
|
|
2099
|
-
localUsers: EdgeUserInfo[];
|
|
2100
|
-
+forgetAccount: (rootLoginId: string) => Promise<void>;
|
|
2101
|
-
|
|
2102
|
-
// Account creation:
|
|
2103
|
-
/** Preemptively requests a CAPTCHA for account creation. */
|
|
2104
|
-
+fetchChallenge: () => Promise<{
|
|
2105
|
-
challengeId: string;
|
|
2106
|
-
/** If this is missing, the challenge is already solved. */
|
|
2107
|
-
challengeUri?: string;
|
|
2108
|
-
}>;
|
|
2109
|
-
+fixUsername: (username: string) => string;
|
|
2110
|
-
+usernameAvailable: (
|
|
2111
|
-
username: string,
|
|
2112
|
-
opts?: { challengeId?: string },
|
|
2113
|
-
) => Promise<boolean>;
|
|
2114
|
-
+createAccount: (
|
|
2115
|
-
opts: EdgeCreateAccountOptions & EdgeAccountOptions,
|
|
2116
|
-
) => Promise<EdgeAccount>;
|
|
2117
|
-
|
|
2118
|
-
// Barcode login:
|
|
2119
|
-
+requestEdgeLogin: (
|
|
2120
|
-
opts?: EdgeAccountOptions,
|
|
2121
|
-
) => Promise<EdgePendingEdgeLogin>;
|
|
2122
|
-
|
|
2123
|
-
// Fingerprint login:
|
|
2124
|
-
+loginWithKey: (
|
|
2125
|
-
usernameOrLoginId: string,
|
|
2126
|
-
loginKey: string,
|
|
2127
|
-
opts?: EdgeAccountOptions & { useLoginId?: boolean },
|
|
2128
|
-
) => Promise<EdgeAccount>;
|
|
2129
|
-
|
|
2130
|
-
// Password login:
|
|
2131
|
-
+checkPasswordRules: (password: string) => EdgePasswordRules;
|
|
2132
|
-
+loginWithPassword: (
|
|
2133
|
-
username: string,
|
|
2134
|
-
password: string,
|
|
2135
|
-
opts?: EdgeAccountOptions,
|
|
2136
|
-
) => Promise<EdgeAccount>;
|
|
2137
|
-
|
|
2138
|
-
// PIN login:
|
|
2139
|
-
+loginWithPIN: (
|
|
2140
|
-
usernameOrLoginId: string,
|
|
2141
|
-
pin: string,
|
|
2142
|
-
opts?: EdgeAccountOptions & { useLoginId?: boolean },
|
|
2143
|
-
) => Promise<EdgeAccount>;
|
|
2144
|
-
|
|
2145
|
-
// Recovery2 login:
|
|
2146
|
-
+loginWithRecovery2: (
|
|
2147
|
-
recovery2Key: string,
|
|
2148
|
-
username: string,
|
|
2149
|
-
answers: string[],
|
|
2150
|
-
opts?: EdgeAccountOptions,
|
|
2151
|
-
) => Promise<EdgeAccount>;
|
|
2152
|
-
+fetchRecovery2Questions: (
|
|
2153
|
-
recovery2Key: string,
|
|
2154
|
-
username: string,
|
|
2155
|
-
) => Promise<string[]>;
|
|
2156
|
-
|
|
2157
|
-
// OTP stuff:
|
|
2158
|
-
+requestOtpReset: (
|
|
2159
|
-
username: string,
|
|
2160
|
-
otpResetToken: string,
|
|
2161
|
-
) => Promise<Date>;
|
|
2162
|
-
+fetchLoginMessages: () => Promise<EdgeLoginMessage[]>;
|
|
2163
|
-
|
|
2164
|
-
// Background mode:
|
|
2165
|
-
+paused: boolean;
|
|
2166
|
-
+changePaused: (
|
|
2167
|
-
paused: boolean,
|
|
2168
|
-
opts?: { secondsDelay?: number },
|
|
2169
|
-
) => Promise<void>;
|
|
2170
|
-
|
|
2171
|
-
// Logging options:
|
|
2172
|
-
+logSettings: EdgeLogSettings;
|
|
2173
|
-
+changeLogSettings: (
|
|
2174
|
-
settings: $Rest<EdgeLogSettings, { ... }>,
|
|
2175
|
-
) => Promise<void>;
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
// ---------------------------------------------------------------------
|
|
2179
|
-
// fake mode
|
|
2180
|
-
// ---------------------------------------------------------------------
|
|
2181
|
-
|
|
2182
|
-
export type EdgeFakeWorldOptions = {
|
|
2183
|
-
crashReporter?: EdgeCrashReporter;
|
|
2184
|
-
onLog?: EdgeOnLog;
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
export type EdgeFakeContextOptions = {
|
|
2188
|
-
// EdgeContextOptions:
|
|
2189
|
-
airbitzSupport?: boolean;
|
|
2190
|
-
apiKey?: string;
|
|
2191
|
-
apiSecret?: Uint8Array;
|
|
2192
|
-
appId: string;
|
|
2193
|
-
deviceDescription?: string;
|
|
2194
|
-
hideKeys?: boolean;
|
|
2195
|
-
logSettings?: $Rest<EdgeLogSettings, { ... }>;
|
|
2196
|
-
plugins?: EdgeCorePluginsInit;
|
|
2197
|
-
|
|
2198
|
-
// Allows core plugins to access the real network except for the
|
|
2199
|
-
// login and sync servers, which remain emulated:
|
|
2200
|
-
allowNetworkAccess?: boolean;
|
|
2201
|
-
|
|
2202
|
-
// Fake device options:
|
|
2203
|
-
cleanDevice?: boolean;
|
|
2204
|
-
|
|
2205
|
-
/** Extra files to be saved on the fake device. */
|
|
2206
|
-
extraFiles?: { [path: string]: string };
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
/**
|
|
2210
|
-
* A block of JSON data that can be used to save & restore a user
|
|
2211
|
-
* on the fake unit-testing server.
|
|
2212
|
-
*/
|
|
2213
|
-
export type EdgeFakeUser = {
|
|
2214
|
-
username?: string;
|
|
2215
|
-
lastLogin?: Date;
|
|
2216
|
-
loginId: string; // base64
|
|
2217
|
-
loginKey: string; // base64
|
|
2218
|
-
repos: {
|
|
2219
|
-
[syncKey: string]: mixed; // Cleaned with asEdgeRepoDump
|
|
2220
|
-
};
|
|
2221
|
-
server: mixed; // Cleaned with asEdgeLoginDump
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
export type EdgeFakeWorld = {
|
|
2225
|
-
+close: () => Promise<void>;
|
|
2226
|
-
|
|
2227
|
-
+makeEdgeContext: (
|
|
2228
|
-
opts: EdgeFakeContextOptions,
|
|
2229
|
-
) => Promise<EdgeContext>;
|
|
2230
|
-
|
|
2231
|
-
+goOffline: (offline?: boolean) => Promise<void>;
|
|
2232
|
-
+dumpFakeUser: (account: EdgeAccount) => Promise<EdgeFakeUser>;
|
|
2233
|
-
}
|
|
2234
|
-
|
|
2235
|
-
// ---------------------------------------------------------------------
|
|
2236
|
-
// deprecated types
|
|
2237
|
-
// ---------------------------------------------------------------------
|
|
2238
|
-
|
|
2239
|
-
/** @deprecated use EdgeTxAmount instead */
|
|
2240
|
-
export type EdgeNetworkFee = {
|
|
2241
|
-
+currencyCode: string;
|
|
2242
|
-
+nativeAmount: string;
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
/** @deprecated use EdgeTxAmount instead */
|
|
2246
|
-
export type EdgeNetworkFee2 = {
|
|
2247
|
-
+nativeAmount: string;
|
|
2248
|
-
+currencyPluginId: string;
|
|
2249
|
-
+tokenId: EdgeTokenId;
|
|
2250
|
-
}
|