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