@bitgo/wasm-solana 1.4.1 → 1.4.2

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.
Files changed (39) hide show
  1. package/dist/cjs/js/builder.d.ts +499 -0
  2. package/dist/cjs/js/builder.js +113 -0
  3. package/dist/cjs/js/index.d.ts +16 -0
  4. package/dist/cjs/js/index.js +79 -0
  5. package/dist/cjs/js/keypair.d.ts +47 -0
  6. package/dist/cjs/js/keypair.js +69 -0
  7. package/dist/cjs/js/parser.d.ts +253 -0
  8. package/dist/cjs/js/parser.js +58 -0
  9. package/dist/cjs/js/pubkey.d.ts +54 -0
  10. package/dist/cjs/js/pubkey.js +76 -0
  11. package/dist/cjs/js/transaction.d.ts +156 -0
  12. package/dist/cjs/js/transaction.js +176 -0
  13. package/dist/cjs/js/versioned.d.ts +177 -0
  14. package/dist/cjs/js/versioned.js +197 -0
  15. package/dist/cjs/js/wasm/wasm_solana.d.ts +1030 -0
  16. package/dist/cjs/js/wasm/wasm_solana.js +6216 -0
  17. package/dist/cjs/js/wasm/wasm_solana_bg.wasm +0 -0
  18. package/dist/cjs/js/wasm/wasm_solana_bg.wasm.d.ts +341 -0
  19. package/dist/cjs/package.json +1 -0
  20. package/dist/esm/js/builder.d.ts +499 -0
  21. package/dist/esm/js/builder.js +109 -0
  22. package/dist/esm/js/index.d.ts +16 -0
  23. package/dist/esm/js/index.js +24 -0
  24. package/dist/esm/js/keypair.d.ts +47 -0
  25. package/dist/esm/js/keypair.js +65 -0
  26. package/dist/esm/js/parser.d.ts +253 -0
  27. package/dist/esm/js/parser.js +55 -0
  28. package/dist/esm/js/pubkey.d.ts +54 -0
  29. package/dist/esm/js/pubkey.js +72 -0
  30. package/dist/esm/js/transaction.d.ts +156 -0
  31. package/dist/esm/js/transaction.js +172 -0
  32. package/dist/esm/js/versioned.d.ts +177 -0
  33. package/dist/esm/js/versioned.js +192 -0
  34. package/dist/esm/js/wasm/wasm_solana.d.ts +1030 -0
  35. package/dist/esm/js/wasm/wasm_solana.js +4 -0
  36. package/dist/esm/js/wasm/wasm_solana_bg.js +6138 -0
  37. package/dist/esm/js/wasm/wasm_solana_bg.wasm +0 -0
  38. package/dist/esm/js/wasm/wasm_solana_bg.wasm.d.ts +341 -0
  39. package/package.json +1 -1
