BlueWallet/class/wallet-gradient.ts

139 lines
5.2 KiB
TypeScript
Raw Normal View History

import { LegacyWallet } from './wallets/legacy-wallet';
import { HDSegwitP2SHWallet } from './wallets/hd-segwit-p2sh-wallet';
2023-11-05 21:16:49 +01:00
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';
2020-10-05 23:25:14 +02:00
import { MultisigHDWallet } from './wallets/multisig-hd-wallet';
import { HDAezeedWallet } from './wallets/hd-aezeed-wallet';
import { SLIP39LegacyP2PKHWallet, SLIP39SegwitP2SHWallet, SLIP39SegwitBech32Wallet } from './wallets/slip39-wallets';
2023-10-24 03:28:44 +02:00
import { useTheme } from '../components/themes';
2019-01-25 05:46:03 +01:00
export default class WalletGradient {
2023-11-05 21:16:49 +01:00
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 createWallet = () => {
const { colors } = useTheme();
return colors.lightButton;
};
2019-01-25 05:46:03 +01:00
2023-11-05 21:16:49 +01:00
static gradientsFor(type: string): string[] {
let gradient: string[];
2019-01-25 05:46:03 +01:00
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:
2019-01-25 05:46:03 +01:00
gradient = WalletGradient.hdLegacyP2PKHWallet;
break;
case HDLegacyBreadwalletWallet.type:
gradient = WalletGradient.hdLegacyBreadWallet;
break;
case HDSegwitP2SHWallet.type:
case SLIP39SegwitP2SHWallet.type:
2019-01-25 05:46:03 +01:00
gradient = WalletGradient.hdSegwitP2SHWallet;
break;
2019-06-01 22:44:39 +02:00
case HDSegwitBech32Wallet.type:
case HDSegwitElectrumSeedP2WPKHWallet.type:
case SLIP39SegwitBech32Wallet.type:
2019-06-01 22:44:39 +02:00
gradient = WalletGradient.hdSegwitBech32Wallet;
break;
case SegwitBech32Wallet.type:
gradient = WalletGradient.segwitBech32Wallet;
break;
2020-10-05 23:25:14 +02:00
case MultisigHDWallet.type:
gradient = WalletGradient.multisigHdWallet;
break;
case HDAezeedWallet.type:
gradient = WalletGradient.aezeedWallet;
break;
2023-11-05 21:16:49 +01:00
case LightningCustodianWallet.type:
gradient = WalletGradient.lightningCustodianWallet;
break;
2019-01-25 05:46:03 +01:00
default:
gradient = WalletGradient.defaultGradients;
break;
}
return gradient;
}
2023-11-05 21:16:49 +01:00
static linearGradientProps(type: string) {
let props: any;
2020-12-11 18:35:47 +01:00
switch (type) {
case MultisigHDWallet.type:
/* Example
2020-12-11 18:35:47 +01:00
props = { start: { x: 0, y: 0 } };
https://github.com/react-native-linear-gradient/react-native-linear-gradient
*/
break;
default:
break;
}
return props;
}
2023-11-05 21:16:49 +01:00
static headerColorFor(type: string): string {
let gradient: string[];
2019-01-25 05:46:03 +01:00
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:
2019-01-25 05:46:03 +01:00
gradient = WalletGradient.hdLegacyP2PKHWallet;
break;
case HDLegacyBreadwalletWallet.type:
gradient = WalletGradient.hdLegacyBreadWallet;
break;
case HDSegwitP2SHWallet.type:
case SLIP39SegwitP2SHWallet.type:
2019-01-25 05:46:03 +01:00
gradient = WalletGradient.hdSegwitP2SHWallet;
break;
2019-06-01 22:44:39 +02:00
case HDSegwitBech32Wallet.type:
case HDSegwitElectrumSeedP2WPKHWallet.type:
case SLIP39SegwitBech32Wallet.type:
2019-06-01 22:44:39 +02:00
gradient = WalletGradient.hdSegwitBech32Wallet;
break;
case SegwitBech32Wallet.type:
gradient = WalletGradient.segwitBech32Wallet;
break;
2020-10-05 23:25:14 +02:00
case MultisigHDWallet.type:
gradient = WalletGradient.multisigHdWallet;
break;
case HDAezeedWallet.type:
gradient = WalletGradient.aezeedWallet;
break;
2023-11-05 21:16:49 +01:00
case LightningCustodianWallet.type:
gradient = WalletGradient.lightningCustodianWallet;
break;
2019-01-25 05:46:03 +01:00
default:
gradient = WalletGradient.defaultGradients;
break;
}
return gradient[0];
}
}