@provablehq/wasm 0.8.0 → 0.8.4

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