File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,6 +131,14 @@ export class Transaction {
131131 return this . _wasm . to_bytes ( ) ;
132132 }
133133
134+ /**
135+ * Serialize to network broadcast format.
136+ * @returns The transaction as bytes ready for broadcast
137+ */
138+ toBroadcastFormat ( ) : Uint8Array {
139+ return this . toBytes ( ) ;
140+ }
141+
134142 /**
135143 * Get all account keys as Pubkey instances
136144 * @returns Array of account public keys
Original file line number Diff line number Diff line change @@ -209,6 +209,14 @@ export class VersionedTransaction {
209209 return Buffer . from ( this . toBytes ( ) ) . toString ( "base64" ) ;
210210 }
211211
212+ /**
213+ * Serialize to network broadcast format.
214+ * @returns The transaction as bytes ready for broadcast
215+ */
216+ toBroadcastFormat ( ) : Uint8Array {
217+ return this . toBytes ( ) ;
218+ }
219+
212220 /**
213221 * Get static account keys (accounts stored directly in the message).
214222 * For versioned transactions, additional accounts may be referenced via ALTs.
Original file line number Diff line number Diff line change @@ -95,13 +95,15 @@ describe("VersionedTransaction", () => {
9595
9696 describe ( "id getter" , ( ) => {
9797 it ( "should return UNSIGNED for unsigned transaction" , ( ) => {
98- const tx = VersionedTransaction . fromBase64 ( LEGACY_TX_BASE64 ) ;
98+ const bytes = Buffer . from ( LEGACY_TX_BASE64 , "base64" ) ;
99+ const tx = VersionedTransaction . fromBytes ( bytes ) ;
99100 // The test transaction has an all-zeros signature (unsigned)
100101 assert . strictEqual ( tx . id , "UNSIGNED" ) ;
101102 } ) ;
102103
103104 it ( "should return base58 signature after signing" , ( ) => {
104- const tx = VersionedTransaction . fromBase64 ( LEGACY_TX_BASE64 ) ;
105+ const bytes = Buffer . from ( LEGACY_TX_BASE64 , "base64" ) ;
106+ const tx = VersionedTransaction . fromBytes ( bytes ) ;
105107 const feePayer = tx . feePayer ;
106108
107109 // Add a non-zero signature
You can’t perform that action at this time.
0 commit comments