Prettier for /components/brave_wallet_ui/options (#29337)
This commit is contained in:
@@ -65,17 +65,11 @@ components/brave_wallet/resources/solana_web3_script.js
|
||||
/components/brave_new_tab_ui/
|
||||
/components/brave_rewards/
|
||||
/components/brave_wallet/
|
||||
/components/brave_wallet_ui/constants/
|
||||
/components/brave_wallet_ui/ledger/
|
||||
/components/brave_wallet_ui/line_chart/
|
||||
/components/brave_wallet_ui/market/
|
||||
/components/brave_wallet_ui/mocks/
|
||||
/components/brave_wallet_ui/nft/
|
||||
/components/brave_wallet_ui/options/
|
||||
/components/brave_wallet_ui/panel/
|
||||
/components/brave_wallet_ui/stories/
|
||||
/components/brave_wallet_ui/theme/
|
||||
/components/brave_wallet_ui/trezor/
|
||||
/components/brave_shields/
|
||||
/components/brave_vpn/
|
||||
/components/brave_news/
|
||||
|
||||
@@ -9,7 +9,7 @@ import { TimeDelta } from 'gen/mojo/public/mojom/base/time.mojom.m.js'
|
||||
import * as BraveWallet from 'gen/brave/components/brave_wallet/common/brave_wallet.mojom.m.js'
|
||||
import {
|
||||
ExternalWallet,
|
||||
ExternalWalletProvider
|
||||
ExternalWalletProvider,
|
||||
} from '../../brave_rewards/resources/shared/lib/external_wallet'
|
||||
|
||||
// Re-export BraveWallet for use in other modules, to avoid hard-coding the
|
||||
@@ -26,7 +26,7 @@ export {
|
||||
MeldPaymentMethod,
|
||||
MeldCryptoWidget,
|
||||
CryptoBuySessionData,
|
||||
CryptoWidgetCustomerData
|
||||
CryptoWidgetCustomerData,
|
||||
} from 'gen/brave/components/brave_wallet/common/meld_integration.mojom.m.js'
|
||||
export type NftDropdownOptionId = 'collected' | 'hidden'
|
||||
|
||||
@@ -355,8 +355,8 @@ export type SerializableSolanaTxDataMaxRetries = {
|
||||
}
|
||||
|
||||
export type SerializableSolanaTxDataSendOptions =
|
||||
| (Omit<Defined<BraveWallet.SolanaSendTransactionOptions>, 'maxRetries'> &
|
||||
SerializableSolanaTxDataMaxRetries)
|
||||
| (Omit<Defined<BraveWallet.SolanaSendTransactionOptions>, 'maxRetries'>
|
||||
& SerializableSolanaTxDataMaxRetries)
|
||||
| undefined
|
||||
|
||||
export type SerializableSolanaTxData = Omit<
|
||||
@@ -452,7 +452,7 @@ export const BuySupportedChains = [
|
||||
BraveWallet.SOLANA_MAINNET,
|
||||
BraveWallet.OPTIMISM_MAINNET_CHAIN_ID,
|
||||
BraveWallet.FILECOIN_MAINNET,
|
||||
BraveWallet.FANTOM_MAINNET_CHAIN_ID
|
||||
BraveWallet.FANTOM_MAINNET_CHAIN_ID,
|
||||
]
|
||||
|
||||
export type TransactionPanelPayload = {
|
||||
@@ -479,12 +479,12 @@ export enum WalletRoutes {
|
||||
OnboardingNewWalletNetworkSelection = '/crypto/onboarding/new/networks',
|
||||
OnboardingNewWalletCreatePassword = '/crypto/onboarding/new/create-password',
|
||||
OnboardingBackupWallet = '/crypto/onboarding/new/backup-wallet',
|
||||
OnboardingExplainRecoveryPhrase = '/crypto/onboarding/new' +
|
||||
'/explain-recovery-phrase',
|
||||
OnboardingBackupRecoveryPhrase = '/crypto/onboarding/new' +
|
||||
'/backup-recovery-phrase',
|
||||
OnboardingVerifyRecoveryPhrase = '/crypto/onboarding/new' +
|
||||
'/verify-recovery-phrase',
|
||||
OnboardingExplainRecoveryPhrase = '/crypto/onboarding/new'
|
||||
+ '/explain-recovery-phrase',
|
||||
OnboardingBackupRecoveryPhrase = '/crypto/onboarding/new'
|
||||
+ '/backup-recovery-phrase',
|
||||
OnboardingVerifyRecoveryPhrase = '/crypto/onboarding/new'
|
||||
+ '/verify-recovery-phrase',
|
||||
|
||||
// onboarding (import & restore)
|
||||
OnboardingImportStart = '/crypto/onboarding/import',
|
||||
@@ -507,12 +507,12 @@ export enum WalletRoutes {
|
||||
OnboardingImportHardwareWalletWelcome = '/crypto/onboarding/hardware/welcome',
|
||||
OnboardingHardwareWalletTerms = '/crypto/onboarding/hardware/terms',
|
||||
OnboardingHardwareWalletConnect = '/crypto/onboarding/hardware/connect',
|
||||
OnboardingHardwareWalletConnectSelectDevice = '/crypto/onboarding/' +
|
||||
'hardware/select-device/:accountTypeName?',
|
||||
OnboardingHardwareWalletNetworkSelection = '/crypto/onboarding/hardware' +
|
||||
'/networks',
|
||||
OnboardingHardwareWalletCreatePassword = '/crypto/onboarding/' +
|
||||
'hardware/create-password',
|
||||
OnboardingHardwareWalletConnectSelectDevice = '/crypto/onboarding/'
|
||||
+ 'hardware/select-device/:accountTypeName?',
|
||||
OnboardingHardwareWalletNetworkSelection = '/crypto/onboarding/hardware'
|
||||
+ '/networks',
|
||||
OnboardingHardwareWalletCreatePassword = '/crypto/onboarding/'
|
||||
+ 'hardware/create-password',
|
||||
|
||||
// onboarding complete
|
||||
OnboardingComplete = '/crypto/onboarding/complete',
|
||||
@@ -602,13 +602,13 @@ export enum WalletRoutes {
|
||||
AccountsHash = '#accounts',
|
||||
TransactionsHash = '#transactions',
|
||||
MyAssetsHash = '#my-assets',
|
||||
AvailableAssetsHash = '#available-assets'
|
||||
AvailableAssetsHash = '#available-assets',
|
||||
}
|
||||
|
||||
export const AccountPageTabs = {
|
||||
AccountAssetsSub: 'assets',
|
||||
AccountNFTsSub: 'nfts',
|
||||
AccountTransactionsSub: 'transactions'
|
||||
AccountTransactionsSub: 'transactions',
|
||||
} as const
|
||||
|
||||
export const WalletOrigin = 'chrome://wallet'
|
||||
@@ -675,7 +675,7 @@ export const emptyProviderErrorCodeUnion: BraveWallet.ProviderErrorUnion = {
|
||||
bitcoinProviderError: undefined,
|
||||
filecoinProviderError: undefined,
|
||||
solanaProviderError: undefined,
|
||||
cardanoProviderError: undefined
|
||||
cardanoProviderError: undefined,
|
||||
}
|
||||
|
||||
export interface TransactionProviderErrorRegistry {
|
||||
@@ -694,7 +694,7 @@ export const SupportedOnRampNetworks = [
|
||||
BraveWallet.OPTIMISM_MAINNET_CHAIN_ID,
|
||||
BraveWallet.ARBITRUM_MAINNET_CHAIN_ID,
|
||||
BraveWallet.AURORA_MAINNET_CHAIN_ID,
|
||||
BraveWallet.BITCOIN_MAINNET
|
||||
BraveWallet.BITCOIN_MAINNET,
|
||||
]
|
||||
|
||||
export const SupportedOffRampNetworks = [
|
||||
@@ -707,7 +707,7 @@ export const SupportedOffRampNetworks = [
|
||||
BraveWallet.CELO_MAINNET_CHAIN_ID,
|
||||
BraveWallet.OPTIMISM_MAINNET_CHAIN_ID,
|
||||
BraveWallet.ARBITRUM_MAINNET_CHAIN_ID,
|
||||
BraveWallet.BITCOIN_MAINNET
|
||||
BraveWallet.BITCOIN_MAINNET,
|
||||
]
|
||||
|
||||
export const SupportedTestNetworks = [
|
||||
@@ -719,7 +719,7 @@ export const SupportedTestNetworks = [
|
||||
BraveWallet.FILECOIN_ETHEREUM_TESTNET_CHAIN_ID,
|
||||
BraveWallet.BITCOIN_TESTNET,
|
||||
BraveWallet.Z_CASH_TESTNET,
|
||||
BraveWallet.CARDANO_TESTNET
|
||||
BraveWallet.CARDANO_TESTNET,
|
||||
]
|
||||
|
||||
export const SupportedTestNetworkEntityIds: EntityId[] = [
|
||||
@@ -735,34 +735,34 @@ export const SupportedTestNetworkEntityIds: EntityId[] = [
|
||||
BraveWallet.FILECOIN_ETHEREUM_TESTNET_CHAIN_ID,
|
||||
BraveWallet.BITCOIN_TESTNET,
|
||||
BraveWallet.Z_CASH_TESTNET,
|
||||
BraveWallet.CARDANO_TESTNET
|
||||
BraveWallet.CARDANO_TESTNET,
|
||||
]
|
||||
|
||||
export const DAppSupportedCoinTypes = [
|
||||
BraveWallet.CoinType.SOL,
|
||||
BraveWallet.CoinType.ETH
|
||||
BraveWallet.CoinType.ETH,
|
||||
]
|
||||
|
||||
export const CustomAssetSupportedCoinTypes = [
|
||||
BraveWallet.CoinType.SOL,
|
||||
BraveWallet.CoinType.ETH
|
||||
BraveWallet.CoinType.ETH,
|
||||
]
|
||||
|
||||
export const DAppSupportedPrimaryChains = [
|
||||
BraveWallet.MAINNET_CHAIN_ID,
|
||||
BraveWallet.SOLANA_MAINNET
|
||||
BraveWallet.SOLANA_MAINNET,
|
||||
]
|
||||
|
||||
export const BitcoinMainnetKeyringIds = [
|
||||
BraveWallet.KeyringId.kBitcoin84,
|
||||
BraveWallet.KeyringId.kBitcoinImport,
|
||||
BraveWallet.KeyringId.kBitcoinHardware
|
||||
BraveWallet.KeyringId.kBitcoinHardware,
|
||||
]
|
||||
|
||||
export const BitcoinTestnetKeyringIds = [
|
||||
BraveWallet.KeyringId.kBitcoin84Testnet,
|
||||
BraveWallet.KeyringId.kBitcoinImportTestnet,
|
||||
BraveWallet.KeyringId.kBitcoinHardwareTestnet
|
||||
BraveWallet.KeyringId.kBitcoinHardwareTestnet,
|
||||
]
|
||||
|
||||
export const ZCashTestnetKeyringIds = [BraveWallet.KeyringId.kZCashTestnet]
|
||||
@@ -781,7 +781,7 @@ export const CoinTypes = {
|
||||
SOL: 501,
|
||||
ADA: 1815,
|
||||
MIN_VALUE: 0,
|
||||
MAX_VALUE: 501
|
||||
MAX_VALUE: 501,
|
||||
} as const
|
||||
|
||||
export type CoinType = (typeof CoinTypes)[keyof typeof CoinTypes]
|
||||
@@ -792,7 +792,7 @@ export enum CoinTypesMap {
|
||||
SOL = BraveWallet.CoinType.SOL,
|
||||
BTC = BraveWallet.CoinType.BTC,
|
||||
ZEC = BraveWallet.CoinType.ZEC,
|
||||
ADA = BraveWallet.CoinType.ADA
|
||||
ADA = BraveWallet.CoinType.ADA,
|
||||
}
|
||||
|
||||
export type BuyOption = {
|
||||
@@ -890,7 +890,7 @@ export type SendPageTabHashes =
|
||||
|
||||
export const SendPageTabHashes = {
|
||||
token: '#token',
|
||||
nft: '#nft'
|
||||
nft: '#nft',
|
||||
} as const
|
||||
|
||||
export type NavIDTypes =
|
||||
@@ -927,7 +927,7 @@ export enum TokenStandards {
|
||||
ERC721 = 'ERC721',
|
||||
ERC20 = 'ERC20',
|
||||
ERC1155 = 'ERC1155',
|
||||
SPL = 'SPL'
|
||||
SPL = 'SPL',
|
||||
}
|
||||
export interface CommonNftMetadata {
|
||||
attributes?: any[]
|
||||
@@ -956,7 +956,7 @@ export enum AddressMessageInfoIds {
|
||||
zcashInvalidUnifiedAddressError = 11,
|
||||
zcashInvalidUnifiedAddressMissingTransparentPartError = 12,
|
||||
zcashInvalidUnifiedAddressMissingOrchardPartError = 13,
|
||||
zcashInvalidAddressNetworkMismatchError = 14
|
||||
zcashInvalidAddressNetworkMismatchError = 14,
|
||||
}
|
||||
|
||||
export type AddressMessageInfo = {
|
||||
@@ -988,35 +988,35 @@ export type DAppConnectedPermissionsOption = {
|
||||
|
||||
export const FilecoinNetworkTypes = [
|
||||
BraveWallet.FILECOIN_MAINNET,
|
||||
BraveWallet.FILECOIN_TESTNET
|
||||
BraveWallet.FILECOIN_TESTNET,
|
||||
] as const
|
||||
export type FilecoinNetwork = (typeof FilecoinNetworkTypes)[number]
|
||||
|
||||
export const FilecoinNetworkLocaleMapping = {
|
||||
[BraveWallet.FILECOIN_MAINNET]: 'Filecoin Mainnet',
|
||||
[BraveWallet.FILECOIN_TESTNET]: 'Filecoin Testnet'
|
||||
[BraveWallet.FILECOIN_TESTNET]: 'Filecoin Testnet',
|
||||
}
|
||||
|
||||
export const BitcoinNetworkTypes = [
|
||||
BraveWallet.BITCOIN_MAINNET,
|
||||
BraveWallet.BITCOIN_TESTNET
|
||||
BraveWallet.BITCOIN_TESTNET,
|
||||
] as const
|
||||
export type BitcoinNetwork = (typeof BitcoinNetworkTypes)[number]
|
||||
|
||||
export const ZCashNetworkTypes = [
|
||||
BraveWallet.Z_CASH_MAINNET,
|
||||
BraveWallet.Z_CASH_TESTNET
|
||||
BraveWallet.Z_CASH_TESTNET,
|
||||
] as const
|
||||
export type ZCashNetwork = (typeof ZCashNetworkTypes)[number]
|
||||
|
||||
export const BitcoinNetworkLocaleMapping = {
|
||||
[BraveWallet.BITCOIN_MAINNET]: 'Bitcoin Mainnet',
|
||||
[BraveWallet.BITCOIN_TESTNET]: 'Bitcoin Testnet'
|
||||
[BraveWallet.BITCOIN_TESTNET]: 'Bitcoin Testnet',
|
||||
}
|
||||
|
||||
export const ZCashNetworkLocaleMapping = {
|
||||
[BraveWallet.Z_CASH_MAINNET]: 'ZCash Mainnet',
|
||||
[BraveWallet.Z_CASH_TESTNET]: 'ZCash Testnet'
|
||||
[BraveWallet.Z_CASH_TESTNET]: 'ZCash Testnet',
|
||||
}
|
||||
|
||||
export type GasFeeOption = {
|
||||
@@ -1038,7 +1038,7 @@ export type SwapAndSend = {
|
||||
|
||||
export enum SignDataSteps {
|
||||
SignRisk = 0,
|
||||
SignData = 1
|
||||
SignData = 1,
|
||||
}
|
||||
|
||||
export interface LineChartIframeData {
|
||||
@@ -1076,14 +1076,14 @@ export type BitcoinBalances = {
|
||||
export const WalletStatus = {
|
||||
kNotConnected: 0,
|
||||
kConnected: 2,
|
||||
kLoggedOut: 4
|
||||
kLoggedOut: 4,
|
||||
} as const
|
||||
|
||||
export const externalWalletProviders = [
|
||||
'uphold',
|
||||
'bitflyer',
|
||||
'gemini',
|
||||
'zebpay'
|
||||
'zebpay',
|
||||
]
|
||||
|
||||
export type WalletStatus = (typeof WalletStatus)[keyof typeof WalletStatus]
|
||||
@@ -1102,7 +1102,7 @@ export const SwapProviderNameMapping = {
|
||||
[BraveWallet.SwapProvider.kJupiter]: 'Jupiter',
|
||||
[BraveWallet.SwapProvider.kZeroEx]: '0x',
|
||||
[BraveWallet.SwapProvider.kLiFi]: 'LI.FI',
|
||||
[BraveWallet.SwapProvider.kSquid]: 'Squid'
|
||||
[BraveWallet.SwapProvider.kSquid]: 'Squid',
|
||||
}
|
||||
|
||||
export const SupportedSwapProviders = [
|
||||
@@ -1110,7 +1110,7 @@ export const SupportedSwapProviders = [
|
||||
BraveWallet.SwapProvider.kJupiter,
|
||||
BraveWallet.SwapProvider.kZeroEx,
|
||||
BraveWallet.SwapProvider.kLiFi,
|
||||
BraveWallet.SwapProvider.kSquid
|
||||
BraveWallet.SwapProvider.kSquid,
|
||||
]
|
||||
|
||||
export type StorybookTransactionTypes = 'Send' | 'Swap' | 'Bridge' | 'Approve'
|
||||
@@ -1118,7 +1118,7 @@ export const StorybookTransactionOptions: StorybookTransactionTypes[] = [
|
||||
'Send',
|
||||
'Swap',
|
||||
'Bridge',
|
||||
'Approve'
|
||||
'Approve',
|
||||
]
|
||||
|
||||
export type StorybookCoinTypes = 'ETH' | 'SOL' | 'BTC' | 'ZEC' | 'FIL'
|
||||
@@ -1127,7 +1127,7 @@ export const StorybookCoinTypeOptions: StorybookCoinTypes[] = [
|
||||
'SOL',
|
||||
'BTC',
|
||||
'ZEC',
|
||||
'FIL'
|
||||
'FIL',
|
||||
]
|
||||
|
||||
export type StorybookTransactionArgs = {
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
import {
|
||||
LedgerCommand,
|
||||
LEDGER_BRIDGE_URL
|
||||
LEDGER_BRIDGE_URL,
|
||||
} from '../common/hardware/ledgerjs/ledger-messages'
|
||||
import {
|
||||
BridgeType,
|
||||
BridgeTypes
|
||||
BridgeTypes,
|
||||
} from '../common/hardware/untrusted_shared_types'
|
||||
import { LedgerUntrustedMessagingTransport } from '../common/hardware/ledgerjs/ledger-untrusted-transport'
|
||||
import { SolanaLedgerUntrustedMessagingTransport } from '../common/hardware/ledgerjs/sol-ledger-untrusted-transport'
|
||||
@@ -19,11 +19,11 @@ import { BitcoinLedgerUntrustedMessagingTransport } from '../common/hardware/led
|
||||
|
||||
const setUpAuthorizeButtonListener = (
|
||||
targetUrl: string,
|
||||
bridgeType: string
|
||||
bridgeType: string,
|
||||
) => {
|
||||
const untrustedMessagingTransport = getUntrustedMessagingTransport(
|
||||
bridgeType,
|
||||
targetUrl
|
||||
targetUrl,
|
||||
)
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
const authorizeBtn = document.getElementById('authorize')
|
||||
@@ -33,7 +33,7 @@ const setUpAuthorizeButtonListener = (
|
||||
untrustedMessagingTransport.sendCommand({
|
||||
id: LedgerCommand.AuthorizationSuccess,
|
||||
origin: LEDGER_BRIDGE_URL,
|
||||
command: LedgerCommand.AuthorizationSuccess
|
||||
command: LedgerCommand.AuthorizationSuccess,
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -43,28 +43,28 @@ const setUpAuthorizeButtonListener = (
|
||||
|
||||
const getUntrustedMessagingTransport = (
|
||||
bridgeType: string,
|
||||
targetUrl: string
|
||||
targetUrl: string,
|
||||
): LedgerUntrustedMessagingTransport => {
|
||||
switch (bridgeType as BridgeType) {
|
||||
case BridgeTypes.SolLedger:
|
||||
return new SolanaLedgerUntrustedMessagingTransport(
|
||||
window.parent,
|
||||
targetUrl
|
||||
targetUrl,
|
||||
)
|
||||
case BridgeTypes.EthLedger:
|
||||
return new EthereumLedgerUntrustedMessagingTransport(
|
||||
window.parent,
|
||||
targetUrl
|
||||
targetUrl,
|
||||
)
|
||||
case BridgeTypes.FilLedger:
|
||||
return new FilecoinLedgerUntrustedMessagingTransport(
|
||||
window.parent,
|
||||
targetUrl
|
||||
targetUrl,
|
||||
)
|
||||
case BridgeTypes.BtcLedger:
|
||||
return new BitcoinLedgerUntrustedMessagingTransport(
|
||||
window.parent,
|
||||
targetUrl
|
||||
targetUrl,
|
||||
)
|
||||
default:
|
||||
throw new Error(`Invalid bridgeType ${bridgeType}`)
|
||||
|
||||
@@ -16,7 +16,7 @@ export const CustomReferenceDot = ({
|
||||
cx,
|
||||
cy,
|
||||
onUpdateYPosition,
|
||||
onUpdateXPosition
|
||||
onUpdateXPosition,
|
||||
}: Props) => {
|
||||
// Effects
|
||||
React.useLayoutEffect(() => {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { formatTimelineDate } from '../../utils/datetime-utils'
|
||||
import {
|
||||
TooltipWrapper,
|
||||
ChartBalance,
|
||||
ChartDate
|
||||
ChartDate,
|
||||
} from './custom_tooltip.styles'
|
||||
|
||||
type Props = TooltipProps<number, number> & {
|
||||
@@ -31,7 +31,7 @@ export function CustomTooltip({
|
||||
payload,
|
||||
viewBox,
|
||||
defaultFiatCurrency,
|
||||
hidePortfolioBalances
|
||||
hidePortfolioBalances,
|
||||
}: Props) {
|
||||
// Effects
|
||||
React.useLayoutEffect(() => {
|
||||
@@ -50,7 +50,7 @@ export function CustomTooltip({
|
||||
const middleEndTranslate =
|
||||
xRightCoordinate >= 8 ? 0 : Math.abs(xRightCoordinate) - 4
|
||||
const balance = new Amount(payload[0].value).formatAsFiat(
|
||||
defaultFiatCurrency
|
||||
defaultFiatCurrency,
|
||||
)
|
||||
|
||||
return (
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
XAxis,
|
||||
YAxis,
|
||||
ResponsiveContainer,
|
||||
Tooltip
|
||||
Tooltip,
|
||||
} from 'recharts'
|
||||
|
||||
// Types
|
||||
@@ -22,7 +22,7 @@ import type { TokenPriceHistory } from '../../constants/types'
|
||||
import { mojoTimeDeltaToJSDate } from '../../../common/mojomUtils'
|
||||
import {
|
||||
deserializeTimeDelta,
|
||||
makeSerializableTimeDelta
|
||||
makeSerializableTimeDelta,
|
||||
} from '../../utils/model-serialization-utils'
|
||||
|
||||
// Components
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
StyledWrapper,
|
||||
LoadingOverlay,
|
||||
LoadIcon,
|
||||
AreaWrapper
|
||||
AreaWrapper,
|
||||
} from './line_chart.styles'
|
||||
|
||||
interface Props {
|
||||
@@ -50,22 +50,22 @@ interface Props {
|
||||
const EmptyChartData = [
|
||||
{
|
||||
date: makeSerializableTimeDelta({
|
||||
microseconds: 1
|
||||
microseconds: 1,
|
||||
}),
|
||||
close: 1
|
||||
close: 1,
|
||||
},
|
||||
{
|
||||
date: makeSerializableTimeDelta({
|
||||
microseconds: 2
|
||||
microseconds: 2,
|
||||
}),
|
||||
close: 1
|
||||
close: 1,
|
||||
},
|
||||
{
|
||||
date: makeSerializableTimeDelta({
|
||||
microseconds: 3
|
||||
microseconds: 3,
|
||||
}),
|
||||
close: 1
|
||||
}
|
||||
close: 1,
|
||||
},
|
||||
]
|
||||
|
||||
export function LineChart({
|
||||
@@ -75,7 +75,7 @@ export function LineChart({
|
||||
customStyle,
|
||||
showTooltip,
|
||||
defaultFiatCurrency,
|
||||
hidePortfolioBalances
|
||||
hidePortfolioBalances,
|
||||
}: Props) {
|
||||
// state
|
||||
const [activeXPosition, setActiveXPosition] = React.useState<number>(0)
|
||||
@@ -91,7 +91,7 @@ export function LineChart({
|
||||
|
||||
return priceHistory.map((price) => ({
|
||||
date: mojoTimeDeltaToJSDate(deserializeTimeDelta(price.date)),
|
||||
close: price.close
|
||||
close: price.close,
|
||||
}))
|
||||
}, [priceData, isDisabled])
|
||||
|
||||
@@ -139,19 +139,19 @@ export function LineChart({
|
||||
hide={true}
|
||||
dataKey='date'
|
||||
/>
|
||||
{priceData &&
|
||||
priceData.length > 0 &&
|
||||
!isDisabled &&
|
||||
showTooltip && (
|
||||
{priceData
|
||||
&& priceData.length > 0
|
||||
&& !isDisabled
|
||||
&& showTooltip && (
|
||||
<Tooltip
|
||||
isAnimationActive={false}
|
||||
position={{
|
||||
x: activeXPosition,
|
||||
y: toolTipYPosition
|
||||
y: toolTipYPosition,
|
||||
}}
|
||||
cursor={{
|
||||
stroke: leo.color.icon.interactive,
|
||||
strokeWidth: 2
|
||||
strokeWidth: 2,
|
||||
}}
|
||||
content={
|
||||
<CustomTooltip
|
||||
@@ -192,5 +192,5 @@ export function LineChart({
|
||||
|
||||
LineChart.defaultProps = {
|
||||
showPulsatingDot: true,
|
||||
showTooltip: true
|
||||
showTooltip: true,
|
||||
}
|
||||
|
||||
@@ -9,26 +9,26 @@ export const AccountDetailsMenuOptions: AccountButtonOptionsObjectType[] = [
|
||||
{
|
||||
id: 'edit',
|
||||
name: 'braveWalletAllowSpendEditButton',
|
||||
icon: 'edit-pencil'
|
||||
icon: 'edit-pencil',
|
||||
},
|
||||
{
|
||||
id: 'explorer',
|
||||
name: 'braveWalletTransactionExplorer',
|
||||
icon: 'web3-blockexplorer'
|
||||
icon: 'web3-blockexplorer',
|
||||
},
|
||||
{
|
||||
id: 'deposit',
|
||||
name: 'braveWalletAccountsDeposit',
|
||||
icon: 'money-bag-coins'
|
||||
icon: 'money-bag-coins',
|
||||
},
|
||||
{
|
||||
id: 'privateKey',
|
||||
name: 'braveWalletAccountsExport',
|
||||
icon: 'key'
|
||||
icon: 'key',
|
||||
},
|
||||
{
|
||||
id: 'remove',
|
||||
name: 'braveWalletAccountsRemove',
|
||||
icon: 'trash'
|
||||
}
|
||||
icon: 'trash',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -16,10 +16,10 @@ export const AllAccountsOption: BraveWallet.AccountInfo = {
|
||||
kind: BraveWallet.AccountKind.kDerived,
|
||||
address: AllAccountsOptionUniqueKey,
|
||||
accountIndex: 0,
|
||||
uniqueKey: AllAccountsOptionUniqueKey
|
||||
uniqueKey: AllAccountsOptionUniqueKey,
|
||||
},
|
||||
name: getLocale('braveWalletAccountFilterAllAccounts'),
|
||||
hardware: undefined
|
||||
hardware: undefined,
|
||||
}
|
||||
|
||||
export const isAllAccountsOptionFilter = (selectedAccountFilter: string) => {
|
||||
|
||||
@@ -9,40 +9,40 @@ import { AccountButtonOptionsObjectType } from '../constants/types'
|
||||
export const BuyButtonOption: AccountButtonOptionsObjectType = {
|
||||
id: 'buy',
|
||||
name: 'braveWalletBuy',
|
||||
icon: 'coins-alt1'
|
||||
icon: 'coins-alt1',
|
||||
}
|
||||
|
||||
export const DepositButtonOption: AccountButtonOptionsObjectType = {
|
||||
id: 'deposit',
|
||||
name: 'braveWalletAccountsDeposit',
|
||||
icon: 'money-bag-coins'
|
||||
icon: 'money-bag-coins',
|
||||
}
|
||||
|
||||
export const AccountButtonOptions: AccountButtonOptionsObjectType[] = [
|
||||
{
|
||||
id: 'details',
|
||||
name: 'braveWalletAllowSpendDetailsButton',
|
||||
icon: 'eye-on'
|
||||
icon: 'eye-on',
|
||||
},
|
||||
{
|
||||
id: 'edit',
|
||||
name: 'braveWalletAllowSpendEditButton',
|
||||
icon: 'edit-pencil'
|
||||
icon: 'edit-pencil',
|
||||
},
|
||||
{
|
||||
id: 'privateKey',
|
||||
name: 'braveWalletAccountsExport',
|
||||
icon: 'key'
|
||||
icon: 'key',
|
||||
},
|
||||
DepositButtonOption,
|
||||
{
|
||||
id: 'remove',
|
||||
name: 'braveWalletAccountsRemove',
|
||||
icon: 'trash'
|
||||
icon: 'trash',
|
||||
},
|
||||
{
|
||||
id: 'shield',
|
||||
name: 'braveWalletSwitchToShieldedAccount',
|
||||
icon: 'shield-done'
|
||||
}
|
||||
icon: 'shield-done',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -8,14 +8,14 @@ import { getLocale } from '../../common/locale'
|
||||
export const AddAccountNavOptions = (): TopTabNavObjectType[] => [
|
||||
{
|
||||
id: 'create',
|
||||
name: getLocale('braveWalletAddAccountCreate')
|
||||
name: getLocale('braveWalletAddAccountCreate'),
|
||||
},
|
||||
{
|
||||
id: 'import',
|
||||
name: getLocale('braveWalletAddAccountImport')
|
||||
name: getLocale('braveWalletAddAccountImport'),
|
||||
},
|
||||
{
|
||||
id: 'hardware',
|
||||
name: getLocale('braveWalletAddAccountHardware')
|
||||
}
|
||||
name: getLocale('braveWalletAddAccountHardware'),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -9,10 +9,10 @@ import { TabOption } from '../components/shared/tabs/tabs'
|
||||
export const CUSTOM_ASSET_NAV_OPTIONS: TabOption[] = [
|
||||
{
|
||||
id: 'token',
|
||||
label: getLocale('braveWalletAddAssetTokenTabTitle')
|
||||
label: getLocale('braveWalletAddAssetTokenTabTitle'),
|
||||
},
|
||||
{
|
||||
id: 'nft',
|
||||
label: getLocale('braveWalletAddAssetNftTabTitle')
|
||||
}
|
||||
label: getLocale('braveWalletAddAssetNftTabTitle'),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -8,18 +8,18 @@ import { getLocale } from '../../common/locale'
|
||||
export const AmountPresetOptions = (): AmountPresetObjectType[] => [
|
||||
{
|
||||
name: getLocale('braveWalletPreset25'),
|
||||
value: 0.25
|
||||
value: 0.25,
|
||||
},
|
||||
{
|
||||
name: getLocale('braveWalletPreset50'),
|
||||
value: 0.5
|
||||
value: 0.5,
|
||||
},
|
||||
{
|
||||
name: getLocale('braveWalletPreset75'),
|
||||
value: 0.75
|
||||
value: 0.75,
|
||||
},
|
||||
{
|
||||
name: getLocale('braveWalletPreset100'),
|
||||
value: 1
|
||||
}
|
||||
value: 1,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -7,21 +7,21 @@ import { DropdownFilterOption } from '../constants/types'
|
||||
|
||||
export const HighToLowAssetsFilterOption: DropdownFilterOption = {
|
||||
id: 'highToLow',
|
||||
name: 'braveWalletAssetFilterHighToLow'
|
||||
name: 'braveWalletAssetFilterHighToLow',
|
||||
}
|
||||
|
||||
export const AssetFilterOptions: DropdownFilterOption[] = [
|
||||
HighToLowAssetsFilterOption,
|
||||
{
|
||||
id: 'lowToHigh',
|
||||
name: 'braveWalletAssetFilterLowToHigh'
|
||||
name: 'braveWalletAssetFilterLowToHigh',
|
||||
},
|
||||
{
|
||||
id: 'aToZ',
|
||||
name: 'braveWalletAssetFilterAToZ'
|
||||
name: 'braveWalletAssetFilterAToZ',
|
||||
},
|
||||
{
|
||||
id: 'zToA',
|
||||
name: 'braveWalletAssetFilterZToA'
|
||||
}
|
||||
name: 'braveWalletAssetFilterZToA',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -29,15 +29,14 @@ import {
|
||||
MATICIcon,
|
||||
SOLIcon,
|
||||
ZECIcon,
|
||||
CardanoIcon
|
||||
CardanoIcon,
|
||||
} from '../assets/network_token_icons/network_token_icons'
|
||||
|
||||
export const getNetworkLogo = (chainId: string, symbol: string): string => {
|
||||
if (chainId === BraveWallet.AURORA_MAINNET_CHAIN_ID) return AuroraIcon
|
||||
if (chainId === BraveWallet.OPTIMISM_MAINNET_CHAIN_ID) return OpIcon
|
||||
if (chainId === BraveWallet.POLYGON_MAINNET_CHAIN_ID) return MATICIcon
|
||||
if (chainId === BraveWallet.BNB_SMART_CHAIN_MAINNET_CHAIN_ID)
|
||||
return BNBIcon
|
||||
if (chainId === BraveWallet.BNB_SMART_CHAIN_MAINNET_CHAIN_ID) return BNBIcon
|
||||
if (chainId === BraveWallet.AVALANCHE_MAINNET_CHAIN_ID) return AVAXIcon
|
||||
if (chainId === BraveWallet.FANTOM_MAINNET_CHAIN_ID) return FtmIcon
|
||||
if (chainId === BraveWallet.CELO_MAINNET_CHAIN_ID) return CeloIcon
|
||||
@@ -68,15 +67,15 @@ export const getNetworkLogo = (chainId: string, symbol: string): string => {
|
||||
export const makeNativeAssetLogo = (symbol: string, chainId: string) => {
|
||||
return getNetworkLogo(
|
||||
symbol.toUpperCase() === 'ETH' ? BraveWallet.MAINNET_CHAIN_ID : chainId,
|
||||
symbol
|
||||
symbol,
|
||||
)
|
||||
}
|
||||
|
||||
type UndefinedIf<R, T> = T extends undefined ? undefined : R
|
||||
export const makeNetworkAsset = <
|
||||
T extends BraveWallet.NetworkInfo | undefined | null
|
||||
T extends BraveWallet.NetworkInfo | undefined | null,
|
||||
>(
|
||||
network: T
|
||||
network: T,
|
||||
): UndefinedIf<BraveWallet.BlockchainToken, T> => {
|
||||
if (!network) {
|
||||
return undefined as UndefinedIf<BraveWallet.BlockchainToken, T>
|
||||
@@ -101,6 +100,6 @@ export const makeNetworkAsset = <
|
||||
? SKIP_PRICE_LOOKUP_COINGECKO_ID
|
||||
: '',
|
||||
chainId: network.chainId,
|
||||
coin: network.coin
|
||||
coin: network.coin,
|
||||
} as UndefinedIf<BraveWallet.BlockchainToken, T>
|
||||
}
|
||||
|
||||
@@ -9,18 +9,18 @@ import { AutoLockOption } from '../constants/types'
|
||||
export const autoLockOptions: AutoLockOption[] = [
|
||||
{
|
||||
label: getLocale('braveWalletAutoLockDurationMinutes').replace('$1', '5'),
|
||||
minutes: 5
|
||||
minutes: 5,
|
||||
},
|
||||
{
|
||||
label: getLocale('braveWalletAutoLockDurationMinutes').replace('$1', '10'),
|
||||
minutes: 10
|
||||
minutes: 10,
|
||||
},
|
||||
{
|
||||
label: getLocale('braveWalletAutoLockDurationHours').replace('$1', '1'),
|
||||
minutes: 60
|
||||
minutes: 60,
|
||||
},
|
||||
{
|
||||
label: getLocale('braveWalletAutoLockDurationHours').replace('$1', '3'),
|
||||
minutes: 180
|
||||
}
|
||||
minutes: 180,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -8,14 +8,14 @@ import { getLocale } from '../../common/locale'
|
||||
export const BuySendSwapOptions = (): BuySendSwapObjectType[] => [
|
||||
{
|
||||
id: 'buy',
|
||||
name: getLocale('braveWalletBuy')
|
||||
name: getLocale('braveWalletBuy'),
|
||||
},
|
||||
{
|
||||
id: 'send',
|
||||
name: getLocale('braveWalletSend')
|
||||
name: getLocale('braveWalletSend'),
|
||||
},
|
||||
{
|
||||
id: 'swap',
|
||||
name: getLocale('braveWalletSwap')
|
||||
}
|
||||
name: getLocale('braveWalletSwap'),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -21,14 +21,14 @@ function getBuyOptions(): BuyOption[] {
|
||||
actionText: getLocale('braveWalletBuyWithRamp'),
|
||||
icon: RampIcon,
|
||||
name: getLocale('braveWalletBuyRampNetworkName'),
|
||||
description: getLocale('braveWalletBuyRampDescription')
|
||||
description: getLocale('braveWalletBuyRampDescription'),
|
||||
},
|
||||
{
|
||||
id: BraveWallet.OnRampProvider.kTransak,
|
||||
actionText: getLocale('braveWalletBuyWithTransak'),
|
||||
icon: TransakIcon,
|
||||
name: getLocale('braveWalletBuyTransakName'),
|
||||
description: getLocale('braveWalletBuyTransakDescription')
|
||||
description: getLocale('braveWalletBuyTransakDescription'),
|
||||
},
|
||||
{
|
||||
id: BraveWallet.OnRampProvider.kSardine,
|
||||
@@ -37,15 +37,15 @@ function getBuyOptions(): BuyOption[] {
|
||||
? SardineIconDark
|
||||
: SardineIconLight,
|
||||
name: getLocale('braveWalletBuySardineName'),
|
||||
description: getLocale('braveWalletBuySardineDescription')
|
||||
description: getLocale('braveWalletBuySardineDescription'),
|
||||
},
|
||||
{
|
||||
id: BraveWallet.OnRampProvider.kCoinbase,
|
||||
actionText: getLocale('braveWalletBuyWithCoinbase'),
|
||||
icon: CoinbaseIcon,
|
||||
name: getLocale('braveWalletBuyCoinbaseName'),
|
||||
description: getLocale('braveWalletBuyCoinbaseDescription')
|
||||
}
|
||||
description: getLocale('braveWalletBuyCoinbaseDescription'),
|
||||
},
|
||||
]
|
||||
|
||||
if (isStripeSupported()) {
|
||||
@@ -54,7 +54,7 @@ function getBuyOptions(): BuyOption[] {
|
||||
actionText: getLocale('braveWalletBuyWithStripe'),
|
||||
icon: StripeIcon,
|
||||
name: getLocale('braveWalletBuyStripeName'),
|
||||
description: getLocale('braveWalletBuyStripeDescription')
|
||||
description: getLocale('braveWalletBuyStripeDescription'),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -8,36 +8,36 @@ export const ChartTimelineOptions: ChartTimelineObjectType[] = [
|
||||
{
|
||||
abr: 'braveWalletChartOneHourAbbr',
|
||||
name: 'braveWalletChartOneHour',
|
||||
id: 0
|
||||
id: 0,
|
||||
},
|
||||
{
|
||||
abr: 'braveWalletChartOneDayAbbr',
|
||||
name: 'braveWalletChartOneDay',
|
||||
id: 1
|
||||
id: 1,
|
||||
},
|
||||
{
|
||||
abr: 'braveWalletChartOneWeekAbbr',
|
||||
name: 'braveWalletChartOneWeek',
|
||||
id: 2
|
||||
id: 2,
|
||||
},
|
||||
{
|
||||
abr: 'braveWalletChartOneMonthAbbr',
|
||||
name: 'braveWalletChartOneMonth',
|
||||
id: 3
|
||||
id: 3,
|
||||
},
|
||||
{
|
||||
abr: 'braveWalletChartThreeMonthsAbbr',
|
||||
name: 'braveWalletChartThreeMonths',
|
||||
id: 4
|
||||
id: 4,
|
||||
},
|
||||
{
|
||||
abr: 'braveWalletChartOneYearAbbr',
|
||||
name: 'braveWalletChartOneYear',
|
||||
id: 5
|
||||
id: 5,
|
||||
},
|
||||
{
|
||||
abr: 'braveWalletChartAllTimeAbbr',
|
||||
name: 'braveWalletChartAllTime',
|
||||
id: 6
|
||||
}
|
||||
id: 6,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -15,7 +15,7 @@ export const CreateAccountOptions = (options: {
|
||||
}): CreateAccountOptionsType[] => {
|
||||
const isNetworkVisible = (coin: BraveWallet.CoinType, chaiId: string) => {
|
||||
return !!options.visibleNetworks.find(
|
||||
(n) => n.coin === coin && n.chainId === chaiId
|
||||
(n) => n.coin === coin && n.chainId === chaiId,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export const CreateAccountOptions = (options: {
|
||||
name: 'Ethereum',
|
||||
coin: BraveWallet.CoinType.ETH,
|
||||
icon: getNetworkLogo(BraveWallet.MAINNET_CHAIN_ID, 'ETH'),
|
||||
chainIcons: ['eth-color', 'matic-color', 'op-color', 'aurora-color']
|
||||
chainIcons: ['eth-color', 'matic-color', 'op-color', 'aurora-color'],
|
||||
})
|
||||
|
||||
accounts.push({
|
||||
@@ -35,7 +35,7 @@ export const CreateAccountOptions = (options: {
|
||||
name: 'Solana',
|
||||
coin: BraveWallet.CoinType.SOL,
|
||||
icon: getNetworkLogo(BraveWallet.SOLANA_MAINNET, 'SOL'),
|
||||
chainIcons: ['sol-color']
|
||||
chainIcons: ['sol-color'],
|
||||
})
|
||||
|
||||
accounts.push({
|
||||
@@ -44,20 +44,20 @@ export const CreateAccountOptions = (options: {
|
||||
coin: BraveWallet.CoinType.FIL,
|
||||
fixedNetwork: BraveWallet.FILECOIN_MAINNET,
|
||||
icon: getNetworkLogo(BraveWallet.FILECOIN_MAINNET, 'FIL'),
|
||||
chainIcons: ['filecoin-color']
|
||||
chainIcons: ['filecoin-color'],
|
||||
})
|
||||
if (
|
||||
isNetworkVisible(BraveWallet.CoinType.FIL, BraveWallet.FILECOIN_TESTNET)
|
||||
) {
|
||||
testnetAccounts.push({
|
||||
description: getLocale(
|
||||
'braveWalletCreateAccountFilecoinTestnetDescription'
|
||||
'braveWalletCreateAccountFilecoinTestnetDescription',
|
||||
),
|
||||
name: 'Filecoin Testnet',
|
||||
coin: BraveWallet.CoinType.FIL,
|
||||
fixedNetwork: BraveWallet.FILECOIN_TESTNET,
|
||||
icon: getNetworkLogo(BraveWallet.FILECOIN_TESTNET, 'FIL'),
|
||||
chainIcons: ['filecoin-color']
|
||||
chainIcons: ['filecoin-color'],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -68,20 +68,20 @@ export const CreateAccountOptions = (options: {
|
||||
fixedNetwork: BraveWallet.BITCOIN_MAINNET,
|
||||
coin: BraveWallet.CoinType.BTC,
|
||||
icon: getNetworkLogo(BraveWallet.BITCOIN_MAINNET, 'BTC'),
|
||||
chainIcons: ['btc-color']
|
||||
chainIcons: ['btc-color'],
|
||||
})
|
||||
if (
|
||||
isNetworkVisible(BraveWallet.CoinType.BTC, BraveWallet.BITCOIN_TESTNET)
|
||||
) {
|
||||
testnetAccounts.push({
|
||||
description: getLocale(
|
||||
'braveWalletCreateAccountBitcoinTestnetDescription'
|
||||
'braveWalletCreateAccountBitcoinTestnetDescription',
|
||||
),
|
||||
name: 'Bitcoin Testnet',
|
||||
fixedNetwork: BraveWallet.BITCOIN_TESTNET,
|
||||
coin: BraveWallet.CoinType.BTC,
|
||||
icon: getNetworkLogo(BraveWallet.BITCOIN_TESTNET, 'BTC'),
|
||||
chainIcons: ['btc-color']
|
||||
chainIcons: ['btc-color'],
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -93,20 +93,20 @@ export const CreateAccountOptions = (options: {
|
||||
fixedNetwork: BraveWallet.Z_CASH_MAINNET,
|
||||
coin: BraveWallet.CoinType.ZEC,
|
||||
icon: getNetworkLogo(BraveWallet.Z_CASH_MAINNET, 'ZEC'),
|
||||
chainIcons: []
|
||||
chainIcons: [],
|
||||
})
|
||||
if (
|
||||
isNetworkVisible(BraveWallet.CoinType.ZEC, BraveWallet.Z_CASH_TESTNET)
|
||||
) {
|
||||
testnetAccounts.push({
|
||||
description: getLocale(
|
||||
'braveWalletCreateAccountZCashTestnetDescription'
|
||||
'braveWalletCreateAccountZCashTestnetDescription',
|
||||
),
|
||||
name: 'Zcash Testnet',
|
||||
fixedNetwork: BraveWallet.Z_CASH_TESTNET,
|
||||
coin: BraveWallet.CoinType.ZEC,
|
||||
icon: getNetworkLogo(BraveWallet.Z_CASH_TESTNET, 'ZEC'),
|
||||
chainIcons: []
|
||||
chainIcons: [],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -117,20 +117,20 @@ export const CreateAccountOptions = (options: {
|
||||
fixedNetwork: BraveWallet.CARDANO_MAINNET,
|
||||
coin: BraveWallet.CoinType.ADA,
|
||||
icon: getNetworkLogo(BraveWallet.CARDANO_MAINNET, 'ADA'),
|
||||
chainIcons: ['ada-color']
|
||||
chainIcons: ['ada-color'],
|
||||
})
|
||||
if (
|
||||
isNetworkVisible(BraveWallet.CoinType.ADA, BraveWallet.CARDANO_TESTNET)
|
||||
) {
|
||||
testnetAccounts.push({
|
||||
description: getLocale(
|
||||
'braveWalletCreateAccountCardanoTestnetDescription'
|
||||
'braveWalletCreateAccountCardanoTestnetDescription',
|
||||
),
|
||||
name: 'Cardano Testnet',
|
||||
fixedNetwork: BraveWallet.CARDANO_TESTNET,
|
||||
coin: BraveWallet.CoinType.ADA,
|
||||
icon: getNetworkLogo(BraveWallet.CARDANO_TESTNET, 'ADA'),
|
||||
chainIcons: ['ada-color']
|
||||
chainIcons: ['ada-color'],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,18 +8,18 @@ import { DAppConnectedPermissionsOption } from '../constants/types'
|
||||
|
||||
export const DAppPermittedOptions: DAppConnectedPermissionsOption[] = [
|
||||
{
|
||||
name: 'braveWalletConnectPermissionBalanceAndActivity'
|
||||
name: 'braveWalletConnectPermissionBalanceAndActivity',
|
||||
},
|
||||
{
|
||||
name: 'braveWalletConnectPermissionRequestApproval'
|
||||
name: 'braveWalletConnectPermissionRequestApproval',
|
||||
},
|
||||
{
|
||||
name: 'braveWalletConnectPermissionAddress'
|
||||
}
|
||||
name: 'braveWalletConnectPermissionAddress',
|
||||
},
|
||||
]
|
||||
|
||||
export const DAppNotPermittedOptions: DAppConnectedPermissionsOption[] = [
|
||||
{
|
||||
name: 'braveWalletConnectPermissionMoveFunds'
|
||||
}
|
||||
name: 'braveWalletConnectPermissionMoveFunds',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -9,18 +9,18 @@ import { BraveWallet, DAppPermissionDurationOption } from '../constants/types'
|
||||
export const DAppPermissionDurationOptions: DAppPermissionDurationOption[] = [
|
||||
{
|
||||
name: 'braveWalletPermissionUntilClose',
|
||||
id: BraveWallet.PermissionLifetimeOption.kPageClosed
|
||||
id: BraveWallet.PermissionLifetimeOption.kPageClosed,
|
||||
},
|
||||
{
|
||||
name: 'braveWalletPermissionOneDay',
|
||||
id: BraveWallet.PermissionLifetimeOption.k24Hours
|
||||
id: BraveWallet.PermissionLifetimeOption.k24Hours,
|
||||
},
|
||||
{
|
||||
name: 'braveWalletPermissionOneWeek',
|
||||
id: BraveWallet.PermissionLifetimeOption.k7Days
|
||||
id: BraveWallet.PermissionLifetimeOption.k7Days,
|
||||
},
|
||||
{
|
||||
name: 'braveWalletPermissionForever',
|
||||
id: BraveWallet.PermissionLifetimeOption.kForever
|
||||
}
|
||||
id: BraveWallet.PermissionLifetimeOption.kForever,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -8,26 +8,26 @@ export const ExpirationPresetOptions: ExpirationPresetObjectType[] = [
|
||||
{
|
||||
id: 1,
|
||||
name: '1D',
|
||||
expiration: 1
|
||||
expiration: 1,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '3D',
|
||||
expiration: 3
|
||||
expiration: 3,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '5D',
|
||||
expiration: 5
|
||||
expiration: 5,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '1W',
|
||||
expiration: 7
|
||||
expiration: 7,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '2W',
|
||||
expiration: 14
|
||||
}
|
||||
expiration: 14,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -9,14 +9,14 @@ import { GasFeeOption } from '../constants/types'
|
||||
export const gasFeeOptions: GasFeeOption[] = [
|
||||
{
|
||||
id: 'slow',
|
||||
name: 'braveSwapSlow'
|
||||
name: 'braveSwapSlow',
|
||||
},
|
||||
{
|
||||
id: 'average',
|
||||
name: 'braveSwapAverage'
|
||||
name: 'braveSwapAverage',
|
||||
},
|
||||
{
|
||||
id: 'fast',
|
||||
name: 'braveSwapFast'
|
||||
}
|
||||
name: 'braveSwapFast',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -7,21 +7,21 @@ import { DropdownFilterOption } from '../constants/types'
|
||||
|
||||
export const NoneGroupByOption: DropdownFilterOption = {
|
||||
id: 'none',
|
||||
name: 'braveWalletNone'
|
||||
name: 'braveWalletNone',
|
||||
}
|
||||
|
||||
export const AccountsGroupByOption: DropdownFilterOption = {
|
||||
id: 'accounts',
|
||||
name: 'braveWalletAccounts'
|
||||
name: 'braveWalletAccounts',
|
||||
}
|
||||
|
||||
export const NetworksGroupByOption: DropdownFilterOption = {
|
||||
id: 'networks',
|
||||
name: 'braveWalletNetworks'
|
||||
name: 'braveWalletNetworks',
|
||||
}
|
||||
|
||||
export const GroupAssetsByOptions: DropdownFilterOption[] = [
|
||||
NoneGroupByOption,
|
||||
AccountsGroupByOption,
|
||||
NetworksGroupByOption
|
||||
NetworksGroupByOption,
|
||||
]
|
||||
|
||||
@@ -12,5 +12,5 @@ export const ETH: BlockchainToken = {
|
||||
logo: '',
|
||||
name: 'Ethereum',
|
||||
symbol: 'ETH',
|
||||
visible: true
|
||||
visible: true,
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ import { getLocale } from '$web-common/locale'
|
||||
export const AssetFilterOptions: AssetFilter[] = [
|
||||
{
|
||||
value: 'all',
|
||||
label: getLocale('braveWalletMarketDataAllAssetsFilter')
|
||||
label: getLocale('braveWalletMarketDataAllAssetsFilter'),
|
||||
},
|
||||
{
|
||||
value: 'tradable',
|
||||
label: getLocale('braveWalletMarketDataTradableFilter')
|
||||
}
|
||||
label: getLocale('braveWalletMarketDataTradableFilter'),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -12,38 +12,38 @@ import { MarketGridHeader } from '../constants/types'
|
||||
export const marketGridHeaders: MarketGridHeader[] = [
|
||||
{
|
||||
id: 'assets',
|
||||
label: getLocale('braveWalletMarketDataAssetsColumn')
|
||||
label: getLocale('braveWalletMarketDataAssetsColumn'),
|
||||
},
|
||||
{
|
||||
id: 'currentPrice',
|
||||
label: getLocale('braveWalletMarketDataPriceColumn'),
|
||||
sortable: true
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
id: 'priceChangePercentage24h',
|
||||
label: getLocale('braveWalletMarketData24HrColumn'),
|
||||
sortable: true,
|
||||
width: '80px'
|
||||
width: '80px',
|
||||
},
|
||||
{
|
||||
id: 'marketCap',
|
||||
label: getLocale('braveWalletMarketDataMarketCapColumn'),
|
||||
sortable: true,
|
||||
width: '90px',
|
||||
hideOnPanel: true
|
||||
hideOnPanel: true,
|
||||
},
|
||||
{
|
||||
id: 'totalVolume',
|
||||
label: getLocale('braveWalletMarketDataVolumeColumn'),
|
||||
sortable: true,
|
||||
hideOnPanel: true,
|
||||
width: '95px'
|
||||
width: '95px',
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
label: 'Buy/Deposit',
|
||||
sortable: false,
|
||||
hideOnPanel: true,
|
||||
width: '130px'
|
||||
}
|
||||
width: '130px',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
NavOption,
|
||||
WalletRoutes,
|
||||
AccountPageTabs,
|
||||
PanelTypes
|
||||
PanelTypes,
|
||||
} from '../constants/types'
|
||||
|
||||
const PANEL_TYPES: PanelTypes[] = [
|
||||
@@ -30,15 +30,15 @@ const PANEL_TYPES: PanelTypes[] = [
|
||||
'sitePermissions',
|
||||
'swap',
|
||||
'activity', // Transactions
|
||||
'transactionStatus'
|
||||
'transactionStatus',
|
||||
]
|
||||
|
||||
export const isValidPanelNavigationOption = (
|
||||
panelName: string
|
||||
panelName: string,
|
||||
): panelName is PanelTypes => {
|
||||
return (
|
||||
PANEL_TYPES.includes(panelName as PanelTypes) &&
|
||||
!isPersistanceOfPanelProhibited(panelName as PanelTypes)
|
||||
PANEL_TYPES.includes(panelName as PanelTypes)
|
||||
&& !isPersistanceOfPanelProhibited(panelName as PanelTypes)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ const BridgeOption: NavOption = {
|
||||
id: 'bridge',
|
||||
name: 'braveWalletBridge',
|
||||
icon: 'web3-bridge',
|
||||
route: WalletRoutes.Bridge
|
||||
route: WalletRoutes.Bridge,
|
||||
}
|
||||
|
||||
export const BuySendSwapDepositOptions: NavOption[] = [
|
||||
@@ -54,48 +54,48 @@ export const BuySendSwapDepositOptions: NavOption[] = [
|
||||
id: 'buy',
|
||||
name: 'braveWalletBuy',
|
||||
icon: 'coins-alt1',
|
||||
route: WalletRoutes.FundWalletPageStart
|
||||
route: WalletRoutes.FundWalletPageStart,
|
||||
},
|
||||
{
|
||||
id: 'send',
|
||||
name: 'braveWalletSend',
|
||||
icon: 'send',
|
||||
route: WalletRoutes.Send
|
||||
route: WalletRoutes.Send,
|
||||
},
|
||||
{
|
||||
id: 'swap',
|
||||
name: 'braveWalletSwap',
|
||||
icon: 'currency-exchange',
|
||||
route: WalletRoutes.Swap
|
||||
route: WalletRoutes.Swap,
|
||||
},
|
||||
BridgeOption,
|
||||
{
|
||||
id: 'deposit',
|
||||
name: 'braveWalletDepositCryptoButton',
|
||||
icon: 'money-bag-coins',
|
||||
route: WalletRoutes.DepositFundsPageStart
|
||||
}
|
||||
route: WalletRoutes.DepositFundsPageStart,
|
||||
},
|
||||
]
|
||||
|
||||
const PortfolioActivityNavOption: NavOption = {
|
||||
id: 'activity',
|
||||
name: 'braveWalletActivity',
|
||||
icon: 'activity',
|
||||
route: WalletRoutes.PortfolioActivity
|
||||
route: WalletRoutes.PortfolioActivity,
|
||||
}
|
||||
|
||||
const AssetsNavOption: NavOption = {
|
||||
id: 'assets',
|
||||
name: 'braveWalletAccountsAssets',
|
||||
icon: 'coins',
|
||||
route: WalletRoutes.PortfolioAssets
|
||||
route: WalletRoutes.PortfolioAssets,
|
||||
}
|
||||
|
||||
const ExploreNavOption: NavOption = {
|
||||
id: 'explore',
|
||||
name: 'braveWalletTopNavExplore',
|
||||
icon: 'discover',
|
||||
route: WalletRoutes.Explore
|
||||
route: WalletRoutes.Explore,
|
||||
}
|
||||
|
||||
export const PanelNavOptions: NavOption[] = [
|
||||
@@ -103,21 +103,21 @@ export const PanelNavOptions: NavOption[] = [
|
||||
id: 'portfolio',
|
||||
name: 'braveWalletTopNavPortfolio',
|
||||
icon: 'coins',
|
||||
route: WalletRoutes.Portfolio
|
||||
route: WalletRoutes.Portfolio,
|
||||
},
|
||||
{
|
||||
id: 'connections',
|
||||
name: 'braveWalletConnections',
|
||||
icon: 'link-normal',
|
||||
route: WalletRoutes.Connections
|
||||
route: WalletRoutes.Connections,
|
||||
},
|
||||
{
|
||||
id: 'accounts',
|
||||
name: 'braveWalletTopNavAccounts',
|
||||
icon: 'user-accounts',
|
||||
route: WalletRoutes.Accounts
|
||||
route: WalletRoutes.Accounts,
|
||||
},
|
||||
ExploreNavOption
|
||||
ExploreNavOption,
|
||||
]
|
||||
|
||||
export const NavOptions: NavOption[] = [
|
||||
@@ -125,20 +125,20 @@ export const NavOptions: NavOption[] = [
|
||||
id: 'portfolio',
|
||||
name: 'braveWalletTopNavPortfolio',
|
||||
icon: 'coins',
|
||||
route: WalletRoutes.Portfolio
|
||||
route: WalletRoutes.Portfolio,
|
||||
},
|
||||
{
|
||||
id: 'accounts',
|
||||
name: 'braveWalletTopNavAccounts',
|
||||
icon: 'user-accounts',
|
||||
route: WalletRoutes.Accounts
|
||||
route: WalletRoutes.Accounts,
|
||||
},
|
||||
ExploreNavOption
|
||||
ExploreNavOption,
|
||||
]
|
||||
|
||||
export const AllNavOptions: NavOption[] = [
|
||||
...NavOptions,
|
||||
...BuySendSwapDepositOptions
|
||||
...BuySendSwapDepositOptions,
|
||||
]
|
||||
|
||||
export const PortfolioNavOptions: NavOption[] = [
|
||||
@@ -147,14 +147,14 @@ export const PortfolioNavOptions: NavOption[] = [
|
||||
id: 'nfts',
|
||||
name: 'braveWalletTopNavNFTS',
|
||||
icon: 'grid04',
|
||||
route: WalletRoutes.PortfolioNFTs
|
||||
route: WalletRoutes.PortfolioNFTs,
|
||||
},
|
||||
PortfolioActivityNavOption
|
||||
PortfolioActivityNavOption,
|
||||
]
|
||||
|
||||
export const PortfolioNavOptionsNoNFTsTab: NavOption[] = [
|
||||
AssetsNavOption,
|
||||
PortfolioActivityNavOption
|
||||
PortfolioActivityNavOption,
|
||||
]
|
||||
|
||||
export const ExploreNavOptions: NavOption[] = [
|
||||
@@ -162,14 +162,14 @@ export const ExploreNavOptions: NavOption[] = [
|
||||
id: 'market',
|
||||
name: 'braveWalletTopNavMarket',
|
||||
icon: 'discover',
|
||||
route: WalletRoutes.Market
|
||||
route: WalletRoutes.Market,
|
||||
},
|
||||
{
|
||||
id: 'web3',
|
||||
name: 'braveWalletWeb3',
|
||||
icon: 'discover',
|
||||
route: WalletRoutes.Web3
|
||||
}
|
||||
route: WalletRoutes.Web3,
|
||||
},
|
||||
]
|
||||
|
||||
export const PortfolioAssetOptions: NavOption[] = [
|
||||
@@ -177,14 +177,14 @@ export const PortfolioAssetOptions: NavOption[] = [
|
||||
id: 'accounts',
|
||||
name: 'braveWalletTopNavAccounts',
|
||||
icon: 'user-accounts',
|
||||
route: WalletRoutes.AccountsHash
|
||||
route: WalletRoutes.AccountsHash,
|
||||
},
|
||||
{
|
||||
id: 'transactions',
|
||||
name: 'braveWalletTransactions',
|
||||
icon: 'activity',
|
||||
route: WalletRoutes.TransactionsHash
|
||||
}
|
||||
route: WalletRoutes.TransactionsHash,
|
||||
},
|
||||
]
|
||||
|
||||
export const EditVisibleAssetsOptions: NavOption[] = [
|
||||
@@ -192,14 +192,14 @@ export const EditVisibleAssetsOptions: NavOption[] = [
|
||||
id: 'my_assets',
|
||||
name: 'braveWalletMyAssets',
|
||||
icon: '',
|
||||
route: WalletRoutes.MyAssetsHash
|
||||
route: WalletRoutes.MyAssetsHash,
|
||||
},
|
||||
{
|
||||
id: 'available_assets',
|
||||
name: 'braveWalletAvailableAssets',
|
||||
icon: '',
|
||||
route: WalletRoutes.AvailableAssetsHash
|
||||
}
|
||||
route: WalletRoutes.AvailableAssetsHash,
|
||||
},
|
||||
]
|
||||
|
||||
export const CreateAccountOptions: NavOption[] = [
|
||||
@@ -207,20 +207,20 @@ export const CreateAccountOptions: NavOption[] = [
|
||||
id: 'accounts',
|
||||
name: 'braveWalletCreateAccountButton',
|
||||
icon: 'plus-add',
|
||||
route: WalletRoutes.CreateAccountModalStart
|
||||
route: WalletRoutes.CreateAccountModalStart,
|
||||
},
|
||||
{
|
||||
id: 'accounts',
|
||||
name: 'braveWalletImportAccount',
|
||||
icon: 'product-brave-wallet',
|
||||
route: WalletRoutes.ImportAccountModalStart
|
||||
route: WalletRoutes.ImportAccountModalStart,
|
||||
},
|
||||
{
|
||||
id: 'accounts',
|
||||
name: 'braveWalletConnectHardwareWallet',
|
||||
icon: 'flashdrive',
|
||||
route: WalletRoutes.AddHardwareAccountModalStart
|
||||
}
|
||||
route: WalletRoutes.AddHardwareAccountModalStart,
|
||||
},
|
||||
]
|
||||
|
||||
export const AccountDetailsOptions: NavOption[] = [
|
||||
@@ -228,18 +228,18 @@ export const AccountDetailsOptions: NavOption[] = [
|
||||
id: 'assets',
|
||||
name: 'braveWalletAccountsAssets',
|
||||
icon: '',
|
||||
route: AccountPageTabs.AccountAssetsSub
|
||||
route: AccountPageTabs.AccountAssetsSub,
|
||||
},
|
||||
{
|
||||
id: 'nfts',
|
||||
name: 'braveWalletTopNavNFTS',
|
||||
icon: '',
|
||||
route: AccountPageTabs.AccountNFTsSub
|
||||
route: AccountPageTabs.AccountNFTsSub,
|
||||
},
|
||||
{
|
||||
id: 'transactions',
|
||||
name: 'braveWalletTransactions',
|
||||
icon: '',
|
||||
route: AccountPageTabs.AccountTransactionsSub
|
||||
}
|
||||
route: AccountPageTabs.AccountTransactionsSub,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -18,14 +18,14 @@ export const AllNetworksOption: BraveWallet.NetworkInfo = {
|
||||
rpcEndpoints: [],
|
||||
symbol: 'all',
|
||||
symbolName: 'all',
|
||||
supportedKeyrings: []
|
||||
supportedKeyrings: [],
|
||||
}
|
||||
|
||||
export const AllNetworksOptionNetworkId = getNetworkId(AllNetworksOption)
|
||||
|
||||
export const AllNetworksOptionDefault: NetworkFilterType = {
|
||||
chainId: 'all',
|
||||
coin: 0
|
||||
coin: 0,
|
||||
}
|
||||
|
||||
export const SupportedTopLevelChainIds = [
|
||||
@@ -33,5 +33,5 @@ export const SupportedTopLevelChainIds = [
|
||||
BraveWallet.SOLANA_MAINNET,
|
||||
BraveWallet.FILECOIN_MAINNET,
|
||||
BraveWallet.BITCOIN_MAINNET,
|
||||
BraveWallet.Z_CASH_MAINNET
|
||||
BraveWallet.Z_CASH_MAINNET,
|
||||
]
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
RewardsIconL,
|
||||
RewardsIconD,
|
||||
CreditCardIconL,
|
||||
CreditCardIconD
|
||||
CreditCardIconD,
|
||||
} from '../assets/svg-icons/nav-button-icons'
|
||||
|
||||
export const NavOptions = (): NavObjectType[] => [
|
||||
@@ -18,18 +18,18 @@ export const NavOptions = (): NavObjectType[] => [
|
||||
name: getLocale('braveWalletSideNavCrypto'),
|
||||
primaryIcon: WalletIconL,
|
||||
secondaryIcon: WalletIconD,
|
||||
id: 'crypto'
|
||||
id: 'crypto',
|
||||
},
|
||||
{
|
||||
name: getLocale('braveWalletSideNavRewards'),
|
||||
primaryIcon: RewardsIconL,
|
||||
secondaryIcon: RewardsIconD,
|
||||
id: 'rewards'
|
||||
id: 'rewards',
|
||||
},
|
||||
{
|
||||
name: getLocale('braveWalletSideNavCards'),
|
||||
primaryIcon: CreditCardIconL,
|
||||
secondaryIcon: CreditCardIconD,
|
||||
id: 'cards'
|
||||
}
|
||||
id: 'cards',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -7,14 +7,14 @@ import { SlippagePresetObjectType } from '../constants/types'
|
||||
export const SlippagePresetOptions: SlippagePresetObjectType[] = [
|
||||
{
|
||||
id: 1,
|
||||
slippage: 0.5
|
||||
slippage: 0.5,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
slippage: 1
|
||||
slippage: 1,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
slippage: 2
|
||||
}
|
||||
slippage: 2,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -9,10 +9,10 @@ import { SwapAndSend } from '../constants/types'
|
||||
export const SwapAndSendOptions: SwapAndSend[] = [
|
||||
{
|
||||
label: 'braveSwapToAccount',
|
||||
name: 'to-account'
|
||||
name: 'to-account',
|
||||
},
|
||||
{
|
||||
label: 'braveSwapToAddress',
|
||||
name: 'to-address'
|
||||
}
|
||||
name: 'to-address',
|
||||
},
|
||||
]
|
||||
|
||||
@@ -9,24 +9,24 @@ import { getLocale } from '$web-common/locale'
|
||||
export const TopNavOptions = (): TopTabNavObjectType[] => [
|
||||
{
|
||||
id: 'portfolio',
|
||||
name: getLocale('braveWalletTopNavPortfolio')
|
||||
name: getLocale('braveWalletTopNavPortfolio'),
|
||||
},
|
||||
{
|
||||
id: 'nfts',
|
||||
name: getLocale('braveWalletTopNavNFTS')
|
||||
name: getLocale('braveWalletTopNavNFTS'),
|
||||
},
|
||||
{
|
||||
id: 'activity', // Transactions
|
||||
name: getLocale('braveWalletActivity')
|
||||
name: getLocale('braveWalletActivity'),
|
||||
},
|
||||
{
|
||||
id: 'accounts',
|
||||
name: getLocale('braveWalletTopNavAccounts')
|
||||
name: getLocale('braveWalletTopNavAccounts'),
|
||||
},
|
||||
{
|
||||
id: 'market',
|
||||
name: getLocale('braveWalletTopNavMarket')
|
||||
}
|
||||
name: getLocale('braveWalletTopNavMarket'),
|
||||
},
|
||||
// Temp commented out for MVP
|
||||
// {
|
||||
// id: 'apps',
|
||||
|
||||
@@ -15,8 +15,8 @@ const walletDarkTheme: ITheme & IThemeWallet = {
|
||||
...defaultDarkTheme.color,
|
||||
text: colors.white,
|
||||
panelBackground: colors.grey900,
|
||||
outlineColor: 'rgba(255,255,255,0.5)'
|
||||
}
|
||||
outlineColor: 'rgba(255,255,255,0.5)',
|
||||
},
|
||||
}
|
||||
|
||||
export default walletDarkTheme
|
||||
|
||||
@@ -16,8 +16,8 @@ const walletLightTheme: ITheme & IThemeWallet = {
|
||||
text: colors.neutral900,
|
||||
panelBackground: '#F9F9FD',
|
||||
panelBackgroundSecondary: colors.neutral000,
|
||||
outlineColor: 'rgba(255,80,0,0.2)'
|
||||
}
|
||||
outlineColor: 'rgba(255,80,0,0.2)',
|
||||
},
|
||||
}
|
||||
|
||||
export default walletLightTheme
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
SignMessageResponsePayload,
|
||||
UnlockResponse,
|
||||
SignTypedMessageCommand,
|
||||
SignTypedMessageResponsePayload
|
||||
SignTypedMessageResponsePayload,
|
||||
} from '../common/hardware/trezor/trezor-messages'
|
||||
import { addTrezorCommandHandler } from '../common/hardware/trezor/trezor-command-handler'
|
||||
|
||||
@@ -33,22 +33,22 @@ const hexPad = (hexString: string) => {
|
||||
const createUnlockResponse = (
|
||||
command: UnlockCommand,
|
||||
result: boolean,
|
||||
error?: Unsuccessful
|
||||
error?: Unsuccessful,
|
||||
): UnlockResponsePayload => {
|
||||
const payload: UnlockResponse = !result && error ? error : { success: result }
|
||||
return {
|
||||
...command,
|
||||
payload: payload
|
||||
payload: payload,
|
||||
}
|
||||
}
|
||||
|
||||
const createGetAccountsResponse = (
|
||||
command: GetAccountsCommand,
|
||||
result: TrezorGetAccountsResponse
|
||||
result: TrezorGetAccountsResponse,
|
||||
): GetAccountsResponsePayload => {
|
||||
return {
|
||||
...command,
|
||||
payload: result
|
||||
payload: result,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ addTrezorCommandHandler(
|
||||
lazyLoad: false,
|
||||
manifest: {
|
||||
email: 'support@brave.com',
|
||||
appUrl: 'https://brave.com'
|
||||
}
|
||||
appUrl: 'https://brave.com',
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
resolve(createUnlockResponse(command, true))
|
||||
@@ -71,30 +71,30 @@ addTrezorCommandHandler(
|
||||
resolve(createUnlockResponse(command, false, error))
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
addTrezorCommandHandler(
|
||||
TrezorCommand.GetAccounts,
|
||||
(
|
||||
command: GetAccountsCommand,
|
||||
source: Window
|
||||
source: Window,
|
||||
): Promise<GetAccountsResponsePayload> => {
|
||||
return new Promise(async (resolve) => {
|
||||
TrezorConnect.getPublicKey({ bundle: command.paths }).then(
|
||||
(result: TrezorGetAccountsResponse) => {
|
||||
resolve(createGetAccountsResponse(command, result))
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
addTrezorCommandHandler(
|
||||
TrezorCommand.SignTransaction,
|
||||
(
|
||||
command: SignTransactionCommand,
|
||||
source: Window
|
||||
source: Window,
|
||||
): Promise<SignTransactionResponsePayload> => {
|
||||
return new Promise(async (resolve) => {
|
||||
TrezorConnect.ethereumSignTransaction(command.payload).then(
|
||||
@@ -106,9 +106,9 @@ addTrezorCommandHandler(
|
||||
success: false,
|
||||
payload: {
|
||||
error: result.payload.error,
|
||||
code: result.payload.code
|
||||
}
|
||||
}
|
||||
code: result.payload.code,
|
||||
},
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -120,21 +120,21 @@ addTrezorCommandHandler(
|
||||
// https://docs.trezor.io/trezor-suite/packages/connect/methods/ethereumSignTransaction.html#result
|
||||
vBytes: Buffer.from(hexPad(result.payload.v.slice(2)), 'hex'),
|
||||
rBytes: Buffer.from(result.payload.r.slice(2), 'hex'),
|
||||
sBytes: Buffer.from(result.payload.s.slice(2), 'hex')
|
||||
}
|
||||
}
|
||||
sBytes: Buffer.from(result.payload.s.slice(2), 'hex'),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
addTrezorCommandHandler(
|
||||
TrezorCommand.SignMessage,
|
||||
(
|
||||
command: SignMessageCommand,
|
||||
source: Window
|
||||
source: Window,
|
||||
): Promise<SignMessageResponsePayload> => {
|
||||
return new Promise(async (resolve) => {
|
||||
TrezorConnect.ethereumSignMessage(command.payload).then(
|
||||
@@ -146,9 +146,9 @@ addTrezorCommandHandler(
|
||||
success: false,
|
||||
payload: {
|
||||
error: result.payload.error,
|
||||
code: result.payload.code
|
||||
}
|
||||
}
|
||||
code: result.payload.code,
|
||||
},
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -159,21 +159,21 @@ addTrezorCommandHandler(
|
||||
payload: {
|
||||
success: true,
|
||||
payload: {
|
||||
bytes: Buffer.from(result.payload.signature, 'hex')
|
||||
}
|
||||
}
|
||||
bytes: Buffer.from(result.payload.signature, 'hex'),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
addTrezorCommandHandler(
|
||||
TrezorCommand.SignTypedMessage,
|
||||
(
|
||||
command: SignTypedMessageCommand,
|
||||
source: Window
|
||||
source: Window,
|
||||
): Promise<SignTypedMessageResponsePayload> => {
|
||||
return new Promise(async (resolve) => {
|
||||
TrezorConnect.ethereumSignTypedData(command.payload).then(
|
||||
@@ -185,9 +185,9 @@ addTrezorCommandHandler(
|
||||
success: false,
|
||||
payload: {
|
||||
error: result.payload.error,
|
||||
code: result.payload.code
|
||||
}
|
||||
}
|
||||
code: result.payload.code,
|
||||
},
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -198,12 +198,12 @@ addTrezorCommandHandler(
|
||||
payload: {
|
||||
success: true,
|
||||
payload: {
|
||||
bytes: Buffer.from(result.payload.signature.slice(2), 'hex')
|
||||
}
|
||||
}
|
||||
bytes: Buffer.from(result.payload.signature.slice(2), 'hex'),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user