saito-wasm 0.2.166 → 0.2.168

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.166"
3
+ version = "0.2.168"
4
4
  edition = "2021"
5
5
 
6
6
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -30,6 +30,7 @@ serde_json = { version = "=1.0.120" }
30
30
  num-derive = { version = "=0.4.2" }
31
31
  num-traits = { version = "=0.2.19" }
32
32
  console_error_panic_hook = "=0.1.7"
33
+ rayon = "=1.10.0"
33
34
 
34
35
  [package.metadata.wasm-pack.profile.release]
35
36
  wasm-opt = ['-Oz']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saito-wasm",
3
- "version": "0.2.166",
3
+ "version": "0.2.168",
4
4
  "description": "js wrappings around saito-core using wasm",
5
5
  "scripts": {
6
6
  "test": "./node_modules/.bin/jest",
@@ -3,126 +3,112 @@
3
3
  /**
4
4
  * @returns {Promise<string>}
5
5
  */
6
- export function get_congestion_stats(): Promise<string>;
6
+ export function get_stats(): Promise<string>;
7
7
  /**
8
- * @param {WasmBalanceSnapshot} snapshot
9
- * @returns {Promise<void>}
8
+ * @param {string} slip1_utxo_key
9
+ * @param {string} slip2_utxo_key
10
+ * @param {string} slip3_utxo_key
11
+ * @returns {Promise<WasmTransaction>}
10
12
  */
11
- export function update_from_balance_snapshot(snapshot: WasmBalanceSnapshot): Promise<void>;
13
+ export function create_remove_bound_transaction(slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string): Promise<WasmTransaction>;
12
14
  /**
15
+ * @returns {Promise<string>}
16
+ */
17
+ export function get_congestion_stats(): Promise<string>;
18
+ /**
19
+ * @param {bigint} threshold
13
20
  * @returns {Promise<void>}
14
21
  */
15
- export function disable_producing_blocks_by_timer(): Promise<void>;
22
+ export function write_issuance_file(threshold: bigint): Promise<void>;
16
23
  /**
17
24
  * @returns {Promise<string>}
18
25
  */
19
- export function get_stats(): Promise<string>;
26
+ export function get_peer_stats(): Promise<string>;
20
27
  /**
21
- * @param {string} public_key
22
- * @returns {Promise<Array<any>>}
28
+ * @returns {Promise<WasmWallet>}
23
29
  */
24
- export function get_account_slips(public_key: string): Promise<Array<any>>;
30
+ export function get_wallet(): Promise<WasmWallet>;
25
31
  /**
26
- * @param {bigint} num
27
- * @param {bigint} deposit
28
- * @param {Uint8Array} tx_msg
32
+ * @param {bigint} peer_index
33
+ * @param {string} ip
34
+ * @returns {Promise<void>}
35
+ */
36
+ export function process_new_peer(peer_index: bigint, ip: string): Promise<void>;
37
+ /**
38
+ * @param {Array<any>} public_keys
39
+ * @param {BigUint64Array} amounts
29
40
  * @param {bigint} fee
30
- * @param {string} recipient_public_key
31
- * @param {string} nft_type
41
+ * @param {boolean} _force_merge
32
42
  * @returns {Promise<WasmTransaction>}
33
43
  */
34
- export function create_bound_transaction(num: bigint, deposit: bigint, tx_msg: Uint8Array, fee: bigint, recipient_public_key: string, nft_type: string): Promise<WasmTransaction>;
44
+ export function create_transaction_with_multiple_payments(public_keys: Array<any>, amounts: BigUint64Array, fee: bigint, _force_merge: boolean): Promise<WasmTransaction>;
35
45
  /**
36
46
  * @param {bigint} peer_index
37
47
  * @returns {Promise<void>}
38
48
  */
39
49
  export function remove_stun_peer(peer_index: bigint): Promise<void>;
40
50
  /**
41
- * @returns {Promise<any>}
42
- */
43
- export function get_confirmations(): Promise<any>;
44
- /**
45
- * @param {bigint} current_time
46
- * @returns {Promise<void>}
51
+ * @param {Uint8Array} buffer
52
+ * @param {string} private_key
53
+ * @returns {string}
47
54
  */
48
- export function process_stat_interval(current_time: bigint): Promise<void>;
55
+ export function sign_buffer(buffer: Uint8Array, private_key: string): string;
49
56
  /**
50
- * @param {string} key
51
- * @returns {boolean}
57
+ * @param {Uint8Array} buffer
58
+ * @returns {string}
52
59
  */
53
- export function is_valid_public_key(key: string): boolean;
60
+ export function hash(buffer: Uint8Array): string;
54
61
  /**
55
- * @param {string} config_json
56
- * @param {string} private_key
57
- * @param {number} log_level_num
58
- * @param {bigint} hasten_multiplier
59
- * @param {boolean} delete_old_blocks
60
- * @returns {Promise<any>}
62
+ * @returns {Promise<boolean>}
61
63
  */
62
- export function initialize(config_json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint, delete_old_blocks: boolean): Promise<any>;
64
+ export function produce_block_without_gt(): Promise<boolean>;
63
65
  /**
64
- * @param {bigint} amt
65
- * @param {string} slip1_utxo_key
66
- * @param {string} slip2_utxo_key
67
- * @param {string} slip3_utxo_key
68
- * @param {string} recipient_public_key
69
- * @param {Uint8Array} tx_msg
70
- * @returns {Promise<WasmTransaction>}
66
+ * @returns {Promise<Array<any>>}
71
67
  */
72
- export function create_send_bound_transaction(amt: bigint, slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string, recipient_public_key: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
68
+ export function get_nft_list(): Promise<Array<any>>;
73
69
  /**
74
- * @param {string} slip1_utxo_key
75
- * @param {string} slip2_utxo_key
76
- * @param {string} slip3_utxo_key
77
- * @returns {Promise<WasmTransaction>}
70
+ * @param {bigint} peer_index
71
+ * @returns {Promise<WasmPeer | undefined>}
78
72
  */
79
- export function create_remove_bound_transaction(slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string): Promise<WasmTransaction>;
73
+ export function get_peer(peer_index: bigint): Promise<WasmPeer | undefined>;
80
74
  /**
81
- * @returns {Promise<WasmBlockchain>}
75
+ * @param {bigint} duration_in_ms
76
+ * @returns {Promise<void>}
82
77
  */
83
- export function get_blockchain(): Promise<WasmBlockchain>;
78
+ export function process_timer_event(duration_in_ms: bigint): Promise<void>;
84
79
  /**
85
- * @returns {Promise<Array<any>>}
80
+ * @returns {Promise<boolean>}
86
81
  */
87
- export function get_mempool_txs(): Promise<Array<any>>;
82
+ export function produce_block_with_gt(): Promise<boolean>;
88
83
  /**
89
- * @param {string} nft_id_hex
84
+ * @param {string} slip1_utxo_key
85
+ * @param {string} slip2_utxo_key
86
+ * @param {string} slip3_utxo_key
87
+ * @param {number} left_count
88
+ * @param {number} right_count
90
89
  * @param {Uint8Array} tx_msg
91
90
  * @returns {Promise<WasmTransaction>}
92
91
  */
93
- export function create_merge_bound_transaction(nft_id_hex: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
94
- /**
95
- * @returns {Promise<Array<any>>}
96
- */
97
- export function get_nft_list(): Promise<Array<any>>;
98
- /**
99
- * @returns {Promise<string>}
100
- */
101
- export function get_latest_block_hash(): Promise<string>;
92
+ export function create_split_bound_transaction(slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string, left_count: number, right_count: number, tx_msg: Uint8Array): Promise<WasmTransaction>;
102
93
  /**
103
- * @param {Uint8Array} buffer
104
- * @param {string} private_key
105
- * @returns {string}
94
+ * @param {bigint} current_time
95
+ * @returns {Promise<void>}
106
96
  */
107
- export function sign_buffer(buffer: Uint8Array, private_key: string): string;
97
+ export function process_stat_interval(current_time: bigint): Promise<void>;
108
98
  /**
109
99
  * @param {bigint} peer_index
110
- * @returns {Promise<WasmPeer | undefined>}
111
- */
112
- export function get_peer(peer_index: bigint): Promise<WasmPeer | undefined>;
113
- /**
100
+ * @param {string} public_key
114
101
  * @returns {Promise<void>}
115
102
  */
116
- export function start_from_received_ghost_chain(): Promise<void>;
103
+ export function process_stun_peer(peer_index: bigint, public_key: string): Promise<void>;
117
104
  /**
118
- * @returns {string}
105
+ * @returns {Promise<any>}
119
106
  */
120
- export function generate_private_key(): string;
107
+ export function get_confirmations(): Promise<any>;
121
108
  /**
122
- * @param {string} block_hash
123
- * @returns {Promise<WasmBlock>}
109
+ * @returns {Promise<void>}
124
110
  */
125
- export function get_block(block_hash: string): Promise<WasmBlock>;
111
+ export function start_from_received_ghost_chain(): Promise<void>;
126
112
  /**
127
113
  * @param {Uint8Array} buffer
128
114
  * @param {number} msg_index
@@ -131,58 +117,61 @@ export function get_block(block_hash: string): Promise<WasmBlock>;
131
117
  */
132
118
  export function send_api_error(buffer: Uint8Array, msg_index: number, peer_index: bigint): Promise<void>;
133
119
  /**
134
- * @param {Array<any>} public_keys
135
- * @param {BigUint64Array} amounts
136
- * @param {bigint} fee
137
- * @param {boolean} _force_merge
138
- * @returns {Promise<WasmTransaction>}
120
+ * @returns {Promise<Array<any>>}
139
121
  */
140
- export function create_transaction_with_multiple_payments(public_keys: Array<any>, amounts: BigUint64Array, fee: bigint, _force_merge: boolean): Promise<WasmTransaction>;
122
+ export function get_mempool_txs(): Promise<Array<any>>;
141
123
  /**
142
- * @param {Uint8Array} buffer
124
+ * @param {string} private_key
143
125
  * @returns {string}
144
126
  */
145
- export function hash(buffer: Uint8Array): string;
127
+ export function generate_public_key(private_key: string): string;
146
128
  /**
147
- * @returns {Promise<boolean>}
129
+ * @param {string} config_json
130
+ * @param {string} private_key
131
+ * @param {number} log_level_num
132
+ * @param {bigint} hasten_multiplier
133
+ * @param {boolean} delete_old_blocks
134
+ * @returns {Promise<any>}
148
135
  */
149
- export function produce_block_with_gt(): Promise<boolean>;
136
+ export function initialize(config_json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint, delete_old_blocks: boolean): Promise<any>;
150
137
  /**
151
- * @param {Uint8Array} hash
152
- * @param {bigint} block_id
153
- * @param {bigint} peer_index
154
- * @returns {Promise<void>}
138
+ * @param {Uint8Array} buffer
139
+ * @param {string} signature
140
+ * @param {string} public_key
141
+ * @returns {boolean}
155
142
  */
156
- export function process_failed_block_fetch(hash: Uint8Array, block_id: bigint, peer_index: bigint): Promise<void>;
143
+ export function verify_signature(buffer: Uint8Array, signature: string, public_key: string): boolean;
157
144
  /**
158
145
  * @param {Uint8Array} buffer
159
- * @param {Uint8Array} hash
160
- * @param {bigint} block_id
161
146
  * @param {bigint} peer_index
162
147
  * @returns {Promise<void>}
163
148
  */
164
- export function process_fetched_block(buffer: Uint8Array, hash: Uint8Array, block_id: bigint, peer_index: bigint): Promise<void>;
149
+ export function process_msg_buffer_from_peer(buffer: Uint8Array, peer_index: bigint): Promise<void>;
165
150
  /**
166
- * @param {number} major
167
- * @param {number} minor
168
- * @param {number} patch
169
- * @returns {Promise<void>}
151
+ * @param {bigint} num
152
+ * @param {bigint} deposit
153
+ * @param {Uint8Array} tx_msg
154
+ * @param {bigint} fee
155
+ * @param {string} recipient_public_key
156
+ * @param {string} nft_type
157
+ * @returns {Promise<WasmTransaction>}
170
158
  */
171
- export function set_wallet_version(major: number, minor: number, patch: number): Promise<void>;
159
+ export function create_bound_transaction(num: bigint, deposit: bigint, tx_msg: Uint8Array, fee: bigint, recipient_public_key: string, nft_type: string): Promise<WasmTransaction>;
172
160
  /**
173
- * @returns {Promise<boolean>}
161
+ * @returns {Promise<WasmBlockchain>}
174
162
  */
175
- export function produce_block_without_gt(): Promise<boolean>;
163
+ export function get_blockchain(): Promise<WasmBlockchain>;
176
164
  /**
177
- * @param {bigint} threshold
165
+ * @param {Uint8Array} hash
166
+ * @param {bigint} block_id
167
+ * @param {bigint} peer_index
178
168
  * @returns {Promise<void>}
179
169
  */
180
- export function write_issuance_file(threshold: bigint): Promise<void>;
170
+ export function process_failed_block_fetch(hash: Uint8Array, block_id: bigint, peer_index: bigint): Promise<void>;
181
171
  /**
182
- * @param {bigint} peer_index
183
- * @returns {Promise<void>}
172
+ * @returns {string}
184
173
  */
185
- export function process_peer_disconnection(peer_index: bigint): Promise<void>;
174
+ export function generate_private_key(): string;
186
175
  /**
187
176
  * @param {string} public_key
188
177
  * @param {bigint} amount
@@ -192,90 +181,101 @@ export function process_peer_disconnection(peer_index: bigint): Promise<void>;
192
181
  */
193
182
  export function create_transaction(public_key: string, amount: bigint, fee: bigint, force_merge: boolean): Promise<WasmTransaction>;
194
183
  /**
195
- * @param {Array<any>} keys
196
- * @returns {Promise<WasmBalanceSnapshot>}
184
+ * @param {WasmBalanceSnapshot} snapshot
185
+ * @returns {Promise<void>}
197
186
  */
198
- export function get_balance_snapshot(keys: Array<any>): Promise<WasmBalanceSnapshot>;
187
+ export function update_from_balance_snapshot(snapshot: WasmBalanceSnapshot): Promise<void>;
199
188
  /**
200
- * @param {Uint8Array} buffer
201
- * @param {bigint} peer_index
189
+ * @param {WasmTransaction} tx
202
190
  * @returns {Promise<void>}
203
191
  */
204
- export function process_msg_buffer_from_peer(buffer: Uint8Array, peer_index: bigint): Promise<void>;
192
+ export function propagate_transaction(tx: WasmTransaction): Promise<void>;
205
193
  /**
206
194
  * @param {bigint} peer_index
207
- * @param {string} public_key
208
195
  * @returns {Promise<void>}
209
196
  */
210
- export function process_stun_peer(peer_index: bigint, public_key: string): Promise<void>;
197
+ export function process_peer_disconnection(peer_index: bigint): Promise<void>;
211
198
  /**
212
199
  * @param {Uint8Array} buffer
213
- * @param {number} msg_index
200
+ * @param {Uint8Array} hash
201
+ * @param {bigint} block_id
214
202
  * @param {bigint} peer_index
215
203
  * @returns {Promise<void>}
216
204
  */
217
- export function send_api_success(buffer: Uint8Array, msg_index: number, peer_index: bigint): Promise<void>;
205
+ export function process_fetched_block(buffer: Uint8Array, hash: Uint8Array, block_id: bigint, peer_index: bigint): Promise<void>;
218
206
  /**
219
- * @returns {Promise<WasmWallet>}
207
+ * @param {string} public_key
208
+ * @returns {Promise<Array<any>>}
220
209
  */
221
- export function get_wallet(): Promise<WasmWallet>;
210
+ export function get_account_slips(public_key: string): Promise<Array<any>>;
222
211
  /**
223
212
  * @returns {Promise<Array<any>>}
224
213
  */
225
214
  export function get_peers(): Promise<Array<any>>;
226
215
  /**
227
- * @param {Uint8Array} buffer
228
- * @param {number} msg_index
229
- * @param {bigint} peer_index
230
- * @returns {Promise<void>}
231
- */
232
- export function send_api_call(buffer: Uint8Array, msg_index: number, peer_index: bigint): Promise<void>;
233
- /**
234
- * @param {bigint} peer_index
235
- * @param {string} ip
236
- * @returns {Promise<void>}
216
+ * @param {string} key
217
+ * @returns {boolean}
237
218
  */
238
- export function process_new_peer(peer_index: bigint, ip: string): Promise<void>;
219
+ export function is_valid_public_key(key: string): boolean;
239
220
  /**
240
- * @param {WasmTransaction} tx
241
- * @returns {Promise<void>}
221
+ * @param {string} block_hash
222
+ * @returns {Promise<WasmBlock>}
242
223
  */
243
- export function propagate_transaction(tx: WasmTransaction): Promise<void>;
224
+ export function get_block(block_hash: string): Promise<WasmBlock>;
244
225
  /**
245
226
  * @returns {Promise<string>}
246
227
  */
247
- export function get_peer_stats(): Promise<string>;
228
+ export function get_latest_block_hash(): Promise<string>;
248
229
  /**
249
- * @param {Uint8Array} buffer
250
- * @param {string} signature
251
- * @param {string} public_key
252
- * @returns {boolean}
230
+ * @param {bigint} amt
231
+ * @param {string} slip1_utxo_key
232
+ * @param {string} slip2_utxo_key
233
+ * @param {string} slip3_utxo_key
234
+ * @param {string} recipient_public_key
235
+ * @param {Uint8Array} tx_msg
236
+ * @returns {Promise<WasmTransaction>}
253
237
  */
254
- export function verify_signature(buffer: Uint8Array, signature: string, public_key: string): boolean;
238
+ export function create_send_bound_transaction(amt: bigint, slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string, recipient_public_key: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
255
239
  /**
256
240
  * @returns {Promise<bigint>}
257
241
  */
258
242
  export function get_next_peer_index(): Promise<bigint>;
259
243
  /**
260
- * @param {string} private_key
261
- * @returns {string}
244
+ * @returns {Promise<void>}
262
245
  */
263
- export function generate_public_key(private_key: string): string;
246
+ export function disable_producing_blocks_by_timer(): Promise<void>;
264
247
  /**
265
- * @param {bigint} duration_in_ms
248
+ * @param {Uint8Array} buffer
249
+ * @param {number} msg_index
250
+ * @param {bigint} peer_index
266
251
  * @returns {Promise<void>}
267
252
  */
268
- export function process_timer_event(duration_in_ms: bigint): Promise<void>;
253
+ export function send_api_call(buffer: Uint8Array, msg_index: number, peer_index: bigint): Promise<void>;
269
254
  /**
270
- * @param {string} slip1_utxo_key
271
- * @param {string} slip2_utxo_key
272
- * @param {string} slip3_utxo_key
273
- * @param {number} left_count
274
- * @param {number} right_count
255
+ * @param {Array<any>} keys
256
+ * @returns {Promise<WasmBalanceSnapshot>}
257
+ */
258
+ export function get_balance_snapshot(keys: Array<any>): Promise<WasmBalanceSnapshot>;
259
+ /**
260
+ * @param {Uint8Array} buffer
261
+ * @param {number} msg_index
262
+ * @param {bigint} peer_index
263
+ * @returns {Promise<void>}
264
+ */
265
+ export function send_api_success(buffer: Uint8Array, msg_index: number, peer_index: bigint): Promise<void>;
266
+ /**
267
+ * @param {string} nft_id_hex
275
268
  * @param {Uint8Array} tx_msg
276
269
  * @returns {Promise<WasmTransaction>}
277
270
  */
278
- export function create_split_bound_transaction(slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string, left_count: number, right_count: number, tx_msg: Uint8Array): Promise<WasmTransaction>;
271
+ export function create_merge_bound_transaction(nft_id_hex: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
272
+ /**
273
+ * @param {number} major
274
+ * @param {number} minor
275
+ * @param {number} patch
276
+ * @returns {Promise<void>}
277
+ */
278
+ export function set_wallet_version(major: number, minor: number, patch: number): Promise<void>;
279
279
  /**
280
280
  */
281
281
  export class SaitoWasm {