-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: corrupted paper-wallet backup #4
Conversation
@yilmazbahadir and @AnthonyLaw to review. Please make sure to fix any spelling errors throughout the commit. It's not clear what the issue was originally and how this fixes it. Could you extend the original issue following the format seen here? As a rule of thumb, you want to describe these three things:
|
The code looks good, but 2 problems for me.
|
I think this addresses the same question with a suggestion => #5 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you run lint:fix
in the whole project before you merge this one? (after the second PR merged ofc)
packages/paper-wallets/index.ts
Outdated
@@ -98,17 +97,39 @@ class SymbolPaperWallet { | |||
* Exports as a PDF Uin8Array | |||
*/ | |||
async toPdf(): Promise<Uint8Array> { | |||
// Load teplate pdf document. It consists of 2 pages - mnemonic and account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Load teplate pdf document. It consists of 2 pages - mnemonic and account. | |
// Load template pdf document. It consists of 2 pages - mnemonic and account. |
@0x6861746366574 description updated. |
What's the issue? Can you please provide a console log.
You can build it locally and follow these instructions: |
|
@AnthonyLaw can you please open a new issue regarding this? |
Oops. Tried to rename the branch and forgot PR's are very particular. 😁 |
eeca845
to
f533d38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleting package-lock.json
?
@yilmazbahadir yes. This is the old one from |
Just to verify @0x6861746366574, do we want to bundle the dependencies together and release them as a single package(wallets-lib) or do we want to turn this into a monorepo and release it as separate packages in the near future? Stuffing sounds like it is the former(single package) from your discord message just wanted to verify before we proceed. |
Correct, we want to package them as a single library in the interim. |
What the current behaviour is
The paper wallet lib uses 2 encoded PDF docs. The first one contains Mnemonic page, the second one -Account page. The output of Paper Wallet lib is a single PDF doc which always contains 1 Mnemonic page and Account pages depending on the number of
accountInfos
passed to the constructor. To do it the paper wallet lib uses the "Mnemonic" PDF as a base and copies pages from "Account" PDF.Why this is an issue.
There is an issue with the
copyPages()
method form "pdf-lib" which is used to copy Account page from one PDF doc to another. Copied page is corrupted.What's the fix
This PR changes the way how the Account page is cloning. Instead of coping Account page from separate (foreign) PDF doc, now Mnemonic and Account pages are already in a single doc. It lets to avoid using a
copyPages()
method form "pdf-lib" which introduces an issue.