@bitgo/wasm-solana 1.6.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,15 @@
1
1
  /**
2
- * Transaction building from high-level intents.
2
+ * Versioned Transaction Building from Raw MessageV0 Data.
3
3
  *
4
- * Provides types and functions for building Solana transactions from a
5
- * declarative intent structure, without requiring the full @solana/web3.js dependency.
4
+ * This module provides `buildFromVersionedData` for building versioned transactions
5
+ * from pre-compiled MessageV0 data. This is used for:
6
+ * - WalletConnect/Jupiter pre-compiled versioned transactions
7
+ * - Custom transaction pass-through (customTx intent)
8
+ *
9
+ * Unlike the intent-based builder, this takes already-compiled instruction
10
+ * data with account indexes, not high-level instructions.
6
11
  */
7
- import { Transaction } from "./transaction.js";
8
12
  import { VersionedTransaction } from "./versioned.js";
9
- /** Use a recent blockhash for the transaction */
10
- export interface BlockhashNonceSource {
11
- type: "blockhash";
12
- /** The recent blockhash value (base58) */
13
- value: string;
14
- }
15
- /** Use a durable nonce account for the transaction */
16
- export interface DurableNonceSource {
17
- type: "durable";
18
- /** The nonce account address (base58) */
19
- address: string;
20
- /** The nonce authority address (base58) */
21
- authority: string;
22
- /** The nonce value stored in the account (base58) - this becomes the blockhash */
23
- value: string;
24
- }
25
- /** Nonce source for the transaction */
26
- export type NonceSource = BlockhashNonceSource | DurableNonceSource;
27
13
  /**
28
14
  * Address Lookup Table data for versioned transactions.
29
15
  *
@@ -38,386 +24,6 @@ export interface AddressLookupTable {
38
24
  /** Indices of readonly accounts in the lookup table */
39
25
  readonlyIndexes: number[];
40
26
  }
