@provablehq/wasm 0.7.3 → 0.8.2
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/README.md +1 -2
- package/dist/mainnet/aleo_wasm.d.ts +1713 -2159
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.d.ts +1 -25
- package/dist/mainnet/index.js +3058 -3056
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +2896 -2827
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +1713 -2159
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.d.ts +1 -25
- package/dist/testnet/index.js +3058 -3056
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +2895 -2826
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +6 -5
- package/dist/mainnet/aleo_wasm.js +0 -6344
- package/dist/mainnet/aleo_wasm.js.map +0 -1
- package/dist/mainnet/aleo_wasm_init.d.ts +0 -17
- package/dist/testnet/aleo_wasm.js +0 -6344
- package/dist/testnet/aleo_wasm.js.map +0 -1
- package/dist/testnet/aleo_wasm_init.d.ts +0 -17
|
@@ -1,2515 +1,2069 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* Verify an execution with a single function and a single transition. Executions with multiple
|
|
5
|
-
* transitions or functions will fail to verify. Also, this does not verify that the state root of
|
|
6
|
-
* the execution is included in the Aleo Network ledger.
|
|
7
|
-
*
|
|
8
|
-
* @param {Execution} execution The function execution to verify
|
|
9
|
-
* @param {VerifyingKey} verifying_key The verifying key for the function
|
|
10
|
-
* @param {Program} program The program that the function execution belongs to
|
|
11
|
-
* @param {String} function_id The name of the function that was executed
|
|
12
|
-
* @returns {boolean} True if the execution is valid, false otherwise
|
|
13
|
-
|
|
14
|
-
* @param {VerifyingKey} verifying_key
|
|
15
|
-
* @param {Program} program
|
|
16
|
-
* @param {string} function_id
|
|
17
|
-
* @returns {boolean}
|
|
18
|
-
*/
|
|
4
|
+
* Verify an execution with a single function and a single transition. Executions with multiple
|
|
5
|
+
* transitions or functions will fail to verify. Also, this does not verify that the state root of
|
|
6
|
+
* the execution is included in the Aleo Network ledger.
|
|
7
|
+
*
|
|
8
|
+
* @param {Execution} execution The function execution to verify
|
|
9
|
+
* @param {VerifyingKey} verifying_key The verifying key for the function
|
|
10
|
+
* @param {Program} program The program that the function execution belongs to
|
|
11
|
+
* @param {String} function_id The name of the function that was executed
|
|
12
|
+
* @returns {boolean} True if the execution is valid, false otherwise
|
|
13
|
+
*/
|
|
19
14
|
export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* @param {number} receiver
|
|
22
|
-
*/
|
|
23
15
|
export function runRayonThread(receiver: number): void;
|
|
24
|
-
/**
|
|
25
|
-
* @param {URL} url
|
|
26
|
-
* @param {number} num_threads
|
|
27
|
-
* @returns {Promise<void>}
|
|
28
|
-
*/
|
|
29
16
|
export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
30
17
|
/**
|
|
31
|
-
* Public address of an Aleo account
|
|
32
|
-
*/
|
|
18
|
+
* Public address of an Aleo account
|
|
19
|
+
*/
|
|
33
20
|
export class Address {
|
|
21
|
+
private constructor();
|
|
34
22
|
free(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Derive an Aleo address from a private key
|
|
37
|
-
*
|
|
38
|
-
* @param {PrivateKey} private_key The private key to derive the address from
|
|
39
|
-
* @returns {Address} Address corresponding to the private key
|
|
40
|
-
|
|
41
|
-
* @returns {Address}
|
|
42
|
-
*/
|
|
23
|
+
/**
|
|
24
|
+
* Derive an Aleo address from a private key
|
|
25
|
+
*
|
|
26
|
+
* @param {PrivateKey} private_key The private key to derive the address from
|
|
27
|
+
* @returns {Address} Address corresponding to the private key
|
|
28
|
+
*/
|
|
43
29
|
static from_private_key(private_key: PrivateKey): Address;
|
|
44
|
-
/**
|
|
45
|
-
* Derive an Aleo address from a view key
|
|
46
|
-
*
|
|
47
|
-
* @param {ViewKey} view_key The view key to derive the address from
|
|
48
|
-
* @returns {Address} Address corresponding to the view key
|
|
49
|
-
|
|
50
|
-
* @returns {Address}
|
|
51
|
-
*/
|
|
30
|
+
/**
|
|
31
|
+
* Derive an Aleo address from a view key
|
|
32
|
+
*
|
|
33
|
+
* @param {ViewKey} view_key The view key to derive the address from
|
|
34
|
+
* @returns {Address} Address corresponding to the view key
|
|
35
|
+
*/
|
|
52
36
|
static from_view_key(view_key: ViewKey): Address;
|
|
53
|
-
/**
|
|
54
|
-
* Derive an Aleo address from a compute key.
|
|
55
|
-
*
|
|
56
|
-
* @param {ComputeKey} compute_key The compute key to derive the address from
|
|
57
|
-
|
|
58
|
-
* @returns {Address}
|
|
59
|
-
*/
|
|
37
|
+
/**
|
|
38
|
+
* Derive an Aleo address from a compute key.
|
|
39
|
+
*
|
|
40
|
+
* @param {ComputeKey} compute_key The compute key to derive the address from
|
|
41
|
+
*/
|
|
60
42
|
static from_compute_key(compute_key: ComputeKey): Address;
|
|
61
|
-
/**
|
|
62
|
-
* Create an aleo address object from a string representation of an address
|
|
63
|
-
*
|
|
64
|
-
* @param {string} address String representation of an addressm
|
|
65
|
-
* @returns {Address} Address
|
|
66
|
-
|
|
67
|
-
* @returns {Address}
|
|
68
|
-
*/
|
|
43
|
+
/**
|
|
44
|
+
* Create an aleo address object from a string representation of an address
|
|
45
|
+
*
|
|
46
|
+
* @param {string} address String representation of an addressm
|
|
47
|
+
* @returns {Address} Address
|
|
48
|
+
*/
|
|
69
49
|
static from_string(address: string): Address;
|
|
70
|
-
/**
|
|
71
|
-
* Get a string representation of an Aleo address object
|
|
72
|
-
*
|
|
73
|
-
* @param {Address} Address
|
|
74
|
-
* @returns {string} String representation of the address
|
|
75
|
-
|
|
76
|
-
*/
|
|
50
|
+
/**
|
|
51
|
+
* Get a string representation of an Aleo address object
|
|
52
|
+
*
|
|
53
|
+
* @param {Address} Address
|
|
54
|
+
* @returns {string} String representation of the address
|
|
55
|
+
*/
|
|
77
56
|
to_string(): string;
|
|
78
|
-
/**
|
|
79
|
-
* Verify a signature for a message signed by the address
|
|
80
|
-
*
|
|
81
|
-
* @param {Uint8Array} Byte array representing a message signed by the address
|
|
82
|
-
* @returns {boolean} Boolean representing whether or not the signature is valid
|
|
83
|
-
|
|
84
|
-
* @param {Signature} signature
|
|
85
|
-
* @returns {boolean}
|
|
86
|
-
*/
|
|
57
|
+
/**
|
|
58
|
+
* Verify a signature for a message signed by the address
|
|
59
|
+
*
|
|
60
|
+
* @param {Uint8Array} Byte array representing a message signed by the address
|
|
61
|
+
* @returns {boolean} Boolean representing whether or not the signature is valid
|
|
62
|
+
*/
|
|
87
63
|
verify(message: Uint8Array, signature: Signature): boolean;
|
|
88
64
|
}
|
|
89
65
|
/**
|
|
90
|
-
* SnarkVM Ciphertext object. A Ciphertext represents an symmetrically encrypted plaintext. This
|
|
91
|
-
* object provides decryption methods to recover the plaintext from the ciphertext (given the
|
|
92
|
-
* api consumer has the proper decryption materials).
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
*/
|
|
66
|
+
* SnarkVM Ciphertext object. A Ciphertext represents an symmetrically encrypted plaintext. This
|
|
67
|
+
* object provides decryption methods to recover the plaintext from the ciphertext (given the
|
|
68
|
+
* api consumer has the proper decryption materials).
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
*/
|
|
96
72
|
export class Ciphertext {
|
|
73
|
+
private constructor();
|
|
97
74
|
free(): void;
|
|
98
|
-
/**
|
|
99
|
-
* Decrypt the ciphertext using the given view key.
|
|
100
|
-
*
|
|
101
|
-
* @param {ViewKey} The view key of the account that encrypted the ciphertext.
|
|
102
|
-
* @param {Group} The nonce used to encrypt the ciphertext.
|
|
103
|
-
*
|
|
104
|
-
* @returns {Plaintext} The decrypted plaintext.
|
|
105
|
-
|
|
106
|
-
* @param {Group} nonce
|
|
107
|
-
* @returns {Plaintext}
|
|
108
|
-
*/
|
|
75
|
+
/**
|
|
76
|
+
* Decrypt the ciphertext using the given view key.
|
|
77
|
+
*
|
|
78
|
+
* @param {ViewKey} The view key of the account that encrypted the ciphertext.
|
|
79
|
+
* @param {Group} The nonce used to encrypt the ciphertext.
|
|
80
|
+
*
|
|
81
|
+
* @returns {Plaintext} The decrypted plaintext.
|
|
82
|
+
*/
|
|
109
83
|
decrypt(view_key: ViewKey, nonce: Group): Plaintext;
|
|
110
|
-
/**
|
|
111
|
-
* Decrypts a ciphertext into plaintext using the given transition view key.
|
|
112
|
-
*
|
|
113
|
-
* @param {Field} transition_view_key The transition view key that was used to encrypt the ciphertext.
|
|
114
|
-
*
|
|
115
|
-
* @returns {Plaintext} The decrypted plaintext.
|
|
116
|
-
|
|
117
|
-
* @returns {Plaintext}
|
|
118
|
-
*/
|
|
84
|
+
/**
|
|
85
|
+
* Decrypts a ciphertext into plaintext using the given transition view key.
|
|
86
|
+
*
|
|
87
|
+
* @param {Field} transition_view_key The transition view key that was used to encrypt the ciphertext.
|
|
88
|
+
*
|
|
89
|
+
* @returns {Plaintext} The decrypted plaintext.
|
|
90
|
+
*/
|
|
119
91
|
decryptSymmetric(transition_view_key: Field): Plaintext;
|
|
120
|
-
/**
|
|
121
|
-
* Deserialize a left endian byte array into a Ciphertext.
|
|
122
|
-
*
|
|
123
|
-
* @param {Uint8Array} bytes The byte array representing the Ciphertext.
|
|
124
|
-
*
|
|
125
|
-
* @returns {Ciphertext} The Ciphertext object.
|
|
126
|
-
|
|
127
|
-
* @returns {Ciphertext}
|
|
128
|
-
*/
|
|
92
|
+
/**
|
|
93
|
+
* Deserialize a left endian byte array into a Ciphertext.
|
|
94
|
+
*
|
|
95
|
+
* @param {Uint8Array} bytes The byte array representing the Ciphertext.
|
|
96
|
+
*
|
|
97
|
+
* @returns {Ciphertext} The Ciphertext object.
|
|
98
|
+
*/
|
|
129
99
|
static fromBytesLe(bytes: Uint8Array): Ciphertext;
|
|
130
|
-
/**
|
|
131
|
-
* Deserialize a Ciphertext string into a Ciphertext object.
|
|
132
|
-
*
|
|
133
|
-
* @param {string} ciphertext A string representation of the ciphertext.
|
|
134
|
-
*
|
|
135
|
-
* @returns {Ciphertext} The Ciphertext object.
|
|
136
|
-
|
|
137
|
-
* @returns {Ciphertext}
|
|
138
|
-
*/
|
|
100
|
+
/**
|
|
101
|
+
* Deserialize a Ciphertext string into a Ciphertext object.
|
|
102
|
+
*
|
|
103
|
+
* @param {string} ciphertext A string representation of the ciphertext.
|
|
104
|
+
*
|
|
105
|
+
* @returns {Ciphertext} The Ciphertext object.
|
|
106
|
+
*/
|
|
139
107
|
static fromString(ciphertext: string): Ciphertext;
|
|
140
|
-
/**
|
|
141
|
-
* Serialize a Ciphertext object into a byte array.
|
|
142
|
-
*
|
|
143
|
-
* @returns {Uint8Array} The serialized Ciphertext.
|
|
144
|
-
|
|
145
|
-
*/
|
|
108
|
+
/**
|
|
109
|
+
* Serialize a Ciphertext object into a byte array.
|
|
110
|
+
*
|
|
111
|
+
* @returns {Uint8Array} The serialized Ciphertext.
|
|
112
|
+
*/
|
|
146
113
|
toBytes(): Uint8Array;
|
|
147
|
-
/**
|
|
148
|
-
* Serialize a Ciphertext into a js string.
|
|
149
|
-
*
|
|
150
|
-
* @returns {string} The serialized Ciphertext.
|
|
151
|
-
|
|
152
|
-
*/
|
|
114
|
+
/**
|
|
115
|
+
* Serialize a Ciphertext into a js string.
|
|
116
|
+
*
|
|
117
|
+
* @returns {string} The serialized Ciphertext.
|
|
118
|
+
*/
|
|
153
119
|
toString(): string;
|
|
154
120
|
}
|
|
155
|
-
/**
|
|
156
|
-
*/
|
|
157
121
|
export class ComputeKey {
|
|
122
|
+
private constructor();
|
|
158
123
|
free(): void;
|
|
159
|
-
/**
|
|
160
|
-
* Create a new compute key from a private key.
|
|
161
|
-
*
|
|
162
|
-
* @param {PrivateKey} private_key Private key
|
|
163
|
-
*
|
|
164
|
-
* @returns {ComputeKey} Compute key
|
|
165
|
-
|
|
166
|
-
* @returns {ComputeKey}
|
|
167
|
-
*/
|
|
124
|
+
/**
|
|
125
|
+
* Create a new compute key from a private key.
|
|
126
|
+
*
|
|
127
|
+
* @param {PrivateKey} private_key Private key
|
|
128
|
+
*
|
|
129
|
+
* @returns {ComputeKey} Compute key
|
|
130
|
+
*/
|
|
168
131
|
static from_private_key(private_key: PrivateKey): ComputeKey;
|
|
169
|
-
/**
|
|
170
|
-
* Get the address from the compute key.
|
|
171
|
-
*
|
|
172
|
-
* @returns {Address}
|
|
173
|
-
|
|
174
|
-
*/
|
|
132
|
+
/**
|
|
133
|
+
* Get the address from the compute key.
|
|
134
|
+
*
|
|
135
|
+
* @returns {Address}
|
|
136
|
+
*/
|
|
175
137
|
address(): Address;
|
|
176
|
-
/**
|
|
177
|
-
* Get the sk_prf of the compute key.
|
|
178
|
-
*
|
|
179
|
-
* @returns {Scalar} sk_prf
|
|
180
|
-
|
|
181
|
-
*/
|
|
138
|
+
/**
|
|
139
|
+
* Get the sk_prf of the compute key.
|
|
140
|
+
*
|
|
141
|
+
* @returns {Scalar} sk_prf
|
|
142
|
+
*/
|
|
182
143
|
sk_prf(): Scalar;
|
|
183
|
-
/**
|
|
184
|
-
* Get the pr_tag of the compute key.
|
|
185
|
-
*
|
|
186
|
-
* @returns {Group} pr_tag
|
|
187
|
-
|
|
188
|
-
*/
|
|
144
|
+
/**
|
|
145
|
+
* Get the pr_tag of the compute key.
|
|
146
|
+
*
|
|
147
|
+
* @returns {Group} pr_tag
|
|
148
|
+
*/
|
|
189
149
|
pk_sig(): Group;
|
|
190
|
-
/**
|
|
191
|
-
* Get the pr_sig of the compute key.
|
|
192
|
-
*
|
|
193
|
-
* @returns {Group} pr_sig
|
|
194
|
-
|
|
195
|
-
*/
|
|
150
|
+
/**
|
|
151
|
+
* Get the pr_sig of the compute key.
|
|
152
|
+
*
|
|
153
|
+
* @returns {Group} pr_sig
|
|
154
|
+
*/
|
|
196
155
|
pr_sig(): Group;
|
|
197
156
|
}
|
|
198
157
|
/**
|
|
199
|
-
* Execution of an Aleo program.
|
|
200
|
-
*/
|
|
158
|
+
* Execution of an Aleo program.
|
|
159
|
+
*/
|
|
201
160
|
export class Execution {
|
|
161
|
+
private constructor();
|
|
202
162
|
free(): void;
|
|
203
|
-
/**
|
|
204
|
-
* Returns the string representation of the execution.
|
|
205
|
-
*
|
|
206
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Returns the string representation of the execution.
|
|
165
|
+
*
|
|
166
|
+
* @returns {string} The string representation of the execution.
|
|
167
|
+
*/
|
|
207
168
|
toString(): string;
|
|
208
|
-
/**
|
|
209
|
-
* Creates an execution object from a string representation of an execution.
|
|
210
|
-
*
|
|
211
|
-
* @returns {Execution}
|
|
212
|
-
*/
|
|
169
|
+
/**
|
|
170
|
+
* Creates an execution object from a string representation of an execution.
|
|
171
|
+
*
|
|
172
|
+
* @returns {Execution | Error} The wasm representation of an execution object.
|
|
173
|
+
*/
|
|
213
174
|
static fromString(execution: string): Execution;
|
|
175
|
+
/**
|
|
176
|
+
* Returns the global state root of the execution.
|
|
177
|
+
*
|
|
178
|
+
* @returns {Execution | Error} The global state root used in the execution.
|
|
179
|
+
*/
|
|
180
|
+
globalStateRoot(): string;
|
|
181
|
+
/**
|
|
182
|
+
* Returns the proof of the execution.
|
|
183
|
+
*
|
|
184
|
+
* @returns {string} The execution proof.
|
|
185
|
+
*/
|
|
186
|
+
proof(): string;
|
|
187
|
+
/**
|
|
188
|
+
* Returns the transitions present in the execution.
|
|
189
|
+
*
|
|
190
|
+
* @returns Array<Transition> the array of transitions present in the execution.
|
|
191
|
+
*/
|
|
192
|
+
transitions(): Array<any>;
|
|
214
193
|
}
|
|
215
194
|
/**
|
|
216
|
-
* Webassembly Representation of an Aleo function execution response
|
|
217
|
-
*
|
|
218
|
-
* This object is returned by the execution of an Aleo function off-chain. It provides methods for
|
|
219
|
-
* retrieving the outputs of the function execution.
|
|
220
|
-
*/
|
|
195
|
+
* Webassembly Representation of an Aleo function execution response
|
|
196
|
+
*
|
|
197
|
+
* This object is returned by the execution of an Aleo function off-chain. It provides methods for
|
|
198
|
+
* retrieving the outputs of the function execution.
|
|
199
|
+
*/
|
|
221
200
|
export class ExecutionResponse {
|
|
201
|
+
private constructor();
|
|
222
202
|
free(): void;
|
|
223
|
-
/**
|
|
224
|
-
* Get the outputs of the executed function
|
|
225
|
-
*
|
|
226
|
-
* @returns {Array} Array of strings representing the outputs of the function
|
|
227
|
-
|
|
228
|
-
*/
|
|
203
|
+
/**
|
|
204
|
+
* Get the outputs of the executed function
|
|
205
|
+
*
|
|
206
|
+
* @returns {Array} Array of strings representing the outputs of the function
|
|
207
|
+
*/
|
|
229
208
|
getOutputs(): Array<any>;
|
|
230
|
-
/**
|
|
231
|
-
* Returns the execution object if present, null if otherwise.
|
|
232
|
-
*
|
|
233
|
-
* @returns {Execution | undefined} The execution object if present, null if otherwise
|
|
234
|
-
|
|
235
|
-
*/
|
|
209
|
+
/**
|
|
210
|
+
* Returns the execution object if present, null if otherwise.
|
|
211
|
+
*
|
|
212
|
+
* @returns {Execution | undefined} The execution object if present, null if otherwise
|
|
213
|
+
*/
|
|
236
214
|
getExecution(): Execution | undefined;
|
|
237
|
-
/**
|
|
238
|
-
* Returns the program keys if present
|
|
239
|
-
|
|
240
|
-
*/
|
|
215
|
+
/**
|
|
216
|
+
* Returns the program keys if present
|
|
217
|
+
*/
|
|
241
218
|
getKeys(): KeyPair;
|
|
242
|
-
/**
|
|
243
|
-
* Returns the proving_key if the proving key was cached in the Execution response.
|
|
244
|
-
* Note the proving key is removed from the response object after the first call to this
|
|
245
|
-
* function. Subsequent calls will return null.
|
|
246
|
-
*
|
|
247
|
-
* @returns {ProvingKey | undefined} The proving key
|
|
248
|
-
|
|
249
|
-
*/
|
|
219
|
+
/**
|
|
220
|
+
* Returns the proving_key if the proving key was cached in the Execution response.
|
|
221
|
+
* Note the proving key is removed from the response object after the first call to this
|
|
222
|
+
* function. Subsequent calls will return null.
|
|
223
|
+
*
|
|
224
|
+
* @returns {ProvingKey | undefined} The proving key
|
|
225
|
+
*/
|
|
250
226
|
getProvingKey(): ProvingKey | undefined;
|
|
251
|
-
/**
|
|
252
|
-
* Returns the verifying_key associated with the program
|
|
253
|
-
*
|
|
254
|
-
* @returns {VerifyingKey} The verifying key
|
|
255
|
-
|
|
256
|
-
*/
|
|
227
|
+
/**
|
|
228
|
+
* Returns the verifying_key associated with the program
|
|
229
|
+
*
|
|
230
|
+
* @returns {VerifyingKey} The verifying key
|
|
231
|
+
*/
|
|
257
232
|
getVerifyingKey(): VerifyingKey;
|
|
258
|
-
/**
|
|
259
|
-
* Returns the function identifier
|
|
260
|
-
|
|
261
|
-
*/
|
|
233
|
+
/**
|
|
234
|
+
* Returns the function identifier
|
|
235
|
+
*/
|
|
262
236
|
getFunctionId(): string;
|
|
263
|
-
/**
|
|
264
|
-
* Returns the program
|
|
265
|
-
|
|
266
|
-
*/
|
|
237
|
+
/**
|
|
238
|
+
* Returns the program
|
|
239
|
+
*/
|
|
267
240
|
getProgram(): Program;
|
|
268
241
|
}
|
|
269
242
|
/**
|
|
270
|
-
* Field element.
|
|
271
|
-
*/
|
|
243
|
+
* Field element.
|
|
244
|
+
*/
|
|
272
245
|
export class Field {
|
|
246
|
+
private constructor();
|
|
273
247
|
free(): void;
|
|
274
|
-
/**
|
|
275
|
-
* Creates a field object from a string representation of a field.
|
|
276
|
-
|
|
277
|
-
* @returns {Field}
|
|
278
|
-
*/
|
|
248
|
+
/**
|
|
249
|
+
* Creates a field object from a string representation of a field.
|
|
250
|
+
*/
|
|
279
251
|
static fromString(field: string): Field;
|
|
280
|
-
/**
|
|
281
|
-
* Create a plaintext element from a group element.
|
|
282
|
-
|
|
283
|
-
*/
|
|
252
|
+
/**
|
|
253
|
+
* Create a plaintext element from a group element.
|
|
254
|
+
*/
|
|
284
255
|
toPlaintext(): Plaintext;
|
|
285
|
-
/**
|
|
286
|
-
* Returns the string representation of the field.
|
|
287
|
-
|
|
288
|
-
*/
|
|
256
|
+
/**
|
|
257
|
+
* Returns the string representation of the field.
|
|
258
|
+
*/
|
|
289
259
|
toString(): string;
|
|
290
|
-
/**
|
|
291
|
-
* Generate a random field element.
|
|
292
|
-
|
|
293
|
-
*/
|
|
260
|
+
/**
|
|
261
|
+
* Generate a random field element.
|
|
262
|
+
*/
|
|
294
263
|
static random(): Field;
|
|
295
|
-
/**
|
|
296
|
-
* Add two field elements.
|
|
297
|
-
|
|
298
|
-
* @returns {Field}
|
|
299
|
-
*/
|
|
264
|
+
/**
|
|
265
|
+
* Add two field elements.
|
|
266
|
+
*/
|
|
300
267
|
add(other: Field): Field;
|
|
301
|
-
/**
|
|
302
|
-
* Subtract two field elements.
|
|
303
|
-
|
|
304
|
-
* @returns {Field}
|
|
305
|
-
*/
|
|
268
|
+
/**
|
|
269
|
+
* Subtract two field elements.
|
|
270
|
+
*/
|
|
306
271
|
subtract(other: Field): Field;
|
|
307
|
-
/**
|
|
308
|
-
* Multiply two field elements.
|
|
309
|
-
|
|
310
|
-
* @returns {Field}
|
|
311
|
-
*/
|
|
272
|
+
/**
|
|
273
|
+
* Multiply two field elements.
|
|
274
|
+
*/
|
|
312
275
|
multiply(other: Field): Field;
|
|
313
|
-
/**
|
|
314
|
-
* Divide two field elements.
|
|
315
|
-
|
|
316
|
-
* @returns {Field}
|
|
317
|
-
*/
|
|
276
|
+
/**
|
|
277
|
+
* Divide two field elements.
|
|
278
|
+
*/
|
|
318
279
|
divide(other: Field): Field;
|
|
319
|
-
/**
|
|
320
|
-
* Power of a field element.
|
|
321
|
-
|
|
322
|
-
* @returns {Field}
|
|
323
|
-
*/
|
|
280
|
+
/**
|
|
281
|
+
* Power of a field element.
|
|
282
|
+
*/
|
|
324
283
|
pow(other: Field): Field;
|
|
325
|
-
/**
|
|
326
|
-
* Invert the field element.
|
|
327
|
-
|
|
328
|
-
*/
|
|
284
|
+
/**
|
|
285
|
+
* Invert the field element.
|
|
286
|
+
*/
|
|
329
287
|
inverse(): Field;
|
|
330
|
-
/**
|
|
331
|
-
* Get the zero element of the field.
|
|
332
|
-
|
|
333
|
-
*/
|
|
288
|
+
/**
|
|
289
|
+
* Get the zero element of the field.
|
|
290
|
+
*/
|
|
334
291
|
static zero(): Field;
|
|
335
|
-
/**
|
|
336
|
-
* Get the one element of the field.
|
|
337
|
-
|
|
338
|
-
*/
|
|
292
|
+
/**
|
|
293
|
+
* Get the one element of the field.
|
|
294
|
+
*/
|
|
339
295
|
static one(): Field;
|
|
340
|
-
/**
|
|
341
|
-
* Double the field element.
|
|
342
|
-
|
|
343
|
-
*/
|
|
296
|
+
/**
|
|
297
|
+
* Double the field element.
|
|
298
|
+
*/
|
|
344
299
|
double(): Field;
|
|
345
|
-
/**
|
|
346
|
-
* Check if one field element equals another.
|
|
347
|
-
|
|
348
|
-
* @returns {boolean}
|
|
349
|
-
*/
|
|
300
|
+
/**
|
|
301
|
+
* Check if one field element equals another.
|
|
302
|
+
*/
|
|
350
303
|
equals(other: Field): boolean;
|
|
351
304
|
}
|
|
352
|
-
/**
|
|
353
|
-
*/
|
|
354
305
|
export class GraphKey {
|
|
306
|
+
private constructor();
|
|
355
307
|
free(): void;
|
|
356
|
-
/**
|
|
357
|
-
* Create a new graph key from a view key.
|
|
358
|
-
*
|
|
359
|
-
* @param {ViewKey} view_key View key
|
|
360
|
-
* @returns {GraphKey} Graph key
|
|
361
|
-
|
|
362
|
-
* @returns {GraphKey}
|
|
363
|
-
*/
|
|
308
|
+
/**
|
|
309
|
+
* Create a new graph key from a view key.
|
|
310
|
+
*
|
|
311
|
+
* @param {ViewKey} view_key View key
|
|
312
|
+
* @returns {GraphKey} Graph key
|
|
313
|
+
*/
|
|
364
314
|
static from_view_key(view_key: ViewKey): GraphKey;
|
|
365
|
-
/**
|
|
366
|
-
* Create a new graph key from a string representation of a graph key
|
|
367
|
-
*
|
|
368
|
-
* @param {string} graph_key String representation of a graph key
|
|
369
|
-
* @returns {GraphKey} Graph key
|
|
370
|
-
|
|
371
|
-
* @returns {GraphKey}
|
|
372
|
-
*/
|
|
315
|
+
/**
|
|
316
|
+
* Create a new graph key from a string representation of a graph key
|
|
317
|
+
*
|
|
318
|
+
* @param {string} graph_key String representation of a graph key
|
|
319
|
+
* @returns {GraphKey} Graph key
|
|
320
|
+
*/
|
|
373
321
|
static from_string(graph_key: string): GraphKey;
|
|
374
|
-
/**
|
|
375
|
-
* Get a string representation of a graph key
|
|
376
|
-
*
|
|
377
|
-
* @returns {string} String representation of a graph key
|
|
378
|
-
|
|
379
|
-
*/
|
|
322
|
+
/**
|
|
323
|
+
* Get a string representation of a graph key
|
|
324
|
+
*
|
|
325
|
+
* @returns {string} String representation of a graph key
|
|
326
|
+
*/
|
|
380
327
|
to_string(): string;
|
|
381
|
-
/**
|
|
382
|
-
* Get the sk_tag of the graph key. Used to determine ownership of records.
|
|
383
|
-
|
|
384
|
-
*/
|
|
328
|
+
/**
|
|
329
|
+
* Get the sk_tag of the graph key. Used to determine ownership of records.
|
|
330
|
+
*/
|
|
385
331
|
sk_tag(): Field;
|
|
386
332
|
}
|
|
387
333
|
/**
|
|
388
|
-
* Elliptic curve element.
|
|
389
|
-
*/
|
|
334
|
+
* Elliptic curve element.
|
|
335
|
+
*/
|
|
390
336
|
export class Group {
|
|
337
|
+
private constructor();
|
|
391
338
|
free(): void;
|
|
392
|
-
/**
|
|
393
|
-
* Creates a group object from a string representation of a group.
|
|
394
|
-
|
|
395
|
-
* @returns {Group}
|
|
396
|
-
*/
|
|
339
|
+
/**
|
|
340
|
+
* Creates a group object from a string representation of a group.
|
|
341
|
+
*/
|
|
397
342
|
static fromString(group: string): Group;
|
|
398
|
-
/**
|
|
399
|
-
* Returns the string representation of the group.
|
|
400
|
-
|
|
401
|
-
*/
|
|
343
|
+
/**
|
|
344
|
+
* Returns the string representation of the group.
|
|
345
|
+
*/
|
|
402
346
|
toString(): string;
|
|
403
|
-
/**
|
|
404
|
-
* Get the x-coordinate of the group element.
|
|
405
|
-
|
|
406
|
-
*/
|
|
347
|
+
/**
|
|
348
|
+
* Get the x-coordinate of the group element.
|
|
349
|
+
*/
|
|
407
350
|
toXCoordinate(): Field;
|
|
408
|
-
/**
|
|
409
|
-
* Create a plaintext element from a group element.
|
|
410
|
-
|
|
411
|
-
*/
|
|
351
|
+
/**
|
|
352
|
+
* Create a plaintext element from a group element.
|
|
353
|
+
*/
|
|
412
354
|
toPlaintext(): Plaintext;
|
|
413
|
-
/**
|
|
414
|
-
* Generate a random group element.
|
|
415
|
-
|
|
416
|
-
*/
|
|
355
|
+
/**
|
|
356
|
+
* Generate a random group element.
|
|
357
|
+
*/
|
|
417
358
|
static random(): Group;
|
|
418
|
-
/**
|
|
419
|
-
* Add two group elements.
|
|
420
|
-
|
|
421
|
-
* @returns {Group}
|
|
422
|
-
*/
|
|
359
|
+
/**
|
|
360
|
+
* Add two group elements.
|
|
361
|
+
*/
|
|
423
362
|
add(other: Group): Group;
|
|
424
|
-
/**
|
|
425
|
-
* Subtract two group elements (equivalently: add the inverse of an element).
|
|
426
|
-
|
|
427
|
-
* @returns {Group}
|
|
428
|
-
*/
|
|
363
|
+
/**
|
|
364
|
+
* Subtract two group elements (equivalently: add the inverse of an element).
|
|
365
|
+
*/
|
|
429
366
|
subtract(other: Group): Group;
|
|
430
|
-
/**
|
|
431
|
-
* Multiply a group element by a scalar element.
|
|
432
|
-
|
|
433
|
-
* @returns {Group}
|
|
434
|
-
*/
|
|
367
|
+
/**
|
|
368
|
+
* Multiply a group element by a scalar element.
|
|
369
|
+
*/
|
|
435
370
|
scalarMultiply(scalar: Scalar): Group;
|
|
436
|
-
/**
|
|
437
|
-
* Double the group element.
|
|
438
|
-
|
|
439
|
-
*/
|
|
371
|
+
/**
|
|
372
|
+
* Double the group element.
|
|
373
|
+
*/
|
|
440
374
|
double(): Group;
|
|
441
|
-
/**
|
|
442
|
-
* Get the inverse of the group element. This is the reflection of the point about the axis
|
|
443
|
-
* of symmetry i.e. (x,y) -> (x, -y).
|
|
444
|
-
|
|
445
|
-
*/
|
|
375
|
+
/**
|
|
376
|
+
* Get the inverse of the group element. This is the reflection of the point about the axis
|
|
377
|
+
* of symmetry i.e. (x,y) -> (x, -y).
|
|
378
|
+
*/
|
|
446
379
|
inverse(): Group;
|
|
447
|
-
/**
|
|
448
|
-
* Check if one group element equals another.
|
|
449
|
-
|
|
450
|
-
* @returns {boolean}
|
|
451
|
-
*/
|
|
380
|
+
/**
|
|
381
|
+
* Check if one group element equals another.
|
|
382
|
+
*/
|
|
452
383
|
equals(other: Group): boolean;
|
|
453
|
-
/**
|
|
454
|
-
* Get the group identity element under the group operation (i.e. the point at infinity.)
|
|
455
|
-
|
|
456
|
-
*/
|
|
384
|
+
/**
|
|
385
|
+
* Get the group identity element under the group operation (i.e. the point at infinity.)
|
|
386
|
+
*/
|
|
457
387
|
static zero(): Group;
|
|
458
|
-
/**
|
|
459
|
-
* Get the generator of the group.
|
|
460
|
-
|
|
461
|
-
*/
|
|
388
|
+
/**
|
|
389
|
+
* Get the generator of the group.
|
|
390
|
+
*/
|
|
462
391
|
static generator(): Group;
|
|
463
392
|
}
|
|
464
393
|
/**
|
|
465
|
-
* Key pair object containing both the function proving and verifying keys
|
|
466
|
-
*/
|
|
394
|
+
* Key pair object containing both the function proving and verifying keys
|
|
395
|
+
*/
|
|
467
396
|
export class KeyPair {
|
|
468
397
|
free(): void;
|
|
469
|
-
/**
|
|
470
|
-
* Create new key pair from proving and verifying keys
|
|
471
|
-
*
|
|
472
|
-
* @param {ProvingKey} proving_key Proving key corresponding to a function in an Aleo program
|
|
473
|
-
* @param {VerifyingKey} verifying_key Verifying key corresponding to a function in an Aleo program
|
|
474
|
-
* @returns {KeyPair} Key pair object containing both the function proving and verifying keys
|
|
475
|
-
|
|
476
|
-
* @param {VerifyingKey} verifying_key
|
|
477
|
-
*/
|
|
398
|
+
/**
|
|
399
|
+
* Create new key pair from proving and verifying keys
|
|
400
|
+
*
|
|
401
|
+
* @param {ProvingKey} proving_key Proving key corresponding to a function in an Aleo program
|
|
402
|
+
* @param {VerifyingKey} verifying_key Verifying key corresponding to a function in an Aleo program
|
|
403
|
+
* @returns {KeyPair} Key pair object containing both the function proving and verifying keys
|
|
404
|
+
*/
|
|
478
405
|
constructor(proving_key: ProvingKey, verifying_key: VerifyingKey);
|
|
479
|
-
/**
|
|
480
|
-
* Get the proving key. This method will remove the proving key from the key pair
|
|
481
|
-
*
|
|
482
|
-
* @returns {ProvingKey}
|
|
483
|
-
|
|
484
|
-
*/
|
|
406
|
+
/**
|
|
407
|
+
* Get the proving key. This method will remove the proving key from the key pair
|
|
408
|
+
*
|
|
409
|
+
* @returns {ProvingKey}
|
|
410
|
+
*/
|
|
485
411
|
provingKey(): ProvingKey;
|
|
486
|
-
/**
|
|
487
|
-
* Get the verifying key. This method will remove the verifying key from the key pair
|
|
488
|
-
*
|
|
489
|
-
* @returns {VerifyingKey}
|
|
490
|
-
|
|
491
|
-
*/
|
|
412
|
+
/**
|
|
413
|
+
* Get the verifying key. This method will remove the verifying key from the key pair
|
|
414
|
+
*
|
|
415
|
+
* @returns {VerifyingKey}
|
|
416
|
+
*/
|
|
492
417
|
verifyingKey(): VerifyingKey;
|
|
493
418
|
}
|
|
494
|
-
/**
|
|
495
|
-
*/
|
|
496
419
|
export class Metadata {
|
|
420
|
+
private constructor();
|
|
497
421
|
free(): void;
|
|
498
|
-
/**
|
|
499
|
-
* @returns {string}
|
|
500
|
-
*/
|
|
501
422
|
static baseUrl(): string;
|
|
502
|
-
/**
|
|
503
|
-
* @returns {Metadata}
|
|
504
|
-
*/
|
|
505
423
|
static bond_public(): Metadata;
|
|
506
|
-
/**
|
|
507
|
-
* @returns {Metadata}
|
|
508
|
-
*/
|
|
509
424
|
static bond_validator(): Metadata;
|
|
510
|
-
/**
|
|
511
|
-
* @returns {Metadata}
|
|
512
|
-
*/
|
|
513
425
|
static claim_unbond_public(): Metadata;
|
|
514
|
-
/**
|
|
515
|
-
* @returns {Metadata}
|
|
516
|
-
*/
|
|
517
426
|
static fee_private(): Metadata;
|
|
518
|
-
/**
|
|
519
|
-
* @returns {Metadata}
|
|
520
|
-
*/
|
|
521
427
|
static fee_public(): Metadata;
|
|
522
|
-
/**
|
|
523
|
-
* @returns {Metadata}
|
|
524
|
-
*/
|
|
525
428
|
static inclusion(): Metadata;
|
|
526
|
-
/**
|
|
527
|
-
* @returns {Metadata}
|
|
528
|
-
*/
|
|
529
429
|
static join(): Metadata;
|
|
530
|
-
/**
|
|
531
|
-
* @returns {Metadata}
|
|
532
|
-
*/
|
|
533
430
|
static set_validator_state(): Metadata;
|
|
534
|
-
/**
|
|
535
|
-
* @returns {Metadata}
|
|
536
|
-
*/
|
|
537
431
|
static split(): Metadata;
|
|
538
|
-
/**
|
|
539
|
-
* @returns {Metadata}
|
|
540
|
-
*/
|
|
541
432
|
static transfer_private(): Metadata;
|
|
542
|
-
/**
|
|
543
|
-
* @returns {Metadata}
|
|
544
|
-
*/
|
|
545
433
|
static transfer_private_to_public(): Metadata;
|
|
546
|
-
/**
|
|
547
|
-
* @returns {Metadata}
|
|
548
|
-
*/
|
|
549
434
|
static transfer_public(): Metadata;
|
|
550
|
-
/**
|
|
551
|
-
* @returns {Metadata}
|
|
552
|
-
*/
|
|
553
435
|
static transfer_public_as_signer(): Metadata;
|
|
554
|
-
/**
|
|
555
|
-
* @returns {Metadata}
|
|
556
|
-
*/
|
|
557
436
|
static transfer_public_to_private(): Metadata;
|
|
558
|
-
/**
|
|
559
|
-
* @returns {Metadata}
|
|
560
|
-
*/
|
|
561
437
|
static unbond_public(): Metadata;
|
|
562
|
-
/**
|
|
563
|
-
*/
|
|
564
|
-
locator: string;
|
|
565
|
-
/**
|
|
566
|
-
*/
|
|
567
438
|
name: string;
|
|
568
|
-
|
|
569
|
-
*/
|
|
439
|
+
locator: string;
|
|
570
440
|
prover: string;
|
|
571
|
-
/**
|
|
572
|
-
*/
|
|
573
441
|
verifier: string;
|
|
574
|
-
/**
|
|
575
|
-
*/
|
|
576
442
|
verifyingKey: string;
|
|
577
443
|
}
|
|
578
444
|
/**
|
|
579
|
-
* An offline query object used to insert the global state root and state paths needed to create
|
|
580
|
-
* a valid inclusion proof offline.
|
|
581
|
-
*/
|
|
445
|
+
* An offline query object used to insert the global state root and state paths needed to create
|
|
446
|
+
* a valid inclusion proof offline.
|
|
447
|
+
*/
|
|
582
448
|
export class OfflineQuery {
|
|
583
449
|
free(): void;
|
|
584
|
-
/**
|
|
585
|
-
* Creates a new offline query object. The state root is required to be passed in as a string
|
|
586
|
-
|
|
587
|
-
* @param {string} state_root
|
|
588
|
-
*/
|
|
450
|
+
/**
|
|
451
|
+
* Creates a new offline query object. The state root is required to be passed in as a string
|
|
452
|
+
*/
|
|
589
453
|
constructor(block_height: number, state_root: string);
|
|
590
|
-
/**
|
|
591
|
-
* Add a new block height to the offline query object.
|
|
592
|
-
|
|
593
|
-
*/
|
|
454
|
+
/**
|
|
455
|
+
* Add a new block height to the offline query object.
|
|
456
|
+
*/
|
|
594
457
|
addBlockHeight(block_height: number): void;
|
|
595
|
-
/**
|
|
596
|
-
* Add a new state path to the offline query object.
|
|
597
|
-
*
|
|
598
|
-
* @param {string} commitment: The commitment corresponding to a record inpout
|
|
599
|
-
* @param {string} state_path: The state path corresponding to the commitment
|
|
600
|
-
|
|
601
|
-
* @param {string} state_path
|
|
602
|
-
*/
|
|
458
|
+
/**
|
|
459
|
+
* Add a new state path to the offline query object.
|
|
460
|
+
*
|
|
461
|
+
* @param {string} commitment: The commitment corresponding to a record inpout
|
|
462
|
+
* @param {string} state_path: The state path corresponding to the commitment
|
|
463
|
+
*/
|
|
603
464
|
addStatePath(commitment: string, state_path: string): void;
|
|
604
|
-
/**
|
|
605
|
-
* Get a json string representation of the offline query object
|
|
606
|
-
|
|
607
|
-
*/
|
|
465
|
+
/**
|
|
466
|
+
* Get a json string representation of the offline query object
|
|
467
|
+
*/
|
|
608
468
|
toString(): string;
|
|
609
|
-
/**
|
|
610
|
-
* Create an offline query object from a json string representation
|
|
611
|
-
|
|
612
|
-
* @returns {OfflineQuery}
|
|
613
|
-
*/
|
|
469
|
+
/**
|
|
470
|
+
* Create an offline query object from a json string representation
|
|
471
|
+
*/
|
|
614
472
|
static fromString(s: string): OfflineQuery;
|
|
615
473
|
}
|
|
616
474
|
/**
|
|
617
|
-
* SnarkVM Plaintext object. Plaintext is a fundamental monadic type used to represent Aleo
|
|
618
|
-
* primitive types (boolean, field, group, i8, i16, i32, i64, i128, u8, u16, u32, u64, u128,
|
|
619
|
-
* scalar, and signature), struct types, and array types.
|
|
620
|
-
*
|
|
621
|
-
* In the context of a web or NodeJS application, this type is useful for turning an Aleo type into
|
|
622
|
-
* a JS value, object, or array that might be necessary for performing computations within the
|
|
623
|
-
* application.
|
|
624
|
-
*
|
|
625
|
-
* @example
|
|
626
|
-
* // Get the bond state of an existing address.
|
|
627
|
-
* const bondState = await fetch(https://api.explorer.provable.com/v1/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
|
|
628
|
-
* // Convert the bond state to a Plaintext object.
|
|
629
|
-
* const bondStatePlaintext = Plaintext.fromString(bond_state);
|
|
630
|
-
* // Convert the Plaintext object to a JS object.
|
|
631
|
-
* const bondStateObject = bond_state_plaintext.toObject();
|
|
632
|
-
* // Check if the bond state matches the expected object.
|
|
633
|
-
* const expectedObject = { validator: "aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f", microcredits: 100000000u64 };
|
|
634
|
-
* assert( JSON.stringify(bondStateObject) === JSON.stringify(expectedObject) );
|
|
635
|
-
*/
|
|
475
|
+
* SnarkVM Plaintext object. Plaintext is a fundamental monadic type used to represent Aleo
|
|
476
|
+
* primitive types (boolean, field, group, i8, i16, i32, i64, i128, u8, u16, u32, u64, u128,
|
|
477
|
+
* scalar, and signature), struct types, and array types.
|
|
478
|
+
*
|
|
479
|
+
* In the context of a web or NodeJS application, this type is useful for turning an Aleo type into
|
|
480
|
+
* a JS value, object, or array that might be necessary for performing computations within the
|
|
481
|
+
* application.
|
|
482
|
+
*
|
|
483
|
+
* @example
|
|
484
|
+
* // Get the bond state of an existing address.
|
|
485
|
+
* const bondState = await fetch(https://api.explorer.provable.com/v1/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
|
|
486
|
+
* // Convert the bond state to a Plaintext object.
|
|
487
|
+
* const bondStatePlaintext = Plaintext.fromString(bond_state);
|
|
488
|
+
* // Convert the Plaintext object to a JS object.
|
|
489
|
+
* const bondStateObject = bond_state_plaintext.toObject();
|
|
490
|
+
* // Check if the bond state matches the expected object.
|
|
491
|
+
* const expectedObject = { validator: "aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f", microcredits: 100000000u64 };
|
|
492
|
+
* assert( JSON.stringify(bondStateObject) === JSON.stringify(expectedObject) );
|
|
493
|
+
*/
|
|
636
494
|
export class Plaintext {
|
|
495
|
+
private constructor();
|
|
637
496
|
free(): void;
|
|
638
|
-
/**
|
|
639
|
-
* Find plaintext member if the plaintext is a struct. Returns `null` if the plaintext is not
|
|
640
|
-
* a struct or the member does not exist.
|
|
641
|
-
*
|
|
642
|
-
* @param {string} name The name of the plaintext member to find.
|
|
643
|
-
*
|
|
644
|
-
* @returns {Plaintext
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
* Encrypt a plaintext with an address and randomizer.
|
|
651
|
-
* @param {Address} address
|
|
652
|
-
* @param {Scalar} randomizer
|
|
653
|
-
* @returns {Ciphertext}
|
|
654
|
-
*/
|
|
497
|
+
/**
|
|
498
|
+
* Find plaintext member if the plaintext is a struct. Returns `null` if the plaintext is not
|
|
499
|
+
* a struct or the member does not exist.
|
|
500
|
+
*
|
|
501
|
+
* @param {string} name The name of the plaintext member to find.
|
|
502
|
+
*
|
|
503
|
+
* @returns {Plaintext} The plaintext member.
|
|
504
|
+
*/
|
|
505
|
+
find(name: string): Plaintext;
|
|
506
|
+
/**
|
|
507
|
+
* Encrypt a plaintext with an address and randomizer.
|
|
508
|
+
*/
|
|
655
509
|
encrypt(address: Address, randomizer: Scalar): Ciphertext;
|
|
656
|
-
/**
|
|
657
|
-
* Encrypt a plaintext with a transition view key.
|
|
658
|
-
|
|
659
|
-
* @returns {Ciphertext}
|
|
660
|
-
*/
|
|
510
|
+
/**
|
|
511
|
+
* Encrypt a plaintext with a transition view key.
|
|
512
|
+
*/
|
|
661
513
|
encryptSymmetric(transition_view_key: Field): Ciphertext;
|
|
662
|
-
/**
|
|
663
|
-
* Creates a plaintext object from a string representation of a plaintext.
|
|
664
|
-
*
|
|
665
|
-
* @param {string} plaintext The string representation of the plaintext.
|
|
666
|
-
*
|
|
667
|
-
* @returns {Plaintext} The plaintext object.
|
|
668
|
-
|
|
669
|
-
* @returns {Plaintext}
|
|
670
|
-
*/
|
|
514
|
+
/**
|
|
515
|
+
* Creates a plaintext object from a string representation of a plaintext.
|
|
516
|
+
*
|
|
517
|
+
* @param {string} plaintext The string representation of the plaintext.
|
|
518
|
+
*
|
|
519
|
+
* @returns {Plaintext} The plaintext object.
|
|
520
|
+
*/
|
|
671
521
|
static fromString(plaintext: string): Plaintext;
|
|
672
|
-
/**
|
|
673
|
-
* Get a plaintext object from a series of bytes.
|
|
674
|
-
*
|
|
675
|
-
* @param {Uint8Array} bytes A left endian byte array representing the plaintext.
|
|
676
|
-
*
|
|
677
|
-
* @returns {Plaintext} The plaintext object.
|
|
678
|
-
|
|
679
|
-
* @returns {Plaintext}
|
|
680
|
-
*/
|
|
522
|
+
/**
|
|
523
|
+
* Get a plaintext object from a series of bytes.
|
|
524
|
+
*
|
|
525
|
+
* @param {Uint8Array} bytes A left endian byte array representing the plaintext.
|
|
526
|
+
*
|
|
527
|
+
* @returns {Plaintext} The plaintext object.
|
|
528
|
+
*/
|
|
681
529
|
static fromBytesLe(bytes: Uint8Array): Plaintext;
|
|
682
|
-
/**
|
|
683
|
-
* Generate a random plaintext element from a series of bytes.
|
|
684
|
-
*
|
|
685
|
-
* @param {Uint8Array} bytes A left endian byte array representing the plaintext.
|
|
686
|
-
|
|
687
|
-
*/
|
|
530
|
+
/**
|
|
531
|
+
* Generate a random plaintext element from a series of bytes.
|
|
532
|
+
*
|
|
533
|
+
* @param {Uint8Array} bytes A left endian byte array representing the plaintext.
|
|
534
|
+
*/
|
|
688
535
|
toBytesLe(): Uint8Array;
|
|
689
|
-
/**
|
|
690
|
-
* Returns the string representation of the plaintext.
|
|
691
|
-
*
|
|
692
|
-
* @returns {string} The string representation of the plaintext.
|
|
693
|
-
|
|
694
|
-
*/
|
|
536
|
+
/**
|
|
537
|
+
* Returns the string representation of the plaintext.
|
|
538
|
+
*
|
|
539
|
+
* @returns {string} The string representation of the plaintext.
|
|
540
|
+
*/
|
|
695
541
|
toString(): string;
|
|
696
|
-
/**
|
|
697
|
-
*
|
|
698
|
-
*
|
|
699
|
-
* @returns {
|
|
700
|
-
|
|
701
|
-
|
|
542
|
+
/**
|
|
543
|
+
* Gives the type of the plaintext.
|
|
544
|
+
*
|
|
545
|
+
* @returns {string} The type of the plaintext.
|
|
546
|
+
*/
|
|
547
|
+
plaintextType(): string;
|
|
548
|
+
/**
|
|
549
|
+
* Attempt to convert the plaintext to a JS object.
|
|
550
|
+
*
|
|
551
|
+
* @returns {Object} The JS object representation of the plaintext.
|
|
552
|
+
*/
|
|
702
553
|
toObject(): any;
|
|
703
554
|
}
|
|
704
555
|
/**
|
|
705
|
-
* Private key of an Aleo account
|
|
706
|
-
*/
|
|
556
|
+
* Private key of an Aleo account
|
|
557
|
+
*/
|
|
707
558
|
export class PrivateKey {
|
|
708
559
|
free(): void;
|
|
709
|
-
/**
|
|
710
|
-
* Generate a new private key using a cryptographically secure random number generator
|
|
711
|
-
*
|
|
712
|
-
* @returns {PrivateKey}
|
|
713
|
-
*/
|
|
560
|
+
/**
|
|
561
|
+
* Generate a new private key using a cryptographically secure random number generator
|
|
562
|
+
*
|
|
563
|
+
* @returns {PrivateKey}
|
|
564
|
+
*/
|
|
714
565
|
constructor();
|
|
715
|
-
/**
|
|
716
|
-
* Get a private key from a series of unchecked bytes
|
|
717
|
-
*
|
|
718
|
-
* @param {Uint8Array} seed Unchecked 32 byte long Uint8Array acting as the seed for the private key
|
|
719
|
-
* @returns {PrivateKey}
|
|
720
|
-
|
|
721
|
-
* @returns {PrivateKey}
|
|
722
|
-
*/
|
|
566
|
+
/**
|
|
567
|
+
* Get a private key from a series of unchecked bytes
|
|
568
|
+
*
|
|
569
|
+
* @param {Uint8Array} seed Unchecked 32 byte long Uint8Array acting as the seed for the private key
|
|
570
|
+
* @returns {PrivateKey}
|
|
571
|
+
*/
|
|
723
572
|
static from_seed_unchecked(seed: Uint8Array): PrivateKey;
|
|
724
|
-
/**
|
|
725
|
-
* Get a private key from a string representation of a private key
|
|
726
|
-
*
|
|
727
|
-
* @param {string} seed String representation of a private key
|
|
728
|
-
* @returns {PrivateKey}
|
|
729
|
-
|
|
730
|
-
* @returns {PrivateKey}
|
|
731
|
-
*/
|
|
573
|
+
/**
|
|
574
|
+
* Get a private key from a string representation of a private key
|
|
575
|
+
*
|
|
576
|
+
* @param {string} seed String representation of a private key
|
|
577
|
+
* @returns {PrivateKey}
|
|
578
|
+
*/
|
|
732
579
|
static from_string(private_key: string): PrivateKey;
|
|
733
|
-
/**
|
|
734
|
-
* Get a string representation of the private key. This function should be used very carefully
|
|
735
|
-
* as it exposes the private key plaintext
|
|
736
|
-
*
|
|
737
|
-
* @returns {string} String representation of a private key
|
|
738
|
-
|
|
739
|
-
*/
|
|
580
|
+
/**
|
|
581
|
+
* Get a string representation of the private key. This function should be used very carefully
|
|
582
|
+
* as it exposes the private key plaintext
|
|
583
|
+
*
|
|
584
|
+
* @returns {string} String representation of a private key
|
|
585
|
+
*/
|
|
740
586
|
to_string(): string;
|
|
741
|
-
/**
|
|
742
|
-
* Get the view key corresponding to the private key
|
|
743
|
-
*
|
|
744
|
-
* @returns {ViewKey}
|
|
745
|
-
|
|
746
|
-
*/
|
|
587
|
+
/**
|
|
588
|
+
* Get the view key corresponding to the private key
|
|
589
|
+
*
|
|
590
|
+
* @returns {ViewKey}
|
|
591
|
+
*/
|
|
747
592
|
to_view_key(): ViewKey;
|
|
748
|
-
/**
|
|
749
|
-
* Get the address corresponding to the private key
|
|
750
|
-
*
|
|
751
|
-
* @returns {Address}
|
|
752
|
-
|
|
753
|
-
*/
|
|
593
|
+
/**
|
|
594
|
+
* Get the address corresponding to the private key
|
|
595
|
+
*
|
|
596
|
+
* @returns {Address}
|
|
597
|
+
*/
|
|
754
598
|
to_address(): Address;
|
|
755
|
-
/**
|
|
756
|
-
* Sign a message with the private key
|
|
757
|
-
*
|
|
758
|
-
* @param {Uint8Array} Byte array representing a message signed by the address
|
|
759
|
-
* @returns {Signature} Signature generated by signing the message with the address
|
|
760
|
-
|
|
761
|
-
* @returns {Signature}
|
|
762
|
-
*/
|
|
599
|
+
/**
|
|
600
|
+
* Sign a message with the private key
|
|
601
|
+
*
|
|
602
|
+
* @param {Uint8Array} Byte array representing a message signed by the address
|
|
603
|
+
* @returns {Signature} Signature generated by signing the message with the address
|
|
604
|
+
*/
|
|
763
605
|
sign(message: Uint8Array): Signature;
|
|
764
|
-
/**
|
|
765
|
-
* Get a new randomly generated private key ciphertext using a secret. The secret is sensitive
|
|
766
|
-
* and will be needed to decrypt the private key later, so it should be stored securely
|
|
767
|
-
*
|
|
768
|
-
* @param {string} secret Secret used to encrypt the private key
|
|
769
|
-
* @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
|
|
770
|
-
|
|
771
|
-
* @returns {PrivateKeyCiphertext}
|
|
772
|
-
*/
|
|
606
|
+
/**
|
|
607
|
+
* Get a new randomly generated private key ciphertext using a secret. The secret is sensitive
|
|
608
|
+
* and will be needed to decrypt the private key later, so it should be stored securely
|
|
609
|
+
*
|
|
610
|
+
* @param {string} secret Secret used to encrypt the private key
|
|
611
|
+
* @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
|
|
612
|
+
*/
|
|
773
613
|
static newEncrypted(secret: string): PrivateKeyCiphertext;
|
|
774
|
-
/**
|
|
775
|
-
* Encrypt an existing private key with a secret. The secret is sensitive and will be needed to
|
|
776
|
-
* decrypt the private key later, so it should be stored securely
|
|
777
|
-
*
|
|
778
|
-
* @param {string} secret Secret used to encrypt the private key
|
|
779
|
-
* @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
|
|
780
|
-
|
|
781
|
-
* @returns {PrivateKeyCiphertext}
|
|
782
|
-
*/
|
|
614
|
+
/**
|
|
615
|
+
* Encrypt an existing private key with a secret. The secret is sensitive and will be needed to
|
|
616
|
+
* decrypt the private key later, so it should be stored securely
|
|
617
|
+
*
|
|
618
|
+
* @param {string} secret Secret used to encrypt the private key
|
|
619
|
+
* @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
|
|
620
|
+
*/
|
|
783
621
|
toCiphertext(secret: string): PrivateKeyCiphertext;
|
|
784
|
-
/**
|
|
785
|
-
* Get private key from a private key ciphertext and secret originally used to encrypt it
|
|
786
|
-
*
|
|
787
|
-
* @param {PrivateKeyCiphertext} ciphertext Ciphertext representation of the private key
|
|
788
|
-
* @param {string} secret Secret originally used to encrypt the private key
|
|
789
|
-
* @returns {PrivateKey} Private key
|
|
790
|
-
|
|
791
|
-
* @param {string} secret
|
|
792
|
-
* @returns {PrivateKey}
|
|
793
|
-
*/
|
|
622
|
+
/**
|
|
623
|
+
* Get private key from a private key ciphertext and secret originally used to encrypt it
|
|
624
|
+
*
|
|
625
|
+
* @param {PrivateKeyCiphertext} ciphertext Ciphertext representation of the private key
|
|
626
|
+
* @param {string} secret Secret originally used to encrypt the private key
|
|
627
|
+
* @returns {PrivateKey} Private key
|
|
628
|
+
*/
|
|
794
629
|
static fromPrivateKeyCiphertext(ciphertext: PrivateKeyCiphertext, secret: string): PrivateKey;
|
|
795
630
|
}
|
|
796
631
|
/**
|
|
797
|
-
* Private Key in ciphertext form
|
|
798
|
-
*/
|
|
632
|
+
* Private Key in ciphertext form
|
|
633
|
+
*/
|
|
799
634
|
export class PrivateKeyCiphertext {
|
|
635
|
+
private constructor();
|
|
800
636
|
free(): void;
|
|
801
|
-
/**
|
|
802
|
-
* Encrypt a private key using a secret string. The secret is sensitive and will be needed to
|
|
803
|
-
* decrypt the private key later, so it should be stored securely
|
|
804
|
-
*
|
|
805
|
-
* @param {PrivateKey} private_key Private key to encrypt
|
|
806
|
-
* @param {string} secret Secret to encrypt the private key with
|
|
807
|
-
* @returns {PrivateKeyCiphertext} Private key ciphertext
|
|
808
|
-
|
|
809
|
-
* @param {string} secret
|
|
810
|
-
* @returns {PrivateKeyCiphertext}
|
|
811
|
-
*/
|
|
637
|
+
/**
|
|
638
|
+
* Encrypt a private key using a secret string. The secret is sensitive and will be needed to
|
|
639
|
+
* decrypt the private key later, so it should be stored securely
|
|
640
|
+
*
|
|
641
|
+
* @param {PrivateKey} private_key Private key to encrypt
|
|
642
|
+
* @param {string} secret Secret to encrypt the private key with
|
|
643
|
+
* @returns {PrivateKeyCiphertext} Private key ciphertext
|
|
644
|
+
*/
|
|
812
645
|
static encryptPrivateKey(private_key: PrivateKey, secret: string): PrivateKeyCiphertext;
|
|
813
|
-
/**
|
|
814
|
-
* Decrypts a private ciphertext using a secret string. This must be the same secret used to
|
|
815
|
-
* encrypt the private key
|
|
816
|
-
*
|
|
817
|
-
* @param {string} secret Secret used to encrypt the private key
|
|
818
|
-
* @returns {PrivateKey} Private key
|
|
819
|
-
|
|
820
|
-
* @returns {PrivateKey}
|
|
821
|
-
*/
|
|
646
|
+
/**
|
|
647
|
+
* Decrypts a private ciphertext using a secret string. This must be the same secret used to
|
|
648
|
+
* encrypt the private key
|
|
649
|
+
*
|
|
650
|
+
* @param {string} secret Secret used to encrypt the private key
|
|
651
|
+
* @returns {PrivateKey} Private key
|
|
652
|
+
*/
|
|
822
653
|
decryptToPrivateKey(secret: string): PrivateKey;
|
|
823
|
-
/**
|
|
824
|
-
* Returns the ciphertext string
|
|
825
|
-
*
|
|
826
|
-
* @returns {string} Ciphertext string
|
|
827
|
-
|
|
828
|
-
*/
|
|
654
|
+
/**
|
|
655
|
+
* Returns the ciphertext string
|
|
656
|
+
*
|
|
657
|
+
* @returns {string} Ciphertext string
|
|
658
|
+
*/
|
|
829
659
|
toString(): string;
|
|
830
|
-
/**
|
|
831
|
-
* Creates a PrivateKeyCiphertext from a string
|
|
832
|
-
*
|
|
833
|
-
* @param {string} ciphertext Ciphertext string
|
|
834
|
-
* @returns {PrivateKeyCiphertext} Private key ciphertext
|
|
835
|
-
|
|
836
|
-
* @returns {PrivateKeyCiphertext}
|
|
837
|
-
*/
|
|
660
|
+
/**
|
|
661
|
+
* Creates a PrivateKeyCiphertext from a string
|
|
662
|
+
*
|
|
663
|
+
* @param {string} ciphertext Ciphertext string
|
|
664
|
+
* @returns {PrivateKeyCiphertext} Private key ciphertext
|
|
665
|
+
*/
|
|
838
666
|
static fromString(ciphertext: string): PrivateKeyCiphertext;
|
|
839
667
|
}
|
|
840
668
|
/**
|
|
841
|
-
* Webassembly Representation of an Aleo program
|
|
842
|
-
*/
|
|
669
|
+
* Webassembly Representation of an Aleo program
|
|
670
|
+
*/
|
|
843
671
|
export class Program {
|
|
672
|
+
private constructor();
|
|
844
673
|
free(): void;
|
|
845
|
-
/**
|
|
846
|
-
* Create a program from a program string
|
|
847
|
-
*
|
|
848
|
-
* @param {string} program Aleo program source code
|
|
849
|
-
* @returns {Program} Program object
|
|
850
|
-
|
|
851
|
-
* @returns {Program}
|
|
852
|
-
*/
|
|
674
|
+
/**
|
|
675
|
+
* Create a program from a program string
|
|
676
|
+
*
|
|
677
|
+
* @param {string} program Aleo program source code
|
|
678
|
+
* @returns {Program} Program object
|
|
679
|
+
*/
|
|
853
680
|
static fromString(program: string): Program;
|
|
854
|
-
/**
|
|
855
|
-
* Get a string representation of the program
|
|
856
|
-
*
|
|
857
|
-
* @returns {string} String containing the program source code
|
|
858
|
-
|
|
859
|
-
*/
|
|
681
|
+
/**
|
|
682
|
+
* Get a string representation of the program
|
|
683
|
+
*
|
|
684
|
+
* @returns {string} String containing the program source code
|
|
685
|
+
*/
|
|
860
686
|
toString(): string;
|
|
861
|
-
/**
|
|
862
|
-
* Determine if a function is present in the program
|
|
863
|
-
*
|
|
864
|
-
* @param {string} functionName Name of the function to check for
|
|
865
|
-
* @returns {boolean} True if the program is valid, false otherwise
|
|
866
|
-
|
|
867
|
-
* @returns {boolean}
|
|
868
|
-
*/
|
|
687
|
+
/**
|
|
688
|
+
* Determine if a function is present in the program
|
|
689
|
+
*
|
|
690
|
+
* @param {string} functionName Name of the function to check for
|
|
691
|
+
* @returns {boolean} True if the program is valid, false otherwise
|
|
692
|
+
*/
|
|
869
693
|
hasFunction(function_name: string): boolean;
|
|
870
|
-
/**
|
|
871
|
-
* Get javascript array of functions names in the program
|
|
872
|
-
*
|
|
873
|
-
* @returns {Array} Array of all function names present in the program
|
|
874
|
-
*
|
|
875
|
-
* @example
|
|
876
|
-
* const expected_functions = [
|
|
877
|
-
* "mint",
|
|
878
|
-
* "transfer_private",
|
|
879
|
-
* "transfer_private_to_public",
|
|
880
|
-
* "transfer_public",
|
|
881
|
-
* "transfer_public_to_private",
|
|
882
|
-
* "join",
|
|
883
|
-
* "split",
|
|
884
|
-
* "fee"
|
|
885
|
-
* ]
|
|
886
|
-
*
|
|
887
|
-
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
888
|
-
* const credits_functions = credits_program.getFunctions();
|
|
889
|
-
* console.log(credits_functions === expected_functions); // Output should be "true"
|
|
890
|
-
|
|
891
|
-
*/
|
|
694
|
+
/**
|
|
695
|
+
* Get javascript array of functions names in the program
|
|
696
|
+
*
|
|
697
|
+
* @returns {Array} Array of all function names present in the program
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* const expected_functions = [
|
|
701
|
+
* "mint",
|
|
702
|
+
* "transfer_private",
|
|
703
|
+
* "transfer_private_to_public",
|
|
704
|
+
* "transfer_public",
|
|
705
|
+
* "transfer_public_to_private",
|
|
706
|
+
* "join",
|
|
707
|
+
* "split",
|
|
708
|
+
* "fee"
|
|
709
|
+
* ]
|
|
710
|
+
*
|
|
711
|
+
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
712
|
+
* const credits_functions = credits_program.getFunctions();
|
|
713
|
+
* console.log(credits_functions === expected_functions); // Output should be "true"
|
|
714
|
+
*/
|
|
892
715
|
getFunctions(): Array<any>;
|
|
893
|
-
/**
|
|
894
|
-
* Get a javascript object representation of the function inputs and types. This can be used
|
|
895
|
-
* to generate a web form to capture user inputs for an execution of a function.
|
|
896
|
-
*
|
|
897
|
-
* @param {string} function_name Name of the function to get inputs for
|
|
898
|
-
* @returns {Array} Array of function inputs
|
|
899
|
-
*
|
|
900
|
-
* @example
|
|
901
|
-
* const expected_inputs = [
|
|
902
|
-
* {
|
|
903
|
-
* type:"record",
|
|
904
|
-
* visibility:"private",
|
|
905
|
-
* record:"credits",
|
|
906
|
-
* members:[
|
|
907
|
-
* {
|
|
908
|
-
* name:"microcredits",
|
|
909
|
-
* type:"u64",
|
|
910
|
-
* visibility:"private"
|
|
911
|
-
* }
|
|
912
|
-
* ],
|
|
913
|
-
* register:"r0"
|
|
914
|
-
* },
|
|
915
|
-
* {
|
|
916
|
-
* type:"address",
|
|
917
|
-
* visibility:"private",
|
|
918
|
-
* register:"r1"
|
|
919
|
-
* },
|
|
920
|
-
* {
|
|
921
|
-
* type:"u64",
|
|
922
|
-
* visibility:"private",
|
|
923
|
-
* register:"r2"
|
|
924
|
-
* }
|
|
925
|
-
* ];
|
|
926
|
-
*
|
|
927
|
-
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
928
|
-
* const transfer_function_inputs = credits_program.getFunctionInputs("transfer_private");
|
|
929
|
-
* console.log(transfer_function_inputs === expected_inputs); // Output should be "true"
|
|
930
|
-
|
|
931
|
-
* @returns {Array<any>}
|
|
932
|
-
*/
|
|
716
|
+
/**
|
|
717
|
+
* Get a javascript object representation of the function inputs and types. This can be used
|
|
718
|
+
* to generate a web form to capture user inputs for an execution of a function.
|
|
719
|
+
*
|
|
720
|
+
* @param {string} function_name Name of the function to get inputs for
|
|
721
|
+
* @returns {Array} Array of function inputs
|
|
722
|
+
*
|
|
723
|
+
* @example
|
|
724
|
+
* const expected_inputs = [
|
|
725
|
+
* {
|
|
726
|
+
* type:"record",
|
|
727
|
+
* visibility:"private",
|
|
728
|
+
* record:"credits",
|
|
729
|
+
* members:[
|
|
730
|
+
* {
|
|
731
|
+
* name:"microcredits",
|
|
732
|
+
* type:"u64",
|
|
733
|
+
* visibility:"private"
|
|
734
|
+
* }
|
|
735
|
+
* ],
|
|
736
|
+
* register:"r0"
|
|
737
|
+
* },
|
|
738
|
+
* {
|
|
739
|
+
* type:"address",
|
|
740
|
+
* visibility:"private",
|
|
741
|
+
* register:"r1"
|
|
742
|
+
* },
|
|
743
|
+
* {
|
|
744
|
+
* type:"u64",
|
|
745
|
+
* visibility:"private",
|
|
746
|
+
* register:"r2"
|
|
747
|
+
* }
|
|
748
|
+
* ];
|
|
749
|
+
*
|
|
750
|
+
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
751
|
+
* const transfer_function_inputs = credits_program.getFunctionInputs("transfer_private");
|
|
752
|
+
* console.log(transfer_function_inputs === expected_inputs); // Output should be "true"
|
|
753
|
+
*/
|
|
933
754
|
getFunctionInputs(function_name: string): Array<any>;
|
|
934
|
-
/**
|
|
935
|
-
* Get a the list of a program's mappings and the names/types of their keys and values.
|
|
936
|
-
*
|
|
937
|
-
* @returns {Array} - An array of objects representing the mappings in the program
|
|
938
|
-
* @example
|
|
939
|
-
* const expected_mappings = [
|
|
940
|
-
* {
|
|
941
|
-
* name: "account",
|
|
942
|
-
* key_name: "owner",
|
|
943
|
-
* key_type: "address",
|
|
944
|
-
* value_name: "microcredits",
|
|
945
|
-
* value_type: "u64"
|
|
946
|
-
* }
|
|
947
|
-
* ]
|
|
948
|
-
*
|
|
949
|
-
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
950
|
-
* const credits_mappings = credits_program.getMappings();
|
|
951
|
-
* console.log(credits_mappings === expected_mappings); // Output should be "true"
|
|
952
|
-
|
|
953
|
-
*/
|
|
755
|
+
/**
|
|
756
|
+
* Get a the list of a program's mappings and the names/types of their keys and values.
|
|
757
|
+
*
|
|
758
|
+
* @returns {Array} - An array of objects representing the mappings in the program
|
|
759
|
+
* @example
|
|
760
|
+
* const expected_mappings = [
|
|
761
|
+
* {
|
|
762
|
+
* name: "account",
|
|
763
|
+
* key_name: "owner",
|
|
764
|
+
* key_type: "address",
|
|
765
|
+
* value_name: "microcredits",
|
|
766
|
+
* value_type: "u64"
|
|
767
|
+
* }
|
|
768
|
+
* ]
|
|
769
|
+
*
|
|
770
|
+
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
771
|
+
* const credits_mappings = credits_program.getMappings();
|
|
772
|
+
* console.log(credits_mappings === expected_mappings); // Output should be "true"
|
|
773
|
+
*/
|
|
954
774
|
getMappings(): Array<any>;
|
|
955
|
-
/**
|
|
956
|
-
* Get a javascript object representation of a program record and its types
|
|
957
|
-
*
|
|
958
|
-
* @param {string} record_name Name of the record to get members for
|
|
959
|
-
* @returns {Object} Object containing the record name, type, and members
|
|
960
|
-
*
|
|
961
|
-
* @example
|
|
962
|
-
*
|
|
963
|
-
* const expected_record = {
|
|
964
|
-
* type: "record",
|
|
965
|
-
* record: "Credits",
|
|
966
|
-
* members: [
|
|
967
|
-
* {
|
|
968
|
-
* name: "owner",
|
|
969
|
-
* type: "address",
|
|
970
|
-
* visibility: "private"
|
|
971
|
-
* },
|
|
972
|
-
* {
|
|
973
|
-
* name: "microcredits",
|
|
974
|
-
* type: "u64",
|
|
975
|
-
* visibility: "private"
|
|
976
|
-
* }
|
|
977
|
-
* ];
|
|
978
|
-
* };
|
|
979
|
-
*
|
|
980
|
-
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
981
|
-
* const credits_record = credits_program.getRecordMembers("Credits");
|
|
982
|
-
* console.log(credits_record === expected_record); // Output should be "true"
|
|
983
|
-
|
|
984
|
-
* @returns {object}
|
|
985
|
-
*/
|
|
775
|
+
/**
|
|
776
|
+
* Get a javascript object representation of a program record and its types
|
|
777
|
+
*
|
|
778
|
+
* @param {string} record_name Name of the record to get members for
|
|
779
|
+
* @returns {Object} Object containing the record name, type, and members
|
|
780
|
+
*
|
|
781
|
+
* @example
|
|
782
|
+
*
|
|
783
|
+
* const expected_record = {
|
|
784
|
+
* type: "record",
|
|
785
|
+
* record: "Credits",
|
|
786
|
+
* members: [
|
|
787
|
+
* {
|
|
788
|
+
* name: "owner",
|
|
789
|
+
* type: "address",
|
|
790
|
+
* visibility: "private"
|
|
791
|
+
* },
|
|
792
|
+
* {
|
|
793
|
+
* name: "microcredits",
|
|
794
|
+
* type: "u64",
|
|
795
|
+
* visibility: "private"
|
|
796
|
+
* }
|
|
797
|
+
* ];
|
|
798
|
+
* };
|
|
799
|
+
*
|
|
800
|
+
* const credits_program = aleo_wasm.Program.getCreditsProgram();
|
|
801
|
+
* const credits_record = credits_program.getRecordMembers("Credits");
|
|
802
|
+
* console.log(credits_record === expected_record); // Output should be "true"
|
|
803
|
+
*/
|
|
986
804
|
getRecordMembers(record_name: string): object;
|
|
987
|
-
/**
|
|
988
|
-
* Get a javascript object representation of a program struct and its types
|
|
989
|
-
*
|
|
990
|
-
* @param {string} struct_name Name of the struct to get members for
|
|
991
|
-
* @returns {Array} Array containing the struct members
|
|
992
|
-
*
|
|
993
|
-
* @example
|
|
994
|
-
*
|
|
995
|
-
* const STRUCT_PROGRAM = "program token_issue.aleo;
|
|
996
|
-
*
|
|
997
|
-
* struct token_metadata:
|
|
998
|
-
* network as u32;
|
|
999
|
-
* version as u32;
|
|
1000
|
-
*
|
|
1001
|
-
* struct token:
|
|
1002
|
-
* token_id as u32;
|
|
1003
|
-
* metadata as token_metadata;
|
|
1004
|
-
*
|
|
1005
|
-
* function no_op:
|
|
1006
|
-
* input r0 as u64;
|
|
1007
|
-
* output r0 as u64;"
|
|
1008
|
-
*
|
|
1009
|
-
* const expected_struct_members = [
|
|
1010
|
-
* {
|
|
1011
|
-
* name: "token_id",
|
|
1012
|
-
* type: "u32",
|
|
1013
|
-
* },
|
|
1014
|
-
* {
|
|
1015
|
-
* name: "metadata",
|
|
1016
|
-
* type: "struct",
|
|
1017
|
-
* struct_id: "token_metadata",
|
|
1018
|
-
* members: [
|
|
1019
|
-
* {
|
|
1020
|
-
* name: "network",
|
|
1021
|
-
* type: "u32",
|
|
1022
|
-
* }
|
|
1023
|
-
* {
|
|
1024
|
-
* name: "version",
|
|
1025
|
-
* type: "u32",
|
|
1026
|
-
* }
|
|
1027
|
-
* ]
|
|
1028
|
-
* }
|
|
1029
|
-
* ];
|
|
1030
|
-
*
|
|
1031
|
-
* const program = aleo_wasm.Program.fromString(STRUCT_PROGRAM);
|
|
1032
|
-
* const struct_members = program.getStructMembers("token");
|
|
1033
|
-
* console.log(struct_members === expected_struct_members); // Output should be "true"
|
|
1034
|
-
|
|
1035
|
-
* @returns {Array<any>}
|
|
1036
|
-
*/
|
|
805
|
+
/**
|
|
806
|
+
* Get a javascript object representation of a program struct and its types
|
|
807
|
+
*
|
|
808
|
+
* @param {string} struct_name Name of the struct to get members for
|
|
809
|
+
* @returns {Array} Array containing the struct members
|
|
810
|
+
*
|
|
811
|
+
* @example
|
|
812
|
+
*
|
|
813
|
+
* const STRUCT_PROGRAM = "program token_issue.aleo;
|
|
814
|
+
*
|
|
815
|
+
* struct token_metadata:
|
|
816
|
+
* network as u32;
|
|
817
|
+
* version as u32;
|
|
818
|
+
*
|
|
819
|
+
* struct token:
|
|
820
|
+
* token_id as u32;
|
|
821
|
+
* metadata as token_metadata;
|
|
822
|
+
*
|
|
823
|
+
* function no_op:
|
|
824
|
+
* input r0 as u64;
|
|
825
|
+
* output r0 as u64;"
|
|
826
|
+
*
|
|
827
|
+
* const expected_struct_members = [
|
|
828
|
+
* {
|
|
829
|
+
* name: "token_id",
|
|
830
|
+
* type: "u32",
|
|
831
|
+
* },
|
|
832
|
+
* {
|
|
833
|
+
* name: "metadata",
|
|
834
|
+
* type: "struct",
|
|
835
|
+
* struct_id: "token_metadata",
|
|
836
|
+
* members: [
|
|
837
|
+
* {
|
|
838
|
+
* name: "network",
|
|
839
|
+
* type: "u32",
|
|
840
|
+
* }
|
|
841
|
+
* {
|
|
842
|
+
* name: "version",
|
|
843
|
+
* type: "u32",
|
|
844
|
+
* }
|
|
845
|
+
* ]
|
|
846
|
+
* }
|
|
847
|
+
* ];
|
|
848
|
+
*
|
|
849
|
+
* const program = aleo_wasm.Program.fromString(STRUCT_PROGRAM);
|
|
850
|
+
* const struct_members = program.getStructMembers("token");
|
|
851
|
+
* console.log(struct_members === expected_struct_members); // Output should be "true"
|
|
852
|
+
*/
|
|
1037
853
|
getStructMembers(struct_name: string): Array<any>;
|
|
1038
|
-
/**
|
|
1039
|
-
* Get the credits.aleo program
|
|
1040
|
-
*
|
|
1041
|
-
* @returns {Program} The credits.aleo program
|
|
1042
|
-
|
|
1043
|
-
*/
|
|
854
|
+
/**
|
|
855
|
+
* Get the credits.aleo program
|
|
856
|
+
*
|
|
857
|
+
* @returns {Program} The credits.aleo program
|
|
858
|
+
*/
|
|
1044
859
|
static getCreditsProgram(): Program;
|
|
1045
|
-
/**
|
|
1046
|
-
* Get the id of the program
|
|
1047
|
-
*
|
|
1048
|
-
* @returns {string} The id of the program
|
|
1049
|
-
|
|
1050
|
-
*/
|
|
860
|
+
/**
|
|
861
|
+
* Get the id of the program
|
|
862
|
+
*
|
|
863
|
+
* @returns {string} The id of the program
|
|
864
|
+
*/
|
|
1051
865
|
id(): string;
|
|
1052
|
-
/**
|
|
1053
|
-
* Get a unique address of the program
|
|
1054
|
-
*
|
|
1055
|
-
* @returns {Address} The address of the program
|
|
1056
|
-
|
|
1057
|
-
*/
|
|
866
|
+
/**
|
|
867
|
+
* Get a unique address of the program
|
|
868
|
+
*
|
|
869
|
+
* @returns {Address} The address of the program
|
|
870
|
+
*/
|
|
1058
871
|
address(): Address;
|
|
1059
|
-
/**
|
|
1060
|
-
* Determine equality with another program
|
|
1061
|
-
*
|
|
1062
|
-
* @param {Program} other The other program to compare
|
|
1063
|
-
* @returns {boolean} True if the programs are equal, false otherwise
|
|
1064
|
-
|
|
1065
|
-
* @returns {boolean}
|
|
1066
|
-
*/
|
|
872
|
+
/**
|
|
873
|
+
* Determine equality with another program
|
|
874
|
+
*
|
|
875
|
+
* @param {Program} other The other program to compare
|
|
876
|
+
* @returns {boolean} True if the programs are equal, false otherwise
|
|
877
|
+
*/
|
|
1067
878
|
isEqual(other: Program): boolean;
|
|
1068
|
-
/**
|
|
1069
|
-
* Get program_imports
|
|
1070
|
-
*
|
|
1071
|
-
* @returns {Array} The program imports
|
|
1072
|
-
*
|
|
1073
|
-
* @example
|
|
1074
|
-
*
|
|
1075
|
-
* const DOUBLE_TEST = "import multiply_test.aleo;
|
|
1076
|
-
*
|
|
1077
|
-
* program double_test.aleo;
|
|
1078
|
-
*
|
|
1079
|
-
* function double_it:
|
|
1080
|
-
* input r0 as u32.private;
|
|
1081
|
-
* call multiply_test.aleo/multiply 2u32 r0 into r1;
|
|
1082
|
-
* output r1 as u32.private;";
|
|
1083
|
-
*
|
|
1084
|
-
* const expected_imports = [
|
|
1085
|
-
* "multiply_test.aleo"
|
|
1086
|
-
* ];
|
|
1087
|
-
*
|
|
1088
|
-
* const program = aleo_wasm.Program.fromString(DOUBLE_TEST_PROGRAM);
|
|
1089
|
-
* const imports = program.getImports();
|
|
1090
|
-
* console.log(imports === expected_imports); // Output should be "true"
|
|
1091
|
-
|
|
1092
|
-
*/
|
|
879
|
+
/**
|
|
880
|
+
* Get program_imports
|
|
881
|
+
*
|
|
882
|
+
* @returns {Array} The program imports
|
|
883
|
+
*
|
|
884
|
+
* @example
|
|
885
|
+
*
|
|
886
|
+
* const DOUBLE_TEST = "import multiply_test.aleo;
|
|
887
|
+
*
|
|
888
|
+
* program double_test.aleo;
|
|
889
|
+
*
|
|
890
|
+
* function double_it:
|
|
891
|
+
* input r0 as u32.private;
|
|
892
|
+
* call multiply_test.aleo/multiply 2u32 r0 into r1;
|
|
893
|
+
* output r1 as u32.private;";
|
|
894
|
+
*
|
|
895
|
+
* const expected_imports = [
|
|
896
|
+
* "multiply_test.aleo"
|
|
897
|
+
* ];
|
|
898
|
+
*
|
|
899
|
+
* const program = aleo_wasm.Program.fromString(DOUBLE_TEST_PROGRAM);
|
|
900
|
+
* const imports = program.getImports();
|
|
901
|
+
* console.log(imports === expected_imports); // Output should be "true"
|
|
902
|
+
*/
|
|
1093
903
|
getImports(): Array<any>;
|
|
1094
904
|
}
|
|
1095
|
-
/**
|
|
1096
|
-
*/
|
|
1097
905
|
export class ProgramManager {
|
|
906
|
+
private constructor();
|
|
1098
907
|
free(): void;
|
|
1099
|
-
/**
|
|
1100
|
-
* Deploy an Aleo program
|
|
1101
|
-
*
|
|
1102
|
-
* @param private_key The private key of the sender
|
|
1103
|
-
* @param program The source code of the program being deployed
|
|
1104
|
-
* @param imports A javascript object holding the source code of any imported programs in the
|
|
1105
|
-
* form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
|
|
1106
|
-
* Note that all imported programs must be deployed on chain before the main program in order
|
|
1107
|
-
* for the deployment to succeed
|
|
1108
|
-
* @param fee_credits The amount of credits to pay as a fee
|
|
1109
|
-
* @param fee_record The record to spend the fee from
|
|
1110
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
1111
|
-
* @param imports (optional) Provide a list of imports to use for the program deployment in the
|
|
1112
|
-
* form of a javascript object where the keys are a string of the program name and the values
|
|
1113
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
1114
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
1115
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
1116
|
-
* @returns {Transaction}
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
*
|
|
1121
|
-
*
|
|
1122
|
-
*
|
|
1123
|
-
*
|
|
1124
|
-
* @param
|
|
1125
|
-
* @param
|
|
1126
|
-
*
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1138
|
-
* @
|
|
1139
|
-
* @
|
|
1140
|
-
|
|
1141
|
-
* @returns {Promise<bigint>}
|
|
1142
|
-
*/
|
|
1143
|
-
static estimateDeploymentFee(program: string, imports?: object): Promise<bigint>;
|
|
1144
|
-
/**
|
|
1145
|
-
* Estimate the component of the deployment cost which comes from the fee for the program name.
|
|
1146
|
-
* Note that this cost does not represent the entire cost of deployment. It is additional to
|
|
1147
|
-
* the cost of the size (in bytes) of the deployment.
|
|
1148
|
-
*
|
|
1149
|
-
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
1150
|
-
*
|
|
1151
|
-
* @param name The name of the program to be deployed
|
|
1152
|
-
* @returns {u64}
|
|
1153
|
-
* @param {string} name
|
|
1154
|
-
* @returns {bigint}
|
|
1155
|
-
*/
|
|
908
|
+
/**
|
|
909
|
+
* Deploy an Aleo program
|
|
910
|
+
*
|
|
911
|
+
* @param private_key The private key of the sender
|
|
912
|
+
* @param program The source code of the program being deployed
|
|
913
|
+
* @param imports A javascript object holding the source code of any imported programs in the
|
|
914
|
+
* form \{"program_name1": "program_source_code", "program_name2": "program_source_code", ..\}.
|
|
915
|
+
* Note that all imported programs must be deployed on chain before the main program in order
|
|
916
|
+
* for the deployment to succeed
|
|
917
|
+
* @param fee_credits The amount of credits to pay as a fee
|
|
918
|
+
* @param fee_record The record to spend the fee from
|
|
919
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
920
|
+
* @param imports (optional) Provide a list of imports to use for the program deployment in the
|
|
921
|
+
* form of a javascript object where the keys are a string of the program name and the values
|
|
922
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
923
|
+
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
924
|
+
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
925
|
+
* @returns {Transaction}
|
|
926
|
+
*/
|
|
927
|
+
static buildDeploymentTransaction(private_key: PrivateKey, program: string, fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
928
|
+
/**
|
|
929
|
+
* Estimate the fee for a program deployment
|
|
930
|
+
*
|
|
931
|
+
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
932
|
+
*
|
|
933
|
+
* @param program The source code of the program being deployed
|
|
934
|
+
* @param imports (optional) Provide a list of imports to use for the deployment fee estimation
|
|
935
|
+
* in the form of a javascript object where the keys are a string of the program name and the values
|
|
936
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
937
|
+
* @returns {u64}
|
|
938
|
+
*/
|
|
939
|
+
static estimateDeploymentFee(program: string, imports?: object | null): Promise<bigint>;
|
|
940
|
+
/**
|
|
941
|
+
* Estimate the component of the deployment cost which comes from the fee for the program name.
|
|
942
|
+
* Note that this cost does not represent the entire cost of deployment. It is additional to
|
|
943
|
+
* the cost of the size (in bytes) of the deployment.
|
|
944
|
+
*
|
|
945
|
+
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
946
|
+
*
|
|
947
|
+
* @param name The name of the program to be deployed
|
|
948
|
+
* @returns {u64}
|
|
949
|
+
*/
|
|
1156
950
|
static estimateProgramNameCost(name: string): bigint;
|
|
1157
|
-
/**
|
|
1158
|
-
* Execute an arbitrary function locally
|
|
1159
|
-
*
|
|
1160
|
-
* @param {PrivateKey} private_key The private key of the sender
|
|
1161
|
-
* @param {string} program The source code of the program being executed
|
|
1162
|
-
* @param {string} function The name of the function to execute
|
|
1163
|
-
* @param {Array} inputs A javascript array of inputs to the function
|
|
1164
|
-
* @param {boolean} prove_execution If true, the execution will be proven and an execution object
|
|
1165
|
-
* containing the proof and the encrypted inputs and outputs needed to verify the proof offline
|
|
1166
|
-
* will be returned.
|
|
1167
|
-
* @param {boolean} cache Cache the proving and verifying keys in the Execution response.
|
|
1168
|
-
* If this is set to 'true' the keys synthesized will be stored in the Execution Response
|
|
1169
|
-
* and the `ProvingKey` and `VerifyingKey` can be retrieved from the response via the `.getKeys()`
|
|
1170
|
-
* method.
|
|
1171
|
-
* @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
|
|
1172
|
-
* form of a javascript object where the keys are a string of the program name and the values
|
|
1173
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
1174
|
-
* @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
|
|
1175
|
-
* @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
*
|
|
1180
|
-
*
|
|
1181
|
-
* @param
|
|
1182
|
-
* @param
|
|
1183
|
-
* @param
|
|
1184
|
-
* @param
|
|
1185
|
-
* @param
|
|
1186
|
-
* @param
|
|
1187
|
-
* @
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
*
|
|
1192
|
-
*
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
1195
|
-
* @param
|
|
1196
|
-
* @param
|
|
1197
|
-
* @param
|
|
1198
|
-
* @param
|
|
1199
|
-
* @
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
*
|
|
1204
|
-
*
|
|
1205
|
-
*
|
|
1206
|
-
*
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1209
|
-
* @param
|
|
1210
|
-
* @param
|
|
1211
|
-
* @
|
|
1212
|
-
* @param
|
|
1213
|
-
* @param
|
|
1214
|
-
* @param
|
|
1215
|
-
*
|
|
1216
|
-
*
|
|
1217
|
-
* @param
|
|
1218
|
-
* @param
|
|
1219
|
-
* @
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1225
|
-
*
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
*
|
|
1230
|
-
*
|
|
1231
|
-
*
|
|
1232
|
-
|
|
1233
|
-
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
1234
|
-
*
|
|
1235
|
-
* @param private_key The private key of the sender
|
|
1236
|
-
* @param program The source code of the program to estimate the execution fee for
|
|
1237
|
-
* @param function The name of the function to execute
|
|
1238
|
-
* @param inputs A javascript array of inputs to the function
|
|
1239
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
1240
|
-
* @param imports (optional) Provide a list of imports to use for the fee estimation in the
|
|
1241
|
-
* form of a javascript object where the keys are a string of the program name and the values
|
|
1242
|
-
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
1243
|
-
* @param proving_key (optional) Provide a verifying key to use for the fee estimation
|
|
1244
|
-
* @param verifying_key (optional) Provide a verifying key to use for the fee estimation
|
|
1245
|
-
* @returns {u64} Fee in microcredits
|
|
1246
|
-
* @param {PrivateKey} private_key
|
|
1247
|
-
* @param {string} program
|
|
1248
|
-
* @param {string} _function
|
|
1249
|
-
* @param {Array<any>} inputs
|
|
1250
|
-
* @param {string | undefined} [url]
|
|
1251
|
-
* @param {object | undefined} [imports]
|
|
1252
|
-
* @param {ProvingKey | undefined} [proving_key]
|
|
1253
|
-
* @param {VerifyingKey | undefined} [verifying_key]
|
|
1254
|
-
* @param {OfflineQuery | undefined} [offline_query]
|
|
1255
|
-
* @returns {Promise<bigint>}
|
|
1256
|
-
*/
|
|
1257
|
-
static estimateExecutionFee(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, url?: string, imports?: object, proving_key?: ProvingKey, verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<bigint>;
|
|
1258
|
-
/**
|
|
1259
|
-
* Estimate the finalize fee component for executing a function. This fee is additional to the
|
|
1260
|
-
* size of the execution of the program in bytes. If the function does not have a finalize
|
|
1261
|
-
* step, then the finalize fee is 0.
|
|
1262
|
-
*
|
|
1263
|
-
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
1264
|
-
*
|
|
1265
|
-
* @param program The program containing the function to estimate the finalize fee for
|
|
1266
|
-
* @param function The function to estimate the finalize fee for
|
|
1267
|
-
* @returns {u64} Fee in microcredits
|
|
1268
|
-
* @param {string} program
|
|
1269
|
-
* @param {string} _function
|
|
1270
|
-
* @returns {bigint}
|
|
1271
|
-
*/
|
|
951
|
+
/**
|
|
952
|
+
* Execute an arbitrary function locally
|
|
953
|
+
*
|
|
954
|
+
* @param {PrivateKey} private_key The private key of the sender
|
|
955
|
+
* @param {string} program The source code of the program being executed
|
|
956
|
+
* @param {string} function The name of the function to execute
|
|
957
|
+
* @param {Array} inputs A javascript array of inputs to the function
|
|
958
|
+
* @param {boolean} prove_execution If true, the execution will be proven and an execution object
|
|
959
|
+
* containing the proof and the encrypted inputs and outputs needed to verify the proof offline
|
|
960
|
+
* will be returned.
|
|
961
|
+
* @param {boolean} cache Cache the proving and verifying keys in the Execution response.
|
|
962
|
+
* If this is set to 'true' the keys synthesized will be stored in the Execution Response
|
|
963
|
+
* and the `ProvingKey` and `VerifyingKey` can be retrieved from the response via the `.getKeys()`
|
|
964
|
+
* method.
|
|
965
|
+
* @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
|
|
966
|
+
* form of a javascript object where the keys are a string of the program name and the values
|
|
967
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
968
|
+
* @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
|
|
969
|
+
* @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
|
|
970
|
+
*/
|
|
971
|
+
static executeFunctionOffline(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, prove_execution: boolean, cache: boolean, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, url?: string | null, offline_query?: OfflineQuery | null): Promise<ExecutionResponse>;
|
|
972
|
+
/**
|
|
973
|
+
* Execute Aleo function and create an Aleo execution transaction
|
|
974
|
+
*
|
|
975
|
+
* @param private_key The private key of the sender
|
|
976
|
+
* @param program The source code of the program being executed
|
|
977
|
+
* @param function The name of the function to execute
|
|
978
|
+
* @param inputs A javascript array of inputs to the function
|
|
979
|
+
* @param fee_credits The amount of credits to pay as a fee
|
|
980
|
+
* @param fee_record The record to spend the fee from
|
|
981
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
982
|
+
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
983
|
+
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
984
|
+
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
985
|
+
* keys will be deallocated from memory after the transaction is executed.
|
|
986
|
+
* @param imports (optional) Provide a list of imports to use for the function execution in the
|
|
987
|
+
* form of a javascript object where the keys are a string of the program name and the values
|
|
988
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
989
|
+
* @param proving_key (optional) Provide a verifying key to use for the function execution
|
|
990
|
+
* @param verifying_key (optional) Provide a verifying key to use for the function execution
|
|
991
|
+
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
992
|
+
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
993
|
+
* @returns {Transaction}
|
|
994
|
+
*/
|
|
995
|
+
static buildExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
996
|
+
/**
|
|
997
|
+
* Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
|
|
998
|
+
* verifying keys will be stored in the ProgramManager's memory and used for subsequent
|
|
999
|
+
* program executions.
|
|
1000
|
+
*
|
|
1001
|
+
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
1002
|
+
*
|
|
1003
|
+
* @param private_key The private key of the sender
|
|
1004
|
+
* @param program The source code of the program to estimate the execution fee for
|
|
1005
|
+
* @param function The name of the function to execute
|
|
1006
|
+
* @param inputs A javascript array of inputs to the function
|
|
1007
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
1008
|
+
* @param imports (optional) Provide a list of imports to use for the fee estimation in the
|
|
1009
|
+
* form of a javascript object where the keys are a string of the program name and the values
|
|
1010
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
1011
|
+
* @param proving_key (optional) Provide a verifying key to use for the fee estimation
|
|
1012
|
+
* @param verifying_key (optional) Provide a verifying key to use for the fee estimation
|
|
1013
|
+
* @returns {u64} Fee in microcredits
|
|
1014
|
+
*/
|
|
1015
|
+
static estimateExecutionFee(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, url?: string | null, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<bigint>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Estimate the finalize fee component for executing a function. This fee is additional to the
|
|
1018
|
+
* size of the execution of the program in bytes. If the function does not have a finalize
|
|
1019
|
+
* step, then the finalize fee is 0.
|
|
1020
|
+
*
|
|
1021
|
+
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
1022
|
+
*
|
|
1023
|
+
* @param program The program containing the function to estimate the finalize fee for
|
|
1024
|
+
* @param function The function to estimate the finalize fee for
|
|
1025
|
+
* @returns {u64} Fee in microcredits
|
|
1026
|
+
*/
|
|
1272
1027
|
static estimateFinalizeFee(program: string, _function: string): bigint;
|
|
1273
|
-
/**
|
|
1274
|
-
* Join two records together to create a new record with an amount of credits equal to the sum
|
|
1275
|
-
* of the credits of the two original records
|
|
1276
|
-
*
|
|
1277
|
-
* @param private_key The private key of the sender
|
|
1278
|
-
* @param record_1 The first record to combine
|
|
1279
|
-
* @param record_2 The second record to combine
|
|
1280
|
-
* @param fee_credits The amount of credits to pay as a fee
|
|
1281
|
-
* @param fee_record The record to spend the fee from
|
|
1282
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
1283
|
-
* @param join_proving_key (optional) Provide a proving key to use for the join function
|
|
1284
|
-
* @param join_verifying_key (optional) Provide a verifying key to use for the join function
|
|
1285
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
1286
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
1287
|
-
* @returns {Transaction} Transaction object
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
1293
|
-
* @param
|
|
1294
|
-
* @param
|
|
1295
|
-
*
|
|
1296
|
-
* @param
|
|
1297
|
-
* @param
|
|
1298
|
-
* @param
|
|
1299
|
-
* @
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1306
|
-
* @param
|
|
1307
|
-
*
|
|
1308
|
-
* @param
|
|
1309
|
-
* @param
|
|
1310
|
-
* @param
|
|
1311
|
-
* @param
|
|
1312
|
-
* @
|
|
1313
|
-
* @param
|
|
1314
|
-
* @param
|
|
1315
|
-
*
|
|
1316
|
-
* @param
|
|
1317
|
-
* @param
|
|
1318
|
-
* @
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
* @param
|
|
1327
|
-
* @param
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
* @param amount_record The record to fund the amount from
|
|
1331
|
-
* @param fee_credits The amount of credits to pay as a fee
|
|
1332
|
-
* @param fee_record The record to spend the fee from
|
|
1333
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
1334
|
-
* @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
|
|
1335
|
-
* function
|
|
1336
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
1337
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
1338
|
-
* @returns {Transaction}
|
|
1339
|
-
* @param {PrivateKey} private_key
|
|
1340
|
-
* @param {number} amount_credits
|
|
1341
|
-
* @param {string} recipient
|
|
1342
|
-
* @param {string} transfer_type
|
|
1343
|
-
* @param {RecordPlaintext | undefined} amount_record
|
|
1344
|
-
* @param {number} fee_credits
|
|
1345
|
-
* @param {RecordPlaintext | undefined} [fee_record]
|
|
1346
|
-
* @param {string | undefined} [url]
|
|
1347
|
-
* @param {ProvingKey | undefined} [transfer_proving_key]
|
|
1348
|
-
* @param {VerifyingKey | undefined} [transfer_verifying_key]
|
|
1349
|
-
* @param {ProvingKey | undefined} [fee_proving_key]
|
|
1350
|
-
* @param {VerifyingKey | undefined} [fee_verifying_key]
|
|
1351
|
-
* @param {OfflineQuery | undefined} [offline_query]
|
|
1352
|
-
* @returns {Promise<Transaction>}
|
|
1353
|
-
*/
|
|
1354
|
-
static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, amount_record: RecordPlaintext | undefined, fee_credits: number, fee_record?: RecordPlaintext, url?: string, transfer_proving_key?: ProvingKey, transfer_verifying_key?: VerifyingKey, fee_proving_key?: ProvingKey, fee_verifying_key?: VerifyingKey, offline_query?: OfflineQuery): Promise<Transaction>;
|
|
1355
|
-
/**
|
|
1356
|
-
* Synthesize proving and verifying keys for a program
|
|
1357
|
-
*
|
|
1358
|
-
* @param program {string} The program source code of the program to synthesize keys for
|
|
1359
|
-
* @param function_id {string} The function to synthesize keys for
|
|
1360
|
-
* @param inputs {Array} The inputs to the function
|
|
1361
|
-
* @param imports {Object | undefined} The imports for the program
|
|
1362
|
-
* @param {PrivateKey} private_key
|
|
1363
|
-
* @param {string} program
|
|
1364
|
-
* @param {string} function_id
|
|
1365
|
-
* @param {Array<any>} inputs
|
|
1366
|
-
* @param {object | undefined} [imports]
|
|
1367
|
-
* @returns {Promise<KeyPair>}
|
|
1368
|
-
*/
|
|
1369
|
-
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object): Promise<KeyPair>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Join two records together to create a new record with an amount of credits equal to the sum
|
|
1030
|
+
* of the credits of the two original records
|
|
1031
|
+
*
|
|
1032
|
+
* @param private_key The private key of the sender
|
|
1033
|
+
* @param record_1 The first record to combine
|
|
1034
|
+
* @param record_2 The second record to combine
|
|
1035
|
+
* @param fee_credits The amount of credits to pay as a fee
|
|
1036
|
+
* @param fee_record The record to spend the fee from
|
|
1037
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
1038
|
+
* @param join_proving_key (optional) Provide a proving key to use for the join function
|
|
1039
|
+
* @param join_verifying_key (optional) Provide a verifying key to use for the join function
|
|
1040
|
+
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
1041
|
+
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
1042
|
+
* @returns {Transaction} Transaction object
|
|
1043
|
+
*/
|
|
1044
|
+
static buildJoinTransaction(private_key: PrivateKey, record_1: RecordPlaintext, record_2: RecordPlaintext, fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, join_proving_key?: ProvingKey | null, join_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
1045
|
+
/**
|
|
1046
|
+
* Split an Aleo credits record into two separate records. This function does not require a fee.
|
|
1047
|
+
*
|
|
1048
|
+
* @param private_key The private key of the sender
|
|
1049
|
+
* @param split_amount The amount of the credit split. This amount will be subtracted from the
|
|
1050
|
+
* value of the record and two new records will be created with the split amount and the remainder
|
|
1051
|
+
* @param amount_record The record to split
|
|
1052
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
1053
|
+
* @param split_proving_key (optional) Provide a proving key to use for the split function
|
|
1054
|
+
* @param split_verifying_key (optional) Provide a verifying key to use for the split function
|
|
1055
|
+
* @returns {Transaction} Transaction object
|
|
1056
|
+
*/
|
|
1057
|
+
static buildSplitTransaction(private_key: PrivateKey, split_amount: number, amount_record: RecordPlaintext, url?: string | null, split_proving_key?: ProvingKey | null, split_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Send credits from one Aleo account to another
|
|
1060
|
+
*
|
|
1061
|
+
* @param private_key The private key of the sender
|
|
1062
|
+
* @param amount_credits The amount of credits to send
|
|
1063
|
+
* @param recipient The recipient of the transaction
|
|
1064
|
+
* @param transfer_type The type of the transfer (options: "private", "public", "private_to_public", "public_to_private")
|
|
1065
|
+
* @param amount_record The record to fund the amount from
|
|
1066
|
+
* @param fee_credits The amount of credits to pay as a fee
|
|
1067
|
+
* @param fee_record The record to spend the fee from
|
|
1068
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
1069
|
+
* @param transfer_verifying_key (optional) Provide a verifying key to use for the transfer
|
|
1070
|
+
* function
|
|
1071
|
+
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
1072
|
+
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
1073
|
+
* @returns {Transaction}
|
|
1074
|
+
*/
|
|
1075
|
+
static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, amount_record: RecordPlaintext | null | undefined, fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, transfer_proving_key?: ProvingKey | null, transfer_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
1076
|
+
/**
|
|
1077
|
+
* Synthesize proving and verifying keys for a program
|
|
1078
|
+
*
|
|
1079
|
+
* @param program {string} The program source code of the program to synthesize keys for
|
|
1080
|
+
* @param function_id {string} The function to synthesize keys for
|
|
1081
|
+
* @param inputs {Array} The inputs to the function
|
|
1082
|
+
* @param imports {Object | undefined} The imports for the program
|
|
1083
|
+
*/
|
|
1084
|
+
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object | null): Promise<KeyPair>;
|
|
1370
1085
|
}
|
|
1371
1086
|
/**
|
|
1372
|
-
* Proving key for a function within an Aleo program
|
|
1373
|
-
*/
|
|
1087
|
+
* Proving key for a function within an Aleo program
|
|
1088
|
+
*/
|
|
1374
1089
|
export class ProvingKey {
|
|
1090
|
+
private constructor();
|
|
1375
1091
|
free(): void;
|
|
1376
|
-
/**
|
|
1377
|
-
* Verify if the proving key is for the bond_public function
|
|
1378
|
-
*
|
|
1379
|
-
* @example
|
|
1380
|
-
* const provingKey = ProvingKey.fromBytes("bond_public_proving_key.bin");
|
|
1381
|
-
* provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1382
|
-
*
|
|
1383
|
-
* @returns {boolean} returns true if the proving key is for the bond_public function, false if otherwise
|
|
1384
|
-
|
|
1385
|
-
*/
|
|
1092
|
+
/**
|
|
1093
|
+
* Verify if the proving key is for the bond_public function
|
|
1094
|
+
*
|
|
1095
|
+
* @example
|
|
1096
|
+
* const provingKey = ProvingKey.fromBytes("bond_public_proving_key.bin");
|
|
1097
|
+
* provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1098
|
+
*
|
|
1099
|
+
* @returns {boolean} returns true if the proving key is for the bond_public function, false if otherwise
|
|
1100
|
+
*/
|
|
1386
1101
|
isBondPublicProver(): boolean;
|
|
1387
|
-
/**
|
|
1388
|
-
* Verify if the proving key is for the bond_validator function
|
|
1389
|
-
*
|
|
1390
|
-
* @example
|
|
1391
|
-
* const provingKey = ProvingKey.fromBytes("bond_validator_proving_key.bin");
|
|
1392
|
-
* provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1393
|
-
*
|
|
1394
|
-
* @returns {boolean} returns true if the proving key is for the bond_validator function, false if otherwise
|
|
1395
|
-
|
|
1396
|
-
*/
|
|
1102
|
+
/**
|
|
1103
|
+
* Verify if the proving key is for the bond_validator function
|
|
1104
|
+
*
|
|
1105
|
+
* @example
|
|
1106
|
+
* const provingKey = ProvingKey.fromBytes("bond_validator_proving_key.bin");
|
|
1107
|
+
* provingKey.isBondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1108
|
+
*
|
|
1109
|
+
* @returns {boolean} returns true if the proving key is for the bond_validator function, false if otherwise
|
|
1110
|
+
*/
|
|
1397
1111
|
isBondValidatorProver(): boolean;
|
|
1398
|
-
/**
|
|
1399
|
-
* Verify if the proving key is for the claim_unbond function
|
|
1400
|
-
*
|
|
1401
|
-
* @example
|
|
1402
|
-
* const provingKey = ProvingKey.fromBytes("claim_unbond_proving_key.bin");
|
|
1403
|
-
* provingKey.isClaimUnbondProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1404
|
-
*
|
|
1405
|
-
* @returns {boolean} returns true if the proving key is for the claim_unbond function, false if otherwise
|
|
1406
|
-
|
|
1407
|
-
*/
|
|
1112
|
+
/**
|
|
1113
|
+
* Verify if the proving key is for the claim_unbond function
|
|
1114
|
+
*
|
|
1115
|
+
* @example
|
|
1116
|
+
* const provingKey = ProvingKey.fromBytes("claim_unbond_proving_key.bin");
|
|
1117
|
+
* provingKey.isClaimUnbondProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1118
|
+
*
|
|
1119
|
+
* @returns {boolean} returns true if the proving key is for the claim_unbond function, false if otherwise
|
|
1120
|
+
*/
|
|
1408
1121
|
isClaimUnbondPublicProver(): boolean;
|
|
1409
|
-
/**
|
|
1410
|
-
* Verify if the proving key is for the fee_private function
|
|
1411
|
-
*
|
|
1412
|
-
* @example
|
|
1413
|
-
* const provingKey = ProvingKey.fromBytes("fee_private_proving_key.bin");
|
|
1414
|
-
* provingKey.isFeePrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1415
|
-
*
|
|
1416
|
-
* @returns {boolean} returns true if the proving key is for the fee_private function, false if otherwise
|
|
1417
|
-
|
|
1418
|
-
*/
|
|
1122
|
+
/**
|
|
1123
|
+
* Verify if the proving key is for the fee_private function
|
|
1124
|
+
*
|
|
1125
|
+
* @example
|
|
1126
|
+
* const provingKey = ProvingKey.fromBytes("fee_private_proving_key.bin");
|
|
1127
|
+
* provingKey.isFeePrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1128
|
+
*
|
|
1129
|
+
* @returns {boolean} returns true if the proving key is for the fee_private function, false if otherwise
|
|
1130
|
+
*/
|
|
1419
1131
|
isFeePrivateProver(): boolean;
|
|
1420
|
-
/**
|
|
1421
|
-
* Verify if the proving key is for the fee_public function
|
|
1422
|
-
*
|
|
1423
|
-
* @example
|
|
1424
|
-
* const provingKey = ProvingKey.fromBytes("fee_public_proving_key.bin");
|
|
1425
|
-
* provingKey.isFeePublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1426
|
-
*
|
|
1427
|
-
* @returns {boolean} returns true if the proving key is for the fee_public function, false if otherwise
|
|
1428
|
-
|
|
1429
|
-
*/
|
|
1132
|
+
/**
|
|
1133
|
+
* Verify if the proving key is for the fee_public function
|
|
1134
|
+
*
|
|
1135
|
+
* @example
|
|
1136
|
+
* const provingKey = ProvingKey.fromBytes("fee_public_proving_key.bin");
|
|
1137
|
+
* provingKey.isFeePublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1138
|
+
*
|
|
1139
|
+
* @returns {boolean} returns true if the proving key is for the fee_public function, false if otherwise
|
|
1140
|
+
*/
|
|
1430
1141
|
isFeePublicProver(): boolean;
|
|
1431
|
-
/**
|
|
1432
|
-
* Verify if the proving key is for the inclusion function
|
|
1433
|
-
*
|
|
1434
|
-
* @example
|
|
1435
|
-
* const provingKey = ProvingKey.fromBytes("inclusion_proving_key.bin");
|
|
1436
|
-
* provingKey.isInclusionProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1437
|
-
*
|
|
1438
|
-
* @returns {boolean} returns true if the proving key is for the inclusion function, false if otherwise
|
|
1439
|
-
|
|
1440
|
-
*/
|
|
1142
|
+
/**
|
|
1143
|
+
* Verify if the proving key is for the inclusion function
|
|
1144
|
+
*
|
|
1145
|
+
* @example
|
|
1146
|
+
* const provingKey = ProvingKey.fromBytes("inclusion_proving_key.bin");
|
|
1147
|
+
* provingKey.isInclusionProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1148
|
+
*
|
|
1149
|
+
* @returns {boolean} returns true if the proving key is for the inclusion function, false if otherwise
|
|
1150
|
+
*/
|
|
1441
1151
|
isInclusionProver(): boolean;
|
|
1442
|
-
/**
|
|
1443
|
-
* Verify if the proving key is for the join function
|
|
1444
|
-
*
|
|
1445
|
-
* @example
|
|
1446
|
-
* const provingKey = ProvingKey.fromBytes("join_proving_key.bin");
|
|
1447
|
-
* provingKey.isJoinProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1448
|
-
*
|
|
1449
|
-
* @returns {boolean} returns true if the proving key is for the join function, false if otherwise
|
|
1450
|
-
|
|
1451
|
-
*/
|
|
1152
|
+
/**
|
|
1153
|
+
* Verify if the proving key is for the join function
|
|
1154
|
+
*
|
|
1155
|
+
* @example
|
|
1156
|
+
* const provingKey = ProvingKey.fromBytes("join_proving_key.bin");
|
|
1157
|
+
* provingKey.isJoinProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1158
|
+
*
|
|
1159
|
+
* @returns {boolean} returns true if the proving key is for the join function, false if otherwise
|
|
1160
|
+
*/
|
|
1452
1161
|
isJoinProver(): boolean;
|
|
1453
|
-
/**
|
|
1454
|
-
* Verify if the proving key is for the set_validator_state function
|
|
1455
|
-
*
|
|
1456
|
-
* @example
|
|
1457
|
-
* const provingKey = ProvingKey.fromBytes("set_validator_set_proving_key.bin");
|
|
1458
|
-
* provingKey.isSetValidatorStateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1459
|
-
*
|
|
1460
|
-
* @returns {boolean} returns true if the proving key is for the set_validator_state function, false if otherwise
|
|
1461
|
-
|
|
1462
|
-
*/
|
|
1162
|
+
/**
|
|
1163
|
+
* Verify if the proving key is for the set_validator_state function
|
|
1164
|
+
*
|
|
1165
|
+
* @example
|
|
1166
|
+
* const provingKey = ProvingKey.fromBytes("set_validator_set_proving_key.bin");
|
|
1167
|
+
* provingKey.isSetValidatorStateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1168
|
+
*
|
|
1169
|
+
* @returns {boolean} returns true if the proving key is for the set_validator_state function, false if otherwise
|
|
1170
|
+
*/
|
|
1463
1171
|
isSetValidatorStateProver(): boolean;
|
|
1464
|
-
/**
|
|
1465
|
-
* Verify if the proving key is for the split function
|
|
1466
|
-
*
|
|
1467
|
-
* @example
|
|
1468
|
-
* const provingKey = ProvingKey.fromBytes("split_proving_key.bin");
|
|
1469
|
-
* provingKey.isSplitProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1470
|
-
*
|
|
1471
|
-
* @returns {boolean} returns true if the proving key is for the split function, false if otherwise
|
|
1472
|
-
|
|
1473
|
-
*/
|
|
1172
|
+
/**
|
|
1173
|
+
* Verify if the proving key is for the split function
|
|
1174
|
+
*
|
|
1175
|
+
* @example
|
|
1176
|
+
* const provingKey = ProvingKey.fromBytes("split_proving_key.bin");
|
|
1177
|
+
* provingKey.isSplitProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1178
|
+
*
|
|
1179
|
+
* @returns {boolean} returns true if the proving key is for the split function, false if otherwise
|
|
1180
|
+
*/
|
|
1474
1181
|
isSplitProver(): boolean;
|
|
1475
|
-
/**
|
|
1476
|
-
* Verify if the proving key is for the transfer_private function
|
|
1477
|
-
*
|
|
1478
|
-
* @example
|
|
1479
|
-
* const provingKey = ProvingKey.fromBytes("transfer_private_proving_key.bin");
|
|
1480
|
-
* provingKey.isTransferPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1481
|
-
*
|
|
1482
|
-
* @returns {boolean} returns true if the proving key is for the transfer_private function, false if otherwise
|
|
1483
|
-
|
|
1484
|
-
*/
|
|
1182
|
+
/**
|
|
1183
|
+
* Verify if the proving key is for the transfer_private function
|
|
1184
|
+
*
|
|
1185
|
+
* @example
|
|
1186
|
+
* const provingKey = ProvingKey.fromBytes("transfer_private_proving_key.bin");
|
|
1187
|
+
* provingKey.isTransferPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1188
|
+
*
|
|
1189
|
+
* @returns {boolean} returns true if the proving key is for the transfer_private function, false if otherwise
|
|
1190
|
+
*/
|
|
1485
1191
|
isTransferPrivateProver(): boolean;
|
|
1486
|
-
/**
|
|
1487
|
-
* Verify if the proving key is for the transfer_private_to_public function
|
|
1488
|
-
*
|
|
1489
|
-
* @example
|
|
1490
|
-
* const provingKey = ProvingKey.fromBytes("transfer_private_to_public_proving_key.bin");
|
|
1491
|
-
* provingKey.isTransferPrivateToPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1492
|
-
*
|
|
1493
|
-
* @returns {boolean} returns true if the proving key is for the transfer_private_to_public function, false if otherwise
|
|
1494
|
-
|
|
1495
|
-
*/
|
|
1192
|
+
/**
|
|
1193
|
+
* Verify if the proving key is for the transfer_private_to_public function
|
|
1194
|
+
*
|
|
1195
|
+
* @example
|
|
1196
|
+
* const provingKey = ProvingKey.fromBytes("transfer_private_to_public_proving_key.bin");
|
|
1197
|
+
* provingKey.isTransferPrivateToPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1198
|
+
*
|
|
1199
|
+
* @returns {boolean} returns true if the proving key is for the transfer_private_to_public function, false if otherwise
|
|
1200
|
+
*/
|
|
1496
1201
|
isTransferPrivateToPublicProver(): boolean;
|
|
1497
|
-
/**
|
|
1498
|
-
* Verify if the proving key is for the transfer_public function
|
|
1499
|
-
*
|
|
1500
|
-
* @example
|
|
1501
|
-
* const provingKey = ProvingKey.fromBytes("transfer_public_proving_key.bin");
|
|
1502
|
-
* provingKey.isTransferPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1503
|
-
*
|
|
1504
|
-
* @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
|
|
1505
|
-
|
|
1506
|
-
*/
|
|
1202
|
+
/**
|
|
1203
|
+
* Verify if the proving key is for the transfer_public function
|
|
1204
|
+
*
|
|
1205
|
+
* @example
|
|
1206
|
+
* const provingKey = ProvingKey.fromBytes("transfer_public_proving_key.bin");
|
|
1207
|
+
* provingKey.isTransferPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1208
|
+
*
|
|
1209
|
+
* @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
|
|
1210
|
+
*/
|
|
1507
1211
|
isTransferPublicProver(): boolean;
|
|
1508
|
-
/**
|
|
1509
|
-
* Verify if the proving key is for the transfer_public_as_signer function
|
|
1510
|
-
*
|
|
1511
|
-
* @example
|
|
1512
|
-
* const provingKey = ProvingKey.fromBytes("transfer_public_as_signer_proving_key.bin");
|
|
1513
|
-
* provingKey.isTransferPublicAsSignerProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1514
|
-
*
|
|
1515
|
-
* @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
|
|
1516
|
-
|
|
1517
|
-
*/
|
|
1212
|
+
/**
|
|
1213
|
+
* Verify if the proving key is for the transfer_public_as_signer function
|
|
1214
|
+
*
|
|
1215
|
+
* @example
|
|
1216
|
+
* const provingKey = ProvingKey.fromBytes("transfer_public_as_signer_proving_key.bin");
|
|
1217
|
+
* provingKey.isTransferPublicAsSignerProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1218
|
+
*
|
|
1219
|
+
* @returns {boolean} returns true if the proving key is for the transfer_public function, false if otherwise
|
|
1220
|
+
*/
|
|
1518
1221
|
isTransferPublicAsSignerProver(): boolean;
|
|
1519
|
-
/**
|
|
1520
|
-
* Verify if the proving key is for the transfer_public_to_private function
|
|
1521
|
-
*
|
|
1522
|
-
* @example
|
|
1523
|
-
* const provingKey = ProvingKey.fromBytes("transfer_public_to_private_proving_key.bin");
|
|
1524
|
-
* provingKey.isTransferPublicToPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1525
|
-
*
|
|
1526
|
-
* @returns {boolean} returns true if the proving key is for the transfer_public_to_private function, false if otherwise
|
|
1527
|
-
|
|
1528
|
-
*/
|
|
1222
|
+
/**
|
|
1223
|
+
* Verify if the proving key is for the transfer_public_to_private function
|
|
1224
|
+
*
|
|
1225
|
+
* @example
|
|
1226
|
+
* const provingKey = ProvingKey.fromBytes("transfer_public_to_private_proving_key.bin");
|
|
1227
|
+
* provingKey.isTransferPublicToPrivateProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1228
|
+
*
|
|
1229
|
+
* @returns {boolean} returns true if the proving key is for the transfer_public_to_private function, false if otherwise
|
|
1230
|
+
*/
|
|
1529
1231
|
isTransferPublicToPrivateProver(): boolean;
|
|
1530
|
-
/**
|
|
1531
|
-
* Verify if the proving key is for the unbond_public function
|
|
1532
|
-
*
|
|
1533
|
-
* @example
|
|
1534
|
-
* const provingKey = ProvingKey.fromBytes("unbond_public.bin");
|
|
1535
|
-
* provingKey.isUnbondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1536
|
-
*
|
|
1537
|
-
* @returns {boolean} returns true if the proving key is for the unbond_public_prover function, false if otherwise
|
|
1538
|
-
|
|
1539
|
-
*/
|
|
1232
|
+
/**
|
|
1233
|
+
* Verify if the proving key is for the unbond_public function
|
|
1234
|
+
*
|
|
1235
|
+
* @example
|
|
1236
|
+
* const provingKey = ProvingKey.fromBytes("unbond_public.bin");
|
|
1237
|
+
* provingKey.isUnbondPublicProver() ? console.log("Key verified") : throw new Error("Invalid key");
|
|
1238
|
+
*
|
|
1239
|
+
* @returns {boolean} returns true if the proving key is for the unbond_public_prover function, false if otherwise
|
|
1240
|
+
*/
|
|
1540
1241
|
isUnbondPublicProver(): boolean;
|
|
1541
|
-
/**
|
|
1542
|
-
* Return the checksum of the proving key
|
|
1543
|
-
*
|
|
1544
|
-
* @returns {string} Checksum of the proving key
|
|
1545
|
-
|
|
1546
|
-
*/
|
|
1242
|
+
/**
|
|
1243
|
+
* Return the checksum of the proving key
|
|
1244
|
+
*
|
|
1245
|
+
* @returns {string} Checksum of the proving key
|
|
1246
|
+
*/
|
|
1547
1247
|
checksum(): string;
|
|
1548
|
-
/**
|
|
1549
|
-
* Create a copy of the proving key
|
|
1550
|
-
*
|
|
1551
|
-
* @returns {ProvingKey} A copy of the proving key
|
|
1552
|
-
|
|
1553
|
-
*/
|
|
1248
|
+
/**
|
|
1249
|
+
* Create a copy of the proving key
|
|
1250
|
+
*
|
|
1251
|
+
* @returns {ProvingKey} A copy of the proving key
|
|
1252
|
+
*/
|
|
1554
1253
|
copy(): ProvingKey;
|
|
1555
|
-
/**
|
|
1556
|
-
* Construct a new proving key from a byte array
|
|
1557
|
-
*
|
|
1558
|
-
* @param {Uint8Array} bytes Byte array representation of a proving key
|
|
1559
|
-
* @returns {ProvingKey}
|
|
1560
|
-
|
|
1561
|
-
* @returns {ProvingKey}
|
|
1562
|
-
*/
|
|
1254
|
+
/**
|
|
1255
|
+
* Construct a new proving key from a byte array
|
|
1256
|
+
*
|
|
1257
|
+
* @param {Uint8Array} bytes Byte array representation of a proving key
|
|
1258
|
+
* @returns {ProvingKey}
|
|
1259
|
+
*/
|
|
1563
1260
|
static fromBytes(bytes: Uint8Array): ProvingKey;
|
|
1564
|
-
/**
|
|
1565
|
-
* Create a proving key from string
|
|
1566
|
-
*
|
|
1567
|
-
* @param {string} String representation of the proving key
|
|
1568
|
-
|
|
1569
|
-
* @returns {ProvingKey}
|
|
1570
|
-
*/
|
|
1261
|
+
/**
|
|
1262
|
+
* Create a proving key from string
|
|
1263
|
+
*
|
|
1264
|
+
* @param {string} String representation of the proving key
|
|
1265
|
+
*/
|
|
1571
1266
|
static fromString(string: string): ProvingKey;
|
|
1572
|
-
/**
|
|
1573
|
-
* Return the byte representation of a proving key
|
|
1574
|
-
*
|
|
1575
|
-
* @returns {Uint8Array} Byte array representation of a proving key
|
|
1576
|
-
|
|
1577
|
-
*/
|
|
1267
|
+
/**
|
|
1268
|
+
* Return the byte representation of a proving key
|
|
1269
|
+
*
|
|
1270
|
+
* @returns {Uint8Array} Byte array representation of a proving key
|
|
1271
|
+
*/
|
|
1578
1272
|
toBytes(): Uint8Array;
|
|
1579
|
-
/**
|
|
1580
|
-
* Get a string representation of the proving key
|
|
1581
|
-
*
|
|
1582
|
-
* @returns {string} String representation of the proving key
|
|
1583
|
-
|
|
1584
|
-
*/
|
|
1273
|
+
/**
|
|
1274
|
+
* Get a string representation of the proving key
|
|
1275
|
+
*
|
|
1276
|
+
* @returns {string} String representation of the proving key
|
|
1277
|
+
*/
|
|
1585
1278
|
toString(): string;
|
|
1586
1279
|
}
|
|
1587
1280
|
/**
|
|
1588
|
-
* Encrypted Aleo record
|
|
1589
|
-
*/
|
|
1281
|
+
* Encrypted Aleo record
|
|
1282
|
+
*/
|
|
1590
1283
|
export class RecordCiphertext {
|
|
1284
|
+
private constructor();
|
|
1591
1285
|
free(): void;
|
|
1592
|
-
/**
|
|
1593
|
-
* Create a record ciphertext from a string
|
|
1594
|
-
*
|
|
1595
|
-
* @param {string} record String representation of a record ciphertext
|
|
1596
|
-
* @returns {RecordCiphertext} Record ciphertext
|
|
1597
|
-
|
|
1598
|
-
* @returns {RecordCiphertext}
|
|
1599
|
-
*/
|
|
1286
|
+
/**
|
|
1287
|
+
* Create a record ciphertext from a string
|
|
1288
|
+
*
|
|
1289
|
+
* @param {string} record String representation of a record ciphertext
|
|
1290
|
+
* @returns {RecordCiphertext} Record ciphertext
|
|
1291
|
+
*/
|
|
1600
1292
|
static fromString(record: string): RecordCiphertext;
|
|
1601
|
-
/**
|
|
1602
|
-
* Return the string reprensentation of the record ciphertext
|
|
1603
|
-
*
|
|
1604
|
-
* @returns {string} String representation of the record ciphertext
|
|
1605
|
-
|
|
1606
|
-
*/
|
|
1293
|
+
/**
|
|
1294
|
+
* Return the string reprensentation of the record ciphertext
|
|
1295
|
+
*
|
|
1296
|
+
* @returns {string} String representation of the record ciphertext
|
|
1297
|
+
*/
|
|
1607
1298
|
toString(): string;
|
|
1608
|
-
/**
|
|
1609
|
-
* Decrypt the record ciphertext into plaintext using the view key. The record will only
|
|
1610
|
-
* decrypt if the record was encrypted by the account corresponding to the view key
|
|
1611
|
-
*
|
|
1612
|
-
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
1613
|
-
* @returns {RecordPlaintext} Record plaintext object
|
|
1614
|
-
|
|
1615
|
-
* @returns {RecordPlaintext}
|
|
1616
|
-
*/
|
|
1299
|
+
/**
|
|
1300
|
+
* Decrypt the record ciphertext into plaintext using the view key. The record will only
|
|
1301
|
+
* decrypt if the record was encrypted by the account corresponding to the view key
|
|
1302
|
+
*
|
|
1303
|
+
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
1304
|
+
* @returns {RecordPlaintext} Record plaintext object
|
|
1305
|
+
*/
|
|
1617
1306
|
decrypt(view_key: ViewKey): RecordPlaintext;
|
|
1618
|
-
/**
|
|
1619
|
-
* Determines if the account corresponding to the view key is the owner of the record
|
|
1620
|
-
*
|
|
1621
|
-
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
1622
|
-
* @returns {boolean}
|
|
1623
|
-
|
|
1624
|
-
* @returns {boolean}
|
|
1625
|
-
*/
|
|
1307
|
+
/**
|
|
1308
|
+
* Determines if the account corresponding to the view key is the owner of the record
|
|
1309
|
+
*
|
|
1310
|
+
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
1311
|
+
* @returns {boolean}
|
|
1312
|
+
*/
|
|
1626
1313
|
isOwner(view_key: ViewKey): boolean;
|
|
1627
|
-
/**
|
|
1628
|
-
* Get the tag of the record using the graph key.
|
|
1629
|
-
*
|
|
1630
|
-
* @param {GraphKey} graph key of the account associatd with the record.
|
|
1631
|
-
* @param {Field} commitment of the record.
|
|
1632
|
-
*
|
|
1633
|
-
* @returns {Field} tag of the record.
|
|
1634
|
-
|
|
1635
|
-
* @param {Field} commitment
|
|
1636
|
-
* @returns {Field}
|
|
1637
|
-
*/
|
|
1314
|
+
/**
|
|
1315
|
+
* Get the tag of the record using the graph key.
|
|
1316
|
+
*
|
|
1317
|
+
* @param {GraphKey} graph key of the account associatd with the record.
|
|
1318
|
+
* @param {Field} commitment of the record.
|
|
1319
|
+
*
|
|
1320
|
+
* @returns {Field} tag of the record.
|
|
1321
|
+
*/
|
|
1638
1322
|
static tag(graph_key: GraphKey, commitment: Field): Field;
|
|
1639
1323
|
}
|
|
1640
1324
|
/**
|
|
1641
|
-
* Plaintext representation of an Aleo record
|
|
1642
|
-
*/
|
|
1325
|
+
* Plaintext representation of an Aleo record
|
|
1326
|
+
*/
|
|
1643
1327
|
export class RecordPlaintext {
|
|
1328
|
+
private constructor();
|
|
1644
1329
|
free(): void;
|
|
1645
|
-
/**
|
|
1646
|
-
* @param {string} program_id
|
|
1647
|
-
* @param {string} record_name
|
|
1648
|
-
* @returns {Field}
|
|
1649
|
-
*/
|
|
1650
1330
|
commitment(program_id: string, record_name: string): Field;
|
|
1651
|
-
/**
|
|
1652
|
-
* Return a record plaintext from a string.
|
|
1653
|
-
*
|
|
1654
|
-
* @param {string} record String representation of a plaintext representation of an Aleo record
|
|
1655
|
-
* @returns {RecordPlaintext} Record plaintext
|
|
1656
|
-
|
|
1657
|
-
* @returns {RecordPlaintext}
|
|
1658
|
-
*/
|
|
1331
|
+
/**
|
|
1332
|
+
* Return a record plaintext from a string.
|
|
1333
|
+
*
|
|
1334
|
+
* @param {string} record String representation of a plaintext representation of an Aleo record
|
|
1335
|
+
* @returns {RecordPlaintext} Record plaintext
|
|
1336
|
+
*/
|
|
1659
1337
|
static fromString(record: string): RecordPlaintext;
|
|
1660
|
-
/**
|
|
1661
|
-
* @param {string} input
|
|
1662
|
-
* @returns {Plaintext}
|
|
1663
|
-
*/
|
|
1664
1338
|
getMember(input: string): Plaintext;
|
|
1665
|
-
/**
|
|
1666
|
-
* Get the owner of the record.
|
|
1667
|
-
|
|
1668
|
-
*/
|
|
1339
|
+
/**
|
|
1340
|
+
* Get the owner of the record.
|
|
1341
|
+
*/
|
|
1669
1342
|
owner(): Address;
|
|
1670
|
-
/**
|
|
1671
|
-
* Get a representation of a record as a javascript object for usage in client side
|
|
1672
|
-
* computations. Note that this is not a reversible operation and exists for the convenience
|
|
1673
|
-
* of discovering and using properties of the record.
|
|
1674
|
-
*
|
|
1675
|
-
* The conversion guide is as follows:
|
|
1676
|
-
* - u8, u16, u32, i8, i16 i32 --> Number
|
|
1677
|
-
* - u64, u128, i64, i128 --> BigInt
|
|
1678
|
-
* - Address, Field, Group, Scalar --> String.
|
|
1679
|
-
*
|
|
1680
|
-
* Address, Field, Group, and Scalar will all be converted to their bech32 string
|
|
1681
|
-
* representation. These string representations can be converted back to their respective wasm
|
|
1682
|
-
* types using the fromString method on the Address, Field, Group, and Scalar objects in this
|
|
1683
|
-
* library.
|
|
1684
|
-
*
|
|
1685
|
-
* @example
|
|
1686
|
-
* # Create a wasm record from a record string.
|
|
1687
|
-
* let record_plaintext_wasm = RecordPlainext.from_string("{
|
|
1688
|
-
* owner: aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48.private,
|
|
1689
|
-
* metadata: {
|
|
1690
|
-
* player1: aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48.private,
|
|
1691
|
-
* player2: aleo1dreuxnmg9cny8ee9v2u0wr4v4affnwm09u2pytfwz0f2en2shgqsdsfjn6.private,
|
|
1692
|
-
* nonce: 660310649780728486489183263981322848354071976582883879926426319832534836534field.private
|
|
1693
|
-
* },
|
|
1694
|
-
* id: 1953278585719525811355617404139099418855053112960441725284031425961000152405field.private,
|
|
1695
|
-
* positions: 50794271u64.private,
|
|
1696
|
-
* attempts: 0u64.private,
|
|
1697
|
-
* hits: 0u64.private,
|
|
1698
|
-
* _nonce: 5668100912391182624073500093436664635767788874314097667746354181784048204413group.public
|
|
1699
|
-
* }");
|
|
1700
|
-
*
|
|
1701
|
-
* let expected_object = {
|
|
1702
|
-
* owner: "aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48",
|
|
1703
|
-
* metadata: {
|
|
1704
|
-
* player1: "aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48",
|
|
1705
|
-
* player2: "aleo1dreuxnmg9cny8ee9v2u0wr4v4affnwm09u2pytfwz0f2en2shgqsdsfjn6",
|
|
1706
|
-
* nonce: "660310649780728486489183263981322848354071976582883879926426319832534836534field"
|
|
1707
|
-
* },
|
|
1708
|
-
* id: "1953278585719525811355617404139099418855053112960441725284031425961000152405field",
|
|
1709
|
-
* positions: 50794271,
|
|
1710
|
-
* attempts: 0,
|
|
1711
|
-
* hits: 0,
|
|
1712
|
-
* _nonce: "5668100912391182624073500093436664635767788874314097667746354181784048204413group"
|
|
1713
|
-
* };
|
|
1714
|
-
*
|
|
1715
|
-
* # Create the expected object
|
|
1716
|
-
* let record_plaintext_object = record_plaintext_wasm.to_js_object();
|
|
1717
|
-
* assert(JSON.stringify(record_plaintext_object) == JSON.stringify(expected_object));
|
|
1718
|
-
*
|
|
1719
|
-
* @returns {Object} Javascript object representation of the record
|
|
1720
|
-
|
|
1721
|
-
*/
|
|
1343
|
+
/**
|
|
1344
|
+
* Get a representation of a record as a javascript object for usage in client side
|
|
1345
|
+
* computations. Note that this is not a reversible operation and exists for the convenience
|
|
1346
|
+
* of discovering and using properties of the record.
|
|
1347
|
+
*
|
|
1348
|
+
* The conversion guide is as follows:
|
|
1349
|
+
* - u8, u16, u32, i8, i16 i32 --> Number
|
|
1350
|
+
* - u64, u128, i64, i128 --> BigInt
|
|
1351
|
+
* - Address, Field, Group, Scalar --> String.
|
|
1352
|
+
*
|
|
1353
|
+
* Address, Field, Group, and Scalar will all be converted to their bech32 string
|
|
1354
|
+
* representation. These string representations can be converted back to their respective wasm
|
|
1355
|
+
* types using the fromString method on the Address, Field, Group, and Scalar objects in this
|
|
1356
|
+
* library.
|
|
1357
|
+
*
|
|
1358
|
+
* @example
|
|
1359
|
+
* # Create a wasm record from a record string.
|
|
1360
|
+
* let record_plaintext_wasm = RecordPlainext.from_string("{
|
|
1361
|
+
* owner: aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48.private,
|
|
1362
|
+
* metadata: {
|
|
1363
|
+
* player1: aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48.private,
|
|
1364
|
+
* player2: aleo1dreuxnmg9cny8ee9v2u0wr4v4affnwm09u2pytfwz0f2en2shgqsdsfjn6.private,
|
|
1365
|
+
* nonce: 660310649780728486489183263981322848354071976582883879926426319832534836534field.private
|
|
1366
|
+
* },
|
|
1367
|
+
* id: 1953278585719525811355617404139099418855053112960441725284031425961000152405field.private,
|
|
1368
|
+
* positions: 50794271u64.private,
|
|
1369
|
+
* attempts: 0u64.private,
|
|
1370
|
+
* hits: 0u64.private,
|
|
1371
|
+
* _nonce: 5668100912391182624073500093436664635767788874314097667746354181784048204413group.public
|
|
1372
|
+
* }");
|
|
1373
|
+
*
|
|
1374
|
+
* let expected_object = {
|
|
1375
|
+
* owner: "aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48",
|
|
1376
|
+
* metadata: {
|
|
1377
|
+
* player1: "aleo1kh5t7m30djl0ecdn4f5vuzp7dx0tcwh7ncquqjkm4matj2p2zqpqm6at48",
|
|
1378
|
+
* player2: "aleo1dreuxnmg9cny8ee9v2u0wr4v4affnwm09u2pytfwz0f2en2shgqsdsfjn6",
|
|
1379
|
+
* nonce: "660310649780728486489183263981322848354071976582883879926426319832534836534field"
|
|
1380
|
+
* },
|
|
1381
|
+
* id: "1953278585719525811355617404139099418855053112960441725284031425961000152405field",
|
|
1382
|
+
* positions: 50794271,
|
|
1383
|
+
* attempts: 0,
|
|
1384
|
+
* hits: 0,
|
|
1385
|
+
* _nonce: "5668100912391182624073500093436664635767788874314097667746354181784048204413group"
|
|
1386
|
+
* };
|
|
1387
|
+
*
|
|
1388
|
+
* # Create the expected object
|
|
1389
|
+
* let record_plaintext_object = record_plaintext_wasm.to_js_object();
|
|
1390
|
+
* assert(JSON.stringify(record_plaintext_object) == JSON.stringify(expected_object));
|
|
1391
|
+
*
|
|
1392
|
+
* @returns {Object} Javascript object representation of the record
|
|
1393
|
+
*/
|
|
1722
1394
|
toJsObject(): object;
|
|
1723
|
-
/**
|
|
1724
|
-
* Returns the record plaintext string
|
|
1725
|
-
*
|
|
1726
|
-
* @returns {string} String representation of the record plaintext
|
|
1727
|
-
|
|
1728
|
-
*/
|
|
1395
|
+
/**
|
|
1396
|
+
* Returns the record plaintext string
|
|
1397
|
+
*
|
|
1398
|
+
* @returns {string} String representation of the record plaintext
|
|
1399
|
+
*/
|
|
1729
1400
|
toString(): string;
|
|
1730
|
-
/**
|
|
1731
|
-
* Returns the amount of microcredits in the record
|
|
1732
|
-
*
|
|
1733
|
-
* @returns {u64} Amount of microcredits in the record
|
|
1734
|
-
|
|
1735
|
-
*/
|
|
1401
|
+
/**
|
|
1402
|
+
* Returns the amount of microcredits in the record
|
|
1403
|
+
*
|
|
1404
|
+
* @returns {u64} Amount of microcredits in the record
|
|
1405
|
+
*/
|
|
1736
1406
|
microcredits(): bigint;
|
|
1737
|
-
/**
|
|
1738
|
-
* Returns the nonce of the record. This can be used to uniquely identify a record.
|
|
1739
|
-
*
|
|
1740
|
-
* @returns {string} Nonce of the record
|
|
1741
|
-
|
|
1742
|
-
*/
|
|
1407
|
+
/**
|
|
1408
|
+
* Returns the nonce of the record. This can be used to uniquely identify a record.
|
|
1409
|
+
*
|
|
1410
|
+
* @returns {string} Nonce of the record
|
|
1411
|
+
*/
|
|
1743
1412
|
nonce(): string;
|
|
1744
|
-
/**
|
|
1745
|
-
* Attempt to get the serial number of a record to determine whether or not is has been spent
|
|
1746
|
-
*
|
|
1747
|
-
* @param {PrivateKey} private_key Private key of the account that owns the record
|
|
1748
|
-
* @param {string} program_id Program ID of the program that the record is associated with
|
|
1749
|
-
* @param {string} record_name Name of the record
|
|
1750
|
-
*
|
|
1751
|
-
* @returns {string} Serial number of the record
|
|
1752
|
-
|
|
1753
|
-
* @param {string} program_id
|
|
1754
|
-
* @param {string} record_name
|
|
1755
|
-
* @returns {string}
|
|
1756
|
-
*/
|
|
1413
|
+
/**
|
|
1414
|
+
* Attempt to get the serial number of a record to determine whether or not is has been spent
|
|
1415
|
+
*
|
|
1416
|
+
* @param {PrivateKey} private_key Private key of the account that owns the record
|
|
1417
|
+
* @param {string} program_id Program ID of the program that the record is associated with
|
|
1418
|
+
* @param {string} record_name Name of the record
|
|
1419
|
+
*
|
|
1420
|
+
* @returns {string} Serial number of the record
|
|
1421
|
+
*/
|
|
1757
1422
|
serialNumberString(private_key: PrivateKey, program_id: string, record_name: string): string;
|
|
1758
|
-
/**
|
|
1759
|
-
* Get the tag of the record using the graph key.
|
|
1760
|
-
|
|
1761
|
-
* @param {Field} commitment
|
|
1762
|
-
* @returns {Field}
|
|
1763
|
-
*/
|
|
1423
|
+
/**
|
|
1424
|
+
* Get the tag of the record using the graph key.
|
|
1425
|
+
*/
|
|
1764
1426
|
tag(graph_key: GraphKey, commitment: Field): Field;
|
|
1765
1427
|
}
|
|
1766
1428
|
/**
|
|
1767
|
-
* Scalar field element.
|
|
1768
|
-
*/
|
|
1429
|
+
* Scalar field element.
|
|
1430
|
+
*/
|
|
1769
1431
|
export class Scalar {
|
|
1432
|
+
private constructor();
|
|
1770
1433
|
free(): void;
|
|
1771
|
-
/**
|
|
1772
|
-
* Returns the string representation of the group.
|
|
1773
|
-
|
|
1774
|
-
*/
|
|
1434
|
+
/**
|
|
1435
|
+
* Returns the string representation of the group.
|
|
1436
|
+
*/
|
|
1775
1437
|
toString(): string;
|
|
1776
|
-
/**
|
|
1777
|
-
* Create a plaintext element from a group element.
|
|
1778
|
-
|
|
1779
|
-
*/
|
|
1438
|
+
/**
|
|
1439
|
+
* Create a plaintext element from a group element.
|
|
1440
|
+
*/
|
|
1780
1441
|
toPlaintext(): Plaintext;
|
|
1781
|
-
/**
|
|
1782
|
-
* Creates a group object from a string representation of a group.
|
|
1783
|
-
|
|
1784
|
-
* @returns {Scalar}
|
|
1785
|
-
*/
|
|
1442
|
+
/**
|
|
1443
|
+
* Creates a group object from a string representation of a group.
|
|
1444
|
+
*/
|
|
1786
1445
|
static fromString(group: string): Scalar;
|
|
1787
|
-
/**
|
|
1788
|
-
* Generate a random group element.
|
|
1789
|
-
|
|
1790
|
-
*/
|
|
1446
|
+
/**
|
|
1447
|
+
* Generate a random group element.
|
|
1448
|
+
*/
|
|
1791
1449
|
static random(): Scalar;
|
|
1792
|
-
/**
|
|
1793
|
-
* Add two scalar elements.
|
|
1794
|
-
|
|
1795
|
-
* @returns {Scalar}
|
|
1796
|
-
*/
|
|
1450
|
+
/**
|
|
1451
|
+
* Add two scalar elements.
|
|
1452
|
+
*/
|
|
1797
1453
|
add(other: Scalar): Scalar;
|
|
1798
|
-
/**
|
|
1799
|
-
* Subtract two scalar elements.
|
|
1800
|
-
|
|
1801
|
-
* @returns {Scalar}
|
|
1802
|
-
*/
|
|
1454
|
+
/**
|
|
1455
|
+
* Subtract two scalar elements.
|
|
1456
|
+
*/
|
|
1803
1457
|
subtract(other: Scalar): Scalar;
|
|
1804
|
-
/**
|
|
1805
|
-
* Multiply two scalar elements.
|
|
1806
|
-
|
|
1807
|
-
* @returns {Scalar}
|
|
1808
|
-
*/
|
|
1458
|
+
/**
|
|
1459
|
+
* Multiply two scalar elements.
|
|
1460
|
+
*/
|
|
1809
1461
|
multiply(other: Scalar): Scalar;
|
|
1810
|
-
/**
|
|
1811
|
-
* Divide two scalar elements.
|
|
1812
|
-
|
|
1813
|
-
* @returns {Scalar}
|
|
1814
|
-
*/
|
|
1462
|
+
/**
|
|
1463
|
+
* Divide two scalar elements.
|
|
1464
|
+
*/
|
|
1815
1465
|
divide(other: Scalar): Scalar;
|
|
1816
|
-
/**
|
|
1817
|
-
* Double the scalar element.
|
|
1818
|
-
|
|
1819
|
-
*/
|
|
1466
|
+
/**
|
|
1467
|
+
* Double the scalar element.
|
|
1468
|
+
*/
|
|
1820
1469
|
double(): Scalar;
|
|
1821
|
-
/**
|
|
1822
|
-
* Power of a scalar element.
|
|
1823
|
-
|
|
1824
|
-
* @returns {Scalar}
|
|
1825
|
-
*/
|
|
1470
|
+
/**
|
|
1471
|
+
* Power of a scalar element.
|
|
1472
|
+
*/
|
|
1826
1473
|
pow(other: Scalar): Scalar;
|
|
1827
|
-
/**
|
|
1828
|
-
* Invert the scalar element.
|
|
1829
|
-
|
|
1830
|
-
*/
|
|
1474
|
+
/**
|
|
1475
|
+
* Invert the scalar element.
|
|
1476
|
+
*/
|
|
1831
1477
|
inverse(): Scalar;
|
|
1832
|
-
/**
|
|
1833
|
-
* Creates a one valued element of the scalar field.
|
|
1834
|
-
|
|
1835
|
-
*/
|
|
1478
|
+
/**
|
|
1479
|
+
* Creates a one valued element of the scalar field.
|
|
1480
|
+
*/
|
|
1836
1481
|
static one(): Scalar;
|
|
1837
|
-
/**
|
|
1838
|
-
* Creates a zero valued element of the scalar field
|
|
1839
|
-
|
|
1840
|
-
*/
|
|
1482
|
+
/**
|
|
1483
|
+
* Creates a zero valued element of the scalar field
|
|
1484
|
+
*/
|
|
1841
1485
|
static zero(): Scalar;
|
|
1842
|
-
/**
|
|
1843
|
-
* Check if one scalar element equals another.
|
|
1844
|
-
|
|
1845
|
-
* @returns {boolean}
|
|
1846
|
-
*/
|
|
1486
|
+
/**
|
|
1487
|
+
* Check if one scalar element equals another.
|
|
1488
|
+
*/
|
|
1847
1489
|
equals(other: Scalar): boolean;
|
|
1848
1490
|
}
|
|
1849
1491
|
/**
|
|
1850
|
-
* Cryptographic signature of a message signed by an Aleo account
|
|
1851
|
-
*/
|
|
1492
|
+
* Cryptographic signature of a message signed by an Aleo account
|
|
1493
|
+
*/
|
|
1852
1494
|
export class Signature {
|
|
1495
|
+
private constructor();
|
|
1853
1496
|
free(): void;
|
|
1854
|
-
/**
|
|
1855
|
-
* Sign a message with a private key
|
|
1856
|
-
*
|
|
1857
|
-
* @param {PrivateKey} private_key The private key to sign the message with
|
|
1858
|
-
* @param {Uint8Array} message Byte representation of the message to sign
|
|
1859
|
-
* @returns {Signature} Signature of the message
|
|
1860
|
-
|
|
1861
|
-
* @param {Uint8Array} message
|
|
1862
|
-
* @returns {Signature}
|
|
1863
|
-
*/
|
|
1497
|
+
/**
|
|
1498
|
+
* Sign a message with a private key
|
|
1499
|
+
*
|
|
1500
|
+
* @param {PrivateKey} private_key The private key to sign the message with
|
|
1501
|
+
* @param {Uint8Array} message Byte representation of the message to sign
|
|
1502
|
+
* @returns {Signature} Signature of the message
|
|
1503
|
+
*/
|
|
1864
1504
|
static sign(private_key: PrivateKey, message: Uint8Array): Signature;
|
|
1865
|
-
/**
|
|
1866
|
-
* Get an address from a signature.
|
|
1867
|
-
*
|
|
1868
|
-
* @returns {Address} Address object
|
|
1869
|
-
|
|
1870
|
-
*/
|
|
1505
|
+
/**
|
|
1506
|
+
* Get an address from a signature.
|
|
1507
|
+
*
|
|
1508
|
+
* @returns {Address} Address object
|
|
1509
|
+
*/
|
|
1871
1510
|
to_address(): Address;
|
|
1872
|
-
/**
|
|
1873
|
-
* Get the challenge of a signature.
|
|
1874
|
-
|
|
1875
|
-
*/
|
|
1511
|
+
/**
|
|
1512
|
+
* Get the challenge of a signature.
|
|
1513
|
+
*/
|
|
1876
1514
|
challenge(): Scalar;
|
|
1877
|
-
/**
|
|
1878
|
-
* Get the response of a signature.
|
|
1879
|
-
|
|
1880
|
-
*/
|
|
1515
|
+
/**
|
|
1516
|
+
* Get the response of a signature.
|
|
1517
|
+
*/
|
|
1881
1518
|
response(): Scalar;
|
|
1882
|
-
/**
|
|
1883
|
-
* Verify a signature of a message with an address
|
|
1884
|
-
*
|
|
1885
|
-
* @param {Address} address The address to verify the signature with
|
|
1886
|
-
* @param {Uint8Array} message Byte representation of the message to verify
|
|
1887
|
-
* @returns {boolean} True if the signature is valid, false otherwise
|
|
1888
|
-
|
|
1889
|
-
* @param {Uint8Array} message
|
|
1890
|
-
* @returns {boolean}
|
|
1891
|
-
*/
|
|
1519
|
+
/**
|
|
1520
|
+
* Verify a signature of a message with an address
|
|
1521
|
+
*
|
|
1522
|
+
* @param {Address} address The address to verify the signature with
|
|
1523
|
+
* @param {Uint8Array} message Byte representation of the message to verify
|
|
1524
|
+
* @returns {boolean} True if the signature is valid, false otherwise
|
|
1525
|
+
*/
|
|
1892
1526
|
verify(address: Address, message: Uint8Array): boolean;
|
|
1893
|
-
/**
|
|
1894
|
-
* Get a signature from a string representation of a signature
|
|
1895
|
-
*
|
|
1896
|
-
* @param {string} signature String representation of a signature
|
|
1897
|
-
* @returns {Signature} Signature
|
|
1898
|
-
|
|
1899
|
-
* @returns {Signature}
|
|
1900
|
-
*/
|
|
1527
|
+
/**
|
|
1528
|
+
* Get a signature from a string representation of a signature
|
|
1529
|
+
*
|
|
1530
|
+
* @param {string} signature String representation of a signature
|
|
1531
|
+
* @returns {Signature} Signature
|
|
1532
|
+
*/
|
|
1901
1533
|
static from_string(signature: string): Signature;
|
|
1902
|
-
/**
|
|
1903
|
-
* Get a string representation of a signature
|
|
1904
|
-
*
|
|
1905
|
-
* @returns {string} String representation of a signature
|
|
1906
|
-
|
|
1907
|
-
*/
|
|
1534
|
+
/**
|
|
1535
|
+
* Get a string representation of a signature
|
|
1536
|
+
*
|
|
1537
|
+
* @returns {string} String representation of a signature
|
|
1538
|
+
*/
|
|
1908
1539
|
to_string(): string;
|
|
1909
1540
|
}
|
|
1910
1541
|
/**
|
|
1911
|
-
* Webassembly Representation of an Aleo transaction
|
|
1912
|
-
*
|
|
1913
|
-
* This object is created when generating an on-chain function deployment or execution and is the
|
|
1914
|
-
* object that should be submitted to the Aleo Network in order to deploy or execute a function.
|
|
1915
|
-
*/
|
|
1542
|
+
* Webassembly Representation of an Aleo transaction
|
|
1543
|
+
*
|
|
1544
|
+
* This object is created when generating an on-chain function deployment or execution and is the
|
|
1545
|
+
* object that should be submitted to the Aleo Network in order to deploy or execute a function.
|
|
1546
|
+
*/
|
|
1916
1547
|
export class Transaction {
|
|
1548
|
+
private constructor();
|
|
1917
1549
|
free(): void;
|
|
1918
|
-
/**
|
|
1919
|
-
* Create a transaction from a string
|
|
1920
|
-
*
|
|
1921
|
-
* @param {string} transaction String representation of a transaction
|
|
1922
|
-
* @returns {Transaction}
|
|
1923
|
-
|
|
1924
|
-
* @returns {Transaction}
|
|
1925
|
-
*/
|
|
1550
|
+
/**
|
|
1551
|
+
* Create a transaction from a string
|
|
1552
|
+
*
|
|
1553
|
+
* @param {string} transaction String representation of a transaction
|
|
1554
|
+
* @returns {Transaction}
|
|
1555
|
+
*/
|
|
1926
1556
|
static fromString(transaction: string): Transaction;
|
|
1927
|
-
/**
|
|
1928
|
-
* Create a transaction from a Uint8Array of left endian bytes.
|
|
1929
|
-
*
|
|
1930
|
-
* @param {Uint8Array} Uint8Array of left endian bytes encoding a Transaction.
|
|
1931
|
-
* @returns {Transaction}
|
|
1932
|
-
|
|
1933
|
-
* @returns {Transaction}
|
|
1934
|
-
*/
|
|
1557
|
+
/**
|
|
1558
|
+
* Create a transaction from a Uint8Array of left endian bytes.
|
|
1559
|
+
*
|
|
1560
|
+
* @param {Uint8Array} Uint8Array of left endian bytes encoding a Transaction.
|
|
1561
|
+
* @returns {Transaction}
|
|
1562
|
+
*/
|
|
1935
1563
|
static fromBytesLe(bytes: Uint8Array): Transaction;
|
|
1936
|
-
/**
|
|
1937
|
-
* Get the transaction as a string. If you want to submit this transaction to the Aleo Network
|
|
1938
|
-
* this function will create the string that should be submitted in the `POST` data.
|
|
1939
|
-
*
|
|
1940
|
-
* @returns {string} String representation of the transaction
|
|
1941
|
-
|
|
1942
|
-
*/
|
|
1564
|
+
/**
|
|
1565
|
+
* Get the transaction as a string. If you want to submit this transaction to the Aleo Network
|
|
1566
|
+
* this function will create the string that should be submitted in the `POST` data.
|
|
1567
|
+
*
|
|
1568
|
+
* @returns {string} String representation of the transaction
|
|
1569
|
+
*/
|
|
1943
1570
|
toString(): string;
|
|
1944
|
-
/**
|
|
1945
|
-
* Get the transaction as a Uint8Array of left endian bytes.
|
|
1946
|
-
*
|
|
1947
|
-
* @returns {Uint8Array} Uint8Array representation of the transaction
|
|
1948
|
-
|
|
1949
|
-
*/
|
|
1571
|
+
/**
|
|
1572
|
+
* Get the transaction as a Uint8Array of left endian bytes.
|
|
1573
|
+
*
|
|
1574
|
+
* @returns {Uint8Array} Uint8Array representation of the transaction
|
|
1575
|
+
*/
|
|
1950
1576
|
toBytesLe(): Uint8Array;
|
|
1951
|
-
/**
|
|
1952
|
-
* Returns true if the transaction contains the given serial number.
|
|
1953
|
-
*
|
|
1954
|
-
* @param {boolean} True if the transaction contains the given serial number.
|
|
1955
|
-
|
|
1956
|
-
* @returns {boolean}
|
|
1957
|
-
*/
|
|
1577
|
+
/**
|
|
1578
|
+
* Returns true if the transaction contains the given serial number.
|
|
1579
|
+
*
|
|
1580
|
+
* @param {boolean} True if the transaction contains the given serial number.
|
|
1581
|
+
*/
|
|
1958
1582
|
constainsSerialNumber(serial_number: Field): boolean;
|
|
1959
|
-
/**
|
|
1960
|
-
* Returns true if the transaction contains the given commitment.
|
|
1961
|
-
*
|
|
1962
|
-
* @param {boolean} True if the transaction contains the given commitment.
|
|
1963
|
-
|
|
1964
|
-
* @returns {boolean}
|
|
1965
|
-
*/
|
|
1583
|
+
/**
|
|
1584
|
+
* Returns true if the transaction contains the given commitment.
|
|
1585
|
+
*
|
|
1586
|
+
* @param {boolean} True if the transaction contains the given commitment.
|
|
1587
|
+
*/
|
|
1966
1588
|
constainsCommitment(commitment: Field): boolean;
|
|
1967
|
-
/**
|
|
1968
|
-
* Find a record in the transaction by the record's commitment.
|
|
1969
|
-
|
|
1970
|
-
* @returns {RecordCiphertext | undefined}
|
|
1971
|
-
*/
|
|
1589
|
+
/**
|
|
1590
|
+
* Find a record in the transaction by the record's commitment.
|
|
1591
|
+
*/
|
|
1972
1592
|
findRecord(commitment: Field): RecordCiphertext | undefined;
|
|
1973
|
-
/**
|
|
1974
|
-
* Returns the transaction's base fee.
|
|
1975
|
-
|
|
1976
|
-
*/
|
|
1593
|
+
/**
|
|
1594
|
+
* Returns the transaction's base fee.
|
|
1595
|
+
*/
|
|
1977
1596
|
baseFeeAmount(): bigint;
|
|
1978
|
-
/**
|
|
1979
|
-
* Returns the transaction's total fee.
|
|
1980
|
-
|
|
1981
|
-
*/
|
|
1597
|
+
/**
|
|
1598
|
+
* Returns the transaction's total fee.
|
|
1599
|
+
*/
|
|
1982
1600
|
feeAmount(): bigint;
|
|
1983
|
-
/**
|
|
1984
|
-
* Returns the transaction's priority fee.
|
|
1985
|
-
*
|
|
1986
|
-
* returns {bigint} The transaction's priority fee.
|
|
1987
|
-
|
|
1988
|
-
*/
|
|
1601
|
+
/**
|
|
1602
|
+
* Returns the transaction's priority fee.
|
|
1603
|
+
*
|
|
1604
|
+
* returns {bigint} The transaction's priority fee.
|
|
1605
|
+
*/
|
|
1989
1606
|
priorityFeeAmount(): bigint;
|
|
1990
|
-
/**
|
|
1991
|
-
* Returns true if the transaction is a deployment transaction.
|
|
1992
|
-
*
|
|
1993
|
-
* @returns {boolean} True if the transaction is a deployment transaction
|
|
1994
|
-
|
|
1995
|
-
*/
|
|
1607
|
+
/**
|
|
1608
|
+
* Returns true if the transaction is a deployment transaction.
|
|
1609
|
+
*
|
|
1610
|
+
* @returns {boolean} True if the transaction is a deployment transaction
|
|
1611
|
+
*/
|
|
1996
1612
|
isDeploy(): boolean;
|
|
1997
|
-
/**
|
|
1998
|
-
* Returns true if the transaction is an execution transaction.
|
|
1999
|
-
*
|
|
2000
|
-
* @returns {boolean} True if the transaction is an execution transaction
|
|
2001
|
-
|
|
2002
|
-
*/
|
|
1613
|
+
/**
|
|
1614
|
+
* Returns true if the transaction is an execution transaction.
|
|
1615
|
+
*
|
|
1616
|
+
* @returns {boolean} True if the transaction is an execution transaction
|
|
1617
|
+
*/
|
|
2003
1618
|
isExecute(): boolean;
|
|
2004
|
-
/**
|
|
2005
|
-
* Returns true if the transaction is a fee transaction.
|
|
2006
|
-
*
|
|
2007
|
-
* @returns {boolean} True if the transaction is a fee transaction
|
|
2008
|
-
|
|
2009
|
-
*/
|
|
1619
|
+
/**
|
|
1620
|
+
* Returns true if the transaction is a fee transaction.
|
|
1621
|
+
*
|
|
1622
|
+
* @returns {boolean} True if the transaction is a fee transaction
|
|
1623
|
+
*/
|
|
2010
1624
|
isFee(): boolean;
|
|
2011
|
-
/**
|
|
2012
|
-
*
|
|
2013
|
-
*
|
|
2014
|
-
*
|
|
2015
|
-
*
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
1625
|
+
/**
|
|
1626
|
+
* Returns the program deployed within the transaction if the transaction is a deployment
|
|
1627
|
+
* transaction.
|
|
1628
|
+
*
|
|
1629
|
+
* @returns {Program | undefined} The program deployed within the transaction.
|
|
1630
|
+
*/
|
|
1631
|
+
deployedProgram(): Program | undefined;
|
|
1632
|
+
/**
|
|
1633
|
+
* Returns the execution within the transaction (if present).
|
|
1634
|
+
*
|
|
1635
|
+
* @returns {Execution | undefined} The execution within the transaction.
|
|
1636
|
+
*/
|
|
1637
|
+
execution(): Execution | undefined;
|
|
1638
|
+
/**
|
|
1639
|
+
* Get the record plaintext present in a transaction owned by a specific view key.
|
|
1640
|
+
*
|
|
1641
|
+
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
1642
|
+
*
|
|
1643
|
+
* @returns {Array<RecordPlaintext>} Array of record plaintext objects
|
|
1644
|
+
*/
|
|
2020
1645
|
ownedRecords(view_key: ViewKey): Array<any>;
|
|
2021
|
-
/**
|
|
2022
|
-
* Get the records present in a transaction and their commitments.
|
|
2023
|
-
*
|
|
2024
|
-
* @returns {Array<{commitment: Field, record: RecordCiphertext}>} Array of record ciphertext objects
|
|
2025
|
-
|
|
2026
|
-
*/
|
|
1646
|
+
/**
|
|
1647
|
+
* Get the records present in a transaction and their commitments.
|
|
1648
|
+
*
|
|
1649
|
+
* @returns {Array<{commitment: Field, record: RecordCiphertext}>} Array of record ciphertext objects
|
|
1650
|
+
*/
|
|
2027
1651
|
records(): Array<any>;
|
|
2028
|
-
/**
|
|
2029
|
-
* Get a summary of the transaction within a javascript object.
|
|
2030
|
-
*
|
|
2031
|
-
* If the transaction is an execution transaction, this function will return a list of the
|
|
2032
|
-
* transitions and their inputs and outputs.
|
|
2033
|
-
*
|
|
2034
|
-
* If the transaction is a deployment transaction, this function will return the program id and
|
|
2035
|
-
* a list of the functions and their verifying keys, constraint, and variable counts.
|
|
2036
|
-
*
|
|
2037
|
-
* @param {boolean} convert_to_js If true the inputs and outputs will be converted to JS objects,
|
|
2038
|
-
* if false the inputs and outputs will be in wasm format.
|
|
2039
|
-
*
|
|
2040
|
-
* @returns {Object} Transaction summary
|
|
2041
|
-
|
|
2042
|
-
* @returns {object}
|
|
2043
|
-
*/
|
|
1652
|
+
/**
|
|
1653
|
+
* Get a summary of the transaction within a javascript object.
|
|
1654
|
+
*
|
|
1655
|
+
* If the transaction is an execution transaction, this function will return a list of the
|
|
1656
|
+
* transitions and their inputs and outputs.
|
|
1657
|
+
*
|
|
1658
|
+
* If the transaction is a deployment transaction, this function will return the program id and
|
|
1659
|
+
* a list of the functions and their verifying keys, constraint, and variable counts.
|
|
1660
|
+
*
|
|
1661
|
+
* @param {boolean} convert_to_js If true the inputs and outputs will be converted to JS objects,
|
|
1662
|
+
* if false the inputs and outputs will be in wasm format.
|
|
1663
|
+
*
|
|
1664
|
+
* @returns {Object} Transaction summary
|
|
1665
|
+
*/
|
|
2044
1666
|
summary(convert_to_js: boolean): object;
|
|
2045
|
-
/**
|
|
2046
|
-
* Get the id of the transaction. This is the merkle root of the transaction's inclusion proof.
|
|
2047
|
-
*
|
|
2048
|
-
* This value can be used to query the status of the transaction on the Aleo Network to see
|
|
2049
|
-
* if it was successful. If successful, the transaction will be included in a block and this
|
|
2050
|
-
* value can be used to lookup the transaction data on-chain.
|
|
2051
|
-
*
|
|
2052
|
-
* @returns {string} TransactionId
|
|
2053
|
-
|
|
2054
|
-
*/
|
|
1667
|
+
/**
|
|
1668
|
+
* Get the id of the transaction. This is the merkle root of the transaction's inclusion proof.
|
|
1669
|
+
*
|
|
1670
|
+
* This value can be used to query the status of the transaction on the Aleo Network to see
|
|
1671
|
+
* if it was successful. If successful, the transaction will be included in a block and this
|
|
1672
|
+
* value can be used to lookup the transaction data on-chain.
|
|
1673
|
+
*
|
|
1674
|
+
* @returns {string} TransactionId
|
|
1675
|
+
*/
|
|
2055
1676
|
id(): string;
|
|
2056
|
-
/**
|
|
2057
|
-
* Get the
|
|
2058
|
-
* Get the type of the transaction (will return "deploy" or "execute")
|
|
2059
|
-
*
|
|
2060
|
-
* @returns {string} Transaction type
|
|
2061
|
-
|
|
2062
|
-
*/
|
|
1677
|
+
/**
|
|
1678
|
+
* Get the
|
|
1679
|
+
* Get the type of the transaction (will return "deploy" or "execute")
|
|
1680
|
+
*
|
|
1681
|
+
* @returns {string} Transaction type
|
|
1682
|
+
*/
|
|
2063
1683
|
transactionType(): string;
|
|
2064
|
-
/**
|
|
2065
|
-
* Get the transitions in a transaction.
|
|
2066
|
-
*
|
|
2067
|
-
|
|
1684
|
+
/**
|
|
1685
|
+
* Get the transitions in a transaction.
|
|
1686
|
+
*
|
|
1687
|
+
* @returns {Array<Transition>} Array of transition objects
|
|
1688
|
+
*/
|
|
2068
1689
|
transitions(): Array<any>;
|
|
1690
|
+
/**
|
|
1691
|
+
* Get the verifying keys in a transaction.
|
|
1692
|
+
*
|
|
1693
|
+
* @returns {Array<Object>} Array of verifying keys.
|
|
1694
|
+
*/
|
|
1695
|
+
verifyingKeys(): Array<any>;
|
|
2069
1696
|
}
|
|
2070
|
-
/**
|
|
2071
|
-
*/
|
|
2072
1697
|
export class Transition {
|
|
1698
|
+
private constructor();
|
|
2073
1699
|
free(): void;
|
|
2074
|
-
/**
|
|
2075
|
-
* Get the transition ID
|
|
2076
|
-
*
|
|
2077
|
-
* @returns {string} The transition ID
|
|
2078
|
-
|
|
2079
|
-
*/
|
|
1700
|
+
/**
|
|
1701
|
+
* Get the transition ID
|
|
1702
|
+
*
|
|
1703
|
+
* @returns {string} The transition ID
|
|
1704
|
+
*/
|
|
2080
1705
|
id(): string;
|
|
2081
|
-
/**
|
|
2082
|
-
* Create a transition from a string
|
|
2083
|
-
*
|
|
2084
|
-
* @param {string} transition String representation of a transition
|
|
2085
|
-
* @returns {Transition}
|
|
2086
|
-
|
|
2087
|
-
* @returns {Transition}
|
|
2088
|
-
*/
|
|
1706
|
+
/**
|
|
1707
|
+
* Create a transition from a string
|
|
1708
|
+
*
|
|
1709
|
+
* @param {string} transition String representation of a transition
|
|
1710
|
+
* @returns {Transition}
|
|
1711
|
+
*/
|
|
2089
1712
|
static fromString(transition: string): Transition;
|
|
2090
|
-
/**
|
|
2091
|
-
* Create a transition from a Uint8Array of left endian bytes.
|
|
2092
|
-
*
|
|
2093
|
-
* @param {Uint8Array} Uint8Array of left endian bytes encoding a Transition.
|
|
2094
|
-
* @returns {Transition}
|
|
2095
|
-
|
|
2096
|
-
* @returns {Transition}
|
|
2097
|
-
*/
|
|
1713
|
+
/**
|
|
1714
|
+
* Create a transition from a Uint8Array of left endian bytes.
|
|
1715
|
+
*
|
|
1716
|
+
* @param {Uint8Array} Uint8Array of left endian bytes encoding a Transition.
|
|
1717
|
+
* @returns {Transition}
|
|
1718
|
+
*/
|
|
2098
1719
|
static fromBytesLe(bytes: Uint8Array): Transition;
|
|
2099
|
-
/**
|
|
2100
|
-
* Get the transition as a string. If you want to submit this transition to the Aleo Network
|
|
2101
|
-
* this function will create the string that should be submitted in the `POST` data.
|
|
2102
|
-
*
|
|
2103
|
-
* @returns {string} String representation of the transition
|
|
2104
|
-
|
|
2105
|
-
*/
|
|
1720
|
+
/**
|
|
1721
|
+
* Get the transition as a string. If you want to submit this transition to the Aleo Network
|
|
1722
|
+
* this function will create the string that should be submitted in the `POST` data.
|
|
1723
|
+
*
|
|
1724
|
+
* @returns {string} String representation of the transition
|
|
1725
|
+
*/
|
|
2106
1726
|
toString(): string;
|
|
2107
|
-
/**
|
|
2108
|
-
* Get the transition as a Uint8Array of left endian bytes.
|
|
2109
|
-
*
|
|
2110
|
-
* @returns {Uint8Array} Uint8Array representation of the transition
|
|
2111
|
-
|
|
2112
|
-
*/
|
|
1727
|
+
/**
|
|
1728
|
+
* Get the transition as a Uint8Array of left endian bytes.
|
|
1729
|
+
*
|
|
1730
|
+
* @returns {Uint8Array} Uint8Array representation of the transition
|
|
1731
|
+
*/
|
|
2113
1732
|
toBytesLe(): Uint8Array;
|
|
2114
|
-
/**
|
|
2115
|
-
* Get the program ID of the transition.
|
|
2116
|
-
|
|
2117
|
-
*/
|
|
1733
|
+
/**
|
|
1734
|
+
* Get the program ID of the transition.
|
|
1735
|
+
*/
|
|
2118
1736
|
programId(): string;
|
|
2119
|
-
/**
|
|
2120
|
-
* Get the function name of the transition.
|
|
2121
|
-
|
|
2122
|
-
*/
|
|
1737
|
+
/**
|
|
1738
|
+
* Get the function name of the transition.
|
|
1739
|
+
*/
|
|
2123
1740
|
functionName(): string;
|
|
2124
|
-
/**
|
|
2125
|
-
* Returns true if the transition contains the given commitment.
|
|
2126
|
-
*
|
|
2127
|
-
* @param {boolean} True if the transition contains the given commitment.
|
|
2128
|
-
|
|
2129
|
-
* @returns {boolean}
|
|
2130
|
-
*/
|
|
1741
|
+
/**
|
|
1742
|
+
* Returns true if the transition contains the given commitment.
|
|
1743
|
+
*
|
|
1744
|
+
* @param {boolean} True if the transition contains the given commitment.
|
|
1745
|
+
*/
|
|
2131
1746
|
containsCommitment(commitment: Field): boolean;
|
|
2132
|
-
/**
|
|
2133
|
-
* Check if the transition contains a serial number.
|
|
2134
|
-
*
|
|
2135
|
-
* @param {Field} serial_number The serial number to check for
|
|
2136
|
-
*
|
|
2137
|
-
* @returns {bool} True if the transition contains a serial number, false otherwise
|
|
2138
|
-
|
|
2139
|
-
* @returns {boolean}
|
|
2140
|
-
*/
|
|
1747
|
+
/**
|
|
1748
|
+
* Check if the transition contains a serial number.
|
|
1749
|
+
*
|
|
1750
|
+
* @param {Field} serial_number The serial number to check for
|
|
1751
|
+
*
|
|
1752
|
+
* @returns {bool} True if the transition contains a serial number, false otherwise
|
|
1753
|
+
*/
|
|
2141
1754
|
containsSerialNumber(serial_number: Field): boolean;
|
|
2142
|
-
/**
|
|
2143
|
-
* Find a record in the transition by the record's commitment.
|
|
2144
|
-
|
|
2145
|
-
* @returns {RecordCiphertext | undefined}
|
|
2146
|
-
*/
|
|
1755
|
+
/**
|
|
1756
|
+
* Find a record in the transition by the record's commitment.
|
|
1757
|
+
*/
|
|
2147
1758
|
findRecord(commitment: Field): RecordCiphertext | undefined;
|
|
2148
|
-
/**
|
|
2149
|
-
* Get the record plaintext present in a transition owned by a specific view key.
|
|
2150
|
-
*
|
|
2151
|
-
* @param {ViewKey} view_key The view key of the record owner.
|
|
2152
|
-
*
|
|
2153
|
-
* @returns {Array<RecordPlaintext>} Array of record plaintext objects
|
|
2154
|
-
|
|
2155
|
-
* @returns {Array<any>}
|
|
2156
|
-
*/
|
|
1759
|
+
/**
|
|
1760
|
+
* Get the record plaintext present in a transition owned by a specific view key.
|
|
1761
|
+
*
|
|
1762
|
+
* @param {ViewKey} view_key The view key of the record owner.
|
|
1763
|
+
*
|
|
1764
|
+
* @returns {Array<RecordPlaintext>} Array of record plaintext objects
|
|
1765
|
+
*/
|
|
2157
1766
|
ownedRecords(view_key: ViewKey): Array<any>;
|
|
2158
|
-
/**
|
|
2159
|
-
* Get the records present in a transition and their commitments.
|
|
2160
|
-
*
|
|
2161
|
-
* @returns {Array<{commitment: Field, record: RecordCiphertext}>} Array of record ciphertext objects
|
|
2162
|
-
|
|
2163
|
-
*/
|
|
1767
|
+
/**
|
|
1768
|
+
* Get the records present in a transition and their commitments.
|
|
1769
|
+
*
|
|
1770
|
+
* @returns {Array<{commitment: Field, record: RecordCiphertext}>} Array of record ciphertext objects
|
|
1771
|
+
*/
|
|
2164
1772
|
records(): Array<any>;
|
|
2165
|
-
/**
|
|
2166
|
-
* Get the inputs of the transition.
|
|
2167
|
-
*
|
|
2168
|
-
* @param {bool} convert_to_js If true the inputs will be converted to JS objects, if false
|
|
2169
|
-
* the inputs will be in wasm format.
|
|
2170
|
-
*
|
|
2171
|
-
* @returns {Array} Array of inputs
|
|
2172
|
-
|
|
2173
|
-
* @returns {Array<any>}
|
|
2174
|
-
*/
|
|
1773
|
+
/**
|
|
1774
|
+
* Get the inputs of the transition.
|
|
1775
|
+
*
|
|
1776
|
+
* @param {bool} convert_to_js If true the inputs will be converted to JS objects, if false
|
|
1777
|
+
* the inputs will be in wasm format.
|
|
1778
|
+
*
|
|
1779
|
+
* @returns {Array} Array of inputs
|
|
1780
|
+
*/
|
|
2175
1781
|
inputs(convert_to_js: boolean): Array<any>;
|
|
2176
|
-
/**
|
|
2177
|
-
* Get the outputs of the transition.
|
|
2178
|
-
*
|
|
2179
|
-
* @param {bool} convert_to_js If true the outputs will be converted to JS objects, if false
|
|
2180
|
-
* the outputs will be in wasm format.
|
|
2181
|
-
*
|
|
2182
|
-
* @returns {Array} Array of outputs
|
|
2183
|
-
|
|
2184
|
-
* @returns {Array<any>}
|
|
2185
|
-
*/
|
|
1782
|
+
/**
|
|
1783
|
+
* Get the outputs of the transition.
|
|
1784
|
+
*
|
|
1785
|
+
* @param {bool} convert_to_js If true the outputs will be converted to JS objects, if false
|
|
1786
|
+
* the outputs will be in wasm format.
|
|
1787
|
+
*
|
|
1788
|
+
* @returns {Array} Array of outputs
|
|
1789
|
+
*/
|
|
2186
1790
|
outputs(convert_to_js: boolean): Array<any>;
|
|
2187
|
-
/**
|
|
2188
|
-
* Get the transition public key of the transition.
|
|
2189
|
-
|
|
2190
|
-
*/
|
|
1791
|
+
/**
|
|
1792
|
+
* Get the transition public key of the transition.
|
|
1793
|
+
*/
|
|
2191
1794
|
tpk(): Group;
|
|
2192
|
-
/**
|
|
2193
|
-
* Get the transition commitment of the transition.
|
|
2194
|
-
|
|
2195
|
-
*/
|
|
1795
|
+
/**
|
|
1796
|
+
* Get the transition commitment of the transition.
|
|
1797
|
+
*/
|
|
2196
1798
|
tcm(): Field;
|
|
2197
|
-
/**
|
|
2198
|
-
* Get the transition signer commitment of the transition.
|
|
2199
|
-
|
|
2200
|
-
*/
|
|
1799
|
+
/**
|
|
1800
|
+
* Get the transition signer commitment of the transition.
|
|
1801
|
+
*/
|
|
2201
1802
|
scm(): Field;
|
|
2202
1803
|
}
|
|
2203
1804
|
/**
|
|
2204
|
-
* Verifying key for a function within an Aleo program
|
|
2205
|
-
*/
|
|
1805
|
+
* Verifying key for a function within an Aleo program
|
|
1806
|
+
*/
|
|
2206
1807
|
export class VerifyingKey {
|
|
1808
|
+
private constructor();
|
|
2207
1809
|
free(): void;
|
|
2208
|
-
/**
|
|
2209
|
-
* Returns the verifying key for the bond_public function
|
|
2210
|
-
*
|
|
2211
|
-
* @returns {VerifyingKey} Verifying key for the bond_public function
|
|
2212
|
-
|
|
2213
|
-
*/
|
|
1810
|
+
/**
|
|
1811
|
+
* Returns the verifying key for the bond_public function
|
|
1812
|
+
*
|
|
1813
|
+
* @returns {VerifyingKey} Verifying key for the bond_public function
|
|
1814
|
+
*/
|
|
2214
1815
|
static bondPublicVerifier(): VerifyingKey;
|
|
2215
|
-
/**
|
|
2216
|
-
* Returns the verifying key for the bond_validator function
|
|
2217
|
-
*
|
|
2218
|
-
* @returns {VerifyingKey} Verifying key for the bond_validator function
|
|
2219
|
-
|
|
2220
|
-
*/
|
|
1816
|
+
/**
|
|
1817
|
+
* Returns the verifying key for the bond_validator function
|
|
1818
|
+
*
|
|
1819
|
+
* @returns {VerifyingKey} Verifying key for the bond_validator function
|
|
1820
|
+
*/
|
|
2221
1821
|
static bondValidatorVerifier(): VerifyingKey;
|
|
2222
|
-
/**
|
|
2223
|
-
* Returns the verifying key for the claim_delegator function
|
|
2224
|
-
*
|
|
2225
|
-
* @returns {VerifyingKey} Verifying key for the claim_unbond_public function
|
|
2226
|
-
|
|
2227
|
-
*/
|
|
1822
|
+
/**
|
|
1823
|
+
* Returns the verifying key for the claim_delegator function
|
|
1824
|
+
*
|
|
1825
|
+
* @returns {VerifyingKey} Verifying key for the claim_unbond_public function
|
|
1826
|
+
*/
|
|
2228
1827
|
static claimUnbondPublicVerifier(): VerifyingKey;
|
|
2229
|
-
/**
|
|
2230
|
-
* Returns the verifying key for the fee_private function
|
|
2231
|
-
*
|
|
2232
|
-
* @returns {VerifyingKey} Verifying key for the fee_private function
|
|
2233
|
-
|
|
2234
|
-
*/
|
|
1828
|
+
/**
|
|
1829
|
+
* Returns the verifying key for the fee_private function
|
|
1830
|
+
*
|
|
1831
|
+
* @returns {VerifyingKey} Verifying key for the fee_private function
|
|
1832
|
+
*/
|
|
2235
1833
|
static feePrivateVerifier(): VerifyingKey;
|
|
2236
|
-
/**
|
|
2237
|
-
* Returns the verifying key for the fee_public function
|
|
2238
|
-
*
|
|
2239
|
-
* @returns {VerifyingKey} Verifying key for the fee_public function
|
|
2240
|
-
|
|
2241
|
-
*/
|
|
1834
|
+
/**
|
|
1835
|
+
* Returns the verifying key for the fee_public function
|
|
1836
|
+
*
|
|
1837
|
+
* @returns {VerifyingKey} Verifying key for the fee_public function
|
|
1838
|
+
*/
|
|
2242
1839
|
static feePublicVerifier(): VerifyingKey;
|
|
2243
|
-
/**
|
|
2244
|
-
* Returns the verifying key for the inclusion function
|
|
2245
|
-
*
|
|
2246
|
-
* @returns {VerifyingKey} Verifying key for the inclusion function
|
|
2247
|
-
|
|
2248
|
-
*/
|
|
1840
|
+
/**
|
|
1841
|
+
* Returns the verifying key for the inclusion function
|
|
1842
|
+
*
|
|
1843
|
+
* @returns {VerifyingKey} Verifying key for the inclusion function
|
|
1844
|
+
*/
|
|
2249
1845
|
static inclusionVerifier(): VerifyingKey;
|
|
2250
|
-
/**
|
|
2251
|
-
* Returns the verifying key for the join function
|
|
2252
|
-
*
|
|
2253
|
-
* @returns {VerifyingKey} Verifying key for the join function
|
|
2254
|
-
|
|
2255
|
-
*/
|
|
1846
|
+
/**
|
|
1847
|
+
* Returns the verifying key for the join function
|
|
1848
|
+
*
|
|
1849
|
+
* @returns {VerifyingKey} Verifying key for the join function
|
|
1850
|
+
*/
|
|
2256
1851
|
static joinVerifier(): VerifyingKey;
|
|
2257
|
-
/**
|
|
2258
|
-
* Returns the verifying key for the set_validator_state function
|
|
2259
|
-
*
|
|
2260
|
-
* @returns {VerifyingKey} Verifying key for the set_validator_state function
|
|
2261
|
-
|
|
2262
|
-
*/
|
|
1852
|
+
/**
|
|
1853
|
+
* Returns the verifying key for the set_validator_state function
|
|
1854
|
+
*
|
|
1855
|
+
* @returns {VerifyingKey} Verifying key for the set_validator_state function
|
|
1856
|
+
*/
|
|
2263
1857
|
static setValidatorStateVerifier(): VerifyingKey;
|
|
2264
|
-
/**
|
|
2265
|
-
* Returns the verifying key for the split function
|
|
2266
|
-
*
|
|
2267
|
-
* @returns {VerifyingKey} Verifying key for the split function
|
|
2268
|
-
|
|
2269
|
-
*/
|
|
1858
|
+
/**
|
|
1859
|
+
* Returns the verifying key for the split function
|
|
1860
|
+
*
|
|
1861
|
+
* @returns {VerifyingKey} Verifying key for the split function
|
|
1862
|
+
*/
|
|
2270
1863
|
static splitVerifier(): VerifyingKey;
|
|
2271
|
-
/**
|
|
2272
|
-
* Returns the verifying key for the transfer_private function
|
|
2273
|
-
*
|
|
2274
|
-
* @returns {VerifyingKey} Verifying key for the transfer_private function
|
|
2275
|
-
|
|
2276
|
-
*/
|
|
1864
|
+
/**
|
|
1865
|
+
* Returns the verifying key for the transfer_private function
|
|
1866
|
+
*
|
|
1867
|
+
* @returns {VerifyingKey} Verifying key for the transfer_private function
|
|
1868
|
+
*/
|
|
2277
1869
|
static transferPrivateVerifier(): VerifyingKey;
|
|
2278
|
-
/**
|
|
2279
|
-
* Returns the verifying key for the transfer_private_to_public function
|
|
2280
|
-
*
|
|
2281
|
-
* @returns {VerifyingKey} Verifying key for the transfer_private_to_public function
|
|
2282
|
-
|
|
2283
|
-
*/
|
|
1870
|
+
/**
|
|
1871
|
+
* Returns the verifying key for the transfer_private_to_public function
|
|
1872
|
+
*
|
|
1873
|
+
* @returns {VerifyingKey} Verifying key for the transfer_private_to_public function
|
|
1874
|
+
*/
|
|
2284
1875
|
static transferPrivateToPublicVerifier(): VerifyingKey;
|
|
2285
|
-
/**
|
|
2286
|
-
* Returns the verifying key for the transfer_public function
|
|
2287
|
-
*
|
|
2288
|
-
* @returns {VerifyingKey} Verifying key for the transfer_public function
|
|
2289
|
-
|
|
2290
|
-
*/
|
|
1876
|
+
/**
|
|
1877
|
+
* Returns the verifying key for the transfer_public function
|
|
1878
|
+
*
|
|
1879
|
+
* @returns {VerifyingKey} Verifying key for the transfer_public function
|
|
1880
|
+
*/
|
|
2291
1881
|
static transferPublicVerifier(): VerifyingKey;
|
|
2292
|
-
/**
|
|
2293
|
-
* Returns the verifying key for the transfer_public_as_signer function
|
|
2294
|
-
*
|
|
2295
|
-
* @returns {VerifyingKey} Verifying key for the transfer_public_as_signer function
|
|
2296
|
-
|
|
2297
|
-
*/
|
|
1882
|
+
/**
|
|
1883
|
+
* Returns the verifying key for the transfer_public_as_signer function
|
|
1884
|
+
*
|
|
1885
|
+
* @returns {VerifyingKey} Verifying key for the transfer_public_as_signer function
|
|
1886
|
+
*/
|
|
2298
1887
|
static transferPublicAsSignerVerifier(): VerifyingKey;
|
|
2299
|
-
/**
|
|
2300
|
-
* Returns the verifying key for the transfer_public_to_private function
|
|
2301
|
-
*
|
|
2302
|
-
* @returns {VerifyingKey} Verifying key for the transfer_public_to_private function
|
|
2303
|
-
|
|
2304
|
-
*/
|
|
1888
|
+
/**
|
|
1889
|
+
* Returns the verifying key for the transfer_public_to_private function
|
|
1890
|
+
*
|
|
1891
|
+
* @returns {VerifyingKey} Verifying key for the transfer_public_to_private function
|
|
1892
|
+
*/
|
|
2305
1893
|
static transferPublicToPrivateVerifier(): VerifyingKey;
|
|
2306
|
-
/**
|
|
2307
|
-
* Returns the verifying key for the unbond_public function
|
|
2308
|
-
*
|
|
2309
|
-
* @returns {VerifyingKey} Verifying key for the unbond_public function
|
|
2310
|
-
|
|
2311
|
-
*/
|
|
1894
|
+
/**
|
|
1895
|
+
* Returns the verifying key for the unbond_public function
|
|
1896
|
+
*
|
|
1897
|
+
* @returns {VerifyingKey} Verifying key for the unbond_public function
|
|
1898
|
+
*/
|
|
2312
1899
|
static unbondPublicVerifier(): VerifyingKey;
|
|
2313
|
-
/**
|
|
2314
|
-
* Returns the verifying key for the bond_public function
|
|
2315
|
-
*
|
|
2316
|
-
* @returns {VerifyingKey} Verifying key for the bond_public function
|
|
2317
|
-
|
|
2318
|
-
*/
|
|
1900
|
+
/**
|
|
1901
|
+
* Returns the verifying key for the bond_public function
|
|
1902
|
+
*
|
|
1903
|
+
* @returns {VerifyingKey} Verifying key for the bond_public function
|
|
1904
|
+
*/
|
|
2319
1905
|
isBondPublicVerifier(): boolean;
|
|
2320
|
-
/**
|
|
2321
|
-
* Returns the verifying key for the bond_validator function
|
|
2322
|
-
*
|
|
2323
|
-
* @returns {VerifyingKey} Verifying key for the bond_validator function
|
|
2324
|
-
|
|
2325
|
-
*/
|
|
1906
|
+
/**
|
|
1907
|
+
* Returns the verifying key for the bond_validator function
|
|
1908
|
+
*
|
|
1909
|
+
* @returns {VerifyingKey} Verifying key for the bond_validator function
|
|
1910
|
+
*/
|
|
2326
1911
|
isBondValidatorVerifier(): boolean;
|
|
2327
|
-
/**
|
|
2328
|
-
* Verifies the verifying key is for the claim_delegator function
|
|
2329
|
-
*
|
|
2330
|
-
* @returns {bool}
|
|
2331
|
-
|
|
2332
|
-
*/
|
|
1912
|
+
/**
|
|
1913
|
+
* Verifies the verifying key is for the claim_delegator function
|
|
1914
|
+
*
|
|
1915
|
+
* @returns {bool}
|
|
1916
|
+
*/
|
|
2333
1917
|
isClaimUnbondPublicVerifier(): boolean;
|
|
2334
|
-
/**
|
|
2335
|
-
* Verifies the verifying key is for the fee_private function
|
|
2336
|
-
*
|
|
2337
|
-
* @returns {bool}
|
|
2338
|
-
|
|
2339
|
-
*/
|
|
1918
|
+
/**
|
|
1919
|
+
* Verifies the verifying key is for the fee_private function
|
|
1920
|
+
*
|
|
1921
|
+
* @returns {bool}
|
|
1922
|
+
*/
|
|
2340
1923
|
isFeePrivateVerifier(): boolean;
|
|
2341
|
-
/**
|
|
2342
|
-
* Verifies the verifying key is for the fee_public function
|
|
2343
|
-
*
|
|
2344
|
-
* @returns {bool}
|
|
2345
|
-
|
|
2346
|
-
*/
|
|
1924
|
+
/**
|
|
1925
|
+
* Verifies the verifying key is for the fee_public function
|
|
1926
|
+
*
|
|
1927
|
+
* @returns {bool}
|
|
1928
|
+
*/
|
|
2347
1929
|
isFeePublicVerifier(): boolean;
|
|
2348
|
-
/**
|
|
2349
|
-
* Verifies the verifying key is for the inclusion function
|
|
2350
|
-
*
|
|
2351
|
-
* @returns {bool}
|
|
2352
|
-
|
|
2353
|
-
*/
|
|
1930
|
+
/**
|
|
1931
|
+
* Verifies the verifying key is for the inclusion function
|
|
1932
|
+
*
|
|
1933
|
+
* @returns {bool}
|
|
1934
|
+
*/
|
|
2354
1935
|
isInclusionVerifier(): boolean;
|
|
2355
|
-
/**
|
|
2356
|
-
* Verifies the verifying key is for the join function
|
|
2357
|
-
*
|
|
2358
|
-
* @returns {bool}
|
|
2359
|
-
|
|
2360
|
-
*/
|
|
1936
|
+
/**
|
|
1937
|
+
* Verifies the verifying key is for the join function
|
|
1938
|
+
*
|
|
1939
|
+
* @returns {bool}
|
|
1940
|
+
*/
|
|
2361
1941
|
isJoinVerifier(): boolean;
|
|
2362
|
-
/**
|
|
2363
|
-
* Verifies the verifying key is for the set_validator_state function
|
|
2364
|
-
*
|
|
2365
|
-
* @returns {bool}
|
|
2366
|
-
|
|
2367
|
-
*/
|
|
1942
|
+
/**
|
|
1943
|
+
* Verifies the verifying key is for the set_validator_state function
|
|
1944
|
+
*
|
|
1945
|
+
* @returns {bool}
|
|
1946
|
+
*/
|
|
2368
1947
|
isSetValidatorStateVerifier(): boolean;
|
|
2369
|
-
/**
|
|
2370
|
-
* Verifies the verifying key is for the split function
|
|
2371
|
-
*
|
|
2372
|
-
* @returns {bool}
|
|
2373
|
-
|
|
2374
|
-
*/
|
|
1948
|
+
/**
|
|
1949
|
+
* Verifies the verifying key is for the split function
|
|
1950
|
+
*
|
|
1951
|
+
* @returns {bool}
|
|
1952
|
+
*/
|
|
2375
1953
|
isSplitVerifier(): boolean;
|
|
2376
|
-
/**
|
|
2377
|
-
* Verifies the verifying key is for the transfer_private function
|
|
2378
|
-
*
|
|
2379
|
-
* @returns {bool}
|
|
2380
|
-
|
|
2381
|
-
*/
|
|
1954
|
+
/**
|
|
1955
|
+
* Verifies the verifying key is for the transfer_private function
|
|
1956
|
+
*
|
|
1957
|
+
* @returns {bool}
|
|
1958
|
+
*/
|
|
2382
1959
|
isTransferPrivateVerifier(): boolean;
|
|
2383
|
-
/**
|
|
2384
|
-
* Verifies the verifying key is for the transfer_private_to_public function
|
|
2385
|
-
*
|
|
2386
|
-
* @returns {bool}
|
|
2387
|
-
|
|
2388
|
-
*/
|
|
1960
|
+
/**
|
|
1961
|
+
* Verifies the verifying key is for the transfer_private_to_public function
|
|
1962
|
+
*
|
|
1963
|
+
* @returns {bool}
|
|
1964
|
+
*/
|
|
2389
1965
|
isTransferPrivateToPublicVerifier(): boolean;
|
|
2390
|
-
/**
|
|
2391
|
-
* Verifies the verifying key is for the transfer_public function
|
|
2392
|
-
*
|
|
2393
|
-
* @returns {bool}
|
|
2394
|
-
|
|
2395
|
-
*/
|
|
1966
|
+
/**
|
|
1967
|
+
* Verifies the verifying key is for the transfer_public function
|
|
1968
|
+
*
|
|
1969
|
+
* @returns {bool}
|
|
1970
|
+
*/
|
|
2396
1971
|
isTransferPublicVerifier(): boolean;
|
|
2397
|
-
/**
|
|
2398
|
-
* Verifies the verifying key is for the transfer_public_as_signer function
|
|
2399
|
-
*
|
|
2400
|
-
* @returns {bool}
|
|
2401
|
-
|
|
2402
|
-
*/
|
|
1972
|
+
/**
|
|
1973
|
+
* Verifies the verifying key is for the transfer_public_as_signer function
|
|
1974
|
+
*
|
|
1975
|
+
* @returns {bool}
|
|
1976
|
+
*/
|
|
2403
1977
|
isTransferPublicAsSignerVerifier(): boolean;
|
|
2404
|
-
/**
|
|
2405
|
-
* Verifies the verifying key is for the transfer_public_to_private function
|
|
2406
|
-
*
|
|
2407
|
-
* @returns {bool}
|
|
2408
|
-
|
|
2409
|
-
*/
|
|
1978
|
+
/**
|
|
1979
|
+
* Verifies the verifying key is for the transfer_public_to_private function
|
|
1980
|
+
*
|
|
1981
|
+
* @returns {bool}
|
|
1982
|
+
*/
|
|
2410
1983
|
isTransferPublicToPrivateVerifier(): boolean;
|
|
2411
|
-
/**
|
|
2412
|
-
* Verifies the verifying key is for the unbond_public function
|
|
2413
|
-
*
|
|
2414
|
-
* @returns {bool}
|
|
2415
|
-
|
|
2416
|
-
*/
|
|
1984
|
+
/**
|
|
1985
|
+
* Verifies the verifying key is for the unbond_public function
|
|
1986
|
+
*
|
|
1987
|
+
* @returns {bool}
|
|
1988
|
+
*/
|
|
2417
1989
|
isUnbondPublicVerifier(): boolean;
|
|
2418
|
-
/**
|
|
2419
|
-
* Get the checksum of the verifying key
|
|
2420
|
-
*
|
|
2421
|
-
* @returns {string} Checksum of the verifying key
|
|
2422
|
-
|
|
2423
|
-
*/
|
|
1990
|
+
/**
|
|
1991
|
+
* Get the checksum of the verifying key
|
|
1992
|
+
*
|
|
1993
|
+
* @returns {string} Checksum of the verifying key
|
|
1994
|
+
*/
|
|
2424
1995
|
checksum(): string;
|
|
2425
|
-
/**
|
|
2426
|
-
* Create a copy of the verifying key
|
|
2427
|
-
*
|
|
2428
|
-
* @returns {VerifyingKey} A copy of the verifying key
|
|
2429
|
-
|
|
2430
|
-
*/
|
|
1996
|
+
/**
|
|
1997
|
+
* Create a copy of the verifying key
|
|
1998
|
+
*
|
|
1999
|
+
* @returns {VerifyingKey} A copy of the verifying key
|
|
2000
|
+
*/
|
|
2431
2001
|
copy(): VerifyingKey;
|
|
2432
|
-
/**
|
|
2433
|
-
* Construct a new verifying key from a byte array
|
|
2434
|
-
*
|
|
2435
|
-
* @param {Uint8Array} bytes Byte representation of a verifying key
|
|
2436
|
-
* @returns {VerifyingKey}
|
|
2437
|
-
|
|
2438
|
-
* @returns {VerifyingKey}
|
|
2439
|
-
*/
|
|
2002
|
+
/**
|
|
2003
|
+
* Construct a new verifying key from a byte array
|
|
2004
|
+
*
|
|
2005
|
+
* @param {Uint8Array} bytes Byte representation of a verifying key
|
|
2006
|
+
* @returns {VerifyingKey}
|
|
2007
|
+
*/
|
|
2440
2008
|
static fromBytes(bytes: Uint8Array): VerifyingKey;
|
|
2441
|
-
/**
|
|
2442
|
-
* Create a verifying key from string
|
|
2443
|
-
*
|
|
2444
|
-
* @param {String} string String representation of a verifying key
|
|
2445
|
-
* @returns {VerifyingKey}
|
|
2446
|
-
|
|
2447
|
-
* @returns {VerifyingKey}
|
|
2448
|
-
*/
|
|
2009
|
+
/**
|
|
2010
|
+
* Create a verifying key from string
|
|
2011
|
+
*
|
|
2012
|
+
* @param {String} string String representation of a verifying key
|
|
2013
|
+
* @returns {VerifyingKey}
|
|
2014
|
+
*/
|
|
2449
2015
|
static fromString(string: string): VerifyingKey;
|
|
2450
|
-
/**
|
|
2451
|
-
* Create a byte array from a verifying key
|
|
2452
|
-
*
|
|
2453
|
-
* @returns {Uint8Array} Byte representation of a verifying key
|
|
2454
|
-
|
|
2455
|
-
*/
|
|
2016
|
+
/**
|
|
2017
|
+
* Create a byte array from a verifying key
|
|
2018
|
+
*
|
|
2019
|
+
* @returns {Uint8Array} Byte representation of a verifying key
|
|
2020
|
+
*/
|
|
2456
2021
|
toBytes(): Uint8Array;
|
|
2457
|
-
/**
|
|
2458
|
-
* Get a string representation of the verifying key
|
|
2459
|
-
*
|
|
2460
|
-
* @returns {String} String representation of the verifying key
|
|
2461
|
-
|
|
2462
|
-
*/
|
|
2022
|
+
/**
|
|
2023
|
+
* Get a string representation of the verifying key
|
|
2024
|
+
*
|
|
2025
|
+
* @returns {String} String representation of the verifying key
|
|
2026
|
+
*/
|
|
2463
2027
|
toString(): string;
|
|
2464
2028
|
}
|
|
2465
|
-
/**
|
|
2466
|
-
*/
|
|
2467
2029
|
export class ViewKey {
|
|
2030
|
+
private constructor();
|
|
2468
2031
|
free(): void;
|
|
2469
|
-
/**
|
|
2470
|
-
* Create a new view key from a private key
|
|
2471
|
-
*
|
|
2472
|
-
* @param {PrivateKey} private_key Private key
|
|
2473
|
-
* @returns {ViewKey} View key
|
|
2474
|
-
|
|
2475
|
-
* @returns {ViewKey}
|
|
2476
|
-
*/
|
|
2032
|
+
/**
|
|
2033
|
+
* Create a new view key from a private key
|
|
2034
|
+
*
|
|
2035
|
+
* @param {PrivateKey} private_key Private key
|
|
2036
|
+
* @returns {ViewKey} View key
|
|
2037
|
+
*/
|
|
2477
2038
|
static from_private_key(private_key: PrivateKey): ViewKey;
|
|
2478
|
-
/**
|
|
2479
|
-
* Create a new view key from a string representation of a view key
|
|
2480
|
-
*
|
|
2481
|
-
* @param {string} view_key String representation of a view key
|
|
2482
|
-
* @returns {ViewKey} View key
|
|
2483
|
-
|
|
2484
|
-
* @returns {ViewKey}
|
|
2485
|
-
*/
|
|
2039
|
+
/**
|
|
2040
|
+
* Create a new view key from a string representation of a view key
|
|
2041
|
+
*
|
|
2042
|
+
* @param {string} view_key String representation of a view key
|
|
2043
|
+
* @returns {ViewKey} View key
|
|
2044
|
+
*/
|
|
2486
2045
|
static from_string(view_key: string): ViewKey;
|
|
2487
|
-
/**
|
|
2488
|
-
* Get a string representation of a view key
|
|
2489
|
-
*
|
|
2490
|
-
* @returns {string} String representation of a view key
|
|
2491
|
-
|
|
2492
|
-
*/
|
|
2046
|
+
/**
|
|
2047
|
+
* Get a string representation of a view key
|
|
2048
|
+
*
|
|
2049
|
+
* @returns {string} String representation of a view key
|
|
2050
|
+
*/
|
|
2493
2051
|
to_string(): string;
|
|
2494
|
-
/**
|
|
2495
|
-
* Get the address corresponding to a view key
|
|
2496
|
-
*
|
|
2497
|
-
* @returns {Address} Address
|
|
2498
|
-
|
|
2499
|
-
*/
|
|
2052
|
+
/**
|
|
2053
|
+
* Get the address corresponding to a view key
|
|
2054
|
+
*
|
|
2055
|
+
* @returns {Address} Address
|
|
2056
|
+
*/
|
|
2500
2057
|
to_address(): Address;
|
|
2501
|
-
/**
|
|
2502
|
-
* Get the underlying scalar of a view key.
|
|
2503
|
-
|
|
2504
|
-
*/
|
|
2058
|
+
/**
|
|
2059
|
+
* Get the underlying scalar of a view key.
|
|
2060
|
+
*/
|
|
2505
2061
|
to_scalar(): Scalar;
|
|
2506
|
-
/**
|
|
2507
|
-
* Decrypt a record ciphertext with a view key
|
|
2508
|
-
*
|
|
2509
|
-
* @param {string} ciphertext String representation of a record ciphertext
|
|
2510
|
-
* @returns {string} String representation of a record plaintext
|
|
2511
|
-
|
|
2512
|
-
* @returns {string}
|
|
2513
|
-
*/
|
|
2062
|
+
/**
|
|
2063
|
+
* Decrypt a record ciphertext with a view key
|
|
2064
|
+
*
|
|
2065
|
+
* @param {string} ciphertext String representation of a record ciphertext
|
|
2066
|
+
* @returns {string} String representation of a record plaintext
|
|
2067
|
+
*/
|
|
2514
2068
|
decrypt(ciphertext: string): string;
|
|
2515
2069
|
}
|