@@ -123,13 +123,18 @@ __*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the
123
123
124
124
``` javascript
125
125
// Create a new object which implements the KeyProvider interface
126
- const networkClient = new AleoNetworkClient (" https://api.explorer.provable.com/v1" );
126
+ const networkClient = new AleoNetworkClient ({ host : " https://api.explorer.provable.com/v1" } );
127
127
const keyProvider = new AleoKeyProvider ();
128
- const recordProvider = new NetworkRecordProvider (account, networkClient);
128
+ const recordProvider = new NetworkRecordProvider ({ account, networkClient } );
129
129
130
130
// Initialize a program manager with the key provider to automatically fetch keys for value transfers
131
- const programManager = new ProgramManager (" https://api.explorer.provable.com/v1" , keyProvider, recordProvider);
132
- programManager .transfer (1 , " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" , " public" , 0.5 );
131
+ const programManager = new ProgramManager ({ host: " https://api.explorer.provable.com/v1" , keyProvider, recordProvider });
132
+ programManager .transfer ({
133
+ amount: 1 ,
134
+ recipient: " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" ,
135
+ transferType: " public" ,
136
+ priorityFee: 0.5 ,
137
+ });
133
138
134
139
// Keys can also be fetched manually using the key provider
135
140
const keySearchParams = { " cacheKey" : " myProgram:myFunction" };
@@ -138,36 +143,42 @@ const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvid
138
143
139
144
---
140
145
141
- ### ` fetchRemoteKeys(verifierUrl, proverUrl, cacheKey ) ► Promise.<FunctionKeyPair> `
146
+ ### ` fetchRemoteKeys(params ) ► Promise.<FunctionKeyPair> `
142
147
143
148
![ modifier: public] ( images/badges/modifier-public.svg )
144
149
145
150
Returns the proving and verifying keys for a specified program from a specified url.
146
151
147
152
Parameters | Type | Description
148
153
--- | --- | ---
149
- __ verifierUrl__ | ` string ` | * Url of the proving key*
150
- __ proverUrl__ | ` string ` | * Url the verifying key*
151
- __ cacheKey__ | ` string ` | * Key to store the keys in the cache*
154
+ __ params__ | ` Object ` | **
155
+ __ params.verifierUrl__ | ` string ` | * Url of the proving key*
156
+ __ params.proverUrl__ | ` string ` | * Url the verifying key*
157
+ __ params.cacheKey__ | ` string ` | * Key to store the keys in the cache*
152
158
__ * return* __ | ` Promise.<FunctionKeyPair> ` | * Proving and verifying keys for the specified program*
153
159
154
160
#### Examples
155
161
156
162
``` javascript
157
163
// Create a new AleoKeyProvider object
158
- const networkClient = new AleoNetworkClient (" https://api.explorer.provable.com/v1" );
164
+ const networkClient = new AleoNetworkClient ({ host : " https://api.explorer.provable.com/v1" } );
159
165
const keyProvider = new AleoKeyProvider ();
160
- const recordProvider = new NetworkRecordProvider (account, networkClient);
166
+ const recordProvider = new NetworkRecordProvider ({ account, networkClient } );
161
167
162
168
// Initialize a program manager with the key provider to automatically fetch keys for value transfers
163
- const programManager = new ProgramManager (" https://api.explorer.provable.com/v1" , keyProvider, recordProvider);
164
- programManager .transfer (1 , " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" , " public" , 0.5 );
169
+ const programManager = new ProgramManager ({ host: " https://api.explorer.provable.com/v1" , keyProvider, recordProvider });
170
+ programManager .transfer ({
171
+ amount: 1 ,
172
+ recipient: " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" ,
173
+ transferType: " public" ,
174
+ priorityFee: 0.5 ,
175
+ });
165
176
166
177
// Keys can also be fetched manually
167
- const [transferPrivateProvingKey , transferPrivateVerifyingKey ] = await keyProvider .fetchKeys (
168
- CREDITS_PROGRAM_KEYS .transfer_private .prover ,
169
- CREDITS_PROGRAM_KEYS .transfer_private .verifier ,
170
- );
178
+ const [transferPrivateProvingKey , transferPrivateVerifyingKey ] = await keyProvider .fetchRemoteKeys ({
179
+ proverUrl : CREDITS_PROGRAM_KEYS .transfer_private .prover ,
180
+ verifierUrl : CREDITS_PROGRAM_KEYS .transfer_private .verifier ,
181
+ } );
171
182
```
172
183
173
184
---
@@ -187,13 +198,18 @@ __*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the
187
198
188
199
``` javascript
189
200
// Create a new AleoKeyProvider
190
- const networkClient = new AleoNetworkClient (" https://api.explorer.provable.com/v1" );
201
+ const networkClient = new AleoNetworkClient ({ host : " https://api.explorer.provable.com/v1" } );
191
202
const keyProvider = new AleoKeyProvider ();
192
- const recordProvider = new NetworkRecordProvider (account, networkClient);
203
+ const recordProvider = new NetworkRecordProvider ({ account, networkClient } );
193
204
194
205
// Initialize a program manager with the key provider to automatically fetch keys for value transfers
195
- const programManager = new ProgramManager (" https://api.explorer.provable.com/v1" , keyProvider, recordProvider);
196
- programManager .transfer (1 , " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" , " public" , 0.5 );
206
+ const programManager = new ProgramManager ({ host: " https://api.explorer.provable.com/v1" , keyProvider, recordProvider });
207
+ programManager .transfer ({
208
+ amount: 1 ,
209
+ recipient: " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" ,
210
+ transferType: " public" ,
211
+ priorityFee: 0.5 ,
212
+ });
197
213
198
214
// Keys can also be fetched manually
199
215
const [transferPublicProvingKey , transferPublicVerifyingKey ] = await keyProvider .transferKeys (" public" );
@@ -349,13 +365,18 @@ __*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the
349
365
350
366
``` javascript
351
367
// Create a new object which implements the KeyProvider interface
352
- const networkClient = new AleoNetworkClient (" https://api.explorer.provable.com/v1" );
368
+ const networkClient = new AleoNetworkClient ({ host : " https://api.explorer.provable.com/v1" } );
353
369
const keyProvider = new AleoKeyProvider ();
354
- const recordProvider = new NetworkRecordProvider (account, networkClient);
370
+ const recordProvider = new NetworkRecordProvider ({ account, networkClient } );
355
371
356
372
// Initialize a program manager with the key provider to automatically fetch keys for value transfers
357
- const programManager = new ProgramManager (" https://api.explorer.provable.com/v1" , keyProvider, recordProvider);
358
- programManager .transfer (1 , " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" , " public" , 0.5 );
373
+ const programManager = new ProgramManager ({ host: " https://api.explorer.provable.com/v1" , keyProvider, recordProvider });
374
+ programManager .transfer ({
375
+ amount: 1 ,
376
+ recipient: " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" ,
377
+ transferType: " public" ,
378
+ priorityFee: 0.5 ,
379
+ });
359
380
360
381
// Keys can also be fetched manually using the key provider
361
382
const keySearchParams = { " cacheKey" : " myProgram:myFunction" };
@@ -364,36 +385,42 @@ const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvid
364
385
365
386
---
366
387
367
- ### ` fetchRemoteKeys(verifierUrl, proverUrl, cacheKey ) ► Promise.<FunctionKeyPair> `
388
+ ### ` fetchRemoteKeys(params ) ► Promise.<FunctionKeyPair> `
368
389
369
390
![ modifier: public] ( images/badges/modifier-public.svg )
370
391
371
392
Returns the proving and verifying keys for a specified program from a specified url.
372
393
373
394
Parameters | Type | Description
374
395
--- | --- | ---
375
- __ verifierUrl__ | ` string ` | * Url of the proving key*
376
- __ proverUrl__ | ` string ` | * Url the verifying key*
377
- __ cacheKey__ | ` string ` | * Key to store the keys in the cache*
396
+ __ params__ | ` Object ` | **
397
+ __ params.verifierUrl__ | ` string ` | * Url of the proving key*
398
+ __ params.proverUrl__ | ` string ` | * Url the verifying key*
399
+ __ params.cacheKey__ | ` string ` | * Key to store the keys in the cache*
378
400
__ * return* __ | ` Promise.<FunctionKeyPair> ` | * Proving and verifying keys for the specified program*
379
401
380
402
#### Examples
381
403
382
404
``` javascript
383
405
// Create a new AleoKeyProvider object
384
- const networkClient = new AleoNetworkClient (" https://api.explorer.provable.com/v1" );
406
+ const networkClient = new AleoNetworkClient ({ host : " https://api.explorer.provable.com/v1" } );
385
407
const keyProvider = new AleoKeyProvider ();
386
- const recordProvider = new NetworkRecordProvider (account, networkClient);
408
+ const recordProvider = new NetworkRecordProvider ({ account, networkClient } );
387
409
388
410
// Initialize a program manager with the key provider to automatically fetch keys for value transfers
389
- const programManager = new ProgramManager (" https://api.explorer.provable.com/v1" , keyProvider, recordProvider);
390
- programManager .transfer (1 , " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" , " public" , 0.5 );
411
+ const programManager = new ProgramManager ({ host: " https://api.explorer.provable.com/v1" , keyProvider, recordProvider });
412
+ programManager .transfer ({
413
+ amount: 1 ,
414
+ recipient: " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" ,
415
+ transferType: " public" ,
416
+ priorityFee: 0.5 ,
417
+ });
391
418
392
419
// Keys can also be fetched manually
393
- const [transferPrivateProvingKey , transferPrivateVerifyingKey ] = await keyProvider .fetchKeys (
394
- CREDITS_PROGRAM_KEYS .transfer_private .prover ,
395
- CREDITS_PROGRAM_KEYS .transfer_private .verifier ,
396
- );
420
+ const [transferPrivateProvingKey , transferPrivateVerifyingKey ] = await keyProvider .fetchRemoteKeys ({
421
+ proverUrl : CREDITS_PROGRAM_KEYS .transfer_private .prover ,
422
+ verifierUrl : CREDITS_PROGRAM_KEYS .transfer_private .verifier ,
423
+ } );
397
424
```
398
425
399
426
---
@@ -413,13 +440,18 @@ __*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the
413
440
414
441
``` javascript
415
442
// Create a new AleoKeyProvider
416
- const networkClient = new AleoNetworkClient (" https://api.explorer.provable.com/v1" );
443
+ const networkClient = new AleoNetworkClient ({ host : " https://api.explorer.provable.com/v1" } );
417
444
const keyProvider = new AleoKeyProvider ();
418
- const recordProvider = new NetworkRecordProvider (account, networkClient);
445
+ const recordProvider = new NetworkRecordProvider ({ account, networkClient } );
419
446
420
447
// Initialize a program manager with the key provider to automatically fetch keys for value transfers
421
- const programManager = new ProgramManager (" https://api.explorer.provable.com/v1" , keyProvider, recordProvider);
422
- programManager .transfer (1 , " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" , " public" , 0.5 );
448
+ const programManager = new ProgramManager ({ host: " https://api.explorer.provable.com/v1" , keyProvider, recordProvider });
449
+ programManager .transfer ({
450
+ amount: 1 ,
451
+ recipient: " aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at" ,
452
+ transferType: " public" ,
453
+ priorityFee: 0.5 ,
454
+ });
423
455
424
456
// Keys can also be fetched manually
425
457
const [transferPublicProvingKey , transferPublicVerifyingKey ] = await keyProvider .transferKeys (" public" );
0 commit comments