@@ -0,0 +1,1030 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class AeCiphertext {
5
+ private constructor();
6
+ free(): void;
7
+ [Symbol.dispose](): void;
8
+ }
9
+
10
+ export class AeKey {
11
+ private constructor();
12
+ free(): void;
13
+ [Symbol.dispose](): void;
14
+ decrypt(ciphertext: AeCiphertext): bigint | undefined;
15
+ /**
16
+ * Encrypts an amount under the authenticated encryption key.
17
+ */
18
+ encrypt(amount: bigint): AeCiphertext;
19
+ /**
20
+ * Generates a random authenticated encryption key.
21
+ *
22
+ * This function is randomized. It internally samples a scalar element using `OsRng`.
23
+ */
24
+ static newRand(): AeKey;
25
+ }
26
+
27
+ export class BatchedGroupedCiphertext2HandlesValidityProof {
28
+ private constructor();
29
+ free(): void;
30
+ [Symbol.dispose](): void;
31
+ }
32
+
33
+ export class BatchedGroupedCiphertext2HandlesValidityProofContext {
34
+ private constructor();
35
+ free(): void;
36
+ [Symbol.dispose](): void;
37
+ static fromBytes(bytes: Uint8Array): BatchedGroupedCiphertext2HandlesValidityProofContext;
38
+ toBytes(): Uint8Array;
39
+ first_pubkey: PodElGamalPubkey;
40
+ second_pubkey: PodElGamalPubkey;
41
+ grouped_ciphertext_lo: PodGroupedElGamalCiphertext2Handles;
42
+ grouped_ciphertext_hi: PodGroupedElGamalCiphertext2Handles;
43
+ }
44
+
45
+ export class BatchedGroupedCiphertext2HandlesValidityProofData {
46
+ private constructor();
47
+ free(): void;
48
+ [Symbol.dispose](): void;
49
+ static fromBytes(bytes: Uint8Array): BatchedGroupedCiphertext2HandlesValidityProofData;
50
+ static new(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, grouped_ciphertext_lo: GroupedElGamalCiphertext2Handles, grouped_ciphertext_hi: GroupedElGamalCiphertext2Handles, amount_lo: bigint, amount_hi: bigint, opening_lo: PedersenOpening, opening_hi: PedersenOpening): BatchedGroupedCiphertext2HandlesValidityProofData;
51
+ toBytes(): Uint8Array;
52
+ context: BatchedGroupedCiphertext2HandlesValidityProofContext;
53
+ proof: PodBatchedGroupedCiphertext2HandlesValidityProof;
54
+ }
55
+
56
+ export class BatchedGroupedCiphertext3HandlesValidityProof {
57
+ private constructor();
58
+ free(): void;
59
+ [Symbol.dispose](): void;
60
+ }
61
+
62
+ export class BatchedGroupedCiphertext3HandlesValidityProofContext {
63
+ private constructor();
64
+ free(): void;
65
+ [Symbol.dispose](): void;
66
+ static fromBytes(bytes: Uint8Array): BatchedGroupedCiphertext3HandlesValidityProofContext;
67
+ toBytes(): Uint8Array;
68
+ first_pubkey: PodElGamalPubkey;
69
+ second_pubkey: PodElGamalPubkey;
70
+ third_pubkey: PodElGamalPubkey;
71
+ grouped_ciphertext_lo: PodGroupedElGamalCiphertext3Handles;
72
+ grouped_ciphertext_hi: PodGroupedElGamalCiphertext3Handles;
73
+ }
74
+
75
+ export class BatchedGroupedCiphertext3HandlesValidityProofData {
76
+ private constructor();
77
+ free(): void;
78
+ [Symbol.dispose](): void;
79
+ static fromBytes(bytes: Uint8Array): BatchedGroupedCiphertext3HandlesValidityProofData;
80
+ static new(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, third_pubkey: ElGamalPubkey, grouped_ciphertext_lo: GroupedElGamalCiphertext3Handles, grouped_ciphertext_hi: GroupedElGamalCiphertext3Handles, amount_lo: bigint, amount_hi: bigint, opening_lo: PedersenOpening, opening_hi: PedersenOpening): BatchedGroupedCiphertext3HandlesValidityProofData;
81
+ toBytes(): Uint8Array;
82
+ context: BatchedGroupedCiphertext3HandlesValidityProofContext;
83
+ proof: PodBatchedGroupedCiphertext3HandlesValidityProof;
84
+ }
85
+
86
+ export class BuilderNamespace {
87
+ private constructor();
88
+ free(): void;
89
+ [Symbol.dispose](): void;
90
+ /**
91
+ * Build a Solana transaction from an intent structure.
92
+ *
93
+ * Takes a TransactionIntent JSON object and returns serialized transaction bytes.
94
+ *
95
+ * # Intent Structure
96
+ *
97
+ * ```json
98
+ * {
99
+ * "feePayer": "DgT9qyYwYKBRDyDw3EfR12LHQCQjtNrKu2qMsXHuosmB",
100
+ * "nonce": {
101
+ * "type": "blockhash",
102
+ * "value": "GWaQEymC3Z9SHM2gkh8u12xL1zJPMHPCSVR3pSDpEXE4"
103
+ * },
104
+ * "instructions": [
105
+ * { "type": "transfer", "from": "...", "to": "...", "lamports": "1000000" },
106
+ * { "type": "memo", "message": "BitGo tx" }
107
+ * ]
108
+ * }
109
+ * ```
110
+ *
111
+ * # Instruction Types
112
+ *
113
+ * - `transfer`: SOL transfer (from, to, lamports)
114
+ * - `createAccount`: Create new account (from, newAccount, lamports, space, owner)
115
+ * - `nonceAdvance`: Advance durable nonce (nonce, authority)
116
+ * - `nonceInitialize`: Initialize nonce account (nonce, authority)
117
+ * - `allocate`: Allocate space (account, space)
118
+ * - `assign`: Assign to program (account, owner)
119
+ * - `memo`: Add memo (message)
120
+ * - `computeBudget`: Set compute units (unitLimit, unitPrice)
121
+ *
122
+ * # Returns
123
+ *
124
+ * A `Transaction` object that can be inspected, signed, and serialized.
125
+ * The transaction will have empty signature placeholders that can be
126
+ * filled in later by signing via `addSignature()`.
127
+ *
128
+ * @param intent - The transaction intent as a JSON object
129
+ * @returns Transaction object
130
+ */
131
+ static build_transaction(intent: any): WasmTransaction;
132
+ /**
133
+ * Build a versioned transaction directly from raw MessageV0 data.
134
+ *
135
+ * This function is used for the `fromVersionedTransactionData()` path where we already
136
+ * have pre-compiled versioned data (indexes + ALT refs). No instruction compilation
137
+ * is needed - we just serialize the raw structure to bytes.
138
+ *
139
+ * # Data Structure
140
+ *
141
+ * ```json
142
+ * {
143
+ * "staticAccountKeys": ["pubkey1", "pubkey2", ...],
144
+ * "addressLookupTables": [
145
+ * { "accountKey": "altPubkey", "writableIndexes": [0, 1], "readonlyIndexes": [2] }
146
+ * ],
147
+ * "versionedInstructions": [
148
+ * { "programIdIndex": 0, "accountKeyIndexes": [1, 2], "data": "base58EncodedData" }
149
+ * ],
150
+ * "messageHeader": {
151
+ * "numRequiredSignatures": 1,
152
+ * "numReadonlySignedAccounts": 0,
153
+ * "numReadonlyUnsignedAccounts": 3
154
+ * },
155
+ * "recentBlockhash": "blockhash"
156
+ * }
157
+ * ```
158
+ *
159
+ * @param data - Raw versioned transaction data as a JSON object
160
+ * @returns VersionedTransaction object
161
+ */
162
+ static build_from_versioned_data(data: any): WasmVersionedTransaction;
163
+ }
164
+
165
+ export class CiphertextCiphertextEqualityProof {
166
+ private constructor();
167
+ free(): void;
168
+ [Symbol.dispose](): void;
169
+ }
170
+
171
+ export class CiphertextCiphertextEqualityProofContext {
172
+ private constructor();
173
+ free(): void;
174
+ [Symbol.dispose](): void;
175
+ static fromBytes(bytes: Uint8Array): CiphertextCiphertextEqualityProofContext;
176
+ toBytes(): Uint8Array;
177
+ first_pubkey: PodElGamalPubkey;
178
+ second_pubkey: PodElGamalPubkey;
179
+ first_ciphertext: PodElGamalCiphertext;
180
+ second_ciphertext: PodElGamalCiphertext;
181
+ }
182
+
183
+ export class CiphertextCiphertextEqualityProofData {
184
+ private constructor();
185
+ free(): void;
186
+ [Symbol.dispose](): void;
187
+ static fromBytes(bytes: Uint8Array): CiphertextCiphertextEqualityProofData;
188
+ static new(first_keypair: ElGamalKeypair, second_pubkey: ElGamalPubkey, first_ciphertext: ElGamalCiphertext, second_ciphertext: ElGamalCiphertext, second_opening: PedersenOpening, amount: bigint): CiphertextCiphertextEqualityProofData;
189
+ toBytes(): Uint8Array;
190
+ context: CiphertextCiphertextEqualityProofContext;
191
+ proof: PodCiphertextCiphertextEqualityProof;
192
+ }
193
+
194
+ export class CiphertextCommitmentEqualityProof {
195
+ private constructor();
196
+ free(): void;
197
+ [Symbol.dispose](): void;
198
+ }
199
+
200
+ export class CiphertextCommitmentEqualityProofContext {
201
+ private constructor();
202
+ free(): void;
203
+ [Symbol.dispose](): void;
204
+ static fromBytes(bytes: Uint8Array): CiphertextCommitmentEqualityProofContext;
205
+ toBytes(): Uint8Array;
206
+ /**
207
+ * The ElGamal pubkey
208
+ */
209
+ pubkey: PodElGamalPubkey;
210
+ /**
211
+ * The ciphertext encrypted under the ElGamal pubkey
212
+ */
213
+ ciphertext: PodElGamalCiphertext;
214
+ /**
215
+ * The Pedersen commitment
216
+ */
217
+ commitment: PodPedersenCommitment;
218
+ }
219
+
220
+ export class CiphertextCommitmentEqualityProofData {
221
+ private constructor();
222
+ free(): void;
223
+ [Symbol.dispose](): void;
224
+ static fromBytes(bytes: Uint8Array): CiphertextCommitmentEqualityProofData;
225
+ static new(keypair: ElGamalKeypair, ciphertext: ElGamalCiphertext, commitment: PedersenCommitment, opening: PedersenOpening, amount: bigint): CiphertextCommitmentEqualityProofData;
226
+ toBytes(): Uint8Array;
227
+ context: CiphertextCommitmentEqualityProofContext;
228
+ proof: PodCiphertextCommitmentEqualityProof;
229
+ }
230
+
231
+ export class DecryptHandle {
232
+ private constructor();
233
+ free(): void;
234
+ [Symbol.dispose](): void;
235
+ }
236
+
237
+ export class ElGamalCiphertext {
238
+ private constructor();
239
+ free(): void;
240
+ [Symbol.dispose](): void;
241
+ commitment: PedersenCommitment;
242
+ handle: DecryptHandle;
243
+ }
244
+
245
+ export class ElGamalKeypair {
246
+ private constructor();
247
+ free(): void;
248
+ [Symbol.dispose](): void;
249
+ pubkeyOwned(): ElGamalPubkey;
250
+ /**
251
+ * Generates the public and secret keys for ElGamal encryption.
252
+ *
253
+ * This function is randomized. It internally samples a scalar element using `OsRng`.
254
+ */
255
+ static newRand(): ElGamalKeypair;
256
+ }
257
+
258
+ export class ElGamalPubkey {
259
+ private constructor();
260
+ free(): void;
261
+ [Symbol.dispose](): void;
262
+ encryptU64(amount: bigint): ElGamalCiphertext;
263
+ encryptWithU64(amount: bigint, opening: PedersenOpening): ElGamalCiphertext;
264
+ }
265
+
266
+ export class GroupedCiphertext2HandlesValidityProof {
267
+ private constructor();
268
+ free(): void;
269
+ [Symbol.dispose](): void;
270
+ }
271
+
272
+ export class GroupedCiphertext2HandlesValidityProofContext {
273
+ private constructor();
274
+ free(): void;
275
+ [Symbol.dispose](): void;
276
+ static fromBytes(bytes: Uint8Array): GroupedCiphertext2HandlesValidityProofContext;
277
+ toBytes(): Uint8Array;
278
+ first_pubkey: PodElGamalPubkey;
279
+ second_pubkey: PodElGamalPubkey;
280
+ grouped_ciphertext: PodGroupedElGamalCiphertext2Handles;
281
+ }
282
+
283
+ export class GroupedCiphertext2HandlesValidityProofData {
284
+ private constructor();
285
+ free(): void;
286
+ [Symbol.dispose](): void;
287
+ static fromBytes(bytes: Uint8Array): GroupedCiphertext2HandlesValidityProofData;
288
+ static new(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, grouped_ciphertext: GroupedElGamalCiphertext2Handles, amount: bigint, opening: PedersenOpening): GroupedCiphertext2HandlesValidityProofData;
289
+ toBytes(): Uint8Array;
290
+ context: GroupedCiphertext2HandlesValidityProofContext;
291
+ proof: PodGroupedCiphertext2HandlesValidityProof;
292
+ }
293
+
294
+ export class GroupedCiphertext3HandlesValidityProof {
295
+ private constructor();
296
+ free(): void;
297
+ [Symbol.dispose](): void;
298
+ }
299
+
300
+ export class GroupedCiphertext3HandlesValidityProofContext {
301
+ private constructor();
302
+ free(): void;
303
+ [Symbol.dispose](): void;
304
+ static fromBytes(bytes: Uint8Array): GroupedCiphertext3HandlesValidityProofContext;
305
+ toBytes(): Uint8Array;
306
+ first_pubkey: PodElGamalPubkey;
307
+ second_pubkey: PodElGamalPubkey;
308
+ third_pubkey: PodElGamalPubkey;
309
+ grouped_ciphertext: PodGroupedElGamalCiphertext3Handles;
310
+ }
311
+
312
+ export class GroupedCiphertext3HandlesValidityProofData {
313
+ private constructor();
314
+ free(): void;
315
+ [Symbol.dispose](): void;
316
+ static fromBytes(bytes: Uint8Array): GroupedCiphertext3HandlesValidityProofData;
317
+ static new(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, third_pubkey: ElGamalPubkey, grouped_ciphertext: GroupedElGamalCiphertext3Handles, amount: bigint, opening: PedersenOpening): GroupedCiphertext3HandlesValidityProofData;
318
+ toBytes(): Uint8Array;
319
+ context: GroupedCiphertext3HandlesValidityProofContext;
320
+ proof: PodGroupedCiphertext3HandlesValidityProof;
321
+ }
322
+
323
+ export class GroupedElGamalCiphertext2Handles {
324
+ private constructor();
325
+ free(): void;
326
+ [Symbol.dispose](): void;
327
+ static encryptU64(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, amount: bigint): GroupedElGamalCiphertext2Handles;
328
+ static encryptionWithU64(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, amount: bigint, opening: PedersenOpening): GroupedElGamalCiphertext2Handles;
329
+ }
330
+
331
+ export class GroupedElGamalCiphertext3Handles {
332
+ private constructor();
333
+ free(): void;
334
+ [Symbol.dispose](): void;
335
+ static encryptU64(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, third_pubkey: ElGamalPubkey, amount: bigint): GroupedElGamalCiphertext3Handles;
336
+ static encryptionWithU64(first_pubkey: ElGamalPubkey, second_pubkey: ElGamalPubkey, third_pubkey: ElGamalPubkey, amount: bigint, opening: PedersenOpening): GroupedElGamalCiphertext3Handles;
337
+ }
338
+
339
+ export class Hash {
340
+ free(): void;
341
+ [Symbol.dispose](): void;
342
+ /**
343
+ * Create a new Hash object
344
+ *
345
+ * * `value` - optional hash as a base58 encoded string, `Uint8Array`, `[number]`
346
+ */
347
+ constructor(value: any);
348
+ /**
349
+ * Checks if two `Hash`s are equal
350
+ */
351
+ equals(other: Hash): boolean;
352
+ /**
353
+ * Return the `Uint8Array` representation of the hash
354
+ */
355
+ toBytes(): Uint8Array;
356
+ /**
357
+ * Return the base58 string representation of the hash
358
+ */
359
+ toString(): string;
360
+ }
361
+
362
+ export class Instruction {
363
+ private constructor();
364
+ free(): void;
365
+ [Symbol.dispose](): void;
366
+ }
367
+
368
+ export class Instructions {
369
+ free(): void;
370
+ [Symbol.dispose](): void;
371
+ constructor();
372
+ push(instruction: Instruction): void;
373
+ }
374
+
375
+ export class Keypair {
376
+ free(): void;
377
+ [Symbol.dispose](): void;
378
+ /**
379
+ * Create a new `Keypair `
380
+ */
381
+ constructor();
382
+ /**
383
+ * Convert a `Keypair` to a `Uint8Array`
384
+ */
385
+ toBytes(): Uint8Array;
386
+ /**
387
+ * Recover a `Keypair` from a `Uint8Array`
388
+ */
389
+ static fromBytes(bytes: Uint8Array): Keypair;
390
+ /**
391
+ * Return the `Pubkey` for this `Keypair`
392
+ */
393
+ pubkey(): Pubkey;
394
+ }
395
+
396
+ export class Message {
397
+ private constructor();
398
+ free(): void;
399
+ [Symbol.dispose](): void;
400
+ /**
401
+ * The id of a recent ledger entry.
402
+ */
403
+ recent_blockhash: Hash;
404
+ }
405
+
406
+ export class ParserNamespace {
407
+ private constructor();
408
+ free(): void;
409
+ [Symbol.dispose](): void;
410
+ /**
411
+ * Parse a serialized Solana transaction into structured data.
412
+ *
413
+ * Takes raw transaction bytes and returns a JavaScript object with:
414
+ * - `feePayer`: The fee payer address (base58)
415
+ * - `numSignatures`: Number of required signatures
416
+ * - `nonce`: The blockhash/nonce value (base58)
417
+ * - `durableNonce`: Optional durable nonce info (if tx uses nonce)
418
+ * - `instructionsData`: Array of decoded instructions with semantic types
419
+ * - `accountKeys`: Array of all account addresses (base58)
420
+ *
421
+ * Each instruction in `instructionsData` has a `type` field identifying the
422
+ * instruction type (e.g., "Transfer", "StakingActivate", "TokenTransfer").
423
+ *
424
+ * Amount fields (amount, fee, lamports, poolTokens) are returned as BigInt.
425
+ *
426
+ * @param bytes - The raw transaction bytes (wire format)
427
+ * @returns A ParsedTransaction object
428
+ */
429
+ static parse_transaction(bytes: Uint8Array): any;
430
+ }
431
+
432
+ export class Pedersen {
433
+ private constructor();
434
+ free(): void;
435
+ [Symbol.dispose](): void;
436
+ static withU64(amount: bigint, opening: PedersenOpening): PedersenCommitment;
437
+ }
438
+
439
+ export class PedersenCommitment {
440
+ private constructor();
441
+ free(): void;
442
+ [Symbol.dispose](): void;
443
+ }
444
+
445
+ export class PedersenOpening {
446
+ private constructor();
447
+ free(): void;
448
+ [Symbol.dispose](): void;
449
+ static newRand(): PedersenOpening;
450
+ }
451
+
452
+ export class PercentageWithCapProof {
453
+ private constructor();
454
+ free(): void;
455
+ [Symbol.dispose](): void;
456
+ }
457
+
458
+ export class PercentageWithCapProofContext {
459
+ private constructor();
460
+ free(): void;
461
+ [Symbol.dispose](): void;
462
+ static fromBytes(bytes: Uint8Array): PercentageWithCapProofContext;
463
+ toBytes(): Uint8Array;
464
+ /**
465
+ * The Pedersen commitment to the percentage amount.
466
+ */
467
+ percentage_commitment: PodPedersenCommitment;
468
+ /**
469
+ * The Pedersen commitment to the delta amount.
470
+ */
471
+ delta_commitment: PodPedersenCommitment;
472
+ /**
473
+ * The Pedersen commitment to the claimed amount.
474
+ */
475
+ claimed_commitment: PodPedersenCommitment;
476
+ /**
477
+ * The maximum cap bound.
478
+ */
479
+ max_value: PodU64;
480
+ }
481
+
482
+ export class PercentageWithCapProofData {
483
+ private constructor();
484
+ free(): void;
485
+ [Symbol.dispose](): void;
486
+ static fromBytes(bytes: Uint8Array): PercentageWithCapProofData;
487
+ static new(percentage_commitment: PedersenCommitment, percentage_opening: PedersenOpening, percentage_amount: bigint, delta_commitment: PedersenCommitment, delta_opening: PedersenOpening, delta_amount: bigint, claimed_commitment: PedersenCommitment, claimed_opening: PedersenOpening, max_value: bigint): PercentageWithCapProofData;
488
+ toBytes(): Uint8Array;
489
+ context: PercentageWithCapProofContext;
490
+ proof: PodPercentageWithCapProof;
491
+ }
492
+
493
+ export class PodAeCiphertext {
494
+ free(): void;
495
+ [Symbol.dispose](): void;
496
+ constructor(value: any);
497
+ decode(): AeCiphertext;
498
+ static encode(decoded: AeCiphertext): PodAeCiphertext;
499
+ equals(other: PodAeCiphertext): boolean;
500
+ static zeroed(): PodAeCiphertext;
501
+ toBytes(): Uint8Array;
502
+ toString(): string;
503
+ }
504
+
505
+ export class PodBatchedGroupedCiphertext2HandlesValidityProof {
506
+ private constructor();
507
+ free(): void;
508
+ [Symbol.dispose](): void;
509
+ }
510
+
511
+ export class PodBatchedGroupedCiphertext3HandlesValidityProof {
512
+ private constructor();
513
+ free(): void;
514
+ [Symbol.dispose](): void;
515
+ }
516
+
517
+ export class PodCiphertextCiphertextEqualityProof {
518
+ private constructor();
519
+ free(): void;
520
+ [Symbol.dispose](): void;
521
+ }
522
+
523
+ export class PodCiphertextCommitmentEqualityProof {
524
+ private constructor();
525
+ free(): void;
526
+ [Symbol.dispose](): void;
527
+ }
528
+
529
+ export class PodElGamalCiphertext {
530
+ free(): void;
531
+ [Symbol.dispose](): void;
532
+ constructor(value: any);
533
+ decode(): ElGamalCiphertext;
534
+ static encode(decoded: ElGamalCiphertext): PodElGamalCiphertext;
535
+ equals(other: PodElGamalCiphertext): boolean;
536
+ static zeroed(): PodElGamalCiphertext;
537
+ toBytes(): Uint8Array;
538
+ toString(): string;
539
+ }
540
+
541
+ export class PodElGamalPubkey {
542
+ free(): void;
543
+ [Symbol.dispose](): void;
544
+ constructor(value: any);
545
+ decode(): ElGamalPubkey;
546
+ static encode(decoded: ElGamalPubkey): PodElGamalPubkey;
547
+ equals(other: PodElGamalPubkey): boolean;
548
+ static zeroed(): PodElGamalPubkey;
549
+ toBytes(): Uint8Array;
550
+ toString(): string;
551
+ }
552
+
553
+ export class PodGroupedCiphertext2HandlesValidityProof {
554
+ private constructor();
555
+ free(): void;
556
+ [Symbol.dispose](): void;
557
+ }
558
+
559
+ export class PodGroupedCiphertext3HandlesValidityProof {
560
+ private constructor();
561
+ free(): void;
562
+ [Symbol.dispose](): void;
563
+ }
564
+
565
+ export class PodGroupedElGamalCiphertext2Handles {
566
+ private constructor();
567
+ free(): void;
568
+ [Symbol.dispose](): void;
569
+ }
570
+
571
+ export class PodGroupedElGamalCiphertext3Handles {
572
+ private constructor();
573
+ free(): void;
574
+ [Symbol.dispose](): void;
575
+ }
576
+
577
+ export class PodPedersenCommitment {
578
+ private constructor();
579
+ free(): void;
580
+ [Symbol.dispose](): void;
581
+ }
582
+
583
+ export class PodPercentageWithCapProof {
584
+ private constructor();
585
+ free(): void;
586
+ [Symbol.dispose](): void;
587
+ }
588
+
589
+ export class PodPubkeyValidityProof {
590
+ private constructor();
591
+ free(): void;
592
+ [Symbol.dispose](): void;
593
+ }
594
+
595
+ export class PodU64 {
596
+ private constructor();
597
+ free(): void;
598
+ [Symbol.dispose](): void;
599
+ }
600
+
601
+ export class PodZeroCiphertextProof {
602
+ private constructor();
603
+ free(): void;
604
+ [Symbol.dispose](): void;
605
+ }
606
+
607
+ export class Pubkey {
608
+ free(): void;
609
+ [Symbol.dispose](): void;
610
+ /**
611
+ * Create a new Pubkey object
612
+ *
613
+ * * `value` - optional public key as a base58 encoded string, `Uint8Array`, `[number]`
614
+ */
615
+ constructor(value: any);
616
+ /**
617
+ * Derive a Pubkey from another Pubkey, string seed, and a program id
618
+ */
619
+ static createWithSeed(base: Pubkey, seed: string, owner: Pubkey): Pubkey;
620
+ /**
621
+ * Find a valid program address
622
+ *
623
+ * Returns:
624
+ * * `[PubKey, number]` - the program address and bump seed
625
+ */
626
+ static findProgramAddress(seeds: any[], program_id: Pubkey): any;
627
+ /**
628
+ * Derive a program address from seeds and a program id
629
+ */
630
+ static createProgramAddress(seeds: any[], program_id: Pubkey): Pubkey;
631
+ /**
632
+ * Checks if two `Pubkey`s are equal
633
+ */
634
+ equals(other: Pubkey): boolean;
635
+ /**
636
+ * Return the `Uint8Array` representation of the public key
637
+ */
638
+ toBytes(): Uint8Array;
639
+ /**
640
+ * Return the base58 string representation of the public key
641
+ */
642
+ toString(): string;
643
+ /**
644
+ * Check if a `Pubkey` is on the ed25519 curve.
645
+ */
646
+ isOnCurve(): boolean;
647
+ }
648
+
649
+ export class PubkeyValidityProof {
650
+ private constructor();
651
+ free(): void;
652
+ [Symbol.dispose](): void;
653
+ }
654
+
655
+ export class PubkeyValidityProofContext {
656
+ private constructor();
657
+ free(): void;
658
+ [Symbol.dispose](): void;
659
+ static fromBytes(bytes: Uint8Array): PubkeyValidityProofContext;
660
+ toBytes(): Uint8Array;
661
+ /**
662
+ * The public key to be proved
663
+ */
664
+ pubkey: PodElGamalPubkey;
665
+ }
666
+
667
+ export class PubkeyValidityProofData {
668
+ private constructor();
669
+ free(): void;
670
+ [Symbol.dispose](): void;
671
+ static fromBytes(bytes: Uint8Array): PubkeyValidityProofData;
672
+ static new(keypair: ElGamalKeypair): PubkeyValidityProofData;
673
+ toBytes(): Uint8Array;
674
+ /**
675
+ * The context data for the public key validity proof
676
+ */
677
+ context: PubkeyValidityProofContext;
678
+ /**
679
+ * Proof that the public key is well-formed
680
+ */
681
+ proof: PodPubkeyValidityProof;
682
+ }
683
+
684
+ export class WasmKeypair {
685
+ private constructor();
686
+ free(): void;
687
+ [Symbol.dispose](): void;
688
+ /**
689
+ * Create a keypair from a 32-byte secret key.
690
+ */
691
+ static from_secret_key(secret_key: Uint8Array): WasmKeypair;
692
+ /**
693
+ * Create a keypair from a 64-byte Solana secret key (secret + public concatenated).
694
+ */
695
+ static from_solana_secret_key(secret_key: Uint8Array): WasmKeypair;
696
+ /**
697
+ * Get the address as a base58 string.
698
+ */
699
+ address(): string;
700
+ /**
701
+ * Get the public key as a base58 string.
702
+ */
703
+ to_base58(): string;
704
+ /**
705
+ * Get the public key as a 32-byte Uint8Array.
706
+ */
707
+ readonly public_key: Uint8Array;
708
+ /**
709
+ * Get the secret key as a 32-byte Uint8Array.
710
+ */
711
+ readonly secret_key: Uint8Array;
712
+ }
713
+
714
+ export class WasmPubkey {
715
+ private constructor();
716
+ free(): void;
717
+ [Symbol.dispose](): void;
718
+ /**
719
+ * Create a Pubkey from raw bytes (32 bytes).
720
+ */
721
+ static from_bytes(bytes: Uint8Array): WasmPubkey;
722
+ /**
723
+ * Create a Pubkey from a base58 string.
724
+ */
725
+ static from_base58(address: string): WasmPubkey;
726
+ /**
727
+ * Check if this public key is on the Ed25519 curve.
728
+ */
729
+ is_on_curve(): boolean;
730
+ /**
731
+ * Check if two pubkeys are equal.
732
+ */
733
+ equals(other: WasmPubkey): boolean;
734
+ /**
735
+ * Get as raw bytes (32 bytes).
736
+ */
737
+ to_bytes(): Uint8Array;
738
+ /**
739
+ * Convert to base58 string (the standard Solana address format).
740
+ */
741
+ to_base58(): string;
742
+ }
743
+
744
+ export class WasmTransaction {
745
+ private constructor();
746
+ free(): void;
747
+ [Symbol.dispose](): void;
748
+ /**
749
+ * Deserialize a transaction from raw bytes.
750
+ */
751
+ static from_bytes(bytes: Uint8Array): WasmTransaction;
752
+ /**
753
+ * Get all signatures as an array of byte arrays.
754
+ *
755
+ * Each signature is returned as a Uint8Array.
756
+ */
757
+ signatures(): Array<any>;
758
+ /**
759
+ * Get all account keys as an array of base58 strings.
760
+ */
761
+ account_keys(): Array<any>;
762
+ /**
763
+ * Get all instructions as an array.
764
+ *
765
+ * Each instruction is a JS object with programId, accounts, and data.
766
+ */
767
+ instructions(): Array<any>;
768
+ /**
769
+ * Check if a public key is a required signer for this transaction.
770
+ *
771
+ * @param pubkey - The public key as a base58 string
772
+ * @returns The signer index if the pubkey is a signer, null otherwise
773
+ */
774
+ signer_index(pubkey: string): number | undefined;
775
+ /**
776
+ * Add a signature for a given public key.
777
+ *
778
+ * The pubkey must be one of the required signers in the transaction.
779
+ * The signature must be exactly 64 bytes (Ed25519 signature).
780
+ *
781
+ * @param pubkey - The public key as a base58 string
782
+ * @param signature - The 64-byte signature
783
+ */
784
+ add_signature(pubkey: string, signature: Uint8Array): void;
785
+ /**
786
+ * Get the signable message payload (what gets signed).
787
+ *
788
+ * This is the serialized message that signers sign.
789
+ */
790
+ signable_payload(): Uint8Array;
791
+ /**
792
+ * Serialize the transaction to bytes.
793
+ */
794
+ to_bytes(): Uint8Array;
795
+ /**
796
+ * Get the number of signatures in the transaction.
797
+ */
798
+ readonly num_signatures: number;
799
+ /**
800
+ * Get the number of instructions in the transaction.
801
+ */
802
+ readonly num_instructions: number;
803
+ /**
804
+ * Get the recent blockhash as a base58 string.
805
+ */
806
+ readonly recent_blockhash: string;
807
+ /**
808
+ * Get the fee payer address as a base58 string.
809
+ *
810
+ * Returns `null` if there are no account keys (shouldn't happen for valid transactions).
811
+ */
812
+ readonly fee_payer: string | undefined;
813
+ }
814
+
815
+ export class WasmVersionedTransaction {
816
+ private constructor();
817
+ free(): void;
818
+ [Symbol.dispose](): void;
819
+ /**
820
+ * Deserialize a transaction from raw bytes.
821
+ *
822
+ * Automatically handles both legacy and versioned formats.
823
+ */
824
+ static from_bytes(bytes: Uint8Array): WasmVersionedTransaction;
825
+ /**
826
+ * Get all signatures as an array of byte arrays.
827
+ */
828
+ signatures(): Array<any>;
829
+ /**
830
+ * Get all instructions as an array.
831
+ *
832
+ * Note: For versioned transactions with ALTs, account indices may
833
+ * reference accounts beyond static_account_keys. Use address_lookup_tables()
834
+ * to resolve additional accounts.
835
+ */
836
+ instructions(): Array<any>;
837
+ /**
838
+ * Check if a public key is a required signer.
839
+ *
840
+ * @returns The signer index if the pubkey is a signer, null otherwise
841
+ */
842
+ signer_index(pubkey: string): number | undefined;
843
+ /**
844
+ * Add a signature for a given public key.
845
+ *
846
+ * @param pubkey - The public key as a base58 string
847
+ * @param signature - The 64-byte signature
848
+ */
849
+ add_signature(pubkey: string, signature: Uint8Array): void;
850
+ /**
851
+ * Get the signable message payload.
852
+ */
853
+ signable_payload(): Uint8Array;
854
+ /**
855
+ * Get static account keys (accounts stored directly in the message).
856
+ *
857
+ * For versioned transactions, additional accounts may be referenced
858
+ * via Address Lookup Tables.
859
+ */
860
+ static_account_keys(): Array<any>;
861
+ /**
862
+ * Get Address Lookup Table data.
863
+ *
864
+ * Returns an array of ALT objects, each containing:
865
+ * - accountKey: The lookup table account address
866
+ * - writableIndexes: Indices of writable accounts in the table
867
+ * - readonlyIndexes: Indices of readonly accounts in the table
868
+ *
869
+ * For legacy transactions, returns an empty array.
870
+ */
871
+ address_lookup_tables(): Array<any>;
872
+ /**
873
+ * Serialize the transaction to bytes.
874
+ */
875
+ to_bytes(): Uint8Array;
876
+ /**
877
+ * Check if this is a versioned transaction (MessageV0).
878
+ *
879
+ * @returns true for MessageV0, false for legacy
880
+ */
881
+ readonly is_versioned: boolean;
882
+ /**
883
+ * Get the number of signatures.
884
+ */
885
+ readonly num_signatures: number;
886
+ /**
887
+ * Get the number of instructions.
888
+ */
889
+ readonly num_instructions: number;
890
+ /**
891
+ * Get the recent blockhash as a base58 string.
892
+ */
893
+ readonly recent_blockhash: string;
894
+ /**
895
+ * Get the fee payer address as a base58 string.
896
+ */
897
+ readonly fee_payer: string | undefined;
898
+ }
899
+
900
+ export class ZeroCiphertextProof {
901
+ private constructor();
902
+ free(): void;
903
+ [Symbol.dispose](): void;
904
+ }
905
+
906
+ export class ZeroCiphertextProofContext {
907
+ private constructor();
908
+ free(): void;
909
+ [Symbol.dispose](): void;
910
+ static fromBytes(bytes: Uint8Array): ZeroCiphertextProofContext;
911
+ toBytes(): Uint8Array;
912
+ /**
913
+ * The ElGamal pubkey associated with the ElGamal ciphertext
914
+ */
915
+ pubkey: PodElGamalPubkey;
916
+ /**
917
+ * The ElGamal ciphertext that encrypts zero
918
+ */
919
+ ciphertext: PodElGamalCiphertext;
920
+ }
921
+
922
+ export class ZeroCiphertextProofData {
923
+ private constructor();
924
+ free(): void;
925
+ [Symbol.dispose](): void;
926
+ static fromBytes(bytes: Uint8Array): ZeroCiphertextProofData;
927
+ static new(keypair: ElGamalKeypair, ciphertext: ElGamalCiphertext): ZeroCiphertextProofData;
928
+ toBytes(): Uint8Array;
929
+ /**
930
+ * The context data for the zero-ciphertext proof
931
+ */
932
+ context: ZeroCiphertextProofContext;
933
+ /**
934
+ * Proof that the ciphertext is zero
935
+ */
936
+ proof: PodZeroCiphertextProof;
937
+ }
938
+
939
+ /**
940
+ * Associated Token Account Program ID
941
+ */
942
+ export function ata_program_id(): string;
943
+
944
+ /**
945
+ * Compute Budget Program ID
946
+ */
947
+ export function compute_budget_program_id(): string;
948
+
949
+ /**
950
+ * Derive the Stake Pool withdraw authority PDA.
951
+ *
952
+ * This allows JavaScript code to compute the withdraw authority without needing @solana/spl-stake-pool.
953
+ * The withdraw authority is a PDA derived from seeds: ["withdraw", stake_pool_address]
954
+ *
955
+ * @param stake_pool_address - Stake pool address (base58)
956
+ * @returns The derived withdraw authority address (base58)
957
+ */
958
+ export function find_withdraw_authority_program_address(stake_pool_address: string): string;
959
+
960
+ /**
961
+ * Derive the Associated Token Account address for a given wallet and mint.
962
+ *
963
+ * This allows JavaScript code to compute ATA addresses without needing @solana/web3.js.
964
+ * The ATA is a PDA derived from seeds: [wallet_address, token_program_id, mint_address]
965
+ *
966
+ * @param wallet_address - Owner wallet address (base58)
967
+ * @param mint_address - Token mint address (base58)
968
+ * @param token_program_id - Token program ID (base58), use TOKEN_PROGRAM_ID or TOKEN_2022_PROGRAM_ID
969
+ * @returns The derived ATA address (base58)
970
+ */
971
+ export function get_associated_token_address(wallet_address: string, mint_address: string, token_program_id: string): string;
972
+
973
+ /**
974
+ * Detect if transaction bytes represent a versioned transaction.
975
+ *
976
+ * @param bytes - Raw transaction bytes
977
+ * @returns true if versioned (MessageV0), false if legacy
978
+ */
979
+ export function is_versioned_transaction(bytes: Uint8Array): boolean;
980
+
981
+ /**
982
+ * Memo Program ID
983
+ */
984
+ export function memo_program_id(): string;
985
+
986
+ /**
987
+ * Nonce account space in bytes (80)
988
+ */
989
+ export function nonce_account_space(): bigint;
990
+
991
+ /**
992
+ * Initialize Javascript logging and panic handler
993
+ */
994
+ export function solana_program_init(): void;
995
+
996
+ /**
997
+ * Stake account space in bytes (200)
998
+ */
999
+ export function stake_account_space(): bigint;
1000
+
1001
+ /**
1002
+ * Stake Pool Program ID (Jito)
1003
+ */
1004
+ export function stake_pool_program_id(): string;
1005
+
1006
+ /**
1007
+ * Stake Program ID
1008
+ */
1009
+ export function stake_program_id(): string;
1010
+
1011
+ /**
1012
+ * System Program ID
1013
+ */
1014
+ export function system_program_id(): string;
1015
+
1016
+ /**
1017
+ * Sysvar Recent Blockhashes address
1018
+ * Reference: https://github.com/solana-labs/solana/blob/v1.18.26/sdk/program/src/sysvar/recent_blockhashes.rs
1019
+ */
1020
+ export function sysvar_recent_blockhashes(): string;
1021
+
1022
+ /**
1023
+ * Token 2022 Program ID
1024
+ */
1025
+ export function token_2022_program_id(): string;
1026
+
1027
+ /**
1028
+ * Token Program ID (SPL Token)
1029
+ */
1030
+ export function token_program_id(): string;