41
- /** SOL transfer instruction */
42
- export interface TransferInstruction {
43
- type: "transfer";
44
- /** Source account (base58) */
45
- from: string;
46
- /** Destination account (base58) */
47
- to: string;
48
- /** Amount in lamports */
49
- lamports: bigint;
50
- }
51
- /** Create new account instruction */
52
- export interface CreateAccountInstruction {
53
- type: "createAccount";
54
- /** Funding account (base58) */
55
- from: string;
56
- /** New account address (base58) */
57
- newAccount: string;
58
- /** Lamports to transfer */
59
- lamports: bigint;
60
- /** Space to allocate in bytes */
61
- space: number;
62
- /** Owner program (base58) */
63
- owner: string;
64
- }
65
- /** Advance durable nonce instruction */
66
- export interface NonceAdvanceInstruction {
67
- type: "nonceAdvance";
68
- /** Nonce account address (base58) */
69
- nonce: string;
70
- /** Nonce authority (base58) */
71
- authority: string;
72
- }
73
- /** Initialize nonce account instruction */
74
- export interface NonceInitializeInstruction {
75
- type: "nonceInitialize";
76
- /** Nonce account address (base58) */
77
- nonce: string;
78
- /** Nonce authority (base58) */
79
- authority: string;
80
- }
81
- /** Allocate space instruction */
82
- export interface AllocateInstruction {
83
- type: "allocate";
84
- /** Account to allocate (base58) */
85
- account: string;
86
- /** Space to allocate in bytes */
87
- space: number;
88
- }
89
- /** Assign account to program instruction */
90
- export interface AssignInstruction {
91
- type: "assign";
92
- /** Account to assign (base58) */
93
- account: string;
94
- /** New owner program (base58) */
95
- owner: string;
96
- }
97
- /** Memo instruction */
98
- export interface MemoInstruction {
99
- type: "memo";
100
- /** The memo message */
101
- message: string;
102
- }
103
- /** Compute budget instruction */
104
- export interface ComputeBudgetInstruction {
105
- type: "computeBudget";
106
- /** Compute unit limit (optional) */
107
- unitLimit?: number;
108
- /** Compute unit price in micro-lamports (optional) */
109
- unitPrice?: number;
110
- }
111
- /** Initialize a stake account instruction */
112
- export interface StakeInitializeInstruction {
113
- type: "stakeInitialize";
114
- /** Stake account address (base58) */
115
- stake: string;
116
- /** Authorized staker pubkey (base58) */
117
- staker: string;
118
- /** Authorized withdrawer pubkey (base58) */
119
- withdrawer: string;
120
- }
121
- /** Delegate stake to a validator instruction */
122
- export interface StakeDelegateInstruction {
123
- type: "stakeDelegate";
124
- /** Stake account address (base58) */
125
- stake: string;
126
- /** Vote account (validator) to delegate to (base58) */
127
- vote: string;
128
- /** Stake authority (base58) */
129
- authority: string;
130
- }
131
- /** Deactivate a stake account instruction */
132
- export interface StakeDeactivateInstruction {
133
- type: "stakeDeactivate";
134
- /** Stake account address (base58) */
135
- stake: string;
136
- /** Stake authority (base58) */
137
- authority: string;
138
- }
139
- /** Withdraw from a stake account instruction */
140
- export interface StakeWithdrawInstruction {
141
- type: "stakeWithdraw";
142
- /** Stake account address (base58) */
143
- stake: string;
144
- /** Recipient address (base58) */
145
- recipient: string;
146
- /** Amount in lamports to withdraw */
147
- lamports: bigint;
148
- /** Withdraw authority (base58) */
149
- authority: string;
150
- }
151
- /** Change stake account authorization instruction */
152
- export interface StakeAuthorizeInstruction {
153
- type: "stakeAuthorize";
154
- /** Stake account address (base58) */
155
- stake: string;
156
- /** New authority pubkey (base58) */
157
- newAuthority: string;
158
- /** Authorization type: "staker" or "withdrawer" */
159
- authorizeType: "staker" | "withdrawer";
160
- /** Current authority (base58) */
161
- authority: string;
162
- }
163
- /** Split stake account instruction (for partial deactivation) */
164
- export interface StakeSplitInstruction {
165
- type: "stakeSplit";
166
- /** Source stake account address (base58) */
167
- stake: string;
168
- /** Destination stake account (must be uninitialized/created first) (base58) */
169
- splitStake: string;
170
- /** Stake authority (base58) */
171
- authority: string;
172
- /** Amount in lamports to split */
173
- lamports: bigint;
174
- }
175
- /** Transfer tokens instruction (uses TransferChecked) */
176
- export interface TokenTransferInstruction {
177
- type: "tokenTransfer";
178
- /** Source token account (base58) */
179
- source: string;
180
- /** Destination token account (base58) */
181
- destination: string;
182
- /** Token mint address (base58) */
183
- mint: string;
184
- /** Amount of tokens (in smallest units) */
185
- amount: bigint;
186
- /** Number of decimals for the token */
187
- decimals: number;
188
- /** Owner/authority of the source account (base58) */
189
- authority: string;
190
- /** Token program ID (optional, defaults to SPL Token) */
191
- programId?: string;
192
- }
193
- /** Create an Associated Token Account instruction */
194
- export interface CreateAssociatedTokenAccountInstruction {
195
- type: "createAssociatedTokenAccount";
196
- /** Payer for account creation (base58) */
197
- payer: string;
198
- /** Owner of the new ATA (base58) */
199
- owner: string;
200
- /** Token mint address (base58) */
201
- mint: string;
202
- /** Token program ID (optional, defaults to SPL Token) */
203
- tokenProgramId?: string;
204
- }
205
- /** Close an Associated Token Account instruction */
206
- export interface CloseAssociatedTokenAccountInstruction {
207
- type: "closeAssociatedTokenAccount";
208
- /** Token account to close (base58) */
209
- account: string;
210
- /** Destination for remaining lamports (base58) */
211
- destination: string;
212
- /** Authority of the account (base58) */
213
- authority: string;
214
- /** Token program ID (optional, defaults to SPL Token) */
215
- programId?: string;
216
- }
217
- /** Mint tokens to an account instruction */
218
- export interface MintToInstruction {
219
- type: "mintTo";
220
- /** Token mint address (base58) */
221
- mint: string;
222
- /** Destination token account (base58) */
223
- destination: string;
224
- /** Mint authority (base58) */
225
- authority: string;
226
- /** Amount of tokens to mint (in smallest units) */
227
- amount: bigint;
228
- /** Token program ID (optional, defaults to SPL Token) */
229
- programId?: string;
230
- }
231
- /** Burn tokens from an account instruction */
232
- export interface BurnInstruction {
233
- type: "burn";
234
- /** Token mint address (base58) */
235
- mint: string;
236
- /** Source token account to burn from (base58) */
237
- account: string;
238
- /** Token account authority (base58) */
239
- authority: string;
240
- /** Amount of tokens to burn (in smallest units) */
241
- amount: bigint;
242
- /** Token program ID (optional, defaults to SPL Token) */
243
- programId?: string;
244
- }
245
- /** Approve a delegate to transfer tokens instruction */
246
- export interface ApproveInstruction {
247
- type: "approve";
248
- /** Token account to approve delegation for (base58) */
249
- account: string;
250
- /** Delegate address (who can transfer) (base58) */
251
- delegate: string;
252
- /** Token account owner (base58) */
253
- owner: string;
254
- /** Amount of tokens to approve (in smallest units) */
255
- amount: bigint;
256
- /** Token program ID (optional, defaults to SPL Token) */
257
- programId?: string;
258
- }
259
- /** Deposit SOL into a stake pool (Jito liquid staking) */
260
- export interface StakePoolDepositSolInstruction {
261
- type: "stakePoolDepositSol";
262
- /** Stake pool address (base58) */
263
- stakePool: string;
264
- /** Withdraw authority PDA (base58) */
265
- withdrawAuthority: string;
266
- /** Reserve stake account (base58) */
267
- reserveStake: string;
268
- /** Funding account (SOL source, signer) (base58) */
269
- fundingAccount: string;
270
- /** Destination for pool tokens (base58) */
271
- destinationPoolAccount: string;
272
- /** Manager fee account (base58) */
273
- managerFeeAccount: string;
274
- /** Referral pool account (base58) */
275
- referralPoolAccount: string;
276
- /** Pool mint address (base58) */
277
- poolMint: string;
278
- /** Amount in lamports to deposit */
279
- lamports: bigint;
280
- }
281
- /** Withdraw stake from a stake pool (Jito liquid staking) */
282
- export interface StakePoolWithdrawStakeInstruction {
283
- type: "stakePoolWithdrawStake";
284
- /** Stake pool address (base58) */
285
- stakePool: string;
286
- /** Validator list account (base58) */
287
- validatorList: string;
288
- /** Withdraw authority PDA (base58) */
289
- withdrawAuthority: string;
290
- /** Validator stake account to split from (base58) */
291
- validatorStake: string;
292
- /** Destination stake account (uninitialized) (base58) */
293
- destinationStake: string;
294
- /** Authority for the destination stake account (base58) */
295
- destinationStakeAuthority: string;
296
- /** Source pool token account authority (signer) (base58) */
297
- sourceTransferAuthority: string;
298
- /** Source pool token account (base58) */
299
- sourcePoolAccount: string;
300
- /** Manager fee account (base58) */
301
- managerFeeAccount: string;
302
- /** Pool mint address (base58) */
303
- poolMint: string;
304
- /** Amount of pool tokens to burn */
305
- poolTokens: bigint;
306
- }
307
- /** Account metadata for custom instructions */
308
- export interface CustomAccountMeta {
309
- /** Account public key (base58) */
310
- pubkey: string;
311
- /** Whether the account is a signer */
312
- isSigner: boolean;
313
- /** Whether the account is writable */
314
- isWritable: boolean;
315
- }
316
- /**
317
- * Custom instruction for invoking any program.
318
- * Enables passthrough of arbitrary instructions for extensibility.
319
- */
320
- export interface CustomInstruction {
321
- type: "custom";
322
- /** The program ID to invoke (base58) */
323
- programId: string;
324
- /** Account metas for the instruction */
325
- accounts: CustomAccountMeta[];
326
- /** Instruction data (base64 or hex encoded) */
327
- data: string;
328
- /** Encoding of the data field: "base64" (default) or "hex" */
329
- encoding?: "base64" | "hex";
330
- }
331
- /** Union of all instruction types */
332
- export type Instruction = TransferInstruction | CreateAccountInstruction | NonceAdvanceInstruction | NonceInitializeInstruction | AllocateInstruction | AssignInstruction | MemoInstruction | ComputeBudgetInstruction | StakeInitializeInstruction | StakeDelegateInstruction | StakeDeactivateInstruction | StakeWithdrawInstruction | StakeAuthorizeInstruction | StakeSplitInstruction | TokenTransferInstruction | CreateAssociatedTokenAccountInstruction | CloseAssociatedTokenAccountInstruction | MintToInstruction | BurnInstruction | ApproveInstruction | StakePoolDepositSolInstruction | StakePoolWithdrawStakeInstruction | CustomInstruction;
333
- /**
334
- * A declarative intent to build a Solana transaction.
335
- *
336
- * @example
337
- * ```typescript
338
- * const intent: TransactionIntent = {
339
- * feePayer: 'DgT9qyYwYKBRDyDw3EfR12LHQCQjtNrKu2qMsXHuosmB',
340
- * nonce: {
341
- * type: 'blockhash',
342
- * value: 'GWaQEymC3Z9SHM2gkh8u12xL1zJPMHPCSVR3pSDpEXE4'
343
- * },
344
- * instructions: [
345
- * { type: 'transfer', from: '...', to: '...', lamports: '1000000' }
346
- * ]
347
- * };
348
- * ```
349
- */
350
- export interface TransactionIntent {
351
- /** The fee payer's public key (base58) */
352
- feePayer: string;
353
- /** The nonce source (blockhash or durable nonce) */
354
- nonce: NonceSource;
355
- /** List of instructions to include */
356
- instructions: Instruction[];
357
- /**
358
- * Address Lookup Tables for versioned transactions.
359
- * If provided, builds a MessageV0 transaction instead of legacy.
360
- */
361
- addressLookupTables?: AddressLookupTable[];
362
- /**
363
- * Static account keys (for versioned transaction round-trip).
364
- * These are the accounts stored directly in the message.
365
- */
366
- staticAccountKeys?: string[];
367
- }
368
- /**
369
- * Build a Solana transaction from a high-level intent.
370
- *
371
- * This function takes a declarative TransactionIntent and produces a Transaction
372
- * object that can be inspected, signed, and serialized.
373
- *
374
- * The returned transaction is unsigned - signatures should be added via
375
- * `addSignature()` before serializing with `toBytes()` and broadcasting.
376
- *
377
- * @param intent - The transaction intent describing what to build
378
- * @returns A Transaction object that can be inspected, signed, and serialized
379
- * @throws Error if the intent cannot be built (e.g., invalid addresses)
380
- *
381
- * @example
382
- * ```typescript
383
- * import { buildTransaction } from '@bitgo/wasm-solana';
384
- *
385
- * // Build a simple SOL transfer
386
- * const tx = buildTransaction({
387
- * feePayer: sender,
388
- * nonce: { type: 'blockhash', value: blockhash },
389
- * instructions: [
390
- * { type: 'transfer', from: sender, to: recipient, lamports: 1000000n }
391
- * ]
392
- * });
393
- *
394
- * // Inspect the transaction
395
- * console.log(tx.feePayer);
396
- * console.log(tx.recentBlockhash);
397
- *
398
- * // Get the signable payload for signing
399
- * const payload = tx.signablePayload();
400
- *
401
- * // Add signature and serialize
402
- * tx.addSignature(signerPubkey, signature);
403
- * const txBytes = tx.toBytes();
404
- * ```
405
- *
406
- * @example
407
- * ```typescript
408
- * // Build with durable nonce and priority fee
409
- * const tx = buildTransaction({
410
- * feePayer: sender,
411
- * nonce: { type: 'durable', address: nonceAccount, authority: sender, value: nonceValue },
412
- * instructions: [
413
- * { type: 'computeBudget', unitLimit: 200000, unitPrice: 5000 },
414
- * { type: 'transfer', from: sender, to: recipient, lamports: 1000000n },
415
- * { type: 'memo', message: 'BitGo transfer' }
416
- * ]
417
- * });
418
- * ```
419
- */
420
- export declare function buildTransaction(intent: TransactionIntent): Transaction;
421
27
  /**
422
28
  * A pre-compiled versioned instruction (uses indexes, not pubkeys).
423
29
  * This is the format used in MessageV0 transactions.
@@ -1,71 +1,19 @@
1
1
  /**
2
- * Transaction building from high-level intents.
2
+ * Versioned Transaction Building from Raw MessageV0 Data.
3
3
  *
4
- * Provides types and functions for building Solana transactions from a
5
- * declarative intent structure, without requiring the full @solana/web3.js dependency.
4
+ * This module provides `buildFromVersionedData` for building versioned transactions
5
+ * from pre-compiled MessageV0 data. This is used for:
6
+ * - WalletConnect/Jupiter pre-compiled versioned transactions
7
+ * - Custom transaction pass-through (customTx intent)
8
+ *
9
+ * Unlike the intent-based builder, this takes already-compiled instruction
10
+ * data with account indexes, not high-level instructions.
6
11
  */
