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

refactor(experimental): make signTransaction assert the transaction is fully signed; add partiallySignTransaction #1820

Conversation

steveluscher
Copy link
Collaborator

Summary

I feel like in the common case of calling signTransaction you will want to end up with a fully signed (ie. landable) transaction, and that partially signing a transaction is more of the edge case.

// Instead of this:
const signedTx: ITransactionWithSignatures = await signTransaction(...);
assertIsFullySignedTransaction(signedTx);

// Just do this:
const signedTx: IFullySignedTransaction = await signTransaction(...); // Throws if it doesn't end up fully signed.

Test Plan

cd packages/transactions
pnpm test:unit:browser
pnpm test:unit:node

@steveluscher
Copy link
Collaborator Author

@steveluscher
Copy link
Collaborator Author

I'm not 1000% sure this is the right API, so please do ponder it with me.

… is fully signed; add `partiallySignTransaction`
@steveluscher steveluscher force-pushed the 11-10-refactor_experimental_make_signTransaction_assert_the_transaction_is_fully_signed_add_partiallySignTransaction_ branch from eaf1e49 to cf65b9c Compare November 10, 2023 05:29
Copy link
Contributor

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

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

I like that change. As mentioned on Discord, you can provide multiple private keys to signTransaction anyway so it's likely to fully sign it for you.

@steveluscher steveluscher merged commit 7d54c2d into master Nov 10, 2023
5 of 7 checks passed
@steveluscher steveluscher deleted the 11-10-refactor_experimental_make_signTransaction_assert_the_transaction_is_fully_signed_add_partiallySignTransaction_ branch November 10, 2023 22:35
Copy link
Contributor

🎉 This PR is included in version 1.87.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

lorisleiva added a commit that referenced this pull request Nov 16, 2023
…gner implementation (#1850)

Fix the typecheck error of `@solana/signers` in CI/CD.

### Problem

The implementation of the `KeyPairSigner` uses the `signTransaction` function from `@solana/transactions` under the hood which [was recently updated](#1820) to also assert the transaction is fully signed. Therefore, the mocked return value was giving a type error because it did not provide a `IFullySignedTransaction` as expected.

### Solution

Use the new `partiallySignTransaction` function from `@solana/transactions` instead of `signTransaction` which does not assert the transaction is full signed (and is equivalent to the old behavior of the `signTransaction` function).
Copy link
Contributor

Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants