Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove unused type guard typings #550

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 24 additions & 34 deletions packages/hdwallet-core/src/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
import _ from "lodash";

import { BinanceWallet, BinanceWalletInfo } from "./binance";
import { BTCInputScriptType, BTCWallet, BTCWalletInfo } from "./bitcoin";
import { CosmosWallet, CosmosWalletInfo } from "./cosmos";
import { DebugLinkWallet } from "./debuglink";
import { EosWallet, EosWalletInfo } from "./eos";
import { ETHWallet, ETHWalletInfo } from "./ethereum";
import { FioWallet, FioWalletInfo } from "./fio";
import { KavaWallet, KavaWalletInfo } from "./kava";
import { OsmosisWallet, OsmosisWalletInfo } from "./osmosis";
import { RippleWallet, RippleWalletInfo } from "./ripple";
import { SecretWallet, SecretWalletInfo } from "./secret";
import { TerraWallet, TerraWalletInfo } from "./terra";
import { ThorchainWallet, ThorchainWalletInfo } from "./thorchain";
import { CosmosWallet } from "./cosmos";
import { OsmosisWallet } from "./osmosis";
import { Transport } from "./transport";

export type BIP32Path = Array<number>;
Expand Down Expand Up @@ -125,99 +115,99 @@ export function infoBTC(info: HDWalletInfo): info is BTCWalletInfo {
return _.isObject(info) && (info as any)._supportsBTCInfo;
}

export function supportsETH(wallet: HDWallet): wallet is ETHWallet {
export function supportsETH(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsETH;
}

export function infoETH(info: HDWalletInfo): info is ETHWalletInfo {
export function infoETH(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsETHInfo;
}

export function supportsCosmos(wallet: HDWallet): wallet is CosmosWallet {
return _.isObject(wallet) && (wallet as any)._supportsCosmos;
}

export function supportsEthSwitchChain(wallet: HDWallet): wallet is ETHWallet {
export function supportsEthSwitchChain(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsEthSwitchChain;
}

export function infoCosmos(info: HDWalletInfo): info is CosmosWalletInfo {
export function infoCosmos(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsCosmosInfo;
}

export function supportsOsmosis(wallet: HDWallet): wallet is OsmosisWallet {
return _.isObject(wallet) && (wallet as any)._supportsOsmosis;
}

export function infoOsmosis(info: HDWalletInfo): info is OsmosisWalletInfo {
export function infoOsmosis(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsOsmosisInfo;
}

export function supportsThorchain(wallet: HDWallet): wallet is ThorchainWallet {
export function supportsThorchain(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsThorchain;
}

export function infoThorchain(info: HDWalletInfo): info is ThorchainWalletInfo {
export function infoThorchain(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsThorchainInfo;
}

export function supportsEos(wallet: HDWallet): wallet is EosWallet {
export function supportsEos(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsEos;
}

export function infoEos(info: HDWalletInfo): info is EosWalletInfo {
export function infoEos(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsEosInfo;
}

export function supportsFio(wallet: HDWallet): wallet is FioWallet {
export function supportsFio(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsFio;
}

export function infoFio(info: HDWalletInfo): info is FioWalletInfo {
export function infoFio(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsFioInfo;
}

export function supportsSecret(wallet: HDWallet): wallet is SecretWallet {
export function supportsSecret(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsSecret;
}

export function infoSecret(info: HDWalletInfo): info is SecretWalletInfo {
export function infoSecret(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsSecretInfo;
}

export function supportsTerra(wallet: HDWallet): wallet is TerraWallet {
export function supportsTerra(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsTerra;
}

export function infoTerra(info: HDWalletInfo): info is TerraWalletInfo {
export function infoTerra(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsTerraInfo;
}

export function supportsKava(wallet: HDWallet): wallet is KavaWallet {
export function supportsKava(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsKava;
}

export function infoKava(info: HDWalletInfo): info is KavaWalletInfo {
export function infoKava(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsKavaInfo;
}

export function supportsRipple(wallet: HDWallet): wallet is RippleWallet {
export function supportsRipple(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsRipple;
}

export function infoRipple(info: HDWalletInfo): info is RippleWalletInfo {
export function infoRipple(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsRippleInfo;
}

export function supportsBinance(wallet: HDWallet): wallet is BinanceWallet {
export function supportsBinance(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsBinance;
}

export function infoBinance(info: HDWalletInfo): info is BinanceWalletInfo {
export function infoBinance(info: HDWalletInfo) {
return _.isObject(info) && (info as any)._supportsBinanceInfo;
}

export function supportsDebugLink(wallet: HDWallet): wallet is DebugLinkWallet {
export function supportsDebugLink(wallet: HDWallet) {
return _.isObject(wallet) && (wallet as any)._supportsDebugLink;
}

Expand Down