7
12
  import { BuilderNamespace } from "./wasm/wasm_solana.js";
8
- import { Transaction } from "./transaction.js";
9
13
  import { VersionedTransaction } from "./versioned.js";
10
14
  // =============================================================================
11
- // buildTransaction function
15
+ // buildFromVersionedData function
12
16
  // =============================================================================
13
- /**
14
- * Build a Solana transaction from a high-level intent.
15
- *
16
- * This function takes a declarative TransactionIntent and produces a Transaction
17
- * object that can be inspected, signed, and serialized.
18
- *
19
- * The returned transaction is unsigned - signatures should be added via
20
- * `addSignature()` before serializing with `toBytes()` and broadcasting.
21
- *
22
- * @param intent - The transaction intent describing what to build
23
- * @returns A Transaction object that can be inspected, signed, and serialized
24
- * @throws Error if the intent cannot be built (e.g., invalid addresses)
25
- *
26
- * @example
27
- * ```typescript
28
- * import { buildTransaction } from '@bitgo/wasm-solana';
29
- *
30
- * // Build a simple SOL transfer
31
- * const tx = buildTransaction({
32
- * feePayer: sender,
33
- * nonce: { type: 'blockhash', value: blockhash },
34
- * instructions: [
35
- * { type: 'transfer', from: sender, to: recipient, lamports: 1000000n }
36
- * ]
37
- * });
38
- *
39
- * // Inspect the transaction
40
- * console.log(tx.feePayer);
41
- * console.log(tx.recentBlockhash);
42
- *
43
- * // Get the signable payload for signing
44
- * const payload = tx.signablePayload();
45
- *
46
- * // Add signature and serialize
47
- * tx.addSignature(signerPubkey, signature);
48
- * const txBytes = tx.toBytes();
49
- * ```
50
- *
51
- * @example
52
- * ```typescript
53
- * // Build with durable nonce and priority fee
54
- * const tx = buildTransaction({
55
- * feePayer: sender,
56
- * nonce: { type: 'durable', address: nonceAccount, authority: sender, value: nonceValue },
57
- * instructions: [
58
- * { type: 'computeBudget', unitLimit: 200000, unitPrice: 5000 },
59
- * { type: 'transfer', from: sender, to: recipient, lamports: 1000000n },
60
- * { type: 'memo', message: 'BitGo transfer' }
61
- * ]
62
- * });
63
- * ```
64
- */
65
- export function buildTransaction(intent) {
66
- const wasm = BuilderNamespace.build_transaction(intent);
67
- return Transaction.fromWasm(wasm);
68
- }
69
17
  /**
70
18
  * Build a versioned transaction directly from raw MessageV0 data.
71
19
  *
@@ -9,10 +9,10 @@ export { Transaction } from "./transaction.js";
9
9
  export { VersionedTransaction, isVersionedTransaction } from "./versioned.js";
10
10
  export type { AddressLookupTableData } from "./versioned.js";
11
11
  export { parseTransaction } from "./parser.js";
12
- export { buildTransaction, buildFromVersionedData } from "./builder.js";
13
- export { buildFromIntent } from "./intentBuilder.js";
12
+ export { buildFromVersionedData } from "./builder.js";
13
+ export { buildFromIntent, buildFromIntent as buildTransactionFromIntent } from "./intentBuilder.js";
14
14
  export type { BaseIntent, PaymentIntent, StakeIntent, UnstakeIntent, ClaimIntent, DeactivateIntent, DelegateIntent, EnableTokenIntent, CloseAtaIntent, ConsolidateIntent, SolanaIntent, StakePoolConfig, BuildFromIntentParams, BuildFromIntentResult, GeneratedKeypair, NonceSource, BlockhashNonce, DurableNonce, } from "./intentBuilder.js";
15
15
  export { system_program_id as systemProgramId, stake_program_id as stakeProgramId, compute_budget_program_id as computeBudgetProgramId, memo_program_id as memoProgramId, token_program_id as tokenProgramId, token_2022_program_id as token2022ProgramId, ata_program_id as ataProgramId, stake_pool_program_id as stakePoolProgramId, stake_account_space as stakeAccountSpace, nonce_account_space as nonceAccountSpace, sysvar_recent_blockhashes as sysvarRecentBlockhashes, get_associated_token_address as getAssociatedTokenAddress, find_withdraw_authority_program_address as findWithdrawAuthorityProgramAddress, } from "./wasm/wasm_solana.js";
16
16
  export type { AccountMeta, Instruction } from "./transaction.js";
17
17
  export type { TransactionInput, ParsedTransaction, DurableNonce as ParsedDurableNonce, InstructionParams, TransferParams, CreateAccountParams, NonceAdvanceParams, CreateNonceAccountParams, NonceInitializeParams, StakeInitializeParams, StakingActivateParams, StakingDeactivateParams, StakingWithdrawParams, StakingDelegateParams, StakingAuthorizeParams, SetComputeUnitLimitParams, SetPriorityFeeParams, TokenTransferParams, CreateAtaParams, CloseAtaParams, MemoParams, StakePoolDepositSolParams, StakePoolWithdrawStakeParams, UnknownInstructionParams, } from "./parser.js";
18
- export type { TransactionIntent, NonceSource as BuilderNonceSource, BlockhashNonceSource, DurableNonceSource, AddressLookupTable as BuilderAddressLookupTable, Instruction as BuilderInstruction, TransferInstruction, CreateAccountInstruction, NonceAdvanceInstruction, NonceInitializeInstruction, AllocateInstruction, AssignInstruction, MemoInstruction, ComputeBudgetInstruction, StakeInitializeInstruction, StakeDelegateInstruction, StakeDeactivateInstruction, StakeWithdrawInstruction, StakeAuthorizeInstruction, StakeSplitInstruction, TokenTransferInstruction, CreateAssociatedTokenAccountInstruction, CloseAssociatedTokenAccountInstruction, MintToInstruction, BurnInstruction, ApproveInstruction, StakePoolDepositSolInstruction, StakePoolWithdrawStakeInstruction, CustomInstruction as BuilderCustomInstruction, CustomAccountMeta, RawVersionedTransactionData, VersionedInstruction as BuilderVersionedInstruction, MessageHeader, } from "./builder.js";
18
+ export type { AddressLookupTable as BuilderAddressLookupTable, RawVersionedTransactionData, VersionedInstruction as BuilderVersionedInstruction, MessageHeader, } from "./builder.js";
@@ -15,8 +15,8 @@ export { Transaction } from "./transaction.js";
15
15
  export { VersionedTransaction, isVersionedTransaction } from "./versioned.js";
16
16
  // Top-level function exports
17
17
  export { parseTransaction } from "./parser.js";
18
- export { buildTransaction, buildFromVersionedData } from "./builder.js";
19
- export { buildFromIntent } from "./intentBuilder.js";
18
+ export { buildFromVersionedData } from "./builder.js";
19
+ export { buildFromIntent, buildFromIntent as buildTransactionFromIntent } from "./intentBuilder.js";
20
20
  // Program ID constants (from WASM)
21
21
  export { system_program_id as systemProgramId, stake_program_id as stakeProgramId, compute_budget_program_id as computeBudgetProgramId, memo_program_id as memoProgramId, token_program_id as tokenProgramId, token_2022_program_id as token2022ProgramId, ata_program_id as ataProgramId, stake_pool_program_id as stakePoolProgramId, stake_account_space as stakeAccountSpace, nonce_account_space as nonceAccountSpace,
22
22
  // Sysvar addresses
@@ -72,7 +72,7 @@ export declare class Transaction {
72
72
  * Get the transaction ID (first signature as base58).
73
73
  *
74
74
  * For Solana, the transaction ID is the first signature.
75
- * Returns "UNSIGNED" if the transaction has no valid signatures.
75
+ * Returns `undefined` if the transaction is unsigned (no signatures or all-zeros signature).
76
76
  *
77
77
  * @example
78
78
  * ```typescript
@@ -81,7 +81,7 @@ export declare class Transaction {
81
81
  * console.log(tx.id); // Base58 encoded signature
82
82
  * ```
83
83
  */
