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