BlueWallet/class/wallet-gradient.ts
2023-11-05 16:16:49 -04:00

147 lines
5.5 KiB
TypeScript

import { LegacyWallet } from './wallets/legacy-wallet';
import { HDSegwitP2SHWallet } from './wallets/hd-segwit-p2sh-wallet';
import { LightningCustodianWallet } from './wallets/lightning-custodian-wallet'; // Missing import
import { HDLegacyBreadwalletWallet } from './wallets/hd-legacy-breadwallet-wallet';
import { HDLegacyP2PKHWallet } from './wallets/hd-legacy-p2pkh-wallet';
import { WatchOnlyWallet } from './wallets/watch-only-wallet';
import { HDSegwitBech32Wallet } from './wallets/hd-segwit-bech32-wallet';
import { SegwitBech32Wallet } from './wallets/segwit-bech32-wallet';
import { HDLegacyElectrumSeedP2PKHWallet } from './wallets/hd-legacy-electrum-seed-p2pkh-wallet';
import { HDSegwitElectrumSeedP2WPKHWallet } from './wallets/hd-segwit-electrum-seed-p2wpkh-wallet';
import { MultisigHDWallet } from './wallets/multisig-hd-wallet';
import { HDAezeedWallet } from './wallets/hd-aezeed-wallet';
import { LightningLdkWallet } from './wallets/lightning-ldk-wallet';
import { SLIP39LegacyP2PKHWallet, SLIP39SegwitP2SHWallet, SLIP39SegwitBech32Wallet } from './wallets/slip39-wallets';
import { useTheme } from '../components/themes';
export default class WalletGradient {
static hdSegwitP2SHWallet: string[] = ['#007AFF', '#0040FF'];
static hdSegwitBech32Wallet: string[] = ['#6CD9FC', '#44BEE5'];
static segwitBech32Wallet: string[] = ['#6CD9FC', '#44BEE5'];
static watchOnlyWallet: string[] = ['#474646', '#282828'];
static legacyWallet: string[] = ['#37E8C0', '#15BE98'];
static hdLegacyP2PKHWallet: string[] = ['#FD7478', '#E73B40'];
static hdLegacyBreadWallet: string[] = ['#fe6381', '#f99c42'];
static multisigHdWallet: string[] = ['#1ce6eb', '#296fc5', '#3500A2'];
static defaultGradients: string[] = ['#B770F6', '#9013FE'];
static lightningCustodianWallet: string[] = ['#F1AA07', '#FD7E37']; // Corrected property with missing colors
static aezeedWallet: string[] = ['#8584FF', '#5351FB'];
static ldkWallet: string[] = ['#8584FF', '#5351FB'];
static createWallet = () => {
const { colors } = useTheme();
return colors.lightButton;
};
static gradientsFor(type: string): string[] {
let gradient: string[];
switch (type) {
case WatchOnlyWallet.type:
gradient = WalletGradient.watchOnlyWallet;
break;
case LegacyWallet.type:
gradient = WalletGradient.legacyWallet;
break;
case HDLegacyP2PKHWallet.type:
case HDLegacyElectrumSeedP2PKHWallet.type:
case SLIP39LegacyP2PKHWallet.type:
gradient = WalletGradient.hdLegacyP2PKHWallet;
break;
case HDLegacyBreadwalletWallet.type:
gradient = WalletGradient.hdLegacyBreadWallet;
break;
case HDSegwitP2SHWallet.type:
case SLIP39SegwitP2SHWallet.type:
gradient = WalletGradient.hdSegwitP2SHWallet;
break;
case HDSegwitBech32Wallet.type:
case HDSegwitElectrumSeedP2WPKHWallet.type:
case SLIP39SegwitBech32Wallet.type:
gradient = WalletGradient.hdSegwitBech32Wallet;
break;
case SegwitBech32Wallet.type:
gradient = WalletGradient.segwitBech32Wallet;
break;
case MultisigHDWallet.type:
gradient = WalletGradient.multisigHdWallet;
break;
case HDAezeedWallet.type:
gradient = WalletGradient.aezeedWallet;
break;
case LightningLdkWallet.type:
gradient = WalletGradient.ldkWallet;
break;
case LightningCustodianWallet.type:
gradient = WalletGradient.lightningCustodianWallet;
break;
default:
gradient = WalletGradient.defaultGradients;
break;
}
return gradient;
}
static linearGradientProps(type: string) {
let props: any;
switch (type) {
case MultisigHDWallet.type:
/* Example
props = { start: { x: 0, y: 0 } };
https://github.com/react-native-linear-gradient/react-native-linear-gradient
*/
break;
default:
break;
}
return props;
}
static headerColorFor(type: string): string {
let gradient: string[];
switch (type) {
case WatchOnlyWallet.type:
gradient = WalletGradient.watchOnlyWallet;
break;
case LegacyWallet.type:
gradient = WalletGradient.legacyWallet;
break;
case HDLegacyP2PKHWallet.type:
case HDLegacyElectrumSeedP2PKHWallet.type:
case SLIP39LegacyP2PKHWallet.type:
gradient = WalletGradient.hdLegacyP2PKHWallet;
break;
case HDLegacyBreadwalletWallet.type:
gradient = WalletGradient.hdLegacyBreadWallet;
break;
case HDSegwitP2SHWallet.type:
case SLIP39SegwitP2SHWallet.type:
gradient = WalletGradient.hdSegwitP2SHWallet;
break;
case HDSegwitBech32Wallet.type:
case HDSegwitElectrumSeedP2WPKHWallet.type:
case SLIP39SegwitBech32Wallet.type:
gradient = WalletGradient.hdSegwitBech32Wallet;
break;
case SegwitBech32Wallet.type:
gradient = WalletGradient.segwitBech32Wallet;
break;
case MultisigHDWallet.type:
gradient = WalletGradient.multisigHdWallet;
break;
case HDAezeedWallet.type:
gradient = WalletGradient.aezeedWallet;
break;
case LightningLdkWallet.type:
gradient = WalletGradient.ldkWallet;
break;
case LightningCustodianWallet.type:
gradient = WalletGradient.lightningCustodianWallet;
break;
default:
gradient = WalletGradient.defaultGradients;
break;
}
return gradient[0];
}
}