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