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