edge-core-js 0.19.21 → 0.19.24
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 +13 -1
- package/android/src/main/assets/edge-core-js/edge-core.js +1 -1
- package/android/src/main/assets/edge-core-js/edge-core.js.map +1 -0
- package/android/src/main/assets/edge-core-js/index.html +25 -0
- package/lib/core/fake/fake-db.js +12 -0
- package/lib/core/fake/fake-server.js +6 -4
- package/lib/core/login/create.js +42 -43
- package/lib/core/login/login-stash.js +4 -2
- package/lib/core/login/login-types.js +2 -0
- package/lib/core/login/login-username.js +33 -0
- package/lib/core/login/login.js +1 -1
- package/lib/error.d.ts +8 -4
- package/lib/fake-types.d.ts +2 -0
- package/lib/node/index.js +98 -53
- package/lib/server-cleaners.d.ts +2 -1
- package/lib/server-types.d.ts +6 -1
- package/lib/types/error.js +18 -4
- package/lib/types/error.ts +18 -4
- package/lib/types/fake-types.js +8 -0
- package/lib/types/fake-types.ts +8 -0
- package/lib/types/server-cleaners.js +12 -1
- package/lib/types/server-cleaners.ts +12 -1
- package/lib/types/server-types.js +8 -0
- package/lib/types/server-types.ts +9 -1
- package/package.json +3 -3
- package/src/types/error.js +18 -4
- package/src/types/fake-types.js +8 -0
- package/src/types/server-cleaners.js +12 -1
- package/src/types/server-types.js +9 -1
- package/types.js +15 -5
package/lib/server-types.d.ts
CHANGED
|
@@ -93,6 +93,10 @@ export interface ChangeSecretPayload {
|
|
|
93
93
|
loginAuthBox: EdgeBox;
|
|
94
94
|
loginAuth: Uint8Array;
|
|
95
95
|
}
|
|
96
|
+
export interface ChangeUsernamePayload {
|
|
97
|
+
userId: Uint8Array;
|
|
98
|
+
userTextBox: EdgeBox;
|
|
99
|
+
}
|
|
96
100
|
export interface ChangeVouchersPayload {
|
|
97
101
|
approvedVouchers?: string[];
|
|
98
102
|
rejectedVouchers?: string[];
|
|
@@ -120,7 +124,6 @@ export interface LoginPayload {
|
|
|
120
124
|
appId: string;
|
|
121
125
|
created: Date;
|
|
122
126
|
loginId: Uint8Array;
|
|
123
|
-
userId?: Uint8Array;
|
|
124
127
|
children?: LoginPayload[];
|
|
125
128
|
parentBox?: EdgeBox;
|
|
126
129
|
otpKey?: Uint8Array;
|
|
@@ -137,6 +140,8 @@ export interface LoginPayload {
|
|
|
137
140
|
recovery2Box?: EdgeBox;
|
|
138
141
|
recovery2KeyBox?: EdgeBox;
|
|
139
142
|
loginAuthBox?: EdgeBox;
|
|
143
|
+
userId?: Uint8Array;
|
|
144
|
+
userTextBox?: EdgeBox;
|
|
140
145
|
pendingVouchers: EdgePendingVoucher[];
|
|
141
146
|
keyBoxes?: EdgeBox[];
|
|
142
147
|
mnemonicBox?: EdgeBox;
|
package/lib/types/error.js
CHANGED
|
@@ -224,35 +224,49 @@ export class SpendToSelfError extends Error {
|
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
226
|
* Trying to swap an amount that is either too low or too high.
|
|
227
|
-
* @param nativeMax the maximum supported amount, in the
|
|
227
|
+
* @param nativeMax the maximum supported amount, in the currency specified
|
|
228
|
+
* by the direction (defaults to "from" currency)
|
|
228
229
|
*/
|
|
229
230
|
export class SwapAboveLimitError extends Error {
|
|
230
231
|
|
|
231
232
|
|
|
232
233
|
|
|
233
234
|
|
|
234
|
-
|
|
235
|
+
|
|
236
|
+
constructor(
|
|
237
|
+
swapInfo,
|
|
238
|
+
nativeMax,
|
|
239
|
+
direction = 'from'
|
|
240
|
+
) {
|
|
235
241
|
super('Amount is too high')
|
|
236
242
|
this.name = 'SwapAboveLimitError'
|
|
237
243
|
this.pluginId = swapInfo.pluginId
|
|
238
244
|
this.nativeMax = nativeMax
|
|
245
|
+
this.direction = direction
|
|
239
246
|
}
|
|
240
247
|
}
|
|
241
248
|
|
|
242
249
|
/**
|
|
243
250
|
* Trying to swap an amount that is either too low or too high.
|
|
244
|
-
* @param nativeMin the minimum supported amount, in the
|
|
251
|
+
* @param nativeMin the minimum supported amount, in the currency specified
|
|
252
|
+
* by the direction (defaults to "from" currency)
|
|
245
253
|
*/
|
|
246
254
|
export class SwapBelowLimitError extends Error {
|
|
247
255
|
|
|
248
256
|
|
|
249
257
|
|
|
250
258
|
|
|
251
|
-
|
|
259
|
+
|
|
260
|
+
constructor(
|
|
261
|
+
swapInfo,
|
|
262
|
+
nativeMin,
|
|
263
|
+
direction = 'from'
|
|
264
|
+
) {
|
|
252
265
|
super('Amount is too low')
|
|
253
266
|
this.name = 'SwapBelowLimitError'
|
|
254
267
|
this.pluginId = swapInfo.pluginId
|
|
255
268
|
this.nativeMin = nativeMin
|
|
269
|
+
this.direction = direction
|
|
256
270
|
}
|
|
257
271
|
}
|
|
258
272
|
|
package/lib/types/error.ts
CHANGED
|
@@ -222,35 +222,49 @@ export class SpendToSelfError extends Error {
|
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
224
|
* Trying to swap an amount that is either too low or too high.
|
|
225
|
-
* @param nativeMax the maximum supported amount, in the
|
|
225
|
+
* @param nativeMax the maximum supported amount, in the currency specified
|
|
226
|
+
* by the direction (defaults to "from" currency)
|
|
226
227
|
*/
|
|
227
228
|
export class SwapAboveLimitError extends Error {
|
|
228
229
|
name: string
|
|
229
230
|
readonly pluginId: string
|
|
230
231
|
readonly nativeMax: string
|
|
232
|
+
readonly direction: 'from' | 'to'
|
|
231
233
|
|
|
232
|
-
constructor(
|
|
234
|
+
constructor(
|
|
235
|
+
swapInfo: EdgeSwapInfo,
|
|
236
|
+
nativeMax: string,
|
|
237
|
+
direction: 'from' | 'to' = 'from'
|
|
238
|
+
) {
|
|
233
239
|
super('Amount is too high')
|
|
234
240
|
this.name = 'SwapAboveLimitError'
|
|
235
241
|
this.pluginId = swapInfo.pluginId
|
|
236
242
|
this.nativeMax = nativeMax
|
|
243
|
+
this.direction = direction
|
|
237
244
|
}
|
|
238
245
|
}
|
|
239
246
|
|
|
240
247
|
/**
|
|
241
248
|
* Trying to swap an amount that is either too low or too high.
|
|
242
|
-
* @param nativeMin the minimum supported amount, in the
|
|
249
|
+
* @param nativeMin the minimum supported amount, in the currency specified
|
|
250
|
+
* by the direction (defaults to "from" currency)
|
|
243
251
|
*/
|
|
244
252
|
export class SwapBelowLimitError extends Error {
|
|
245
253
|
name: string
|
|
246
254
|
readonly pluginId: string
|
|
247
255
|
readonly nativeMin: string
|
|
256
|
+
readonly direction: 'from' | 'to'
|
|
248
257
|
|
|
249
|
-
constructor(
|
|
258
|
+
constructor(
|
|
259
|
+
swapInfo: EdgeSwapInfo,
|
|
260
|
+
nativeMin: string,
|
|
261
|
+
direction: 'from' | 'to' = 'from'
|
|
262
|
+
) {
|
|
250
263
|
super('Amount is too low')
|
|
251
264
|
this.name = 'SwapBelowLimitError'
|
|
252
265
|
this.pluginId = swapInfo.pluginId
|
|
253
266
|
this.nativeMin = nativeMin
|
|
267
|
+
this.direction = direction
|
|
254
268
|
}
|
|
255
269
|
}
|
|
256
270
|
|
package/lib/types/fake-types.js
CHANGED
|
@@ -96,6 +96,10 @@ import {
|
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
99
103
|
|
|
100
104
|
|
|
101
105
|
|
|
@@ -163,6 +167,10 @@ export const asLoginDump = asObject({
|
|
|
163
167
|
loginAuth: asOptional(asBase64),
|
|
164
168
|
loginAuthBox: asOptional(asEdgeBox),
|
|
165
169
|
|
|
170
|
+
// Username:
|
|
171
|
+
userId: asOptional(asBase64),
|
|
172
|
+
userTextBox: asOptional(asEdgeBox),
|
|
173
|
+
|
|
166
174
|
// Keys and assorted goodies:
|
|
167
175
|
keyBoxes: asOptional(asArray(asEdgeBox), []),
|
|
168
176
|
mnemonicBox: asOptional(asEdgeBox),
|
package/lib/types/fake-types.ts
CHANGED
|
@@ -76,6 +76,10 @@ export interface LoginDump {
|
|
|
76
76
|
loginAuth?: Uint8Array
|
|
77
77
|
loginAuthBox?: EdgeBox
|
|
78
78
|
|
|
79
|
+
// Username:
|
|
80
|
+
userId?: Uint8Array
|
|
81
|
+
userTextBox?: EdgeBox
|
|
82
|
+
|
|
79
83
|
// Resources:
|
|
80
84
|
children: LoginDump[]
|
|
81
85
|
keyBoxes: EdgeBox[]
|
|
@@ -161,6 +165,10 @@ export const asLoginDump: Cleaner<LoginDump> = asObject({
|
|
|
161
165
|
loginAuth: asOptional(asBase64),
|
|
162
166
|
loginAuthBox: asOptional(asEdgeBox),
|
|
163
167
|
|
|
168
|
+
// Username:
|
|
169
|
+
userId: asOptional(asBase64),
|
|
170
|
+
userTextBox: asOptional(asEdgeBox),
|
|
171
|
+
|
|
164
172
|
// Keys and assorted goodies:
|
|
165
173
|
keyBoxes: asOptional(asArray(asEdgeBox), []),
|
|
166
174
|
mnemonicBox: asOptional(asEdgeBox),
|
|
@@ -43,6 +43,7 @@ import { base16, base32, base64 } from 'rfc4648'
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
/**
|
|
@@ -219,6 +220,13 @@ export const asChangeSecretPayload = asObject({
|
|
|
219
220
|
loginAuth: asBase64
|
|
220
221
|
})
|
|
221
222
|
|
|
223
|
+
export const asChangeUsernamePayload = asObject(
|
|
224
|
+
{
|
|
225
|
+
userId: asBase64,
|
|
226
|
+
userTextBox: asEdgeBox
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
|
|
222
230
|
export const asChangeVouchersPayload = asObject(
|
|
223
231
|
{
|
|
224
232
|
approvedVouchers: asOptional(asArray(asString)),
|
|
@@ -251,7 +259,6 @@ export const asLoginPayload = asObject({
|
|
|
251
259
|
appId: asString,
|
|
252
260
|
created: asDate,
|
|
253
261
|
loginId: asBase64,
|
|
254
|
-
userId: asOptional(asBase64),
|
|
255
262
|
|
|
256
263
|
// Nested logins:
|
|
257
264
|
children: asOptional(asArray(raw => asLoginPayload(raw))),
|
|
@@ -281,6 +288,10 @@ export const asLoginPayload = asObject({
|
|
|
281
288
|
// Secret-key login:
|
|
282
289
|
loginAuthBox: asOptional(asEdgeBox),
|
|
283
290
|
|
|
291
|
+
// Username:
|
|
292
|
+
userId: asOptional(asBase64),
|
|
293
|
+
userTextBox: asOptional(asEdgeBox),
|
|
294
|
+
|
|
284
295
|
// Voucher login:
|
|
285
296
|
pendingVouchers: asOptional(asArray(asEdgePendingVoucher), []),
|
|
286
297
|
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
ChangePin2Payload,
|
|
20
20
|
ChangeRecovery2Payload,
|
|
21
21
|
ChangeSecretPayload,
|
|
22
|
+
ChangeUsernamePayload,
|
|
22
23
|
ChangeVouchersPayload,
|
|
23
24
|
CreateKeysPayload,
|
|
24
25
|
CreateLoginPayload,
|
|
@@ -214,6 +215,13 @@ export const asChangeSecretPayload: Cleaner<ChangeSecretPayload> = asObject({
|
|
|
214
215
|
loginAuth: asBase64
|
|
215
216
|
})
|
|
216
217
|
|
|
218
|
+
export const asChangeUsernamePayload: Cleaner<ChangeUsernamePayload> = asObject(
|
|
219
|
+
{
|
|
220
|
+
userId: asBase64,
|
|
221
|
+
userTextBox: asEdgeBox
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
|
|
217
225
|
export const asChangeVouchersPayload: Cleaner<ChangeVouchersPayload> = asObject(
|
|
218
226
|
{
|
|
219
227
|
approvedVouchers: asOptional(asArray(asString)),
|
|
@@ -246,7 +254,6 @@ export const asLoginPayload: Cleaner<LoginPayload> = asObject({
|
|
|
246
254
|
appId: asString,
|
|
247
255
|
created: asDate,
|
|
248
256
|
loginId: asBase64,
|
|
249
|
-
userId: asOptional(asBase64),
|
|
250
257
|
|
|
251
258
|
// Nested logins:
|
|
252
259
|
children: asOptional(asArray(raw => asLoginPayload(raw))),
|
|
@@ -276,6 +283,10 @@ export const asLoginPayload: Cleaner<LoginPayload> = asObject({
|
|
|
276
283
|
// Secret-key login:
|
|
277
284
|
loginAuthBox: asOptional(asEdgeBox),
|
|
278
285
|
|
|
286
|
+
// Username:
|
|
287
|
+
userId: asOptional(asBase64),
|
|
288
|
+
userTextBox: asOptional(asEdgeBox),
|
|
289
|
+
|
|
279
290
|
// Voucher login:
|
|
280
291
|
pendingVouchers: asOptional(asArray(asEdgePendingVoucher), []),
|
|
281
292
|
|
|
@@ -135,6 +135,11 @@ export interface ChangeSecretPayload {
|
|
|
135
135
|
loginAuth: Uint8Array
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
export interface ChangeUsernamePayload {
|
|
139
|
+
userId: Uint8Array
|
|
140
|
+
userTextBox: EdgeBox
|
|
141
|
+
}
|
|
142
|
+
|
|
138
143
|
export interface ChangeVouchersPayload {
|
|
139
144
|
approvedVouchers?: string[]
|
|
140
145
|
rejectedVouchers?: string[]
|
|
@@ -181,7 +186,6 @@ export interface LoginPayload {
|
|
|
181
186
|
appId: string
|
|
182
187
|
created: Date
|
|
183
188
|
loginId: Uint8Array
|
|
184
|
-
userId?: Uint8Array
|
|
185
189
|
|
|
186
190
|
// Nested logins:
|
|
187
191
|
children?: LoginPayload[]
|
|
@@ -211,6 +215,10 @@ export interface LoginPayload {
|
|
|
211
215
|
// Secret-key login:
|
|
212
216
|
loginAuthBox?: EdgeBox
|
|
213
217
|
|
|
218
|
+
// Username:
|
|
219
|
+
userId?: Uint8Array
|
|
220
|
+
userTextBox?: EdgeBox
|
|
221
|
+
|
|
214
222
|
// Voucher login:
|
|
215
223
|
pendingVouchers: EdgePendingVoucher[]
|
|
216
224
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-core-js",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.24",
|
|
4
4
|
"description": "Edge account & wallet management library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitcoin",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"cleaners": "^0.3.11",
|
|
84
84
|
"currency-codes": "^1.1.2",
|
|
85
85
|
"disklet": "^0.5.2",
|
|
86
|
-
"edge-sync-client": "^0.2.
|
|
86
|
+
"edge-sync-client": "^0.2.7",
|
|
87
87
|
"elliptic": "^6.4.0",
|
|
88
88
|
"ethereumjs-tx": "^1.3.7",
|
|
89
89
|
"ethereumjs-util": "^5.2.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"rfc4648": "^1.4.0",
|
|
97
97
|
"scrypt-js": "^2.0.3",
|
|
98
98
|
"serverlet": "^0.1.0",
|
|
99
|
-
"yaob": "^0.3.
|
|
99
|
+
"yaob": "^0.3.8",
|
|
100
100
|
"yavent": "^0.1.3"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
package/src/types/error.js
CHANGED
|
@@ -224,35 +224,49 @@ export class SpendToSelfError extends Error {
|
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
226
|
* Trying to swap an amount that is either too low or too high.
|
|
227
|
-
* @param nativeMax the maximum supported amount, in the
|
|
227
|
+
* @param nativeMax the maximum supported amount, in the currency specified
|
|
228
|
+
* by the direction (defaults to "from" currency)
|
|
228
229
|
*/
|
|
229
230
|
export class SwapAboveLimitError extends Error {
|
|
230
231
|
name: string
|
|
231
232
|
+pluginId: string
|
|
232
233
|
+nativeMax: string
|
|
234
|
+
+direction: 'from' | 'to'
|
|
233
235
|
|
|
234
|
-
constructor(
|
|
236
|
+
constructor(
|
|
237
|
+
swapInfo: EdgeSwapInfo,
|
|
238
|
+
nativeMax: string,
|
|
239
|
+
direction: 'from' | 'to' = 'from'
|
|
240
|
+
) {
|
|
235
241
|
super('Amount is too high')
|
|
236
242
|
this.name = 'SwapAboveLimitError'
|
|
237
243
|
this.pluginId = swapInfo.pluginId
|
|
238
244
|
this.nativeMax = nativeMax
|
|
245
|
+
this.direction = direction
|
|
239
246
|
}
|
|
240
247
|
}
|
|
241
248
|
|
|
242
249
|
/**
|
|
243
250
|
* Trying to swap an amount that is either too low or too high.
|
|
244
|
-
* @param nativeMin the minimum supported amount, in the
|
|
251
|
+
* @param nativeMin the minimum supported amount, in the currency specified
|
|
252
|
+
* by the direction (defaults to "from" currency)
|
|
245
253
|
*/
|
|
246
254
|
export class SwapBelowLimitError extends Error {
|
|
247
255
|
name: string
|
|
248
256
|
+pluginId: string
|
|
249
257
|
+nativeMin: string
|
|
258
|
+
+direction: 'from' | 'to'
|
|
250
259
|
|
|
251
|
-
constructor(
|
|
260
|
+
constructor(
|
|
261
|
+
swapInfo: EdgeSwapInfo,
|
|
262
|
+
nativeMin: string,
|
|
263
|
+
direction: 'from' | 'to' = 'from'
|
|
264
|
+
) {
|
|
252
265
|
super('Amount is too low')
|
|
253
266
|
this.name = 'SwapBelowLimitError'
|
|
254
267
|
this.pluginId = swapInfo.pluginId
|
|
255
268
|
this.nativeMin = nativeMin
|
|
269
|
+
this.direction = direction
|
|
256
270
|
}
|
|
257
271
|
}
|
|
258
272
|
|
package/src/types/fake-types.js
CHANGED
|
@@ -78,6 +78,10 @@ export type LoginDump = {
|
|
|
78
78
|
loginAuth?: Uint8Array,
|
|
79
79
|
loginAuthBox?: EdgeBox,
|
|
80
80
|
|
|
81
|
+
// Username:
|
|
82
|
+
userId?: Uint8Array,
|
|
83
|
+
userTextBox?: EdgeBox,
|
|
84
|
+
|
|
81
85
|
// Resources:
|
|
82
86
|
children: LoginDump[],
|
|
83
87
|
keyBoxes: EdgeBox[],
|
|
@@ -163,6 +167,10 @@ export const asLoginDump: Cleaner<LoginDump> = asObject({
|
|
|
163
167
|
loginAuth: asOptional(asBase64),
|
|
164
168
|
loginAuthBox: asOptional(asEdgeBox),
|
|
165
169
|
|
|
170
|
+
// Username:
|
|
171
|
+
userId: asOptional(asBase64),
|
|
172
|
+
userTextBox: asOptional(asEdgeBox),
|
|
173
|
+
|
|
166
174
|
// Keys and assorted goodies:
|
|
167
175
|
keyBoxes: asOptional(asArray(asEdgeBox), []),
|
|
168
176
|
mnemonicBox: asOptional(asEdgeBox),
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
type ChangePin2Payload,
|
|
22
22
|
type ChangeRecovery2Payload,
|
|
23
23
|
type ChangeSecretPayload,
|
|
24
|
+
type ChangeUsernamePayload,
|
|
24
25
|
type ChangeVouchersPayload,
|
|
25
26
|
type CreateKeysPayload,
|
|
26
27
|
type CreateLoginPayload,
|
|
@@ -219,6 +220,13 @@ export const asChangeSecretPayload: Cleaner<ChangeSecretPayload> = asObject({
|
|
|
219
220
|
loginAuth: asBase64
|
|
220
221
|
})
|
|
221
222
|
|
|
223
|
+
export const asChangeUsernamePayload: Cleaner<ChangeUsernamePayload> = asObject(
|
|
224
|
+
{
|
|
225
|
+
userId: asBase64,
|
|
226
|
+
userTextBox: asEdgeBox
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
|
|
222
230
|
export const asChangeVouchersPayload: Cleaner<ChangeVouchersPayload> = asObject(
|
|
223
231
|
{
|
|
224
232
|
approvedVouchers: asOptional(asArray(asString)),
|
|
@@ -251,7 +259,6 @@ export const asLoginPayload: Cleaner<LoginPayload> = asObject({
|
|
|
251
259
|
appId: asString,
|
|
252
260
|
created: asDate,
|
|
253
261
|
loginId: asBase64,
|
|
254
|
-
userId: asOptional(asBase64),
|
|
255
262
|
|
|
256
263
|
// Nested logins:
|
|
257
264
|
children: asOptional(asArray(raw => asLoginPayload(raw))),
|
|
@@ -281,6 +288,10 @@ export const asLoginPayload: Cleaner<LoginPayload> = asObject({
|
|
|
281
288
|
// Secret-key login:
|
|
282
289
|
loginAuthBox: asOptional(asEdgeBox),
|
|
283
290
|
|
|
291
|
+
// Username:
|
|
292
|
+
userId: asOptional(asBase64),
|
|
293
|
+
userTextBox: asOptional(asEdgeBox),
|
|
294
|
+
|
|
284
295
|
// Voucher login:
|
|
285
296
|
pendingVouchers: asOptional(asArray(asEdgePendingVoucher), []),
|
|
286
297
|
|
|
@@ -140,6 +140,11 @@ export type ChangeSecretPayload = {
|
|
|
140
140
|
loginAuth: Uint8Array
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
export type ChangeUsernamePayload = {
|
|
144
|
+
userId: Uint8Array,
|
|
145
|
+
userTextBox: EdgeBox
|
|
146
|
+
}
|
|
147
|
+
|
|
143
148
|
export type ChangeVouchersPayload = {
|
|
144
149
|
approvedVouchers?: string[],
|
|
145
150
|
rejectedVouchers?: string[]
|
|
@@ -186,7 +191,6 @@ export type LoginPayload = {
|
|
|
186
191
|
appId: string,
|
|
187
192
|
created: Date,
|
|
188
193
|
loginId: Uint8Array,
|
|
189
|
-
userId?: Uint8Array,
|
|
190
194
|
|
|
191
195
|
// Nested logins:
|
|
192
196
|
children?: LoginPayload[],
|
|
@@ -216,6 +220,10 @@ export type LoginPayload = {
|
|
|
216
220
|
// Secret-key login:
|
|
217
221
|
loginAuthBox?: EdgeBox,
|
|
218
222
|
|
|
223
|
+
// Username:
|
|
224
|
+
userId?: Uint8Array,
|
|
225
|
+
userTextBox?: EdgeBox,
|
|
226
|
+
|
|
219
227
|
// Voucher login:
|
|
220
228
|
pendingVouchers: EdgePendingVoucher[],
|
|
221
229
|
|
package/types.js
CHANGED
|
@@ -145,6 +145,10 @@ cleaners.asObject({
|
|
|
145
145
|
loginAuthBox: asEdgeBox,
|
|
146
146
|
loginAuth: asBase64
|
|
147
147
|
});
|
|
148
|
+
cleaners.asObject({
|
|
149
|
+
userId: asBase64,
|
|
150
|
+
userTextBox: asEdgeBox
|
|
151
|
+
});
|
|
148
152
|
cleaners.asObject({
|
|
149
153
|
approvedVouchers: cleaners.asOptional(cleaners.asArray(cleaners.asString)),
|
|
150
154
|
rejectedVouchers: cleaners.asOptional(cleaners.asArray(cleaners.asString))
|
|
@@ -170,7 +174,6 @@ const asLoginPayload = cleaners.asObject({
|
|
|
170
174
|
appId: cleaners.asString,
|
|
171
175
|
created: cleaners.asDate,
|
|
172
176
|
loginId: asBase64,
|
|
173
|
-
userId: cleaners.asOptional(asBase64),
|
|
174
177
|
// Nested logins:
|
|
175
178
|
children: cleaners.asOptional(cleaners.asArray(raw => asLoginPayload(raw))),
|
|
176
179
|
parentBox: cleaners.asOptional(asEdgeBox),
|
|
@@ -193,6 +196,9 @@ const asLoginPayload = cleaners.asObject({
|
|
|
193
196
|
recovery2KeyBox: cleaners.asOptional(asEdgeBox),
|
|
194
197
|
// Secret-key login:
|
|
195
198
|
loginAuthBox: cleaners.asOptional(asEdgeBox),
|
|
199
|
+
// Username:
|
|
200
|
+
userId: cleaners.asOptional(asBase64),
|
|
201
|
+
userTextBox: cleaners.asOptional(asEdgeBox),
|
|
196
202
|
// Voucher login:
|
|
197
203
|
pendingVouchers: cleaners.asOptional(cleaners.asArray(asEdgePendingVoucher), []),
|
|
198
204
|
// Resources:
|
|
@@ -563,10 +569,11 @@ function SpendToSelfError(message = 'Spending to self') {
|
|
|
563
569
|
}
|
|
564
570
|
/**
|
|
565
571
|
* Trying to swap an amount that is either too low or too high.
|
|
566
|
-
* @param nativeMax the maximum supported amount, in the
|
|
572
|
+
* @param nativeMax the maximum supported amount, in the currency specified
|
|
573
|
+
* by the direction (defaults to "from" currency)
|
|
567
574
|
*/
|
|
568
575
|
|
|
569
|
-
function SwapAboveLimitError(swapInfo, nativeMax) {
|
|
576
|
+
function SwapAboveLimitError(swapInfo, nativeMax, direction = 'from') {
|
|
570
577
|
if (!(this instanceof SwapAboveLimitError)) throw new TypeError("Class constructor SwapAboveLimitError cannot be invoked without 'new'");
|
|
571
578
|
|
|
572
579
|
var _this11;
|
|
@@ -586,14 +593,16 @@ function SwapAboveLimitError(swapInfo, nativeMax) {
|
|
|
586
593
|
_this11.name = 'SwapAboveLimitError';
|
|
587
594
|
_this11.pluginId = swapInfo.pluginId;
|
|
588
595
|
_this11.nativeMax = nativeMax;
|
|
596
|
+
_this11.direction = direction;
|
|
589
597
|
return _this11;
|
|
590
598
|
}
|
|
591
599
|
/**
|
|
592
600
|
* Trying to swap an amount that is either too low or too high.
|
|
593
|
-
* @param nativeMin the minimum supported amount, in the
|
|
601
|
+
* @param nativeMin the minimum supported amount, in the currency specified
|
|
602
|
+
* by the direction (defaults to "from" currency)
|
|
594
603
|
*/
|
|
595
604
|
|
|
596
|
-
function SwapBelowLimitError(swapInfo, nativeMin) {
|
|
605
|
+
function SwapBelowLimitError(swapInfo, nativeMin, direction = 'from') {
|
|
597
606
|
if (!(this instanceof SwapBelowLimitError)) throw new TypeError("Class constructor SwapBelowLimitError cannot be invoked without 'new'");
|
|
598
607
|
|
|
599
608
|
var _this12;
|
|
@@ -613,6 +622,7 @@ function SwapBelowLimitError(swapInfo, nativeMin) {
|
|
|
613
622
|
_this12.name = 'SwapBelowLimitError';
|
|
614
623
|
_this12.pluginId = swapInfo.pluginId;
|
|
615
624
|
_this12.nativeMin = nativeMin;
|
|
625
|
+
_this12.direction = direction;
|
|
616
626
|
return _this12;
|
|
617
627
|
}
|
|
618
628
|
/**
|