Skip to content

Commit

Permalink
Added export private key, preload success msg
Browse files Browse the repository at this point in the history
  • Loading branch information
n9lsjr committed Feb 6, 2024
1 parent 37162ae commit 57fbfd3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/backend/electron.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,10 @@ ipcMain.handle("get-seed", async (e) => {
}
});

ipcMain.handle('get-privkeys', async () => {
return walletBackend.getPrimaryAddressPrivateKeys()
})

ipcMain.handle("get-node", async (e) => {
const userNode = await nodes.get("node");
if (userNode) {
Expand Down Expand Up @@ -658,6 +662,11 @@ ipcMain.on('errormessage', async (e, message) => {
errorMessage(message)
})

ipcMain.on('successmessage', async (e, message) => {
successMessage(message)
})

successMessage
///////////// HYPER CORE

const sender = (channel, data) => {
Expand Down
8 changes: 8 additions & 0 deletions src/backend/preload.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ contextBridge.exposeInMainWorld("api", {
getSeed: () => {
return ipcRenderer.invoke("get-seed");
},
getPrivateKeys: async () => {
return await ipcRenderer.invoke('get-privkeys')
},
resetWallet: (height) => {
return ipcRenderer.send("reset-wallet", height);
},
Expand All @@ -80,6 +83,10 @@ contextBridge.exposeInMainWorld("api", {
ipcRenderer.send("errormessage", message);
},

successMessage: (message) => {
ipcRenderer.send("successmessage", message);
},

getContacts: async () => {
return await ipcRenderer.invoke("get-contacts");
},
Expand All @@ -94,6 +101,7 @@ contextBridge.exposeInMainWorld("api", {
},



prepareTransaction: async (address, amount, paymentID, sendAll) => {
return await ipcRenderer.invoke('prepare-transaction', address, amount, paymentID, sendAll)
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/NodeSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
justify-content: center;
align-items: center;
gap: 2rem;
max-width: 840px;
max-width: 500px;
}
.node-list {
Expand Down
8 changes: 7 additions & 1 deletion src/routes/wallet/settings/wallet/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
}
return true;
};
const getPrivKeys = async () => {
const keys = await window.api.getPrivateKeys();
navigator.clipboard.writeText(keys[0]);
window.api.successMessage('Private key copied');
};
</script>

<div class="wrapper">
Expand All @@ -33,7 +39,7 @@
<br />

<Button text="Export mnemonic" on:click={() => goto('/auth/backup-wallet')} />
<Button text="Export private key" on:click={console.log('Clicked')} />
<Button text="Export private key" on:click={getPrivKeys} />
</div>

<div class="card-wrapper">
Expand Down

0 comments on commit 57fbfd3

Please sign in to comment.