@@ -353,7 +353,7 @@ class AleoKeyProvider implements FunctionKeyProvider {
353
353
}
354
354
355
355
if ( proverUrl && verifierUrl ) {
356
- return await this . fetchRemoteKeys ( proverUrl , verifierUrl , cacheKey ) ;
356
+ return await this . fetchRemoteKeys ( { proverUrl, verifierUrl, cacheKey } ) ;
357
357
}
358
358
359
359
if ( cacheKey ) {
@@ -366,9 +366,10 @@ class AleoKeyProvider implements FunctionKeyProvider {
366
366
/**
367
367
* Returns the proving and verifying keys for a specified program from a specified url.
368
368
*
369
- * @param {string } verifierUrl Url of the proving key
370
- * @param {string } proverUrl Url the verifying key
371
- * @param {string } cacheKey Key to store the keys in the cache
369
+ * @param {Object } params
370
+ * @param {string } params.verifierUrl Url of the proving key
371
+ * @param {string } params.proverUrl Url the verifying key
372
+ * @param {string } [params.cacheKey] Key to store the keys in the cache
372
373
*
373
374
* @returns {Promise<FunctionKeyPair> } Proving and verifying keys for the specified program
374
375
*
@@ -383,12 +384,18 @@ class AleoKeyProvider implements FunctionKeyProvider {
383
384
* programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
384
385
*
385
386
* // Keys can also be fetched manually
386
- * const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.fetchKeys(
387
- * CREDITS_PROGRAM_KEYS.transfer_private.prover,
388
- * CREDITS_PROGRAM_KEYS.transfer_private.verifier,
389
- * );
387
+ * const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.fetchRemoteKeys({
388
+ * proverUrl: CREDITS_PROGRAM_KEYS.transfer_private.prover,
389
+ * verifierUrl: CREDITS_PROGRAM_KEYS.transfer_private.verifier,
390
+ * } );
390
391
*/
391
- async fetchRemoteKeys ( proverUrl : string , verifierUrl : string , cacheKey ?: string ) : Promise < FunctionKeyPair > {
392
+ async fetchRemoteKeys ( params : {
393
+ proverUrl : string ,
394
+ verifierUrl : string ,
395
+ cacheKey ?: string ,
396
+ } ) : Promise < FunctionKeyPair > {
397
+ let { proverUrl, verifierUrl, cacheKey } = params ;
398
+
392
399
try {
393
400
// If cache is enabled, check if the keys have already been fetched and return them if they have
394
401
if ( this . cacheOption ) {
@@ -421,12 +428,18 @@ class AleoKeyProvider implements FunctionKeyProvider {
421
428
/***
422
429
* Fetches the proving key from a remote source.
423
430
*
424
- * @param proverUrl
425
- * @param cacheKey
431
+ * @param {Object } params
432
+ * @param {string } params.proverUrl
433
+ * @param {string } [params.cacheKey]
426
434
*
427
435
* @returns {Promise<ProvingKey> } Proving key for the specified program
428
436
*/
429
- async fetchProvingKey ( proverUrl : string , cacheKey ?: string ) : Promise < ProvingKey > {
437
+ async fetchProvingKey ( params : {
438
+ proverUrl : string ,
439
+ cacheKey ?: string ,
440
+ } ) : Promise < ProvingKey > {
441
+ let { proverUrl, cacheKey } = params ;
442
+
430
443
try {
431
444
// If cache is enabled, check if the keys have already been fetched and return them if they have
432
445
if ( this . cacheOption ) {
@@ -455,7 +468,7 @@ class AleoKeyProvider implements FunctionKeyProvider {
455
468
try {
456
469
if ( ! this . cache . has ( key . locator ) || ! this . cacheOption ) {
457
470
const verifying_key = key . verifyingKey ( )
458
- const proving_key = < ProvingKey > await this . fetchProvingKey ( key . prover , key . locator ) ;
471
+ const proving_key = < ProvingKey > await this . fetchProvingKey ( { proverUrl : key . prover , cacheKey : key . locator } ) ;
459
472
if ( this . cacheOption ) {
460
473
this . cache . set ( CREDITS_PROGRAM_KEYS . bond_public . locator , [ proving_key . toBytes ( ) , verifying_key . toBytes ( ) ] ) ;
461
474
}
0 commit comments