saito-wasm 0.2.166 → 0.2.167

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