11import { WasmTransaction } from "./wasm/wasm_solana.js" ;
22import { Keypair } from "./keypair.js" ;
33import { Pubkey } from "./pubkey.js" ;
4- import { parseTransactionData } from "./parser.js" ;
5- import type { ParsedTransaction } from "./parser.js" ;
64
75/**
86 * Account metadata for an instruction
@@ -29,27 +27,25 @@ export interface Instruction {
2927}
3028
3129/**
32- * Solana Transaction — the single object for inspecting and signing transactions .
30+ * Solana Transaction — deserialization wrapper for signing and serialization .
3331 *
34- * Use `parseTransaction(bytes)` to create an instance. The returned Transaction
35- * can be both inspected (`.parse()` for decoded instructions) and signed
36- * (`.addSignature()`, `.signablePayload()`, `.toBytes()`).
32+ * Use `Transaction.fromBytes(bytes)` to create an instance for signing.
33+ * Use `parseTransaction(bytes)` from parser.ts to get decoded instruction data.
3734 *
3835 * @example
3936 * ```typescript
40- * import { parseTransaction } from '@bitgo/wasm-solana';
37+ * import { Transaction, parseTransaction } from '@bitgo/wasm-solana';
4138 *
42- * const tx = parseTransaction(txBytes);
43- *
44- * // Inspect decoded instructions
45- * const parsed = tx.parse();
39+ * // Parse for decoded instructions
40+ * const parsed = parseTransaction(txBytes);
4641 * for (const instr of parsed.instructionsData) {
4742 * if (instr.type === 'Transfer') {
4843 * console.log(`${instr.amount} lamports to ${instr.toAddress}`);
4944 * }
5045 * }
5146 *
52- * // Sign and serialize
47+ * // Deserialize for signing
48+ * const tx = Transaction.fromBytes(txBytes);
5349 * tx.addSignature(pubkey, signature);
5450 * const signedBytes = tx.toBytes();
5551 * ```
@@ -246,26 +242,6 @@ export class Transaction {
246242 this . _wasm . sign_with_keypair ( keypair . wasm ) ;
247243 }
248244
249- /**
250- * Parse the transaction into decoded instruction data.
251- *
252- * Returns structured data with all instructions decoded into semantic types
253- * (Transfer, StakeActivate, TokenTransfer, etc.) with amounts as bigint.
254- *
255- * @returns A ParsedTransaction with decoded instructions, feePayer, nonce, etc.
256- *
257- * @example
258- * ```typescript
259- * const tx = parseTransaction(txBytes);
260- * const parsed = tx.parse();
261- * console.log(parsed.feePayer);
262- * console.log(parsed.instructionsData); // Decoded instruction types
263- * ```
264- */
265- parse ( ) : ParsedTransaction {
266- return parseTransactionData ( this . _wasm . to_bytes ( ) ) ;
267- }
268-
269245 /**
270246 * Get the underlying WASM instance (internal use only)
271247 * @internal
0 commit comments