@riocrypto/common 1.0.2062 → 1.0.2064

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.
@@ -0,0 +1,3 @@
1
+ import { User } from "../types/user";
2
+ import { Crypto } from "../types/crypto";
3
+ export declare const getUserPayoutVaultId: (user: User, crypto: Crypto) => string;
@@ -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
@@ -360,6 +360,8 @@ export * from "./types/STP-settings";
360
360
  export * from "./types/axe";
361
361
  export * from "./types/axe-status";
362
362
  export * from "./types/TV-FX-data-provider";
363
+ export * from "./types/liquidity-reservation";
364
+ export * from "./types/liquidity-reservation-status";
363
365
  export * from "./classes/KYCFieldClass";
364
366
  export * from "./classes/KYCFileClass";
365
367
  export * from "./classes/CountryAsset";
@@ -395,5 +397,7 @@ export * from "./helpers/get-base-url";
395
397
  export * from "./helpers/get-currency-with-country";
396
398
  export * from "./helpers/get-can-disburse-without-cosigner";
397
399
  export * from "./helpers/is-bitso-bank-account";
400
+ export * from "./helpers/is-overnight-or-weekend-mexico-city";
401
+ export * from "./helpers/get-user-payout-vault-id";
398
402
  export * from "./constants/mexico-fiscal-regimens";
399
403
  export * from "./constants/mexican-banks";
package/build/index.js CHANGED
@@ -376,6 +376,8 @@ __exportStar(require("./types/STP-settings"), exports);
376
376
  __exportStar(require("./types/axe"), exports);
377
377
  __exportStar(require("./types/axe-status"), exports);
378
378
  __exportStar(require("./types/TV-FX-data-provider"), exports);
379
+ __exportStar(require("./types/liquidity-reservation"), exports);
380
+ __exportStar(require("./types/liquidity-reservation-status"), exports);
379
381
  __exportStar(require("./classes/KYCFieldClass"), exports);
380
382
  __exportStar(require("./classes/KYCFileClass"), exports);
381
383
  __exportStar(require("./classes/CountryAsset"), exports);
@@ -411,5 +413,7 @@ __exportStar(require("./helpers/get-base-url"), exports);
411
413
  __exportStar(require("./helpers/get-currency-with-country"), exports);
412
414
  __exportStar(require("./helpers/get-can-disburse-without-cosigner"), exports);
413
415
  __exportStar(require("./helpers/is-bitso-bank-account"), exports);
416
+ __exportStar(require("./helpers/is-overnight-or-weekend-mexico-city"), exports);
417
+ __exportStar(require("./helpers/get-user-payout-vault-id"), exports);
414
418
  __exportStar(require("./constants/mexico-fiscal-regimens"), exports);
415
419
  __exportStar(require("./constants/mexican-banks"), exports);
@@ -0,0 +1,8 @@
1
+ export declare enum LiquidityReservationStatus {
2
+ requested = "requested",
3
+ pendingConsumption = "pendingConsumption",
4
+ PartiallyConsumed = "partiallyConsumed",
5
+ Consumed = "consumed",
6
+ Cancelled = "cancelled",
7
+ Expired = "expired"
8
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LiquidityReservationStatus = void 0;
4
+ var LiquidityReservationStatus;
5
+ (function (LiquidityReservationStatus) {
6
+ LiquidityReservationStatus["requested"] = "requested";
7
+ LiquidityReservationStatus["pendingConsumption"] = "pendingConsumption";
8
+ LiquidityReservationStatus["PartiallyConsumed"] = "partiallyConsumed";
9
+ LiquidityReservationStatus["Consumed"] = "consumed";
10
+ LiquidityReservationStatus["Cancelled"] = "cancelled";
11
+ LiquidityReservationStatus["Expired"] = "expired";
12
+ })(LiquidityReservationStatus = exports.LiquidityReservationStatus || (exports.LiquidityReservationStatus = {}));
@@ -0,0 +1,14 @@
1
+ import { Fiat } from "./fiat";
2
+ import { Side } from "./side";
3
+ import { Crypto } from "./crypto";
4
+ import { LiquidityReservationStatus } from "./liquidity-reservation-status";
5
+ export interface LiquidityReservation {
6
+ id: string;
7
+ side: Side;
8
+ userId: string;
9
+ currency: Crypto | Fiat;
10
+ amount: number;
11
+ status: LiquidityReservationStatus;
12
+ createdAt: Date;
13
+ expiresAt: Date;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.2062",
3
+ "version": "1.0.2064",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",