@bitgo/wasm-solana 2.5.0 → 2.6.0
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.
- package/dist/cjs/js/index.d.ts +1 -38
- package/dist/cjs/js/index.js +2 -44
- package/dist/cjs/js/parser.d.ts +18 -8
- package/dist/cjs/js/parser.js +20 -11
- package/dist/cjs/js/transaction.d.ts +7 -26
- package/dist/cjs/js/transaction.js +7 -28
- package/dist/cjs/js/wasm/wasm_solana.d.ts +11 -0
- package/dist/cjs/js/wasm/wasm_solana.js +28 -0
- package/dist/cjs/js/wasm/wasm_solana_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_solana_bg.wasm.d.ts +13 -12
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/js/index.d.ts +1 -38
- package/dist/esm/js/index.js +1 -40
- package/dist/esm/js/parser.d.ts +18 -8
- package/dist/esm/js/parser.js +19 -10
- package/dist/esm/js/transaction.d.ts +7 -26
- package/dist/esm/js/transaction.js +7 -28
- package/dist/esm/js/wasm/wasm_solana.d.ts +11 -0
- package/dist/esm/js/wasm/wasm_solana_bg.js +28 -0
- package/dist/esm/js/wasm/wasm_solana_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_solana_bg.wasm.d.ts +13 -12
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/cjs/js/explain.d.ts +0 -100
- package/dist/cjs/js/explain.js +0 -311
- package/dist/esm/js/explain.d.ts +0 -100
- package/dist/esm/js/explain.js +0 -307
package/dist/cjs/js/index.d.ts
CHANGED
|
@@ -3,53 +3,16 @@ export * as pubkey from "./pubkey.js";
|
|
|
3
3
|
export * as transaction from "./transaction.js";
|
|
4
4
|
export * as parser from "./parser.js";
|
|
5
5
|
export * as builder from "./builder.js";
|
|
6
|
-
export * as explain from "./explain.js";
|
|
7
6
|
export { Keypair } from "./keypair.js";
|
|
8
7
|
export { Pubkey } from "./pubkey.js";
|
|
9
8
|
export { Transaction } from "./transaction.js";
|
|
10
9
|
export { VersionedTransaction, isVersionedTransaction } from "./versioned.js";
|
|
11
10
|
export type { AddressLookupTableData } from "./versioned.js";
|
|
12
|
-
export {
|
|
11
|
+
export { parseTransaction } from "./parser.js";
|
|
13
12
|
export { buildFromVersionedData } from "./builder.js";
|
|
14
13
|
export { buildFromIntent, buildFromIntent as buildTransactionFromIntent } from "./intentBuilder.js";
|
|
15
|
-
export { explainTransaction, TransactionType } from "./explain.js";
|
|
16
|
-
import { Transaction as _Transaction } from "./transaction.js";
|
|
17
|
-
/**
|
|
18
|
-
* Parse a Solana transaction from raw bytes.
|
|
19
|
-
*
|
|
20
|
-
* Returns a `Transaction` instance that can be both inspected and signed.
|
|
21
|
-
* Use `.parse()` on the returned Transaction to get decoded instruction data.
|
|
22
|
-
*
|
|
23
|
-
* This is the single entry point for working with transactions — like
|
|
24
|
-
* `BitGoPsbt.fromBytes()` in wasm-utxo.
|
|
25
|
-
*
|
|
26
|
-
* @param bytes - Raw transaction bytes
|
|
27
|
-
* @returns A Transaction that can be inspected (`.parse()`) and signed (`.addSignature()`)
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* import { parseTransaction } from '@bitgo/wasm-solana';
|
|
32
|
-
*
|
|
33
|
-
* const tx = parseTransaction(txBytes);
|
|
34
|
-
*
|
|
35
|
-
* // Inspect
|
|
36
|
-
* const parsed = tx.parse();
|
|
37
|
-
* console.log(parsed.feePayer);
|
|
38
|
-
* for (const instr of parsed.instructionsData) {
|
|
39
|
-
* if (instr.type === 'Transfer') {
|
|
40
|
-
* console.log(`${instr.amount} lamports to ${instr.toAddress}`);
|
|
41
|
-
* }
|
|
42
|
-
* }
|
|
43
|
-
*
|
|
44
|
-
* // Sign
|
|
45
|
-
* tx.addSignature(pubkey, signature);
|
|
46
|
-
* const signedBytes = tx.toBytes();
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare function parseTransaction(bytes: Uint8Array): _Transaction;
|
|
50
14
|
export type { BaseIntent, PaymentIntent, StakeIntent, UnstakeIntent, ClaimIntent, DeactivateIntent, DelegateIntent, EnableTokenIntent, CloseAtaIntent, ConsolidateIntent, AuthorizeIntent, CustomTxIntent, CustomTxInstruction, CustomTxKey, SolanaIntent, StakePoolConfig, BuildFromIntentParams, BuildFromIntentResult, GeneratedKeypair, NonceSource, BlockhashNonce, DurableNonce, } from "./intentBuilder.js";
|
|
51
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";
|
|
52
16
|
export type { AccountMeta, Instruction } from "./transaction.js";
|
|
53
17
|
export type { 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";
|
|
54
|
-
export type { ExplainedTransaction, ExplainedOutput, ExplainedInput, ExplainOptions, TokenEnablement, StakingAuthorizeInfo, } from "./explain.js";
|
|
55
18
|
export type { AddressLookupTable as BuilderAddressLookupTable, RawVersionedTransactionData, VersionedInstruction as BuilderVersionedInstruction, MessageHeader, } from "./builder.js";
|
package/dist/cjs/js/index.js
CHANGED
|
@@ -33,8 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.findWithdrawAuthorityProgramAddress = exports.getAssociatedTokenAddress = exports.sysvarRecentBlockhashes = exports.nonceAccountSpace = exports.stakeAccountSpace = exports.stakePoolProgramId = exports.ataProgramId = exports.token2022ProgramId = exports.tokenProgramId = exports.memoProgramId = exports.computeBudgetProgramId = exports.stakeProgramId = exports.systemProgramId = exports.
|
|
37
|
-
exports.parseTransaction = parseTransaction;
|
|
36
|
+
exports.findWithdrawAuthorityProgramAddress = exports.getAssociatedTokenAddress = exports.sysvarRecentBlockhashes = exports.nonceAccountSpace = exports.stakeAccountSpace = exports.stakePoolProgramId = exports.ataProgramId = exports.token2022ProgramId = exports.tokenProgramId = exports.memoProgramId = exports.computeBudgetProgramId = exports.stakeProgramId = exports.systemProgramId = exports.buildTransactionFromIntent = exports.buildFromIntent = exports.buildFromVersionedData = exports.parseTransaction = exports.isVersionedTransaction = exports.VersionedTransaction = exports.Transaction = exports.Pubkey = exports.Keypair = exports.builder = exports.parser = exports.transaction = exports.pubkey = exports.keypair = void 0;
|
|
38
37
|
const wasm = __importStar(require("./wasm/wasm_solana.js"));
|
|
39
38
|
// Force webpack to include the WASM module
|
|
40
39
|
void wasm;
|
|
@@ -44,7 +43,6 @@ exports.pubkey = __importStar(require("./pubkey.js"));
|
|
|
44
43
|
exports.transaction = __importStar(require("./transaction.js"));
|
|
45
44
|
exports.parser = __importStar(require("./parser.js"));
|
|
46
45
|
exports.builder = __importStar(require("./builder.js"));
|
|
47
|
-
exports.explain = __importStar(require("./explain.js"));
|
|
48
46
|
// Top-level class exports for convenience
|
|
49
47
|
var keypair_js_1 = require("./keypair.js");
|
|
50
48
|
Object.defineProperty(exports, "Keypair", { enumerable: true, get: function () { return keypair_js_1.Keypair; } });
|
|
@@ -58,52 +56,12 @@ Object.defineProperty(exports, "VersionedTransaction", { enumerable: true, get:
|
|
|
58
56
|
Object.defineProperty(exports, "isVersionedTransaction", { enumerable: true, get: function () { return versioned_js_1.isVersionedTransaction; } });
|
|
59
57
|
// Top-level function exports
|
|
60
58
|
var parser_js_1 = require("./parser.js");
|
|
61
|
-
Object.defineProperty(exports, "
|
|
59
|
+
Object.defineProperty(exports, "parseTransaction", { enumerable: true, get: function () { return parser_js_1.parseTransaction; } });
|
|
62
60
|
var builder_js_1 = require("./builder.js");
|
|
63
61
|
Object.defineProperty(exports, "buildFromVersionedData", { enumerable: true, get: function () { return builder_js_1.buildFromVersionedData; } });
|
|
64
62
|
var intentBuilder_js_1 = require("./intentBuilder.js");
|
|
65
63
|
Object.defineProperty(exports, "buildFromIntent", { enumerable: true, get: function () { return intentBuilder_js_1.buildFromIntent; } });
|
|
66
64
|
Object.defineProperty(exports, "buildTransactionFromIntent", { enumerable: true, get: function () { return intentBuilder_js_1.buildFromIntent; } });
|
|
67
|
-
var explain_js_1 = require("./explain.js");
|
|
68
|
-
Object.defineProperty(exports, "explainTransaction", { enumerable: true, get: function () { return explain_js_1.explainTransaction; } });
|
|
69
|
-
Object.defineProperty(exports, "TransactionType", { enumerable: true, get: function () { return explain_js_1.TransactionType; } });
|
|
70
|
-
// Re-export Transaction import for parseTransaction
|
|
71
|
-
const transaction_js_2 = require("./transaction.js");
|
|
72
|
-
/**
|
|
73
|
-
* Parse a Solana transaction from raw bytes.
|
|
74
|
-
*
|
|
75
|
-
* Returns a `Transaction` instance that can be both inspected and signed.
|
|
76
|
-
* Use `.parse()` on the returned Transaction to get decoded instruction data.
|
|
77
|
-
*
|
|
78
|
-
* This is the single entry point for working with transactions — like
|
|
79
|
-
* `BitGoPsbt.fromBytes()` in wasm-utxo.
|
|
80
|
-
*
|
|
81
|
-
* @param bytes - Raw transaction bytes
|
|
82
|
-
* @returns A Transaction that can be inspected (`.parse()`) and signed (`.addSignature()`)
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```typescript
|
|
86
|
-
* import { parseTransaction } from '@bitgo/wasm-solana';
|
|
87
|
-
*
|
|
88
|
-
* const tx = parseTransaction(txBytes);
|
|
89
|
-
*
|
|
90
|
-
* // Inspect
|
|
91
|
-
* const parsed = tx.parse();
|
|
92
|
-
* console.log(parsed.feePayer);
|
|
93
|
-
* for (const instr of parsed.instructionsData) {
|
|
94
|
-
* if (instr.type === 'Transfer') {
|
|
95
|
-
* console.log(`${instr.amount} lamports to ${instr.toAddress}`);
|
|
96
|
-
* }
|
|
97
|
-
* }
|
|
98
|
-
*
|
|
99
|
-
* // Sign
|
|
100
|
-
* tx.addSignature(pubkey, signature);
|
|
101
|
-
* const signedBytes = tx.toBytes();
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
function parseTransaction(bytes) {
|
|
105
|
-
return transaction_js_2.Transaction.fromBytes(bytes);
|
|
106
|
-
}
|
|
107
65
|
// Program ID constants (from WASM)
|
|
108
66
|
var wasm_solana_js_1 = require("./wasm/wasm_solana.js");
|
|
109
67
|
Object.defineProperty(exports, "systemProgramId", { enumerable: true, get: function () { return wasm_solana_js_1.system_program_id; } });
|
package/dist/cjs/js/parser.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* High-level transaction parsing.
|
|
3
3
|
*
|
|
4
|
-
* Provides types and functions for parsing Solana transactions into
|
|
5
|
-
* matching BitGoJS's TxData format.
|
|
4
|
+
* Provides types and functions for parsing Solana transactions into
|
|
5
|
+
* semantic data matching BitGoJS's TxData format.
|
|
6
6
|
*
|
|
7
7
|
* All monetary amounts (amount, fee, lamports, poolTokens) are returned as bigint.
|
|
8
8
|
*/
|
|
9
|
+
import type { Transaction } from "./transaction.js";
|
|
9
10
|
/** SOL transfer parameters */
|
|
10
11
|
export interface TransferParams {
|
|
11
12
|
type: "Transfer";
|
|
@@ -207,13 +208,22 @@ export interface ParsedTransaction {
|
|
|
207
208
|
signatures: string[];
|
|
208
209
|
}
|
|
209
210
|
/**
|
|
210
|
-
* Parse
|
|
211
|
+
* Parse a Transaction into a plain data object with decoded instructions.
|
|
211
212
|
*
|
|
212
|
-
* This is the
|
|
213
|
-
*
|
|
214
|
-
*
|
|
213
|
+
* This is the main parsing function that returns structured data with all
|
|
214
|
+
* instructions decoded into semantic types (Transfer, StakingActivate, etc.)
|
|
215
|
+
* with amounts as bigint.
|
|
215
216
|
*
|
|
216
|
-
*
|
|
217
|
+
* Accepts a `Transaction` object (from `Transaction.fromBytes()`), avoiding
|
|
218
|
+
* double deserialization.
|
|
219
|
+
*
|
|
220
|
+
* @param tx - A Transaction instance (from Transaction.fromBytes())
|
|
217
221
|
* @returns A ParsedTransaction with all instructions decoded
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```typescript
|
|
225
|
+
* const tx = Transaction.fromBytes(txBytes);
|
|
226
|
+
* const parsed = parseTransaction(tx);
|
|
227
|
+
* ```
|
|
218
228
|
*/
|
|
219
|
-
export declare function
|
|
229
|
+
export declare function parseTransaction(tx: Transaction): ParsedTransaction;
|
package/dist/cjs/js/parser.js
CHANGED
|
@@ -2,27 +2,36 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* High-level transaction parsing.
|
|
4
4
|
*
|
|
5
|
-
* Provides types and functions for parsing Solana transactions into
|
|
6
|
-
* matching BitGoJS's TxData format.
|
|
5
|
+
* Provides types and functions for parsing Solana transactions into
|
|
6
|
+
* semantic data matching BitGoJS's TxData format.
|
|
7
7
|
*
|
|
8
8
|
* All monetary amounts (amount, fee, lamports, poolTokens) are returned as bigint.
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.
|
|
11
|
+
exports.parseTransaction = parseTransaction;
|
|
12
12
|
const wasm_solana_js_1 = require("./wasm/wasm_solana.js");
|
|
13
13
|
// =============================================================================
|
|
14
|
-
//
|
|
14
|
+
// parseTransaction function
|
|
15
15
|
// =============================================================================
|
|
16
16
|
/**
|
|
17
|
-
* Parse
|
|
17
|
+
* Parse a Transaction into a plain data object with decoded instructions.
|
|
18
18
|
*
|
|
19
|
-
* This is the
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* This is the main parsing function that returns structured data with all
|
|
20
|
+
* instructions decoded into semantic types (Transfer, StakingActivate, etc.)
|
|
21
|
+
* with amounts as bigint.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
23
|
+
* Accepts a `Transaction` object (from `Transaction.fromBytes()`), avoiding
|
|
24
|
+
* double deserialization.
|
|
25
|
+
*
|
|
26
|
+
* @param tx - A Transaction instance (from Transaction.fromBytes())
|
|
24
27
|
* @returns A ParsedTransaction with all instructions decoded
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const tx = Transaction.fromBytes(txBytes);
|
|
32
|
+
* const parsed = parseTransaction(tx);
|
|
33
|
+
* ```
|
|
25
34
|
*/
|
|
26
|
-
function
|
|
27
|
-
return wasm_solana_js_1.ParserNamespace.
|
|
35
|
+
function parseTransaction(tx) {
|
|
36
|
+
return wasm_solana_js_1.ParserNamespace.parse_from_transaction(tx.wasm);
|
|
28
37
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { WasmTransaction } from "./wasm/wasm_solana.js";
|
|
2
2
|
import { Keypair } from "./keypair.js";
|
|
3
3
|
import { Pubkey } from "./pubkey.js";
|
|
4
|
-
import type { ParsedTransaction } from "./parser.js";
|
|
5
4
|
/**
|
|
6
5
|
* Account metadata for an instruction
|
|
7
6
|
*/
|
|
@@ -25,20 +24,19 @@ export interface Instruction {
|
|
|
25
24
|
data: Uint8Array;
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
28
|
-
* Solana Transaction —
|
|
27
|
+
* Solana Transaction — deserialization wrapper for signing and serialization.
|
|
29
28
|
*
|
|
30
|
-
* Use `
|
|
31
|
-
*
|
|
32
|
-
* (`.addSignature()`, `.signablePayload()`, `.toBytes()`).
|
|
29
|
+
* Use `Transaction.fromBytes(bytes)` to create an instance for signing.
|
|
30
|
+
* Use `parseTransaction(tx)` from parser.ts to get decoded instruction data.
|
|
33
31
|
*
|
|
34
32
|
* @example
|
|
35
33
|
* ```typescript
|
|
36
|
-
* import { parseTransaction } from '@bitgo/wasm-solana';
|
|
34
|
+
* import { Transaction, parseTransaction } from '@bitgo/wasm-solana';
|
|
37
35
|
*
|
|
38
|
-
* const tx =
|
|
36
|
+
* const tx = Transaction.fromBytes(txBytes);
|
|
39
37
|
*
|
|
40
|
-
* //
|
|
41
|
-
* const parsed = tx
|
|
38
|
+
* // Parse for decoded instructions
|
|
39
|
+
* const parsed = parseTransaction(tx);
|
|
42
40
|
* for (const instr of parsed.instructionsData) {
|
|
43
41
|
* if (instr.type === 'Transfer') {
|
|
44
42
|
* console.log(`${instr.amount} lamports to ${instr.toAddress}`);
|
|
@@ -184,23 +182,6 @@ export declare class Transaction {
|
|
|
184
182
|
* @param keypair - A Keypair instance
|
|
185
183
|
*/
|
|
186
184
|
signWithKeypair(keypair: Keypair): void;
|
|
187
|
-
/**
|
|
188
|
-
* Parse the transaction into decoded instruction data.
|
|
189
|
-
*
|
|
190
|
-
* Returns structured data with all instructions decoded into semantic types
|
|
191
|
-
* (Transfer, StakeActivate, TokenTransfer, etc.) with amounts as bigint.
|
|
192
|
-
*
|
|
193
|
-
* @returns A ParsedTransaction with decoded instructions, feePayer, nonce, etc.
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* ```typescript
|
|
197
|
-
* const tx = parseTransaction(txBytes);
|
|
198
|
-
* const parsed = tx.parse();
|
|
199
|
-
* console.log(parsed.feePayer);
|
|
200
|
-
* console.log(parsed.instructionsData); // Decoded instruction types
|
|
201
|
-
* ```
|
|
202
|
-
*/
|
|
203
|
-
parse(): ParsedTransaction;
|
|
204
185
|
/**
|
|
205
186
|
* Get the underlying WASM instance (internal use only)
|
|
206
187
|
* @internal
|
|
@@ -3,22 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Transaction = void 0;
|
|
4
4
|
const wasm_solana_js_1 = require("./wasm/wasm_solana.js");
|
|
5
5
|
const pubkey_js_1 = require("./pubkey.js");
|
|
6
|
-
const parser_js_1 = require("./parser.js");
|
|
7
6
|
/**
|
|
8
|
-
* Solana Transaction —
|
|
7
|
+
* Solana Transaction — deserialization wrapper for signing and serialization.
|
|
9
8
|
*
|
|
10
|
-
* Use `
|
|
11
|
-
*
|
|
12
|
-
* (`.addSignature()`, `.signablePayload()`, `.toBytes()`).
|
|
9
|
+
* Use `Transaction.fromBytes(bytes)` to create an instance for signing.
|
|
10
|
+
* Use `parseTransaction(tx)` from parser.ts to get decoded instruction data.
|
|
13
11
|
*
|
|
14
12
|
* @example
|
|
15
13
|
* ```typescript
|
|
16
|
-
* import { parseTransaction } from '@bitgo/wasm-solana';
|
|
14
|
+
* import { Transaction, parseTransaction } from '@bitgo/wasm-solana';
|
|
17
15
|
*
|
|
18
|
-
* const tx =
|
|
16
|
+
* const tx = Transaction.fromBytes(txBytes);
|
|
19
17
|
*
|
|
20
|
-
* //
|
|
21
|
-
* const parsed = tx
|
|
18
|
+
* // Parse for decoded instructions
|
|
19
|
+
* const parsed = parseTransaction(tx);
|
|
22
20
|
* for (const instr of parsed.instructionsData) {
|
|
23
21
|
* if (instr.type === 'Transfer') {
|
|
24
22
|
* console.log(`${instr.amount} lamports to ${instr.toAddress}`);
|
|
@@ -206,25 +204,6 @@ class Transaction {
|
|
|
206
204
|
signWithKeypair(keypair) {
|
|
207
205
|
this._wasm.sign_with_keypair(keypair.wasm);
|
|
208
206
|
}
|
|
209
|
-
/**
|
|
210
|
-
* Parse the transaction into decoded instruction data.
|
|
211
|
-
*
|
|
212
|
-
* Returns structured data with all instructions decoded into semantic types
|
|
213
|
-
* (Transfer, StakeActivate, TokenTransfer, etc.) with amounts as bigint.
|
|
214
|
-
*
|
|
215
|
-
* @returns A ParsedTransaction with decoded instructions, feePayer, nonce, etc.
|
|
216
|
-
*
|
|
217
|
-
* @example
|
|
218
|
-
* ```typescript
|
|
219
|
-
* const tx = parseTransaction(txBytes);
|
|
220
|
-
* const parsed = tx.parse();
|
|
221
|
-
* console.log(parsed.feePayer);
|
|
222
|
-
* console.log(parsed.instructionsData); // Decoded instruction types
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
parse() {
|
|
226
|
-
return (0, parser_js_1.parseTransactionData)(this._wasm.to_bytes());
|
|
227
|
-
}
|
|
228
207
|
/**
|
|
229
208
|
* Get the underlying WASM instance (internal use only)
|
|
230
209
|
* @internal
|
|
@@ -411,6 +411,17 @@ export class ParserNamespace {
|
|
|
411
411
|
* @returns A ParsedTransaction object
|
|
412
412
|
*/
|
|
413
413
|
static parse_transaction(bytes: Uint8Array): any;
|
|
414
|
+
/**
|
|
415
|
+
* Parse a pre-deserialized Transaction into structured data.
|
|
416
|
+
*
|
|
417
|
+
* Same as `parse_transaction(bytes)` but accepts an already-deserialized
|
|
418
|
+
* WasmTransaction, avoiding double deserialization when the caller already
|
|
419
|
+
* has a Transaction from `fromBytes()`.
|
|
420
|
+
*
|
|
421
|
+
* @param tx - A WasmTransaction instance
|
|
422
|
+
* @returns A ParsedTransaction object
|
|
423
|
+
*/
|
|
424
|
+
static parse_from_transaction(tx: WasmTransaction): any;
|
|
414
425
|
}
|
|
415
426
|
|
|
416
427
|
export class Pedersen {
|
|
@@ -2871,6 +2871,34 @@ class ParserNamespace {
|
|
|
2871
2871
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2872
2872
|
}
|
|
2873
2873
|
}
|
|
2874
|
+
/**
|
|
2875
|
+
* Parse a pre-deserialized Transaction into structured data.
|
|
2876
|
+
*
|
|
2877
|
+
* Same as `parse_transaction(bytes)` but accepts an already-deserialized
|
|
2878
|
+
* WasmTransaction, avoiding double deserialization when the caller already
|
|
2879
|
+
* has a Transaction from `fromBytes()`.
|
|
2880
|
+
*
|
|
2881
|
+
* @param tx - A WasmTransaction instance
|
|
2882
|
+
* @returns A ParsedTransaction object
|
|
2883
|
+
* @param {WasmTransaction} tx
|
|
2884
|
+
* @returns {any}
|
|
2885
|
+
*/
|
|
2886
|
+
static parse_from_transaction(tx) {
|
|
2887
|
+
try {
|
|
2888
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2889
|
+
_assertClass(tx, WasmTransaction);
|
|
2890
|
+
wasm.parsernamespace_parse_from_transaction(retptr, tx.__wbg_ptr);
|
|
2891
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2892
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2893
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2894
|
+
if (r2) {
|
|
2895
|
+
throw takeObject(r1);
|
|
2896
|
+
}
|
|
2897
|
+
return takeObject(r0);
|
|
2898
|
+
} finally {
|
|
2899
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2874
2902
|
}
|
|
2875
2903
|
if (Symbol.dispose) ParserNamespace.prototype[Symbol.dispose] = ParserNamespace.prototype.free;
|
|
2876
2904
|
exports.ParserNamespace = ParserNamespace;
|
|
Binary file
|
|
@@ -15,11 +15,17 @@ export const sysvar_recent_blockhashes: (a: number) => void;
|
|
|
15
15
|
export const token_2022_program_id: (a: number) => void;
|
|
16
16
|
export const token_program_id: (a: number) => void;
|
|
17
17
|
export const __wbg_parsernamespace_free: (a: number, b: number) => void;
|
|
18
|
+
export const parsernamespace_parse_from_transaction: (a: number, b: number) => void;
|
|
19
|
+
export const parsernamespace_parse_transaction: (a: number, b: number, c: number) => void;
|
|
20
|
+
export const __wbg_intentnamespace_free: (a: number, b: number) => void;
|
|
21
|
+
export const intentnamespace_build_from_intent: (a: number, b: number, c: number) => void;
|
|
22
|
+
export const __wbg_buildernamespace_free: (a: number, b: number) => void;
|
|
23
|
+
export const buildernamespace_build_from_versioned_data: (a: number, b: number) => void;
|
|
18
24
|
export const __wbg_wasmkeypair_free: (a: number, b: number) => void;
|
|
25
|
+
export const __wbg_wasmpubkey_free: (a: number, b: number) => void;
|
|
19
26
|
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
20
27
|
export const __wbg_wasmversionedtransaction_free: (a: number, b: number) => void;
|
|
21
28
|
export const is_versioned_transaction: (a: number, b: number) => number;
|
|
22
|
-
export const parsernamespace_parse_transaction: (a: number, b: number, c: number) => void;
|
|
23
29
|
export const wasmkeypair_address: (a: number, b: number) => void;
|
|
24
30
|
export const wasmkeypair_from_secret_key: (a: number, b: number, c: number) => void;
|
|
25
31
|
export const wasmkeypair_from_solana_secret_key: (a: number, b: number, c: number) => void;
|
|
@@ -27,6 +33,12 @@ export const wasmkeypair_generate: () => number;
|
|
|
27
33
|
export const wasmkeypair_public_key: (a: number) => number;
|
|
28
34
|
export const wasmkeypair_secret_key: (a: number) => number;
|
|
29
35
|
export const wasmkeypair_sign: (a: number, b: number, c: number) => number;
|
|
36
|
+
export const wasmpubkey_equals: (a: number, b: number) => number;
|
|
37
|
+
export const wasmpubkey_from_base58: (a: number, b: number, c: number) => void;
|
|
38
|
+
export const wasmpubkey_from_bytes: (a: number, b: number, c: number) => void;
|
|
39
|
+
export const wasmpubkey_is_on_curve: (a: number) => number;
|
|
40
|
+
export const wasmpubkey_to_base58: (a: number, b: number) => void;
|
|
41
|
+
export const wasmpubkey_to_bytes: (a: number) => number;
|
|
30
42
|
export const wasmtransaction_account_keys: (a: number) => number;
|
|
31
43
|
export const wasmtransaction_add_signature: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
32
44
|
export const wasmtransaction_fee_payer: (a: number, b: number) => void;
|
|
@@ -56,17 +68,6 @@ export const wasmversionedtransaction_signer_index: (a: number, b: number, c: nu
|
|
|
56
68
|
export const wasmversionedtransaction_static_account_keys: (a: number) => number;
|
|
57
69
|
export const wasmversionedtransaction_to_bytes: (a: number, b: number) => void;
|
|
58
70
|
export const wasmversionedtransaction_num_signatures: (a: number) => number;
|
|
59
|
-
export const __wbg_buildernamespace_free: (a: number, b: number) => void;
|
|
60
|
-
export const __wbg_intentnamespace_free: (a: number, b: number) => void;
|
|
61
|
-
export const buildernamespace_build_from_versioned_data: (a: number, b: number) => void;
|
|
62
|
-
export const intentnamespace_build_from_intent: (a: number, b: number, c: number) => void;
|
|
63
|
-
export const __wbg_wasmpubkey_free: (a: number, b: number) => void;
|
|
64
|
-
export const wasmpubkey_equals: (a: number, b: number) => number;
|
|
65
|
-
export const wasmpubkey_from_base58: (a: number, b: number, c: number) => void;
|
|
66
|
-
export const wasmpubkey_from_bytes: (a: number, b: number, c: number) => void;
|
|
67
|
-
export const wasmpubkey_is_on_curve: (a: number) => number;
|
|
68
|
-
export const wasmpubkey_to_base58: (a: number, b: number) => void;
|
|
69
|
-
export const wasmpubkey_to_bytes: (a: number) => number;
|
|
70
71
|
export const __wbg_keypair_free: (a: number, b: number) => void;
|
|
71
72
|
export const keypair_constructor: () => number;
|
|
72
73
|
export const keypair_fromBytes: (a: number, b: number, c: number) => void;
|