@alphapoint/apex-web 5.5.6 → 5.8.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/lib/apex.integration.test.js +435 -0
- package/lib/apex.js +37 -1
- package/lib/apex.test.js +138 -0
- package/lib/components/2FA/PasskeyOption.js +126 -0
- package/lib/components/2FA/TwoFactorAuthComponent.js +24 -5
- package/lib/components/2FA/TwoFactorAuthComponent.test.js +94 -0
- package/lib/components/2FA/TwoFactorAuthContainer.js +139 -27
- package/lib/components/2FA/TwoFactorAuthContainer.test.js +627 -0
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.css +6 -0
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.js +6 -2
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.test.js +43 -0
- package/lib/components/AccountsDropdown/AccountsDropdownContainer.js +3 -1
- package/lib/components/BalancesList/BalancesListContainer.js +4 -1
- package/lib/components/ConfirmBlockTradeModal/ConfirmBlockTradeModalContainer.js +34 -6
- package/lib/components/ConfirmBlockTradeModal/ConfirmBlockTradeModalContainer.test.js +298 -0
- package/lib/components/ConfirmOrderModal/ConfirmOrderModalComponent.js +26 -4
- package/lib/components/ConfirmOrderModal/ConfirmOrderModalContainer.js +4 -1
- package/lib/components/DigitalAssets/digitalAssetsPriceLabel.test.js +238 -0
- package/lib/components/EnableTwoFactorAuth/Disable2FAForm.js +22 -7
- package/lib/components/EnableTwoFactorAuth/Disable2FAModal.js +15 -5
- package/lib/components/EnableTwoFactorAuth/Disable2FAModal.test.js +460 -0
- package/lib/components/EnableTwoFactorAuth/Disable2FAModalContainer.js +108 -16
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +7 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +105 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.js +15 -3
- package/lib/components/FusionAuth/UnlinkOAuthIdentityModal.css +13 -0
- package/lib/components/FusionAuth/UnlinkOAuthIdentityModal.js +246 -0
- package/lib/components/FusionAuth/UnlinkOAuthIdentityModal.test.js +521 -0
- package/lib/components/InstrumentPositions/InstrumentPositionsContainer.js +4 -1
- package/lib/components/Login/LoginFormComponent.js +1 -1
- package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.js +2 -1
- package/lib/components/NoAccountBanner/NoAccountBanner.css +9 -0
- package/lib/components/NoAccountBanner/NoAccountBanner.js +58 -0
- package/lib/components/NoAccountBanner/index.js +16 -0
- package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.css +31 -0
- package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.js +33 -0
- package/lib/components/NoAccountPlaceholder/index.js +9 -0
- package/lib/components/OrderEntryComponents/advancedForm/AdvancedOrderFormContainer.js +2 -0
- package/lib/components/OrderEntryComponents/common/FormAmountFields.js +5 -0
- package/lib/components/OrderEntryComponents/common/TwapScheduleFields.js +98 -0
- package/lib/components/OrderEntryComponents/defaultForm/OrderEntryAnchoring.js +86 -39
- package/lib/components/OrderEntryComponents/defaultForm/OrderEntryAnchoring.test.js +326 -0
- package/lib/components/OrderEntryComponents/defaultForm/OrderEntryContainer.js +10 -2
- package/lib/components/OrderHistoryComponents/DepositsStatus/DepositsStatusComponent.js +1 -1
- package/lib/components/OrderHistoryComponents/DepositsStatus/DepositsStatusComponent.test.js +99 -0
- package/lib/components/OrderHistoryComponents/InactiveOrders/InactiveOrdersComponent.js +1 -1
- package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.js +1 -1
- package/lib/components/OrderHistoryComponents/WithdrawStatus/WithdrawStatusComponent.js +1 -1
- package/lib/components/OrderHistoryComponents/WithdrawStatus/WithdrawStatusComponent.test.js +113 -0
- package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/PasskeysSettingsCard.css +108 -0
- package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/PasskeysSettingsCard.test.js +983 -0
- package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/PasskeysSettingsCardComponent.js +500 -0
- package/lib/components/Settings/ProfileAndSecurity/PasskeysSettingsCard/index.js +9 -0
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.css +4 -0
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.js +29 -17
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.test.js +135 -0
- package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +12 -4
- package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +268 -0
- package/lib/components/TwoFactorAuthForm/TwoFactorAuthForm.test.js +475 -0
- package/lib/components/TwoFactorAuthForm/TwoFactorAuthFormComponent.js +26 -5
- package/lib/components/TwoFactorAuthForm/TwoFactorAuthFormContainer.js +50 -32
- package/lib/components/common/APAutoTabInput/APAutoTabInput.js +5 -2
- package/lib/components/common/APSelect/APSelect.js +3 -1
- package/lib/components/common/ErrorBoundary/ErrorBoundary.css +35 -0
- package/lib/components/common/ErrorBoundary/ErrorBoundary.js +87 -0
- package/lib/config/CONFIG.md +4 -0
- package/lib/config/configDefault.json +2 -1
- package/lib/constants/sendOrder/orderEntryFormConstants.js +23 -4
- package/lib/constants/sendOrder/timeInForceConstants.js +3 -1
- package/lib/constants/sendOrder/twapRejectReasons.js +26 -0
- package/lib/helpers/errorTextFormatter.js +13 -4
- package/lib/helpers/errorTextFormatter.test.js +26 -0
- package/lib/helpers/orderHistoryHelper.js +13 -1
- package/lib/helpers/orderHistoryHelper.test.js +58 -13
- package/lib/helpers/passkeyApi.js +228 -0
- package/lib/helpers/passkeyApi.test.js +171 -0
- package/lib/helpers/placeOrderHelper.js +76 -61
- package/lib/helpers/placeOrderHelper.test.js +169 -10
- package/lib/helpers/recalculateOrderHelper.js +4 -1
- package/lib/helpers/recalculateOrderHelper.test.js +88 -2
- package/lib/helpers/twapOrderHelper.js +265 -0
- package/lib/helpers/twapOrderHelper.test.js +467 -0
- package/lib/helpers/twoFactorAuthCancellation.js +38 -0
- package/lib/helpers/webauthnHelper.js +300 -0
- package/lib/helpers/webauthnHelper.test.js +199 -0
- package/lib/hocs/forAccount.js +33 -0
- package/lib/hocs/forAccount.test.js +50 -0
- package/lib/hocs/forVerified.js +16 -2
- package/lib/hocs/withAuthentication.js +3 -1
- package/lib/hocs/withOneSubmission.js +168 -0
- package/lib/index.js +3 -2
- package/lib/layouts/HeaderLayout/HeaderLayout.js +2 -1
- package/lib/layouts/WalletsLayout/WalletsLayoutContainer.js +3 -1
- package/lib/layouts/WalletsLayout/WalletsLayoutContainer.test.js +84 -0
- package/lib/redux/actions/apiActions.js +77 -9
- package/lib/redux/actions/apiActions.test.js +233 -0
- package/lib/redux/actions/authActions.js +514 -198
- package/lib/redux/actions/authActions.test.js +627 -47
- package/lib/redux/actions/depositActions.js +1 -1
- package/lib/redux/actions/depositActions.test.js +100 -30
- package/lib/redux/actions/fusionAuthActions.test.js +265 -84
- package/lib/redux/actions/interestAccountActions.js +12 -3
- package/lib/redux/actions/interestAccountActions.test.js +73 -0
- package/lib/redux/actions/modalActions.js +1 -0
- package/lib/redux/actions/orderEntryActions.blockTrade.test.js +306 -0
- package/lib/redux/actions/orderEntryActions.js +74 -22
- package/lib/redux/actions/orderEntryActions.test.js +63 -11
- package/lib/redux/actions/orderHistoryActions.js +20 -8
- package/lib/redux/actions/orderHistoryActions.test.js +63 -0
- package/lib/redux/actions/userActions.js +379 -179
- package/lib/redux/actions/userActions.test.js +925 -234
- package/lib/redux/actions/withdrawActions.js +62 -29
- package/lib/redux/actions/withdrawActions.test.js +246 -73
- package/lib/redux/actions/withdrawActions.travelRule.test.js +17 -3
- package/lib/redux/margin/actions/marginActions.js +6 -3
- package/lib/redux/margin/actions/marginActions.test.js +166 -0
- package/lib/redux/middlewares/authMiddleware.js +5 -0
- package/lib/redux/middlewares/authMiddleware.test.js +88 -29
- package/lib/redux/reducers/authReducer.js +1 -0
- package/lib/redux/reducers/authReducer.test.js +38 -0
- package/lib/redux/reducers/userReducer.js +10 -0
- package/lib/redux/reducers/userReducer.test.js +29 -0
- package/lib/redux/selectors/orderEntrySelector.js +19 -8
- package/lib/redux/selectors/orderEntrySelector.test.js +209 -0
- package/lib/redux/selectors/orderTotalSelector.test.js +40 -1
- package/lib/redux/selectors/recentActivitySelector.js +8 -2
- package/lib/redux/selectors/recentActivitySelector.v2.test.js +33 -0
- package/lib/redux/selectors/userSelectors.js +6 -1
- package/lib/redux/selectors/userSelectors.test.js +28 -0
- package/lib/services/fms/fms.js +2 -0
- package/lib/services/fms/fms.test.js +35 -0
- package/package.json +4 -4
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
4
|
+
var _twapOrderHelper = require("./twapOrderHelper");
|
|
5
|
+
var _orderEntryFormConstants = require("../constants/sendOrder/orderEntryFormConstants");
|
|
6
|
+
var _timeInForceConstants = require("../constants/sendOrder/timeInForceConstants");
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
8
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
|
+
var TWAP = _orderEntryFormConstants.orderTypes.twap.displayName;
|
|
15
|
+
var instrument = {
|
|
16
|
+
Product1Symbol: 'BTC',
|
|
17
|
+
Product2Symbol: 'USD',
|
|
18
|
+
MinimumQuantity: 0.001
|
|
19
|
+
};
|
|
20
|
+
describe('twapOrderHelper', function () {
|
|
21
|
+
describe('hasLimitPrice', function () {
|
|
22
|
+
it.each(['', undefined, null, 0, '0', -1, 'abc'])('is false for %p', function (limitPrice) {
|
|
23
|
+
expect((0, _twapOrderHelper.hasLimitPrice)({
|
|
24
|
+
limitPrice: limitPrice
|
|
25
|
+
})).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
it.each([1, '0.5', new _bignumber["default"](100)])('is true for %p', function (limitPrice) {
|
|
28
|
+
expect((0, _twapOrderHelper.hasLimitPrice)({
|
|
29
|
+
limitPrice: limitPrice
|
|
30
|
+
})).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe('isTwapByValue', function () {
|
|
34
|
+
it('is true only for a TWAP buy without a limit price', function () {
|
|
35
|
+
expect((0, _twapOrderHelper.isTwapByValue)({
|
|
36
|
+
orderType: TWAP,
|
|
37
|
+
side: _orderEntryFormConstants.buyValue,
|
|
38
|
+
limitPrice: ''
|
|
39
|
+
})).toBe(true);
|
|
40
|
+
expect((0, _twapOrderHelper.isTwapByValue)({
|
|
41
|
+
orderType: TWAP,
|
|
42
|
+
side: _orderEntryFormConstants.buyValue,
|
|
43
|
+
limitPrice: '100'
|
|
44
|
+
})).toBe(false);
|
|
45
|
+
expect((0, _twapOrderHelper.isTwapByValue)({
|
|
46
|
+
orderType: TWAP,
|
|
47
|
+
side: _orderEntryFormConstants.sellValue,
|
|
48
|
+
limitPrice: ''
|
|
49
|
+
})).toBe(false);
|
|
50
|
+
expect((0, _twapOrderHelper.isTwapByValue)({
|
|
51
|
+
orderType: 'Market Order',
|
|
52
|
+
side: _orderEntryFormConstants.buyValue,
|
|
53
|
+
limitPrice: ''
|
|
54
|
+
})).toBe(false);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe('getTwapExpireTimeTicks', function () {
|
|
58
|
+
it('converts now plus the duration to .NET ticks', function () {
|
|
59
|
+
// 2026-11-06T12:00:00Z plus 60 minutes
|
|
60
|
+
var now = Date.UTC(2026, 10, 6, 12, 0, 0);
|
|
61
|
+
var ticks = (0, _twapOrderHelper.getTwapExpireTimeTicks)(60, now);
|
|
62
|
+
var expectedMs = now + 60 * 60000;
|
|
63
|
+
expect(ticks).toBe(expectedMs * 10000 + 621355968000000000);
|
|
64
|
+
// round-trips through the inverse that dateHelper.ticksToDateString uses
|
|
65
|
+
expect((ticks - 621355968000000000) / 10000).toBe(expectedMs);
|
|
66
|
+
});
|
|
67
|
+
it('accepts the duration as a string', function () {
|
|
68
|
+
expect((0, _twapOrderHelper.getTwapExpireTimeTicks)('1', 0)).toBe(60000 * 10000 + 621355968000000000);
|
|
69
|
+
});
|
|
70
|
+
it.each([0, -5, '', 'x', undefined])('is null for an unusable duration %p', function (duration) {
|
|
71
|
+
expect((0, _twapOrderHelper.getTwapExpireTimeTicks)(duration, 0)).toBeNull();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
describe('parseSlices', function () {
|
|
75
|
+
it('accepts positive whole numbers only', function () {
|
|
76
|
+
expect((0, _twapOrderHelper.parseSlices)('10')).toBe(10);
|
|
77
|
+
expect((0, _twapOrderHelper.parseSlices)(1)).toBe(1);
|
|
78
|
+
expect((0, _twapOrderHelper.parseSlices)('2.5')).toBeNull();
|
|
79
|
+
expect((0, _twapOrderHelper.parseSlices)(0)).toBeNull();
|
|
80
|
+
expect((0, _twapOrderHelper.parseSlices)('')).toBeNull();
|
|
81
|
+
expect((0, _twapOrderHelper.parseSlices)(undefined)).toBeNull();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
describe('getTwapSliceSize', function () {
|
|
85
|
+
it('divides the total by the slices', function () {
|
|
86
|
+
expect((0, _twapOrderHelper.getTwapSliceSize)('100', '10', 8).toNumber()).toBe(10);
|
|
87
|
+
});
|
|
88
|
+
it('rounds up to the decimal places so ceil(total / slice) never exceeds the requested slices', function () {
|
|
89
|
+
var slice = (0, _twapOrderHelper.getTwapSliceSize)('1', '3', 2);
|
|
90
|
+
expect(slice.toNumber()).toBe(0.34);
|
|
91
|
+
expect(new _bignumber["default"](1).div(slice).integerValue(_bignumber["default"].ROUND_CEIL).toNumber()).toBe(3);
|
|
92
|
+
});
|
|
93
|
+
it('accepts BigNumber totals', function () {
|
|
94
|
+
expect((0, _twapOrderHelper.getTwapSliceSize)(new _bignumber["default"]('0.5'), 2, 4).toNumber()).toBe(0.25);
|
|
95
|
+
});
|
|
96
|
+
it.each([['', '10'], ['0', '10'], ['100', '0'], ['100', '2.5'], [undefined, '10'], ['100', '']])('is null while the inputs are not usable (%p, %p)', function (total, slices) {
|
|
97
|
+
expect((0, _twapOrderHelper.getTwapSliceSize)(total, slices, 8)).toBeNull();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
describe('getTwapEndTime', function () {
|
|
101
|
+
it('adds the duration to now', function () {
|
|
102
|
+
expect((0, _twapOrderHelper.getTwapEndTime)('60', 1000).getTime()).toBe(1000 + 60 * 60000);
|
|
103
|
+
});
|
|
104
|
+
it('is null without a usable duration', function () {
|
|
105
|
+
expect((0, _twapOrderHelper.getTwapEndTime)('', 1000)).toBeNull();
|
|
106
|
+
expect((0, _twapOrderHelper.getTwapEndTime)('0', 1000)).toBeNull();
|
|
107
|
+
expect((0, _twapOrderHelper.getTwapEndTime)('abc', 1000)).toBeNull();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe('getTwapSliceCount', function () {
|
|
111
|
+
it('is ceil(total / slice), the count the engine runs', function () {
|
|
112
|
+
expect((0, _twapOrderHelper.getTwapSliceCount)('1', new _bignumber["default"]('0.25'))).toBe(4);
|
|
113
|
+
expect((0, _twapOrderHelper.getTwapSliceCount)('1', new _bignumber["default"]('0.2'))).toBe(5);
|
|
114
|
+
expect((0, _twapOrderHelper.getTwapSliceCount)('1', new _bignumber["default"]('0.34'))).toBe(3);
|
|
115
|
+
expect((0, _twapOrderHelper.getTwapSliceCount)('0.05', 0.01)).toBe(5);
|
|
116
|
+
});
|
|
117
|
+
it('is null without a total or a slice', function () {
|
|
118
|
+
expect((0, _twapOrderHelper.getTwapSliceCount)('', new _bignumber["default"]('0.2'))).toBeNull();
|
|
119
|
+
expect((0, _twapOrderHelper.getTwapSliceCount)('1', null)).toBeNull();
|
|
120
|
+
expect((0, _twapOrderHelper.getTwapSliceCount)('1', new _bignumber["default"](0))).toBeNull();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
describe('getTwapIntervalSeconds', function () {
|
|
124
|
+
it('spreads the duration evenly over the slices', function () {
|
|
125
|
+
expect((0, _twapOrderHelper.getTwapIntervalSeconds)('60', '12')).toBe(300);
|
|
126
|
+
expect((0, _twapOrderHelper.getTwapIntervalSeconds)(60, 7)).toBeCloseTo(514.2857, 3);
|
|
127
|
+
});
|
|
128
|
+
it('is null without a duration or slices', function () {
|
|
129
|
+
expect((0, _twapOrderHelper.getTwapIntervalSeconds)('', '12')).toBeNull();
|
|
130
|
+
expect((0, _twapOrderHelper.getTwapIntervalSeconds)('60', '')).toBeNull();
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
describe('formatTwapInterval', function () {
|
|
134
|
+
var t = function t(key, vars) {
|
|
135
|
+
return key.replace('{{n}}', vars.n);
|
|
136
|
+
};
|
|
137
|
+
it('shows whole minutes as minutes and anything else as seconds', function () {
|
|
138
|
+
expect((0, _twapOrderHelper.formatTwapInterval)(300, t)).toBe('5 min');
|
|
139
|
+
expect((0, _twapOrderHelper.formatTwapInterval)(514.2857, t)).toBe('514 s');
|
|
140
|
+
expect((0, _twapOrderHelper.formatTwapInterval)(null, t)).toBe('-');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
describe('getTwapSchedule', function () {
|
|
144
|
+
it('sizes a sell by quantity and prices the slice at the market', function () {
|
|
145
|
+
var schedule = (0, _twapOrderHelper.getTwapSchedule)({
|
|
146
|
+
orderType: TWAP,
|
|
147
|
+
side: _orderEntryFormConstants.sellValue,
|
|
148
|
+
quantity: '1',
|
|
149
|
+
value: '50000',
|
|
150
|
+
slices: '4',
|
|
151
|
+
durationMinutes: '20',
|
|
152
|
+
limitPrice: ''
|
|
153
|
+
}, instrument, 50000, 8, 2);
|
|
154
|
+
expect(schedule.byValue).toBe(false);
|
|
155
|
+
expect(schedule.isLimit).toBe(false);
|
|
156
|
+
expect(schedule.slices).toBe(4);
|
|
157
|
+
expect(schedule.durationMinutes).toBe(20);
|
|
158
|
+
expect(schedule.intervalSeconds).toBe(300);
|
|
159
|
+
expect(schedule.sliceSize.toNumber()).toBe(0.25);
|
|
160
|
+
expect(schedule.sliceDecimalPlaces).toBe(8);
|
|
161
|
+
expect(schedule.sliceSymbol).toBe('BTC');
|
|
162
|
+
expect(schedule.sliceValue.toNumber()).toBe(12500);
|
|
163
|
+
expect(schedule.belowMinimumQuantity).toBe(false);
|
|
164
|
+
});
|
|
165
|
+
it('sizes a market buy by value, with the slice in the quote currency', function () {
|
|
166
|
+
var schedule = (0, _twapOrderHelper.getTwapSchedule)({
|
|
167
|
+
orderType: TWAP,
|
|
168
|
+
side: _orderEntryFormConstants.buyValue,
|
|
169
|
+
quantity: '0.2',
|
|
170
|
+
value: '10000',
|
|
171
|
+
slices: '10',
|
|
172
|
+
durationMinutes: '60',
|
|
173
|
+
limitPrice: ''
|
|
174
|
+
}, instrument, 50000, 8, 2);
|
|
175
|
+
expect(schedule.byValue).toBe(true);
|
|
176
|
+
expect(schedule.sliceSize.toNumber()).toBe(1000);
|
|
177
|
+
expect(schedule.sliceDecimalPlaces).toBe(2);
|
|
178
|
+
expect(schedule.sliceSymbol).toBe('USD');
|
|
179
|
+
expect(schedule.sliceValue.toNumber()).toBe(1000);
|
|
180
|
+
expect(schedule.belowMinimumQuantity).toBe(false);
|
|
181
|
+
});
|
|
182
|
+
it('sizes a limit buy by quantity and prices the slice at the limit', function () {
|
|
183
|
+
var schedule = (0, _twapOrderHelper.getTwapSchedule)({
|
|
184
|
+
orderType: TWAP,
|
|
185
|
+
side: _orderEntryFormConstants.buyValue,
|
|
186
|
+
quantity: '1',
|
|
187
|
+
value: '',
|
|
188
|
+
slices: '2',
|
|
189
|
+
durationMinutes: '10',
|
|
190
|
+
limitPrice: '40000'
|
|
191
|
+
}, instrument, 50000, 8, 2);
|
|
192
|
+
expect(schedule.byValue).toBe(false);
|
|
193
|
+
expect(schedule.isLimit).toBe(true);
|
|
194
|
+
expect(schedule.sliceSize.toNumber()).toBe(0.5);
|
|
195
|
+
expect(schedule.sliceValue.toNumber()).toBe(20000);
|
|
196
|
+
});
|
|
197
|
+
it('flags a slice below the instrument minimum quantity', function () {
|
|
198
|
+
var schedule = (0, _twapOrderHelper.getTwapSchedule)({
|
|
199
|
+
orderType: TWAP,
|
|
200
|
+
side: _orderEntryFormConstants.sellValue,
|
|
201
|
+
quantity: '0.005',
|
|
202
|
+
slices: '10',
|
|
203
|
+
durationMinutes: '10',
|
|
204
|
+
limitPrice: ''
|
|
205
|
+
}, instrument, 50000, 8, 2);
|
|
206
|
+
expect(schedule.sliceSize.toNumber()).toBe(0.0005);
|
|
207
|
+
expect(schedule.belowMinimumQuantity).toBe(true);
|
|
208
|
+
});
|
|
209
|
+
it('counts the slices the engine runs when the rounded slice size covers the total in fewer', function () {
|
|
210
|
+
// 1 BTC in 6 slices at a 0.1 increment: the slice rounds up to 0.2, which covers 1 BTC in 5.
|
|
211
|
+
var schedule = (0, _twapOrderHelper.getTwapSchedule)({
|
|
212
|
+
orderType: TWAP,
|
|
213
|
+
side: _orderEntryFormConstants.sellValue,
|
|
214
|
+
quantity: '1',
|
|
215
|
+
slices: '6',
|
|
216
|
+
durationMinutes: '60',
|
|
217
|
+
limitPrice: ''
|
|
218
|
+
}, _objectSpread(_objectSpread({}, instrument), {}, {
|
|
219
|
+
QuantityIncrement: 0.1
|
|
220
|
+
}), 50000, 1, 2);
|
|
221
|
+
expect(schedule.sliceSize.toNumber()).toBe(0.2);
|
|
222
|
+
expect(schedule.requestedSlices).toBe(6);
|
|
223
|
+
expect(schedule.slices).toBe(5);
|
|
224
|
+
expect(schedule.intervalSeconds).toBe(720);
|
|
225
|
+
});
|
|
226
|
+
it('counts a value-sized buy the same way', function () {
|
|
227
|
+
// 100 USD in 3 slices at 2 decimals: 33.34 per slice covers 100 USD in 3.
|
|
228
|
+
var schedule = (0, _twapOrderHelper.getTwapSchedule)({
|
|
229
|
+
orderType: TWAP,
|
|
230
|
+
side: _orderEntryFormConstants.buyValue,
|
|
231
|
+
value: '100',
|
|
232
|
+
slices: '3',
|
|
233
|
+
durationMinutes: '30',
|
|
234
|
+
limitPrice: ''
|
|
235
|
+
}, instrument, 50000, 8, 2);
|
|
236
|
+
expect(schedule.sliceSize.toNumber()).toBe(33.34);
|
|
237
|
+
expect(schedule.slices).toBe(3);
|
|
238
|
+
expect(schedule.intervalSeconds).toBe(600);
|
|
239
|
+
});
|
|
240
|
+
it('leaves the derived values empty while the form is incomplete', function () {
|
|
241
|
+
var schedule = (0, _twapOrderHelper.getTwapSchedule)({
|
|
242
|
+
orderType: TWAP,
|
|
243
|
+
side: _orderEntryFormConstants.sellValue,
|
|
244
|
+
quantity: '',
|
|
245
|
+
slices: '',
|
|
246
|
+
durationMinutes: '',
|
|
247
|
+
limitPrice: ''
|
|
248
|
+
}, instrument, 50000, 8, 2);
|
|
249
|
+
expect(schedule.slices).toBeNull();
|
|
250
|
+
expect(schedule.durationMinutes).toBeNull();
|
|
251
|
+
expect(schedule.intervalSeconds).toBeNull();
|
|
252
|
+
expect(schedule.sliceSize).toBeNull();
|
|
253
|
+
expect(schedule.sliceValue).toBeNull();
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
describe('isTwapSliceBelowMinimum', function () {
|
|
257
|
+
var form = {
|
|
258
|
+
orderType: TWAP,
|
|
259
|
+
side: _orderEntryFormConstants.sellValue,
|
|
260
|
+
quantity: '0.005',
|
|
261
|
+
slices: '10',
|
|
262
|
+
limitPrice: ''
|
|
263
|
+
};
|
|
264
|
+
it('is true when a quantity slice is under the instrument minimum', function () {
|
|
265
|
+
expect((0, _twapOrderHelper.isTwapSliceBelowMinimum)(form, instrument, 8)).toBe(true);
|
|
266
|
+
expect((0, _twapOrderHelper.isTwapSliceBelowMinimum)(_objectSpread(_objectSpread({}, form), {}, {
|
|
267
|
+
quantity: '1'
|
|
268
|
+
}), instrument, 8)).toBe(false);
|
|
269
|
+
});
|
|
270
|
+
it('is false without an instrument minimum, for a value-sized buy, or while the form is incomplete', function () {
|
|
271
|
+
expect((0, _twapOrderHelper.isTwapSliceBelowMinimum)(form, _objectSpread(_objectSpread({}, instrument), {}, {
|
|
272
|
+
MinimumQuantity: 0
|
|
273
|
+
}), 8)).toBe(false);
|
|
274
|
+
expect((0, _twapOrderHelper.isTwapSliceBelowMinimum)(form, undefined, 8)).toBe(false);
|
|
275
|
+
expect((0, _twapOrderHelper.isTwapSliceBelowMinimum)(_objectSpread(_objectSpread({}, form), {}, {
|
|
276
|
+
side: _orderEntryFormConstants.buyValue,
|
|
277
|
+
value: '1'
|
|
278
|
+
}), instrument, 8)).toBe(false);
|
|
279
|
+
expect((0, _twapOrderHelper.isTwapSliceBelowMinimum)(_objectSpread(_objectSpread({}, form), {}, {
|
|
280
|
+
quantity: ''
|
|
281
|
+
}), instrument, 8)).toBe(false);
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
describe('getTwapDurationError', function () {
|
|
285
|
+
it('requires a positive duration within the cap', function () {
|
|
286
|
+
expect((0, _twapOrderHelper.getTwapDurationError)('')).toEqual({
|
|
287
|
+
key: 'Must be greater than {{a}}',
|
|
288
|
+
vars: {
|
|
289
|
+
a: 0,
|
|
290
|
+
ns: 'translation'
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
expect((0, _twapOrderHelper.getTwapDurationError)('0')).toEqual({
|
|
294
|
+
key: 'Must be greater than {{a}}',
|
|
295
|
+
vars: {
|
|
296
|
+
a: 0,
|
|
297
|
+
ns: 'translation'
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
expect((0, _twapOrderHelper.getTwapDurationError)(String(_twapOrderHelper.TWAP_MAX_DURATION_MINUTES + 1))).toEqual({
|
|
301
|
+
key: 'Must be less than {{a}}',
|
|
302
|
+
vars: {
|
|
303
|
+
a: _twapOrderHelper.TWAP_MAX_DURATION_MINUTES + 1,
|
|
304
|
+
ns: 'translation'
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
expect((0, _twapOrderHelper.getTwapDurationError)('60')).toBeUndefined();
|
|
308
|
+
expect((0, _twapOrderHelper.getTwapDurationError)(String(_twapOrderHelper.TWAP_MAX_DURATION_MINUTES))).toBeUndefined();
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
describe('getTwapSlicesError', function () {
|
|
312
|
+
var form = {
|
|
313
|
+
orderType: TWAP,
|
|
314
|
+
side: _orderEntryFormConstants.sellValue,
|
|
315
|
+
quantity: '1',
|
|
316
|
+
limitPrice: ''
|
|
317
|
+
};
|
|
318
|
+
it('requires a whole number of slices the engine accepts', function () {
|
|
319
|
+
var range = {
|
|
320
|
+
key: 'Must be a whole number between {{min}} and {{max}}',
|
|
321
|
+
vars: {
|
|
322
|
+
min: 1,
|
|
323
|
+
max: _twapOrderHelper.TWAP_MAX_SLICES
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
expect((0, _twapOrderHelper.getTwapSlicesError)('', form, instrument, 8)).toEqual(range);
|
|
327
|
+
expect((0, _twapOrderHelper.getTwapSlicesError)('0', form, instrument, 8)).toEqual(range);
|
|
328
|
+
expect((0, _twapOrderHelper.getTwapSlicesError)('2.5', form, instrument, 8)).toEqual(range);
|
|
329
|
+
expect((0, _twapOrderHelper.getTwapSlicesError)(String(_twapOrderHelper.TWAP_MAX_SLICES + 1), form, instrument, 8)).toEqual(range);
|
|
330
|
+
expect((0, _twapOrderHelper.getTwapSlicesError)('10', form, instrument, 8)).toBeUndefined();
|
|
331
|
+
});
|
|
332
|
+
it('rejects a slice below the instrument minimum, with the minimum formatted for the input', function () {
|
|
333
|
+
expect((0, _twapOrderHelper.getTwapSlicesError)('10', _objectSpread(_objectSpread({}, form), {}, {
|
|
334
|
+
quantity: '0.005'
|
|
335
|
+
}), instrument, 4)).toEqual({
|
|
336
|
+
key: 'Each slice must be at least {{min}} {{symbol}}. Increase the amount or use fewer slices',
|
|
337
|
+
vars: {
|
|
338
|
+
min: '0.0010',
|
|
339
|
+
symbol: 'BTC'
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
it('does not check the minimum for a value-sized buy or without an instrument', function () {
|
|
344
|
+
expect((0, _twapOrderHelper.getTwapSlicesError)('10', _objectSpread(_objectSpread({}, form), {}, {
|
|
345
|
+
side: _orderEntryFormConstants.buyValue,
|
|
346
|
+
value: '1',
|
|
347
|
+
quantity: ''
|
|
348
|
+
}), instrument, 8)).toBeUndefined();
|
|
349
|
+
expect((0, _twapOrderHelper.getTwapSlicesError)('10', _objectSpread(_objectSpread({}, form), {}, {
|
|
350
|
+
quantity: '0.005'
|
|
351
|
+
}), undefined, 8)).toBeUndefined();
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
describe('getTwapOrderFields / getTwapOmittedFields', function () {
|
|
355
|
+
var options = {
|
|
356
|
+
quantityDecimalPlaces: 4,
|
|
357
|
+
priceDecimalPlaces: 2,
|
|
358
|
+
now: 0
|
|
359
|
+
};
|
|
360
|
+
it('builds a GTD order with the slice as DisplayQuantity for a quantity-sized TWAP', function () {
|
|
361
|
+
var form = {
|
|
362
|
+
orderType: TWAP,
|
|
363
|
+
side: _orderEntryFormConstants.sellValue,
|
|
364
|
+
quantity: '1',
|
|
365
|
+
value: '50000',
|
|
366
|
+
slices: '3',
|
|
367
|
+
durationMinutes: '30',
|
|
368
|
+
limitPrice: ''
|
|
369
|
+
};
|
|
370
|
+
expect((0, _twapOrderHelper.getTwapOrderFields)(form, options)).toEqual({
|
|
371
|
+
TimeInForce: 6,
|
|
372
|
+
ExpireTime: 30 * 60000 * 10000 + 621355968000000000,
|
|
373
|
+
DisplayQuantity: 0.3334,
|
|
374
|
+
UseDisplayQuantity: true
|
|
375
|
+
});
|
|
376
|
+
expect((0, _twapOrderHelper.getTwapOmittedFields)(form)).toEqual(['Value', 'LimitPrice', 'PostOnly']);
|
|
377
|
+
});
|
|
378
|
+
it('keeps the LimitPrice of a limit-form TWAP', function () {
|
|
379
|
+
var form = {
|
|
380
|
+
orderType: TWAP,
|
|
381
|
+
side: _orderEntryFormConstants.buyValue,
|
|
382
|
+
quantity: '1',
|
|
383
|
+
value: '',
|
|
384
|
+
slices: '2',
|
|
385
|
+
durationMinutes: '10',
|
|
386
|
+
limitPrice: '40000'
|
|
387
|
+
};
|
|
388
|
+
expect((0, _twapOrderHelper.getTwapOmittedFields)(form)).toEqual(['Value', 'PostOnly']);
|
|
389
|
+
expect((0, _twapOrderHelper.getTwapOrderFields)(form, options)).toEqual({
|
|
390
|
+
TimeInForce: 6,
|
|
391
|
+
ExpireTime: 10 * 60000 * 10000 + 621355968000000000,
|
|
392
|
+
DisplayQuantity: 0.5,
|
|
393
|
+
UseDisplayQuantity: true
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
it('sizes a market buy by Value with the slice value as DisplayQuantity', function () {
|
|
397
|
+
var form = {
|
|
398
|
+
orderType: TWAP,
|
|
399
|
+
side: _orderEntryFormConstants.buyValue,
|
|
400
|
+
quantity: '0.2',
|
|
401
|
+
value: '10000',
|
|
402
|
+
slices: '8',
|
|
403
|
+
durationMinutes: '30',
|
|
404
|
+
limitPrice: ''
|
|
405
|
+
};
|
|
406
|
+
expect((0, _twapOrderHelper.getTwapOrderFields)(form, options)).toEqual({
|
|
407
|
+
TimeInForce: 6,
|
|
408
|
+
ExpireTime: 30 * 60000 * 10000 + 621355968000000000,
|
|
409
|
+
Value: 10000,
|
|
410
|
+
DisplayQuantity: 1250,
|
|
411
|
+
UseDisplayQuantity: false
|
|
412
|
+
});
|
|
413
|
+
expect((0, _twapOrderHelper.getTwapOmittedFields)(form)).toEqual(['Quantity', 'LimitPrice', 'PostOnly']);
|
|
414
|
+
});
|
|
415
|
+
it('accepts a BigNumber Value', function () {
|
|
416
|
+
var form = {
|
|
417
|
+
orderType: TWAP,
|
|
418
|
+
side: _orderEntryFormConstants.buyValue,
|
|
419
|
+
value: new _bignumber["default"]('10000'),
|
|
420
|
+
slices: '8',
|
|
421
|
+
durationMinutes: '30',
|
|
422
|
+
limitPrice: ''
|
|
423
|
+
};
|
|
424
|
+
expect((0, _twapOrderHelper.getTwapOrderFields)(form, options).Value).toBe(10000);
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
describe('getFeeFormValues', function () {
|
|
428
|
+
it('requests the fee of a market order for a market-form TWAP', function () {
|
|
429
|
+
expect((0, _twapOrderHelper.getFeeFormValues)({
|
|
430
|
+
orderType: TWAP,
|
|
431
|
+
limitPrice: ''
|
|
432
|
+
}).orderType).toBe(_orderEntryFormConstants.orderTypes.market.displayName);
|
|
433
|
+
});
|
|
434
|
+
it('requests the fee of a limit order for a limit-form TWAP', function () {
|
|
435
|
+
expect((0, _twapOrderHelper.getFeeFormValues)({
|
|
436
|
+
orderType: TWAP,
|
|
437
|
+
limitPrice: '100'
|
|
438
|
+
}).orderType).toBe(_orderEntryFormConstants.orderTypes.limit.displayName);
|
|
439
|
+
});
|
|
440
|
+
it('returns other order types untouched', function () {
|
|
441
|
+
var form = {
|
|
442
|
+
orderType: 'Stop Limit',
|
|
443
|
+
limitPrice: '100'
|
|
444
|
+
};
|
|
445
|
+
expect((0, _twapOrderHelper.getFeeFormValues)(form)).toBe(form);
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
it('sends the time in force the constants table gives a TWAP', function () {
|
|
449
|
+
var fields = (0, _twapOrderHelper.getTwapOrderFields)({
|
|
450
|
+
orderType: TWAP,
|
|
451
|
+
side: _orderEntryFormConstants.sellValue,
|
|
452
|
+
quantity: '1',
|
|
453
|
+
slices: '4',
|
|
454
|
+
durationMinutes: '10',
|
|
455
|
+
limitPrice: ''
|
|
456
|
+
}, {
|
|
457
|
+
quantityDecimalPlaces: 8,
|
|
458
|
+
priceDecimalPlaces: 2,
|
|
459
|
+
now: 0
|
|
460
|
+
});
|
|
461
|
+
expect(fields.TimeInForce).toBe(_timeInForceConstants.timeInForceForOrderType[TWAP]);
|
|
462
|
+
expect(fields.TimeInForce).toBe(6);
|
|
463
|
+
});
|
|
464
|
+
it('caps the slices at what the engine accepts', function () {
|
|
465
|
+
expect(_twapOrderHelper.TWAP_MAX_SLICES).toBe(100);
|
|
466
|
+
});
|
|
467
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isTwoFactorAuthCancellation = exports.TwoFactorAuthCancelledError = void 0;
|
|
8
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
9
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
11
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
13
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
15
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
16
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
17
|
+
function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
|
|
18
|
+
function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
|
|
19
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
+
function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
|
|
21
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
22
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
23
|
+
// Thrown into a pending callAPI promise when the user dismisses the 2FA modal without a
|
|
24
|
+
// successful code, so the caller settles instead of waiting forever.
|
|
25
|
+
var TwoFactorAuthCancelledError = exports.TwoFactorAuthCancelledError = /*#__PURE__*/function (_Error) {
|
|
26
|
+
function TwoFactorAuthCancelledError() {
|
|
27
|
+
var _this;
|
|
28
|
+
_classCallCheck(this, TwoFactorAuthCancelledError);
|
|
29
|
+
_this = _callSuper(this, TwoFactorAuthCancelledError, ['Two-factor authentication was cancelled']);
|
|
30
|
+
_this.name = 'TwoFactorAuthCancelledError';
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
_inherits(TwoFactorAuthCancelledError, _Error);
|
|
34
|
+
return _createClass(TwoFactorAuthCancelledError);
|
|
35
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
36
|
+
var isTwoFactorAuthCancellation = exports.isTwoFactorAuthCancellation = function isTwoFactorAuthCancellation(error) {
|
|
37
|
+
return !!error && error.name === 'TwoFactorAuthCancelledError';
|
|
38
|
+
};
|