saito-wasm 0.2.222 → 0.2.223

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.222"
3
+ version = "0.2.223"
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.222",
3
+ "version": "0.2.223",
4
4
  "description": "js wrappings around saito-core using wasm",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,28 +1,18 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * @param {Uint8Array} buffer
5
- * @returns {string}
4
+ * @returns {Promise<string>}
6
5
  */
7
- export function hash(buffer: Uint8Array): string;
6
+ export function get_latest_block_hash(): Promise<string>;
8
7
  /**
9
8
  * @returns {Promise<void>}
10
9
  */
11
10
  export function start_from_received_ghost_chain(): Promise<void>;
12
11
  /**
13
- * @param {string} slip1_utxo_key
14
- * @param {string} slip2_utxo_key
15
- * @param {string} slip3_utxo_key
16
- * @param {number} left_count
17
- * @param {number} right_count
18
- * @param {Uint8Array} tx_msg
19
- * @returns {Promise<WasmTransaction>}
20
- */
21
- 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>;
22
- /**
23
- * @returns {Promise<Array<any>>}
12
+ * @param {string} key
13
+ * @returns {Promise<void>}
24
14
  */
25
- export function get_peers(): Promise<Array<any>>;
15
+ export function process_peer_disconnection(key: string): Promise<void>;
26
16
  /**
27
17
  * @param {string} slip1_utxo_key
28
18
  * @param {string} slip2_utxo_key
@@ -30,21 +20,18 @@ export function get_peers(): Promise<Array<any>>;
30
20
  * @param {Uint8Array} tx_msg
31
21
  * @returns {Promise<WasmTransaction>}
32
22
  */
