@riocrypto/common 1.0.2707 → 1.0.2709

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,11 @@
1
+ import { Country } from "../types/country";
2
+ import { Crypto } from "../types/crypto";
3
+ import { Fiat } from "../types/fiat";
4
+ import { OnboardingStatus } from "../types/onboarding-status";
5
+ import { OrderStatus } from "../types/order-status";
6
+ export declare const documentedOrderStatusDescription = "These are the statuses an order moves through on a normal flow, and which ones it sees depends on whether it is a buy or a sell and on whether payment is deferred. Other statuses can appear depending on the circumstances of the order.";
7
+ export declare const getDocumentedCryptos: () => Crypto[];
8
+ export declare const getDocumentedFiats: () => Fiat[];
9
+ export declare const getDocumentedCountries: () => Country[];
10
+ export declare const getDocumentedOnboardingStatuses: () => OnboardingStatus[];
11
+ export declare const getDocumentedOrderStatuses: () => OrderStatus[];
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDocumentedOrderStatuses = exports.getDocumentedOnboardingStatuses = exports.getDocumentedCountries = exports.getDocumentedFiats = exports.getDocumentedCryptos = exports.documentedOrderStatusDescription = void 0;
4
+ const country_1 = require("../types/country");
5
+ const crypto_1 = require("../types/crypto");
6
+ const fiat_1 = require("../types/fiat");
7
+ const onboarding_status_1 = require("../types/onboarding-status");
8
+ const order_status_1 = require("../types/order-status");
9
+ const stablecoin_type_1 = require("../types/stablecoin-type");
10
+ const get_order_status_rankings_1 = require("./get-order-status-rankings");
11
+ const is_us_operations_enabled_1 = require("./is-us-operations-enabled");
12
+ // The values the public API documentation advertises. Swagger used to read the
13
+ // raw enums, which meant every internal failure state, retired asset and market
14
+ // we do not sell in ended up in the customer facing specs, so the swagger
15
+ // sources read from here instead.
16
+ // The bridged Polygon contract, which we no longer hand out.
17
+ const RETIRED_CRYPTOS = [crypto_1.Crypto.USDCPolygonBridged];
18
+ const DOCUMENTED_COUNTRIES = [
19
+ country_1.Country.Mexico,
20
+ country_1.Country.Peru,
21
+ country_1.Country.Colombia,
22
+ ];
23
+ const DOCUMENTED_ONBOARDING_STATUSES = [
24
+ onboarding_status_1.OnboardingStatus.None,
25
+ onboarding_status_1.OnboardingStatus.Onboarding,
26
+ onboarding_status_1.OnboardingStatus.Review,
27
+ onboarding_status_1.OnboardingStatus.Approved,
28
+ onboarding_status_1.OnboardingStatus.Declined,
29
+ ];
30
+ exports.documentedOrderStatusDescription = "These are the statuses an order moves through on a normal flow, and which ones it sees depends on whether it is a buy or a sell and on whether payment is deferred. Other statuses can appear depending on the circumstances of the order.";
31
+ const getDocumentedCryptos = () => [...stablecoin_type_1.USD_BACKED_CRYPTOS, ...stablecoin_type_1.EUR_BACKED_CRYPTOS].filter((crypto) => !RETIRED_CRYPTOS.includes(crypto));
32
+ exports.getDocumentedCryptos = getDocumentedCryptos;
33
+ const getDocumentedFiats = () => Object.values(fiat_1.Fiat).filter((fiat) => fiat !== fiat_1.Fiat.Other);
34
+ exports.getDocumentedFiats = getDocumentedFiats;
35
+ const getDocumentedCountries = () => is_us_operations_enabled_1.US_OPERATIONS_ENABLED
36
+ ? [...DOCUMENTED_COUNTRIES, country_1.Country.UnitedStates]
37
+ : [...DOCUMENTED_COUNTRIES];
38
+ exports.getDocumentedCountries = getDocumentedCountries;
39
+ const getDocumentedOnboardingStatuses = () => [
40
+ ...DOCUMENTED_ONBOARDING_STATUSES,
41
+ ];
42
+ exports.getDocumentedOnboardingStatuses = getDocumentedOnboardingStatuses;
43
+ // Neither shows up in the rankings because an order does not pass through them
44
+ // on its way anywhere, but a customer can cancel an order and can let a quote
45
+ // run out, so both are worth documenting.
46
+ const DOCUMENTED_TERMINAL_ORDER_STATUSES = [
47
+ order_status_1.OrderStatus.Cancelled,
48
+ order_status_1.OrderStatus.Expired,
49
+ ];
50
+ const getDocumentedOrderStatuses = () => {
51
+ const happyPath = [
52
+ ...Object.keys(get_order_status_rankings_1.BuyOrderStatusRanking),
53
+ ...Object.keys(get_order_status_rankings_1.SellOrderStatusRanking),
54
+ ...Object.keys(get_order_status_rankings_1.AsyncBuyOrderStatusRanking),
55
+ ...Object.keys(get_order_status_rankings_1.AsyncSellOrderStatusRanking),
56
+ ];
57
+ return [
58
+ ...new Set([...happyPath, ...DOCUMENTED_TERMINAL_ORDER_STATUSES]),
59
+ ];
60
+ };
61
+ exports.getDocumentedOrderStatuses = getDocumentedOrderStatuses;
package/build/index.d.ts CHANGED
@@ -587,6 +587,7 @@ export * from "./helpers/get-days-until-two-way-settlement-date";
587
587
  export * from "./helpers/get-two-way-settlement-date-offset-from-date";
588
588
  export * from "./helpers/get-two-way-settlement-date";
589
589
  export * from "./helpers/get-order-status-rankings";
590
+ export * from "./helpers/get-documented-enums";
590
591
  export * from "./helpers/get-lower-order-statuses";
591
592
  export * from "./helpers/is-us-operations-enabled";
592
593
  export * from "./constants/mexico-fiscal-regimens";
package/build/index.js CHANGED
@@ -603,6 +603,7 @@ __exportStar(require("./helpers/get-days-until-two-way-settlement-date"), export
603
603
  __exportStar(require("./helpers/get-two-way-settlement-date-offset-from-date"), exports);
604
604
  __exportStar(require("./helpers/get-two-way-settlement-date"), exports);
605
605
  __exportStar(require("./helpers/get-order-status-rankings"), exports);
606
+ __exportStar(require("./helpers/get-documented-enums"), exports);
606
607
  __exportStar(require("./helpers/get-lower-order-statuses"), exports);
607
608
  __exportStar(require("./helpers/is-us-operations-enabled"), exports);
608
609
  __exportStar(require("./constants/mexico-fiscal-regimens"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.2707",
3
+ "version": "1.0.2709",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",