From 0a839ff36eb1e827b17af5e4ed1a08de70aab86f Mon Sep 17 00:00:00 2001 From: Ilja Date: Tue, 15 Mar 2022 14:48:35 +0200 Subject: [PATCH] Expose all mnemonics and secret keys in settings --- wallets/react-wallet-v2/src/lib/SolanaLib.ts | 4 ++ .../react-wallet-v2/src/pages/settings.tsx | 45 ++++++++++++------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/wallets/react-wallet-v2/src/lib/SolanaLib.ts b/wallets/react-wallet-v2/src/lib/SolanaLib.ts index ce999aa..e6c77b2 100644 --- a/wallets/react-wallet-v2/src/lib/SolanaLib.ts +++ b/wallets/react-wallet-v2/src/lib/SolanaLib.ts @@ -29,6 +29,10 @@ export default class SolanaLib { return await this.keypair.publicKey.toBase58() } + public getSecretKey() { + return this.keypair.secretKey.toString() + } + public async signMessage(message: string) { const signature = nacl.sign.detached(bs58.decode(message), this.keypair.secretKey) diff --git a/wallets/react-wallet-v2/src/pages/settings.tsx b/wallets/react-wallet-v2/src/pages/settings.tsx index b971a03..4b9b7c2 100644 --- a/wallets/react-wallet-v2/src/pages/settings.tsx +++ b/wallets/react-wallet-v2/src/pages/settings.tsx @@ -1,29 +1,18 @@ import PageHeader from '@/components/PageHeader' import SettingsStore from '@/store/SettingsStore' +import { cosmosWallets } from '@/utils/CosmosWalletUtil' import { eip155Wallets } from '@/utils/EIP155WalletUtil' +import { solanaWallets } from '@/utils/SolanaWalletUtil' import { Card, Divider, Row, Switch, Text } from '@nextui-org/react' import { Fragment } from 'react' import { useSnapshot } from 'valtio' export default function SettingsPage() { - const { testNets, eip155Address } = useSnapshot(SettingsStore.state) + const { testNets, eip155Address, cosmosAddress, solanaAddress } = useSnapshot(SettingsStore.state) return ( - - Mnemonic - - - {eip155Wallets[eip155Address].mnemonic.phrase} - - - - Warning: mnemonic is provided for development purposes only and should not be used - elsewhere! - - - Testnets @@ -33,7 +22,33 @@ export default function SettingsPage() { {testNets ? 'Enabled' : 'Disabled'} - + + + + Warning: mnemonics and secret keys are provided for development purposes only and should not + be used elsewhere! + + + + EIP155 Mnemonic + + + {eip155Wallets[eip155Address].getMnemonic()} + + + + Cosmos Mnemonic + + + {cosmosWallets[cosmosAddress].getMnemonic()} + + + + Solana Secret Key + + + {solanaWallets[solanaAddress].getSecretKey()} + ) }