saito-wasm 0.2.170 → 0.2.172

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