saito-wasm 0.2.170 → 0.2.171

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