@riocrypto/common 1.0.558 → 1.0.559

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(): "Ethereum" | "USDC (Ethereum)" | "USDC (Polygon)";
8
- getSymbol(): "USDC (Ethereum)" | "USDC (Polygon)" | "ETH";
9
- getGasSymbol(): "ETH" | "MATIC";
7
+ getName(): Crypto.BTC | "Ethereum" | "USDC (Ethereum)" | "USDC (Polygon)";
8
+ getSymbol(): Crypto.BTC | "USDC (Ethereum)" | "USDC (Polygon)" | "ETH";
9
+ getGasSymbol(): Crypto.BTC | "ETH" | "MATIC";
10
10
  getDescription(): string;
11
11
  }
@@ -0,0 +1,2 @@
1
+ import { Crypto } from "../types/crypto";
2
+ export declare const isValidCryptoAddress: (address: string, crypto: Crypto) => boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidCryptoAddress = void 0;
4
+ const crypto_1 = require("../types/crypto");
5
+ const isValidCryptoAddress = (address, crypto) => {
6
+ const bitcoinPattern = /^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$/;
7
+ const ethereumPattern = /^0x[a-fA-F0-9]{40}$/;
8
+ switch (crypto) {
9
+ case crypto_1.Crypto.BTC:
10
+ return bitcoinPattern.test(address);
11
+ case crypto_1.Crypto.ETH || crypto_1.Crypto.USDC || crypto_1.Crypto.USDCPolygon:
12
+ return ethereumPattern.test(address);
13
+ default:
14
+ return false;
15
+ }
16
+ };
17
+ exports.isValidCryptoAddress = isValidCryptoAddress;
package/build/index.d.ts CHANGED
@@ -143,4 +143,5 @@ export * from "./classes/PayoutMethodAsset";
143
143
  export * from "./classes/USStateAsset";
144
144
  export * from "./classes/WyrePaymentMethodAsset";
145
145
  export * from "./helpers/get-user-from-client-helper";
146
+ export * from "./helpers/validate-address";
146
147
  export * from "./clients/rio-client";
package/build/index.js CHANGED
@@ -159,4 +159,5 @@ __exportStar(require("./classes/PayoutMethodAsset"), exports);
159
159
  __exportStar(require("./classes/USStateAsset"), exports);
160
160
  __exportStar(require("./classes/WyrePaymentMethodAsset"), exports);
161
161
  __exportStar(require("./helpers/get-user-from-client-helper"), exports);
162
+ __exportStar(require("./helpers/validate-address"), exports);
162
163
  __exportStar(require("./clients/rio-client"), exports);
@@ -1,4 +1,5 @@
1
1
  export declare enum Crypto {
2
+ BTC = "BTC",
2
3
  ETH = "ETH",
3
4
  USDC = "USDC",
4
5
  USDCPolygon = "USDC_POLYGON"
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.Crypto = void 0;
6
6
  var Crypto;
7
7
  (function (Crypto) {
8
- // BTC = "BTC",
8
+ Crypto["BTC"] = "BTC";
9
9
  Crypto["ETH"] = "ETH";
10
10
  Crypto["USDC"] = "USDC";
11
11
  Crypto["USDCPolygon"] = "USDC_POLYGON";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.558",
3
+ "version": "1.0.559",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",