add toBroadcastFormat and id getter#131
Merged
Merged
Conversation
Add id getter to Transaction and VersionedTransaction classes. Returns the first signature as base58, or "UNSIGNED" if no valid signature. Ticket: BTC-3002
| * @returns The transaction as a base64 string ready for broadcast | ||
| */ | ||
| toBroadcastFormat(): string { | ||
| return Buffer.from(this.toBytes()).toString("base64"); |
Contributor
There was a problem hiding this comment.
this can cause problems in the ESM build since Buffer is typically only available in node env
I recently added this to wasm-utxo 1ba55fa
I would recommend returning Uint8Array here and letting the caller do the conversion
|
|
||
| describe("id getter", () => { | ||
| it("should return UNSIGNED for unsigned transaction", () => { | ||
| const tx = VersionedTransaction.fromBase64(LEGACY_TX_BASE64); |
Contributor
There was a problem hiding this comment.
similar here - the interface is cleaner if we deal with raw bytes and leave the base encoding/decoding to the callers
Add toBroadcastFormat() method to Transaction and VersionedTransaction. Returns base64 encoded transaction for Solana network broadcast. Ticket: BTC-3002
05b5751 to
eba962b
Compare
davidkaplanbitgo
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.