Skip to content

Commit 4d3ab6a

Browse files
committed
feat(wasm-solana): add serializeMessage() for web3.js API compatibility
Add serializeMessage() method to Transaction class that returns the signable payload as a Buffer. This provides compatibility with code expecting the @solana/web3.js Transaction.serializeMessage() API, which returns "the Transaction data that need to be covered by signatures". Ticket: BTC-2955
1 parent 2efb802 commit 4d3ab6a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
168 KB
Binary file not shown.

packages/wasm-solana/js/transaction.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ export class Transaction {
8888
return this._wasm.signable_payload();
8989
}
9090

91+
/**
92+
* Serialize the message portion of the transaction.
93+
* Alias for signablePayload() - provides compatibility with @solana/web3.js API.
94+
* Returns a Buffer for compatibility with code expecting .toString('base64').
95+
* @returns The serialized message bytes as a Buffer
96+
*/
97+
serializeMessage(): Buffer {
98+
return Buffer.from(this.signablePayload());
99+
}
100+
91101
/**
92102
* Serialize the transaction to bytes
93103
* @returns The serialized transaction bytes

0 commit comments

Comments
 (0)