@depay/widgets 7.16.5 → 8.0.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/README.md +14 -14
- package/dist/esm/index.bundle.js +22 -18
- package/dist/esm/index.js +528 -1439
- package/dist/umd/index.bundle.js +22 -18
- package/dist/umd/index.js +526 -1437
- package/package.json +19 -18
package/dist/umd/index.js
CHANGED
|
@@ -17,29 +17,24 @@
|
|
|
17
17
|
reject(error);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
20
|
if (info.done) {
|
|
22
21
|
resolve(value);
|
|
23
22
|
} else {
|
|
24
23
|
Promise.resolve(value).then(_next, _throw);
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
function _asyncToGenerator(fn) {
|
|
29
27
|
return function () {
|
|
30
28
|
var self = this,
|
|
31
|
-
|
|
29
|
+
args = arguments;
|
|
32
30
|
return new Promise(function (resolve, reject) {
|
|
33
31
|
var gen = fn.apply(self, args);
|
|
34
|
-
|
|
35
32
|
function _next(value) {
|
|
36
33
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
37
34
|
}
|
|
38
|
-
|
|
39
35
|
function _throw(err) {
|
|
40
36
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
41
37
|
}
|
|
42
|
-
|
|
43
38
|
_next(undefined);
|
|
44
39
|
});
|
|
45
40
|
};
|
|
@@ -72,27 +67,22 @@
|
|
|
72
67
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
73
68
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
74
69
|
}
|
|
75
|
-
|
|
76
70
|
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
77
71
|
});
|
|
78
72
|
|
|
79
73
|
var regeneratorRuntime$1 = createCommonjsModule(function (module) {
|
|
80
74
|
var _typeof = _typeof_1["default"];
|
|
81
|
-
|
|
82
75
|
function _regeneratorRuntime() {
|
|
83
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
84
|
-
|
|
85
76
|
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
86
77
|
return exports;
|
|
87
78
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
88
79
|
var exports = {},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
80
|
+
Op = Object.prototype,
|
|
81
|
+
hasOwn = Op.hasOwnProperty,
|
|
82
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
83
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
84
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
85
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
96
86
|
function define(obj, key, value) {
|
|
97
87
|
return Object.defineProperty(obj, key, {
|
|
98
88
|
value: value,
|
|
@@ -101,7 +91,6 @@
|
|
|
101
91
|
writable: !0
|
|
102
92
|
}), obj[key];
|
|
103
93
|
}
|
|
104
|
-
|
|
105
94
|
try {
|
|
106
95
|
define({}, "");
|
|
107
96
|
} catch (err) {
|
|
@@ -109,40 +98,33 @@
|
|
|
109
98
|
return obj[key] = value;
|
|
110
99
|
};
|
|
111
100
|
}
|
|
112
|
-
|
|
113
101
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
114
102
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
115
|
-
|
|
116
|
-
|
|
103
|
+
generator = Object.create(protoGenerator.prototype),
|
|
104
|
+
context = new Context(tryLocsList || []);
|
|
117
105
|
return generator._invoke = function (innerFn, self, context) {
|
|
118
106
|
var state = "suspendedStart";
|
|
119
107
|
return function (method, arg) {
|
|
120
108
|
if ("executing" === state) throw new Error("Generator is already running");
|
|
121
|
-
|
|
122
109
|
if ("completed" === state) {
|
|
123
110
|
if ("throw" === method) throw arg;
|
|
124
111
|
return doneResult();
|
|
125
112
|
}
|
|
126
|
-
|
|
127
113
|
for (context.method = method, context.arg = arg;;) {
|
|
128
114
|
var delegate = context.delegate;
|
|
129
|
-
|
|
130
115
|
if (delegate) {
|
|
131
116
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
132
|
-
|
|
133
117
|
if (delegateResult) {
|
|
134
118
|
if (delegateResult === ContinueSentinel) continue;
|
|
135
119
|
return delegateResult;
|
|
136
120
|
}
|
|
137
121
|
}
|
|
138
|
-
|
|
139
122
|
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
140
123
|
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
141
124
|
context.dispatchException(context.arg);
|
|
142
125
|
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
143
126
|
state = "executing";
|
|
144
127
|
var record = tryCatch(innerFn, self, context);
|
|
145
|
-
|
|
146
128
|
if ("normal" === record.type) {
|
|
147
129
|
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
148
130
|
return {
|
|
@@ -150,13 +132,11 @@
|
|
|
150
132
|
done: context.done
|
|
151
133
|
};
|
|
152
134
|
}
|
|
153
|
-
|
|
154
135
|
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
155
136
|
}
|
|
156
137
|
};
|
|
157
138
|
}(innerFn, self, context), generator;
|
|
158
139
|
}
|
|
159
|
-
|
|
160
140
|
function tryCatch(fn, obj, arg) {
|
|
161
141
|
try {
|
|
162
142
|
return {
|
|
@@ -170,25 +150,19 @@
|
|
|
170
150
|
};
|
|
171
151
|
}
|
|
172
152
|
}
|
|
173
|
-
|
|
174
153
|
exports.wrap = wrap;
|
|
175
154
|
var ContinueSentinel = {};
|
|
176
|
-
|
|
177
155
|
function Generator() {}
|
|
178
|
-
|
|
179
156
|
function GeneratorFunction() {}
|
|
180
|
-
|
|
181
157
|
function GeneratorFunctionPrototype() {}
|
|
182
|
-
|
|
183
158
|
var IteratorPrototype = {};
|
|
184
159
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
185
160
|
return this;
|
|
186
161
|
});
|
|
187
162
|
var getProto = Object.getPrototypeOf,
|
|
188
|
-
|
|
163
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
189
164
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
190
165
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
191
|
-
|
|
192
166
|
function defineIteratorMethods(prototype) {
|
|
193
167
|
["next", "throw", "return"].forEach(function (method) {
|
|
194
168
|
define(prototype, method, function (arg) {
|
|
@@ -196,14 +170,12 @@
|
|
|
196
170
|
});
|
|
197
171
|
});
|
|
198
172
|
}
|
|
199
|
-
|
|
200
173
|
function AsyncIterator(generator, PromiseImpl) {
|
|
201
174
|
function invoke(method, arg, resolve, reject) {
|
|
202
175
|
var record = tryCatch(generator[method], generator, arg);
|
|
203
|
-
|
|
204
176
|
if ("throw" !== record.type) {
|
|
205
177
|
var result = record.arg,
|
|
206
|
-
|
|
178
|
+
value = result.value;
|
|
207
179
|
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
208
180
|
invoke("next", value, resolve, reject);
|
|
209
181
|
}, function (err) {
|
|
@@ -214,91 +186,73 @@
|
|
|
214
186
|
return invoke("throw", error, resolve, reject);
|
|
215
187
|
});
|
|
216
188
|
}
|
|
217
|
-
|
|
218
189
|
reject(record.arg);
|
|
219
190
|
}
|
|
220
|
-
|
|
221
191
|
var previousPromise;
|
|
222
|
-
|
|
223
192
|
this._invoke = function (method, arg) {
|
|
224
193
|
function callInvokeWithMethodAndArg() {
|
|
225
194
|
return new PromiseImpl(function (resolve, reject) {
|
|
226
195
|
invoke(method, arg, resolve, reject);
|
|
227
196
|
});
|
|
228
197
|
}
|
|
229
|
-
|
|
230
198
|
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
231
199
|
};
|
|
232
200
|
}
|
|
233
|
-
|
|
234
201
|
function maybeInvokeDelegate(delegate, context) {
|
|
235
202
|
var method = delegate.iterator[context.method];
|
|
236
|
-
|
|
237
203
|
if (undefined === method) {
|
|
238
204
|
if (context.delegate = null, "throw" === context.method) {
|
|
239
205
|
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
240
206
|
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
241
207
|
}
|
|
242
|
-
|
|
243
208
|
return ContinueSentinel;
|
|
244
209
|
}
|
|
245
|
-
|
|
246
210
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
247
211
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
248
212
|
var info = record.arg;
|
|
249
213
|
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
250
214
|
}
|
|
251
|
-
|
|
252
215
|
function pushTryEntry(locs) {
|
|
253
216
|
var entry = {
|
|
254
217
|
tryLoc: locs[0]
|
|
255
218
|
};
|
|
256
219
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
257
220
|
}
|
|
258
|
-
|
|
259
221
|
function resetTryEntry(entry) {
|
|
260
222
|
var record = entry.completion || {};
|
|
261
223
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
262
224
|
}
|
|
263
|
-
|
|
264
225
|
function Context(tryLocsList) {
|
|
265
226
|
this.tryEntries = [{
|
|
266
227
|
tryLoc: "root"
|
|
267
228
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
268
229
|
}
|
|
269
|
-
|
|
270
230
|
function values(iterable) {
|
|
271
231
|
if (iterable) {
|
|
272
232
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
273
233
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
274
234
|
if ("function" == typeof iterable.next) return iterable;
|
|
275
|
-
|
|
276
235
|
if (!isNaN(iterable.length)) {
|
|
277
236
|
var i = -1,
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
};
|
|
285
|
-
|
|
237
|
+
next = function next() {
|
|
238
|
+
for (; ++i < iterable.length;) {
|
|
239
|
+
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
240
|
+
}
|
|
241
|
+
return next.value = undefined, next.done = !0, next;
|
|
242
|
+
};
|
|
286
243
|
return next.next = next;
|
|
287
244
|
}
|
|
288
245
|
}
|
|
289
|
-
|
|
290
246
|
return {
|
|
291
247
|
next: doneResult
|
|
292
248
|
};
|
|
293
249
|
}
|
|
294
|
-
|
|
295
250
|
function doneResult() {
|
|
296
251
|
return {
|
|
297
252
|
value: undefined,
|
|
298
253
|
done: !0
|
|
299
254
|
};
|
|
300
255
|
}
|
|
301
|
-
|
|
302
256
|
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
303
257
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
304
258
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
@@ -322,17 +276,14 @@
|
|
|
322
276
|
return "[object Generator]";
|
|
323
277
|
}), exports.keys = function (object) {
|
|
324
278
|
var keys = [];
|
|
325
|
-
|
|
326
279
|
for (var key in object) {
|
|
327
280
|
keys.push(key);
|
|
328
281
|
}
|
|
329
|
-
|
|
330
282
|
return keys.reverse(), function next() {
|
|
331
283
|
for (; keys.length;) {
|
|
332
284
|
var key = keys.pop();
|
|
333
285
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
334
286
|
}
|
|
335
|
-
|
|
336
287
|
return next.done = !0, next;
|
|
337
288
|
};
|
|
338
289
|
}, exports.values = values, Context.prototype = {
|
|
@@ -351,20 +302,16 @@
|
|
|
351
302
|
dispatchException: function dispatchException(exception) {
|
|
352
303
|
if (this.done) throw exception;
|
|
353
304
|
var context = this;
|
|
354
|
-
|
|
355
305
|
function handle(loc, caught) {
|
|
356
306
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
357
307
|
}
|
|
358
|
-
|
|
359
308
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
360
309
|
var entry = this.tryEntries[i],
|
|
361
|
-
|
|
310
|
+
record = entry.completion;
|
|
362
311
|
if ("root" === entry.tryLoc) return handle("end");
|
|
363
|
-
|
|
364
312
|
if (entry.tryLoc <= this.prev) {
|
|
365
313
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
366
|
-
|
|
367
|
-
|
|
314
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
368
315
|
if (hasCatch && hasFinally) {
|
|
369
316
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
370
317
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -380,13 +327,11 @@
|
|
|
380
327
|
abrupt: function abrupt(type, arg) {
|
|
381
328
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
382
329
|
var entry = this.tryEntries[i];
|
|
383
|
-
|
|
384
330
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
385
331
|
var finallyEntry = entry;
|
|
386
332
|
break;
|
|
387
333
|
}
|
|
388
334
|
}
|
|
389
|
-
|
|
390
335
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
391
336
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
392
337
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -404,19 +349,15 @@
|
|
|
404
349
|
"catch": function _catch(tryLoc) {
|
|
405
350
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
406
351
|
var entry = this.tryEntries[i];
|
|
407
|
-
|
|
408
352
|
if (entry.tryLoc === tryLoc) {
|
|
409
353
|
var record = entry.completion;
|
|
410
|
-
|
|
411
354
|
if ("throw" === record.type) {
|
|
412
355
|
var thrown = record.arg;
|
|
413
356
|
resetTryEntry(entry);
|
|
414
357
|
}
|
|
415
|
-
|
|
416
358
|
return thrown;
|
|
417
359
|
}
|
|
418
360
|
}
|
|
419
|
-
|
|
420
361
|
throw new Error("illegal catch attempt");
|
|
421
362
|
},
|
|
422
363
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -428,7 +369,6 @@
|
|
|
428
369
|
}
|
|
429
370
|
}, exports;
|
|
430
371
|
}
|
|
431
|
-
|
|
432
372
|
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
433
373
|
});
|
|
434
374
|
|
|
@@ -454,18 +394,14 @@
|
|
|
454
394
|
|
|
455
395
|
function _iterableToArrayLimit(arr, i) {
|
|
456
396
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
457
|
-
|
|
458
397
|
if (_i == null) return;
|
|
459
398
|
var _arr = [];
|
|
460
399
|
var _n = true;
|
|
461
400
|
var _d = false;
|
|
462
|
-
|
|
463
401
|
var _s, _e;
|
|
464
|
-
|
|
465
402
|
try {
|
|
466
403
|
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
467
404
|
_arr.push(_s.value);
|
|
468
|
-
|
|
469
405
|
if (i && _arr.length === i) break;
|
|
470
406
|
}
|
|
471
407
|
} catch (err) {
|
|
@@ -478,17 +414,14 @@
|
|
|
478
414
|
if (_d) throw _e;
|
|
479
415
|
}
|
|
480
416
|
}
|
|
481
|
-
|
|
482
417
|
return _arr;
|
|
483
418
|
}
|
|
484
419
|
|
|
485
420
|
function _arrayLikeToArray(arr, len) {
|
|
486
421
|
if (len == null || len > arr.length) len = arr.length;
|
|
487
|
-
|
|
488
422
|
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
489
423
|
arr2[i] = arr[i];
|
|
490
424
|
}
|
|
491
|
-
|
|
492
425
|
return arr2;
|
|
493
426
|
}
|
|
494
427
|
|
|
@@ -515,32 +448,26 @@
|
|
|
515
448
|
|
|
516
449
|
var ClosableProvider = (function (props) {
|
|
517
450
|
var _useState = React.useState(true),
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
451
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
452
|
+
closable = _useState2[0],
|
|
453
|
+
setClosable = _useState2[1];
|
|
522
454
|
var _useState3 = React.useState(true),
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
455
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
456
|
+
open = _useState4[0],
|
|
457
|
+
setOpen = _useState4[1];
|
|
527
458
|
var _useContext = React.useContext(UpdatableContext),
|
|
528
|
-
|
|
529
|
-
|
|
459
|
+
setUpdatable = _useContext.setUpdatable;
|
|
530
460
|
var close = function close() {
|
|
531
461
|
if (props.closable === false) {
|
|
532
462
|
return;
|
|
533
463
|
}
|
|
534
|
-
|
|
535
464
|
if (!closable) {
|
|
536
465
|
return;
|
|
537
466
|
}
|
|
538
|
-
|
|
539
467
|
setUpdatable(false);
|
|
540
468
|
setOpen(false);
|
|
541
469
|
setTimeout(props.unmount, 300);
|
|
542
470
|
};
|
|
543
|
-
|
|
544
471
|
return /*#__PURE__*/React__default["default"].createElement(ClosableContext.Provider, {
|
|
545
472
|
value: {
|
|
546
473
|
closable: closable,
|
|
@@ -591,12 +518,10 @@
|
|
|
591
518
|
|
|
592
519
|
var Dialog$1 = (function (props) {
|
|
593
520
|
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
594
|
-
|
|
595
|
-
|
|
521
|
+
navigate = _useContext.navigate;
|
|
596
522
|
var _useContext2 = React.useContext(ClosableContext),
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
523
|
+
close = _useContext2.close,
|
|
524
|
+
closable = _useContext2.closable;
|
|
600
525
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
601
526
|
className: "Dialog"
|
|
602
527
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -624,13 +549,11 @@
|
|
|
624
549
|
|
|
625
550
|
var ConnectingWalletDialog = (function (props) {
|
|
626
551
|
var _useState = React.useState(false),
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
552
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
553
|
+
showConnectButton = _useState2[0],
|
|
554
|
+
setShowConnectButton = _useState2[1];
|
|
631
555
|
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
632
|
-
|
|
633
|
-
|
|
556
|
+
navigate = _useContext.navigate;
|
|
634
557
|
var wallet = props.wallet;
|
|
635
558
|
wallet !== null && wallet !== void 0 && wallet.name ? wallet.name : 'wallet';
|
|
636
559
|
var walletLogo = wallet !== null && wallet !== void 0 && wallet.logo ? wallet.logo : undefined;
|
|
@@ -642,7 +565,6 @@
|
|
|
642
565
|
return clearTimeout(timeout);
|
|
643
566
|
};
|
|
644
567
|
}, []);
|
|
645
|
-
|
|
646
568
|
if (props.pending) {
|
|
647
569
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
648
570
|
stacked: true,
|
|
@@ -713,17 +635,15 @@
|
|
|
713
635
|
|
|
714
636
|
var SelectWalletDialog = (function (props) {
|
|
715
637
|
var _useState = React.useState(false),
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
638
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
639
|
+
showExplanation = _useState2[0],
|
|
640
|
+
setShowExplanation = _useState2[1];
|
|
720
641
|
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
var wallet = web3Wallets.getWallet();
|
|
642
|
+
navigate = _useContext.navigate;
|
|
643
|
+
var wallet = web3Wallets.getWallets()[0];
|
|
724
644
|
React.useEffect(function () {
|
|
725
645
|
_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
726
|
-
var
|
|
646
|
+
var account;
|
|
727
647
|
return regenerator.wrap(function _callee$(_context) {
|
|
728
648
|
while (1) {
|
|
729
649
|
switch (_context.prev = _context.next) {
|
|
@@ -732,18 +652,14 @@
|
|
|
732
652
|
_context.next = 5;
|
|
733
653
|
break;
|
|
734
654
|
}
|
|
735
|
-
|
|
736
655
|
_context.next = 3;
|
|
737
|
-
return wallet.
|
|
738
|
-
|
|
656
|
+
return wallet.account();
|
|
739
657
|
case 3:
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
if (accounts == undefined || accounts.length == 0) {
|
|
658
|
+
account = _context.sent;
|
|
659
|
+
if (account == undefined) {
|
|
743
660
|
navigate('ConnectingWallet');
|
|
744
661
|
props.connect(wallet);
|
|
745
662
|
}
|
|
746
|
-
|
|
747
663
|
case 5:
|
|
748
664
|
case "end":
|
|
749
665
|
return _context.stop();
|
|
@@ -752,27 +668,21 @@
|
|
|
752
668
|
}, _callee);
|
|
753
669
|
}))();
|
|
754
670
|
}, [wallet]);
|
|
755
|
-
|
|
756
671
|
var connect = function connect(walletClass) {
|
|
757
672
|
var wallet = new walletClass();
|
|
758
673
|
props.setWallet(wallet);
|
|
759
674
|
navigate('ConnectingWallet');
|
|
760
675
|
props.connect(wallet);
|
|
761
676
|
};
|
|
762
|
-
|
|
763
677
|
var availableWallets = [web3Wallets.wallets.WalletConnect, web3Wallets.wallets.WalletLink];
|
|
764
|
-
|
|
765
678
|
if (wallet) {
|
|
766
679
|
availableWallets.unshift(wallet.constructor);
|
|
767
680
|
}
|
|
768
|
-
|
|
769
681
|
var walletCards = availableWallets.map(function (wallet, index) {
|
|
770
682
|
var name = wallet.info.name;
|
|
771
|
-
|
|
772
683
|
if (name == 'WalletConnect') {
|
|
773
684
|
name = 'via WalletConnect';
|
|
774
685
|
}
|
|
775
|
-
|
|
776
686
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
777
687
|
key: index,
|
|
778
688
|
className: "PaddingBottomXS"
|
|
@@ -821,41 +731,34 @@
|
|
|
821
731
|
|
|
822
732
|
var ConnectStack = (function (props) {
|
|
823
733
|
var _useContext = React.useContext(ClosableContext),
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
734
|
+
open = _useContext.open,
|
|
735
|
+
close = _useContext.close;
|
|
827
736
|
var _useState = React.useState(),
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
737
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
738
|
+
pending = _useState2[0],
|
|
739
|
+
setPending = _useState2[1];
|
|
832
740
|
var _useState3 = React.useState(),
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
741
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
742
|
+
wallet = _useState4[0],
|
|
743
|
+
setWallet = _useState4[1];
|
|
837
744
|
var connect = function connect(wallet) {
|
|
838
745
|
wallet.connect().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
839
|
-
var
|
|
746
|
+
var account;
|
|
840
747
|
return regenerator.wrap(function _callee$(_context) {
|
|
841
748
|
while (1) {
|
|
842
749
|
switch (_context.prev = _context.next) {
|
|
843
750
|
case 0:
|
|
844
751
|
_context.next = 2;
|
|
845
|
-
return wallet.
|
|
846
|
-
|
|
752
|
+
return wallet.account();
|
|
847
753
|
case 2:
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
if (accounts instanceof Array && accounts.length > 0) {
|
|
754
|
+
account = _context.sent;
|
|
755
|
+
if (account) {
|
|
851
756
|
if (props.autoClose) close();
|
|
852
757
|
if (props.resolve) props.resolve({
|
|
853
758
|
wallet: wallet,
|
|
854
|
-
account:
|
|
855
|
-
accounts: accounts
|
|
759
|
+
account: account
|
|
856
760
|
});
|
|
857
761
|
}
|
|
858
|
-
|
|
859
762
|
case 4:
|
|
860
763
|
case "end":
|
|
861
764
|
return _context.stop();
|
|
@@ -864,7 +767,6 @@
|
|
|
864
767
|
}, _callee);
|
|
865
768
|
})))["catch"](function (error) {
|
|
866
769
|
setPending(false);
|
|
867
|
-
|
|
868
770
|
if ((error === null || error === void 0 ? void 0 : error.code) == 4001) {
|
|
869
771
|
// User rejected the request.
|
|
870
772
|
return;
|
|
@@ -877,17 +779,15 @@
|
|
|
877
779
|
}
|
|
878
780
|
});
|
|
879
781
|
};
|
|
880
|
-
|
|
881
782
|
React.useEffect(function () {
|
|
882
|
-
var wallet = web3Wallets.
|
|
883
|
-
|
|
783
|
+
var wallet = web3Wallets.getWallets()[0];
|
|
884
784
|
if (wallet) {
|
|
885
785
|
setWallet(wallet);
|
|
886
786
|
}
|
|
887
787
|
}, []);
|
|
888
788
|
React.useEffect(function () {
|
|
889
789
|
_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
|
|
890
|
-
var
|
|
790
|
+
var account;
|
|
891
791
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
892
792
|
while (1) {
|
|
893
793
|
switch (_context2.prev = _context2.next) {
|
|
@@ -896,21 +796,16 @@
|
|
|
896
796
|
_context2.next = 5;
|
|
897
797
|
break;
|
|
898
798
|
}
|
|
899
|
-
|
|
900
799
|
_context2.next = 3;
|
|
901
|
-
return wallet.
|
|
902
|
-
|
|
800
|
+
return wallet.account();
|
|
903
801
|
case 3:
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
if (accounts instanceof Array && accounts.length > 0) {
|
|
802
|
+
account = _context2.sent;
|
|
803
|
+
if (account) {
|
|
907
804
|
if (props.resolve) props.resolve({
|
|
908
805
|
wallet: wallet,
|
|
909
|
-
account:
|
|
910
|
-
accounts: accounts
|
|
806
|
+
account: account
|
|
911
807
|
});
|
|
912
808
|
}
|
|
913
|
-
|
|
914
809
|
case 5:
|
|
915
810
|
case "end":
|
|
916
811
|
return _context2.stop();
|
|
@@ -962,7 +857,6 @@
|
|
|
962
857
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
963
858
|
}
|
|
964
859
|
}
|
|
965
|
-
|
|
966
860
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
967
861
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
968
862
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -984,7 +878,6 @@
|
|
|
984
878
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
985
879
|
throw new TypeError("Super expression must either be null or a function");
|
|
986
880
|
}
|
|
987
|
-
|
|
988
881
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
989
882
|
constructor: {
|
|
990
883
|
value: subClass,
|
|
@@ -1002,7 +895,6 @@
|
|
|
1002
895
|
if (self === void 0) {
|
|
1003
896
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1004
897
|
}
|
|
1005
|
-
|
|
1006
898
|
return self;
|
|
1007
899
|
}
|
|
1008
900
|
|
|
@@ -1012,7 +904,6 @@
|
|
|
1012
904
|
} else if (call !== void 0) {
|
|
1013
905
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
1014
906
|
}
|
|
1015
|
-
|
|
1016
907
|
return _assertThisInitialized(self);
|
|
1017
908
|
}
|
|
1018
909
|
|
|
@@ -1193,23 +1084,20 @@
|
|
|
1193
1084
|
}
|
|
1194
1085
|
|
|
1195
1086
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1196
|
-
|
|
1197
1087
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
1198
|
-
|
|
1199
1088
|
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
1200
1089
|
_inherits(ErrorBoundary, _React$Component);
|
|
1201
|
-
|
|
1202
1090
|
var _super = _createSuper(ErrorBoundary);
|
|
1203
|
-
|
|
1204
1091
|
function ErrorBoundary(props) {
|
|
1205
1092
|
_classCallCheck(this, ErrorBoundary);
|
|
1206
|
-
|
|
1207
1093
|
return _super.call(this, props);
|
|
1208
1094
|
}
|
|
1209
|
-
|
|
1210
1095
|
_createClass(ErrorBoundary, [{
|
|
1211
1096
|
key: "componentDidCatch",
|
|
1212
1097
|
value: function componentDidCatch(error, errorInfo) {
|
|
1098
|
+
if (error.error) {
|
|
1099
|
+
error = error.error;
|
|
1100
|
+
}
|
|
1213
1101
|
this.props.setError(error);
|
|
1214
1102
|
}
|
|
1215
1103
|
}, {
|
|
@@ -1218,36 +1106,31 @@
|
|
|
1218
1106
|
return this.props.children;
|
|
1219
1107
|
}
|
|
1220
1108
|
}]);
|
|
1221
|
-
|
|
1222
1109
|
return ErrorBoundary;
|
|
1223
1110
|
}(React__default["default"].Component);
|
|
1224
|
-
|
|
1225
1111
|
var ErrorProvider = (function (props) {
|
|
1226
1112
|
var _useState = React.useState(props.error),
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1113
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1114
|
+
error = _useState2[0],
|
|
1115
|
+
setError = _useState2[1];
|
|
1231
1116
|
var _useState3 = React.useState(true),
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1117
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1118
|
+
open = _useState4[0],
|
|
1119
|
+
setOpen = _useState4[1];
|
|
1236
1120
|
var setErrorFromChildren = function setErrorFromChildren(error) {
|
|
1121
|
+
if (error.error) {
|
|
1122
|
+
error = error.error;
|
|
1123
|
+
}
|
|
1237
1124
|
setError(error);
|
|
1238
|
-
|
|
1239
1125
|
if (props.errorCallback) {
|
|
1240
|
-
props.errorCallback(error);
|
|
1126
|
+
props.errorCallback(error.message || error.toString());
|
|
1241
1127
|
}
|
|
1242
1128
|
};
|
|
1243
|
-
|
|
1244
1129
|
var close = function close() {
|
|
1245
1130
|
setOpen(false);
|
|
1246
1131
|
setTimeout(props.unmount, 300);
|
|
1247
1132
|
};
|
|
1248
|
-
|
|
1249
1133
|
if (error) {
|
|
1250
|
-
console.log(error);
|
|
1251
1134
|
return /*#__PURE__*/React__default["default"].createElement(ReactDialog, {
|
|
1252
1135
|
container: props.container,
|
|
1253
1136
|
close: close,
|
|
@@ -1273,7 +1156,7 @@
|
|
|
1273
1156
|
className: "PaddingLeftS PaddingRightS"
|
|
1274
1157
|
}, /*#__PURE__*/React__default["default"].createElement("pre", {
|
|
1275
1158
|
className: "ErrorSnippetText"
|
|
1276
|
-
}, error.toString())), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1159
|
+
}, error.message || error.toString())), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1277
1160
|
className: "PaddingTopS PaddingBottomS"
|
|
1278
1161
|
}, /*#__PURE__*/React__default["default"].createElement("strong", {
|
|
1279
1162
|
className: "FontSizeM PaddingTopS"
|
|
@@ -1407,7 +1290,6 @@
|
|
|
1407
1290
|
|
|
1408
1291
|
var styleRenderer = (function (style) {
|
|
1409
1292
|
var _style, _style2;
|
|
1410
|
-
|
|
1411
1293
|
style = {
|
|
1412
1294
|
colors: Object.assign({
|
|
1413
1295
|
primary: '#ea357a',
|
|
@@ -1422,44 +1304,37 @@
|
|
|
1422
1304
|
|
|
1423
1305
|
var mount = (function (_ref, content) {
|
|
1424
1306
|
var style = _ref.style,
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1307
|
+
container = _ref.container,
|
|
1308
|
+
document = _ref.document,
|
|
1309
|
+
closed = _ref.closed;
|
|
1428
1310
|
var insideStyle = styleRenderer(style);
|
|
1429
|
-
|
|
1430
1311
|
if (style && style.css) {
|
|
1431
1312
|
insideStyle = [insideStyle, style.css].join(' ');
|
|
1432
1313
|
}
|
|
1433
|
-
|
|
1434
1314
|
var unmountShadowDOM = function unmountShadowDOM() {
|
|
1435
1315
|
// setTimeout to allow dialog to animate out first
|
|
1436
1316
|
setTimeout(function () {
|
|
1437
1317
|
unmount();
|
|
1438
|
-
|
|
1439
1318
|
if (typeof closed == 'function') {
|
|
1440
1319
|
closed();
|
|
1441
1320
|
}
|
|
1442
1321
|
}, 300);
|
|
1443
1322
|
};
|
|
1444
|
-
|
|
1445
1323
|
var outsideStyle;
|
|
1446
|
-
|
|
1447
1324
|
if (container) {
|
|
1448
1325
|
outsideStyle = "\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n z-index: 99999;\n ";
|
|
1449
1326
|
} else {
|
|
1450
1327
|
outsideStyle = "\n position: fixed;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n z-index: 99999;\n ";
|
|
1451
1328
|
}
|
|
1452
|
-
|
|
1453
1329
|
var _ReactShadowDOM = reactShadowDom.ReactShadowDOM({
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1330
|
+
document: document,
|
|
1331
|
+
element: container || document.body,
|
|
1332
|
+
content: content(unmountShadowDOM),
|
|
1333
|
+
outsideStyle: outsideStyle,
|
|
1334
|
+
insideStyle: insideStyle,
|
|
1335
|
+
insideClasses: container ? ['contained'] : []
|
|
1336
|
+
}),
|
|
1337
|
+
unmount = _ReactShadowDOM.unmount;
|
|
1463
1338
|
return unmount;
|
|
1464
1339
|
});
|
|
1465
1340
|
|
|
@@ -1482,10 +1357,9 @@
|
|
|
1482
1357
|
|
|
1483
1358
|
var UpdatableProvider = (function (props) {
|
|
1484
1359
|
var _useState = React.useState(true),
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1360
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1361
|
+
updatable = _useState2[0],
|
|
1362
|
+
setUpdatable = _useState2[1];
|
|
1489
1363
|
return /*#__PURE__*/React__default["default"].createElement(UpdatableContext.Provider, {
|
|
1490
1364
|
value: {
|
|
1491
1365
|
updatable: updatable,
|
|
@@ -1497,44 +1371,35 @@
|
|
|
1497
1371
|
var Connect = function Connect(options) {
|
|
1498
1372
|
requireReactVersion();
|
|
1499
1373
|
var style, error, document;
|
|
1500
|
-
|
|
1501
1374
|
if (_typeof(options) == 'object') {
|
|
1502
1375
|
style = options.style;
|
|
1503
1376
|
error = options.error;
|
|
1504
1377
|
document = options.document;
|
|
1505
1378
|
}
|
|
1506
|
-
|
|
1507
1379
|
return new Promise( /*#__PURE__*/function () {
|
|
1508
1380
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
|
|
1509
|
-
var wallet,
|
|
1381
|
+
var wallet, account;
|
|
1510
1382
|
return regenerator.wrap(function _callee$(_context) {
|
|
1511
1383
|
while (1) {
|
|
1512
1384
|
switch (_context.prev = _context.next) {
|
|
1513
1385
|
case 0:
|
|
1514
|
-
wallet = web3Wallets.
|
|
1515
|
-
|
|
1386
|
+
wallet = web3Wallets.getWallets()[0];
|
|
1516
1387
|
if (!wallet) {
|
|
1517
1388
|
_context.next = 7;
|
|
1518
1389
|
break;
|
|
1519
1390
|
}
|
|
1520
|
-
|
|
1521
1391
|
_context.next = 4;
|
|
1522
|
-
return wallet.
|
|
1523
|
-
|
|
1392
|
+
return wallet.account();
|
|
1524
1393
|
case 4:
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
if (!(accounts instanceof Array && accounts.length > 0)) {
|
|
1394
|
+
account = _context.sent;
|
|
1395
|
+
if (!account) {
|
|
1528
1396
|
_context.next = 7;
|
|
1529
1397
|
break;
|
|
1530
1398
|
}
|
|
1531
|
-
|
|
1532
1399
|
return _context.abrupt("return", resolve({
|
|
1533
1400
|
wallet: wallet,
|
|
1534
|
-
|
|
1535
|
-
account: accounts[0]
|
|
1401
|
+
account: account
|
|
1536
1402
|
}));
|
|
1537
|
-
|
|
1538
1403
|
case 7:
|
|
1539
1404
|
mount({
|
|
1540
1405
|
style: style,
|
|
@@ -1544,7 +1409,6 @@
|
|
|
1544
1409
|
reject('USER_CLOSED_DIALOG');
|
|
1545
1410
|
unmount();
|
|
1546
1411
|
};
|
|
1547
|
-
|
|
1548
1412
|
return function (container) {
|
|
1549
1413
|
return /*#__PURE__*/React__default["default"].createElement(ErrorProvider, {
|
|
1550
1414
|
errorCallback: error,
|
|
@@ -1561,7 +1425,6 @@
|
|
|
1561
1425
|
}), /*#__PURE__*/React__default["default"].createElement(PoweredBy, null))));
|
|
1562
1426
|
};
|
|
1563
1427
|
});
|
|
1564
|
-
|
|
1565
1428
|
case 8:
|
|
1566
1429
|
case "end":
|
|
1567
1430
|
return _context.stop();
|
|
@@ -1569,7 +1432,6 @@
|
|
|
1569
1432
|
}
|
|
1570
1433
|
}, _callee);
|
|
1571
1434
|
}));
|
|
1572
|
-
|
|
1573
1435
|
return function (_x, _x2) {
|
|
1574
1436
|
return _ref.apply(this, arguments);
|
|
1575
1437
|
};
|
|
@@ -1602,15 +1464,12 @@
|
|
|
1602
1464
|
var sortedLowToHigh = _toConsumableArray(routes).sort(function (a, b) {
|
|
1603
1465
|
var aAmountsAvailable = ethers.ethers.BigNumber.from(a.fromBalance).div(ethers.ethers.BigNumber.from(a.fromAmount));
|
|
1604
1466
|
var bAmountsAvailable = ethers.ethers.BigNumber.from(b.fromBalance).div(ethers.ethers.BigNumber.from(b.fromAmount));
|
|
1605
|
-
|
|
1606
1467
|
if (aAmountsAvailable.lt(bAmountsAvailable)) {
|
|
1607
1468
|
return -1;
|
|
1608
1469
|
}
|
|
1609
|
-
|
|
1610
1470
|
if (bAmountsAvailable.lt(aAmountsAvailable)) {
|
|
1611
1471
|
return 1;
|
|
1612
1472
|
}
|
|
1613
|
-
|
|
1614
1473
|
return 0; // equal
|
|
1615
1474
|
});
|
|
1616
1475
|
|
|
@@ -1619,26 +1478,20 @@
|
|
|
1619
1478
|
|
|
1620
1479
|
var round = (function (input) {
|
|
1621
1480
|
var _digitsAfterDecimal;
|
|
1622
|
-
|
|
1623
1481
|
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'up';
|
|
1624
1482
|
var inputAsFloat = parseFloat(input);
|
|
1625
1483
|
var digitsAfterDecimal = inputAsFloat.toString().match(/\d+\.0*(\d{4})/);
|
|
1626
|
-
|
|
1627
1484
|
if ((_digitsAfterDecimal = digitsAfterDecimal) !== null && _digitsAfterDecimal !== void 0 && _digitsAfterDecimal.length) {
|
|
1628
1485
|
digitsAfterDecimal = digitsAfterDecimal[0];
|
|
1629
1486
|
var focus = digitsAfterDecimal.match(/\d{4}$/)[0];
|
|
1630
|
-
|
|
1631
1487
|
var _float;
|
|
1632
|
-
|
|
1633
1488
|
var focusToFixed;
|
|
1634
|
-
|
|
1635
1489
|
if (focus.match(/^0/)) {
|
|
1636
1490
|
if (direction == 'up') {
|
|
1637
1491
|
_float = parseFloat("".concat(focus[1], ".").concat(focus[2]).concat(focus[3]));
|
|
1638
1492
|
} else {
|
|
1639
1493
|
_float = parseFloat("".concat(focus[1], ".").concat(focus[2]).concat(focus[3]));
|
|
1640
1494
|
}
|
|
1641
|
-
|
|
1642
1495
|
focusToFixed = parseFloat(_float).toFixed(2);
|
|
1643
1496
|
focusToFixed = "0".concat(focusToFixed).replace('.', '');
|
|
1644
1497
|
} else {
|
|
@@ -1647,10 +1500,8 @@
|
|
|
1647
1500
|
} else {
|
|
1648
1501
|
_float = parseFloat("".concat(focus[0], ".").concat(focus[1]).concat(focus[2], "1"));
|
|
1649
1502
|
}
|
|
1650
|
-
|
|
1651
1503
|
focusToFixed = parseFloat(_float).toFixed(2).replace('.', '');
|
|
1652
1504
|
}
|
|
1653
|
-
|
|
1654
1505
|
if (focusToFixed == '0999' && parseInt(inputAsFloat.toFixed(0)) == 0) {
|
|
1655
1506
|
focusToFixed = direction == 'up' ? '1000' : '0999';
|
|
1656
1507
|
return parseFloat(digitsAfterDecimal.replace(/\d{4}$/, focusToFixed));
|
|
@@ -18873,42 +18724,32 @@
|
|
|
18873
18724
|
return typeof configuration.amount != 'undefined' || typeof configuration.fromAmount != 'undefined';
|
|
18874
18725
|
});
|
|
18875
18726
|
};
|
|
18876
|
-
|
|
18877
18727
|
var _useContext = React.useContext(ConfigurationContext),
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18881
|
-
|
|
18728
|
+
configuredAmount = _useContext.amount;
|
|
18729
|
+
_useContext.toAmount;
|
|
18730
|
+
var recover = _useContext.recover;
|
|
18882
18731
|
var _useState = React.useState(recover == undefined ? configurationsMissAmounts(props.accept) : false),
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
|
|
18732
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18733
|
+
amountsMissing = _useState2[0],
|
|
18734
|
+
setAmountsMissing = _useState2[1];
|
|
18887
18735
|
var _useContext2 = React.useContext(WalletContext),
|
|
18888
|
-
|
|
18889
|
-
|
|
18736
|
+
account = _useContext2.account;
|
|
18890
18737
|
var _useContext3 = React.useContext(ConversionRateContext),
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18738
|
+
conversionRate = _useContext3.conversionRate,
|
|
18739
|
+
fixedCurrencyConversionRate = _useContext3.fixedCurrencyConversionRate;
|
|
18894
18740
|
var _useContext4 = React.useContext(ErrorContext),
|
|
18895
|
-
|
|
18896
|
-
|
|
18741
|
+
setError = _useContext4.setError;
|
|
18897
18742
|
var _useState3 = React.useState(),
|
|
18898
|
-
|
|
18899
|
-
|
|
18900
|
-
|
|
18901
|
-
|
|
18743
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
18744
|
+
acceptWithAmount = _useState4[0],
|
|
18745
|
+
setAcceptWithAmount = _useState4[1];
|
|
18902
18746
|
var _useState5 = React.useState(_typeof(configuredAmount) == 'object' && configuredAmount.fix && configuredAmount.currency ? configuredAmount.fix : null),
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18747
|
+
_useState6 = _slicedToArray(_useState5, 1),
|
|
18748
|
+
fixedAmount = _useState6[0];
|
|
18906
18749
|
var _useState7 = React.useState(_typeof(configuredAmount) == 'object' && configuredAmount.fix && configuredAmount.currency ? configuredAmount.currency : null),
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18750
|
+
_useState8 = _slicedToArray(_useState7, 1),
|
|
18751
|
+
fixedCurrency = _useState8[0];
|
|
18910
18752
|
var startAmount;
|
|
18911
|
-
|
|
18912
18753
|
if (amountsMissing) {
|
|
18913
18754
|
if (_typeof(configuredAmount) == "object" && configuredAmount.start && configuredAmount.start) {
|
|
18914
18755
|
startAmount = configuredAmount.start;
|
|
@@ -18918,34 +18759,28 @@
|
|
|
18918
18759
|
startAmount = 1;
|
|
18919
18760
|
}
|
|
18920
18761
|
}
|
|
18921
|
-
|
|
18922
18762
|
var _useState9 = React.useState(startAmount),
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18763
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
18764
|
+
amount = _useState10[0],
|
|
18765
|
+
setAmount = _useState10[1];
|
|
18927
18766
|
var _useState11 = React.useState(),
|
|
18928
|
-
|
|
18929
|
-
|
|
18930
|
-
|
|
18931
|
-
|
|
18767
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
18768
|
+
maxRoute = _useState12[0],
|
|
18769
|
+
setMaxRoute = _useState12[1];
|
|
18932
18770
|
var _useState13 = React.useState(),
|
|
18933
|
-
|
|
18934
|
-
|
|
18935
|
-
|
|
18936
|
-
|
|
18771
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
18772
|
+
maxAmount = _useState14[0],
|
|
18773
|
+
setMaxAmount = _useState14[1];
|
|
18937
18774
|
React.useEffect(function () {
|
|
18938
18775
|
if (recover) {
|
|
18939
18776
|
return;
|
|
18940
18777
|
}
|
|
18941
|
-
|
|
18942
18778
|
setAmountsMissing(configurationsMissAmounts(props.accept));
|
|
18943
18779
|
}, [props.accept, recover]);
|
|
18944
|
-
|
|
18945
18780
|
var getAmounts = function getAmounts(_ref) {
|
|
18946
18781
|
var amount = _ref.amount,
|
|
18947
|
-
|
|
18948
|
-
|
|
18782
|
+
conversionRate = _ref.conversionRate,
|
|
18783
|
+
fixedCurrencyConversionRate = _ref.fixedCurrencyConversionRate;
|
|
18949
18784
|
return new Promise(function (resolve, reject) {
|
|
18950
18785
|
if (configuredAmount && configuredAmount.token) {
|
|
18951
18786
|
resolve(props.accept.map(function () {
|
|
@@ -18998,12 +18833,11 @@
|
|
|
18998
18833
|
}
|
|
18999
18834
|
});
|
|
19000
18835
|
};
|
|
19001
|
-
|
|
19002
18836
|
var updateAmounts = React.useCallback(lodash.debounce(function (_ref2) {
|
|
19003
18837
|
var account = _ref2.account,
|
|
19004
|
-
|
|
19005
|
-
|
|
19006
|
-
|
|
18838
|
+
amount = _ref2.amount,
|
|
18839
|
+
conversionRate = _ref2.conversionRate,
|
|
18840
|
+
fixedCurrencyConversionRate = _ref2.fixedCurrencyConversionRate;
|
|
19007
18841
|
getAmounts({
|
|
19008
18842
|
amount: amount,
|
|
19009
18843
|
conversionRate: conversionRate,
|
|
@@ -19013,7 +18847,6 @@
|
|
|
19013
18847
|
if (amounts[index] == undefined) {
|
|
19014
18848
|
return;
|
|
19015
18849
|
}
|
|
19016
|
-
|
|
19017
18850
|
return {
|
|
19018
18851
|
blockchain: configuration.blockchain,
|
|
19019
18852
|
amount: round(amounts[index]),
|
|
@@ -19029,7 +18862,6 @@
|
|
|
19029
18862
|
if (recover) {
|
|
19030
18863
|
return;
|
|
19031
18864
|
}
|
|
19032
|
-
|
|
19033
18865
|
if (amountsMissing && account && conversionRate && (fixedAmount ? fixedCurrencyConversionRate : true)) {
|
|
19034
18866
|
updateAmounts({
|
|
19035
18867
|
account: account,
|
|
@@ -19059,7 +18891,6 @@
|
|
|
19059
18891
|
}).then(setMaxAmount);
|
|
19060
18892
|
return;
|
|
19061
18893
|
}
|
|
19062
|
-
|
|
19063
18894
|
web3Tokens.Token.readable({
|
|
19064
18895
|
amount: routes[0].amountOut,
|
|
19065
18896
|
blockchain: maxRoute.blockchain,
|
|
@@ -19072,7 +18903,6 @@
|
|
|
19072
18903
|
})["catch"](setError);
|
|
19073
18904
|
} else if (maxRoute.fromToken.address == web3Constants.CONSTANTS[maxRoute.blockchain].USD) {
|
|
19074
18905
|
var _maxAmount = parseFloat(new decimal_js.Decimal(readableMaxAmount).mul(conversionRate).toString());
|
|
19075
|
-
|
|
19076
18906
|
setMaxAmount(_maxAmount > 10 ? Math.round(_maxAmount - 1) : _maxAmount - 1);
|
|
19077
18907
|
} else {
|
|
19078
18908
|
web3Exchanges.route({
|
|
@@ -19086,7 +18916,6 @@
|
|
|
19086
18916
|
if (routes[0] == undefined) {
|
|
19087
18917
|
return;
|
|
19088
18918
|
}
|
|
19089
|
-
|
|
19090
18919
|
web3Tokens.Token.readable({
|
|
19091
18920
|
amount: routes[0].amountOut,
|
|
19092
18921
|
blockchain: maxRoute.blockchain,
|
|
@@ -19137,22 +18966,18 @@
|
|
|
19137
18966
|
|
|
19138
18967
|
var ConversionRateProvider = (function (props) {
|
|
19139
18968
|
var _useContext = React.useContext(ErrorContext);
|
|
19140
|
-
|
|
19141
|
-
|
|
18969
|
+
_useContext.setError;
|
|
19142
18970
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
|
|
18971
|
+
amount = _useContext2.amount,
|
|
18972
|
+
currency = _useContext2.currency;
|
|
19146
18973
|
var _useState = React.useState(),
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
18974
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18975
|
+
conversionRate = _useState2[0],
|
|
18976
|
+
setConversionRate = _useState2[1];
|
|
19151
18977
|
var _useState3 = React.useState(),
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
18978
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
18979
|
+
fixedCurrencyConversionRate = _useState4[0],
|
|
18980
|
+
setFixedCurrencyConversionRate = _useState4[1];
|
|
19156
18981
|
React.useEffect(function () {
|
|
19157
18982
|
if (_typeof(amount) == 'object' && amount.currency) {
|
|
19158
18983
|
localCurrency.Currency.fromUSD({
|
|
@@ -19162,7 +18987,6 @@
|
|
|
19162
18987
|
return setFixedCurrencyConversionRate(conversion.amount);
|
|
19163
18988
|
});
|
|
19164
18989
|
}
|
|
19165
|
-
|
|
19166
18990
|
localCurrency.Currency.fromUSD({
|
|
19167
18991
|
amount: 1,
|
|
19168
18992
|
code: currency
|
|
@@ -19186,8 +19010,7 @@
|
|
|
19186
19010
|
|
|
19187
19011
|
var NoPaymentMethodFoundDialog = (function () {
|
|
19188
19012
|
var _useContext = React.useContext(ClosableContext),
|
|
19189
|
-
|
|
19190
|
-
|
|
19013
|
+
close = _useContext.close;
|
|
19191
19014
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
19192
19015
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
19193
19016
|
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
@@ -19225,87 +19048,68 @@
|
|
|
19225
19048
|
|
|
19226
19049
|
var PaymentProvider = (function (props) {
|
|
19227
19050
|
var _useContext = React.useContext(ErrorContext),
|
|
19228
|
-
|
|
19229
|
-
|
|
19051
|
+
setError = _useContext.setError;
|
|
19230
19052
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
19231
|
-
|
|
19232
|
-
|
|
19233
|
-
|
|
19234
|
-
|
|
19235
|
-
|
|
19236
|
-
|
|
19053
|
+
_sent = _useContext2.sent,
|
|
19054
|
+
succeeded = _useContext2.succeeded,
|
|
19055
|
+
failed = _useContext2.failed,
|
|
19056
|
+
recover = _useContext2.recover,
|
|
19057
|
+
before = _useContext2.before;
|
|
19237
19058
|
var _useContext3 = React.useContext(PaymentRoutingContext),
|
|
19238
|
-
|
|
19239
|
-
|
|
19240
|
-
|
|
19059
|
+
selectedRoute = _useContext3.selectedRoute;
|
|
19060
|
+
_useContext3.getPaymentRoutes;
|
|
19241
19061
|
var _useContext4 = React.useContext(ClosableContext),
|
|
19242
|
-
|
|
19243
|
-
|
|
19244
|
-
|
|
19245
|
-
|
|
19062
|
+
open = _useContext4.open,
|
|
19063
|
+
close = _useContext4.close,
|
|
19064
|
+
setClosable = _useContext4.setClosable;
|
|
19246
19065
|
var _useContext5 = React.useContext(PaymentRoutingContext),
|
|
19247
|
-
|
|
19248
|
-
|
|
19066
|
+
allRoutes = _useContext5.allRoutes;
|
|
19249
19067
|
var _useContext6 = React.useContext(UpdatableContext),
|
|
19250
|
-
|
|
19251
|
-
|
|
19068
|
+
setUpdatable = _useContext6.setUpdatable;
|
|
19252
19069
|
var _useContext7 = React.useContext(NavigateContext),
|
|
19253
|
-
|
|
19254
|
-
|
|
19255
|
-
|
|
19070
|
+
navigate = _useContext7.navigate,
|
|
19071
|
+
set = _useContext7.set;
|
|
19256
19072
|
var _useContext8 = React.useContext(WalletContext),
|
|
19257
|
-
|
|
19258
|
-
|
|
19073
|
+
wallet = _useContext8.wallet;
|
|
19259
19074
|
var _useContext9 = React.useContext(PaymentTrackingContext),
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
|
|
19263
|
-
|
|
19075
|
+
release = _useContext9.release,
|
|
19076
|
+
tracking = _useContext9.tracking,
|
|
19077
|
+
initializePaymentTracking = _useContext9.initializeTracking;
|
|
19264
19078
|
var _useContext10 = React.useContext(TransactionTrackingContext),
|
|
19265
|
-
|
|
19266
|
-
|
|
19267
|
-
|
|
19079
|
+
foundTransaction = _useContext10.foundTransaction,
|
|
19080
|
+
initializeTransactionTracking = _useContext10.initializeTracking;
|
|
19268
19081
|
var _useState = React.useState(),
|
|
19269
|
-
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
|
|
19082
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19083
|
+
payment = _useState2[0],
|
|
19084
|
+
setPayment = _useState2[1];
|
|
19273
19085
|
var _useState3 = React.useState(),
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19086
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
19087
|
+
transaction = _useState4[0],
|
|
19088
|
+
setTransaction = _useState4[1];
|
|
19278
19089
|
var _useState5 = React.useState(),
|
|
19279
|
-
|
|
19280
|
-
|
|
19281
|
-
|
|
19282
|
-
|
|
19090
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
19091
|
+
approvalTransaction = _useState6[0],
|
|
19092
|
+
setApprovalTransaction = _useState6[1];
|
|
19283
19093
|
var _useState7 = React.useState('initialized'),
|
|
19284
|
-
|
|
19285
|
-
|
|
19286
|
-
|
|
19287
|
-
|
|
19288
|
-
var paymentConfirmed = function paymentConfirmed(transaction) {
|
|
19094
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
19095
|
+
paymentState = _useState8[0],
|
|
19096
|
+
setPaymentState = _useState8[1];
|
|
19097
|
+
var paymentSucceeded = function paymentSucceeded(transaction) {
|
|
19289
19098
|
if (tracking != true) {
|
|
19290
19099
|
setClosable(true);
|
|
19291
19100
|
}
|
|
19292
|
-
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
if (confirmed) {
|
|
19296
|
-
confirmed(transaction);
|
|
19101
|
+
setPaymentState('success');
|
|
19102
|
+
if (succeeded) {
|
|
19103
|
+
succeeded(transaction);
|
|
19297
19104
|
}
|
|
19298
19105
|
};
|
|
19299
|
-
|
|
19300
19106
|
var paymentFailed = function paymentFailed(transaction, error) {
|
|
19301
19107
|
if (failed) {
|
|
19302
19108
|
failed(transaction, error);
|
|
19303
19109
|
}
|
|
19304
|
-
|
|
19305
19110
|
setClosable(true);
|
|
19306
|
-
set(['
|
|
19111
|
+
set(['PaymentFailed']);
|
|
19307
19112
|
};
|
|
19308
|
-
|
|
19309
19113
|
var pay = /*#__PURE__*/function () {
|
|
19310
19114
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
19311
19115
|
var stop, currentBlock;
|
|
@@ -19317,20 +19121,15 @@
|
|
|
19317
19121
|
_context.next = 6;
|
|
19318
19122
|
break;
|
|
19319
19123
|
}
|
|
19320
|
-
|
|
19321
19124
|
_context.next = 3;
|
|
19322
19125
|
return before(payment.route.transaction);
|
|
19323
|
-
|
|
19324
19126
|
case 3:
|
|
19325
19127
|
stop = _context.sent;
|
|
19326
|
-
|
|
19327
19128
|
if (!(stop === false)) {
|
|
19328
19129
|
_context.next = 6;
|
|
19329
19130
|
break;
|
|
19330
19131
|
}
|
|
19331
|
-
|
|
19332
19132
|
return _context.abrupt("return");
|
|
19333
|
-
|
|
19334
19133
|
case 6:
|
|
19335
19134
|
setClosable(false);
|
|
19336
19135
|
setPaymentState('paying');
|
|
@@ -19340,33 +19139,29 @@
|
|
|
19340
19139
|
blockchain: payment.route.transaction.blockchain,
|
|
19341
19140
|
method: 'latestBlockNumber'
|
|
19342
19141
|
});
|
|
19343
|
-
|
|
19344
19142
|
case 11:
|
|
19345
19143
|
currentBlock = _context.sent;
|
|
19346
19144
|
wallet.sendTransaction(Object.assign({}, payment.route.transaction, {
|
|
19347
19145
|
sent: function sent(transaction) {
|
|
19348
19146
|
initializeTransactionTracking(transaction, currentBlock);
|
|
19349
|
-
|
|
19350
19147
|
if (_sent) {
|
|
19351
19148
|
_sent(transaction);
|
|
19352
19149
|
}
|
|
19353
19150
|
},
|
|
19354
|
-
|
|
19151
|
+
succeeded: paymentSucceeded,
|
|
19355
19152
|
failed: paymentFailed
|
|
19356
19153
|
})).then(function (sentTransaction) {
|
|
19357
|
-
initializePaymentTracking(sentTransaction, currentBlock, payment.route);
|
|
19358
19154
|
setTransaction(sentTransaction);
|
|
19155
|
+
initializePaymentTracking(sentTransaction, currentBlock, payment.route);
|
|
19359
19156
|
})["catch"](function (error) {
|
|
19360
19157
|
console.log('error', error);
|
|
19361
19158
|
setPaymentState('initialized');
|
|
19362
19159
|
setClosable(true);
|
|
19363
19160
|
setUpdatable(true);
|
|
19364
|
-
|
|
19365
19161
|
if ((error === null || error === void 0 ? void 0 : error.code) == 'WRONG_NETWORK') {
|
|
19366
19162
|
navigate('WrongNetwork');
|
|
19367
19163
|
}
|
|
19368
19164
|
});
|
|
19369
|
-
|
|
19370
19165
|
case 13:
|
|
19371
19166
|
case "end":
|
|
19372
19167
|
return _context.stop();
|
|
@@ -19374,17 +19169,15 @@
|
|
|
19374
19169
|
}
|
|
19375
19170
|
}, _callee);
|
|
19376
19171
|
}));
|
|
19377
|
-
|
|
19378
19172
|
return function pay() {
|
|
19379
19173
|
return _ref.apply(this, arguments);
|
|
19380
19174
|
};
|
|
19381
19175
|
}();
|
|
19382
|
-
|
|
19383
19176
|
var approve = function approve() {
|
|
19384
19177
|
setClosable(false);
|
|
19385
19178
|
setPaymentState('approving');
|
|
19386
19179
|
wallet.sendTransaction(Object.assign({}, payment.route.approvalTransaction, {
|
|
19387
|
-
|
|
19180
|
+
succeeded: function succeeded() {
|
|
19388
19181
|
payment.route.approvalRequired = false;
|
|
19389
19182
|
setPayment(payment);
|
|
19390
19183
|
setClosable(true);
|
|
@@ -19398,10 +19191,9 @@
|
|
|
19398
19191
|
setClosable(true);
|
|
19399
19192
|
});
|
|
19400
19193
|
};
|
|
19401
|
-
|
|
19402
19194
|
React.useEffect(function () {
|
|
19403
19195
|
if (release) {
|
|
19404
|
-
setPaymentState('
|
|
19196
|
+
setPaymentState('success');
|
|
19405
19197
|
}
|
|
19406
19198
|
}, [release]);
|
|
19407
19199
|
React.useEffect(function () {
|
|
@@ -19424,9 +19216,8 @@
|
|
|
19424
19216
|
});
|
|
19425
19217
|
Promise.all([paymentToken.name(), paymentToken.symbol()]).then(function (_ref2) {
|
|
19426
19218
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
19427
|
-
|
|
19428
|
-
|
|
19429
|
-
|
|
19219
|
+
name = _ref3[0],
|
|
19220
|
+
symbol = _ref3[1];
|
|
19430
19221
|
setPayment({
|
|
19431
19222
|
blockchain: recover.blockchain,
|
|
19432
19223
|
token: recover.token,
|
|
@@ -19440,7 +19231,6 @@
|
|
|
19440
19231
|
React.useEffect(function () {
|
|
19441
19232
|
if (foundTransaction && foundTransaction.id && foundTransaction.status) {
|
|
19442
19233
|
var newTransaction;
|
|
19443
|
-
|
|
19444
19234
|
if (foundTransaction.id.toLowerCase() != transaction.id.toLowerCase()) {
|
|
19445
19235
|
newTransaction = Object.assign({}, transaction, {
|
|
19446
19236
|
id: foundTransaction.id,
|
|
@@ -19450,9 +19240,8 @@
|
|
|
19450
19240
|
});
|
|
19451
19241
|
setTransaction(newTransaction);
|
|
19452
19242
|
}
|
|
19453
|
-
|
|
19454
19243
|
if (foundTransaction.status == 'success') {
|
|
19455
|
-
|
|
19244
|
+
paymentSucceeded(newTransaction || transaction);
|
|
19456
19245
|
} else if (foundTransaction.status == 'failed') {
|
|
19457
19246
|
paymentFailed(newTransaction || transaction);
|
|
19458
19247
|
}
|
|
@@ -19463,10 +19252,9 @@
|
|
|
19463
19252
|
var fromToken = selectedRoute.fromToken;
|
|
19464
19253
|
Promise.all([fromToken.name(), fromToken.symbol(), fromToken.readable(selectedRoute.fromAmount)]).then(function (_ref4) {
|
|
19465
19254
|
var _ref5 = _slicedToArray(_ref4, 3),
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19255
|
+
name = _ref5[0],
|
|
19256
|
+
symbol = _ref5[1],
|
|
19257
|
+
amount = _ref5[2];
|
|
19470
19258
|
setPayment({
|
|
19471
19259
|
blockchain: selectedRoute.blockchain,
|
|
19472
19260
|
route: selectedRoute,
|
|
@@ -19487,7 +19275,6 @@
|
|
|
19487
19275
|
setUpdatable(true);
|
|
19488
19276
|
}
|
|
19489
19277
|
}, [allRoutes]);
|
|
19490
|
-
|
|
19491
19278
|
if (allRoutes instanceof Array && allRoutes.length == 0) {
|
|
19492
19279
|
return /*#__PURE__*/React__default["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
19493
19280
|
open: open,
|
|
@@ -19524,14 +19311,11 @@
|
|
|
19524
19311
|
} else {
|
|
19525
19312
|
obj[key] = value;
|
|
19526
19313
|
}
|
|
19527
|
-
|
|
19528
19314
|
return obj;
|
|
19529
19315
|
}
|
|
19530
19316
|
|
|
19531
19317
|
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19532
|
-
|
|
19533
19318
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19534
|
-
|
|
19535
19319
|
var prepareAcceptedPayments = function prepareAcceptedPayments(accept) {
|
|
19536
19320
|
var toAddress = _typeof(accept.receiver) == 'object' ? accept.receiver.address : accept.receiver;
|
|
19537
19321
|
var toContract = _typeof(accept.receiver) == 'object' ? accept.receiver : undefined;
|
|
@@ -19540,7 +19324,6 @@
|
|
|
19540
19324
|
toContract: toContract
|
|
19541
19325
|
});
|
|
19542
19326
|
};
|
|
19543
|
-
|
|
19544
19327
|
var mergeFromAccounts = function mergeFromAccounts(accept, account) {
|
|
19545
19328
|
var from = {};
|
|
19546
19329
|
accept.forEach(function (accept) {
|
|
@@ -19548,14 +19331,13 @@
|
|
|
19548
19331
|
});
|
|
19549
19332
|
return from;
|
|
19550
19333
|
};
|
|
19551
|
-
|
|
19552
19334
|
var routePayments = (function (_ref) {
|
|
19553
19335
|
var accept = _ref.accept,
|
|
19554
|
-
|
|
19555
|
-
|
|
19556
|
-
|
|
19557
|
-
|
|
19558
|
-
|
|
19336
|
+
account = _ref.account,
|
|
19337
|
+
whitelist = _ref.whitelist,
|
|
19338
|
+
blacklist = _ref.blacklist,
|
|
19339
|
+
event = _ref.event,
|
|
19340
|
+
fee = _ref.fee;
|
|
19559
19341
|
return web3Payments.route({
|
|
19560
19342
|
accept: accept.map(prepareAcceptedPayments),
|
|
19561
19343
|
from: mergeFromAccounts(accept, account),
|
|
@@ -19567,421 +19349,100 @@
|
|
|
19567
19349
|
});
|
|
19568
19350
|
|
|
19569
19351
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19570
|
-
|
|
19571
19352
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19572
19353
|
var PaymentRoutingProvider = (function (props) {
|
|
19573
19354
|
var _useState = React.useState(),
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19355
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19356
|
+
allRoutes = _useState2[0],
|
|
19357
|
+
setAllRoutes = _useState2[1];
|
|
19578
19358
|
var _useState3 = React.useState(),
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
19582
|
-
|
|
19359
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
19360
|
+
updatedRouteWithNewPrice = _useState4[0],
|
|
19361
|
+
setUpdatedRouteWithNewPrice = _useState4[1];
|
|
19583
19362
|
var _useState5 = React.useState(),
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19363
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
19364
|
+
selectedRoute = _useState6[0],
|
|
19365
|
+
setSelectedRoute = _useState6[1];
|
|
19588
19366
|
var _useState7 = React.useState(false),
|
|
19589
|
-
|
|
19590
|
-
|
|
19591
|
-
|
|
19592
|
-
|
|
19367
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
19368
|
+
slowRouting = _useState8[0],
|
|
19369
|
+
setSlowRouting = _useState8[1];
|
|
19593
19370
|
var _useState9 = React.useState(0),
|
|
19594
|
-
|
|
19595
|
-
|
|
19596
|
-
|
|
19597
|
-
|
|
19371
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
19372
|
+
reloadCount = _useState10[0],
|
|
19373
|
+
setReloadCount = _useState10[1];
|
|
19598
19374
|
var _useContext = React.useContext(WalletContext),
|
|
19599
|
-
|
|
19600
|
-
|
|
19375
|
+
account = _useContext.account;
|
|
19601
19376
|
var _useContext2 = React.useContext(UpdatableContext),
|
|
19602
|
-
|
|
19603
|
-
|
|
19377
|
+
updatable = _useContext2.updatable;
|
|
19604
19378
|
var _useContext3 = React.useContext(ConfigurationContext),
|
|
19605
|
-
|
|
19606
|
-
|
|
19607
|
-
|
|
19608
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(route) {
|
|
19609
|
-
var currentBlock, blocks, i, exchangeRoute, lastAmountsIn, defaultSlippage, defaultSlippageNewAmountBN, defaultReadableAmount, defaultSlippageRoundedAmountBN, newAmountBN, readableAmount, roundedAmountBN, difference1, difference2, slippage, _difference, _difference2, _slippage, highestAmountBN;
|
|
19610
|
-
|
|
19379
|
+
recover = _useContext3.recover;
|
|
19380
|
+
var onRoutesUpdate = /*#__PURE__*/function () {
|
|
19381
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(routes) {
|
|
19611
19382
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
19612
19383
|
while (1) {
|
|
19613
19384
|
switch (_context2.prev = _context2.next) {
|
|
19614
|
-
case 0:
|
|
19615
|
-
if (!route.directTransfer) {
|
|
19616
|
-
_context2.next = 2;
|
|
19617
|
-
break;
|
|
19618
|
-
}
|
|
19619
|
-
|
|
19620
|
-
return _context2.abrupt("return");
|
|
19621
|
-
|
|
19622
|
-
case 2:
|
|
19623
|
-
_context2.next = 4;
|
|
19624
|
-
return web3Client.request({
|
|
19625
|
-
blockchain: route.blockchain,
|
|
19626
|
-
method: 'latestBlockNumber'
|
|
19627
|
-
});
|
|
19628
|
-
|
|
19629
|
-
case 4:
|
|
19630
|
-
currentBlock = _context2.sent;
|
|
19631
|
-
blocks = [];
|
|
19632
|
-
|
|
19633
|
-
for (i = 0; i <= 2; i++) {
|
|
19634
|
-
blocks.push(currentBlock - i);
|
|
19635
|
-
}
|
|
19636
|
-
|
|
19637
|
-
exchangeRoute = route.exchangeRoutes[0];
|
|
19638
|
-
|
|
19639
|
-
if (!(typeof exchangeRoute == 'undefined' || typeof exchangeRoute.exchange == 'undefined')) {
|
|
19640
|
-
_context2.next = 10;
|
|
19641
|
-
break;
|
|
19642
|
-
}
|
|
19643
|
-
|
|
19644
|
-
return _context2.abrupt("return");
|
|
19645
|
-
|
|
19646
|
-
case 10:
|
|
19647
|
-
_context2.next = 12;
|
|
19648
|
-
return Promise.all(blocks.map( /*#__PURE__*/function () {
|
|
19649
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(block) {
|
|
19650
|
-
var amountIn;
|
|
19651
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
19652
|
-
while (1) {
|
|
19653
|
-
switch (_context.prev = _context.next) {
|
|
19654
|
-
case 0:
|
|
19655
|
-
_context.next = 2;
|
|
19656
|
-
return exchangeRoute.exchange.getAmountIn({
|
|
19657
|
-
path: exchangeRoute.path,
|
|
19658
|
-
amountOut: exchangeRoute.amountOutMin,
|
|
19659
|
-
block: block
|
|
19660
|
-
});
|
|
19661
|
-
|
|
19662
|
-
case 2:
|
|
19663
|
-
amountIn = _context.sent;
|
|
19664
|
-
return _context.abrupt("return", amountIn);
|
|
19665
|
-
|
|
19666
|
-
case 4:
|
|
19667
|
-
case "end":
|
|
19668
|
-
return _context.stop();
|
|
19669
|
-
}
|
|
19670
|
-
}
|
|
19671
|
-
}, _callee);
|
|
19672
|
-
}));
|
|
19673
|
-
|
|
19674
|
-
return function (_x2) {
|
|
19675
|
-
return _ref2.apply(this, arguments);
|
|
19676
|
-
};
|
|
19677
|
-
}()));
|
|
19678
|
-
|
|
19679
|
-
case 12:
|
|
19680
|
-
lastAmountsIn = _context2.sent;
|
|
19681
|
-
|
|
19682
|
-
if (!(!lastAmountsIn[0] || !lastAmountsIn[1] || !lastAmountsIn[2])) {
|
|
19683
|
-
_context2.next = 15;
|
|
19684
|
-
break;
|
|
19685
|
-
}
|
|
19686
|
-
|
|
19687
|
-
return _context2.abrupt("return");
|
|
19688
|
-
|
|
19689
|
-
case 15:
|
|
19690
|
-
defaultSlippage = '0.5'; // %
|
|
19691
|
-
|
|
19692
|
-
if (ethers.ethers.BigNumber.from(route.fromAmount).mul(10000).div(ethers.ethers.BigNumber.from(route.toAmount).add(ethers.ethers.BigNumber.from(route.feeAmount || '0'))).sub(10000).toString() <= 100) {
|
|
19693
|
-
// stable coin swap
|
|
19694
|
-
defaultSlippage = '0.1'; // %
|
|
19695
|
-
}
|
|
19696
|
-
|
|
19697
|
-
defaultSlippageNewAmountBN = lastAmountsIn[2].add(lastAmountsIn[2].mul(parseFloat(defaultSlippage) * 100).div(10000));
|
|
19698
|
-
_context2.next = 20;
|
|
19699
|
-
return route.fromToken.readable(defaultSlippageNewAmountBN);
|
|
19700
|
-
|
|
19701
|
-
case 20:
|
|
19702
|
-
defaultReadableAmount = _context2.sent;
|
|
19703
|
-
_context2.next = 23;
|
|
19704
|
-
return route.fromToken.BigNumber(round(defaultReadableAmount));
|
|
19705
|
-
|
|
19706
|
-
case 23:
|
|
19707
|
-
defaultSlippageRoundedAmountBN = _context2.sent;
|
|
19708
|
-
|
|
19709
|
-
if (!(lastAmountsIn[0].gt(lastAmountsIn[1]) && lastAmountsIn[1].gt(lastAmountsIn[2]))) {
|
|
19710
|
-
_context2.next = 41;
|
|
19711
|
-
break;
|
|
19712
|
-
}
|
|
19713
|
-
|
|
19714
|
-
// EXTREME DIRETIONAL SLIPPAGE
|
|
19715
|
-
difference1 = lastAmountsIn[0].sub(lastAmountsIn[1]);
|
|
19716
|
-
difference2 = lastAmountsIn[1].sub(lastAmountsIn[2]);
|
|
19717
|
-
|
|
19718
|
-
if (difference1.lt(difference2)) {
|
|
19719
|
-
slippage = difference2.add(difference2.sub(difference1));
|
|
19720
|
-
} else {
|
|
19721
|
-
slippage = difference1.add(difference1.sub(difference2));
|
|
19722
|
-
}
|
|
19723
|
-
|
|
19724
|
-
newAmountBN = lastAmountsIn[0].add(slippage);
|
|
19725
|
-
_context2.next = 31;
|
|
19726
|
-
return route.fromToken.readable(newAmountBN);
|
|
19727
|
-
|
|
19728
|
-
case 31:
|
|
19729
|
-
readableAmount = _context2.sent;
|
|
19730
|
-
_context2.next = 34;
|
|
19731
|
-
return route.fromToken.BigNumber(round(readableAmount));
|
|
19732
|
-
|
|
19733
|
-
case 34:
|
|
19734
|
-
roundedAmountBN = _context2.sent;
|
|
19735
|
-
|
|
19736
|
-
if (!roundedAmountBN.gt(defaultSlippageRoundedAmountBN)) {
|
|
19737
|
-
_context2.next = 39;
|
|
19738
|
-
break;
|
|
19739
|
-
}
|
|
19740
|
-
|
|
19741
|
-
if (!(route.fromAmount == roundedAmountBN.toString())) {
|
|
19742
|
-
_context2.next = 38;
|
|
19743
|
-
break;
|
|
19744
|
-
}
|
|
19745
|
-
|
|
19746
|
-
return _context2.abrupt("return");
|
|
19747
|
-
|
|
19748
|
-
case 38:
|
|
19749
|
-
return _context2.abrupt("return", roundedAmountBN);
|
|
19750
|
-
|
|
19751
|
-
case 39:
|
|
19752
|
-
_context2.next = 57;
|
|
19753
|
-
break;
|
|
19754
|
-
|
|
19755
|
-
case 41:
|
|
19756
|
-
if (lastAmountsIn[0].eq(lastAmountsIn[1]) && lastAmountsIn[1].eq(lastAmountsIn[2])) {
|
|
19757
|
-
_context2.next = 57;
|
|
19758
|
-
break;
|
|
19759
|
-
}
|
|
19760
|
-
|
|
19761
|
-
// BASE NOISE SLIPPAGE
|
|
19762
|
-
_difference = lastAmountsIn[0].sub(lastAmountsIn[1]).abs();
|
|
19763
|
-
_difference2 = lastAmountsIn[1].sub(lastAmountsIn[2]).abs();
|
|
19764
|
-
|
|
19765
|
-
if (_difference.lt(_difference2)) {
|
|
19766
|
-
_slippage = _difference;
|
|
19767
|
-
} else {
|
|
19768
|
-
_slippage = _difference2;
|
|
19769
|
-
}
|
|
19770
|
-
|
|
19771
|
-
if (lastAmountsIn[0].gt(lastAmountsIn[1]) && lastAmountsIn[0].gt(lastAmountsIn[2])) {
|
|
19772
|
-
highestAmountBN = lastAmountsIn[0];
|
|
19773
|
-
} else if (lastAmountsIn[1].gt(lastAmountsIn[2]) && lastAmountsIn[1].gt(lastAmountsIn[0])) {
|
|
19774
|
-
highestAmountBN = lastAmountsIn[1];
|
|
19775
|
-
} else {
|
|
19776
|
-
highestAmountBN = lastAmountsIn[2];
|
|
19777
|
-
}
|
|
19778
|
-
|
|
19779
|
-
newAmountBN = highestAmountBN.add(_slippage);
|
|
19780
|
-
_context2.next = 49;
|
|
19781
|
-
return route.fromToken.readable(newAmountBN);
|
|
19782
|
-
|
|
19783
|
-
case 49:
|
|
19784
|
-
readableAmount = _context2.sent;
|
|
19785
|
-
_context2.next = 52;
|
|
19786
|
-
return route.fromToken.BigNumber(round(readableAmount));
|
|
19787
|
-
|
|
19788
|
-
case 52:
|
|
19789
|
-
roundedAmountBN = _context2.sent;
|
|
19790
|
-
|
|
19791
|
-
if (!roundedAmountBN.gt(defaultSlippageRoundedAmountBN)) {
|
|
19792
|
-
_context2.next = 57;
|
|
19793
|
-
break;
|
|
19794
|
-
}
|
|
19795
|
-
|
|
19796
|
-
if (!(route.fromAmount == roundedAmountBN.toString())) {
|
|
19797
|
-
_context2.next = 56;
|
|
19798
|
-
break;
|
|
19799
|
-
}
|
|
19800
|
-
|
|
19801
|
-
return _context2.abrupt("return");
|
|
19802
|
-
|
|
19803
|
-
case 56:
|
|
19804
|
-
return _context2.abrupt("return", roundedAmountBN);
|
|
19805
|
-
|
|
19806
|
-
case 57:
|
|
19807
|
-
if (!(route.fromAmount == defaultSlippageRoundedAmountBN.toString())) {
|
|
19808
|
-
_context2.next = 59;
|
|
19809
|
-
break;
|
|
19810
|
-
}
|
|
19811
|
-
|
|
19812
|
-
return _context2.abrupt("return");
|
|
19813
|
-
|
|
19814
|
-
case 59:
|
|
19815
|
-
return _context2.abrupt("return", defaultSlippageRoundedAmountBN);
|
|
19816
|
-
|
|
19817
|
-
case 60:
|
|
19818
|
-
case "end":
|
|
19819
|
-
return _context2.stop();
|
|
19820
|
-
}
|
|
19821
|
-
}
|
|
19822
|
-
}, _callee2);
|
|
19823
|
-
}));
|
|
19824
|
-
|
|
19825
|
-
return function calculateAmountInWithSlippage(_x) {
|
|
19826
|
-
return _ref.apply(this, arguments);
|
|
19827
|
-
};
|
|
19828
|
-
}();
|
|
19829
|
-
|
|
19830
|
-
var onRoutesUpdate = /*#__PURE__*/function () {
|
|
19831
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5(routes) {
|
|
19832
|
-
return regenerator.wrap(function _callee5$(_context5) {
|
|
19833
|
-
while (1) {
|
|
19834
|
-
switch (_context5.prev = _context5.next) {
|
|
19835
19385
|
case 0:
|
|
19836
19386
|
if (routes.length == 0) {
|
|
19837
19387
|
setAllRoutes([]);
|
|
19838
|
-
|
|
19839
19388
|
if (props.setMaxRoute) {
|
|
19840
19389
|
props.setMaxRoute(null);
|
|
19841
19390
|
}
|
|
19842
19391
|
} else {
|
|
19843
19392
|
roundAmounts(routes).then( /*#__PURE__*/function () {
|
|
19844
|
-
var
|
|
19845
|
-
var selectRoute,
|
|
19846
|
-
|
|
19847
|
-
return regenerator.wrap(function _callee4$(_context4) {
|
|
19393
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(roundedRoutes) {
|
|
19394
|
+
var selectRoute, newSelectRoute;
|
|
19395
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
19848
19396
|
while (1) {
|
|
19849
|
-
switch (
|
|
19397
|
+
switch (_context.prev = _context.next) {
|
|
19850
19398
|
case 0:
|
|
19851
|
-
if (
|
|
19852
|
-
|
|
19853
|
-
|
|
19399
|
+
if (typeof selectedRoute == 'undefined') {
|
|
19400
|
+
selectRoute = roundedRoutes[0];
|
|
19401
|
+
setSelectedRoute(selectRoute);
|
|
19402
|
+
} else {
|
|
19403
|
+
newSelectRoute = roundedRoutes[roundedRoutes.findIndex(function (route) {
|
|
19404
|
+
return route.fromToken.address == selectedRoute.fromToken.address && route.blockchain == selectedRoute.blockchain;
|
|
19405
|
+
})];
|
|
19406
|
+
if (newSelectRoute) {
|
|
19407
|
+
if (selectedRoute.fromAmount != newSelectRoute.fromAmount) {
|
|
19408
|
+
setUpdatedRouteWithNewPrice(newSelectRoute);
|
|
19409
|
+
}
|
|
19410
|
+
}
|
|
19854
19411
|
}
|
|
19855
|
-
|
|
19856
|
-
selectRoute = roundedRoutes[0];
|
|
19857
|
-
_context4.next = 4;
|
|
19858
|
-
return calculateAmountInWithSlippage(selectRoute);
|
|
19859
|
-
|
|
19860
|
-
case 4:
|
|
19861
|
-
amountInWithSlippage = _context4.sent;
|
|
19862
|
-
|
|
19863
|
-
if (!amountInWithSlippage) {
|
|
19864
|
-
_context4.next = 8;
|
|
19865
|
-
break;
|
|
19866
|
-
}
|
|
19867
|
-
|
|
19868
|
-
_context4.next = 8;
|
|
19869
|
-
return roundAmount(selectRoute, amountInWithSlippage);
|
|
19870
|
-
|
|
19871
|
-
case 8:
|
|
19872
|
-
setSelectedRoute(selectRoute);
|
|
19873
|
-
_context4.next = 20;
|
|
19874
|
-
break;
|
|
19875
|
-
|
|
19876
|
-
case 11:
|
|
19877
|
-
newSelectRoute = roundedRoutes[roundedRoutes.findIndex(function (route) {
|
|
19878
|
-
return route.fromToken.address == selectedRoute.fromToken.address && route.blockchain == selectedRoute.blockchain;
|
|
19879
|
-
})];
|
|
19880
|
-
|
|
19881
|
-
if (!newSelectRoute) {
|
|
19882
|
-
_context4.next = 20;
|
|
19883
|
-
break;
|
|
19884
|
-
}
|
|
19885
|
-
|
|
19886
|
-
_context4.next = 15;
|
|
19887
|
-
return calculateAmountInWithSlippage(newSelectRoute);
|
|
19888
|
-
|
|
19889
|
-
case 15:
|
|
19890
|
-
_amountInWithSlippage = _context4.sent;
|
|
19891
|
-
|
|
19892
|
-
if (!_amountInWithSlippage) {
|
|
19893
|
-
_context4.next = 19;
|
|
19894
|
-
break;
|
|
19895
|
-
}
|
|
19896
|
-
|
|
19897
|
-
_context4.next = 19;
|
|
19898
|
-
return roundAmount(newSelectRoute, _amountInWithSlippage);
|
|
19899
|
-
|
|
19900
|
-
case 19:
|
|
19901
|
-
if (selectedRoute.fromAmount != newSelectRoute.fromAmount) {
|
|
19902
|
-
setUpdatedRouteWithNewPrice(newSelectRoute);
|
|
19903
|
-
}
|
|
19904
|
-
|
|
19905
|
-
case 20:
|
|
19906
|
-
_context4.next = 22;
|
|
19907
|
-
return Promise.all(roundedRoutes.map( /*#__PURE__*/function () {
|
|
19908
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(route, index) {
|
|
19909
|
-
var amountInWithSlippage;
|
|
19910
|
-
return regenerator.wrap(function _callee3$(_context3) {
|
|
19911
|
-
while (1) {
|
|
19912
|
-
switch (_context3.prev = _context3.next) {
|
|
19913
|
-
case 0:
|
|
19914
|
-
_context3.next = 2;
|
|
19915
|
-
return calculateAmountInWithSlippage(route);
|
|
19916
|
-
|
|
19917
|
-
case 2:
|
|
19918
|
-
amountInWithSlippage = _context3.sent;
|
|
19919
|
-
|
|
19920
|
-
if (!amountInWithSlippage) {
|
|
19921
|
-
_context3.next = 6;
|
|
19922
|
-
break;
|
|
19923
|
-
}
|
|
19924
|
-
|
|
19925
|
-
_context3.next = 6;
|
|
19926
|
-
return roundAmount(route, amountInWithSlippage);
|
|
19927
|
-
|
|
19928
|
-
case 6:
|
|
19929
|
-
return _context3.abrupt("return", route);
|
|
19930
|
-
|
|
19931
|
-
case 7:
|
|
19932
|
-
case "end":
|
|
19933
|
-
return _context3.stop();
|
|
19934
|
-
}
|
|
19935
|
-
}
|
|
19936
|
-
}, _callee3);
|
|
19937
|
-
}));
|
|
19938
|
-
|
|
19939
|
-
return function (_x5, _x6) {
|
|
19940
|
-
return _ref5.apply(this, arguments);
|
|
19941
|
-
};
|
|
19942
|
-
}())).then(setAllRoutes);
|
|
19943
|
-
|
|
19944
|
-
case 22:
|
|
19412
|
+
setAllRoutes(roundedRoutes);
|
|
19945
19413
|
if (props.setMaxRoute) {
|
|
19946
19414
|
props.setMaxRoute(findMaxRoute(roundedRoutes));
|
|
19947
19415
|
}
|
|
19948
|
-
|
|
19949
|
-
case 23:
|
|
19416
|
+
case 3:
|
|
19950
19417
|
case "end":
|
|
19951
|
-
return
|
|
19418
|
+
return _context.stop();
|
|
19952
19419
|
}
|
|
19953
19420
|
}
|
|
19954
|
-
},
|
|
19421
|
+
}, _callee);
|
|
19955
19422
|
}));
|
|
19956
|
-
|
|
19957
|
-
|
|
19958
|
-
return _ref4.apply(this, arguments);
|
|
19423
|
+
return function (_x2) {
|
|
19424
|
+
return _ref2.apply(this, arguments);
|
|
19959
19425
|
};
|
|
19960
19426
|
}());
|
|
19961
19427
|
}
|
|
19962
|
-
|
|
19963
19428
|
case 1:
|
|
19964
19429
|
case "end":
|
|
19965
|
-
return
|
|
19430
|
+
return _context2.stop();
|
|
19966
19431
|
}
|
|
19967
19432
|
}
|
|
19968
|
-
},
|
|
19433
|
+
}, _callee2);
|
|
19969
19434
|
}));
|
|
19970
|
-
|
|
19971
|
-
|
|
19972
|
-
return _ref3.apply(this, arguments);
|
|
19435
|
+
return function onRoutesUpdate(_x) {
|
|
19436
|
+
return _ref.apply(this, arguments);
|
|
19973
19437
|
};
|
|
19974
19438
|
}();
|
|
19975
|
-
|
|
19976
|
-
|
|
19977
|
-
|
|
19978
|
-
|
|
19979
|
-
var updatable = _ref6.updatable;
|
|
19980
|
-
|
|
19439
|
+
var getPaymentRoutes = function getPaymentRoutes(_ref3) {
|
|
19440
|
+
_ref3.allRoutes;
|
|
19441
|
+
_ref3.selectedRoute;
|
|
19442
|
+
var updatable = _ref3.updatable;
|
|
19981
19443
|
if (updatable == false || !props.accept || !account) {
|
|
19982
19444
|
return;
|
|
19983
19445
|
}
|
|
19984
|
-
|
|
19985
19446
|
var slowRoutingTimeout = setTimeout(function () {
|
|
19986
19447
|
setSlowRouting(true);
|
|
19987
19448
|
}, 4000);
|
|
@@ -19992,146 +19453,86 @@
|
|
|
19992
19453
|
onRoutesUpdate(routes);
|
|
19993
19454
|
});
|
|
19994
19455
|
};
|
|
19995
|
-
|
|
19996
19456
|
var updateRouteAmount = function updateRouteAmount(route, amountBN) {
|
|
19997
19457
|
route.fromAmount = amountBN.toString();
|
|
19998
19458
|
route.transaction.params.amounts[0] = amountBN.toString();
|
|
19999
|
-
|
|
20000
19459
|
if (route.transaction.value && route.transaction.value.toString() != '0') {
|
|
20001
19460
|
route.transaction.value = amountBN.toString();
|
|
20002
19461
|
}
|
|
20003
19462
|
};
|
|
20004
|
-
|
|
20005
19463
|
var roundAmount = /*#__PURE__*/function () {
|
|
20006
|
-
var
|
|
19464
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(route, amountBN) {
|
|
20007
19465
|
var readableAmount, roundedAmountBN;
|
|
20008
|
-
return regenerator.wrap(function
|
|
19466
|
+
return regenerator.wrap(function _callee3$(_context3) {
|
|
20009
19467
|
while (1) {
|
|
20010
|
-
switch (
|
|
19468
|
+
switch (_context3.prev = _context3.next) {
|
|
20011
19469
|
case 0:
|
|
20012
19470
|
if (!route.directTransfer) {
|
|
20013
|
-
|
|
19471
|
+
_context3.next = 2;
|
|
20014
19472
|
break;
|
|
20015
19473
|
}
|
|
20016
|
-
|
|
20017
|
-
return _context6.abrupt("return", route);
|
|
20018
|
-
|
|
19474
|
+
return _context3.abrupt("return", route);
|
|
20019
19475
|
case 2:
|
|
20020
|
-
|
|
19476
|
+
_context3.next = 4;
|
|
20021
19477
|
return route.fromToken.readable(amountBN || route.transaction.params.amounts[0]);
|
|
20022
|
-
|
|
20023
19478
|
case 4:
|
|
20024
|
-
readableAmount =
|
|
20025
|
-
|
|
19479
|
+
readableAmount = _context3.sent;
|
|
19480
|
+
_context3.next = 7;
|
|
20026
19481
|
return route.fromToken.BigNumber(round(readableAmount));
|
|
20027
|
-
|
|
20028
19482
|
case 7:
|
|
20029
|
-
roundedAmountBN =
|
|
19483
|
+
roundedAmountBN = _context3.sent;
|
|
20030
19484
|
updateRouteAmount(route, roundedAmountBN);
|
|
20031
|
-
return
|
|
20032
|
-
|
|
19485
|
+
return _context3.abrupt("return", route);
|
|
20033
19486
|
case 10:
|
|
20034
19487
|
case "end":
|
|
20035
|
-
return
|
|
19488
|
+
return _context3.stop();
|
|
20036
19489
|
}
|
|
20037
19490
|
}
|
|
20038
|
-
},
|
|
19491
|
+
}, _callee3);
|
|
20039
19492
|
}));
|
|
20040
|
-
|
|
20041
|
-
|
|
20042
|
-
return _ref7.apply(this, arguments);
|
|
19493
|
+
return function roundAmount(_x3, _x4) {
|
|
19494
|
+
return _ref4.apply(this, arguments);
|
|
20043
19495
|
};
|
|
20044
19496
|
}();
|
|
20045
|
-
|
|
20046
19497
|
var roundAmounts = /*#__PURE__*/function () {
|
|
20047
|
-
var
|
|
20048
|
-
return regenerator.wrap(function
|
|
19498
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(routes) {
|
|
19499
|
+
return regenerator.wrap(function _callee4$(_context4) {
|
|
20049
19500
|
while (1) {
|
|
20050
|
-
switch (
|
|
19501
|
+
switch (_context4.prev = _context4.next) {
|
|
20051
19502
|
case 0:
|
|
20052
|
-
return
|
|
19503
|
+
return _context4.abrupt("return", Promise.all(routes.map(function (route) {
|
|
20053
19504
|
return roundAmount(route);
|
|
20054
19505
|
})));
|
|
20055
|
-
|
|
20056
19506
|
case 1:
|
|
20057
19507
|
case "end":
|
|
20058
|
-
return
|
|
19508
|
+
return _context4.stop();
|
|
20059
19509
|
}
|
|
20060
19510
|
}
|
|
20061
|
-
},
|
|
19511
|
+
}, _callee4);
|
|
20062
19512
|
}));
|
|
20063
|
-
|
|
20064
|
-
|
|
20065
|
-
return _ref8.apply(this, arguments);
|
|
19513
|
+
return function roundAmounts(_x5) {
|
|
19514
|
+
return _ref5.apply(this, arguments);
|
|
20066
19515
|
};
|
|
20067
19516
|
}();
|
|
20068
|
-
|
|
20069
19517
|
var updateRouteWithNewPrice = /*#__PURE__*/function () {
|
|
20070
|
-
var
|
|
20071
|
-
return regenerator.wrap(function
|
|
19518
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5() {
|
|
19519
|
+
return regenerator.wrap(function _callee5$(_context5) {
|
|
20072
19520
|
while (1) {
|
|
20073
|
-
switch (
|
|
19521
|
+
switch (_context5.prev = _context5.next) {
|
|
20074
19522
|
case 0:
|
|
20075
19523
|
setSelectedRoute(_objectSpread({}, updatedRouteWithNewPrice));
|
|
20076
19524
|
setUpdatedRouteWithNewPrice(null);
|
|
20077
|
-
|
|
20078
19525
|
case 2:
|
|
20079
19526
|
case "end":
|
|
20080
|
-
return
|
|
19527
|
+
return _context5.stop();
|
|
20081
19528
|
}
|
|
20082
19529
|
}
|
|
20083
|
-
},
|
|
19530
|
+
}, _callee5);
|
|
20084
19531
|
}));
|
|
20085
|
-
|
|
20086
19532
|
return function updateRouteWithNewPrice() {
|
|
20087
|
-
return
|
|
19533
|
+
return _ref6.apply(this, arguments);
|
|
20088
19534
|
};
|
|
20089
19535
|
}();
|
|
20090
|
-
|
|
20091
|
-
React.useEffect(function () {
|
|
20092
|
-
function updateRouteWithAmountInWithSlippage() {
|
|
20093
|
-
return _updateRouteWithAmountInWithSlippage.apply(this, arguments);
|
|
20094
|
-
}
|
|
20095
|
-
|
|
20096
|
-
function _updateRouteWithAmountInWithSlippage() {
|
|
20097
|
-
_updateRouteWithAmountInWithSlippage = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee9() {
|
|
20098
|
-
var amountInWithSlippage;
|
|
20099
|
-
return regenerator.wrap(function _callee9$(_context9) {
|
|
20100
|
-
while (1) {
|
|
20101
|
-
switch (_context9.prev = _context9.next) {
|
|
20102
|
-
case 0:
|
|
20103
|
-
_context9.next = 2;
|
|
20104
|
-
return calculateAmountInWithSlippage(selectedRoute);
|
|
20105
|
-
|
|
20106
|
-
case 2:
|
|
20107
|
-
amountInWithSlippage = _context9.sent;
|
|
20108
|
-
|
|
20109
|
-
if (!amountInWithSlippage) {
|
|
20110
|
-
_context9.next = 8;
|
|
20111
|
-
break;
|
|
20112
|
-
}
|
|
20113
|
-
|
|
20114
|
-
_context9.next = 6;
|
|
20115
|
-
return roundAmount(selectedRoute, amountInWithSlippage);
|
|
20116
|
-
|
|
20117
|
-
case 6:
|
|
20118
|
-
console.log(222222);
|
|
20119
|
-
setUpdatedRouteWithNewPrice(selectedRoute);
|
|
20120
|
-
|
|
20121
|
-
case 8:
|
|
20122
|
-
case "end":
|
|
20123
|
-
return _context9.stop();
|
|
20124
|
-
}
|
|
20125
|
-
}
|
|
20126
|
-
}, _callee9);
|
|
20127
|
-
}));
|
|
20128
|
-
return _updateRouteWithAmountInWithSlippage.apply(this, arguments);
|
|
20129
|
-
}
|
|
20130
|
-
|
|
20131
|
-
if (selectedRoute) {
|
|
20132
|
-
updateRouteWithAmountInWithSlippage();
|
|
20133
|
-
}
|
|
20134
|
-
}, [selectedRoute]);
|
|
20135
19536
|
React.useEffect(function () {
|
|
20136
19537
|
var timeout = setTimeout(function () {
|
|
20137
19538
|
setReloadCount(reloadCount + 1);
|
|
@@ -20168,55 +19569,42 @@
|
|
|
20168
19569
|
|
|
20169
19570
|
var PaymentValueProvider = (function (props) {
|
|
20170
19571
|
var _useContext = React.useContext(ErrorContext),
|
|
20171
|
-
|
|
20172
|
-
|
|
19572
|
+
setError = _useContext.setError;
|
|
20173
19573
|
var _useContext2 = React.useContext(WalletContext),
|
|
20174
|
-
|
|
20175
|
-
|
|
19574
|
+
account = _useContext2.account;
|
|
20176
19575
|
var _useContext3 = React.useContext(UpdatableContext),
|
|
20177
|
-
|
|
20178
|
-
|
|
19576
|
+
updatable = _useContext3.updatable;
|
|
20179
19577
|
var _useContext4 = React.useContext(ConfigurationContext),
|
|
20180
|
-
|
|
20181
|
-
|
|
20182
|
-
|
|
19578
|
+
configuredAmount = _useContext4.amount,
|
|
19579
|
+
currencyCode = _useContext4.currencyCode;
|
|
20183
19580
|
var _useContext5 = React.useContext(ChangableAmountContext),
|
|
20184
|
-
|
|
20185
|
-
|
|
19581
|
+
amount = _useContext5.amount;
|
|
20186
19582
|
var _useContext6 = React.useContext(PaymentContext),
|
|
20187
|
-
|
|
20188
|
-
|
|
19583
|
+
payment = _useContext6.payment;
|
|
20189
19584
|
var _useState = React.useState(),
|
|
20190
|
-
|
|
20191
|
-
|
|
20192
|
-
|
|
20193
|
-
|
|
19585
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19586
|
+
paymentValue = _useState2[0],
|
|
19587
|
+
setPaymentValue = _useState2[1];
|
|
20194
19588
|
var _useState3 = React.useState(),
|
|
20195
|
-
|
|
20196
|
-
|
|
20197
|
-
|
|
20198
|
-
|
|
19589
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
19590
|
+
displayedPaymentValue = _useState4[0],
|
|
19591
|
+
setDisplayedPaymentValue = _useState4[1];
|
|
20199
19592
|
var _useState5 = React.useState(),
|
|
20200
|
-
|
|
20201
|
-
|
|
20202
|
-
|
|
20203
|
-
|
|
19593
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
19594
|
+
paymentValueLoss = _useState6[0],
|
|
19595
|
+
setPaymentValueLoss = _useState6[1];
|
|
20204
19596
|
var _useContext7 = React.useContext(ConfigurationContext),
|
|
20205
|
-
|
|
20206
|
-
|
|
19597
|
+
currency = _useContext7.currency;
|
|
20207
19598
|
var _useState7 = React.useState(0),
|
|
20208
|
-
|
|
20209
|
-
|
|
20210
|
-
|
|
20211
|
-
|
|
19599
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
19600
|
+
reloadCount = _useState8[0],
|
|
19601
|
+
setReloadCount = _useState8[1];
|
|
20212
19602
|
var updatePaymentValue = function updatePaymentValue(_ref) {
|
|
20213
19603
|
var updatable = _ref.updatable,
|
|
20214
|
-
|
|
20215
|
-
|
|
19604
|
+
payment = _ref.payment;
|
|
20216
19605
|
if (updatable == false || (payment === null || payment === void 0 ? void 0 : payment.route) == undefined) {
|
|
20217
19606
|
return;
|
|
20218
19607
|
}
|
|
20219
|
-
|
|
20220
19608
|
Promise.all([web3Exchanges.route({
|
|
20221
19609
|
blockchain: payment.route.blockchain,
|
|
20222
19610
|
tokenIn: payment.route.fromToken.address,
|
|
@@ -20236,27 +19624,22 @@
|
|
|
20236
19624
|
address: web3Constants.CONSTANTS[payment.route.blockchain].USD
|
|
20237
19625
|
}).decimals()]).then(function (_ref2) {
|
|
20238
19626
|
var _ref3 = _slicedToArray(_ref2, 3),
|
|
20239
|
-
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
|
|
19627
|
+
fromTokenUSDExchangeRoutes = _ref3[0],
|
|
19628
|
+
reverseRoutes = _ref3[1],
|
|
19629
|
+
USDDecimals = _ref3[2];
|
|
20243
19630
|
var fromTokenUSDRoute = fromTokenUSDExchangeRoutes[0];
|
|
20244
19631
|
var reverseRoute = reverseRoutes[0];
|
|
20245
|
-
|
|
20246
19632
|
if (reverseRoute) {
|
|
20247
19633
|
var reverseAmountOutBN = ethers.ethers.BigNumber.from(reverseRoute.amountOut);
|
|
20248
19634
|
var paymentAmountInBN = ethers.ethers.BigNumber.from(payment.route.fromAmount);
|
|
20249
19635
|
var divPercent = 100 - reverseAmountOutBN.mul(ethers.ethers.BigNumber.from('100')).div(paymentAmountInBN).abs().toString();
|
|
20250
|
-
|
|
20251
19636
|
if (divPercent >= 10) {
|
|
20252
19637
|
setPaymentValueLoss(divPercent);
|
|
20253
19638
|
} else {
|
|
20254
19639
|
setPaymentValueLoss(null);
|
|
20255
19640
|
}
|
|
20256
19641
|
}
|
|
20257
|
-
|
|
20258
19642
|
var fromTokenUSDAmount;
|
|
20259
|
-
|
|
20260
19643
|
if (payment.route.fromToken.address.toLowerCase() == web3Constants.CONSTANTS[payment.route.blockchain].USD.toLowerCase()) {
|
|
20261
19644
|
fromTokenUSDAmount = payment.route.fromAmount.toString();
|
|
20262
19645
|
} else if (fromTokenUSDRoute == undefined) {
|
|
@@ -20265,7 +19648,6 @@
|
|
|
20265
19648
|
} else {
|
|
20266
19649
|
fromTokenUSDAmount = fromTokenUSDRoute.amountOut.toString();
|
|
20267
19650
|
}
|
|
20268
|
-
|
|
20269
19651
|
var fromTokenUSDValue = ethers.ethers.utils.formatUnits(fromTokenUSDAmount, USDDecimals);
|
|
20270
19652
|
localCurrency.Currency.fromUSD({
|
|
20271
19653
|
amount: fromTokenUSDValue,
|
|
@@ -20273,7 +19655,6 @@
|
|
|
20273
19655
|
}).then(setPaymentValue);
|
|
20274
19656
|
})["catch"](setError);
|
|
20275
19657
|
};
|
|
20276
|
-
|
|
20277
19658
|
React.useEffect(function () {
|
|
20278
19659
|
if (paymentValue && amount && configuredAmount && configuredAmount.currency && configuredAmount.fix) {
|
|
20279
19660
|
setDisplayedPaymentValue(paymentValue.toString());
|
|
@@ -20318,14 +19699,12 @@
|
|
|
20318
19699
|
|
|
20319
19700
|
var DonationRoutingProvider = (function (props) {
|
|
20320
19701
|
var _useContext = React.useContext(ChangableAmountContext),
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
19702
|
+
acceptWithAmount = _useContext.acceptWithAmount,
|
|
19703
|
+
setMaxRoute = _useContext.setMaxRoute;
|
|
20324
19704
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
20325
|
-
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
|
|
19705
|
+
blacklist = _useContext2.blacklist,
|
|
19706
|
+
whitelist = _useContext2.whitelist,
|
|
19707
|
+
fee = _useContext2.fee;
|
|
20329
19708
|
return /*#__PURE__*/React__default["default"].createElement(DonationRoutingContext.Provider, {
|
|
20330
19709
|
value: {}
|
|
20331
19710
|
}, /*#__PURE__*/React__default["default"].createElement(PaymentRoutingProvider, {
|
|
@@ -20342,9 +19721,7 @@
|
|
|
20342
19721
|
|
|
20343
19722
|
var format = (function (input) {
|
|
20344
19723
|
var _float = round(input);
|
|
20345
|
-
|
|
20346
19724
|
var floatToString = _float.toString();
|
|
20347
|
-
|
|
20348
19725
|
if (new RegExp(/\./).test(floatToString)) {
|
|
20349
19726
|
var exploded = floatToString.split('.');
|
|
20350
19727
|
return new Intl.NumberFormat().format(parseInt(exploded[0])) + '.' + exploded[1];
|
|
@@ -20355,81 +19732,61 @@
|
|
|
20355
19732
|
|
|
20356
19733
|
var ChangeAmountDialog = (function (props) {
|
|
20357
19734
|
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
20358
|
-
|
|
20359
|
-
|
|
19735
|
+
navigate = _useContext.navigate;
|
|
20360
19736
|
var _useContext2 = React.useContext(ErrorContext);
|
|
20361
|
-
|
|
20362
|
-
|
|
19737
|
+
_useContext2.setError;
|
|
20363
19738
|
var _useContext3 = React.useContext(WalletContext);
|
|
20364
|
-
|
|
20365
|
-
|
|
19739
|
+
_useContext3.account;
|
|
20366
19740
|
var _useContext4 = React.useContext(ChangableAmountContext),
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
19741
|
+
amount = _useContext4.amount,
|
|
19742
|
+
setAmount = _useContext4.setAmount,
|
|
19743
|
+
maxAmount = _useContext4.maxAmount;
|
|
20371
19744
|
var _useContext5 = React.useContext(PaymentValueContext);
|
|
20372
|
-
|
|
20373
|
-
|
|
19745
|
+
_useContext5.displayedPaymentValue;
|
|
20374
19746
|
var _useState = React.useState(amount),
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
19747
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19748
|
+
inputAmount = _useState2[0],
|
|
19749
|
+
setInputAmount = _useState2[1];
|
|
20379
19750
|
var _useContext6 = React.useContext(ConfigurationContext),
|
|
20380
|
-
|
|
20381
|
-
|
|
20382
|
-
|
|
19751
|
+
currencyCode = _useContext6.currencyCode,
|
|
19752
|
+
amountConfiguration = _useContext6.amount;
|
|
20383
19753
|
var _useContext7 = React.useContext(PaymentRoutingContext);
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
19754
|
+
_useContext7.allRoutes;
|
|
19755
|
+
var setSelectedRoute = _useContext7.setSelectedRoute;
|
|
20387
19756
|
var min = _typeof(amountConfiguration) == "object" && amountConfiguration.min ? amountConfiguration.min : 1;
|
|
20388
19757
|
var step = _typeof(amountConfiguration) == "object" && amountConfiguration.step ? amountConfiguration.step : 1;
|
|
20389
19758
|
var displayedCurrencyCode = amountConfiguration != undefined && amountConfiguration.token ? null : currencyCode;
|
|
20390
|
-
|
|
20391
19759
|
var changeAmountAndGoBack = function changeAmountAndGoBack() {
|
|
20392
19760
|
var newAmount = toValidValue(parseFloat(inputAmount));
|
|
20393
|
-
|
|
20394
19761
|
if (newAmount != amount) {
|
|
20395
19762
|
setSelectedRoute(undefined);
|
|
20396
19763
|
setAmount(newAmount);
|
|
20397
19764
|
}
|
|
20398
|
-
|
|
20399
19765
|
navigate('back');
|
|
20400
19766
|
};
|
|
20401
|
-
|
|
20402
19767
|
var changeAmount = function changeAmount(value) {
|
|
20403
19768
|
if (Number.isNaN(value)) {
|
|
20404
19769
|
return;
|
|
20405
19770
|
}
|
|
20406
|
-
|
|
20407
19771
|
setInputAmount(value);
|
|
20408
19772
|
};
|
|
20409
|
-
|
|
20410
19773
|
var toValidStep = function toValidStep(value) {
|
|
20411
19774
|
if (step) {
|
|
20412
19775
|
value = parseFloat(new decimal_js.Decimal(Math.floor(new decimal_js.Decimal(value).div(step))).mul(step).toString());
|
|
20413
19776
|
}
|
|
20414
|
-
|
|
20415
19777
|
return value;
|
|
20416
19778
|
};
|
|
20417
|
-
|
|
20418
19779
|
var toValidValue = function toValidValue(value) {
|
|
20419
19780
|
value = toValidStep(value);
|
|
20420
|
-
|
|
20421
19781
|
if (maxAmount) {
|
|
20422
19782
|
value = Math.max(min, Math.min(value, maxAmount));
|
|
20423
19783
|
}
|
|
20424
|
-
|
|
20425
19784
|
value = toValidStep(value);
|
|
20426
19785
|
return value;
|
|
20427
19786
|
};
|
|
20428
|
-
|
|
20429
19787
|
var setValidValue = function setValidValue(value) {
|
|
20430
19788
|
setInputAmount(toValidValue(value));
|
|
20431
19789
|
};
|
|
20432
|
-
|
|
20433
19790
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
20434
19791
|
stacked: true,
|
|
20435
19792
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -20484,8 +19841,7 @@
|
|
|
20484
19841
|
|
|
20485
19842
|
var ChangePaymentSkeleton = (function (props) {
|
|
20486
19843
|
var _useContext = React.useContext(PaymentValueContext),
|
|
20487
|
-
|
|
20488
|
-
|
|
19844
|
+
paymentValue = _useContext.paymentValue;
|
|
20489
19845
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
20490
19846
|
stacked: true,
|
|
20491
19847
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -20517,34 +19873,27 @@
|
|
|
20517
19873
|
|
|
20518
19874
|
var ChangePaymentDialog = (function (props) {
|
|
20519
19875
|
var _useContext = React.useContext(ErrorContext),
|
|
20520
|
-
|
|
20521
|
-
|
|
19876
|
+
setError = _useContext.setError;
|
|
20522
19877
|
var _useContext2 = React.useContext(PaymentRoutingContext),
|
|
20523
|
-
|
|
20524
|
-
|
|
20525
|
-
|
|
19878
|
+
allRoutes = _useContext2.allRoutes,
|
|
19879
|
+
setSelectedRoute = _useContext2.setSelectedRoute;
|
|
20526
19880
|
var _useContext3 = React.useContext(PaymentValueContext);
|
|
20527
|
-
|
|
20528
|
-
|
|
20529
|
-
|
|
19881
|
+
_useContext3.paymentValue;
|
|
19882
|
+
var displayedPaymentValue = _useContext3.displayedPaymentValue;
|
|
20530
19883
|
var _useContext4 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
20531
|
-
|
|
20532
|
-
|
|
19884
|
+
navigate = _useContext4.navigate;
|
|
20533
19885
|
var _useState = React.useState([]),
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
|
|
20537
|
-
|
|
19886
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19887
|
+
allPaymentRoutesWithData = _useState2[0],
|
|
19888
|
+
setAllPaymentRoutesWithData = _useState2[1];
|
|
20538
19889
|
var _useState3 = React.useState([]),
|
|
20539
|
-
|
|
20540
|
-
|
|
20541
|
-
|
|
20542
|
-
|
|
19890
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
19891
|
+
cards = _useState4[0],
|
|
19892
|
+
setCards = _useState4[1];
|
|
20543
19893
|
React.useEffect(function () {
|
|
20544
19894
|
if (allRoutes == undefined) {
|
|
20545
19895
|
return;
|
|
20546
19896
|
}
|
|
20547
|
-
|
|
20548
19897
|
Promise.all(allRoutes.map(function (route) {
|
|
20549
19898
|
route.exchangeRoutes[0];
|
|
20550
19899
|
route.fromToken;
|
|
@@ -20599,11 +19948,9 @@
|
|
|
20599
19948
|
}, /*#__PURE__*/React__default["default"].createElement("small", null, format(round(parseFloat(payment.route.fromBalance.toString()) / Math.pow(10, payment.decimals), 'down')))))));
|
|
20600
19949
|
}));
|
|
20601
19950
|
}, [allPaymentRoutesWithData]);
|
|
20602
|
-
|
|
20603
19951
|
if (allPaymentRoutesWithData.length == 0 || cards.length == 0) {
|
|
20604
19952
|
return /*#__PURE__*/React__default["default"].createElement(ChangePaymentSkeleton, null);
|
|
20605
19953
|
}
|
|
20606
|
-
|
|
20607
19954
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
20608
19955
|
stacked: true,
|
|
20609
19956
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -20624,8 +19971,7 @@
|
|
|
20624
19971
|
|
|
20625
19972
|
var DonationOverviewSkeleton = (function (props) {
|
|
20626
19973
|
var _useContext = React.useContext(ConfigurationContext),
|
|
20627
|
-
|
|
20628
|
-
|
|
19974
|
+
title = _useContext.title;
|
|
20629
19975
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
20630
19976
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20631
19977
|
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
@@ -20723,42 +20069,34 @@
|
|
|
20723
20069
|
|
|
20724
20070
|
var Footer = (function () {
|
|
20725
20071
|
var _useContext = React.useContext(ChangableAmountContext);
|
|
20726
|
-
|
|
20727
|
-
|
|
20728
|
-
|
|
20072
|
+
_useContext.amount;
|
|
20073
|
+
_useContext.amountsMissing;
|
|
20729
20074
|
var _useContext2 = React.useContext(PaymentTrackingContext),
|
|
20730
|
-
|
|
20731
|
-
|
|
20732
|
-
|
|
20733
|
-
|
|
20075
|
+
tracking = _useContext2.tracking,
|
|
20076
|
+
release = _useContext2.release,
|
|
20077
|
+
forwardTo = _useContext2.forwardTo;
|
|
20734
20078
|
var _useContext3 = React.useContext(PaymentContext),
|
|
20735
|
-
|
|
20736
|
-
|
|
20737
|
-
|
|
20738
|
-
|
|
20739
|
-
|
|
20740
|
-
|
|
20741
|
-
|
|
20079
|
+
payment = _useContext3.payment,
|
|
20080
|
+
paymentState = _useContext3.paymentState,
|
|
20081
|
+
pay = _useContext3.pay,
|
|
20082
|
+
transaction = _useContext3.transaction,
|
|
20083
|
+
approve = _useContext3.approve,
|
|
20084
|
+
approvalTransaction = _useContext3.approvalTransaction;
|
|
20742
20085
|
var _useContext4 = React.useContext(PaymentValueContext);
|
|
20743
|
-
|
|
20744
|
-
|
|
20745
|
-
|
|
20746
|
-
|
|
20086
|
+
_useContext4.paymentValue;
|
|
20087
|
+
var displayedPaymentValue = _useContext4.displayedPaymentValue,
|
|
20088
|
+
paymentValueLoss = _useContext4.paymentValueLoss;
|
|
20747
20089
|
var _useContext5 = React.useContext(PaymentRoutingContext),
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20090
|
+
updatedRouteWithNewPrice = _useContext5.updatedRouteWithNewPrice,
|
|
20091
|
+
updateRouteWithNewPrice = _useContext5.updateRouteWithNewPrice;
|
|
20751
20092
|
var _useContext6 = React.useContext(reactDialogStack.NavigateStackContext);
|
|
20752
|
-
|
|
20753
|
-
|
|
20093
|
+
_useContext6.navigate;
|
|
20754
20094
|
var _useContext7 = React.useContext(ClosableContext),
|
|
20755
|
-
|
|
20756
|
-
|
|
20095
|
+
close = _useContext7.close;
|
|
20757
20096
|
var trackingInfo = function trackingInfo() {
|
|
20758
20097
|
if (tracking != true) {
|
|
20759
20098
|
return null;
|
|
20760
20099
|
}
|
|
20761
|
-
|
|
20762
20100
|
if (release) {
|
|
20763
20101
|
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20764
20102
|
className: "Card transparent small disabled"
|
|
@@ -20793,7 +20131,6 @@
|
|
|
20793
20131
|
}, "Validating payment")))));
|
|
20794
20132
|
}
|
|
20795
20133
|
};
|
|
20796
|
-
|
|
20797
20134
|
var additionalPaymentInformation = function additionalPaymentInformation() {
|
|
20798
20135
|
if (paymentState == 'paying' && transaction == undefined) {
|
|
20799
20136
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -20813,7 +20150,7 @@
|
|
|
20813
20150
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20814
20151
|
className: "Opacity05"
|
|
20815
20152
|
}, "Confirm transaction in your wallet")))));
|
|
20816
|
-
} else if (paymentState == '
|
|
20153
|
+
} else if (paymentState == 'success') {
|
|
20817
20154
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20818
20155
|
className: "PaddingBottomS"
|
|
20819
20156
|
}, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("a", {
|
|
@@ -20837,7 +20174,6 @@
|
|
|
20837
20174
|
}, "Payment confirmed"))))), trackingInfo());
|
|
20838
20175
|
}
|
|
20839
20176
|
};
|
|
20840
|
-
|
|
20841
20177
|
var approvalButton = function approvalButton() {
|
|
20842
20178
|
if (payment.route == undefined || !payment.route.approvalRequired || payment.route.directTransfer) {
|
|
20843
20179
|
return null;
|
|
@@ -20861,7 +20197,6 @@
|
|
|
20861
20197
|
}, /*#__PURE__*/React__default["default"].createElement(LoadingText, null, "Approving")));
|
|
20862
20198
|
}
|
|
20863
20199
|
};
|
|
20864
|
-
|
|
20865
20200
|
var mainAction = function mainAction() {
|
|
20866
20201
|
if (updatedRouteWithNewPrice) {
|
|
20867
20202
|
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -20890,7 +20225,6 @@
|
|
|
20890
20225
|
if (payment.route.approvalRequired && !payment.route.directTransfer) {
|
|
20891
20226
|
return;
|
|
20892
20227
|
}
|
|
20893
|
-
|
|
20894
20228
|
pay();
|
|
20895
20229
|
}
|
|
20896
20230
|
}, "Pay ", displayedPaymentValue);
|
|
@@ -20902,7 +20236,7 @@
|
|
|
20902
20236
|
target: "_blank",
|
|
20903
20237
|
rel: "noopener noreferrer"
|
|
20904
20238
|
}, /*#__PURE__*/React__default["default"].createElement(LoadingText, null, "Paying"));
|
|
20905
|
-
} else if (paymentState == '
|
|
20239
|
+
} else if (paymentState == 'success') {
|
|
20906
20240
|
if (tracking == true) {
|
|
20907
20241
|
if (release) {
|
|
20908
20242
|
if (forwardTo) {
|
|
@@ -20931,32 +20265,25 @@
|
|
|
20931
20265
|
}
|
|
20932
20266
|
}
|
|
20933
20267
|
};
|
|
20934
|
-
|
|
20935
20268
|
return /*#__PURE__*/React__default["default"].createElement("div", null, approvalButton(), additionalPaymentInformation(), mainAction());
|
|
20936
20269
|
});
|
|
20937
20270
|
|
|
20938
20271
|
var DonationOverviewDialog = (function (props) {
|
|
20939
20272
|
var _useContext = React.useContext(ConfigurationContext);
|
|
20940
|
-
|
|
20941
|
-
|
|
20942
|
-
|
|
20273
|
+
_useContext.currencyCode;
|
|
20274
|
+
var title = _useContext.title;
|
|
20943
20275
|
var _useContext2 = React.useContext(ChangableAmountContext);
|
|
20944
|
-
|
|
20945
|
-
|
|
20276
|
+
_useContext2.amount;
|
|
20946
20277
|
var _useContext3 = React.useContext(PaymentContext),
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20278
|
+
payment = _useContext3.payment,
|
|
20279
|
+
paymentState = _useContext3.paymentState;
|
|
20950
20280
|
var _useContext4 = React.useContext(PaymentValueContext),
|
|
20951
|
-
|
|
20952
|
-
|
|
20281
|
+
displayedPaymentValue = _useContext4.displayedPaymentValue;
|
|
20953
20282
|
var _useContext5 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
20954
|
-
|
|
20955
|
-
|
|
20283
|
+
navigate = _useContext5.navigate;
|
|
20956
20284
|
if (payment == undefined) {
|
|
20957
20285
|
return /*#__PURE__*/React__default["default"].createElement(DonationOverviewSkeleton, null);
|
|
20958
20286
|
}
|
|
20959
|
-
|
|
20960
20287
|
var blockchain = web3Blockchains.Blockchain.findByName(payment.blockchain);
|
|
20961
20288
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
20962
20289
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -20973,7 +20300,6 @@
|
|
|
20973
20300
|
if (paymentState != 'initialized') {
|
|
20974
20301
|
return;
|
|
20975
20302
|
}
|
|
20976
|
-
|
|
20977
20303
|
navigate('ChangeAmount');
|
|
20978
20304
|
}
|
|
20979
20305
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -20995,7 +20321,6 @@
|
|
|
20995
20321
|
if (paymentState != 'initialized') {
|
|
20996
20322
|
return;
|
|
20997
20323
|
}
|
|
20998
|
-
|
|
20999
20324
|
navigate('ChangePayment');
|
|
21000
20325
|
}
|
|
21001
20326
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -21032,13 +20357,11 @@
|
|
|
21032
20357
|
});
|
|
21033
20358
|
});
|
|
21034
20359
|
|
|
21035
|
-
var
|
|
20360
|
+
var PaymentFailedDialog = (function () {
|
|
21036
20361
|
var _useContext = React.useContext(ClosableContext),
|
|
21037
|
-
|
|
21038
|
-
|
|
20362
|
+
close = _useContext.close;
|
|
21039
20363
|
var _useContext2 = React.useContext(PaymentContext),
|
|
21040
|
-
|
|
21041
|
-
|
|
20364
|
+
transaction = _useContext2.transaction;
|
|
21042
20365
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
21043
20366
|
stacked: false,
|
|
21044
20367
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -21081,11 +20404,9 @@
|
|
|
21081
20404
|
|
|
21082
20405
|
var WrongNetworkDialog = (function (props) {
|
|
21083
20406
|
var _useContext = React.useContext(PaymentContext),
|
|
21084
|
-
|
|
21085
|
-
|
|
20407
|
+
payment = _useContext.payment;
|
|
21086
20408
|
var _useContext2 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
21087
|
-
|
|
21088
|
-
|
|
20409
|
+
navigate = _useContext2.navigate;
|
|
21089
20410
|
var blockchain = web3Blockchains.Blockchain.findByName(payment.route.blockchain);
|
|
21090
20411
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
21091
20412
|
stacked: true,
|
|
@@ -21121,12 +20442,10 @@
|
|
|
21121
20442
|
|
|
21122
20443
|
var DonationStack = (function (props) {
|
|
21123
20444
|
var _useContext = React.useContext(ClosableContext),
|
|
21124
|
-
|
|
21125
|
-
|
|
21126
|
-
|
|
20445
|
+
open = _useContext.open,
|
|
20446
|
+
close = _useContext.close;
|
|
21127
20447
|
var _useContext2 = React.useContext(NavigateContext),
|
|
21128
|
-
|
|
21129
|
-
|
|
20448
|
+
setNavigator = _useContext2.setNavigator;
|
|
21130
20449
|
return /*#__PURE__*/React__default["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
21131
20450
|
setNavigator: setNavigator,
|
|
21132
20451
|
open: open,
|
|
@@ -21138,7 +20457,7 @@
|
|
|
21138
20457
|
DonationOverview: /*#__PURE__*/React__default["default"].createElement(DonationOverviewDialog, null),
|
|
21139
20458
|
ChangeAmount: /*#__PURE__*/React__default["default"].createElement(ChangeAmountDialog, null),
|
|
21140
20459
|
ChangePayment: /*#__PURE__*/React__default["default"].createElement(ChangePaymentDialog, null),
|
|
21141
|
-
|
|
20460
|
+
PaymentFailed: /*#__PURE__*/React__default["default"].createElement(PaymentFailedDialog, null),
|
|
21142
20461
|
WrongNetwork: /*#__PURE__*/React__default["default"].createElement(WrongNetworkDialog, null)
|
|
21143
20462
|
}
|
|
21144
20463
|
});
|
|
@@ -21146,23 +20465,19 @@
|
|
|
21146
20465
|
|
|
21147
20466
|
var NavigateProvider = (function (props) {
|
|
21148
20467
|
var navigator;
|
|
21149
|
-
|
|
21150
20468
|
var setNavigator = function setNavigator(_navigator) {
|
|
21151
20469
|
navigator = _navigator;
|
|
21152
20470
|
};
|
|
21153
|
-
|
|
21154
20471
|
var navigate = function navigate(dialog) {
|
|
21155
20472
|
if (navigator) {
|
|
21156
20473
|
navigator.navigate(dialog);
|
|
21157
20474
|
}
|
|
21158
20475
|
};
|
|
21159
|
-
|
|
21160
20476
|
var set = function set(dialogs) {
|
|
21161
20477
|
if (navigator) {
|
|
21162
20478
|
navigator.set(dialogs);
|
|
21163
20479
|
}
|
|
21164
20480
|
};
|
|
21165
|
-
|
|
21166
20481
|
return /*#__PURE__*/React__default["default"].createElement(NavigateContext.Provider, {
|
|
21167
20482
|
value: {
|
|
21168
20483
|
navigate: navigate,
|
|
@@ -21174,58 +20489,46 @@
|
|
|
21174
20489
|
|
|
21175
20490
|
var PaymentTrackingProvider = (function (props) {
|
|
21176
20491
|
var _useContext = React.useContext(ErrorContext);
|
|
21177
|
-
|
|
21178
|
-
|
|
20492
|
+
_useContext.errorCallback;
|
|
21179
20493
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
21180
|
-
|
|
21181
|
-
|
|
21182
|
-
|
|
21183
|
-
|
|
21184
|
-
|
|
21185
|
-
|
|
20494
|
+
track = _useContext2.track,
|
|
20495
|
+
validated = _useContext2.validated,
|
|
20496
|
+
integration = _useContext2.integration,
|
|
20497
|
+
link = _useContext2.link,
|
|
20498
|
+
type = _useContext2.type;
|
|
21186
20499
|
var _useState = React.useState(),
|
|
21187
|
-
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
|
|
20500
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20501
|
+
transaction = _useState2[0],
|
|
20502
|
+
setTransaction = _useState2[1];
|
|
21191
20503
|
var _useState3 = React.useState(),
|
|
21192
|
-
|
|
21193
|
-
|
|
21194
|
-
|
|
21195
|
-
|
|
20504
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20505
|
+
afterBlock = _useState4[0],
|
|
20506
|
+
setAfterBlock = _useState4[1];
|
|
21196
20507
|
var _useState5 = React.useState(),
|
|
21197
|
-
|
|
21198
|
-
|
|
21199
|
-
|
|
21200
|
-
|
|
20508
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
20509
|
+
paymentRoute = _useState6[0],
|
|
20510
|
+
setPaymentRoute = _useState6[1];
|
|
21201
20511
|
var _useState7 = React.useState(!!(track && (track.endpoint || typeof track.method == 'function') && track.async != true)),
|
|
21202
|
-
|
|
21203
|
-
|
|
21204
|
-
|
|
20512
|
+
_useState8 = _slicedToArray(_useState7, 1),
|
|
20513
|
+
tracking = _useState8[0];
|
|
21205
20514
|
var _useState9 = React.useState(!!(track && track.poll && (track.poll.endpoint || typeof track.poll.method == 'function') && track.async != true)),
|
|
21206
|
-
|
|
21207
|
-
|
|
21208
|
-
|
|
20515
|
+
_useState10 = _slicedToArray(_useState9, 1),
|
|
20516
|
+
polling = _useState10[0];
|
|
21209
20517
|
var _useState11 = React.useState(false),
|
|
21210
|
-
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
|
|
20518
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
20519
|
+
release = _useState12[0],
|
|
20520
|
+
setRelease = _useState12[1];
|
|
21214
20521
|
var _useState13 = React.useState(),
|
|
21215
|
-
|
|
21216
|
-
|
|
21217
|
-
|
|
21218
|
-
|
|
20522
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
20523
|
+
forwardTo = _useState14[0],
|
|
20524
|
+
setForwardTo = _useState14[1];
|
|
21219
20525
|
var _useContext3 = React.useContext(ClosableContext),
|
|
21220
|
-
|
|
21221
|
-
|
|
20526
|
+
setClosable = _useContext3.setClosable;
|
|
21222
20527
|
var _useContext4 = React.useContext(NavigateContext),
|
|
21223
|
-
|
|
21224
|
-
|
|
21225
|
-
|
|
20528
|
+
navigate = _useContext4.navigate;
|
|
20529
|
+
_useContext4.set;
|
|
21226
20530
|
var openSocket = function openSocket(transaction) {
|
|
21227
20531
|
var socket = new WebSocket('wss://integrate.depay.com/cable');
|
|
21228
|
-
|
|
21229
20532
|
socket.onopen = function (event) {
|
|
21230
20533
|
var msg = {
|
|
21231
20534
|
command: 'subscribe',
|
|
@@ -21238,31 +20541,20 @@
|
|
|
21238
20541
|
};
|
|
21239
20542
|
socket.send(JSON.stringify(msg));
|
|
21240
20543
|
};
|
|
21241
|
-
|
|
21242
20544
|
socket.onclose = function (event) {};
|
|
21243
|
-
|
|
21244
20545
|
socket.onmessage = function (event) {
|
|
21245
20546
|
var item = JSON.parse(event.data);
|
|
21246
|
-
|
|
21247
20547
|
if (item.type === "ping" || !item.message) {
|
|
21248
20548
|
return;
|
|
21249
20549
|
}
|
|
21250
|
-
|
|
21251
|
-
if (item.message.status == 'failed') {
|
|
21252
|
-
setClosable(true);
|
|
21253
|
-
set(['PaymentError']);
|
|
21254
|
-
}
|
|
21255
|
-
|
|
21256
20550
|
if (validated) {
|
|
21257
20551
|
validated(item.message.status == 'success');
|
|
21258
20552
|
}
|
|
21259
|
-
|
|
21260
20553
|
if (item.message.release) {
|
|
21261
20554
|
setRelease(true);
|
|
21262
20555
|
setClosable(!item.message.forward_to);
|
|
21263
20556
|
setForwardTo(item.message.forward_to);
|
|
21264
20557
|
socket.close();
|
|
21265
|
-
|
|
21266
20558
|
if (!!item.message.forward_to) {
|
|
21267
20559
|
setTimeout(function () {
|
|
21268
20560
|
props.document.location.href = item.message.forward_to;
|
|
@@ -21270,31 +20562,23 @@
|
|
|
21270
20562
|
}
|
|
21271
20563
|
}
|
|
21272
20564
|
};
|
|
21273
|
-
|
|
21274
20565
|
socket.onerror = function (error) {
|
|
21275
20566
|
console.log('WebSocket Error: ' + error);
|
|
21276
20567
|
};
|
|
21277
20568
|
};
|
|
21278
|
-
|
|
21279
20569
|
var retryStartTracking = function retryStartTracking(transaction, afterBlock, paymentRoute, attempt) {
|
|
21280
20570
|
attempt = parseInt(attempt || 1, 10);
|
|
21281
|
-
console.log('attempt', attempt);
|
|
21282
|
-
console.log('track.attempts', track === null || track === void 0 ? void 0 : track.attempts);
|
|
21283
|
-
|
|
21284
20571
|
if (attempt < ((track === null || track === void 0 ? void 0 : track.attempts) || 40)) {
|
|
21285
20572
|
setTimeout(function () {
|
|
21286
20573
|
startTracking(transaction, afterBlock, paymentRoute, attempt + 1);
|
|
21287
20574
|
}, 3000);
|
|
21288
20575
|
} else {
|
|
21289
|
-
console.log('navigate TrackingFailed');
|
|
21290
20576
|
navigate('TrackingFailed');
|
|
21291
20577
|
}
|
|
21292
20578
|
};
|
|
21293
|
-
|
|
21294
20579
|
var continueTryTracking = function continueTryTracking() {
|
|
21295
20580
|
retryStartTracking(transaction, afterBlock, paymentRoute, 1);
|
|
21296
20581
|
};
|
|
21297
|
-
|
|
21298
20582
|
var callTracking = function callTracking(payment) {
|
|
21299
20583
|
if (track.endpoint) {
|
|
21300
20584
|
return fetch(track.endpoint, {
|
|
@@ -21310,10 +20594,8 @@
|
|
|
21310
20594
|
throw 'No tracking defined!';
|
|
21311
20595
|
}
|
|
21312
20596
|
};
|
|
21313
|
-
|
|
21314
20597
|
var startTracking = function startTracking(transaction, afterBlock, paymentRoute, attempt) {
|
|
21315
20598
|
var _paymentRoute$feeAmou;
|
|
21316
|
-
|
|
21317
20599
|
callTracking({
|
|
21318
20600
|
blockchain: transaction.blockchain,
|
|
21319
20601
|
transaction: transaction.id.toLowerCase(),
|
|
@@ -21336,12 +20618,10 @@
|
|
|
21336
20618
|
retryStartTracking(transaction, afterBlock, paymentRoute, attempt);
|
|
21337
20619
|
});
|
|
21338
20620
|
};
|
|
21339
|
-
|
|
21340
20621
|
var pollStatus = function pollStatus(polling, transaction, afterBlock, paymentRoute, pollingInterval) {
|
|
21341
20622
|
if (!polling || transaction == undefined || afterBlock == undefined || paymentRoute == undefined) {
|
|
21342
20623
|
return;
|
|
21343
20624
|
}
|
|
21344
|
-
|
|
21345
20625
|
var payment = {
|
|
21346
20626
|
blockchain: transaction.blockchain,
|
|
21347
20627
|
transaction: transaction.id.toLowerCase(),
|
|
@@ -21350,7 +20630,6 @@
|
|
|
21350
20630
|
after_block: afterBlock,
|
|
21351
20631
|
to_token: paymentRoute.toToken.address
|
|
21352
20632
|
};
|
|
21353
|
-
|
|
21354
20633
|
var handleResponse = function handleResponse(response) {
|
|
21355
20634
|
if (response.status == 200 || response.status == 201) {
|
|
21356
20635
|
response.json().then(function (data) {
|
|
@@ -21369,7 +20648,6 @@
|
|
|
21369
20648
|
setRelease(true);
|
|
21370
20649
|
}
|
|
21371
20650
|
};
|
|
21372
|
-
|
|
21373
20651
|
if (track.poll.endpoint) {
|
|
21374
20652
|
fetch(track.poll.endpoint, {
|
|
21375
20653
|
method: 'POST',
|
|
@@ -21382,16 +20660,13 @@
|
|
|
21382
20660
|
track.poll.method(payment).then(handleResponse);
|
|
21383
20661
|
}
|
|
21384
20662
|
};
|
|
21385
|
-
|
|
21386
20663
|
React.useEffect(function () {
|
|
21387
20664
|
if (!polling) {
|
|
21388
20665
|
return;
|
|
21389
20666
|
}
|
|
21390
|
-
|
|
21391
20667
|
if (!tracking) {
|
|
21392
20668
|
return;
|
|
21393
20669
|
}
|
|
21394
|
-
|
|
21395
20670
|
var pollingInterval = setInterval(function () {
|
|
21396
20671
|
return pollStatus(polling, transaction, afterBlock, paymentRoute, pollingInterval);
|
|
21397
20672
|
}, 5000);
|
|
@@ -21399,7 +20674,6 @@
|
|
|
21399
20674
|
clearInterval(pollingInterval);
|
|
21400
20675
|
};
|
|
21401
20676
|
}, [polling, transaction, afterBlock, paymentRoute]);
|
|
21402
|
-
|
|
21403
20677
|
var storePayment = function storePayment(transaction, afterBlock, paymentRoute, attempt) {
|
|
21404
20678
|
fetch('https://public.depay.com/payments', {
|
|
21405
20679
|
headers: {
|
|
@@ -21440,24 +20714,19 @@
|
|
|
21440
20714
|
}, 3000);
|
|
21441
20715
|
});
|
|
21442
20716
|
};
|
|
21443
|
-
|
|
21444
20717
|
var initializeTracking = function initializeTracking(transaction, afterBlock, paymentRoute) {
|
|
21445
20718
|
storePayment(transaction, afterBlock, paymentRoute);
|
|
21446
|
-
|
|
21447
20719
|
if (tracking || track && track.async == true) {
|
|
21448
20720
|
startTracking(transaction, afterBlock, paymentRoute);
|
|
21449
20721
|
}
|
|
21450
|
-
|
|
21451
20722
|
if (tracking == false) {
|
|
21452
20723
|
return;
|
|
21453
20724
|
}
|
|
21454
|
-
|
|
21455
20725
|
setTransaction(transaction);
|
|
21456
20726
|
setAfterBlock(afterBlock);
|
|
21457
20727
|
setPaymentRoute(paymentRoute);
|
|
21458
20728
|
openSocket(transaction);
|
|
21459
20729
|
};
|
|
21460
|
-
|
|
21461
20730
|
return /*#__PURE__*/React__default["default"].createElement(PaymentTrackingContext.Provider, {
|
|
21462
20731
|
value: {
|
|
21463
20732
|
tracking: tracking,
|
|
@@ -21471,26 +20740,21 @@
|
|
|
21471
20740
|
|
|
21472
20741
|
var TransactionTrackingProvider = (function (props) {
|
|
21473
20742
|
var _useState = React.useState(),
|
|
21474
|
-
|
|
21475
|
-
|
|
21476
|
-
|
|
21477
|
-
|
|
20743
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20744
|
+
givenTransaction = _useState2[0],
|
|
20745
|
+
setGivenTransaction = _useState2[1];
|
|
21478
20746
|
var _useState3 = React.useState(),
|
|
21479
|
-
|
|
21480
|
-
|
|
21481
|
-
|
|
21482
|
-
|
|
20747
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20748
|
+
foundTransaction = _useState4[0],
|
|
20749
|
+
setFoundTransaction = _useState4[1];
|
|
21483
20750
|
var _useState5 = React.useState(false),
|
|
21484
|
-
|
|
21485
|
-
|
|
21486
|
-
|
|
21487
|
-
|
|
20751
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
20752
|
+
polling = _useState6[0],
|
|
20753
|
+
setPolling = _useState6[1];
|
|
21488
20754
|
var _useContext = React.useContext(ErrorContext);
|
|
21489
|
-
|
|
21490
|
-
|
|
20755
|
+
_useContext.errorCallback;
|
|
21491
20756
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
21492
|
-
|
|
21493
|
-
|
|
20757
|
+
recover = _useContext2.recover;
|
|
21494
20758
|
React.useEffect(function () {
|
|
21495
20759
|
if (polling) {
|
|
21496
20760
|
var poll = function poll() {
|
|
@@ -21508,7 +20772,6 @@
|
|
|
21508
20772
|
}
|
|
21509
20773
|
});
|
|
21510
20774
|
};
|
|
21511
|
-
|
|
21512
20775
|
var pollingInterval = setInterval(poll, 5000);
|
|
21513
20776
|
poll();
|
|
21514
20777
|
return function () {
|
|
@@ -21516,13 +20779,11 @@
|
|
|
21516
20779
|
};
|
|
21517
20780
|
}
|
|
21518
20781
|
}, [polling]);
|
|
21519
|
-
|
|
21520
20782
|
var createTracking = function createTracking(transaction, afterBlock, attempt) {
|
|
21521
20783
|
if (attempt > 3) {
|
|
21522
20784
|
console.log('TRANSACTION TRACKING FAILED AFTER 3 ATTEMPTS!');
|
|
21523
20785
|
return;
|
|
21524
20786
|
}
|
|
21525
|
-
|
|
21526
20787
|
fetch('https://public.depay.com/transactions', {
|
|
21527
20788
|
method: 'POST',
|
|
21528
20789
|
headers: {
|
|
@@ -21551,10 +20812,8 @@
|
|
|
21551
20812
|
}, 3000);
|
|
21552
20813
|
});
|
|
21553
20814
|
};
|
|
21554
|
-
|
|
21555
20815
|
var openSocket = function openSocket(transaction) {
|
|
21556
20816
|
var socket = new WebSocket('wss://integrate.depay.com/cable');
|
|
21557
|
-
|
|
21558
20817
|
socket.onopen = function (event) {
|
|
21559
20818
|
var msg = {
|
|
21560
20819
|
command: 'subscribe',
|
|
@@ -21567,37 +20826,28 @@
|
|
|
21567
20826
|
};
|
|
21568
20827
|
socket.send(JSON.stringify(msg));
|
|
21569
20828
|
};
|
|
21570
|
-
|
|
21571
20829
|
socket.onclose = function (event) {};
|
|
21572
|
-
|
|
21573
20830
|
socket.onmessage = function (event) {
|
|
21574
20831
|
var item = JSON.parse(event.data);
|
|
21575
|
-
|
|
21576
20832
|
if (item.type === "ping") {
|
|
21577
20833
|
return;
|
|
21578
20834
|
}
|
|
21579
|
-
|
|
21580
20835
|
if (item.message && item.message.status && item.message.status != 'pending') {
|
|
21581
20836
|
setFoundTransaction(item.message);
|
|
21582
20837
|
}
|
|
21583
20838
|
};
|
|
21584
|
-
|
|
21585
20839
|
socket.onerror = function (error) {
|
|
21586
20840
|
console.log('WebSocket Error: ' + error);
|
|
21587
20841
|
};
|
|
21588
20842
|
};
|
|
21589
|
-
|
|
21590
20843
|
var initializeTracking = function initializeTracking(transaction, afterBlock) {
|
|
21591
20844
|
setGivenTransaction(transaction);
|
|
21592
|
-
|
|
21593
20845
|
if (recover == undefined) {
|
|
21594
20846
|
createTracking(transaction, afterBlock, 1);
|
|
21595
20847
|
}
|
|
21596
|
-
|
|
21597
20848
|
openSocket(transaction);
|
|
21598
20849
|
setPolling(true);
|
|
21599
20850
|
};
|
|
21600
|
-
|
|
21601
20851
|
React.useEffect(function () {
|
|
21602
20852
|
if (recover) {
|
|
21603
20853
|
initializeTracking({
|
|
@@ -21618,38 +20868,31 @@
|
|
|
21618
20868
|
|
|
21619
20869
|
var WalletProvider = (function (props) {
|
|
21620
20870
|
var _useContext = React.useContext(ConfigurationContext),
|
|
21621
|
-
|
|
21622
|
-
|
|
20871
|
+
recover = _useContext.recover;
|
|
21623
20872
|
var _useContext2 = React.useContext(ErrorContext);
|
|
21624
|
-
|
|
21625
|
-
|
|
20873
|
+
_useContext2.setError;
|
|
21626
20874
|
var _useState = React.useState(),
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
|
|
21630
|
-
|
|
20875
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20876
|
+
wallet = _useState2[0],
|
|
20877
|
+
setWallet = _useState2[1];
|
|
21631
20878
|
var _useState3 = React.useState(),
|
|
21632
|
-
|
|
21633
|
-
|
|
21634
|
-
|
|
21635
|
-
|
|
20879
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20880
|
+
account = _useState4[0],
|
|
20881
|
+
setAccount = _useState4[1];
|
|
21636
20882
|
var _useState5 = React.useState(),
|
|
21637
|
-
|
|
21638
|
-
|
|
21639
|
-
|
|
21640
|
-
|
|
20883
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
20884
|
+
walletState = _useState6[0],
|
|
20885
|
+
setWalletState = _useState6[1];
|
|
21641
20886
|
var connected = function connected(_ref) {
|
|
21642
20887
|
var account = _ref.account,
|
|
21643
|
-
|
|
20888
|
+
wallet = _ref.wallet;
|
|
21644
20889
|
setAccount(account);
|
|
21645
20890
|
setWallet(wallet);
|
|
21646
20891
|
setWalletState('connected');
|
|
21647
|
-
|
|
21648
20892
|
if (props.connected) {
|
|
21649
20893
|
props.connected(account);
|
|
21650
20894
|
}
|
|
21651
20895
|
};
|
|
21652
|
-
|
|
21653
20896
|
if (walletState == 'connected' || recover != undefined) {
|
|
21654
20897
|
return /*#__PURE__*/React__default["default"].createElement(WalletContext.Provider, {
|
|
21655
20898
|
value: {
|
|
@@ -21675,33 +20918,26 @@
|
|
|
21675
20918
|
switch (_context.prev = _context.next) {
|
|
21676
20919
|
case 0:
|
|
21677
20920
|
accept = _ref.accept;
|
|
21678
|
-
|
|
21679
20921
|
if (!(!(accept instanceof Array) || accept.length == 0)) {
|
|
21680
20922
|
_context.next = 3;
|
|
21681
20923
|
break;
|
|
21682
20924
|
}
|
|
21683
|
-
|
|
21684
20925
|
throw 'You need to set the tokens you accept as donation!';
|
|
21685
|
-
|
|
21686
20926
|
case 3:
|
|
21687
20927
|
accept.forEach(function (configuration) {
|
|
21688
20928
|
if (typeof configuration.blockchain === 'undefined') {
|
|
21689
20929
|
throw 'You need to set the blockchain you want to receive the donation on!';
|
|
21690
20930
|
}
|
|
21691
|
-
|
|
21692
20931
|
if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
|
|
21693
20932
|
throw 'You need to set a supported blockchain!';
|
|
21694
20933
|
}
|
|
21695
|
-
|
|
21696
20934
|
if (typeof configuration.token === 'undefined') {
|
|
21697
20935
|
throw 'You need to set the token you want to receive as donation!';
|
|
21698
20936
|
}
|
|
21699
|
-
|
|
21700
20937
|
if (typeof configuration.receiver === 'undefined') {
|
|
21701
20938
|
throw 'You need to set the receiver address that you want to receive the donation!';
|
|
21702
20939
|
}
|
|
21703
20940
|
});
|
|
21704
|
-
|
|
21705
20941
|
case 4:
|
|
21706
20942
|
case "end":
|
|
21707
20943
|
return _context.stop();
|
|
@@ -21709,27 +20945,24 @@
|
|
|
21709
20945
|
}
|
|
21710
20946
|
}, _callee);
|
|
21711
20947
|
}));
|
|
21712
|
-
|
|
21713
20948
|
return function preflight(_x) {
|
|
21714
20949
|
return _ref2.apply(this, arguments);
|
|
21715
20950
|
};
|
|
21716
20951
|
}();
|
|
21717
|
-
|
|
21718
20952
|
var Donation = /*#__PURE__*/function () {
|
|
21719
20953
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
21720
|
-
var amount, accept, event, sent,
|
|
20954
|
+
var amount, accept, event, sent, succeeded, validated, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, closable, integration, link, container, title, document, unmount;
|
|
21721
20955
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
21722
20956
|
while (1) {
|
|
21723
20957
|
switch (_context2.prev = _context2.next) {
|
|
21724
20958
|
case 0:
|
|
21725
|
-
amount = _ref3.amount, accept = _ref3.accept, event = _ref3.event, sent = _ref3.sent,
|
|
20959
|
+
amount = _ref3.amount, accept = _ref3.accept, event = _ref3.event, sent = _ref3.sent, succeeded = _ref3.succeeded, validated = _ref3.validated, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, whitelist = _ref3.whitelist, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, track = _ref3.track, fee = _ref3.fee, closable = _ref3.closable, integration = _ref3.integration, link = _ref3.link, container = _ref3.container, title = _ref3.title, document = _ref3.document;
|
|
21726
20960
|
requireReactVersion();
|
|
21727
20961
|
_context2.prev = 2;
|
|
21728
20962
|
_context2.next = 5;
|
|
21729
20963
|
return preflight$2({
|
|
21730
20964
|
accept: accept
|
|
21731
20965
|
});
|
|
21732
|
-
|
|
21733
20966
|
case 5:
|
|
21734
20967
|
unmount = mount({
|
|
21735
20968
|
style: style,
|
|
@@ -21752,7 +20985,7 @@
|
|
|
21752
20985
|
track: track,
|
|
21753
20986
|
fee: fee,
|
|
21754
20987
|
sent: sent,
|
|
21755
|
-
|
|
20988
|
+
succeeded: succeeded,
|
|
21756
20989
|
validated: validated,
|
|
21757
20990
|
failed: failed,
|
|
21758
20991
|
blacklist: blacklist,
|
|
@@ -21785,16 +21018,13 @@
|
|
|
21785
21018
|
return _context2.abrupt("return", {
|
|
21786
21019
|
unmount: unmount
|
|
21787
21020
|
});
|
|
21788
|
-
|
|
21789
21021
|
case 9:
|
|
21790
21022
|
_context2.prev = 9;
|
|
21791
21023
|
_context2.t0 = _context2["catch"](2);
|
|
21792
21024
|
console.log('critical error', _context2.t0);
|
|
21793
|
-
|
|
21794
21025
|
if (critical != undefined) {
|
|
21795
21026
|
critical(_context2.t0);
|
|
21796
21027
|
}
|
|
21797
|
-
|
|
21798
21028
|
case 13:
|
|
21799
21029
|
case "end":
|
|
21800
21030
|
return _context2.stop();
|
|
@@ -21802,7 +21032,6 @@
|
|
|
21802
21032
|
}
|
|
21803
21033
|
}, _callee2, null, [[2, 9]]);
|
|
21804
21034
|
}));
|
|
21805
|
-
|
|
21806
21035
|
return function Donation(_x2) {
|
|
21807
21036
|
return _ref4.apply(this, arguments);
|
|
21808
21037
|
};
|
|
@@ -21810,23 +21039,19 @@
|
|
|
21810
21039
|
|
|
21811
21040
|
var SignLoginDialog = (function (props) {
|
|
21812
21041
|
var _useContext = React.useContext(ErrorContext),
|
|
21813
|
-
|
|
21814
|
-
|
|
21042
|
+
setError = _useContext.setError;
|
|
21815
21043
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
|
|
21044
|
+
message = _useContext2.message,
|
|
21045
|
+
endpoint = _useContext2.endpoint;
|
|
21819
21046
|
var _useContext3 = React.useContext(ConfigurationContext),
|
|
21820
|
-
|
|
21821
|
-
|
|
21822
|
-
var wallet = web3Wallets.getWallet();
|
|
21047
|
+
recover = _useContext3.recover;
|
|
21048
|
+
var wallet = web3Wallets.getWallets()[0];
|
|
21823
21049
|
wallet !== null && wallet !== void 0 && wallet.name ? wallet.name : 'wallet';
|
|
21824
21050
|
var walletLogo = wallet !== null && wallet !== void 0 && wallet.logo ? wallet.logo : undefined;
|
|
21825
|
-
|
|
21826
21051
|
if (typeof recover != 'function') {
|
|
21827
21052
|
recover = function recover(_ref) {
|
|
21828
21053
|
var message = _ref.message,
|
|
21829
|
-
|
|
21054
|
+
signature = _ref.signature;
|
|
21830
21055
|
return new Promise(function (resolve, reject) {
|
|
21831
21056
|
fetch(endpoint, {
|
|
21832
21057
|
method: 'POST',
|
|
@@ -21851,7 +21076,6 @@
|
|
|
21851
21076
|
});
|
|
21852
21077
|
};
|
|
21853
21078
|
}
|
|
21854
|
-
|
|
21855
21079
|
var login = function login() {
|
|
21856
21080
|
wallet.sign(message).then(function (signature) {
|
|
21857
21081
|
recover({
|
|
@@ -21864,7 +21088,6 @@
|
|
|
21864
21088
|
}
|
|
21865
21089
|
});
|
|
21866
21090
|
};
|
|
21867
|
-
|
|
21868
21091
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
21869
21092
|
body: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21870
21093
|
className: "TextCenter"
|
|
@@ -21891,14 +21114,12 @@
|
|
|
21891
21114
|
|
|
21892
21115
|
var LoginStack = (function (props) {
|
|
21893
21116
|
var _useContext = React.useContext(ClosableContext),
|
|
21894
|
-
|
|
21895
|
-
|
|
21896
|
-
|
|
21117
|
+
open = _useContext.open,
|
|
21118
|
+
close = _useContext.close;
|
|
21897
21119
|
var _useState = React.useState(true),
|
|
21898
|
-
|
|
21899
|
-
|
|
21900
|
-
|
|
21901
|
-
|
|
21120
|
+
_useState2 = _slicedToArray(_useState, 2);
|
|
21121
|
+
_useState2[0];
|
|
21122
|
+
_useState2[1];
|
|
21902
21123
|
return /*#__PURE__*/React__default["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
21903
21124
|
open: open,
|
|
21904
21125
|
close: close,
|
|
@@ -21917,7 +21138,6 @@
|
|
|
21917
21138
|
var Login = function Login(options) {
|
|
21918
21139
|
requireReactVersion();
|
|
21919
21140
|
var style, error, document, message, endpoint, recover;
|
|
21920
|
-
|
|
21921
21141
|
if (_typeof(options) == 'object') {
|
|
21922
21142
|
style = options.style;
|
|
21923
21143
|
error = options.error;
|
|
@@ -21926,7 +21146,6 @@
|
|
|
21926
21146
|
endpoint = options.endpoint;
|
|
21927
21147
|
recover = options.recover;
|
|
21928
21148
|
}
|
|
21929
|
-
|
|
21930
21149
|
return new Promise( /*#__PURE__*/function () {
|
|
21931
21150
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_resolve, reject) {
|
|
21932
21151
|
return regenerator.wrap(function _callee$(_context) {
|
|
@@ -21942,7 +21161,6 @@
|
|
|
21942
21161
|
reject('USER_CLOSED_DIALOG');
|
|
21943
21162
|
unmount();
|
|
21944
21163
|
};
|
|
21945
|
-
|
|
21946
21164
|
return function (container) {
|
|
21947
21165
|
return /*#__PURE__*/React__default["default"].createElement(ErrorProvider, {
|
|
21948
21166
|
errorCallback: error,
|
|
@@ -21961,14 +21179,12 @@
|
|
|
21961
21179
|
container: container,
|
|
21962
21180
|
resolve: function resolve(account) {
|
|
21963
21181
|
unmount();
|
|
21964
|
-
|
|
21965
21182
|
_resolve(account);
|
|
21966
21183
|
}
|
|
21967
21184
|
}), /*#__PURE__*/React__default["default"].createElement(PoweredBy, null)))));
|
|
21968
21185
|
};
|
|
21969
21186
|
});
|
|
21970
21187
|
})["catch"](reject);
|
|
21971
|
-
|
|
21972
21188
|
case 1:
|
|
21973
21189
|
case "end":
|
|
21974
21190
|
return _context.stop();
|
|
@@ -21976,7 +21192,6 @@
|
|
|
21976
21192
|
}
|
|
21977
21193
|
}, _callee);
|
|
21978
21194
|
}));
|
|
21979
|
-
|
|
21980
21195
|
return function (_x, _x2) {
|
|
21981
21196
|
return _ref.apply(this, arguments);
|
|
21982
21197
|
};
|
|
@@ -21987,15 +21202,13 @@
|
|
|
21987
21202
|
|
|
21988
21203
|
var PaymentAmountRoutingProvider = (function (props) {
|
|
21989
21204
|
var _useContext = React.useContext(ChangableAmountContext),
|
|
21990
|
-
|
|
21991
|
-
|
|
21992
|
-
|
|
21993
|
-
|
|
21205
|
+
amountsMissing = _useContext.amountsMissing,
|
|
21206
|
+
acceptWithAmount = _useContext.acceptWithAmount,
|
|
21207
|
+
setMaxRoute = _useContext.setMaxRoute;
|
|
21994
21208
|
var _useState = React.useState(),
|
|
21995
|
-
|
|
21996
|
-
|
|
21997
|
-
|
|
21998
|
-
|
|
21209
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21210
|
+
accept = _useState2[0],
|
|
21211
|
+
setAccept = _useState2[1];
|
|
21999
21212
|
React.useEffect(function () {
|
|
22000
21213
|
if (amountsMissing) {
|
|
22001
21214
|
if (acceptWithAmount) {
|
|
@@ -22019,13 +21232,11 @@
|
|
|
22019
21232
|
|
|
22020
21233
|
var PaymentOverviewSkeleton = (function (props) {
|
|
22021
21234
|
var _useContext = React.useContext(ChangableAmountContext),
|
|
22022
|
-
|
|
22023
|
-
|
|
22024
|
-
|
|
21235
|
+
amountsMissing = _useContext.amountsMissing,
|
|
21236
|
+
fixedAmount = _useContext.fixedAmount;
|
|
22025
21237
|
var _useContext2 = React.useContext(PaymentRoutingContext),
|
|
22026
|
-
|
|
22027
|
-
|
|
22028
|
-
|
|
21238
|
+
slowRouting = _useContext2.slowRouting,
|
|
21239
|
+
selectedRoute = _useContext2.selectedRoute;
|
|
22029
21240
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
22030
21241
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
22031
21242
|
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
@@ -22059,29 +21270,23 @@
|
|
|
22059
21270
|
|
|
22060
21271
|
var PaymentOverviewDialog = (function (props) {
|
|
22061
21272
|
var _useContext = React.useContext(ConfigurationContext),
|
|
22062
|
-
|
|
22063
|
-
|
|
22064
|
-
|
|
21273
|
+
currencyCode = _useContext.currencyCode,
|
|
21274
|
+
recover = _useContext.recover;
|
|
22065
21275
|
var _useContext2 = React.useContext(PaymentContext),
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
21276
|
+
payment = _useContext2.payment,
|
|
21277
|
+
paymentState = _useContext2.paymentState;
|
|
22069
21278
|
var _useContext3 = React.useContext(ChangableAmountContext),
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22074
|
-
|
|
21279
|
+
amount = _useContext3.amount,
|
|
21280
|
+
amountsMissing = _useContext3.amountsMissing,
|
|
21281
|
+
fixedAmount = _useContext3.fixedAmount,
|
|
21282
|
+
fixedCurrency = _useContext3.fixedCurrency;
|
|
22075
21283
|
var _useContext4 = React.useContext(PaymentValueContext),
|
|
22076
|
-
|
|
22077
|
-
|
|
21284
|
+
paymentValue = _useContext4.paymentValue;
|
|
22078
21285
|
var _useContext5 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
22079
|
-
|
|
22080
|
-
|
|
21286
|
+
navigate = _useContext5.navigate;
|
|
22081
21287
|
if (payment == undefined || recover == undefined && paymentValue == undefined) {
|
|
22082
21288
|
return /*#__PURE__*/React__default["default"].createElement(PaymentOverviewSkeleton, null);
|
|
22083
21289
|
}
|
|
22084
|
-
|
|
22085
21290
|
var blockchain = web3Blockchains.Blockchain.findByName(payment.blockchain);
|
|
22086
21291
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
22087
21292
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -22098,7 +21303,6 @@
|
|
|
22098
21303
|
if (paymentState != 'initialized') {
|
|
22099
21304
|
return;
|
|
22100
21305
|
}
|
|
22101
|
-
|
|
22102
21306
|
navigate('ChangeAmount');
|
|
22103
21307
|
}
|
|
22104
21308
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -22123,7 +21327,6 @@
|
|
|
22123
21327
|
if (paymentState != 'initialized') {
|
|
22124
21328
|
return;
|
|
22125
21329
|
}
|
|
22126
|
-
|
|
22127
21330
|
navigate('ChangePayment');
|
|
22128
21331
|
}
|
|
22129
21332
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -22162,19 +21365,15 @@
|
|
|
22162
21365
|
|
|
22163
21366
|
var TrackingFailedDialog = (function () {
|
|
22164
21367
|
var _useContext = React.useContext(PaymentTrackingContext),
|
|
22165
|
-
|
|
22166
|
-
|
|
21368
|
+
continueTryTracking = _useContext.continueTryTracking;
|
|
22167
21369
|
var _useContext2 = React.useContext(PaymentContext),
|
|
22168
|
-
|
|
22169
|
-
|
|
21370
|
+
transaction = _useContext2.transaction;
|
|
22170
21371
|
var _useContext3 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
22171
|
-
|
|
22172
|
-
|
|
21372
|
+
navigate = _useContext3.navigate;
|
|
22173
21373
|
var tryAgain = function tryAgain() {
|
|
22174
21374
|
continueTryTracking();
|
|
22175
21375
|
navigate('back');
|
|
22176
21376
|
};
|
|
22177
|
-
|
|
22178
21377
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
22179
21378
|
stacked: false,
|
|
22180
21379
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -22210,12 +21409,10 @@
|
|
|
22210
21409
|
|
|
22211
21410
|
var PaymentStack = (function (props) {
|
|
22212
21411
|
var _useContext = React.useContext(ClosableContext),
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
21412
|
+
open = _useContext.open,
|
|
21413
|
+
close = _useContext.close;
|
|
22216
21414
|
var _useContext2 = React.useContext(NavigateContext),
|
|
22217
|
-
|
|
22218
|
-
|
|
21415
|
+
setNavigator = _useContext2.setNavigator;
|
|
22219
21416
|
return /*#__PURE__*/React__default["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
22220
21417
|
setNavigator: setNavigator,
|
|
22221
21418
|
open: open,
|
|
@@ -22227,7 +21424,7 @@
|
|
|
22227
21424
|
PaymentOverview: /*#__PURE__*/React__default["default"].createElement(PaymentOverviewDialog, null),
|
|
22228
21425
|
ChangeAmount: /*#__PURE__*/React__default["default"].createElement(ChangeAmountDialog, null),
|
|
22229
21426
|
ChangePayment: /*#__PURE__*/React__default["default"].createElement(ChangePaymentDialog, null),
|
|
22230
|
-
|
|
21427
|
+
PaymentFailed: /*#__PURE__*/React__default["default"].createElement(PaymentFailedDialog, null),
|
|
22231
21428
|
WrongNetwork: /*#__PURE__*/React__default["default"].createElement(WrongNetworkDialog, null),
|
|
22232
21429
|
TrackingFailed: /*#__PURE__*/React__default["default"].createElement(TrackingFailedDialog, null)
|
|
22233
21430
|
}
|
|
@@ -22242,37 +21439,29 @@
|
|
|
22242
21439
|
switch (_context.prev = _context.next) {
|
|
22243
21440
|
case 0:
|
|
22244
21441
|
accept = _ref.accept, recover = _ref.recover;
|
|
22245
|
-
|
|
22246
21442
|
if (!recover) {
|
|
22247
21443
|
_context.next = 3;
|
|
22248
21444
|
break;
|
|
22249
21445
|
}
|
|
22250
|
-
|
|
22251
21446
|
return _context.abrupt("return");
|
|
22252
|
-
|
|
22253
21447
|
case 3:
|
|
22254
21448
|
accept.forEach(function (configuration) {
|
|
22255
21449
|
if (typeof configuration.blockchain === 'undefined') {
|
|
22256
21450
|
throw 'You need to set the blockchain your want to receive the payment on!';
|
|
22257
21451
|
}
|
|
22258
|
-
|
|
22259
21452
|
if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
|
|
22260
21453
|
throw 'You need to set a supported blockchain!';
|
|
22261
21454
|
}
|
|
22262
|
-
|
|
22263
21455
|
if (typeof configuration.token === 'undefined' && typeof configuration.fromToken === 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
|
|
22264
21456
|
throw 'You need to set the token you want to receive as payment!';
|
|
22265
21457
|
}
|
|
22266
|
-
|
|
22267
21458
|
if (typeof configuration.token === 'undefined' && typeof configuration.fromToken !== 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
|
|
22268
21459
|
throw 'You need to set the fromToken, fromAmount and toToken!';
|
|
22269
21460
|
}
|
|
22270
|
-
|
|
22271
21461
|
if (typeof configuration.receiver === 'undefined') {
|
|
22272
21462
|
throw 'You need to set the receiver address that you want to receive the payment!';
|
|
22273
21463
|
}
|
|
22274
21464
|
});
|
|
22275
|
-
|
|
22276
21465
|
case 4:
|
|
22277
21466
|
case "end":
|
|
22278
21467
|
return _context.stop();
|
|
@@ -22280,20 +21469,18 @@
|
|
|
22280
21469
|
}
|
|
22281
21470
|
}, _callee);
|
|
22282
21471
|
}));
|
|
22283
|
-
|
|
22284
21472
|
return function preflight(_x) {
|
|
22285
21473
|
return _ref2.apply(this, arguments);
|
|
22286
21474
|
};
|
|
22287
21475
|
}();
|
|
22288
|
-
|
|
22289
21476
|
var Payment = /*#__PURE__*/function () {
|
|
22290
21477
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
22291
|
-
var accept, amount, event, sent,
|
|
21478
|
+
var accept, amount, event, sent, succeeded, validated, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, recover, closable, integration, link, container, before, document, unmount;
|
|
22292
21479
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
22293
21480
|
while (1) {
|
|
22294
21481
|
switch (_context2.prev = _context2.next) {
|
|
22295
21482
|
case 0:
|
|
22296
|
-
accept = _ref3.accept, amount = _ref3.amount, event = _ref3.event, sent = _ref3.sent,
|
|
21483
|
+
accept = _ref3.accept, amount = _ref3.amount, event = _ref3.event, sent = _ref3.sent, succeeded = _ref3.succeeded, validated = _ref3.validated, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, whitelist = _ref3.whitelist, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, track = _ref3.track, fee = _ref3.fee, recover = _ref3.recover, closable = _ref3.closable, integration = _ref3.integration, link = _ref3.link, container = _ref3.container, before = _ref3.before, document = _ref3.document;
|
|
22297
21484
|
requireReactVersion();
|
|
22298
21485
|
_context2.prev = 2;
|
|
22299
21486
|
_context2.next = 5;
|
|
@@ -22301,7 +21488,6 @@
|
|
|
22301
21488
|
accept: accept,
|
|
22302
21489
|
recover: recover
|
|
22303
21490
|
});
|
|
22304
|
-
|
|
22305
21491
|
case 5:
|
|
22306
21492
|
unmount = mount({
|
|
22307
21493
|
style: style,
|
|
@@ -22323,7 +21509,7 @@
|
|
|
22323
21509
|
currency: currency,
|
|
22324
21510
|
event: event,
|
|
22325
21511
|
sent: sent,
|
|
22326
|
-
|
|
21512
|
+
succeeded: succeeded,
|
|
22327
21513
|
validated: validated,
|
|
22328
21514
|
failed: failed,
|
|
22329
21515
|
whitelist: whitelist,
|
|
@@ -22365,16 +21551,13 @@
|
|
|
22365
21551
|
return _context2.abrupt("return", {
|
|
22366
21552
|
unmount: unmount
|
|
22367
21553
|
});
|
|
22368
|
-
|
|
22369
21554
|
case 9:
|
|
22370
21555
|
_context2.prev = 9;
|
|
22371
21556
|
_context2.t0 = _context2["catch"](2);
|
|
22372
21557
|
console.log('critical error', _context2.t0);
|
|
22373
|
-
|
|
22374
21558
|
if (critical != undefined) {
|
|
22375
21559
|
critical(_context2.t0);
|
|
22376
21560
|
}
|
|
22377
|
-
|
|
22378
21561
|
case 13:
|
|
22379
21562
|
case "end":
|
|
22380
21563
|
return _context2.stop();
|
|
@@ -22382,19 +21565,17 @@
|
|
|
22382
21565
|
}
|
|
22383
21566
|
}, _callee2, null, [[2, 9]]);
|
|
22384
21567
|
}));
|
|
22385
|
-
|
|
22386
21568
|
return function Payment(_x2) {
|
|
22387
21569
|
return _ref4.apply(this, arguments);
|
|
22388
21570
|
};
|
|
22389
21571
|
}();
|
|
22390
|
-
|
|
22391
21572
|
Payment.preload = function (_ref5) {
|
|
22392
21573
|
var account = _ref5.account,
|
|
22393
|
-
|
|
22394
|
-
|
|
22395
|
-
|
|
22396
|
-
|
|
22397
|
-
|
|
21574
|
+
accept = _ref5.accept,
|
|
21575
|
+
whitelist = _ref5.whitelist,
|
|
21576
|
+
blacklist = _ref5.blacklist,
|
|
21577
|
+
event = _ref5.event,
|
|
21578
|
+
fee = _ref5.fee;
|
|
22398
21579
|
routePayments({
|
|
22399
21580
|
account: account,
|
|
22400
21581
|
accept: accept,
|
|
@@ -22411,25 +21592,21 @@
|
|
|
22411
21592
|
|
|
22412
21593
|
var ToTokenProvider = (function (props) {
|
|
22413
21594
|
var _useContext = React.useContext(PaymentContext),
|
|
22414
|
-
|
|
22415
|
-
|
|
21595
|
+
payment = _useContext.payment;
|
|
22416
21596
|
var _useState = React.useState(),
|
|
22417
|
-
|
|
22418
|
-
|
|
22419
|
-
|
|
22420
|
-
|
|
21597
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21598
|
+
toToken = _useState2[0],
|
|
21599
|
+
setToToken = _useState2[1];
|
|
22421
21600
|
var _useState3 = React.useState(),
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
21601
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
21602
|
+
toTokenReadableAmount = _useState4[0],
|
|
21603
|
+
setToTokenReadableAmount = _useState4[1];
|
|
22426
21604
|
React.useEffect(function () {
|
|
22427
21605
|
if (payment) {
|
|
22428
21606
|
Promise.all([payment.route.toToken.symbol(), payment.route.toToken.readable(payment.route.toAmount)]).then(function (_ref) {
|
|
22429
21607
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
21608
|
+
symbol = _ref2[0],
|
|
21609
|
+
readableAmount = _ref2[1];
|
|
22433
21610
|
setToToken({
|
|
22434
21611
|
address: payment.route.toToken.address,
|
|
22435
21612
|
symbol: symbol
|
|
@@ -22448,29 +21625,23 @@
|
|
|
22448
21625
|
|
|
22449
21626
|
var SaleRoutingProvider = (function (props) {
|
|
22450
21627
|
var _useContext = React.useContext(ChangableAmountContext),
|
|
22451
|
-
|
|
22452
|
-
|
|
22453
|
-
|
|
21628
|
+
acceptWithAmount = _useContext.acceptWithAmount,
|
|
21629
|
+
setMaxRoute = _useContext.setMaxRoute;
|
|
22454
21630
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
22455
|
-
|
|
22456
|
-
|
|
21631
|
+
sell = _useContext2.sell;
|
|
22457
21632
|
var _useContext3 = React.useContext(ConfigurationContext),
|
|
22458
|
-
|
|
22459
|
-
|
|
21633
|
+
blacklist = _useContext3.blacklist;
|
|
22460
21634
|
if (blacklist == undefined) {
|
|
22461
21635
|
blacklist = {};
|
|
22462
21636
|
}
|
|
22463
|
-
|
|
22464
21637
|
for (var blockchain in sell) {
|
|
22465
21638
|
var token = sell[blockchain];
|
|
22466
|
-
|
|
22467
21639
|
if (blacklist[blockchain] instanceof Array) {
|
|
22468
21640
|
blacklist[blockchain].push(token);
|
|
22469
21641
|
} else {
|
|
22470
21642
|
blacklist[blockchain] = [token];
|
|
22471
21643
|
}
|
|
22472
21644
|
}
|
|
22473
|
-
|
|
22474
21645
|
return /*#__PURE__*/React__default["default"].createElement(SaleRoutingContext.Provider, {
|
|
22475
21646
|
value: {}
|
|
22476
21647
|
}, /*#__PURE__*/React__default["default"].createElement(PaymentRoutingProvider, {
|
|
@@ -22518,31 +21689,24 @@
|
|
|
22518
21689
|
|
|
22519
21690
|
var SaleOverviewDialog = (function (props) {
|
|
22520
21691
|
var _useContext = React.useContext(ChangableAmountContext);
|
|
22521
|
-
|
|
22522
|
-
|
|
21692
|
+
_useContext.amount;
|
|
22523
21693
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
22524
|
-
|
|
22525
|
-
|
|
22526
|
-
|
|
21694
|
+
tokenImage = _useContext2.tokenImage,
|
|
21695
|
+
amountConfiguration = _useContext2.amount;
|
|
22527
21696
|
var _useContext3 = React.useContext(PaymentValueContext),
|
|
22528
|
-
|
|
22529
|
-
|
|
21697
|
+
paymentValue = _useContext3.paymentValue;
|
|
22530
21698
|
var _useContext4 = React.useContext(PaymentContext),
|
|
22531
|
-
|
|
22532
|
-
|
|
22533
|
-
|
|
21699
|
+
payment = _useContext4.payment,
|
|
21700
|
+
paymentState = _useContext4.paymentState;
|
|
22534
21701
|
var _useContext5 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
22535
|
-
|
|
22536
|
-
|
|
21702
|
+
navigate = _useContext5.navigate;
|
|
22537
21703
|
var _useContext6 = React.useContext(ToTokenContext),
|
|
22538
|
-
|
|
22539
|
-
|
|
22540
|
-
|
|
21704
|
+
toToken = _useContext6.toToken,
|
|
21705
|
+
toTokenReadableAmount = _useContext6.toTokenReadableAmount;
|
|
22541
21706
|
var _useState = React.useState(),
|
|
22542
|
-
|
|
22543
|
-
|
|
22544
|
-
|
|
22545
|
-
|
|
21707
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21708
|
+
salePerTokenValue = _useState2[0],
|
|
21709
|
+
setSalePerTokenValue = _useState2[1];
|
|
22546
21710
|
React.useEffect(function () {
|
|
22547
21711
|
if (paymentValue && (amountConfiguration == undefined || amountConfiguration.token != true) && toTokenReadableAmount) {
|
|
22548
21712
|
var UsdAmountPerToken = paymentValue.amount / parseFloat(toTokenReadableAmount);
|
|
@@ -22554,19 +21718,15 @@
|
|
|
22554
21718
|
amount: 0,
|
|
22555
21719
|
code: paymentValue.code
|
|
22556
21720
|
}).toString();
|
|
22557
|
-
|
|
22558
21721
|
if (readableLocalizedAmountPerToken != zero) {
|
|
22559
21722
|
setSalePerTokenValue(readableLocalizedAmountPerToken);
|
|
22560
21723
|
}
|
|
22561
21724
|
}
|
|
22562
21725
|
}, [paymentValue, toTokenReadableAmount]);
|
|
22563
|
-
|
|
22564
21726
|
if (toToken == undefined || toTokenReadableAmount == undefined || payment == undefined || paymentValue == undefined) {
|
|
22565
21727
|
return /*#__PURE__*/React__default["default"].createElement(SaleOverviewSkeleton, null);
|
|
22566
21728
|
}
|
|
22567
|
-
|
|
22568
21729
|
var tokenImageElement;
|
|
22569
|
-
|
|
22570
21730
|
if (tokenImage) {
|
|
22571
21731
|
tokenImageElement = /*#__PURE__*/React__default["default"].createElement("img", {
|
|
22572
21732
|
src: tokenImage
|
|
@@ -22577,7 +21737,6 @@
|
|
|
22577
21737
|
address: toToken.address
|
|
22578
21738
|
});
|
|
22579
21739
|
}
|
|
22580
|
-
|
|
22581
21740
|
var blockchain = web3Blockchains.Blockchain.findByName(payment.blockchain);
|
|
22582
21741
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
22583
21742
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -22594,7 +21753,6 @@
|
|
|
22594
21753
|
if (paymentState != 'initialized') {
|
|
22595
21754
|
return;
|
|
22596
21755
|
}
|
|
22597
|
-
|
|
22598
21756
|
navigate('ChangeAmount');
|
|
22599
21757
|
}
|
|
22600
21758
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -22630,7 +21788,6 @@
|
|
|
22630
21788
|
if (paymentState != 'initialized') {
|
|
22631
21789
|
return;
|
|
22632
21790
|
}
|
|
22633
|
-
|
|
22634
21791
|
navigate('ChangePayment');
|
|
22635
21792
|
}
|
|
22636
21793
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -22664,12 +21821,10 @@
|
|
|
22664
21821
|
|
|
22665
21822
|
var SaleStack = (function (props) {
|
|
22666
21823
|
var _useContext = React.useContext(ClosableContext),
|
|
22667
|
-
|
|
22668
|
-
|
|
22669
|
-
|
|
21824
|
+
open = _useContext.open,
|
|
21825
|
+
close = _useContext.close;
|
|
22670
21826
|
var _useContext2 = React.useContext(NavigateContext),
|
|
22671
|
-
|
|
22672
|
-
|
|
21827
|
+
setNavigator = _useContext2.setNavigator;
|
|
22673
21828
|
return /*#__PURE__*/React__default["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
22674
21829
|
setNavigator: setNavigator,
|
|
22675
21830
|
open: open,
|
|
@@ -22682,7 +21837,7 @@
|
|
|
22682
21837
|
ChangeAmount: /*#__PURE__*/React__default["default"].createElement(ChangeAmountDialog, null),
|
|
22683
21838
|
ChangePayment: /*#__PURE__*/React__default["default"].createElement(ChangePaymentDialog, null),
|
|
22684
21839
|
NoPaymentMethodFound: /*#__PURE__*/React__default["default"].createElement(NoPaymentMethodFoundDialog, null),
|
|
22685
|
-
|
|
21840
|
+
PaymentFailed: /*#__PURE__*/React__default["default"].createElement(PaymentFailedDialog, null),
|
|
22686
21841
|
WrongNetwork: /*#__PURE__*/React__default["default"].createElement(WrongNetworkDialog, null)
|
|
22687
21842
|
}
|
|
22688
21843
|
});
|
|
@@ -22696,30 +21851,23 @@
|
|
|
22696
21851
|
switch (_context.prev = _context.next) {
|
|
22697
21852
|
case 0:
|
|
22698
21853
|
sell = _ref.sell;
|
|
22699
|
-
|
|
22700
21854
|
if (!(_typeof(sell) != 'object')) {
|
|
22701
21855
|
_context.next = 3;
|
|
22702
21856
|
break;
|
|
22703
21857
|
}
|
|
22704
|
-
|
|
22705
21858
|
throw 'You need to configure at least 1 "blockchain": "token"';
|
|
22706
|
-
|
|
22707
21859
|
case 3:
|
|
22708
21860
|
if (!(Object.keys(sell).length == 0)) {
|
|
22709
21861
|
_context.next = 5;
|
|
22710
21862
|
break;
|
|
22711
21863
|
}
|
|
22712
|
-
|
|
22713
21864
|
throw 'You need to configure at least 1 "blockchain": "token"';
|
|
22714
|
-
|
|
22715
21865
|
case 5:
|
|
22716
21866
|
if (!(Object.values(sell).length == 0)) {
|
|
22717
21867
|
_context.next = 7;
|
|
22718
21868
|
break;
|
|
22719
21869
|
}
|
|
22720
|
-
|
|
22721
21870
|
throw 'You need to configure at least 1 "blockchain": "token"';
|
|
22722
|
-
|
|
22723
21871
|
case 7:
|
|
22724
21872
|
case "end":
|
|
22725
21873
|
return _context.stop();
|
|
@@ -22727,27 +21875,24 @@
|
|
|
22727
21875
|
}
|
|
22728
21876
|
}, _callee);
|
|
22729
21877
|
}));
|
|
22730
|
-
|
|
22731
21878
|
return function preflight(_x) {
|
|
22732
21879
|
return _ref2.apply(this, arguments);
|
|
22733
21880
|
};
|
|
22734
21881
|
}();
|
|
22735
|
-
|
|
22736
21882
|
var Sale = /*#__PURE__*/function () {
|
|
22737
21883
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
22738
|
-
var amount, sell, sent,
|
|
21884
|
+
var amount, sell, sent, succeeded, failed, error, critical, style, blacklist, providers, currency, connected, closed, tokenImage, closable, integration, document, accept, unmount;
|
|
22739
21885
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
22740
21886
|
while (1) {
|
|
22741
21887
|
switch (_context2.prev = _context2.next) {
|
|
22742
21888
|
case 0:
|
|
22743
|
-
amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent,
|
|
21889
|
+
amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent, succeeded = _ref3.succeeded, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, tokenImage = _ref3.tokenImage, closable = _ref3.closable, integration = _ref3.integration, document = _ref3.document;
|
|
22744
21890
|
requireReactVersion();
|
|
22745
21891
|
_context2.prev = 2;
|
|
22746
21892
|
_context2.next = 5;
|
|
22747
21893
|
return preflight({
|
|
22748
21894
|
sell: sell
|
|
22749
21895
|
});
|
|
22750
|
-
|
|
22751
21896
|
case 5:
|
|
22752
21897
|
accept = Object.keys(sell).map(function (key) {
|
|
22753
21898
|
return {
|
|
@@ -22773,7 +21918,7 @@
|
|
|
22773
21918
|
sell: sell,
|
|
22774
21919
|
currency: currency,
|
|
22775
21920
|
sent: sent,
|
|
22776
|
-
|
|
21921
|
+
succeeded: succeeded,
|
|
22777
21922
|
failed: failed,
|
|
22778
21923
|
blacklist: blacklist,
|
|
22779
21924
|
providers: providers,
|
|
@@ -22802,16 +21947,13 @@
|
|
|
22802
21947
|
return _context2.abrupt("return", {
|
|
22803
21948
|
unmount: unmount
|
|
22804
21949
|
});
|
|
22805
|
-
|
|
22806
21950
|
case 10:
|
|
22807
21951
|
_context2.prev = 10;
|
|
22808
21952
|
_context2.t0 = _context2["catch"](2);
|
|
22809
21953
|
console.log('critical error', _context2.t0);
|
|
22810
|
-
|
|
22811
21954
|
if (critical != undefined) {
|
|
22812
21955
|
critical(_context2.t0);
|
|
22813
21956
|
}
|
|
22814
|
-
|
|
22815
21957
|
case 14:
|
|
22816
21958
|
case "end":
|
|
22817
21959
|
return _context2.stop();
|
|
@@ -22819,7 +21961,6 @@
|
|
|
22819
21961
|
}
|
|
22820
21962
|
}, _callee2, null, [[2, 10]]);
|
|
22821
21963
|
}));
|
|
22822
|
-
|
|
22823
21964
|
return function Sale(_x2) {
|
|
22824
21965
|
return _ref4.apply(this, arguments);
|
|
22825
21966
|
};
|
|
@@ -22829,10 +21970,9 @@
|
|
|
22829
21970
|
|
|
22830
21971
|
var SelectionProvider = (function (props) {
|
|
22831
21972
|
var _useState = React.useState({}),
|
|
22832
|
-
|
|
22833
|
-
|
|
22834
|
-
|
|
22835
|
-
|
|
21973
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21974
|
+
selection = _useState2[0],
|
|
21975
|
+
setSelection = _useState2[1];
|
|
22836
21976
|
return /*#__PURE__*/React__default["default"].createElement(SelectionContext.Provider, {
|
|
22837
21977
|
value: {
|
|
22838
21978
|
selection: selection,
|
|
@@ -22866,25 +22006,20 @@
|
|
|
22866
22006
|
|
|
22867
22007
|
var ConfirmTokenSelectionDialog = (function (props) {
|
|
22868
22008
|
var _useContext = React.useContext(SelectionContext),
|
|
22869
|
-
|
|
22870
|
-
|
|
22009
|
+
selection = _useContext.selection;
|
|
22871
22010
|
var _useContext2 = React.useContext(ClosableContext),
|
|
22872
|
-
|
|
22873
|
-
|
|
22011
|
+
setOpen = _useContext2.setOpen;
|
|
22874
22012
|
var token = selection.token;
|
|
22875
22013
|
var address = token.address || token.external_id;
|
|
22876
22014
|
var logo = token.logo || token.image;
|
|
22877
22015
|
var blockchain = web3Blockchains.Blockchain.findByName(token.blockchain);
|
|
22878
22016
|
var age = token.first_transfer ? msToTime(new Date() - new Date(token.first_transfer)) : undefined;
|
|
22879
|
-
|
|
22880
22017
|
if (age) {
|
|
22881
22018
|
age = [age.year && age.year >= 1 ? age.year >= 2 ? "".concat(age.year, " years") : "1 year" : undefined, age.month && age.month >= 1 ? age.month >= 2 ? "".concat(age.month, " months") : "1 month" : undefined, age.day && age.day >= 1 && age.month <= 1 && age.year < 1 ? age.day >= 2 ? "".concat(age.day, " days !!!") : "1 day !!!" : undefined].filter(function (n) {
|
|
22882
22019
|
return n;
|
|
22883
22020
|
}).join(' ');
|
|
22884
22021
|
}
|
|
22885
|
-
|
|
22886
22022
|
var holders = token.unique_senders ? token.unique_senders : undefined;
|
|
22887
|
-
|
|
22888
22023
|
if (holders) {
|
|
22889
22024
|
if (holders > 1000000) {
|
|
22890
22025
|
holders = "Millions";
|
|
@@ -22898,7 +22033,6 @@
|
|
|
22898
22033
|
holders = "Only a Few!!!";
|
|
22899
22034
|
}
|
|
22900
22035
|
}
|
|
22901
|
-
|
|
22902
22036
|
var onClickConfirm = function onClickConfirm() {
|
|
22903
22037
|
setOpen(false);
|
|
22904
22038
|
props.resolve({
|
|
@@ -22911,7 +22045,6 @@
|
|
|
22911
22045
|
});
|
|
22912
22046
|
setTimeout(props.unmount, 300);
|
|
22913
22047
|
};
|
|
22914
|
-
|
|
22915
22048
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
22916
22049
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
22917
22050
|
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
@@ -22969,26 +22102,21 @@
|
|
|
22969
22102
|
|
|
22970
22103
|
var SelectBlockchainDialog = (function (props) {
|
|
22971
22104
|
var _useContext = React.useContext(SelectionContext),
|
|
22972
|
-
|
|
22973
|
-
|
|
22105
|
+
setSelection = _useContext.setSelection;
|
|
22974
22106
|
var _useContext2 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
22975
|
-
|
|
22976
|
-
|
|
22107
|
+
navigate = _useContext2.navigate;
|
|
22977
22108
|
var stacked = Object.keys(props.selection).length > 1;
|
|
22978
22109
|
var blockchains = [web3Blockchains.Blockchain.findByName('ethereum'), web3Blockchains.Blockchain.findByName('bsc'), web3Blockchains.Blockchain.findByName('polygon')];
|
|
22979
|
-
|
|
22980
22110
|
var selectBlockchain = function selectBlockchain(blockchain) {
|
|
22981
22111
|
setSelection(Object.assign(props.selection, {
|
|
22982
22112
|
blockchain: blockchain
|
|
22983
22113
|
}));
|
|
22984
|
-
|
|
22985
22114
|
if (stacked) {
|
|
22986
22115
|
navigate('back');
|
|
22987
22116
|
} else {
|
|
22988
22117
|
props.resolve(blockchain);
|
|
22989
22118
|
}
|
|
22990
22119
|
};
|
|
22991
|
-
|
|
22992
22120
|
var elements = blockchains.map(function (blockchain, index) {
|
|
22993
22121
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
22994
22122
|
key: index,
|
|
@@ -23026,42 +22154,33 @@
|
|
|
23026
22154
|
|
|
23027
22155
|
var SelectTokenDialog = (function (props) {
|
|
23028
22156
|
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
23029
|
-
|
|
23030
|
-
|
|
22157
|
+
navigate = _useContext.navigate;
|
|
23031
22158
|
var _useContext2 = React.useContext(ClosableContext),
|
|
23032
|
-
|
|
23033
|
-
|
|
22159
|
+
setOpen = _useContext2.setOpen;
|
|
23034
22160
|
var _useContext3 = React.useContext(SelectionContext),
|
|
23035
|
-
|
|
23036
|
-
|
|
22161
|
+
setSelection = _useContext3.setSelection;
|
|
23037
22162
|
var _useState = React.useState(''),
|
|
23038
|
-
|
|
23039
|
-
|
|
23040
|
-
|
|
23041
|
-
|
|
22163
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22164
|
+
searchTerm = _useState2[0],
|
|
22165
|
+
setSearchTerm = _useState2[1];
|
|
23042
22166
|
var _useState3 = React.useState(),
|
|
23043
|
-
|
|
23044
|
-
|
|
23045
|
-
|
|
23046
|
-
|
|
22167
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
22168
|
+
blockchain = _useState4[0],
|
|
22169
|
+
setBlockchain = _useState4[1];
|
|
23047
22170
|
var _useState5 = React.useState(false),
|
|
23048
|
-
|
|
23049
|
-
|
|
23050
|
-
|
|
23051
|
-
|
|
22171
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
22172
|
+
showAddToken = _useState6[0],
|
|
22173
|
+
setShowAddToken = _useState6[1];
|
|
23052
22174
|
var _useState7 = React.useState([]),
|
|
23053
|
-
|
|
23054
|
-
|
|
23055
|
-
|
|
23056
|
-
|
|
22175
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
22176
|
+
tokens = _useState8[0],
|
|
22177
|
+
setTokens = _useState8[1];
|
|
23057
22178
|
var _useState9 = React.useState(),
|
|
23058
|
-
|
|
23059
|
-
|
|
23060
|
-
|
|
23061
|
-
|
|
22179
|
+
_useState10 = _slicedToArray(_useState9, 2);
|
|
22180
|
+
_useState10[0];
|
|
22181
|
+
_useState10[1];
|
|
23062
22182
|
var searchElement = React.useRef();
|
|
23063
|
-
var wallet = web3Wallets.
|
|
23064
|
-
|
|
22183
|
+
var wallet = web3Wallets.getWallets()[0];
|
|
23065
22184
|
var startWithBlockchain = function startWithBlockchain(name) {
|
|
23066
22185
|
var blockchain = web3Blockchains.Blockchain.findByName(name);
|
|
23067
22186
|
setBlockchain(blockchain);
|
|
@@ -23071,12 +22190,10 @@
|
|
|
23071
22190
|
}));
|
|
23072
22191
|
setTokens(blockchain.tokens);
|
|
23073
22192
|
};
|
|
23074
|
-
|
|
23075
22193
|
React.useEffect(function () {
|
|
23076
22194
|
if (wallet) {
|
|
23077
22195
|
wallet.connectedTo().then(function (name) {
|
|
23078
22196
|
var blockchain = web3Blockchains.Blockchain.findByName(name);
|
|
23079
|
-
|
|
23080
22197
|
if (name && name.length && blockchain && blockchain.tokens && blockchain.tokens.length) {
|
|
23081
22198
|
startWithBlockchain(name);
|
|
23082
22199
|
} else {
|
|
@@ -23091,27 +22208,22 @@
|
|
|
23091
22208
|
if (props.selection.blockchain) {
|
|
23092
22209
|
setBlockchain(props.selection.blockchain);
|
|
23093
22210
|
setTokens(props.selection.blockchain.tokens);
|
|
23094
|
-
|
|
23095
22211
|
if (searchElement.current) {
|
|
23096
22212
|
searchElement.current.value = '';
|
|
23097
22213
|
searchElement.current.focus();
|
|
23098
22214
|
}
|
|
23099
22215
|
}
|
|
23100
22216
|
}, [props.selection, props.selection.blockchain]);
|
|
23101
|
-
|
|
23102
22217
|
var onClickChangeBlockchain = function onClickChangeBlockchain() {
|
|
23103
22218
|
navigate('SelectBlockchain');
|
|
23104
22219
|
};
|
|
23105
|
-
|
|
23106
22220
|
var onClickAddToken = function onClickAddToken() {
|
|
23107
22221
|
setShowAddToken(true);
|
|
23108
|
-
|
|
23109
22222
|
if (searchElement.current) {
|
|
23110
22223
|
searchElement.current.value = '';
|
|
23111
22224
|
searchElement.current.focus();
|
|
23112
22225
|
}
|
|
23113
22226
|
};
|
|
23114
|
-
|
|
23115
22227
|
var searchTokens = React.useCallback(lodash.debounce(function (term, blockchainName) {
|
|
23116
22228
|
fetch("https://public.depay.com/tokens/search?blockchain=".concat(blockchainName, "&term=").concat(term)).then(function (response) {
|
|
23117
22229
|
if (response.status == 200) {
|
|
@@ -23127,32 +22239,26 @@
|
|
|
23127
22239
|
return reject;
|
|
23128
22240
|
});
|
|
23129
22241
|
}, 300), []);
|
|
23130
|
-
|
|
23131
22242
|
var onChangeSearch = function onChangeSearch(event) {
|
|
23132
22243
|
var term = event.target.value;
|
|
23133
22244
|
setSearchTerm(term);
|
|
23134
|
-
|
|
23135
22245
|
if (term.match(/^0x/)) {
|
|
23136
22246
|
setTokens([]);
|
|
23137
22247
|
var token;
|
|
23138
|
-
|
|
23139
22248
|
try {
|
|
23140
22249
|
token = new web3Tokens.Token({
|
|
23141
22250
|
blockchain: blockchain.name,
|
|
23142
22251
|
address: term
|
|
23143
22252
|
});
|
|
23144
22253
|
} catch (_unused) {}
|
|
23145
|
-
|
|
23146
22254
|
if (token == undefined) {
|
|
23147
22255
|
return;
|
|
23148
22256
|
}
|
|
23149
|
-
|
|
23150
22257
|
Promise.all([token.name(), token.symbol(), token.decimals()]).then(function (_ref) {
|
|
23151
22258
|
var _ref2 = _slicedToArray(_ref, 3),
|
|
23152
|
-
|
|
23153
|
-
|
|
23154
|
-
|
|
23155
|
-
|
|
22259
|
+
name = _ref2[0],
|
|
22260
|
+
symbol = _ref2[1],
|
|
22261
|
+
decimals = _ref2[2];
|
|
23156
22262
|
setTokens([{
|
|
23157
22263
|
name: name,
|
|
23158
22264
|
symbol: symbol,
|
|
@@ -23168,7 +22274,6 @@
|
|
|
23168
22274
|
setTokens(blockchain.tokens);
|
|
23169
22275
|
}
|
|
23170
22276
|
};
|
|
23171
|
-
|
|
23172
22277
|
var select = function select(token) {
|
|
23173
22278
|
if (blockchain.tokens.find(function (majorToken) {
|
|
23174
22279
|
return majorToken.address.toLowerCase() == (token.address || token.external_id).toLowerCase();
|
|
@@ -23190,7 +22295,6 @@
|
|
|
23190
22295
|
navigate('ConfirmTokenSelection');
|
|
23191
22296
|
}
|
|
23192
22297
|
};
|
|
23193
|
-
|
|
23194
22298
|
var elements = tokens.map(function (token, index) {
|
|
23195
22299
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
23196
22300
|
key: "".concat(index, "-").concat(token.address),
|
|
@@ -23221,11 +22325,9 @@
|
|
|
23221
22325
|
className: "CardText"
|
|
23222
22326
|
}, token.name))));
|
|
23223
22327
|
});
|
|
23224
|
-
|
|
23225
22328
|
if (blockchain == undefined) {
|
|
23226
22329
|
return null;
|
|
23227
22330
|
}
|
|
23228
|
-
|
|
23229
22331
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
23230
22332
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
23231
22333
|
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
@@ -23278,22 +22380,17 @@
|
|
|
23278
22380
|
|
|
23279
22381
|
var SelectStack = (function (props) {
|
|
23280
22382
|
var _useContext = React.useContext(ConfigurationContext),
|
|
23281
|
-
|
|
23282
|
-
|
|
22383
|
+
what = _useContext.what;
|
|
23283
22384
|
var _useContext2 = React.useContext(ClosableContext),
|
|
23284
|
-
|
|
23285
|
-
|
|
23286
|
-
|
|
22385
|
+
open = _useContext2.open,
|
|
22386
|
+
close = _useContext2.close;
|
|
23287
22387
|
var _useContext3 = React.useContext(SelectionContext),
|
|
23288
|
-
|
|
23289
|
-
|
|
22388
|
+
selection = _useContext3.selection;
|
|
23290
22389
|
var start;
|
|
23291
|
-
|
|
23292
22390
|
switch (what) {
|
|
23293
22391
|
default:
|
|
23294
22392
|
start = 'SelectToken';
|
|
23295
22393
|
}
|
|
23296
|
-
|
|
23297
22394
|
return /*#__PURE__*/React__default["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
23298
22395
|
open: open,
|
|
23299
22396
|
close: close,
|
|
@@ -23322,22 +22419,18 @@
|
|
|
23322
22419
|
var Select = function Select(options) {
|
|
23323
22420
|
requireReactVersion();
|
|
23324
22421
|
var style, error, document, what;
|
|
23325
|
-
|
|
23326
22422
|
if (_typeof(options) == 'object') {
|
|
23327
22423
|
style = options.style;
|
|
23328
22424
|
error = options.error;
|
|
23329
22425
|
document = options.document;
|
|
23330
22426
|
what = options.what;
|
|
23331
22427
|
}
|
|
23332
|
-
|
|
23333
22428
|
var startupError;
|
|
23334
|
-
|
|
23335
22429
|
if (what == undefined) {
|
|
23336
22430
|
startupError = '"what" needs to be configured!';
|
|
23337
22431
|
} else if (['token'].indexOf(what) < 0) {
|
|
23338
22432
|
startupError = "Unknown \"what\" configured: ".concat(what, "!");
|
|
23339
22433
|
}
|
|
23340
|
-
|
|
23341
22434
|
return new Promise( /*#__PURE__*/function () {
|
|
23342
22435
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
|
|
23343
22436
|
return regenerator.wrap(function _callee$(_context) {
|
|
@@ -23352,7 +22445,6 @@
|
|
|
23352
22445
|
reject('USER_CLOSED_DIALOG');
|
|
23353
22446
|
unmount();
|
|
23354
22447
|
};
|
|
23355
|
-
|
|
23356
22448
|
return function (container) {
|
|
23357
22449
|
return /*#__PURE__*/React__default["default"].createElement(ErrorProvider, {
|
|
23358
22450
|
error: startupError,
|
|
@@ -23373,7 +22465,6 @@
|
|
|
23373
22465
|
})), /*#__PURE__*/React__default["default"].createElement(PoweredBy, null)))));
|
|
23374
22466
|
};
|
|
23375
22467
|
});
|
|
23376
|
-
|
|
23377
22468
|
case 1:
|
|
23378
22469
|
case "end":
|
|
23379
22470
|
return _context.stop();
|
|
@@ -23381,7 +22472,6 @@
|
|
|
23381
22472
|
}
|
|
23382
22473
|
}, _callee);
|
|
23383
22474
|
}));
|
|
23384
|
-
|
|
23385
22475
|
return function (_x, _x2) {
|
|
23386
22476
|
return _ref.apply(this, arguments);
|
|
23387
22477
|
};
|
|
@@ -23394,8 +22484,7 @@
|
|
|
23394
22484
|
Login: Login,
|
|
23395
22485
|
Payment: Payment,
|
|
23396
22486
|
Sale: Sale,
|
|
23397
|
-
Select: Select
|
|
23398
|
-
provider: web3Client.provider
|
|
22487
|
+
Select: Select
|
|
23399
22488
|
};
|
|
23400
22489
|
|
|
23401
22490
|
return DePayWidgets;
|