diff --git a/.cert/cert.pem b/.cert/cert.pem new file mode 100644 index 00000000..c0c9d18f --- /dev/null +++ b/.cert/cert.pem @@ -0,0 +1,27 @@ +-----BEGIN CERTIFICATE----- +MIIEozCCAwugAwIBAgIRALVgQ4iLzJxtipCRuRZ9FWMwDQYJKoZIhvcNAQELBQAw +gbkxHjAcBgNVBAoTFW1rY2VydCBkZXZlbG9wbWVudCBDQTFHMEUGA1UECww+YmFy +dG9zei5saXBpbnNraUBCYXJ0b3N6cy1NYWNCb29rLVByby5sb2NhbCAoQmFydG9z +eiBMaXBpbnNraSkxTjBMBgNVBAMMRW1rY2VydCBiYXJ0b3N6LmxpcGluc2tpQEJh +cnRvc3pzLU1hY0Jvb2stUHJvLmxvY2FsIChCYXJ0b3N6IExpcGluc2tpKTAeFw0x +OTA2MDEwMDAwMDBaFw0zMDEwMTgwMjU2MzhaMHIxJzAlBgNVBAoTHm1rY2VydCBk +ZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTFHMEUGA1UECww+YmFydG9zei5saXBpbnNr +aUBCYXJ0b3N6cy1NYWNCb29rLVByby5sb2NhbCAoQmFydG9zeiBMaXBpbnNraSkw +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDOwT5doIalTreoX71W6TLr +V2tijuSHLRmIDcDutPM/cPYNUHgkGthZveMdrcoaDqveHZdGjWY39U+8kzrdcbV2 +7oXNd4ivC5acS8DIJNCO3G1JcNSYnxmZXEaPAHXaVke+SMXVTWbUvA8Rkyor9hPe +KW8gtFqm2IT/klRBfWuYLO24dILrCfYkqJkZ6g++X7pBp1R/8h9SYdHWbHxIDk2d +CWaHNA7v8g1bMw2ZmxICwgbsARplLgIU/ZWRKQik2axOIeHDpoeV9/hj4SXvs1bA +yvO8oNMjYuekkAs117NAfJb9oR6p/iet39IfzY4zQmBqwFDuAu7+nZq1NfFLajor +AgMBAAGjbDBqMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAM +BgNVHRMBAf8EAjAAMB8GA1UdIwQYMBaAFLRNFQImfwsJQApnvaPukIsWedjpMBQG +A1UdEQQNMAuCCWxvY2FsaG9zdDANBgkqhkiG9w0BAQsFAAOCAYEAgm1tjv0cRoBR +lBzIajECMHVK1dHYARaaFrG4ll1DpWS38Cyn2FN/YIIdTrzh8vFIkV/Leeozcjp8 +nE84zziw9nYvX86SfKtv8uVaVLPoNm2hl9JQS/19dMrB25vpeDGJqmnF3/n7oVEC +SY6fY2xLMx47tpnT5P9NuXgP6Zz6KVQp+CPEfoIkTo+dU0Kk67K5Q9OR42SyiRG2 +JxSBymbPV/mHwOxAS2M6QMODPt+FpVYeiz+iM6d1lL2NGs2CnyBFaFLNlmxij9yL +rZoU+Om5LrhgY5CL7/DVkU6xZC0VI9AZvV3eV5ouPv4ofH47BSOkxwLj5V4xFGTf ++1YRuvqE12EecBpz5g/33LzrkipA7G6P1Oca38g7Xkv6+XKALXIZ2dtcXUp7s7Ty +Cf6Nydlgeqe6Ik6+OKgWIwCahr2cWWVKC/JFMqOYugD4dYcyvbv+V06YEQvYJP5B +yhVdn4uVAfrGGFUCRm9ZM3EhSPZlNwVcG6l5jaV/48L+Uy32VGvJ +-----END CERTIFICATE----- diff --git a/.cert/key.pem b/.cert/key.pem new file mode 100644 index 00000000..2d61e87b --- /dev/null +++ b/.cert/key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDOwT5doIalTreo +X71W6TLrV2tijuSHLRmIDcDutPM/cPYNUHgkGthZveMdrcoaDqveHZdGjWY39U+8 +kzrdcbV27oXNd4ivC5acS8DIJNCO3G1JcNSYnxmZXEaPAHXaVke+SMXVTWbUvA8R +kyor9hPeKW8gtFqm2IT/klRBfWuYLO24dILrCfYkqJkZ6g++X7pBp1R/8h9SYdHW +bHxIDk2dCWaHNA7v8g1bMw2ZmxICwgbsARplLgIU/ZWRKQik2axOIeHDpoeV9/hj +4SXvs1bAyvO8oNMjYuekkAs117NAfJb9oR6p/iet39IfzY4zQmBqwFDuAu7+nZq1 +NfFLajorAgMBAAECggEBAMuSWeW1+N0q9IpEOhko44n1OTaBm2G9djYP1Lc0U41T +m/DgGmryQ7OY09aVFzkw2OiKGjjNYKgYUbpK/Nqs6w9/Kx9zYpF3x4N80wQ9u1vu +jWySO8FKZdoqkQ6cVW31Jg6leKTc4TL1N6EGVa+TS1yjT1fUPK2q4skBOxSAeUAK +t5OvL5eeuumu+Ya3nrwQ1wp1ZBWhkeDIGjED8SDPfT0kU4v8dKTJcXk7ooF5s1OZ +H6HSzEej8eZSfBLDTwPsHylaGTcTi9Tgi8CnjAVdBLaFJlS+bkvv7m5/jnuEpofX +HkyAW5LDnIvHLycE3Ql9BQsR/DF9uzQvn9VRwPGQm4ECgYEA6/eyWhQfl4rDfjQi +fzQgjEYnTbE69R3LUUKulUQQeBYcZO2JAAGZ45G6lZ1zEWFmXuj0aQRYpj798cTg +0ZyH7Dllae8GPZlQ0u/Pxp03DzrvNGbHiTEBYqyVB+gJFn9Robm1eG+kP3QVgaIq +iOXwnUGL74MaJKdwi9ruhzLaQwUCgYEA4E6qJwkBRkGfpjSc0stwTEd+04nSPU1u +V3jFkxS/MNHCF/FUOGBKvrEbbedZ4DRiHjmQ6+zsvl+5jW75bw2rrxxxjkvpNjZe +BOKhac7c+jHXEAm4xuP6lUnPOenBhy/AvOJMm+6wzxdvTzp2gfnfIUOld24bdSXP +29yOzOpYb28CgYAlDn0f0FE1x0D0LNPODi2eWdYKSW7s14T6efJY1puPgEltQDBn +o9i6+EPJAzTy4czl0sevRlN1qCbRNQ3pXR+rZUgb3sGoIs+ikK6cjkv7RFIUdJ+Z +V+zTxi6RU0s6ETyMnVF2XHH61Qwbk5ACd7nVuFl1f603XGQ8UmFrMf080QKBgQDQ +a2eg87YScOGGDvb0ywFib0BCEJqgSXVQo7B5lNp94zmFA8EszRRGkcwZ19DkCeht +izHEdhYYYlvINihg7wPqpvRAsvpUXDoKMganiQY9F9hsV4wwih8JXlbFyhT/pvhg +yalDbostMepEZN8+sE2K3A9ApLewp1y3Pv4VG17m0wKBgB7GIrI2Jx5CG4yFoM8y +kB5rbvNlGAER58AMhzMebs7e2pQg0GxMpaNwqSZyVG0kLq7ayXn9ExA+uQpAG6cR +fnBWVflYf0hKIC1M6U9kOle6lZ/Nbdo80wGa5z3Ieup6w9WB0pbtifvbsnv6RLeA +S7MNQDcNXJxQulqppa+1BOTl +-----END PRIVATE KEY----- diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..f98abe2c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +insert_final_newline = true + +[*.{js}] +charset = utf-8 + +[src/**.js] +indent_style = space +indent_size = 2 + +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/.env.development b/.env.development new file mode 100644 index 00000000..74cc4ab5 --- /dev/null +++ b/.env.development @@ -0,0 +1,2 @@ +HTTPS=true +SSL_CRT_FILE=./.cert/cert.pem SSL_KEY_FILE=./.cert/key.pem \ No newline at end of file diff --git a/LICENSE b/LICENSE index 6623dd0e..2c8c9e05 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,201 @@ -Copyright 2020 Serum Foundation + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - http://www.apache.org/licenses/LICENSE-2.0 + 1. Definitions. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020 Serum Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/package.json b/package.json index 1e3e88b8..45704040 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "@ledgerhq/hw-transport-webusb": "^5.34.0", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", "@project-serum/serum": "^0.13.11", diff --git a/public/favicon.ico b/public/favicon.ico index bcd5dfd6..a686df69 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/logo192.png b/public/logo192.png index fc44b0a3..3d620c55 100644 Binary files a/public/logo192.png and b/public/logo192.png differ diff --git a/public/logo512.png b/public/logo512.png index a4e47a65..013b5d32 100644 Binary files a/public/logo512.png and b/public/logo512.png differ diff --git a/src/App.js b/src/App.js index 43f4a3fa..a5a3ea8f 100644 --- a/src/App.js +++ b/src/App.js @@ -38,16 +38,17 @@ export default function App() { }> + - - + + }> - - + + diff --git a/src/components/AddAccountDialog.js b/src/components/AddAccountDialog.js index d0857ff2..1ae67fe2 100644 --- a/src/components/AddAccountDialog.js +++ b/src/components/AddAccountDialog.js @@ -16,7 +16,9 @@ export default function AddAccountDialog({ open, onAdd, onClose }) { const [isImport, setIsImport] = useState(false); const [importedPrivateKey, setPrivateKey] = useState(''); - const importedAccount = isImport ? decodeAccount(importedPrivateKey) : undefined; + const importedAccount = isImport + ? decodeAccount(importedPrivateKey) + : undefined; const isAddEnabled = isImport ? name && importedAccount !== undefined : name; return ( diff --git a/src/components/AddHarwareWalletDialog.js b/src/components/AddHarwareWalletDialog.js new file mode 100644 index 00000000..cf09a874 --- /dev/null +++ b/src/components/AddHarwareWalletDialog.js @@ -0,0 +1,87 @@ +import React, { useEffect, useState } from 'react'; +import DialogActions from '@material-ui/core/DialogActions'; +import Button from '@material-ui/core/Button'; +import DialogTitle from '@material-ui/core/DialogTitle'; +import DialogContent from '@material-ui/core/DialogContent'; +import DialogForm from './DialogForm'; +import { LedgerWalletProvider } from '../utils/walletProvider/ledger'; +import CircularProgress from '@material-ui/core/CircularProgress'; +import { useSnackbar } from 'notistack'; + +export default function AddHardwareWalletDialog({ open, onAdd, onClose }) { + const [pubKey, setPubKey] = useState(); + const { enqueueSnackbar } = useSnackbar(); + + useEffect(() => { + (async () => { + if (open) { + try { + const provider = new LedgerWalletProvider(); + await provider.init(); + setPubKey(provider.publicKey); + } catch (err) { + console.log( + `received error when attempting to connect ledger: ${err}`, + ); + if (err.statusCode === 0x6804) { + enqueueSnackbar('Unlock ledger device', { variant: 'error' }); + } + setPubKey(undefined); + onClose(); + } + } + })(); + }, [open, onClose, enqueueSnackbar]); + + return ( + {}} + onClose={() => { + setPubKey(undefined); + onClose(); + }} + onSubmit={() => { + setPubKey(undefined); + onAdd(pubKey); + onClose(); + }} + fullWidth + > + Add hardware wallet + +
+ {pubKey ? ( + <> + Hardware wallet detected: +
{pubKey.toString()}
+ + ) : ( + <> + Connect your ledger and open the Solana application + + + )} +
+
+ + + + +
+ ); +} diff --git a/src/components/BalancesList.js b/src/components/BalancesList.js index 0839043b..5086c688 100644 --- a/src/components/BalancesList.js +++ b/src/components/BalancesList.js @@ -7,7 +7,8 @@ import { refreshWalletPublicKeys, useBalanceInfo, useWallet, - useWalletPublicKeys, useWalletSelector, + useWalletPublicKeys, + useWalletSelector, } from '../utils/wallet'; import LoadingIndicator from './LoadingIndicator'; import Collapse from '@material-ui/core/Collapse'; @@ -42,7 +43,7 @@ import { showTokenInfoDialog } from '../utils/config'; import CloseTokenAccountDialog from './CloseTokenAccountButton'; import ListItemIcon from '@material-ui/core/ListItemIcon'; import TokenIcon from './TokenIcon'; -import EditAccountNameDialog from "./EditAccountNameDialog"; +import EditAccountNameDialog from './EditAccountNameDialog'; const balanceFormat = new Intl.NumberFormat(undefined, { minimumFractionDigits: 4, @@ -54,9 +55,11 @@ export default function BalancesList() { const wallet = useWallet(); const [publicKeys, loaded] = useWalletPublicKeys(); const [showAddTokenDialog, setShowAddTokenDialog] = useState(false); - const [showEditAccountNameDialog, setShowEditAccountNameDialog] = useState(false); + const [showEditAccountNameDialog, setShowEditAccountNameDialog] = useState( + false, + ); const { accounts, setAccountName } = useWalletSelector(); - const selectedAccount = accounts.find(a => a.isSelected) + const selectedAccount = accounts.find((a) => a.isSelected); return ( @@ -65,13 +68,15 @@ export default function BalancesList() { {selectedAccount && selectedAccount.name} Balances - {selectedAccount && selectedAccount.name !== "Main account" && - - setShowEditAccountNameDialog(true)}> - - - - } + {selectedAccount && + selectedAccount.name !== 'Main account' && + selectedAccount.name !== 'Hardware wallet' && ( + + setShowEditAccountNameDialog(true)}> + + + + )} setShowAddTokenDialog(true)}> @@ -108,7 +113,7 @@ export default function BalancesList() { oldName={selectedAccount ? selectedAccount.name : ''} onEdit={(name) => { setAccountName(selectedAccount.selector, name); - setShowEditAccountNameDialog(false) + setShowEditAccountNameDialog(false); }} /> @@ -133,10 +138,11 @@ const useStyles = makeStyles((theme) => ({ }, })); -function BalanceListItem({ publicKey }) { +export function BalanceListItem({ publicKey, expandable }) { const balanceInfo = useBalanceInfo(publicKey); const classes = useStyles(); const [open, setOpen] = useState(false); + expandable = expandable === undefined ? true : expandable; if (!balanceInfo) { return ; @@ -146,7 +152,7 @@ function BalanceListItem({ publicKey }) { return ( <> - setOpen((open) => !open)}> + expandable && setOpen((open) => !open)}> @@ -161,7 +167,7 @@ function BalanceListItem({ publicKey }) { secondary={publicKey.toBase58()} secondaryTypographyProps={{ className: classes.address }} /> - {open ? : } + {expandable ? open ? : : <>} ; @@ -197,10 +204,12 @@ function BalanceListItemDetails({ publicKey, balanceInfo }) { return ( <> - setExportAccDialogOpen(false)} - open={exportAccDialogOpen} - /> + {wallet.allowsExport && ( + setExportAccDialogOpen(false)} + open={exportAccDialogOpen} + /> + )}
{!publicKey.equals(owner) && showTokenInfoDialog ? ( @@ -270,7 +279,7 @@ function BalanceListItemDetails({ publicKey, balanceInfo }) {
- {exportNeedsDisplay && ( + {exportNeedsDisplay && wallet.allowsExport && (
setExportAccDialogOpen(true)}> diff --git a/src/components/DebugButtons.js b/src/components/DebugButtons.js index 1173291e..a6f12b04 100644 --- a/src/components/DebugButtons.js +++ b/src/components/DebugButtons.js @@ -20,7 +20,7 @@ export default function DebugButtons() { const wallet = useWallet(); const updateTokenName = useUpdateTokenName(); const { endpoint } = useConnectionConfig(); - const balanceInfo = useBalanceInfo(wallet.account.publicKey); + const balanceInfo = useBalanceInfo(wallet.publicKey); const [sendTransaction, sending] = useSendTransaction(); const callAsync = useCallAsync(); @@ -28,14 +28,11 @@ export default function DebugButtons() { function requestAirdrop() { callAsync( - wallet.connection.requestAirdrop( - wallet.account.publicKey, - LAMPORTS_PER_SOL, - ), + wallet.connection.requestAirdrop(wallet.publicKey, LAMPORTS_PER_SOL), { onSuccess: async () => { await sleep(5000); - refreshAccountInfo(wallet.connection, wallet.account.publicKey); + refreshAccountInfo(wallet.connection, wallet.publicKey); }, successMessage: 'Success! Please wait up to 30 seconds for the SOL tokens to appear in your wallet.', @@ -53,7 +50,7 @@ export default function DebugButtons() { sendTransaction( createAndInitializeMint({ connection: wallet.connection, - owner: wallet.account, + owner: wallet, mint, amount: 1000, decimals: 2, diff --git a/src/components/DeleteAccountDialog.js b/src/components/DeleteAccountDialog.js index 3f507225..67ff5583 100644 --- a/src/components/DeleteAccountDialog.js +++ b/src/components/DeleteAccountDialog.js @@ -1,12 +1,16 @@ -import React from "react"; -import DialogForm from "./DialogForm"; -import {forgetWallet} from "../utils/wallet-seed"; -import DialogTitle from "@material-ui/core/DialogTitle"; -import {DialogContentText} from "@material-ui/core"; -import DialogActions from "@material-ui/core/DialogActions"; -import Button from "@material-ui/core/Button"; +import React from 'react'; +import DialogForm from './DialogForm'; +import { forgetWallet } from '../utils/wallet-seed'; +import DialogTitle from '@material-ui/core/DialogTitle'; +import { DialogContentText } from '@material-ui/core'; +import DialogActions from '@material-ui/core/DialogActions'; +import Button from '@material-ui/core/Button'; -export default function DeleteAccountDialog({open, onClose, isDeleteAccountEnabled}) { +export default function DeleteAccountDialog({ + open, + onClose, + isDeleteAccountEnabled, +}) { return ( <> - You will not be able to recover the current accounts without the seed phrase, and - the account private key. This action will delete all current accounts from - your browser.

- - - To prevent loss of funds, please ensure you have the seed phrase and the private key - for all current accounts. + You will not be able to recover the current accounts without the + seed phrase, and the account private key. This action will delete + all current accounts from your browser. +
+
+ + To prevent loss of funds, please ensure you have the seed phrase + and the private key for all current accounts.
- diff --git a/src/components/EditAccountNameDialog.js b/src/components/EditAccountNameDialog.js index cc2a83f6..2b5748e8 100644 --- a/src/components/EditAccountNameDialog.js +++ b/src/components/EditAccountNameDialog.js @@ -1,12 +1,17 @@ -import React, {useState} from "react"; -import DialogForm from "./DialogForm"; -import DialogContent from "@material-ui/core/DialogContent"; -import DialogTitle from "@material-ui/core/DialogTitle"; -import TextField from "@material-ui/core/TextField"; -import Button from "@material-ui/core/Button"; -import DialogActions from "@material-ui/core/DialogActions"; +import React, { useState } from 'react'; +import DialogForm from './DialogForm'; +import DialogContent from '@material-ui/core/DialogContent'; +import DialogTitle from '@material-ui/core/DialogTitle'; +import TextField from '@material-ui/core/TextField'; +import Button from '@material-ui/core/Button'; +import DialogActions from '@material-ui/core/DialogActions'; -export default function EditAccountNameDialog({open, oldName, onClose, onEdit}) { +export default function EditAccountNameDialog({ + open, + oldName, + onClose, + onEdit, +}) { const [name, setName] = useState(oldName); return (