saito-wasm 0.2.240 → 0.2.243

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/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "saito-wasm"
3
- version = "0.2.240"
3
+ version = "0.2.243"
4
4
  edition = "2021"
5
5
 
6
6
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.2.240",
3
+ "version": "0.2.243",
4
4
  "files": [
5
5
  "pkg/web/**/*",
6
6
  "pkg/node/**/*",
@@ -1,101 +1,89 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
+ * @param {string} json
4
5
  * @returns {string}
5
6
  */
6
- export function generate_private_key(): string;
7
+ export function get_script_address(json: string): string;
7
8
  /**
8
- * @returns {Promise<boolean>}
9
+ * @param {string} script_json
10
+ * @param {string} witness_json
11
+ * @returns {string}
9
12
  */
10
- export function produce_block_without_gt(): Promise<boolean>;
13
+ export function merge_witness(script_json: string, witness_json: string): string;
11
14
  /**
12
- * @param {bigint} peer_id
13
15
  * @param {string} public_key
14
- * @returns {Promise<void>}
15
- */
16
- export function remove_stun_peer(peer_id: bigint, public_key: string): Promise<void>;
17
- /**
18
- * @param {string | undefined} [url]
19
- * @returns {Promise<WasmNetworkPeer>}
20
- */
21
- export function create_network_peer(url?: string): Promise<WasmNetworkPeer>;
22
- /**
23
- * @returns {Promise<boolean>}
16
+ * @returns {Promise<Array<any>>}
24
17
  */
25
- export function produce_block_with_gt(): Promise<boolean>;
18
+ export function get_account_slips(public_key: string): Promise<Array<any>>;
26
19
  /**
27
- * @returns {Promise<string>}
20
+ * @param {Array<any>} keys
21
+ * @returns {Promise<WasmBalanceSnapshot>}
28
22
  */
29
- export function get_latest_block_hash(): Promise<string>;
23
+ export function get_balance_snapshot(keys: Array<any>): Promise<WasmBalanceSnapshot>;
30
24
  /**
31
- * @param {Uint8Array} buffer
32
- * @param {string} private_key
33
- * @returns {string}
25
+ * @param {bigint} threshold
26
+ * @returns {Promise<void>}
34
27
  */
35
- export function sign_buffer(buffer: Uint8Array, private_key: string): string;
28
+ export function write_issuance_file(threshold: bigint): Promise<void>;
36
29
  /**
37
- * @returns {WasmNetwork}
30
+ * @returns {Promise<void>}
38
31
  */
39
- export function get_network(): WasmNetwork;
32
+ export function disable_producing_blocks_by_timer(): Promise<void>;
40
33
  /**
41
- * @param {Uint8Array} buffer
42
- * @returns {string}
34
+ * @returns {Promise<void>}
43
35
  */
44
- export function hash(buffer: Uint8Array): string;
36
+ export function enable_producing_blocks_by_timer(): Promise<void>;
45
37
  /**
46
- * @returns {Promise<WasmBlockchain>}
38
+ * @param {(Uint8Array)[] | undefined} [extra_txs]
39
+ * @returns {Promise<boolean>}
47
40
  */
48
- export function get_blockchain(): Promise<WasmBlockchain>;
41
+ export function produce_block_with_gt(extra_txs?: (Uint8Array)[]): Promise<boolean>;
49
42
  /**
50
- * @param {bigint} duration_in_ms
51
- * @returns {Promise<void>}
43
+ * @param {(Uint8Array)[] | undefined} [extra_txs]
44
+ * @returns {Promise<boolean>}
52
45
  */
53
- export function process_timer_event(duration_in_ms: bigint): Promise<void>;
46
+ export function produce_block_without_gt(extra_txs?: (Uint8Array)[]): Promise<boolean>;
54
47
  /**
55
- * @param {Uint8Array} buffer
56
- * @param {Uint8Array} hash
57
- * @param {bigint} block_id
58
- * @param {bigint} peer_id
48
+ * @param {WasmBalanceSnapshot} snapshot
59
49
  * @returns {Promise<void>}
60
50
  */
61
- export function process_fetched_block(buffer: Uint8Array, hash: Uint8Array, block_id: bigint, peer_id: bigint): Promise<void>;
51
+ export function update_from_balance_snapshot(snapshot: WasmBalanceSnapshot): Promise<void>;
62
52
  /**
63
- * @param {string} json
64
- * @returns {Promise<number>}
53
+ * @returns {string}
65
54
  */
66
- export function evaluate_script(json: string): Promise<number>;
55
+ export function generate_private_key(): string;
67
56
  /**
68
- * @returns {Promise<void>}
57
+ * @param {string} private_key
58
+ * @returns {string}
69
59
  */
70
- export function disable_producing_blocks_by_timer(): Promise<void>;
60
+ export function generate_public_key(private_key: string): string;
71
61
  /**
72
62
  * @returns {Promise<WasmWallet>}
73
63
  */
74
64
  export function get_wallet(): Promise<WasmWallet>;
75
65
  /**
76
- * @param {string} block_hash
77
- * @returns {Promise<WasmBlock>}
66
+ * @returns {WasmNetwork}
78
67
  */
79
- export function get_block(block_hash: string): Promise<WasmBlock>;
68
+ export function get_network(): WasmNetwork;
80
69
  /**
81
- * @returns {Promise<Array<any>>}
70
+ * @returns {Promise<WasmBlockchain>}
82
71
  */
83
- export function get_mempool_txs(): Promise<Array<any>>;
72
+ export function get_blockchain(): Promise<WasmBlockchain>;
84
73
  /**
85
- * @param {WasmBalanceSnapshot} snapshot
86
- * @returns {Promise<void>}
74
+ * @returns {Promise<Array<any>>}
87
75
  */
88
- export function update_from_balance_snapshot(snapshot: WasmBalanceSnapshot): Promise<void>;
76
+ export function get_mempool_txs(): Promise<Array<any>>;
89
77
  /**
90
78
  * @param {string} key
91
79
  * @returns {boolean}
92
80
  */
93
81
  export function isPublicKey(key: string): boolean;
94
82
  /**
95
- * @param {bigint} peer_id
96
- * @returns {Promise<void>}
83
+ * @param {string | undefined} [url]
84
+ * @returns {Promise<WasmNetworkPeer>}
97
85
  */
98
- export function process_peer_disconnection(peer_id: bigint): Promise<void>;
86
+ export function create_network_peer(url?: string): Promise<WasmNetworkPeer>;
99
87
  /**
100
88
  * @param {string} config_json
101
89
  * @param {string} private_key
@@ -106,26 +94,30 @@ export function process_peer_disconnection(peer_id: bigint): Promise<void>;
106
94
  */
107
95
  export function initialize(config_json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint, delete_old_blocks: boolean): Promise<any>;
108
96
  /**
109
- * @param {bigint} current_time
97
+ * @returns {Promise<Array<any>>}
98
+ */
99
+ export function get_nft_list(): Promise<Array<any>>;
100
+ /**
101
+ * @param {bigint} duration_in_ms
110
102
  * @returns {Promise<void>}
111
103
  */
112
- export function process_stat_interval(current_time: bigint): Promise<void>;
104
+ export function process_timer_event(duration_in_ms: bigint): Promise<void>;
113
105
  /**
114
- * @param {bigint} threshold
106
+ * @param {bigint} current_time
115
107
  * @returns {Promise<void>}
116
108
  */
117
- export function write_issuance_file(threshold: bigint): Promise<void>;
109
+ export function process_stat_interval(current_time: bigint): Promise<void>;
118
110
  /**
119
- * @param {Array<any>} keys
120
- * @returns {Promise<WasmBalanceSnapshot>}
111
+ * @param {Uint8Array} buffer
112
+ * @returns {string}
121
113
  */
122
- export function get_balance_snapshot(keys: Array<any>): Promise<WasmBalanceSnapshot>;
114
+ export function hash(buffer: Uint8Array): string;
123
115
  /**
124
- * @param {bigint} peer_id
125
- * @param {boolean} initiate_handshake
126
- * @returns {Promise<void>}
116
+ * @param {Uint8Array} buffer
117
+ * @param {string} private_key
118
+ * @returns {string}
127
119
  */
128
- export function process_new_peer(peer_id: bigint, initiate_handshake: boolean): Promise<void>;
120
+ export function sign_buffer(buffer: Uint8Array, private_key: string): string;
129
121
  /**
130
122
  * @param {Uint8Array} buffer
131
123
  * @param {string} signature
@@ -134,25 +126,36 @@ export function process_new_peer(peer_id: bigint, initiate_handshake: boolean):
134
126
  */
135
127
  export function verify_signature(buffer: Uint8Array, signature: string, public_key: string): boolean;
136
128
  /**
137
- * @param {Uint8Array} buffer
138
- * @param {WasmNetworkPeer} peer
139
- * @returns {Promise<Uint8Array>}
129
+ * @param {string} json
130
+ * @returns {Promise<number>}
140
131
  */
141
- export function process_msg_buffer_from_peer(buffer: Uint8Array, peer: WasmNetworkPeer): Promise<Uint8Array>;
132
+ export function evaluate_script(json: string): Promise<number>;
142
133
  /**
143
- * @param {string} private_key
134
+ * @param {string} json
135
+ * @param {WasmTransaction} tx
136
+ * @returns {Promise<number>}
137
+ */
138
+ export function evaluate_script_with_transaction(json: string, tx: WasmTransaction): Promise<number>;
139
+ /**
140
+ * @param {string} json
144
141
  * @returns {string}
145
142
  */
146
- export function generate_public_key(private_key: string): string;
143
+ export function get_script_hash(json: string): string;
147
144
  /**
148
- * @returns {Promise<Array<any>>}
145
+ * @returns {Promise<string>}
149
146
  */
150
- export function get_nft_list(): Promise<Array<any>>;
147
+ export function get_latest_block_hash(): Promise<string>;
151
148
  /**
152
- * @param {string} public_key
153
- * @returns {Promise<Array<any>>}
149
+ * @param {string} block_hash
150
+ * @returns {Promise<WasmBlock>}
154
151
  */
155
- export function get_account_slips(public_key: string): Promise<Array<any>>;
152
+ export function get_block(block_hash: string): Promise<WasmBlock>;
153
+ /**
154
+ * @param {bigint} peer_id
155
+ * @param {boolean} initiate_handshake
156
+ * @returns {Promise<void>}
157
+ */
158
+ export function process_new_peer(peer_id: bigint, initiate_handshake: boolean): Promise<void>;
156
159
  /**
157
160
  * @param {bigint} peer_id
158
161
  * @param {string} public_key
@@ -160,6 +163,31 @@ export function get_account_slips(public_key: string): Promise<Array<any>>;
160
163
  */
161
164
  export function process_stun_peer(peer_id: bigint, public_key: string): Promise<void>;
162
165
  /**
166
+ * @param {bigint} peer_id
167
+ * @param {string} public_key
168
+ * @returns {Promise<void>}
169
+ */
170
+ export function remove_stun_peer(peer_id: bigint, public_key: string): Promise<void>;
171
+ /**
172
+ * @param {bigint} peer_id
173
+ * @returns {Promise<void>}
174
+ */
175
+ export function process_peer_disconnection(peer_id: bigint): Promise<void>;
176
+ /**
177
+ * @param {Uint8Array} buffer
178
+ * @param {WasmNetworkPeer} peer
179
+ * @returns {Promise<Uint8Array>}
180
+ */
181
+ export function process_msg_buffer_from_peer(buffer: Uint8Array, peer: WasmNetworkPeer): Promise<Uint8Array>;
182
+ /**
183
+ * @param {Uint8Array} buffer
184
+ * @param {Uint8Array} hash
185
+ * @param {bigint} block_id
186
+ * @param {bigint} peer_id
187
+ * @returns {Promise<void>}
188
+ */
189
+ export function process_fetched_block(buffer: Uint8Array, hash: Uint8Array, block_id: bigint, peer_id: bigint): Promise<void>;
190
+ /**
163
191
  * @param {Uint8Array} hash
164
192
  * @param {bigint} block_id
165
193
  * @param {bigint} peer_id
@@ -366,6 +394,12 @@ export class WasmBlock {
366
394
  export class WasmBlockchain {
367
395
  free(): void;
368
396
  /**
397
+ * @param {number} count
398
+ * @param {boolean} include_offchain
399
+ * @returns {Promise<Array<any>>}
400
+ */
401
+ get_blocks(count: number, include_offchain: boolean): Promise<Array<any>>;
402
+ /**
369
403
  * @returns {Promise<string>}
370
404
  */
371
405
  get_fork_id(): Promise<string>;
@@ -376,6 +410,12 @@ export class WasmBlockchain {
376
410
  set_fork_id(hash: string): Promise<void>;
377
411
  /**
378
412
  * @param {bigint} block_id
413
+ * @param {boolean} include_transactions
414
+ * @returns {Promise<WasmBlock>}
415
+ */
416
+ get_block_by_id(block_id: bigint, include_transactions: boolean): Promise<WasmBlock>;
417
+ /**
418
+ * @param {bigint} block_id
379
419
  * @returns {Promise<Array<any>>}
380
420
  */
381
421
  get_hashes_at_id(block_id: bigint): Promise<Array<any>>;
@@ -455,13 +495,19 @@ export class WasmBlockchain {
455
495
  */
456
496
  get_lowest_acceptable_block_hash(): Promise<string>;
457
497
  /**
458
- * @returns {any}
459
- */
460
- get(): any;
461
- /**
462
498
  * @returns {Promise<void>}
463
499
  */
464
500
  reset(): Promise<void>;
501
+ /**
502
+ * @param {string} block_hash
503
+ * @param {boolean} include_transactions
504
+ * @returns {Promise<WasmBlock>}
505
+ */
506
+ get_block(block_hash: string, include_transactions: boolean): Promise<WasmBlock>;
507
+ /**
508
+ * @returns {any}
509
+ */
510
+ get(): any;
465
511
  }
466
512
  /**
467
513
  */
@@ -577,9 +623,6 @@ export class WasmNetwork {
577
623
  */
578
624
  propagateTransaction(wtx: WasmTransaction): Promise<void>;
579
625
  /**
580
- */
581
- constructor();
582
- /**
583
626
  * @param {string} key
584
627
  * @returns {Promise<WasmPeer | undefined>}
585
628
  */
@@ -589,6 +632,9 @@ export class WasmNetwork {
589
632
  */
590
633
  getPeers(): Promise<Array<any>>;
591
634
  /**
635
+ */
636
+ constructor();
637
+ /**
592
638
  */
593
639
  readonly api: WasmNetworkApi;
594
640
  /**
@@ -630,14 +676,14 @@ export class WasmNetworkPeer {
630
676
  */
631
677
  get_public_key(): Promise<string>;
632
678
  /**
633
- * @returns {bigint}
634
- */
635
- get_id(): bigint;
636
- /**
637
679
  * @returns {Promise<string>}
638
680
  */
639
681
  get_url(): Promise<string>;
640
682
  /**
683
+ * @returns {bigint}
684
+ */
685
+ get_id(): bigint;
686
+ /**
641
687
  * @param {bigint} peer_id
642
688
  */
643
689
  constructor(peer_id: bigint);
@@ -652,12 +698,21 @@ export class WasmPeer {
652
698
  */
653
699
  has_service(service: string): boolean;
654
700
  /**
701
+ */
702
+ readonly host: string;
703
+ /**
655
704
  */
656
705
  readonly id: bigint;
657
706
  /**
658
707
  */
659
708
  readonly key_list: Array<any>;
660
709
  /**
710
+ */
711
+ readonly port: number;
712
+ /**
713
+ */
714
+ readonly protocol: string;
715
+ /**
661
716
  */
662
717
  readonly public_key: string;
663
718
  /**
@@ -748,6 +803,10 @@ export class WasmSlip {
748
803
  export class WasmTransaction {
749
804
  free(): void;
750
805
  /**
806
+ * @returns {Promise<void>}
807
+ */
808
+ sign(): Promise<void>;
809
+ /**
751
810
  * @param {WasmSlip} slip
752
811
  */
753
812
  add_to_slip(slip: WasmSlip): void;
@@ -771,10 +830,6 @@ export class WasmTransaction {
771
830
  */
772
831
  constructor();
773
832
  /**
774
- * @returns {Promise<void>}
775
- */
776
- sign(): Promise<void>;
777
- /**
778
833
  * @param {string} key
779
834
  * @returns {boolean}
780
835
  */
@@ -950,10 +1005,6 @@ export class WasmWallet {
950
1005
  */
951
1006
  createAtomizeBoundTransaction(slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
952
1007
  /**
953
- * @returns {any}
954
- */
955
- get(): any;
956
- /**
957
1008
  * @param {Array<any>} public_keys
958
1009
  * @param {BigUint64Array} amounts
959
1010
  * @param {bigint} fee
@@ -993,6 +1044,10 @@ export class WasmWallet {
993
1044
  * @returns {Promise<Array<any>>}
994
1045
  */
995
1046
  get_slips(): Promise<Array<any>>;
1047
+ /**
1048
+ * @returns {any}
1049
+ */
1050
+ get(): any;
996
1051
  }
997
1052
  /**
998
1053
  */