Skip to content

add toBroadcastFormat and id getter#131

Merged
lcovar merged 2 commits into
masterfrom
BTC-3002-transactoin
Feb 4, 2026
Merged

add toBroadcastFormat and id getter#131
lcovar merged 2 commits into
masterfrom
BTC-3002-transactoin

Conversation

@lcovar
Copy link
Copy Markdown
Contributor

@lcovar lcovar commented Feb 4, 2026

No description provided.

Add id getter to Transaction and VersionedTransaction classes.
Returns the first signature as base58, or "UNSIGNED" if no valid signature.

Ticket: BTC-3002
@lcovar lcovar requested a review from a team as a code owner February 4, 2026 01:19
@lcovar lcovar changed the title Btc 3002 transactoin add toBroadcastFormat and id getter Feb 4, 2026
Comment thread packages/wasm-solana/js/transaction.ts Outdated
* @returns The transaction as a base64 string ready for broadcast
*/
toBroadcastFormat(): string {
return Buffer.from(this.toBytes()).toString("base64");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread packages/wasm-solana/test/versioned.ts Outdated

describe("id getter", () => {
it("should return UNSIGNED for unsigned transaction", () => {
const tx = VersionedTransaction.fromBase64(LEGACY_TX_BASE64);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
@lcovar lcovar force-pushed the BTC-3002-transactoin branch from 05b5751 to eba962b Compare February 4, 2026 20:18
@lcovar lcovar merged commit 3032745 into master Feb 4, 2026
6 checks passed
@lcovar lcovar deleted the BTC-3002-transactoin branch February 4, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants