Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(experimental): assert single sending signer inside signAndSe…
…nd function (#2852) Fixes #2818 This PR calls the `assertIsTransactionMessageWithSingleSendingSigner` inside the `signAndSendTransactionMessageWithSigners` so the end-user doesn't need to do it explicitly. This is partly to improve the developer experience and partly because TS doesn't fail properly when the transaction message hasn't been asserted on prior to calling the sign and send function. Note that I did not remove the `assertIsTransactionMessageWithSingleSendingSigner` and the `isTransactionMessageWithSingleSendingSigner` from the package's exports since they may still be useful for custom use-cases such as the one described in the documentation: ```ts let transactionSignature: SignatureBytes; if (isTransactionMessageWithSingleSendingSigner(transaction)) { transactionSignature = await signAndSendTransactionMessageWithSigners(transaction); } else { const signedTransaction = await signTransactionMessageWithSigners(transaction); const encodedTransaction = getBase64EncodedWireTransaction(signedTransaction); transactionSignature = await rpc.sendTransaction(encodedTransaction).send(); } ```
- Loading branch information