UNPKG

chaingate

Version:

A complete TypeScript library for connecting to and making transactions on different blockchains

69 lines 2.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InvalidWallet = void 0; exports.isLocalWallet = isLocalWallet; exports.requireLocalWallet = requireLocalWallet; exports.isDerivationPathsWallet = isDerivationPathsWallet; exports.requireDerivationPathsSupport = requireDerivationPathsSupport; exports.isPrivateKeyWallet = isPrivateKeyWallet; exports.requirePrivateKeyWallet = requirePrivateKeyWallet; exports.isSeedWallet = isSeedWallet; exports.requireSeedWallet = requireSeedWallet; exports.isPhraseWallet = isPhraseWallet; exports.requirePhraseWallet = requirePhraseWallet; const HDWallet_1 = require("./Wallet/abstract/HDWallet/HDWallet"); const PrivateKeyWallet_1 = require("./Wallet/implementations/PrivateKeyWallet/PrivateKeyWallet"); const SeedWallet_1 = require("./Wallet/implementations/SeedWallet/SeedWallet"); const PhraseWallet_1 = require("./Wallet/implementations/PhraseWallet/PhraseWallet"); class InvalidWallet extends Error { constructor() { super('Wallet is invalid'); if (Error.captureStackTrace) Error.captureStackTrace(this, InvalidWallet); this.name = this.constructor.name; } } exports.InvalidWallet = InvalidWallet; // LocalWallet function isLocalWallet(wallet) { return (wallet instanceof PhraseWallet_1.PhraseWallet || wallet instanceof SeedWallet_1.SeedWallet || wallet instanceof PrivateKeyWallet_1.PrivateKeyWallet); } function requireLocalWallet(wallet) { if (!isLocalWallet(wallet)) throw new InvalidWallet(); } // HDWallet function isDerivationPathsWallet(wallet) { return wallet instanceof HDWallet_1.HDWallet; } function requireDerivationPathsSupport(wallet) { if (!isDerivationPathsWallet(wallet)) throw new InvalidWallet(); } // ImportedPrivateKey function isPrivateKeyWallet(wallet) { return wallet instanceof PrivateKeyWallet_1.PrivateKeyWallet; } function requirePrivateKeyWallet(wallet) { if (!isPrivateKeyWallet(wallet)) throw new InvalidWallet(); } // Seed wallet function isSeedWallet(wallet) { return wallet instanceof SeedWallet_1.SeedWallet; } function requireSeedWallet(wallet) { if (!isSeedWallet(wallet)) throw new InvalidWallet(); } // Phrase wallet function isPhraseWallet(wallet) { return wallet instanceof PhraseWallet_1.PhraseWallet; } function requirePhraseWallet(wallet) { if (!isPhraseWallet(wallet)) throw new InvalidWallet(); } //# sourceMappingURL=CastWallet.js.map