@riocrypto/common 1.0.2656 → 1.0.2659

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)" | "EURC (Ethereum)" | "EURC (Solana)" | "EURC (Base)" | "USDT (Polygon)" | "USDT (Ethereum)" | "USDT (Tron)" | "USDT (BSC)" | "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)" | "EURC (Ethereum)" | "EURC (Solana)" | "EURC (Base)" | "USDT (Polygon)" | "USDT (Ethereum)" | "USDT (Tron)" | "USDT (BSC)" | "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";
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)" | "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)" | "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";
10
10
  getDescription(): string;
11
11
  }
@@ -77,6 +77,9 @@ class CryptoAsset extends Asset_1.Asset {
77
77
  else if (this.rawSymbol === crypto_1.Crypto.USDCBase) {
78
78
  return "USDC (Base)";
79
79
  }
80
+ else if (this.rawSymbol === crypto_1.Crypto.USDCTempoBridged) {
81
+ return "USDC.e (Tempo)";
82
+ }
80
83
  else if (this.rawSymbol === crypto_1.Crypto.EURCEthereum) {
81
84
  return "EURC (Ethereum)";
82
85
  }
@@ -142,6 +145,9 @@ class CryptoAsset extends Asset_1.Asset {
142
145
  else if (this.rawSymbol === crypto_1.Crypto.USDCBase) {
143
146
  return "USDC (Base)";
144
147
  }
148
+ else if (this.rawSymbol === crypto_1.Crypto.USDCTempoBridged) {
149
+ return "USDC.e (Tempo)";
150
+ }
145
151
  else if (this.rawSymbol === crypto_1.Crypto.EURCEthereum) {
146
152
  return "EURC (Ethereum)";
147
153
  }
@@ -198,6 +204,9 @@ class CryptoAsset extends Asset_1.Asset {
198
204
  else if (this.rawSymbol === crypto_1.Crypto.USDCBase) {
199
205
  return "BASECHAIN_ETH";
200
206
  }
207
+ else if (this.rawSymbol === crypto_1.Crypto.USDCTempoBridged) {
208
+ return "TEMPO";
209
+ }
201
210
  else if (this.rawSymbol === crypto_1.Crypto.USDC) {
202
211
  return "ETH";
203
212
  }
@@ -258,6 +267,9 @@ class CryptoAsset extends Asset_1.Asset {
258
267
  else if (this.rawSymbol === crypto_1.Crypto.USDCBase) {
259
268
  return "USDC on the Base chain.";
260
269
  }
270
+ else if (this.rawSymbol === crypto_1.Crypto.USDCTempoBridged) {
271
+ return "Bridged USDC on the Tempo chain.";
272
+ }
261
273
  else if (this.rawSymbol === crypto_1.Crypto.EURCEthereum) {
262
274
  return "EURC on the Ethereum chain.";
263
275
  }
@@ -0,0 +1,10 @@
1
+ import { CustomError } from "./custom-error";
2
+ export declare class UsOperationsDisabledError extends CustomError {
3
+ statusCode: number;
4
+ internalCode: number;
5
+ constructor();
6
+ serializeErrors(): {
7
+ code: number;
8
+ message: string;
9
+ }[];
10
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UsOperationsDisabledError = void 0;
4
+ const custom_error_1 = require("./custom-error");
5
+ class UsOperationsDisabledError extends custom_error_1.CustomError {
6
+ constructor() {
7
+ super("US operations are temporarily unavailable");
8
+ this.statusCode = 403;
9
+ this.internalCode = 44;
10
+ Object.setPrototypeOf(this, UsOperationsDisabledError.prototype);
11
+ }
12
+ serializeErrors() {
13
+ return [
14
+ {
15
+ code: this.internalCode,
16
+ message: "US operations are temporarily unavailable",
17
+ },
18
+ ];
19
+ }
20
+ }
21
+ exports.UsOperationsDisabledError = UsOperationsDisabledError;
@@ -33,6 +33,9 @@ const formatTransactionHash = (hash, crypto) => {
33
33
  else if ([crypto_1.Crypto.USDCBase].includes(crypto)) {
34
34
  return `https://basescan.org/tx/${hash}`;
35
35
  }
36
+ else if ([crypto_1.Crypto.USDCTempoBridged].includes(crypto)) {
37
+ return `https://explore.tempo.xyz/tx/${hash}`;
38
+ }
36
39
  else {
37
40
  return "N/A";
38
41
  }
@@ -33,6 +33,8 @@ const getAddressForTesting = (crypto) => {
33
33
  };
34
34
  case crypto_1.Crypto.USDCBase:
35
35
  return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
36
+ case crypto_1.Crypto.USDCTempoBridged:
37
+ return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
36
38
  default:
37
39
  throw new Error(`Unsupported crypto: ${crypto}`);
38
40
  }
@@ -0,0 +1,17 @@
1
+ import { Country } from "../types/country";
2
+ import { CountryOfOrigin } from "../types/country-of-origin";
3
+ /**
4
+ * Temporary kill switch for US operations while the commercial agreement with
5
+ * our US partner (Bridge) is paused. When this is `false`, users cannot create
6
+ * new US business (users, quotes, orders, bank accounts, transfers) and the US
7
+ * is hidden from country selectors in the UI. Read operations are unaffected.
8
+ *
9
+ * Set back to `true` to restore US support across the platform.
10
+ */
11
+ export declare const US_OPERATIONS_ENABLED = false;
12
+ export declare const isUsCountry: (country?: Country | CountryOfOrigin | string | null) => boolean;
13
+ /**
14
+ * Throws when a write operation targets the US while US operations are disabled.
15
+ * No-op for non-US countries and when US operations are enabled.
16
+ */
17
+ export declare const assertUsOperationsEnabled: (country?: Country | CountryOfOrigin | string | null) => void;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertUsOperationsEnabled = exports.isUsCountry = exports.US_OPERATIONS_ENABLED = void 0;
4
+ const country_1 = require("../types/country");
5
+ const us_operations_disabled_error_1 = require("../errors/us-operations-disabled-error");
6
+ /**
7
+ * Temporary kill switch for US operations while the commercial agreement with
8
+ * our US partner (Bridge) is paused. When this is `false`, users cannot create
9
+ * new US business (users, quotes, orders, bank accounts, transfers) and the US
10
+ * is hidden from country selectors in the UI. Read operations are unaffected.
11
+ *
12
+ * Set back to `true` to restore US support across the platform.
13
+ */
14
+ exports.US_OPERATIONS_ENABLED = false;
15
+ const isUsCountry = (country) => country === country_1.Country.UnitedStates;
16
+ exports.isUsCountry = isUsCountry;
17
+ /**
18
+ * Throws when a write operation targets the US while US operations are disabled.
19
+ * No-op for non-US countries and when US operations are enabled.
20
+ */
21
+ const assertUsOperationsEnabled = (country) => {
22
+ if (!exports.US_OPERATIONS_ENABLED && (0, exports.isUsCountry)(country)) {
23
+ throw new us_operations_disabled_error_1.UsOperationsDisabledError();
24
+ }
25
+ };
26
+ exports.assertUsOperationsEnabled = assertUsOperationsEnabled;
@@ -19,6 +19,7 @@ const isValidCryptoAddress = (address, crypto) => {
19
19
  crypto_1.Crypto.USDC ||
20
20
  crypto_1.Crypto.USDCPolygon ||
21
21
  crypto_1.Crypto.USDCBase ||
22
+ crypto_1.Crypto.USDCTempoBridged ||
22
23
  crypto_1.Crypto.USDTTron ||
23
24
  crypto_1.Crypto.USDTPolygon ||
24
25
  crypto_1.Crypto.USDTEthereum ||
package/build/index.d.ts CHANGED
@@ -40,6 +40,7 @@ export * from "./errors/expired-quote-error";
40
40
  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
+ export * from "./errors/us-operations-disabled-error";
43
44
  export * from "./events/base-listener";
44
45
  export * from "./events/base-publisher";
45
46
  export * from "./events/subjects";
@@ -561,5 +562,6 @@ export * from "./helpers/get-two-way-settlement-date-offset-from-date";
561
562
  export * from "./helpers/get-two-way-settlement-date";
562
563
  export * from "./helpers/get-order-status-rankings";
563
564
  export * from "./helpers/get-lower-order-statuses";
565
+ export * from "./helpers/is-us-operations-enabled";
564
566
  export * from "./constants/mexico-fiscal-regimens";
565
567
  export * from "./constants/mexican-banks";
package/build/index.js CHANGED
@@ -56,6 +56,7 @@ __exportStar(require("./errors/expired-quote-error"), exports);
56
56
  __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
+ __exportStar(require("./errors/us-operations-disabled-error"), exports);
59
60
  __exportStar(require("./events/base-listener"), exports);
60
61
  __exportStar(require("./events/base-publisher"), exports);
61
62
  __exportStar(require("./events/subjects"), exports);
@@ -577,5 +578,6 @@ __exportStar(require("./helpers/get-two-way-settlement-date-offset-from-date"),
577
578
  __exportStar(require("./helpers/get-two-way-settlement-date"), exports);
578
579
  __exportStar(require("./helpers/get-order-status-rankings"), exports);
579
580
  __exportStar(require("./helpers/get-lower-order-statuses"), exports);
581
+ __exportStar(require("./helpers/is-us-operations-enabled"), exports);
580
582
  __exportStar(require("./constants/mexico-fiscal-regimens"), exports);
581
583
  __exportStar(require("./constants/mexican-banks"), exports);
@@ -3,6 +3,7 @@ export declare enum Blockchain {
3
3
  Ethereum = "ethereum",
4
4
  Solana = "solana",
5
5
  Stellar = "stellar",
6
+ Tempo = "tempo",
6
7
  Tron = "tron",
7
8
  BSC = "bsc",
8
9
  Base = "base"
@@ -7,6 +7,7 @@ var Blockchain;
7
7
  Blockchain["Ethereum"] = "ethereum";
8
8
  Blockchain["Solana"] = "solana";
9
9
  Blockchain["Stellar"] = "stellar";
10
+ Blockchain["Tempo"] = "tempo";
10
11
  Blockchain["Tron"] = "tron";
11
12
  Blockchain["BSC"] = "bsc";
12
13
  Blockchain["Base"] = "base";
@@ -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
+ USDCTempoBridged = "USDCE_TEMPO_MXYR",
11
12
  EURCEthereum = "EUROC_ETH_F5NG",
12
13
  EURCSolana = "EURC_SOL",
13
14
  EURCBase = "EURC_B609K9QB_Y213",
@@ -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["USDCTempoBridged"] = "USDCE_TEMPO_MXYR";
15
16
  Crypto["EURCEthereum"] = "EUROC_ETH_F5NG";
16
17
  Crypto["EURCSolana"] = "EURC_SOL";
17
18
  Crypto["EURCBase"] = "EURC_B609K9QB_Y213";
@@ -3,6 +3,7 @@ export declare enum CurrencyWithCountry {
3
3
  USDCSolana = "SOL_USDC_PTHX",
4
4
  USDCStellar = "XLM_USDC_5F3T",
5
5
  USDCBase = "USDC_BASECHAIN_ETH_5I5C",
6
+ USDCTempoBridged = "USDCE_TEMPO_MXYR",
6
7
  EURCEthereum = "EUROC_ETH_F5NG",
7
8
  EURCSolana = "EURC_SOL",
8
9
  EURCBase = "EURC_B609K9QB_Y213",
@@ -7,6 +7,7 @@ var CurrencyWithCountry;
7
7
  CurrencyWithCountry["USDCSolana"] = "SOL_USDC_PTHX";
8
8
  CurrencyWithCountry["USDCStellar"] = "XLM_USDC_5F3T";
9
9
  CurrencyWithCountry["USDCBase"] = "USDC_BASECHAIN_ETH_5I5C";
10
+ CurrencyWithCountry["USDCTempoBridged"] = "USDCE_TEMPO_MXYR";
10
11
  CurrencyWithCountry["EURCEthereum"] = "EUROC_ETH_F5NG";
11
12
  CurrencyWithCountry["EURCSolana"] = "EURC_SOL";
12
13
  CurrencyWithCountry["EURCBase"] = "EURC_B609K9QB_Y213";
@@ -14,6 +14,7 @@ exports.USD_BACKED_CRYPTOS = [
14
14
  crypto_1.Crypto.USDCSolana,
15
15
  crypto_1.Crypto.USDCStellar,
16
16
  crypto_1.Crypto.USDCBase,
17
+ crypto_1.Crypto.USDCTempoBridged,
17
18
  crypto_1.Crypto.USDTPolygon,
18
19
  crypto_1.Crypto.USDTEthereum,
19
20
  crypto_1.Crypto.USDTTron,
@@ -31,6 +32,7 @@ exports.USDC_CRYPTOS = [
31
32
  crypto_1.Crypto.USDCSolana,
32
33
  crypto_1.Crypto.USDCStellar,
33
34
  crypto_1.Crypto.USDCBase,
35
+ crypto_1.Crypto.USDCTempoBridged,
34
36
  ];
35
37
  exports.USDT_CRYPTOS = [
36
38
  crypto_1.Crypto.USDTPolygon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.2656",
3
+ "version": "1.0.2659",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",