BlueWallet/class/wallet-gradient.js

129 lines
4.5 KiB
JavaScript
Raw Normal View History

import { LegacyWallet } from './wallets/legacy-wallet';
import { HDSegwitP2SHWallet } from './wallets/hd-segwit-p2sh-wallet';
import { LightningCustodianWallet } from './wallets/lightning-custodian-wallet';
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 { PlaceholderWallet } from './wallets/placeholder-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 { useTheme } from '@react-navigation/native';
2019-01-25 05:46:03 +01:00
export default class WalletGradient {
2019-03-05 02:04:40 +01:00
static hdSegwitP2SHWallet = ['#65ceef', '#68bbe1'];
2019-06-01 22:44:39 +02:00
static hdSegwitBech32Wallet = ['#68bbe1', '#3b73d4'];
static segwitBech32Wallet = ['#f8bbe1', '#945a90'];
2019-01-25 05:46:03 +01:00
static watchOnlyWallet = ['#7d7d7d', '#4a4a4a'];
static legacyWallet = ['#40fad1', '#15be98'];
static hdLegacyP2PKHWallet = ['#e36dfa', '#bd10e0'];
static hdLegacyBreadWallet = ['#fe6381', '#f99c42'];
2020-10-05 23:25:14 +02:00
static multisigHdWallet = ['#1ce6eb', '#296fc5', '#3500A2'];
2019-03-05 02:04:40 +01:00
static defaultGradients = ['#c65afb', '#9053fe'];
2019-01-25 05:46:03 +01:00
static lightningCustodianWallet = ['#f1be07', '#f79056'];
static createWallet = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const { colors } = useTheme();
return colors.lightButton;
};
2019-01-25 05:46:03 +01:00
static gradientsFor(type) {
let gradient;
switch (type) {
case WatchOnlyWallet.type:
gradient = WalletGradient.watchOnlyWallet;
break;
case LegacyWallet.type:
gradient = WalletGradient.legacyWallet;
break;
case HDLegacyP2PKHWallet.type:
case HDLegacyElectrumSeedP2PKHWallet.type:
2019-01-25 05:46:03 +01:00
gradient = WalletGradient.hdLegacyP2PKHWallet;
break;
case HDLegacyBreadwalletWallet.type:
gradient = WalletGradient.hdLegacyBreadWallet;
break;
case HDSegwitP2SHWallet.type:
gradient = WalletGradient.hdSegwitP2SHWallet;
break;
2019-06-01 22:44:39 +02:00
case HDSegwitBech32Wallet.type:
case HDSegwitElectrumSeedP2WPKHWallet.type:
2019-06-01 22:44:39 +02:00
gradient = WalletGradient.hdSegwitBech32Wallet;
break;
2019-01-25 05:46:03 +01:00
case LightningCustodianWallet.type:
gradient = WalletGradient.lightningCustodianWallet;
break;
2019-12-27 03:21:07 +01:00
case PlaceholderWallet.type:
gradient = WalletGradient.watchOnlyWallet;
break;
case SegwitBech32Wallet.type:
gradient = WalletGradient.segwitBech32Wallet;
break;
2020-10-05 23:25:14 +02:00
case MultisigHDWallet.type:
gradient = WalletGradient.multisigHdWallet;
break;
2019-01-25 05:46:03 +01:00
default:
gradient = WalletGradient.defaultGradients;
break;
}
return gradient;
}
2020-12-11 18:35:47 +01:00
static linearGradientProps(type) {
let props;
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;
}
2019-01-25 05:46:03 +01:00
static headerColorFor(type) {
let gradient;
switch (type) {
case WatchOnlyWallet.type:
gradient = WalletGradient.watchOnlyWallet;
break;
case LegacyWallet.type:
gradient = WalletGradient.legacyWallet;
break;
case HDLegacyP2PKHWallet.type:
case HDLegacyElectrumSeedP2PKHWallet.type:
2019-01-25 05:46:03 +01:00
gradient = WalletGradient.hdLegacyP2PKHWallet;
break;
case HDLegacyBreadwalletWallet.type:
gradient = WalletGradient.hdLegacyBreadWallet;
break;
case HDSegwitP2SHWallet.type:
gradient = WalletGradient.hdSegwitP2SHWallet;
break;
2019-06-01 22:44:39 +02:00
case HDSegwitBech32Wallet.type:
case HDSegwitElectrumSeedP2WPKHWallet.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;
2019-01-25 05:46:03 +01:00
case LightningCustodianWallet.type:
gradient = WalletGradient.lightningCustodianWallet;
break;
default:
gradient = WalletGradient.defaultGradients;
break;
}
return gradient[0];
}
}