33
- export function create_atomize_bound_transaction(slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
23
+ export function create_remove_bound_transaction(slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
24
+ /**
25
+ * @param {WasmBalanceSnapshot} snapshot
26
+ * @returns {Promise<void>}
27
+ */
28
+ export function update_from_balance_snapshot(snapshot: WasmBalanceSnapshot): Promise<void>;
34
29
  /**
35
30
  * @param {Array<any>} keys
36
31
  * @returns {Promise<WasmBalanceSnapshot>}
37
32
  */
38
33
  export function get_balance_snapshot(keys: Array<any>): Promise<WasmBalanceSnapshot>;
39
34
  /**
40
- * @returns {Promise<boolean>}
41
- */
42
- export function produce_block_without_gt(): Promise<boolean>;
43
- /**
44
- * @returns {Promise<void>}
45
- */
46
- export function disable_producing_blocks_by_timer(): Promise<void>;
47
- /**
48
35
  * @param {Uint8Array} hash
49
36
  * @param {bigint} block_id
50
37
  * @param {string} key
@@ -52,125 +39,97 @@ export function disable_producing_blocks_by_timer(): Promise<void>;
52
39
  */
53
40
  export function process_failed_block_fetch(hash: Uint8Array, block_id: bigint, key: string): Promise<void>;
54
41
  /**
55
- * @param {Uint8Array} buffer
56
- * @param {WasmNetworkPeer} peer
57
- * @returns {Promise<Uint8Array>}
42
+ * @param {string} config_json
43
+ * @param {string} private_key
44
+ * @param {number} log_level_num
45
+ * @param {bigint} hasten_multiplier
46
+ * @param {boolean} delete_old_blocks
47
+ * @returns {Promise<any>}
58
48
  */
59
- export function process_msg_buffer_from_peer(buffer: Uint8Array, peer: WasmNetworkPeer): Promise<Uint8Array>;
49
+ export function initialize(config_json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint, delete_old_blocks: boolean): Promise<any>;
60
50
  /**
61
- * @param {bigint} current_time
62
51
  * @returns {Promise<void>}
63
52
  */
64
- export function process_stat_interval(current_time: bigint): Promise<void>;
53
+ export function disable_producing_blocks_by_timer(): Promise<void>;
65
54
  /**
66
55
  * @param {string} public_key
67
- * @returns {Promise<void>}
68
- */
69
- export function process_stun_peer(public_key: string): Promise<void>;
70
- /**
71
- * @param {bigint} threshold
72
- * @returns {Promise<void>}
56
+ * @returns {Promise<Array<any>>}
73
57
  */
74
- export function write_issuance_file(threshold: bigint): Promise<void>;
58
+ export function get_account_slips(public_key: string): Promise<Array<any>>;
75
59
  /**
76
60
  * @param {Uint8Array} buffer
77
- * @param {number} msg_index
61
+ * @param {Uint8Array} hash
62
+ * @param {bigint} block_id
78
63
  * @param {string} key
79
64
  * @returns {Promise<void>}
80
65
  */
81
- export function send_api_success(buffer: Uint8Array, msg_index: number, key: string): Promise<void>;
82
- /**
83
- * @param {string} public_key
84
- * @param {bigint} amount
85
- * @param {bigint} fee
86
- * @param {boolean} force_merge
87
- * @returns {Promise<WasmTransaction>}
88
- */
89
- export function create_transaction(public_key: string, amount: bigint, fee: bigint, force_merge: boolean): Promise<WasmTransaction>;
66
+ export function process_fetched_block(buffer: Uint8Array, hash: Uint8Array, block_id: bigint, key: string): Promise<void>;
90
67
  /**
91
- * @param {Uint8Array} buffer
92
- * @param {number} msg_index
93
- * @param {string} key
68
+ * @param {bigint} threshold
94
69
  * @returns {Promise<void>}
95
70
  */
96
- export function send_api_error(buffer: Uint8Array, msg_index: number, key: string): Promise<void>;
97
- /**
98
- * @returns {Promise<boolean>}
99
- */
100
- export function produce_block_with_gt(): Promise<boolean>;
71
+ export function write_issuance_file(threshold: bigint): Promise<void>;
101
72
  /**
102
- * @param {string} public_key
103
- * @returns {Promise<Array<any>>}
73
+ * @returns {Promise<WasmBlockchain>}
104
74
  */
105
- export function get_account_slips(public_key: string): Promise<Array<any>>;
75
+ export function get_blockchain(): Promise<WasmBlockchain>;
106
76
  /**
77
+ * @param {Uint8Array} buffer
107
78
  * @param {string} private_key
108
79
  * @returns {string}
109
80
  */
110
- export function generate_public_key(private_key: string): string;
111
- /**
112
- * @param {string} key
113
- * @returns {Promise<WasmPeer | undefined>}
114
- */
115
- export function get_peer(key: string): Promise<WasmPeer | undefined>;
116
- /**
117
- * @param {Uint8Array} buffer
118
- * @param {Uint8Array} hash
119
- * @param {bigint} block_id
120
- * @param {string} key
121
- * @returns {Promise<void>}
122
- */
123
- export function process_fetched_block(buffer: Uint8Array, hash: Uint8Array, block_id: bigint, key: string): Promise<void>;
124
- /**
125
- * @param {WasmNetworkPeer} peer
126
- * @returns {Promise<void>}
127
- */
128
- export function process_new_peer(peer: WasmNetworkPeer): Promise<void>;
81
+ export function sign_buffer(buffer: Uint8Array, private_key: string): string;
129
82
  /**
130
- * @param {WasmBalanceSnapshot} snapshot
131
- * @returns {Promise<void>}
83
+ * @returns {Promise<Array<any>>}
132
84
  */
133
- export function update_from_balance_snapshot(snapshot: WasmBalanceSnapshot): Promise<void>;
85
+ export function get_mempool_txs(): Promise<Array<any>>;
134
86
  /**
135
87
  * @param {bigint} duration_in_ms
136
88
  * @returns {Promise<void>}
137
89
  */
138
90
  export function process_timer_event(duration_in_ms: bigint): Promise<void>;
139
91
  /**
140
- * @param {Uint8Array} buffer
141
- * @param {number} msg_index
142
- * @param {string} key
143
- * @returns {Promise<void>}
92
+ * @param {string} slip1_utxo_key
93
+ * @param {string} slip2_utxo_key
94
+ * @param {string} slip3_utxo_key
95
+ * @param {number} left_count
96
+ * @param {number} right_count
97
+ * @param {Uint8Array} tx_msg
98
+ * @returns {Promise<WasmTransaction>}
144
99
  */
145
- export function send_api_call(buffer: Uint8Array, msg_index: number, key: string): Promise<void>;
100
+ 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>;
146
101
  /**
147
102
  * @returns {Promise<string>}
148
103
  */
149
- export function get_congestion_stats(): Promise<string>;
104
+ export function get_stats(): Promise<string>;
150
105
  /**
151
- * @param {number} major
152
- * @param {number} minor
153
- * @param {number} patch
154
- * @returns {Promise<void>}
106
+ * @param {string} block_hash
107
+ * @returns {Promise<WasmBlock>}
155
108
  */
156
- export function set_wallet_version(major: number, minor: number, patch: number): Promise<void>;
109
+ export function get_block(block_hash: string): Promise<WasmBlock>;
157
110
  /**
158
- * @param {string} key
159
- * @returns {Promise<void>}
111
+ * @returns {Promise<boolean>}
160
112
  */
161
- export function process_peer_disconnection(key: string): Promise<void>;
113
+ export function produce_block_with_gt(): Promise<boolean>;
162
114
  /**
163
- * @param {Array<any>} public_keys
164
- * @param {BigUint64Array} amounts
115
+ * @param {string} nft_id_hex
116
+ * @param {Uint8Array} tx_msg
117
+ * @returns {Promise<WasmTransaction>}
118
+ */
119
+ export function create_merge_bound_transaction(nft_id_hex: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
120
+ /**
121
+ * @param {string} public_key
122
+ * @param {bigint} amount
165
123
  * @param {bigint} fee
166
- * @param {boolean} _force_merge
124
+ * @param {boolean} force_merge
167
125
  * @returns {Promise<WasmTransaction>}
168
126
  */
169
- export function create_transaction_with_multiple_payments(public_keys: Array<any>, amounts: BigUint64Array, fee: bigint, _force_merge: boolean): Promise<WasmTransaction>;
127
+ export function create_transaction(public_key: string, amount: bigint, fee: bigint, force_merge: boolean): Promise<WasmTransaction>;
170
128
  /**
171
- * @returns {Promise<string>}
129
+ * @param {bigint} current_time
130
+ * @returns {Promise<void>}
172
131
  */
173
- export function get_latest_block_hash(): Promise<string>;
132
+ export function process_stat_interval(current_time: bigint): Promise<void>;
174
133
  /**
175
134
  * @param {string} slip1_utxo_key
176
135
  * @param {string} slip2_utxo_key
@@ -178,68 +137,82 @@ export function get_latest_block_hash(): Promise<string>;
178
137
  * @param {Uint8Array} tx_msg
179
138
  * @returns {Promise<WasmTransaction>}
180
139
  */
181
- export function create_remove_bound_transaction(slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
140
+ export function create_atomize_bound_transaction(slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
182
141
  /**
183
142
  * @param {string} key
184
143
  * @returns {boolean}
185
144
  */
186
- export function is_valid_public_key(key: string): boolean;
145
+ export function isPublicKey(key: string): boolean;
146
+ /**
147
+ * @param {string} public_key
148
+ * @returns {Promise<void>}
149
+ */
150
+ export function process_stun_peer(public_key: string): Promise<void>;
187
151
  /**
188
- * @param {string} config_json
189
- * @param {string} private_key
190
- * @param {number} log_level_num
191
- * @param {bigint} hasten_multiplier
192
- * @param {boolean} delete_old_blocks
193
152
  * @returns {Promise<any>}
194
153
  */
195
- export function initialize(config_json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint, delete_old_blocks: boolean): Promise<any>;
154
+ export function get_confirmations(): Promise<any>;
196
155
  /**
197
- * @param {bigint} num
198
- * @param {bigint} deposit
199
- * @param {Uint8Array} tx_msg
200
- * @param {bigint} _fee
201
- * @param {string} recipient_public_key
202
- * @param {string} nft_type
203
- * @returns {Promise<WasmTransaction>}
156
+ * @param {Uint8Array} buffer
157
+ * @returns {string}
204
158
  */
205
- export function create_bound_transaction(num: bigint, deposit: bigint, tx_msg: Uint8Array, _fee: bigint, recipient_public_key: string, nft_type: string): Promise<WasmTransaction>;
159
+ export function hash(buffer: Uint8Array): string;
206
160
  /**
207
- * @param {string} block_hash
208
- * @returns {Promise<WasmBlock>}
161
+ * @param {string} public_key
162
+ * @returns {Promise<void>}
209
163
  */
210
- export function get_block(block_hash: string): Promise<WasmBlock>;
164
+ export function remove_stun_peer(public_key: string): Promise<void>;
211
165
  /**
212
- * @returns {Promise<Array<any>>}
166
+ * @returns {Promise<string>}
213
167
  */
214
- export function get_mempool_txs(): Promise<Array<any>>;
168
+ export function get_congestion_stats(): Promise<string>;
215
169
  /**
216
170
  * @param {Uint8Array} buffer
217
- * @param {string} private_key
218
- * @returns {string}
171
+ * @param {WasmNetworkPeer} peer
172
+ * @returns {Promise<Uint8Array>}
219
173
  */
220
- export function sign_buffer(buffer: Uint8Array, private_key: string): string;
174
+ export function process_msg_buffer_from_peer(buffer: Uint8Array, peer: WasmNetworkPeer): Promise<Uint8Array>;
221
175
  /**
222
- * @returns {string}
176
+ * @param {bigint} amt
177
+ * @param {string} slip1_utxo_key
178
+ * @param {string} slip2_utxo_key
179
+ * @param {string} slip3_utxo_key
180
+ * @param {string} recipient_public_key
181
+ * @param {Uint8Array} tx_msg
182
+ * @returns {Promise<WasmTransaction>}
223
183
  */
224
- export function generate_private_key(): string;
184
+ 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>;
225
185
  /**
226
- * @returns {Promise<WasmBlockchain>}
186
+ * @param {WasmNetworkPeer} peer
187
+ * @returns {Promise<void>}
227
188
  */
228
- export function get_blockchain(): Promise<WasmBlockchain>;
189
+ export function process_new_peer(peer: WasmNetworkPeer): Promise<void>;
229
190
  /**
230
- * @returns {Promise<Array<any>>}
191
+ * @param {Array<any>} public_keys
192
+ * @param {BigUint64Array} amounts
193
+ * @param {bigint} fee
194
+ * @param {boolean} _force_merge
195
+ * @returns {Promise<WasmTransaction>}
231
196
  */
232
- export function get_nft_list(): Promise<Array<any>>;
197
+ export function create_transaction_with_multiple_payments(public_keys: Array<any>, amounts: BigUint64Array, fee: bigint, _force_merge: boolean): Promise<WasmTransaction>;
233
198
  /**
234
- * @param {string} public_key
235
- * @returns {Promise<void>}
199
+ * @returns {WasmNetwork}
236
200
  */
237
- export function remove_stun_peer(public_key: string): Promise<void>;
201
+ export function get_network(): WasmNetwork;
238
202
  /**
239
203
  * @returns {Promise<WasmWallet>}
240
204
  */
241
205
  export function get_wallet(): Promise<WasmWallet>;
242
206
  /**
207
+ * @param {string} private_key
208
+ * @returns {string}
209
+ */
210
+ export function generate_public_key(private_key: string): string;
211
+ /**
212
+ * @returns {Promise<boolean>}
213
+ */
214
+ export function produce_block_without_gt(): Promise<boolean>;
215
+ /**
243
216
  * @param {Uint8Array} buffer
244
217
  * @param {string} signature
245
218
  * @param {string} public_key
@@ -247,34 +220,23 @@ export function get_wallet(): Promise<WasmWallet>;
247
220
  */
248
221
  export function verify_signature(buffer: Uint8Array, signature: string, public_key: string): boolean;
249
222
  /**
250
- * @param {bigint} amt
251
- * @param {string} slip1_utxo_key
252
- * @param {string} slip2_utxo_key
253
- * @param {string} slip3_utxo_key
254
- * @param {string} recipient_public_key
255
- * @param {Uint8Array} tx_msg
256
- * @returns {Promise<WasmTransaction>}
223
+ * @returns {Promise<Array<any>>}
257
224
  */
258
- 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>;
225
+ export function get_nft_list(): Promise<Array<any>>;
259
226
  /**
260
- * @param {WasmTransaction} tx
261
- * @returns {Promise<void>}
227
+ * @returns {string}
262
228
  */
263
- export function propagate_transaction(tx: WasmTransaction): Promise<void>;
229
+ export function generate_private_key(): string;
264
230
  /**
265
- * @param {string} nft_id_hex
231
+ * @param {bigint} num
232
+ * @param {bigint} deposit
266
233
  * @param {Uint8Array} tx_msg
234
+ * @param {bigint} _fee
235
+ * @param {string} recipient_public_key
236
+ * @param {string} nft_type
267
237
  * @returns {Promise<WasmTransaction>}
268
238
  */
269
- export function create_merge_bound_transaction(nft_id_hex: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
270
- /**
271
- * @returns {Promise<any>}
272
- */
273
- export function get_confirmations(): Promise<any>;
274
- /**
275
- * @returns {Promise<string>}
276
- */
277
- export function get_stats(): Promise<string>;
239
+ export function create_bound_transaction(num: bigint, deposit: bigint, tx_msg: Uint8Array, _fee: bigint, recipient_public_key: string, nft_type: string): Promise<WasmTransaction>;
278
240
  /**
279
241
  */
280
242
  export class SaitoWasm {
@@ -666,6 +628,57 @@ export class WasmNFT {
666
628
  }
667
629
  /**
668
630
  */
631
+ export class WasmNetwork {
632
+ free(): void;
633
+ /**
634
+ * @param {WasmTransaction} wtx
635
+ * @returns {Promise<void>}
636
+ */
637
+ propagateTransaction(wtx: WasmTransaction): Promise<void>;
638
+ /**
639
+ */
640
+ constructor();
641
+ /**
642
+ * @param {string} key
643
+ * @returns {Promise<WasmPeer | undefined>}
644
+ */
645
+ getPeer(key: string): Promise<WasmPeer | undefined>;
646
+ /**
647
+ * @returns {Promise<Array<any>>}
648
+ */
649
+ getPeers(): Promise<Array<any>>;
650
+ /**
651
+ */
652
+ readonly api: WasmNetworkApi;
653
+ }
654
+ /**
655
+ */
656
+ export class WasmNetworkApi {
657
+ free(): void;
658
+ /**
659
+ * @param {Uint8Array} buffer
660
+ * @param {number} msg_index
661
+ * @param {string} key
662
+ * @returns {Promise<void>}
663
+ */
664
+ send(buffer: Uint8Array, msg_index: number, key: string): Promise<void>;
665
+ /**
666
+ * @param {Uint8Array} buffer
667
+ * @param {number} msg_index
668
+ * @param {string} key
669
+ * @returns {Promise<void>}
670
+ */
671
+ error(buffer: Uint8Array, msg_index: number, key: string): Promise<void>;
672
+ /**
673
+ * @param {Uint8Array} buffer
674
+ * @param {number} msg_index
675
+ * @param {string} key
676
+ * @returns {Promise<void>}
677
+ */
678
+ success(buffer: Uint8Array, msg_index: number, key: string): Promise<void>;
679
+ }
680
+ /**
681
+ */
669
682
  export class WasmNetworkPeer {
670
683
  free(): void;
671
684
  /**
@@ -896,6 +909,17 @@ export class WasmWallet {
896
909
  */
897
910
  set_private_key(key: string): Promise<void>;
898
911
  /**
912
+ * @returns {Promise<object>}
913
+ */
914
+ getWalletVersion(): Promise<object>;
915
+ /**
916
+ * @param {number} major
917
+ * @param {number} minor
918
+ * @param {number} patch
919
+ * @returns {Promise<void>}
920
+ */
921
+ setWalletVersion(major: number, minor: number, patch: number): Promise<void>;
922
+ /**
899
923
  * @returns {Promise<void>}
900
924
  */
901
925
  load(): Promise<void>;