@riocrypto/common 1.0.2647 → 1.0.2649

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 | "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 | "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 | "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)" | "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";
10
10
  getDescription(): string;
11
11
  }
package/build/index.d.ts CHANGED
@@ -379,6 +379,7 @@ export * from "./types/internal-transfer-type";
379
379
  export * from "./types/treasury-provider";
380
380
  export * from "./types/internal-transfer-origin-status";
381
381
  export * from "./types/internal-transfer-destination-status";
382
+ export * from "./types/map-imported-transfer-status";
382
383
  export * from "./types/import-order-data";
383
384
  export * from "./types/internal-trade";
384
385
  export * from "./types/internal-trade-status";
package/build/index.js CHANGED
@@ -395,6 +395,7 @@ __exportStar(require("./types/internal-transfer-type"), exports);
395
395
  __exportStar(require("./types/treasury-provider"), exports);
396
396
  __exportStar(require("./types/internal-transfer-origin-status"), exports);
397
397
  __exportStar(require("./types/internal-transfer-destination-status"), exports);
398
+ __exportStar(require("./types/map-imported-transfer-status"), exports);
398
399
  __exportStar(require("./types/import-order-data"), exports);
399
400
  __exportStar(require("./types/internal-trade"), exports);
400
401
  __exportStar(require("./types/internal-trade-status"), exports);
@@ -19,5 +19,6 @@ export declare enum Crypto {
19
19
  TRON = "TRX",
20
20
  POL = "MATIC_POLYGON",
21
21
  XLM = "XLM",
22
- BNB = "BNB_BSC"
22
+ BNB = "BNB_BSC",
23
+ Other = "OTHER_CRYPTO"
23
24
  }
@@ -24,4 +24,5 @@ var Crypto;
24
24
  Crypto["POL"] = "MATIC_POLYGON";
25
25
  Crypto["XLM"] = "XLM";
26
26
  Crypto["BNB"] = "BNB_BSC";
27
+ Crypto["Other"] = "OTHER_CRYPTO";
27
28
  })(Crypto = exports.Crypto || (exports.Crypto = {}));
@@ -2,5 +2,6 @@ export declare enum Fiat {
2
2
  USD = "USD",
3
3
  MXN = "MXN",
4
4
  PEN = "PEN",
5
- COP = "COP"
5
+ COP = "COP",
6
+ Other = "OTHER_FIAT"
6
7
  }
@@ -8,4 +8,5 @@ var Fiat;
8
8
  Fiat["MXN"] = "MXN";
9
9
  Fiat["PEN"] = "PEN";
10
10
  Fiat["COP"] = "COP";
11
+ Fiat["Other"] = "OTHER_FIAT";
11
12
  })(Fiat = exports.Fiat || (exports.Fiat = {}));
@@ -2,5 +2,8 @@ export declare enum InternalTransferDestinationStatus {
2
2
  AwaitingFunds = "awaitingFunds",
3
3
  FundsCreditedButWithdrawalLocked = "fundsCreditedButWithdrawalLocked",
4
4
  Complete = "complete",
5
- Failed = "failed"
5
+ Failed = "failed",
6
+ Returned = "returned",
7
+ Cancelled = "cancelled",
8
+ Other = "other"
6
9
  }
@@ -7,4 +7,9 @@ var InternalTransferDestinationStatus;
7
7
  InternalTransferDestinationStatus["FundsCreditedButWithdrawalLocked"] = "fundsCreditedButWithdrawalLocked";
8
8
  InternalTransferDestinationStatus["Complete"] = "complete";
9
9
  InternalTransferDestinationStatus["Failed"] = "failed";
10
+ InternalTransferDestinationStatus["Returned"] = "returned";
11
+ InternalTransferDestinationStatus["Cancelled"] = "cancelled";
12
+ // A provider-native status that does not map to any of the above. The raw
13
+ // provider status is stored on destination.otherStatus and shown in a tooltip.
14
+ InternalTransferDestinationStatus["Other"] = "other";
10
15
  })(InternalTransferDestinationStatus = exports.InternalTransferDestinationStatus || (exports.InternalTransferDestinationStatus = {}));
