Skip to content

Commit 65301a7

Browse files
committed
Updating docs
1 parent c208c09 commit 65301a7

7 files changed

+1170
-601
lines changed

docs/api_reference/sdk-src_account.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ __*return*__ | [RecordPlaintext](sdk-src_wasm.md) | *The decrypted record plaint
236236
import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
237237

238238
// Create a connection to the Aleo network and an account
239-
const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
239+
const networkClient = new AleoNetworkClient({ host: "https://api.explorer.provable.com/v1" });
240240
const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
241241

242242
// Get the record ciphertexts from a transaction.
@@ -272,7 +272,7 @@ __*return*__ | `Array.<RecordPlaintext>` | *An array of decrypted record plainte
272272
import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
273273

274274
// Create a connection to the Aleo network and an account
275-
const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
275+
const networkClient = new AleoNetworkClient({ host: "https://api.explorer.provable.com/v1" });
276276
const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
277277

278278
// Get the record ciphertexts from a transaction.
@@ -303,7 +303,7 @@ __*return*__ | `boolean` | *True if the account owns the record, false otherwise
303303
import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
304304

305305
// Create a connection to the Aleo network and an account
306-
const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
306+
const networkClient = new AleoNetworkClient({ host: "https://api.explorer.provable.com/v1" });
307307
const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
308308

309309
// Get the record ciphertexts from a transaction and check ownership of them.
@@ -565,7 +565,7 @@ __*return*__ | [RecordPlaintext](sdk-src_wasm.md) | *The decrypted record plaint
565565
import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
566566

567567
// Create a connection to the Aleo network and an account
568-
const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
568+
const networkClient = new AleoNetworkClient({ host: "https://api.explorer.provable.com/v1" });
569569
const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
570570

571571
// Get the record ciphertexts from a transaction.
@@ -601,7 +601,7 @@ __*return*__ | `Array.<RecordPlaintext>` | *An array of decrypted record plainte
601601
import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
602602

603603
// Create a connection to the Aleo network and an account
604-
const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
604+
const networkClient = new AleoNetworkClient({ host: "https://api.explorer.provable.com/v1" });
605605
const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
606606

607607
// Get the record ciphertexts from a transaction.
@@ -632,7 +632,7 @@ __*return*__ | `boolean` | *True if the account owns the record, false otherwise
632632
import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
633633

634634
// Create a connection to the Aleo network and an account
635-
const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
635+
const networkClient = new AleoNetworkClient({ host: "https://api.explorer.provable.com/v1" });
636636
const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
637637

638638
// Get the record ciphertexts from a transaction and check ownership of them.

docs/api_reference/sdk-src_function-key-provider.md

Lines changed: 72 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,18 @@ __*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the
123123

124124
```javascript
125125
// 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" });
127127
const keyProvider = new AleoKeyProvider();
128-
const recordProvider = new NetworkRecordProvider(account, networkClient);
128+
const recordProvider = new NetworkRecordProvider({ account, networkClient });
129129

130130
// 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+
});
133138

134139
// Keys can also be fetched manually using the key provider
135140
const keySearchParams = { "cacheKey": "myProgram:myFunction" };
@@ -138,36 +143,42 @@ const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvid
138143

139144
---
140145

141-
### `fetchRemoteKeys(verifierUrl, proverUrl, cacheKey) ► Promise.<FunctionKeyPair>`
146+
### `fetchRemoteKeys(params) ► Promise.<FunctionKeyPair>`
142147

143148
![modifier: public](images/badges/modifier-public.svg)
144149

145150
Returns the proving and verifying keys for a specified program from a specified url.
146151

147152
Parameters | Type | Description
148153
--- | --- | ---
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*
152158
__*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the specified program*
153159

154160
#### Examples
155161

156162
```javascript
157163
// 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" });
159165
const keyProvider = new AleoKeyProvider();
160-
const recordProvider = new NetworkRecordProvider(account, networkClient);
166+
const recordProvider = new NetworkRecordProvider({ account, networkClient });
161167

162168
// 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+
});
165176

166177
// 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+
});
171182
```
172183

173184
---
@@ -187,13 +198,18 @@ __*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the
187198

188199
```javascript
189200
// 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" });
191202
const keyProvider = new AleoKeyProvider();
192-
const recordProvider = new NetworkRecordProvider(account, networkClient);
203+
const recordProvider = new NetworkRecordProvider({ account, networkClient });
193204

194205
// 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+
});
197213

198214
// Keys can also be fetched manually
199215
const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");
@@ -349,13 +365,18 @@ __*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the
349365

350366
```javascript
351367
// 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" });
353369
const keyProvider = new AleoKeyProvider();
354-
const recordProvider = new NetworkRecordProvider(account, networkClient);
370+
const recordProvider = new NetworkRecordProvider({ account, networkClient });
355371

356372
// 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+
});
359380

360381
// Keys can also be fetched manually using the key provider
361382
const keySearchParams = { "cacheKey": "myProgram:myFunction" };
@@ -364,36 +385,42 @@ const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvid
364385

365386
---
366387

367-
### `fetchRemoteKeys(verifierUrl, proverUrl, cacheKey) ► Promise.<FunctionKeyPair>`
388+
### `fetchRemoteKeys(params) ► Promise.<FunctionKeyPair>`
368389

369390
![modifier: public](images/badges/modifier-public.svg)
370391

371392
Returns the proving and verifying keys for a specified program from a specified url.
372393

373394
Parameters | Type | Description
374395
--- | --- | ---
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*
378400
__*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the specified program*
379401

380402
#### Examples
381403

382404
```javascript
383405
// 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" });
385407
const keyProvider = new AleoKeyProvider();
386-
const recordProvider = new NetworkRecordProvider(account, networkClient);
408+
const recordProvider = new NetworkRecordProvider({ account, networkClient });
387409

388410
// 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+
});
391418

392419
// 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+
});
397424
```
398425

399426
---
@@ -413,13 +440,18 @@ __*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the
413440

414441
```javascript
415442
// 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" });
417444
const keyProvider = new AleoKeyProvider();
418-
const recordProvider = new NetworkRecordProvider(account, networkClient);
445+
const recordProvider = new NetworkRecordProvider({ account, networkClient });
419446

420447
// 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+
});
423455

424456
// Keys can also be fetched manually
425457
const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");

0 commit comments

Comments
 (0)