@riocrypto/common 1.0.2061 → 1.0.2063
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/build/helpers/get-user-payout-vault-id.d.ts +3 -0
- package/build/helpers/get-user-payout-vault-id.js +41 -0
- package/build/helpers/is-overnight-or-weekend-mexico-city.d.ts +1 -0
- package/build/helpers/is-overnight-or-weekend-mexico-city.js +24 -0
- package/build/index.d.ts +3 -0
- package/build/index.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserPayoutVaultId = void 0;
|
|
4
|
+
const user_attribute_1 = require("../types/user-attribute");
|
|
5
|
+
const is_overnight_or_weekend_mexico_city_1 = require("./is-overnight-or-weekend-mexico-city");
|
|
6
|
+
const getUserPayoutVaultId = (user, crypto) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const customPayoutFireblocksVault = user.customPayoutFireblocksVault;
|
|
9
|
+
if (customPayoutFireblocksVault === null || customPayoutFireblocksVault === void 0 ? void 0 : customPayoutFireblocksVault[crypto]) {
|
|
10
|
+
if ((0, is_overnight_or_weekend_mexico_city_1.isOvernightOrWeekendMexicoCity)()) {
|
|
11
|
+
if (customPayoutFireblocksVault[crypto].overrideOvernightAndWeekendVault) {
|
|
12
|
+
return customPayoutFireblocksVault[crypto].fireblocksVaultId;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
if ((_a = user.attributes) === null || _a === void 0 ? void 0 : _a.includes(user_attribute_1.UserAttribute.useFireblocksOvernightAndWeekendVault)) {
|
|
16
|
+
return "411";
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return "2";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return customPayoutFireblocksVault[crypto].fireblocksVaultId;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
if ((0, is_overnight_or_weekend_mexico_city_1.isOvernightOrWeekendMexicoCity)()) {
|
|
29
|
+
if ((_b = user.attributes) === null || _b === void 0 ? void 0 : _b.includes(user_attribute_1.UserAttribute.useFireblocksOvernightAndWeekendVault)) {
|
|
30
|
+
return "411";
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return "2";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return "2";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.getUserPayoutVaultId = getUserPayoutVaultId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isOvernightOrWeekendMexicoCity: () => boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isOvernightOrWeekendMexicoCity = void 0;
|
|
4
|
+
const isOvernightOrWeekendMexicoCity = () => {
|
|
5
|
+
const mexicoCityTime = new Date().toLocaleString("en-US", {
|
|
6
|
+
timeZone: "America/Mexico_City",
|
|
7
|
+
});
|
|
8
|
+
const currentTime = new Date(mexicoCityTime);
|
|
9
|
+
// Check if it's weekend (0 is Sunday, 6 is Saturday)
|
|
10
|
+
const dayOfWeek = currentTime.getDay();
|
|
11
|
+
if (dayOfWeek === 0 || dayOfWeek === 6) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
const hours = currentTime.getHours();
|
|
15
|
+
const minutes = currentTime.getMinutes();
|
|
16
|
+
// Convert current time to minutes since midnight for easier comparison
|
|
17
|
+
const currentTimeInMinutes = hours * 60 + minutes;
|
|
18
|
+
const eveningCutoff = 19 * 60 + 30; // 7:30 PM = 19:30
|
|
19
|
+
const morningCutoff = 8 * 60; // 8:00 AM = 8:00
|
|
20
|
+
// Check if current time is between 7:30 PM and 8:00 AM
|
|
21
|
+
return (currentTimeInMinutes >= eveningCutoff ||
|
|
22
|
+
currentTimeInMinutes < morningCutoff);
|
|
23
|
+
};
|
|
24
|
+
exports.isOvernightOrWeekendMexicoCity = isOvernightOrWeekendMexicoCity;
|
package/build/index.d.ts
CHANGED
|
@@ -181,6 +181,7 @@ export * from "./events/axe-partially-taken-event";
|
|
|
181
181
|
export * from "./events/axe-taken-event";
|
|
182
182
|
export * from "./events/axe-cancelled-event";
|
|
183
183
|
export * from "./events/axe-updated-event";
|
|
184
|
+
export * from "./events/FX-provider-updated-event";
|
|
184
185
|
export * from "./types/auth-payload";
|
|
185
186
|
export * from "./types/admin-auth-payload";
|
|
186
187
|
export * from "./types/admin-auth";
|
|
@@ -394,5 +395,7 @@ export * from "./helpers/get-base-url";
|
|
|
394
395
|
export * from "./helpers/get-currency-with-country";
|
|
395
396
|
export * from "./helpers/get-can-disburse-without-cosigner";
|
|
396
397
|
export * from "./helpers/is-bitso-bank-account";
|
|
398
|
+
export * from "./helpers/is-overnight-or-weekend-mexico-city";
|
|
399
|
+
export * from "./helpers/get-user-payout-vault-id";
|
|
397
400
|
export * from "./constants/mexico-fiscal-regimens";
|
|
398
401
|
export * from "./constants/mexican-banks";
|
package/build/index.js
CHANGED
|
@@ -197,6 +197,7 @@ __exportStar(require("./events/axe-partially-taken-event"), exports);
|
|
|
197
197
|
__exportStar(require("./events/axe-taken-event"), exports);
|
|
198
198
|
__exportStar(require("./events/axe-cancelled-event"), exports);
|
|
199
199
|
__exportStar(require("./events/axe-updated-event"), exports);
|
|
200
|
+
__exportStar(require("./events/FX-provider-updated-event"), exports);
|
|
200
201
|
__exportStar(require("./types/auth-payload"), exports);
|
|
201
202
|
__exportStar(require("./types/admin-auth-payload"), exports);
|
|
202
203
|
__exportStar(require("./types/admin-auth"), exports);
|
|
@@ -410,5 +411,7 @@ __exportStar(require("./helpers/get-base-url"), exports);
|
|
|
410
411
|
__exportStar(require("./helpers/get-currency-with-country"), exports);
|
|
411
412
|
__exportStar(require("./helpers/get-can-disburse-without-cosigner"), exports);
|
|
412
413
|
__exportStar(require("./helpers/is-bitso-bank-account"), exports);
|
|
414
|
+
__exportStar(require("./helpers/is-overnight-or-weekend-mexico-city"), exports);
|
|
415
|
+
__exportStar(require("./helpers/get-user-payout-vault-id"), exports);
|
|
413
416
|
__exportStar(require("./constants/mexico-fiscal-regimens"), exports);
|
|
414
417
|
__exportStar(require("./constants/mexican-banks"), exports);
|