@@ -2,5 +2,8 @@ export declare enum InternalTransferOriginStatus {
2
2
  Pending = "pending",
3
3
  SendingFunds = "sendingFunds",
4
4
  Complete = "complete",
5
- Failed = "failed"
5
+ Failed = "failed",
6
+ Returned = "returned",
7
+ Cancelled = "cancelled",
8
+ Other = "other"
6
9
  }
@@ -7,4 +7,9 @@ var InternalTransferOriginStatus;
7
7
  InternalTransferOriginStatus["SendingFunds"] = "sendingFunds";
8
8
  InternalTransferOriginStatus["Complete"] = "complete";
9
9
  InternalTransferOriginStatus["Failed"] = "failed";
10
+ InternalTransferOriginStatus["Returned"] = "returned";
11
+ InternalTransferOriginStatus["Cancelled"] = "cancelled";
12
+ // A provider-native status that does not map to any of the above. The raw
13
+ // provider status is stored on origin.otherStatus and shown in a tooltip.
14
+ InternalTransferOriginStatus["Other"] = "other";
10
15
  })(InternalTransferOriginStatus = exports.InternalTransferOriginStatus || (exports.InternalTransferOriginStatus = {}));
@@ -4,6 +4,13 @@ import { Fiat } from "./fiat";
4
4
  import { Crypto } from "./crypto";
5
5
  import { InternalTransferOriginStatus } from "./internal-transfer-origin-status";
6
6
  import { InternalTransferDestinationStatus } from "./internal-transfer-destination-status";