84
- get id(): string;
84
+ get id(): string | undefined;
85
85
  /**
86
86
  * Get the signable message payload (what gets signed)
87
87
  * This is the serialized message that signers sign
@@ -91,10 +91,9 @@ export declare class Transaction {
91
91
  /**
92
92
  * Serialize the message portion of the transaction.
93
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
94
+ * @returns The serialized message bytes
96
95
  */
97
- serializeMessage(): Buffer;
96
+ serializeMessage(): Uint8Array;
98
97
  /**
99
98
  * Serialize the transaction to bytes
100
99
  * @returns The serialized transaction bytes
@@ -63,7 +63,7 @@ export class Transaction {
63
63
  * Get the transaction ID (first signature as base58).
64
64
  *
65
65
  * For Solana, the transaction ID is the first signature.
66
- * Returns "UNSIGNED" if the transaction has no valid signatures.
66
+ * Returns `undefined` if the transaction is unsigned (no signatures or all-zeros signature).
67
67
  *
68
68
  * @example
69
69
  * ```typescript
@@ -86,11 +86,10 @@ export class Transaction {
86
86
  /**
87
87
  * Serialize the message portion of the transaction.
88
88
  * Alias for signablePayload() - provides compatibility with @solana/web3.js API.
89
- * Returns a Buffer for compatibility with code expecting .toString('base64').
90
- * @returns The serialized message bytes as a Buffer
89
+ * @returns The serialized message bytes
91
90
  */
