1import * as wg from './walletgen';
3import JSZip from 'jszip';
4import saveAs from 'file-saver';
6export async function generateWallet(point, boot) {
7 const ticket = await wg.makeTicket(point);
8 const wallet = await wg.generateWallet(point, ticket, boot);
12//TODO should be moved to lib/walletgen
13export async function downloadWallet(paperWallets, keyfile, keyfilename) {
14 if (paperWallets.length === 1) {
15 const zip = new JSZip();
17 const wallet = paperWallets[0];
18 const ship = wallet.wallet.meta.patp.replace('~', '');
19 const zipName = `${ship}-passport`;
20 const folder = zip.folder(zipName);
22 wallet.frames.forEach(frame => {
23 const filename = `${ship}-${frame.givenName}.png`;
24 folder.file(filename, frame.image);
27 if (keyfile && keyfilename) {
28 folder.file(keyfilename, keyfile);
31 await zip.generateAsync({ type: 'blob' }).then(content => {
32 saveAs(content, `${zipName}.zip`);
36 console.error('downloadWallet() can only download 1 wallet at a time.');
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list