saito-wasm 0.2.222 → 0.2.224

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