7
+ export interface OtherProviderMetadata {
8
+ blockchainAddress?: string;
9
+ memo?: string;
10
+ bankAccountInfo?: string;
11
+ bankName?: string;
12
+ label?: string;
13
+ }
7
14
  export interface InternalTransfer {
8
15
  id: string;
9
16
  adminId: string;
@@ -12,6 +19,8 @@ export interface InternalTransfer {
12
19
  transferType: InternalTransferType;
13
20
  amount: number;
14
21
  currency: Fiat | Crypto;
22
+ otherCurrencyCode?: string;
23
+ isImported?: boolean;
15
24
  blockchainTxId?: string;
16
25
  reference?: string;
17
26
  SPEITrackingNumber?: string;
@@ -20,12 +29,16 @@ export interface InternalTransfer {
20
29
  provider: TreasuryProvider;
21
30
  amountSent: number;
22
31
  status: InternalTransferOriginStatus;
32
+ otherStatus?: string;
33
+ otherProviderMetadata?: OtherProviderMetadata;
23
34
  };
24
35
  destination: {
25
36
  provider: TreasuryProvider;
26
37
  amountReceived: number;
27
38
  status: InternalTransferDestinationStatus;
39
+ otherStatus?: string;
28
40
  notifyWhenCredited?: boolean;
29
41
  notifyWhenCompleted?: boolean;
42
+ otherProviderMetadata?: OtherProviderMetadata;
30
43
  };
31
44
  }
@@ -0,0 +1,4 @@
1
+ import { InternalTransferOriginStatus } from "./internal-transfer-origin-status";
2
+ import { InternalTransferDestinationStatus } from "./internal-transfer-destination-status";
3
+ export declare const mapImportedOriginStatus: (raw?: string) => InternalTransferOriginStatus;
4
+ export declare const mapImportedDestinationStatus: (raw?: string) => InternalTransferDestinationStatus;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapImportedDestinationStatus = exports.mapImportedOriginStatus = void 0;
4
+ const internal_transfer_origin_status_1 = require("./internal-transfer-origin-status");
5
+ const internal_transfer_destination_status_1 = require("./internal-transfer-destination-status");
6
+ const normalize = (raw) => raw.toLowerCase().replace(/[\s._-]/g, "");
7
+ // Ordered so more specific categories win before the broad "complete" tokens.
8
+ const CATEGORY_TOKENS = [
9
+ {
10
+ category: "returned",
11
+ tokens: [
12
+ "returned",
13
+ "return",
14
+ "refunded",
15
+ "refund",
16
+ "reversed",
17
+ "reversal",
18
+ "devuelta",
19
+ "retornada",
20
+ ],
21
+ },
22
+ {
23
+ category: "cancelled",
24
+ tokens: ["cancelled", "canceled", "cancel", "void", "voided", "cancelada"],
25
+ },
26
+ {
27
+ category: "failed",
28
+ tokens: [
29
+ "failed",
30
+ "failure",
31
+ "fail",
32
+ "error",
33
+ "rejected",
34
+ "declined",
35
+ "denied",
36
+ "expired",
37
+ ],
38
+ },
39
+ {
40
+ category: "complete",
41
+ tokens: [
42
+ "complete",
43
+ "completed",
44
+ "success",
45
+ "successful",
46
+ "settled",
47
+ "confirmed",
48
+ "credited",
49
+ "posted",
50
+ "filled",
51
+ "paid",
52
+ "done",
53
+ ],
54
+ },
55
+ ];
56
+ const categorize = (raw) => {
57
+ const normalized = normalize(raw || "");
58
+ if (!normalized) {
59
+ return "other";
60
+ }
61
+ for (const { category, tokens } of CATEGORY_TOKENS) {
62
+ if (tokens.some((token) => normalized.includes(token))) {
63
+ return category;
64
+ }
65
+ }
66
+ return "other";
67
+ };
68
+ // Maps a provider-native status to the origin status we persist on an imported
69
+ // InternalTransfer. Unrecognised statuses become Other; store the raw value on
70
+ // origin.otherStatus so the UI can display it.
71
+ const mapImportedOriginStatus = (raw) => {
72
+ switch (categorize(raw)) {
73
+ case "complete":
74
+ return internal_transfer_origin_status_1.InternalTransferOriginStatus.Complete;
75
+ case "failed":
76
+ return internal_transfer_origin_status_1.InternalTransferOriginStatus.Failed;
77
+ case "returned":
78
+ return internal_transfer_origin_status_1.InternalTransferOriginStatus.Returned;
79
+ case "cancelled":
80
+ return internal_transfer_origin_status_1.InternalTransferOriginStatus.Cancelled;
81
+ default:
82
+ return internal_transfer_origin_status_1.InternalTransferOriginStatus.Other;
83
+ }
84
+ };
85
+ exports.mapImportedOriginStatus = mapImportedOriginStatus;
86
+ // Maps a provider-native status to the destination status we persist on an
87
+ // imported InternalTransfer. Unrecognised statuses become Other; store the raw
88
+ // value on destination.otherStatus so the UI can display it.
89
+ const mapImportedDestinationStatus = (raw) => {
90
+ switch (categorize(raw)) {
91
+ case "complete":
92
+ return internal_transfer_destination_status_1.InternalTransferDestinationStatus.Complete;
93
+ case "failed":
94
+ return internal_transfer_destination_status_1.InternalTransferDestinationStatus.Failed;
95
+ case "returned":
96
+ return internal_transfer_destination_status_1.InternalTransferDestinationStatus.Returned;
97
+ case "cancelled":
98
+ return internal_transfer_destination_status_1.InternalTransferDestinationStatus.Cancelled;
99
+ default:
100
+ return internal_transfer_destination_status_1.InternalTransferDestinationStatus.Other;
101
+ }
102
+ };
103
+ exports.mapImportedDestinationStatus = mapImportedDestinationStatus;
@@ -21,5 +21,6 @@ export declare enum TreasuryProvider {
21
21
  BancoAzteca = "bancoAzteca",
22
22
  TransnetworkPaymentAccount = "transnetworkPaymentAccount",
23
23
  StoneXPaymentAccount = "stoneXPaymentAccount",
24
- Alfin = "alfin"
24
+ Alfin = "alfin",
25
+ Other = "other"
25
26
  }
@@ -26,4 +26,5 @@ var TreasuryProvider;
26
26
  TreasuryProvider["TransnetworkPaymentAccount"] = "transnetworkPaymentAccount";
27
27
  TreasuryProvider["StoneXPaymentAccount"] = "stoneXPaymentAccount";
28
28
  TreasuryProvider["Alfin"] = "alfin";
29
+ TreasuryProvider["Other"] = "other";
29
30
  })(TreasuryProvider = exports.TreasuryProvider || (exports.TreasuryProvider = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.2647",
3
+ "version": "1.0.2649",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",