saito-wasm 0.2.204 → 0.2.206

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