92
91
  serializeMessage() {
93
- return Buffer.from(this.signablePayload());
92
+ return this.signablePayload();
94
93
  }
95
94
  /**
96
95
  * Serialize the transaction to bytes
@@ -63,10 +63,6 @@ export declare class VersionedTransaction {
63
63
  * Automatically handles both legacy and versioned formats.
64
64
  */
65
65
  static fromBytes(bytes: Uint8Array): VersionedTransaction;
66
- /**
67
- * Deserialize a transaction from base64 string.
68
- */
69
- static fromBase64(base64: string): VersionedTransaction;
70
66
  /**
71
67
  * Create a VersionedTransaction from a WasmVersionedTransaction instance.
72
68
  * @internal Used by builder functions
@@ -126,9 +122,9 @@ export declare class VersionedTransaction {
126
122
  * Get the transaction ID (first signature as base58).
127
123
  *
128
124
  * For Solana, the transaction ID is the first signature.
129
- * Returns "UNSIGNED" if the transaction has no valid signatures.
125
+ * Returns `undefined` if the transaction is unsigned (no signatures or all-zeros signature).
130
126
  */
131
- get id(): string;
127
+ get id(): string | undefined;
132
128
  /**
133
129
  * Get the signable message payload.
134
130
  */
@@ -136,18 +132,13 @@ export declare class VersionedTransaction {
136
132
  /**
137
133
  * Serialize the message portion of the transaction.
138
134
  * Alias for signablePayload() - provides compatibility with @solana/web3.js API.
139
- * Returns a Buffer for compatibility with code expecting .toString('base64').
140
- * @returns The serialized message bytes as a Buffer
135
+ * @returns The serialized message bytes
141
136
  */
142
- serializeMessage(): Buffer;
137
+ serializeMessage(): Uint8Array;
143
138
  /**
144
139
  * Serialize the transaction to bytes.
145
140
  */
146
141
  toBytes(): Uint8Array;
147
- /**
148
- * Serialize the transaction to base64.
149
- */
150
- toBase64(): string;
151
142
  /**
152
143
  * Serialize to network broadcast format.
153
144
  * @returns The transaction as bytes ready for broadcast
@@ -33,13 +33,6 @@ export class VersionedTransaction {
33
33
  static fromBytes(bytes) {
34
34
  return new VersionedTransaction(WasmVersionedTransaction.from_bytes(bytes));
35
35
  }
36
- /**
37
- * Deserialize a transaction from base64 string.
38
- */
39
- static fromBase64(base64) {
40
- const bytes = Uint8Array.from(Buffer.from(base64, "base64"));
41
- return VersionedTransaction.fromBytes(bytes);
42
- }
43
36
  /**
44
37
  * Create a VersionedTransaction from a WasmVersionedTransaction instance.
45
38
  * @internal Used by builder functions
@@ -115,7 +108,7 @@ export class VersionedTransaction {
115
108
  * Get the transaction ID (first signature as base58).
116
109
  *
117
110
  * For Solana, the transaction ID is the first signature.
118
- * Returns "UNSIGNED" if the transaction has no valid signatures.
111
+ * Returns `undefined` if the transaction is unsigned (no signatures or all-zeros signature).
119
112
  */
120
113
  get id() {
121
114
  return this.inner.id;
@@ -129,11 +122,10 @@ export class VersionedTransaction {
129
122
  /**
130
123
  * Serialize the message portion of the transaction.
131
124
  * Alias for signablePayload() - provides compatibility with @solana/web3.js API.
132
- * Returns a Buffer for compatibility with code expecting .toString('base64').
133
- * @returns The serialized message bytes as a Buffer
125
+ * @returns The serialized message bytes
134
126
  */
135
127
  serializeMessage() {
136
- return Buffer.from(this.signablePayload());
128
+ return this.signablePayload();
137
129
  }
138
130
  /**
139
131
  * Serialize the transaction to bytes.
@@ -141,12 +133,6 @@ export class VersionedTransaction {
141
133
  toBytes() {
142
134
  return this.inner.to_bytes();
143
135
  }
144
- /**
145
- * Serialize the transaction to base64.
146
- */
147
- toBase64() {
148
- return Buffer.from(this.toBytes()).toString("base64");
149
- }
150
136
  /**
151
137
  * Serialize to network broadcast format.
152
138
  * @returns The transaction as bytes ready for broadcast