saito-wasm 0.2.239 → 0.2.242
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 +1 -1
- package/package.json +1 -1
- package/pkg/node/index.d.ts +157 -102
- package/pkg/node/index.js +523 -368
- package/pkg/node/index_bg.wasm +0 -0
- package/pkg/node/index_bg.wasm.d.ts +15 -4
- package/pkg/node/package.json +3 -3
- package/pkg/web/index.d.ts +172 -106
- package/pkg/web/index.js +507 -351
- package/pkg/web/index_bg.wasm +0 -0
- package/pkg/web/index_bg.wasm.d.ts +15 -4
- package/pkg/web/package.json +3 -3
- /package/pkg/node/snippets/{saito-wasm-785d0781d8caf60c → saito-wasm-5f70c6a4e79426c7}/js/msg_handler.js +0 -0
- /package/pkg/web/snippets/{saito-wasm-785d0781d8caf60c → saito-wasm-5f70c6a4e79426c7}/js/msg_handler.js +0 -0
package/Cargo.toml
CHANGED
package/package.json
CHANGED
package/pkg/node/index.d.ts
CHANGED
|
@@ -1,157 +1,178 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {string} private_key
|
|
4
|
+
* @param {string} json
|
|
6
5
|
* @returns {string}
|
|
7
6
|
*/
|
|
8
|
-
export function
|
|
7
|
+
export function get_script_address(json: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* @param {string} script_json
|
|
10
|
+
* @param {string} witness_json
|
|
11
|
+
* @returns {string}
|
|
12
|
+
*/
|
|
13
|
+
export function merge_witness(script_json: string, witness_json: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} public_key
|
|
16
|
+
* @returns {Promise<Array<any>>}
|
|
17
|
+
*/
|
|
18
|
+
export function get_account_slips(public_key: string): Promise<Array<any>>;
|
|
19
|
+
/**
|
|
20
|
+
* @param {Array<any>} keys
|
|
21
|
+
* @returns {Promise<WasmBalanceSnapshot>}
|
|
22
|
+
*/
|
|
23
|
+
export function get_balance_snapshot(keys: Array<any>): Promise<WasmBalanceSnapshot>;
|
|
9
24
|
/**
|
|
10
25
|
* @param {bigint} threshold
|
|
11
26
|
* @returns {Promise<void>}
|
|
12
27
|
*/
|
|
13
28
|
export function write_issuance_file(threshold: bigint): Promise<void>;
|
|
14
29
|
/**
|
|
15
|
-
* @param {bigint} peer_id
|
|
16
|
-
* @param {string} public_key
|
|
17
30
|
* @returns {Promise<void>}
|
|
18
31
|
*/
|
|
19
|
-
export function
|
|
32
|
+
export function disable_producing_blocks_by_timer(): Promise<void>;
|
|
20
33
|
/**
|
|
34
|
+
* @returns {Promise<void>}
|
|
35
|
+
*/
|
|
36
|
+
export function enable_producing_blocks_by_timer(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* @param {(Uint8Array)[] | undefined} [extra_txs]
|
|
39
|
+
* @returns {Promise<boolean>}
|
|
40
|
+
*/
|
|
41
|
+
export function produce_block_with_gt(extra_txs?: (Uint8Array)[]): Promise<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* @param {(Uint8Array)[] | undefined} [extra_txs]
|
|
21
44
|
* @returns {Promise<boolean>}
|
|
22
45
|
*/
|
|
23
|
-
export function produce_block_without_gt(): Promise<boolean>;
|
|
46
|
+
export function produce_block_without_gt(extra_txs?: (Uint8Array)[]): Promise<boolean>;
|
|
24
47
|
/**
|
|
25
48
|
* @param {WasmBalanceSnapshot} snapshot
|
|
26
49
|
* @returns {Promise<void>}
|
|
27
50
|
*/
|
|
28
51
|
export function update_from_balance_snapshot(snapshot: WasmBalanceSnapshot): Promise<void>;
|
|
29
52
|
/**
|
|
30
|
-
* @returns {
|
|
53
|
+
* @returns {string}
|
|
31
54
|
*/
|
|
32
|
-
export function
|
|
55
|
+
export function generate_private_key(): string;
|
|
33
56
|
/**
|
|
34
|
-
* @param {
|
|
35
|
-
* @
|
|
36
|
-
* @param {bigint} peer_id
|
|
37
|
-
* @returns {Promise<void>}
|
|
57
|
+
* @param {string} private_key
|
|
58
|
+
* @returns {string}
|
|
38
59
|
*/
|
|
39
|
-
export function
|
|
60
|
+
export function generate_public_key(private_key: string): string;
|
|
40
61
|
/**
|
|
41
|
-
* @
|
|
42
|
-
* @returns {Promise<WasmBlock>}
|
|
62
|
+
* @returns {Promise<WasmWallet>}
|
|
43
63
|
*/
|
|
44
|
-
export function
|
|
64
|
+
export function get_wallet(): Promise<WasmWallet>;
|
|
45
65
|
/**
|
|
46
|
-
* @
|
|
47
|
-
* @returns {boolean}
|
|
66
|
+
* @returns {WasmNetwork}
|
|
48
67
|
*/
|
|
49
|
-
export function
|
|
68
|
+
export function get_network(): WasmNetwork;
|
|
50
69
|
/**
|
|
51
|
-
* @
|
|
52
|
-
* @returns {string}
|
|
70
|
+
* @returns {Promise<WasmBlockchain>}
|
|
53
71
|
*/
|
|
54
|
-
export function
|
|
72
|
+
export function get_blockchain(): Promise<WasmBlockchain>;
|
|
55
73
|
/**
|
|
56
|
-
* @
|
|
57
|
-
* @returns {Promise<WasmBalanceSnapshot>}
|
|
74
|
+
* @returns {Promise<Array<any>>}
|
|
58
75
|
*/
|
|
59
|
-
export function
|
|
76
|
+
export function get_mempool_txs(): Promise<Array<any>>;
|
|
60
77
|
/**
|
|
61
|
-
* @param {
|
|
62
|
-
* @param {string} signature
|
|
63
|
-
* @param {string} public_key
|
|
78
|
+
* @param {string} key
|
|
64
79
|
* @returns {boolean}
|
|
65
80
|
*/
|
|
66
|
-
export function
|
|
81
|
+
export function isPublicKey(key: string): boolean;
|
|
67
82
|
/**
|
|
68
|
-
* @
|
|
83
|
+
* @param {string | undefined} [url]
|
|
84
|
+
* @returns {Promise<WasmNetworkPeer>}
|
|
69
85
|
*/
|
|
70
|
-
export function
|
|
86
|
+
export function create_network_peer(url?: string): Promise<WasmNetworkPeer>;
|
|
71
87
|
/**
|
|
72
|
-
* @
|
|
88
|
+
* @param {string} config_json
|
|
89
|
+
* @param {string} private_key
|
|
90
|
+
* @param {number} log_level_num
|
|
91
|
+
* @param {bigint} hasten_multiplier
|
|
92
|
+
* @param {boolean} delete_old_blocks
|
|
93
|
+
* @returns {Promise<any>}
|
|
73
94
|
*/
|
|
74
|
-
export function
|
|
95
|
+
export function initialize(config_json: string, private_key: string, log_level_num: number, hasten_multiplier: bigint, delete_old_blocks: boolean): Promise<any>;
|
|
75
96
|
/**
|
|
76
|
-
* @
|
|
77
|
-
* @returns {Promise<void>}
|
|
97
|
+
* @returns {Promise<Array<any>>}
|
|
78
98
|
*/
|
|
79
|
-
export function
|
|
99
|
+
export function get_nft_list(): Promise<Array<any>>;
|
|
80
100
|
/**
|
|
81
|
-
* @
|
|
101
|
+
* @param {bigint} duration_in_ms
|
|
102
|
+
* @returns {Promise<void>}
|
|
82
103
|
*/
|
|
83
|
-
export function
|
|
104
|
+
export function process_timer_event(duration_in_ms: bigint): Promise<void>;
|
|
84
105
|
/**
|
|
85
|
-
* @param {bigint}
|
|
86
|
-
* @param {string} public_key
|
|
106
|
+
* @param {bigint} current_time
|
|
87
107
|
* @returns {Promise<void>}
|
|
88
108
|
*/
|
|
89
|
-
export function
|
|
109
|
+
export function process_stat_interval(current_time: bigint): Promise<void>;
|
|
90
110
|
/**
|
|
91
|
-
* @param {
|
|
92
|
-
* @
|
|
93
|
-
* @returns {Promise<void>}
|
|
111
|
+
* @param {Uint8Array} buffer
|
|
112
|
+
* @returns {string}
|
|
94
113
|
*/
|
|
95
|
-
export function
|
|
114
|
+
export function hash(buffer: Uint8Array): string;
|
|
96
115
|
/**
|
|
116
|
+
* @param {Uint8Array} buffer
|
|
97
117
|
* @param {string} private_key
|
|
98
118
|
* @returns {string}
|
|
99
119
|
*/
|
|
100
|
-
export function
|
|
120
|
+
export function sign_buffer(buffer: Uint8Array, private_key: string): string;
|
|
101
121
|
/**
|
|
102
|
-
* @param {
|
|
103
|
-
* @
|
|
122
|
+
* @param {Uint8Array} buffer
|
|
123
|
+
* @param {string} signature
|
|
124
|
+
* @param {string} public_key
|
|
125
|
+
* @returns {boolean}
|
|
104
126
|
*/
|
|
105
|
-
export function
|
|
127
|
+
export function verify_signature(buffer: Uint8Array, signature: string, public_key: string): boolean;
|
|
106
128
|
/**
|
|
107
|
-
* @
|
|
129
|
+
* @param {string} json
|
|
130
|
+
* @returns {Promise<number>}
|
|
108
131
|
*/
|
|
109
|
-
export function
|
|
132
|
+
export function evaluate_script(json: string): Promise<number>;
|
|
110
133
|
/**
|
|
111
|
-
* @param {
|
|
112
|
-
* @param {
|
|
113
|
-
* @
|
|
114
|
-
* @param {bigint} peer_id
|
|
115
|
-
* @returns {Promise<void>}
|
|
134
|
+
* @param {string} json
|
|
135
|
+
* @param {WasmTransaction} tx
|
|
136
|
+
* @returns {Promise<number>}
|
|
116
137
|
*/
|
|
117
|
-
export function
|
|
138
|
+
export function evaluate_script_with_transaction(json: string, tx: WasmTransaction): Promise<number>;
|
|
118
139
|
/**
|
|
119
140
|
* @param {string} json
|
|
120
|
-
* @returns {
|
|
141
|
+
* @returns {string}
|
|
121
142
|
*/
|
|
122
|
-
export function
|
|
143
|
+
export function get_script_hash(json: string): string;
|
|
123
144
|
/**
|
|
124
|
-
* @
|
|
125
|
-
* @returns {Promise<void>}
|
|
145
|
+
* @returns {Promise<string>}
|
|
126
146
|
*/
|
|
127
|
-
export function
|
|
147
|
+
export function get_latest_block_hash(): Promise<string>;
|
|
128
148
|
/**
|
|
129
|
-
* @param {string}
|
|
130
|
-
* @returns {Promise<
|
|
149
|
+
* @param {string} block_hash
|
|
150
|
+
* @returns {Promise<WasmBlock>}
|
|
131
151
|
*/
|
|
132
|
-
export function
|
|
152
|
+
export function get_block(block_hash: string): Promise<WasmBlock>;
|
|
133
153
|
/**
|
|
134
|
-
* @param {
|
|
135
|
-
* @param {
|
|
136
|
-
* @
|
|
137
|
-
* @param {bigint} hasten_multiplier
|
|
138
|
-
* @param {boolean} delete_old_blocks
|
|
139
|
-
* @returns {Promise<any>}
|
|
154
|
+
* @param {bigint} peer_id
|
|
155
|
+
* @param {boolean} initiate_handshake
|
|
156
|
+
* @returns {Promise<void>}
|
|
140
157
|
*/
|
|
141
|
-
export function
|
|
158
|
+
export function process_new_peer(peer_id: bigint, initiate_handshake: boolean): Promise<void>;
|
|
142
159
|
/**
|
|
143
|
-
* @
|
|
160
|
+
* @param {bigint} peer_id
|
|
161
|
+
* @param {string} public_key
|
|
162
|
+
* @returns {Promise<void>}
|
|
144
163
|
*/
|
|
145
|
-
export function
|
|
164
|
+
export function process_stun_peer(peer_id: bigint, public_key: string): Promise<void>;
|
|
146
165
|
/**
|
|
147
|
-
* @param {bigint}
|
|
166
|
+
* @param {bigint} peer_id
|
|
167
|
+
* @param {string} public_key
|
|
148
168
|
* @returns {Promise<void>}
|
|
149
169
|
*/
|
|
150
|
-
export function
|
|
170
|
+
export function remove_stun_peer(peer_id: bigint, public_key: string): Promise<void>;
|
|
151
171
|
/**
|
|
152
|
-
* @
|
|
172
|
+
* @param {bigint} peer_id
|
|
173
|
+
* @returns {Promise<void>}
|
|
153
174
|
*/
|
|
154
|
-
export function
|
|
175
|
+
export function process_peer_disconnection(peer_id: bigint): Promise<void>;
|
|
155
176
|
/**
|
|
156
177
|
* @param {Uint8Array} buffer
|
|
157
178
|
* @param {WasmNetworkPeer} peer
|
|
@@ -159,13 +180,20 @@ export function generate_private_key(): string;
|
|
|
159
180
|
*/
|
|
160
181
|
export function process_msg_buffer_from_peer(buffer: Uint8Array, peer: WasmNetworkPeer): Promise<Uint8Array>;
|
|
161
182
|
/**
|
|
162
|
-
* @
|
|
183
|
+
* @param {Uint8Array} buffer
|
|
184
|
+
* @param {Uint8Array} hash
|
|
185
|
+
* @param {bigint} block_id
|
|
186
|
+
* @param {bigint} peer_id
|
|
187
|
+
* @returns {Promise<void>}
|
|
163
188
|
*/
|
|
164
|
-
export function
|
|
189
|
+
export function process_fetched_block(buffer: Uint8Array, hash: Uint8Array, block_id: bigint, peer_id: bigint): Promise<void>;
|
|
165
190
|
/**
|
|
166
|
-
* @
|
|
191
|
+
* @param {Uint8Array} hash
|
|
192
|
+
* @param {bigint} block_id
|
|
193
|
+
* @param {bigint} peer_id
|
|
194
|
+
* @returns {Promise<void>}
|
|
167
195
|
*/
|
|
168
|
-
export function
|
|
196
|
+
export function process_failed_block_fetch(hash: Uint8Array, block_id: bigint, peer_id: bigint): Promise<void>;
|
|
169
197
|
/**
|
|
170
198
|
*/
|
|
171
199
|
export class SaitoWasm {
|
|
@@ -366,6 +394,12 @@ export class WasmBlock {
|
|
|
366
394
|
export class WasmBlockchain {
|
|
367
395
|
free(): void;
|
|
368
396
|
/**
|
|
397
|
+
* @param {number} count
|
|
398
|
+
* @param {boolean} include_offchain
|
|
399
|
+
* @returns {Promise<Array<any>>}
|
|
400
|
+
*/
|
|
401
|
+
get_blocks(count: number, include_offchain: boolean): Promise<Array<any>>;
|
|
402
|
+
/**
|
|
369
403
|
* @returns {Promise<string>}
|
|
370
404
|
*/
|
|
371
405
|
get_fork_id(): Promise<string>;
|
|
@@ -376,6 +410,12 @@ export class WasmBlockchain {
|
|
|
376
410
|
set_fork_id(hash: string): Promise<void>;
|
|
377
411
|
/**
|
|
378
412
|
* @param {bigint} block_id
|
|
413
|
+
* @param {boolean} include_transactions
|
|
414
|
+
* @returns {Promise<WasmBlock>}
|
|
415
|
+
*/
|
|
416
|
+
get_block_by_id(block_id: bigint, include_transactions: boolean): Promise<WasmBlock>;
|
|
417
|
+
/**
|
|
418
|
+
* @param {bigint} block_id
|
|
379
419
|
* @returns {Promise<Array<any>>}
|
|
380
420
|
*/
|
|
381
421
|
get_hashes_at_id(block_id: bigint): Promise<Array<any>>;
|
|
@@ -455,13 +495,19 @@ export class WasmBlockchain {
|
|
|
455
495
|
*/
|
|
456
496
|
get_lowest_acceptable_block_hash(): Promise<string>;
|
|
457
497
|
/**
|
|
458
|
-
* @returns {any}
|
|
459
|
-
*/
|
|
460
|
-
get(): any;
|
|
461
|
-
/**
|
|
462
498
|
* @returns {Promise<void>}
|
|
463
499
|
*/
|
|
464
500
|
reset(): Promise<void>;
|
|
501
|
+
/**
|
|
502
|
+
* @param {string} block_hash
|
|
503
|
+
* @param {boolean} include_transactions
|
|
504
|
+
* @returns {Promise<WasmBlock>}
|
|
505
|
+
*/
|
|
506
|
+
get_block(block_hash: string, include_transactions: boolean): Promise<WasmBlock>;
|
|
507
|
+
/**
|
|
508
|
+
* @returns {any}
|
|
509
|
+
*/
|
|
510
|
+
get(): any;
|
|
465
511
|
}
|
|
466
512
|
/**
|
|
467
513
|
*/
|
|
@@ -577,9 +623,6 @@ export class WasmNetwork {
|
|
|
577
623
|
*/
|
|
578
624
|
propagateTransaction(wtx: WasmTransaction): Promise<void>;
|
|
579
625
|
/**
|
|
580
|
-
*/
|
|
581
|
-
constructor();
|
|
582
|
-
/**
|
|
583
626
|
* @param {string} key
|
|
584
627
|
* @returns {Promise<WasmPeer | undefined>}
|
|
585
628
|
*/
|
|
@@ -589,6 +632,9 @@ export class WasmNetwork {
|
|
|
589
632
|
*/
|
|
590
633
|
getPeers(): Promise<Array<any>>;
|
|
591
634
|
/**
|
|
635
|
+
*/
|
|
636
|
+
constructor();
|
|
637
|
+
/**
|
|
592
638
|
*/
|
|
593
639
|
readonly api: WasmNetworkApi;
|
|
594
640
|
/**
|
|
@@ -630,14 +676,14 @@ export class WasmNetworkPeer {
|
|
|
630
676
|
*/
|
|
631
677
|
get_public_key(): Promise<string>;
|
|
632
678
|
/**
|
|
633
|
-
* @returns {bigint}
|
|
634
|
-
*/
|
|
635
|
-
get_id(): bigint;
|
|
636
|
-
/**
|
|
637
679
|
* @returns {Promise<string>}
|
|
638
680
|
*/
|
|
639
681
|
get_url(): Promise<string>;
|
|
640
682
|
/**
|
|
683
|
+
* @returns {bigint}
|
|
684
|
+
*/
|
|
685
|
+
get_id(): bigint;
|
|
686
|
+
/**
|
|
641
687
|
* @param {bigint} peer_id
|
|
642
688
|
*/
|
|
643
689
|
constructor(peer_id: bigint);
|
|
@@ -652,12 +698,21 @@ export class WasmPeer {
|
|
|
652
698
|
*/
|
|
653
699
|
has_service(service: string): boolean;
|
|
654
700
|
/**
|
|
701
|
+
*/
|
|
702
|
+
readonly host: string;
|
|
703
|
+
/**
|
|
655
704
|
*/
|
|
656
705
|
readonly id: bigint;
|
|
657
706
|
/**
|
|
658
707
|
*/
|
|
659
708
|
readonly key_list: Array<any>;
|
|
660
709
|
/**
|
|
710
|
+
*/
|
|
711
|
+
readonly port: number;
|
|
712
|
+
/**
|
|
713
|
+
*/
|
|
714
|
+
readonly protocol: string;
|
|
715
|
+
/**
|
|
661
716
|
*/
|
|
662
717
|
readonly public_key: string;
|
|
663
718
|
/**
|
|
@@ -748,6 +803,10 @@ export class WasmSlip {
|
|
|
748
803
|
export class WasmTransaction {
|
|
749
804
|
free(): void;
|
|
750
805
|
/**
|
|
806
|
+
* @returns {Promise<void>}
|
|
807
|
+
*/
|
|
808
|
+
sign(): Promise<void>;
|
|
809
|
+
/**
|
|
751
810
|
* @param {WasmSlip} slip
|
|
752
811
|
*/
|
|
753
812
|
add_to_slip(slip: WasmSlip): void;
|
|
@@ -771,10 +830,6 @@ export class WasmTransaction {
|
|
|
771
830
|
*/
|
|
772
831
|
constructor();
|
|
773
832
|
/**
|
|
774
|
-
* @returns {Promise<void>}
|
|
775
|
-
*/
|
|
776
|
-
sign(): Promise<void>;
|
|
777
|
-
/**
|
|
778
833
|
* @param {string} key
|
|
779
834
|
* @returns {boolean}
|
|
780
835
|
*/
|
|
@@ -950,10 +1005,6 @@ export class WasmWallet {
|
|
|
950
1005
|
*/
|
|
951
1006
|
createAtomizeBoundTransaction(slip1_utxo_key: string, slip2_utxo_key: string, slip3_utxo_key: string, tx_msg: Uint8Array): Promise<WasmTransaction>;
|
|
952
1007
|
/**
|
|
953
|
-
* @returns {any}
|
|
954
|
-
*/
|
|
955
|
-
get(): any;
|
|
956
|
-
/**
|
|
957
1008
|
* @param {Array<any>} public_keys
|
|
958
1009
|
* @param {BigUint64Array} amounts
|
|
959
1010
|
* @param {bigint} fee
|
|
@@ -993,6 +1044,10 @@ export class WasmWallet {
|
|
|
993
1044
|
* @returns {Promise<Array<any>>}
|
|
994
1045
|
*/
|
|
995
1046
|
get_slips(): Promise<Array<any>>;
|
|
1047
|
+
/**
|
|
1048
|
+
* @returns {any}
|
|
1049
|
+
*/
|
|
1050
|
+
get(): any;
|
|
996
1051
|
}
|
|
997
1052
|
/**
|
|
998
1053
|
*/
|