Skip to content
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

Add STX support for Ledger accounts #212

Merged
merged 14 commits into from
Sep 7, 2023

Conversation

dhriaznov
Copy link
Contributor

@dhriaznov dhriaznov commented Aug 11, 2023

🔘 PR Type

  • Enhancement

📜 Background

We would like to support STX account import, regular transactions and incoming txs signing as well.
We already have some code for STX support for Ledger accounts, but we should update and test it.

Issue Link: #[ENG-2499]
Context Link (if applicable):

🔄 Changes

Does this PR introduce a breaking change?

  • Yes, Incompatible API changes
  • No, Adds functionality (backwards compatible)
  • No, Bug fixes (backwards compatible)

Changes:

  • Updated importStacksAccountFromLedger method logic
  • Updated signLedgerStxTransaction method logic
  • Added StacksRecipient type

Impact:

  • This PR impacts the STX functionality for the ledger accounts (which weren't introduced to the users yet)

🖼 Screenshot / 📹 Video

✅ Review checklist

Please ensure the following are true before merging:

  • Code Style is consistent with the project guidelines.
  • Code is readable and well-commented.
  • No unnecessary or debugging code has been added.
  • Security considerations have been taken into account.
  • The change has been manually tested and works as expected.
  • Breaking changes and their impacts have been considered and documented.
  • Code does not introduce new technical debt or issues.

@dhriaznov dhriaznov self-assigned this Aug 11, 2023
@dhriaznov dhriaznov added the enhancement New feature or request label Aug 16, 2023
@dhriaznov dhriaznov requested review from teebszet and Imamah-Zafar and removed request for m-aboelenein August 28, 2023 08:38
ledger/transaction.ts Show resolved Hide resolved
ledger/transaction.ts Show resolved Hide resolved

return { address, publicKey: publicKey.toString('hex') };
}

/**
* This function is used to sign a Stacks transaction with the ledger
* @param transport - the transport object with connected ledger device
* @param transaction - the transaction to sign
* @param transactionBuffer - the transaction to sign
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was there a strong reason to change this interface and move the serialize call out of this function?

I noticed your web-extension PR didn't update confirmLedgerTransaction/index.ts L251 with the new param

and confirmStxTransaction/index.ts now does an extra .seralize() before calling this function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the serialization was added on the extension side because otherwise it threw an error:
Monosnap Xverse Wallet 2023-09-01 13-13-16

Currently, confirmStxTransaction/index.ts makes the tx serialization and passes it to confirmLedgerTransaction/index.ts screen ready to be passed to this core function in a Buffer format

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right. basically because we have to pass around a serialized transaction between screens anyway, so this removes the multiple actions to serialize (for location.state) -> deserialize (for this function) -> serialize (within this function)

is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's right

@dhriaznov
Copy link
Contributor Author

Hey @teebszet, could you take a look once again please?

@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2023

Test this PR with npm i @secretkeylabs/[email protected]

@teebszet teebszet merged commit a2df5e0 into develop Sep 7, 2023
3 checks passed
@teebszet teebszet deleted the denys/eng-2499-add-stx-support-for-ledger-accounts branch September 7, 2023 09:40
teebszet pushed a commit that referenced this pull request Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants