kaspa_consensus_client/serializable/
mod.rs1#![allow(non_snake_case)]
21
22pub mod numeric;
23pub mod string;
24
25use wasm_bindgen::prelude::*;
26#[wasm_bindgen(typescript_custom_section)]
27const TS_TYPES: &'static str = r#"
28
29/**
30 * Interface defines the structure of a serializable UTXO entry.
31 *
32 * @see {@link ISerializableTransactionInput}, {@link ISerializableTransaction}
33 * @category Wallet SDK
34 */
35export interface ISerializableUtxoEntry {
36 address?: Address;
37 amount: bigint;
38 scriptPublicKey: ScriptPublicKey;
39 blockDaaScore: bigint;
40 isCoinbase: boolean;
41}
42
43/**
44 * Interface defines the structure of a serializable transaction input.
45 *
46 * @see {@link ISerializableTransaction}
47 * @category Wallet SDK
48 */
49export interface ISerializableTransactionInput {
50 transactionId : HexString;
51 index: number;
52 sequence: bigint;
53 sigOpCount: number;
54 signatureScript?: HexString;
55 utxo: ISerializableUtxoEntry;
56}
57
58/**
59 * Interface defines the structure of a serializable transaction output.
60 *
61 * @see {@link ISerializableTransaction}
62 * @category Wallet SDK
63 */
64export interface ISerializableTransactionOutput {
65 value: bigint;
66 scriptPublicKey: IScriptPublicKey;
67}
68
69/**
70 * Interface defines the structure of a serializable transaction.
71 *
72 * Serializable transactions can be produced using
73 * {@link Transaction.serializeToJSON},
74 * {@link Transaction.serializeToSafeJSON} and
75 * {@link Transaction.serializeToObject}
76 * functions for processing (signing) in external systems.
77 *
78 * Once the transaction is signed, it can be deserialized
79 * into {@link Transaction} using {@link Transaction.deserializeFromJSON}
80 * and {@link Transaction.deserializeFromSafeJSON} functions.
81 *
82 * @see {@link Transaction},
83 * {@link ISerializableTransactionInput},
84 * {@link ISerializableTransactionOutput},
85 * {@link ISerializableUtxoEntry}
86 *
87 * @category Wallet SDK
88 */
89export interface ISerializableTransaction {
90 id? : HexString;
91 version: number;
92 inputs: ISerializableTransactionInput[];
93 outputs: ISerializableTransactionOutput[];
94 lockTime: bigint;
95 subnetworkId: HexString;
96 gas: bigint;
97 payload: HexString;
98}
99
100"#;
101
102#[wasm_bindgen]
103extern "C" {
104 #[wasm_bindgen(extends = js_sys::Array, typescript_type = "ISerializableTransaction")]
106 pub type SerializableTransactionT;
107}