saito-wasm 0.2.239 → 0.2.242

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.239"
3
+ version = "0.2.242"
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.239",
3
+ "version": "0.2.242",
4
4
  "files": [
5
5
  "pkg/web/**/*",
6
6
  "pkg/node/**/*",
@@ -1,157 +1,178 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {Uint8Array} buffer
5
- * @param {string} private_key
4
+ * @param {string} json
6
5
  * @returns {string}
7
6
  */
8
- export function sign_buffer(buffer: Uint8Array, private_key: string): string;
7
+ export function get_script_address(json: string): string;
8
+ /**
9
+ * @param {string} script_json
10
+ * @param {string} witness_json
11
+ * @returns {string}
12
+ */
13
+ export function merge_witness(script_json: string, witness_json: string): string;
14
+ /**
15
+ * @param {string} public_key
16
+ * @returns {Promise<Array<any>>}
17
+ */
18
+ export function get_account_slips(public_key: string): Promise<Array<any>>;
19
+ /**
20
+ * @param {Array<any>} keys
21
+ * @returns {Promise<WasmBalanceSnapshot>}
22
+ */
23
+ export function get_balance_snapshot(keys: Array<any>): Promise<WasmBalanceSnapshot>;
9
24
  /**
10
25
  * @param {bigint} threshold
11
26
  * @returns {Promise<void>}
12
27
  */
13
28
  export function write_issuance_file(threshold: bigint): Promise<void>;
14
29
  /**
15
- * @param {bigint} peer_id
16
- * @param {string} public_key
17
30
  * @returns {Promise<void>}
18
31
  */
19
- export function process_stun_peer(peer_id: bigint, public_key: string): Promise<void>;
32
+ export function disable_producing_blocks_by_timer(): Promise<void>;
20
33
  /**
34
+ * @returns {Promise<void>}
35
+ */
36
+ export function enable_producing_blocks_by_timer(): Promise<void>;
37
+ /**
38
+ * @param {(Uint8Array)[] | undefined} [extra_txs]
39
+ * @returns {Promise<boolean>}
40
+ */
41
+ export function produce_block_with_gt(extra_txs?: (Uint8Array)[]): Promise<boolean>;
42
+ /**
43
+ * @param {(Uint8Array)[] | undefined} [extra_txs]
21
44
  * @returns {Promise<boolean>}
22
45
  */
23
- export function produce_block_without_gt(): Promise<boolean>;
46
+ export function produce_block_without_gt(extra_txs?: (Uint8Array)[]): Promise<boolean>;
24
47
  /**
25
48
  * @param {WasmBalanceSnapshot} snapshot
26
49
  * @returns {Promise<void>}
27
50
  */
28
51
  export function update_from_balance_snapshot(snapshot: WasmBalanceSnapshot): Promise<void>;
29
52
  /**
30
- * @returns {Promise<void>}
53
+ * @returns {string}
31
54
  */
32
- export function disable_producing_blocks_by_timer(): Promise<void>;
55
+ export function generate_private_key(): string;
33
56
  /**
34
- * @param {Uint8Array} hash
35
- * @param {bigint} block_id
36
- * @param {bigint} peer_id
37
- * @returns {Promise<void>}
57
+ * @param {string} private_key
58
+ * @returns {string}
38
59
  */
39
- export function process_failed_block_fetch(hash: Uint8Array, block_id: bigint, peer_id: bigint): Promise<void>;
60
+ export function generate_public_key(private_key: string): string;
40
61
  /**
41
- * @param {string} block_hash
42
- * @returns {Promise<WasmBlock>}
62
+ * @returns {Promise<WasmWallet>}
43
63
  */
44
- export function get_block(block_hash: string): Promise<WasmBlock>;
64
+ export function get_wallet(): Promise<WasmWallet>;
45
65
  /**
46
- * @param {string} key
47
- * @returns {boolean}
66
+ * @returns {WasmNetwork}
48
67
  */
49
- export function isPublicKey(key: string): boolean;
68
+ export function get_network(): WasmNetwork;
50
69
  /**
51
- * @param {Uint8Array} buffer
52
- * @returns {string}
70
+ * @returns {Promise<WasmBlockchain>}
53
71
  */
54
- export function hash(buffer: Uint8Array): string;
72
+ export function get_blockchain(): Promise<WasmBlockchain>;
55
73
  /**
56
- * @param {Array<any>} keys
57
- * @returns {Promise<WasmBalanceSnapshot>}
74
+ * @returns {Promise<Array<any>>}
58
75
  */
59
- export function get_balance_snapshot(keys: Array<any>): Promise<WasmBalanceSnapshot>;
76
+ export function get_mempool_txs(): Promise<Array<any>>;
60
77
  /**
61
- * @param {Uint8Array} buffer
62
- * @param {string} signature
63
- * @param {string} public_key
78
+ * @param {string} key
64
79
  * @returns {boolean}
65
80
  */
66
- export function verify_signature(buffer: Uint8Array, signature: string, public_key: string): boolean;
81
+ export function isPublicKey(key: string): boolean;
67
82
  /**
68
- * @returns {Promise<string>}
83
+ * @param {string | undefined} [url]
84
+ * @returns {Promise<WasmNetworkPeer>}
69
85
  */
70
- export function get_latest_block_hash(): Promise<string>;
86
+ export function create_network_peer(url?: string): Promise<WasmNetworkPeer>;
71
87
  /**
72
- * @returns {Promise<boolean>}
88
+ * @param {string} config_json
89
+ * @param {string} private_key
90
+ * @param {number} log_level_num
91
+ * @param {bigint} hasten_multiplier
92
+ * @param {boolean} delete_old_blocks
93
+ * @returns {Promise<any>}
73
94
  */
74
- export function produce_block_with_gt(): Promise<boolean>;
95
+ export function initialize(config_json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint, delete_old_blocks: boolean): Promise<any>;
75
96
  /**
76
- * @param {bigint} peer_id
77
- * @returns {Promise<void>}
97
+ * @returns {Promise<Array<any>>}
78
98
  */
79
- export function process_peer_disconnection(peer_id: bigint): Promise<void>;
99
+ export function get_nft_list(): Promise<Array<any>>;
80
100
  /**
81
- * @returns {Promise<WasmBlockchain>}
101
+ * @param {bigint} duration_in_ms
102
+ * @returns {Promise<void>}
82
103
  */
83
- export function get_blockchain(): Promise<WasmBlockchain>;
104
+ export function process_timer_event(duration_in_ms: bigint): Promise<void>;
84
105
  /**
85
- * @param {bigint} peer_id
86
- * @param {string} public_key
106
+ * @param {bigint} current_time
87
107
  * @returns {Promise<void>}
88
108
  */
89
- export function remove_stun_peer(peer_id: bigint, public_key: string): Promise<void>;
109
+ export function process_stat_interval(current_time: bigint): Promise<void>;
90
110
  /**
91
- * @param {bigint} peer_id
92
- * @param {boolean} initiate_handshake
93
- * @returns {Promise<void>}
111
+ * @param {Uint8Array} buffer
112
+ * @returns {string}
94
113
  */
95
- export function process_new_peer(peer_id: bigint, initiate_handshake: boolean): Promise<void>;
114
+ export function hash(buffer: Uint8Array): string;
96
115
  /**
116
+ * @param {Uint8Array} buffer
97
117
  * @param {string} private_key
98
118
  * @returns {string}
99
119
  */
100
- export function generate_public_key(private_key: string): string;
120
+ export function sign_buffer(buffer: Uint8Array, private_key: string): string;
101
121
  /**
102
- * @param {string | undefined} [url]
103
- * @returns {Promise<WasmNetworkPeer>}
122
+ * @param {Uint8Array} buffer
123
+ * @param {string} signature
124
+ * @param {string} public_key
125
+ * @returns {boolean}
104
126
  */
105
- export function create_network_peer(url?: string): Promise<WasmNetworkPeer>;
127
+ export function verify_signature(buffer: Uint8Array, signature: string, public_key: string): boolean;
106
128
  /**
107
- * @returns {WasmNetwork}
129
+ * @param {string} json
130
+ * @returns {Promise<number>}
108
131
  */
109
- export function get_network(): WasmNetwork;
132
+ export function evaluate_script(json: string): Promise<number>;
110
133
  /**
111
- * @param {Uint8Array} buffer
112
- * @param {Uint8Array} hash
113
- * @param {bigint} block_id
114
- * @param {bigint} peer_id
115
- * @returns {Promise<void>}
134
+ * @param {string} json
135
+ * @param {WasmTransaction} tx
136
+ * @returns {Promise<number>}
116
137
  */
117
- export function process_fetched_block(buffer: Uint8Array, hash: Uint8Array, block_id: bigint, peer_id: bigint): Promise<void>;
138
+ export function evaluate_script_with_transaction(json: string, tx: WasmTransaction): Promise<number>;
118
139
  /**
119
140
  * @param {string} json
120
- * @returns {Promise<number>}
141
+ * @returns {string}
121
142
  */
122
- export function evaluate_script(json: string): Promise<number>;
143
+ export function get_script_hash(json: string): string;
123
144
  /**
124
- * @param {bigint} current_time
125
- * @returns {Promise<void>}
145
+ * @returns {Promise<string>}
126
146
  */
127
- export function process_stat_interval(current_time: bigint): Promise<void>;
147
+ export function get_latest_block_hash(): Promise<string>;
128
148
  /**
129
- * @param {string} public_key
130
- * @returns {Promise<Array<any>>}
149
+ * @param {string} block_hash
150
+ * @returns {Promise<WasmBlock>}
131
151
  */
132
- export function get_account_slips(public_key: string): Promise<Array<any>>;
152
+ export function get_block(block_hash: string): Promise<WasmBlock>;
133
153
  /**
134
- * @param {string} config_json
135
- * @param {string} private_key
136
- * @param {number} log_level_num
137
- * @param {bigint} hasten_multiplier
138
- * @param {boolean} delete_old_blocks
139
- * @returns {Promise<any>}
154
+ * @param {bigint} peer_id
155
+ * @param {boolean} initiate_handshake
156
+ * @returns {Promise<void>}
140
157
  */
141
- export function initialize(config_json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint, delete_old_blocks: boolean): Promise<any>;
158
+ export function process_new_peer(peer_id: bigint, initiate_handshake: boolean): Promise<void>;
142
159
  /**
143
- * @returns {Promise<Array<any>>}
160
+ * @param {bigint} peer_id
161
+ * @param {string} public_key
162
+ * @returns {Promise<void>}
144
163
  */
145
- export function get_mempool_txs(): Promise<Array<any>>;
164
+ export function process_stun_peer(peer_id: bigint, public_key: string): Promise<void>;
146
165
  /**
147
- * @param {bigint} duration_in_ms
166
+ * @param {bigint} peer_id
167
+ * @param {string} public_key
148
168
  * @returns {Promise<void>}
149
169
  */
150
- export function process_timer_event(duration_in_ms: bigint): Promise<void>;
170
+ export function remove_stun_peer(peer_id: bigint, public_key: string): Promise<void>;
151
171
  /**
152
- * @returns {string}
172
+ * @param {bigint} peer_id
173
+ * @returns {Promise<void>}
153
174
  */
154
- export function generate_private_key(): string;
175
+ export function process_peer_disconnection(peer_id: bigint): Promise<void>;
155
176
  /**
156
177
  * @param {Uint8Array} buffer
157
178
  * @param {WasmNetworkPeer} peer
@@ -159,13 +180,20 @@ export function generate_private_key(): string;
159
180
  */
160
181
  export function process_msg_buffer_from_peer(buffer: Uint8Array, peer: WasmNetworkPeer): Promise<Uint8Array>;
161
182
  /**
162
- * @returns {Promise<WasmWallet>}
183
+ * @param {Uint8Array} buffer
184
+ * @param {Uint8Array} hash
185
+ * @param {bigint} block_id
186
+ * @param {bigint} peer_id
187
+ * @returns {Promise<void>}
163
188
  */
164
- export function get_wallet(): Promise<WasmWallet>;
189
+ export function process_fetched_block(buffer: Uint8Array, hash: Uint8Array, block_id: bigint, peer_id: bigint): Promise<void>;
165
190
  /**
166
- * @returns {Promise<Array<any>>}
191
+ * @param {Uint8Array} hash
192
+ * @param {bigint} block_id
193
+ * @param {bigint} peer_id
194
+ * @returns {Promise<void>}
167
195
  */
168
- export function get_nft_list(): Promise<Array<any>>;
196
+ export function process_failed_block_fetch(hash: Uint8Array, block_id: bigint, peer_id: bigint): Promise<void>;
169
197
  /**
170
198
  */
171
199
  export class SaitoWasm {
@@ -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
  */