@riocrypto/common 1.0.2722 → 1.0.2724

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.
@@ -4,8 +4,8 @@ export declare class CryptoAsset extends Asset {
4
4
  rawSymbol: Crypto;
5
5
  constructor(rawSymbol: Crypto);
6
6
  getImageUri(): string;
7
- getName(): Crypto.XLM | Crypto.Other | "Bitcoin" | "Ethereum" | "Ethereum (Base)" | "USDC (Ethereum)" | "USDC (Polygon)" | "USDC (Bridged to Polygon)" | "USDC (Solana)" | "USDC (Stellar)" | "USDC (Base)" | "USDC.e (Tempo)" | "EURC (Ethereum)" | "EURC (Solana)" | "EURC (Base)" | "USDT (Polygon)" | "USDT (Ethereum)" | "USDT (Tron)" | "USDT (BSC)" | "USDT (Solana)" | "Tron" | "Solana" | "Polygon" | "BNB";
8
- getSymbol(): Crypto.SOL | Crypto.TRON | Crypto.POL | Crypto.XLM | Crypto.BNB | Crypto.Other | "USDC (Ethereum)" | "USDC (Polygon)" | "USDC (Bridged to Polygon)" | "USDC (Solana)" | "USDC (Stellar)" | "USDC (Base)" | "USDC.e (Tempo)" | "EURC (Ethereum)" | "EURC (Solana)" | "EURC (Base)" | "USDT (Polygon)" | "USDT (Ethereum)" | "USDT (Tron)" | "USDT (BSC)" | "USDT (Solana)" | "BTC" | "ETH" | "ETH (Base)";
9
- getGasSymbol(): Crypto.SOL | Crypto.TRON | Crypto.POL | Crypto.XLM | Crypto.BNB | Crypto.Other | "BTC" | "ETH" | "BASECHAIN_ETH" | "MATIC" | "TRX" | "BNB_BSC" | "SOL" | "XLM" | "TEMPO";
7
+ getName(): Crypto.XLM | Crypto.Other | "Bitcoin" | "Ethereum" | "Ethereum (Base)" | "USDC (Ethereum)" | "USDC (Polygon)" | "USDC (Bridged to Polygon)" | "USDC (Solana)" | "USDC (Stellar)" | "USDC (Base)" | "USDC.e (Tempo)" | "USDC (Arc)" | "EURC (Ethereum)" | "EURC (Solana)" | "EURC (Base)" | "USDT (Polygon)" | "USDT (Ethereum)" | "USDT (Tron)" | "USDT (BSC)" | "USDT (Solana)" | "Tron" | "Solana" | "Polygon" | "BNB";
8
+ getSymbol(): Crypto.SOL | Crypto.TRON | Crypto.POL | Crypto.XLM | Crypto.BNB | Crypto.Other | "USDC (Ethereum)" | "USDC (Polygon)" | "USDC (Bridged to Polygon)" | "USDC (Solana)" | "USDC (Stellar)" | "USDC (Base)" | "USDC.e (Tempo)" | "USDC (Arc)" | "EURC (Ethereum)" | "EURC (Solana)" | "EURC (Base)" | "USDT (Polygon)" | "USDT (Ethereum)" | "USDT (Tron)" | "USDT (BSC)" | "USDT (Solana)" | "BTC" | "ETH" | "ETH (Base)";
9
+ getGasSymbol(): Crypto.SOL | Crypto.TRON | Crypto.POL | Crypto.XLM | Crypto.BNB | Crypto.Other | "BTC" | "ETH" | "BASECHAIN_ETH" | "MATIC" | "TRX" | "BNB_BSC" | "SOL" | "XLM" | "TEMPO" | "ARC";
10
10
  getDescription(): string;
11
11
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CryptoAsset = void 0;
4
4
  const crypto_1 = require("../types/crypto");
5
+ const stablecoin_type_1 = require("../types/stablecoin-type");
5
6
  const Asset_1 = require("./Asset");
6
7
  class CryptoAsset extends Asset_1.Asset {
7
8
  constructor(rawSymbol) {
@@ -30,7 +31,7 @@ class CryptoAsset extends Asset_1.Asset {
30
31
  // if (this.symbol.includes("USDT")) {
31
32
  // return `${process.env.NEXT_PUBLIC_BASE_PATH}/logos/USDT.svg`;
32
33
  // }
33
- if (this.rawSymbol.includes("USDC")) {
34
+ if (stablecoin_type_1.USDC_CRYPTOS.includes(this.rawSymbol)) {
34
35
  return `${process.env.NEXT_PUBLIC_BASE_PATH}/logos/USDC.svg`;
35
36
  }
36
37
  if (this.rawSymbol.includes("EUR")) {
@@ -80,6 +81,9 @@ class CryptoAsset extends Asset_1.Asset {
80
81
  else if (this.rawSymbol === crypto_1.Crypto.USDCTempoBridged) {
81
82
  return "USDC.e (Tempo)";
82
83
  }
84
+ else if (this.rawSymbol === crypto_1.Crypto.USDCArc) {
85
+ return "USDC (Arc)";
86
+ }
83
87
  else if (this.rawSymbol === crypto_1.Crypto.EURCEthereum) {
84
88
  return "EURC (Ethereum)";
85
89
  }
@@ -151,6 +155,9 @@ class CryptoAsset extends Asset_1.Asset {
151
155
  else if (this.rawSymbol === crypto_1.Crypto.USDCTempoBridged) {
152
156
  return "USDC.e (Tempo)";
153
157
  }
158
+ else if (this.rawSymbol === crypto_1.Crypto.USDCArc) {
159
+ return "USDC (Arc)";
160
+ }
154
161
  else if (this.rawSymbol === crypto_1.Crypto.EURCEthereum) {
155
162
  return "EURC (Ethereum)";
156
163
  }
@@ -216,6 +223,9 @@ class CryptoAsset extends Asset_1.Asset {
216
223
  else if (this.rawSymbol === crypto_1.Crypto.USDCTempoBridged) {
217
224
  return "TEMPO";
218
225
  }
226
+ else if (this.rawSymbol === crypto_1.Crypto.USDCArc) {
227
+ return "ARC";
228
+ }
219
229
  else if (this.rawSymbol === crypto_1.Crypto.USDC) {
220
230
  return "ETH";
221
231
  }
@@ -279,6 +289,9 @@ class CryptoAsset extends Asset_1.Asset {
279
289
  else if (this.rawSymbol === crypto_1.Crypto.USDCTempoBridged) {
280
290
  return "Bridged USDC on the Tempo chain.";
281
291
  }
292
+ else if (this.rawSymbol === crypto_1.Crypto.USDCArc) {
293
+ return "USDC on the Arc chain.";
294
+ }
282
295
  else if (this.rawSymbol === crypto_1.Crypto.EURCEthereum) {
283
296
  return "EURC on the Ethereum chain.";
284
297
  }
@@ -0,0 +1,11 @@
1
+ import { CustomError } from "./custom-error";
2
+ export declare class CryptoNotLaunchedError extends CustomError {
3
+ crypto: string;
4
+ statusCode: number;
5
+ internalCode: number;
6
+ constructor(crypto: string);
7
+ serializeErrors(): {
8
+ code: number;
9
+ message: string;
10
+ }[];
11
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CryptoNotLaunchedError = void 0;
4
+ const custom_error_1 = require("./custom-error");
5
+ class CryptoNotLaunchedError extends custom_error_1.CustomError {
6
+ constructor(crypto) {
7
+ super(`${crypto} is not yet available`);
8
+ this.crypto = crypto;
9
+ this.statusCode = 400;
10
+ this.internalCode = 45;
11
+ Object.setPrototypeOf(this, CryptoNotLaunchedError.prototype);
12
+ }
13
+ serializeErrors() {
14
+ return [
15
+ {
16
+ code: this.internalCode,
17
+ message: `${this.crypto} is not yet available`,
18
+ },
19
+ ];
20
+ }
21
+ }
22
+ exports.CryptoNotLaunchedError = CryptoNotLaunchedError;
@@ -33,6 +33,9 @@ const formatTransactionHash = (hash, crypto) => {
33
33
  else if ([crypto_1.Crypto.USDCTempoBridged].includes(crypto)) {
34
34
  return `https://explore.tempo.xyz/tx/${hash}`;
35
35
  }
36
+ else if ([crypto_1.Crypto.USDCArc].includes(crypto)) {
37
+ return `https://explorer.arc.io/tx/${hash}`;
38
+ }
36
39
  else {
37
40
  return "N/A";
38
41
  }
@@ -37,6 +37,8 @@ const getAddressForTesting = (crypto) => {
37
37
  return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
38
38
  case crypto_1.Crypto.USDCTempoBridged:
39
39
  return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
40
+ case crypto_1.Crypto.USDCArc:
41
+ return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
40
42
  default:
41
43
  throw new Error(`Unsupported crypto: ${crypto}`);
42
44
  }
@@ -9,6 +9,7 @@ const order_status_1 = require("../types/order-status");
9
9
  const stablecoin_type_1 = require("../types/stablecoin-type");
10
10
  const get_order_status_rankings_1 = require("./get-order-status-rankings");
11
11
  const is_us_operations_enabled_1 = require("./is-us-operations-enabled");
12
+ const is_crypto_launched_1 = require("./is-crypto-launched");
12
13
  // The values the public API documentation advertises. Swagger used to read the
13
14
  // raw enums, which meant every internal failure state, retired asset and market
14
15
  // we do not sell in ended up in the customer facing specs, so the swagger
@@ -28,7 +29,9 @@ const DOCUMENTED_ONBOARDING_STATUSES = [
28
29
  onboarding_status_1.OnboardingStatus.Declined,
29
30
  ];
30
31
  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
+ // The specs are generated at build time, so a crypto behind the launch switch is
33
+ // left out of them until it is removed from PRELAUNCH_CRYPTOS.
34
+ const getDocumentedCryptos = () => [...stablecoin_type_1.USD_BACKED_CRYPTOS, ...stablecoin_type_1.EUR_BACKED_CRYPTOS].filter((crypto) => !RETIRED_CRYPTOS.includes(crypto) && !is_crypto_launched_1.PRELAUNCH_CRYPTOS.includes(crypto));
32
35
  exports.getDocumentedCryptos = getDocumentedCryptos;
33
36
  const getDocumentedFiats = () => Object.values(fiat_1.Fiat).filter((fiat) => fiat !== fiat_1.Fiat.Other);
34
37
  exports.getDocumentedFiats = getDocumentedFiats;
@@ -0,0 +1,5 @@
1
+ import { Crypto } from "../types/crypto";
2
+ export declare const PRELAUNCH_CRYPTOS: Crypto[];
3
+ export declare const isPrelaunchCrypto: (crypto: Crypto) => boolean;
4
+ export declare const isCryptoLaunched: (crypto: Crypto, launchedCryptos?: Crypto[] | null) => boolean;
5
+ export declare const filterLaunchedCryptos: <T extends Crypto>(cryptos: T[], launchedCryptos?: Crypto[] | null) => T[];
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterLaunchedCryptos = exports.isCryptoLaunched = exports.isPrelaunchCrypto = exports.PRELAUNCH_CRYPTOS = void 0;
4
+ const crypto_1 = require("../types/crypto");
5
+ // Cryptos that are fully wired up but not yet offered to customers. Each one
6
+ // stays hidden from customer-facing flows (quotes, orders, deposit addresses,
7
+ // bulk payments, dashboard selectors) until an admin adds it to
8
+ // `RioSettings.launchedCryptos`. Internal treasury operations are not gated.
9
+ //
10
+ // Once a crypto has been launched for good, remove it from this list so the
11
+ // setting no longer has to carry it.
12
+ exports.PRELAUNCH_CRYPTOS = [crypto_1.Crypto.USDCArc];
13
+ const isPrelaunchCrypto = (crypto) => exports.PRELAUNCH_CRYPTOS.includes(crypto);
14
+ exports.isPrelaunchCrypto = isPrelaunchCrypto;
15
+ const isCryptoLaunched = (crypto, launchedCryptos) => !(0, exports.isPrelaunchCrypto)(crypto) || (launchedCryptos !== null && launchedCryptos !== void 0 ? launchedCryptos : []).includes(crypto);
16
+ exports.isCryptoLaunched = isCryptoLaunched;
17
+ const filterLaunchedCryptos = (cryptos, launchedCryptos) => cryptos.filter((crypto) => (0, exports.isCryptoLaunched)(crypto, launchedCryptos));
18
+ exports.filterLaunchedCryptos = filterLaunchedCryptos;
@@ -21,6 +21,7 @@ const isValidCryptoAddress = (address, crypto) => {
21
21
  crypto_1.Crypto.USDCPolygon ||
22
22
  crypto_1.Crypto.USDCBase ||
23
23
  crypto_1.Crypto.USDCTempoBridged ||
24
+ crypto_1.Crypto.USDCArc ||
24
25
  crypto_1.Crypto.USDTTron ||
25
26
  crypto_1.Crypto.USDTPolygon ||
26
27
  crypto_1.Crypto.USDTEthereum ||
package/build/index.d.ts CHANGED
@@ -41,6 +41,7 @@ export * from "./errors/user-not-enabled-in-us-error";
41
41
  export * from "./errors/above-limit-error";
42
42
  export * from "./errors/onboarding-not-approved-error";
43
43
  export * from "./errors/us-operations-disabled-error";
44
+ export * from "./errors/crypto-not-launched-error";
44
45
  export * from "./events/base-listener";
45
46
  export * from "./events/base-publisher";
46
47
  export * from "./events/subjects";
@@ -603,5 +604,6 @@ export * from "./helpers/get-order-status-rankings";
603
604
  export * from "./helpers/get-documented-enums";
604
605
  export * from "./helpers/get-lower-order-statuses";
605
606
  export * from "./helpers/is-us-operations-enabled";
607
+ export * from "./helpers/is-crypto-launched";
606
608
  export * from "./constants/mexico-fiscal-regimens";
607
609
  export * from "./constants/mexican-banks";
package/build/index.js CHANGED
@@ -57,6 +57,7 @@ __exportStar(require("./errors/user-not-enabled-in-us-error"), exports);
57
57
  __exportStar(require("./errors/above-limit-error"), exports);
58
58
  __exportStar(require("./errors/onboarding-not-approved-error"), exports);
59
59
  __exportStar(require("./errors/us-operations-disabled-error"), exports);
60
+ __exportStar(require("./errors/crypto-not-launched-error"), exports);
60
61
  __exportStar(require("./events/base-listener"), exports);
61
62
  __exportStar(require("./events/base-publisher"), exports);
62
63
  __exportStar(require("./events/subjects"), exports);
@@ -619,5 +620,6 @@ __exportStar(require("./helpers/get-order-status-rankings"), exports);
619
620
  __exportStar(require("./helpers/get-documented-enums"), exports);
620
621
  __exportStar(require("./helpers/get-lower-order-statuses"), exports);
621
622
  __exportStar(require("./helpers/is-us-operations-enabled"), exports);
623
+ __exportStar(require("./helpers/is-crypto-launched"), exports);
622
624
  __exportStar(require("./constants/mexico-fiscal-regimens"), exports);
623
625
  __exportStar(require("./constants/mexican-banks"), exports);
@@ -6,5 +6,6 @@ export declare enum Blockchain {
6
6
  Tempo = "tempo",
7
7
  Tron = "tron",
8
8
  BSC = "bsc",
9
- Base = "base"
9
+ Base = "base",
10
+ Arc = "arc_chain"
10
11
  }
@@ -11,4 +11,5 @@ var Blockchain;
11
11
  Blockchain["Tron"] = "tron";
12
12
  Blockchain["BSC"] = "bsc";
13
13
  Blockchain["Base"] = "base";
14
+ Blockchain["Arc"] = "arc_chain";
14
15
  })(Blockchain = exports.Blockchain || (exports.Blockchain = {}));
@@ -8,6 +8,7 @@ export declare enum Crypto {
8
8
  USDCSolana = "SOL_USDC_PTHX",
9
9
  USDCStellar = "XLM_USDC_5F3T",
10
10
  USDCBase = "USDC_BASECHAIN_ETH_5I5C",
11
+ USDCArc = "ARC",
11
12
  USDCTempoBridged = "USDCE_TEMPO_MXYR",
12
13
  EURCEthereum = "EUROC_ETH_F5NG",
13
14
  EURCSolana = "EURC_SOL",
@@ -12,6 +12,7 @@ var Crypto;
12
12
  Crypto["USDCSolana"] = "SOL_USDC_PTHX";
13
13
  Crypto["USDCStellar"] = "XLM_USDC_5F3T";
14
14
  Crypto["USDCBase"] = "USDC_BASECHAIN_ETH_5I5C";
15
+ Crypto["USDCArc"] = "ARC";
15
16
  Crypto["USDCTempoBridged"] = "USDCE_TEMPO_MXYR";
16
17
  Crypto["EURCEthereum"] = "EUROC_ETH_F5NG";
17
18
  Crypto["EURCSolana"] = "EURC_SOL";
@@ -4,6 +4,7 @@ export declare enum CurrencyWithCountry {
4
4
  USDCStellar = "XLM_USDC_5F3T",
5
5
  USDCBase = "USDC_BASECHAIN_ETH_5I5C",
6
6
  USDCTempoBridged = "USDCE_TEMPO_MXYR",
7
+ USDCArc = "ARC",
7
8
  EURCEthereum = "EUROC_ETH_F5NG",
8
9
  EURCSolana = "EURC_SOL",
9
10
  EURCBase = "EURC_B609K9QB_Y213",
@@ -8,6 +8,7 @@ var CurrencyWithCountry;
8
8
  CurrencyWithCountry["USDCStellar"] = "XLM_USDC_5F3T";
9
9
  CurrencyWithCountry["USDCBase"] = "USDC_BASECHAIN_ETH_5I5C";
10
10
  CurrencyWithCountry["USDCTempoBridged"] = "USDCE_TEMPO_MXYR";
11
+ CurrencyWithCountry["USDCArc"] = "ARC";
11
12
  CurrencyWithCountry["EURCEthereum"] = "EUROC_ETH_F5NG";
12
13
  CurrencyWithCountry["EURCSolana"] = "EURC_SOL";
13
14
  CurrencyWithCountry["EURCBase"] = "EURC_B609K9QB_Y213";
@@ -1,4 +1,5 @@
1
1
  import { Country } from "./country";
2
+ import { Crypto } from "./crypto";
2
3
  import { Fiat } from "./fiat";
3
4
  import { FXPriceSourcePolicies } from "./fx-price-source-policy";
4
5
  import { FXProvider } from "./fx-provider";
@@ -89,4 +90,5 @@ export interface RioSettingsUpdate {
89
90
  };
90
91
  };
91
92
  };
93
+ launchedCryptos?: Crypto[];
92
94
  }
@@ -124,4 +124,5 @@ export interface RioSettings {
124
124
  };
125
125
  };
126
126
  };
127
+ launchedCryptos?: Crypto[];
127
128
  }
@@ -15,6 +15,7 @@ exports.USD_BACKED_CRYPTOS = [
15
15
  crypto_1.Crypto.USDCStellar,
16
16
  crypto_1.Crypto.USDCBase,
17
17
  crypto_1.Crypto.USDCTempoBridged,
18
+ crypto_1.Crypto.USDCArc,
18
19
  crypto_1.Crypto.USDTPolygon,
19
20
  crypto_1.Crypto.USDTEthereum,
20
21
  crypto_1.Crypto.USDTTron,
@@ -34,6 +35,7 @@ exports.USDC_CRYPTOS = [
34
35
  crypto_1.Crypto.USDCStellar,
35
36
  crypto_1.Crypto.USDCBase,
36
37
  crypto_1.Crypto.USDCTempoBridged,
38
+ crypto_1.Crypto.USDCArc,
37
39
  ];
38
40
  exports.USDT_CRYPTOS = [
39
41
  crypto_1.Crypto.USDTPolygon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.2722",
3
+ "version": "1.0.2724",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",