Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions docs/api_reference/sdk-src_function-key-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,30 @@ const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider

---

### `transferPublicKeys() ► Promise.<FunctionKeyPair>`

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

Returns the proving and verifying keys for the transfer_public function.

Parameters | Type | Description
--- | --- | ---
__*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the transfer_public function*

---

### `inclusionKeys() ► Promise.<FunctionKeyPair>`

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

Returns the proving and verifying keys for the inclusion proof.

Parameters | Type | Description
--- | --- | ---
__*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the inclusion proof.*

---

### `joinKeys() ► Promise.<FunctionKeyPair>`

![modifier: public](images/badges/modifier-public.svg)
Expand Down Expand Up @@ -427,6 +451,30 @@ const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider

---

### `transferPublicKeys() ► Promise.<FunctionKeyPair>`

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

Returns the proving and verifying keys for the transfer_public function.

Parameters | Type | Description
--- | --- | ---
__*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the transfer_public function*

---

### `inclusionKeys() ► Promise.<FunctionKeyPair>`

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

Returns the proving and verifying keys for the inclusion proof.

Parameters | Type | Description
--- | --- | ---
__*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the inclusion proof.*

---

### `joinKeys() ► Promise.<FunctionKeyPair>`

![modifier: public](images/badges/modifier-public.svg)
Expand Down
52 changes: 52 additions & 0 deletions docs/api_reference/sdk-src_offline-key-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,18 @@ __*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the

---

### `inclusionKeys() ► Promise.<FunctionKeyPair>`

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

Get the inclusion prover keys from. The keys must be cached prior to calling this method for it to work.

Parameters | Type | Description
--- | --- | ---
__*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the inclusion prover*

---

### `joinKeys() ► Promise.<FunctionKeyPair>`

![modifier: public](images/badges/modifier-public.svg)
Expand Down Expand Up @@ -646,6 +658,20 @@ __provingKey__ | `undefined` | **

---

### `insertInclusionKeys(provingKey)`

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

Insert the proving and verifying keys for the inclusion prover into the cache. Only the proving key needs
to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
that the keys match the expected checksum for the inclusion prover.

Parameters | Type | Description
--- | --- | ---
__provingKey__ | `undefined` | **

---

### `insertJoinKeys(provingKey)`

![modifier: public](images/badges/modifier-public.svg)
Expand Down Expand Up @@ -873,6 +899,18 @@ __*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the

---

### `inclusionKeys() ► Promise.<FunctionKeyPair>`

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

Get the inclusion prover keys from. The keys must be cached prior to calling this method for it to work.

Parameters | Type | Description
--- | --- | ---
__*return*__ | `Promise.<FunctionKeyPair>` | *Proving and verifying keys for the inclusion prover*

---

### `joinKeys() ► Promise.<FunctionKeyPair>`

![modifier: public](images/badges/modifier-public.svg)
Expand Down Expand Up @@ -998,6 +1036,20 @@ __provingKey__ | `undefined` | **

---

### `insertInclusionKeys(provingKey)`

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

Insert the proving and verifying keys for the inclusion prover into the cache. Only the proving key needs
to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
that the keys match the expected checksum for the inclusion prover.

Parameters | Type | Description
--- | --- | ---
__provingKey__ | `undefined` | **

---

### `insertJoinKeys(provingKey)`

![modifier: public](images/badges/modifier-public.svg)
Expand Down
24 changes: 20 additions & 4 deletions docs/api_reference/sdk-src_program-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -1253,15 +1253,23 @@ assert(isValid);

---

### `createProgramFromSource(program) ► Program`
### `createProgramFromSource(executionResponse, imports, importedVerifyingKeys, program) ► boolean`

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

Create a program object from a program&#x27;s source code
Set the inclusion key bytes.

Parameters | Type | Description
--- | --- | ---
__executionResponse__ | `executionResponse` | *The response from an offline function execution (via the &#x60;programManager.run&#x60; method)*
__imports__ | `ImportedPrograms` | *The imported programs used in the execution. Specified as { &quot;programName&quot;: &quot;programSourceCode&quot;, ... }*
__importedVerifyingKeys__ | `ImportedVerifyingKeys` | *The verifying keys in the execution. Specified as { &quot;programName&quot;: [[&quot;functionName&quot;, &quot;verifyingKey&quot;], ...], ... }*
__program__ | `string` | *Program source code*
__*return*__ | `boolean` | *True if the proof is valid, false otherwise


/**
Create a program object from a program&#x27;s source code*
__*return*__ | [Program](sdk-src_wasm.md) | *The program object*

---
Expand Down Expand Up @@ -2521,15 +2529,23 @@ assert(isValid);

---

### `createProgramFromSource(program) ► Program`
### `createProgramFromSource(executionResponse, imports, importedVerifyingKeys, program) ► boolean`

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

Create a program object from a program&#x27;s source code
Set the inclusion key bytes.

Parameters | Type | Description
--- | --- | ---
__executionResponse__ | `executionResponse` | *The response from an offline function execution (via the &#x60;programManager.run&#x60; method)*
__imports__ | `ImportedPrograms` | *The imported programs used in the execution. Specified as { &quot;programName&quot;: &quot;programSourceCode&quot;, ... }*
__importedVerifyingKeys__ | `ImportedVerifyingKeys` | *The verifying keys in the execution. Specified as { &quot;programName&quot;: [[&quot;functionName&quot;, &quot;verifyingKey&quot;], ...], ... }*
__program__ | `string` | *Program source code*
__*return*__ | `boolean` | *True if the proof is valid, false otherwise


/**
Create a program object from a program&#x27;s source code*
__*return*__ | [Program](sdk-src_wasm.md) | *The program object*

---
Expand Down
72 changes: 30 additions & 42 deletions docs/api_reference/sdk-src_record-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,21 @@ Set the account used to search for records

Parameters | Type | Description
--- | --- | ---
__account__ | [Account](sdk-src_account.md) | *The account to use for searching for records*
__account__ | [Account](sdk-src_account.md) | *The account used to use for searching for records.*

---

### `findCreditsRecords(microcredits, unspent, nonces, searchParameters) ► Promise.<RecordPlaintext>`
### `findCreditsRecords(microcredits, searchParameters) ► Promise.<Array.<OwnedRecord>>`

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

Find a list of credit records with a given number of microcredits by via the official Aleo API

Parameters | Type | Description
--- | --- | ---
__microcredits__ | `Array.<number>` | *The number of microcredits to search for*
__unspent__ | `boolean` | *Whether or not the record is unspent*
__nonces__ | `Array.<string>` | *Nonces of records already found so that they are not found again*
__searchParameters__ | `RecordSearchParams` | *Additional parameters to search for*
__*return*__ | `Promise.<RecordPlaintext>` | *The record if found, otherwise an error*
__microcredits__ | `Array.<number>` | *The number of microcredits to search for.*
__searchParameters__ | `RecordSearchParams` | *Additional parameters to search for.*
__*return*__ | `Promise.<Array.<OwnedRecord>>` | *The records if found, otherwise an error.*

#### Examples

Expand All @@ -48,11 +46,11 @@ const keyProvider = new AleoKeyProvider();
const recordProvider = new NetworkRecordProvider(account, networkClient);

// The record provider can be used to find records with a given number of microcredits
const record = await recordProvider.findCreditsRecord(5000, true, []);
const record = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces: [] });

// When a record is found but not yet used, it's nonce should be added to the nonces parameter so that it is not
// found again if a subsequent search is performed
const records = await recordProvider.findCreditsRecords(5000, true, [record.nonce()]);
const records = await recordProvider.findCreditsRecords(5000, { unspent: true, nonces: [record.nonce()] });

// When the program manager is initialized with the record provider it will be used to find automatically find
// fee records and amount records for value transfers so that they do not need to be specified manually
Expand All @@ -62,19 +60,17 @@ programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwn

---

### `findCreditsRecord(microcredits, unspent, nonces, searchParameters) ► Promise.<RecordPlaintext>`
### `findCreditsRecord(microcredits, searchParameters) ► Promise.<OwnedRecord>`

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

Find a credit record with a given number of microcredits by via the official Aleo API

Parameters | Type | Description
--- | --- | ---
__microcredits__ | `number` | *The number of microcredits to search for*
__unspent__ | `boolean` | *Whether or not the record is unspent*
__nonces__ | `Array.<string>` | *Nonces of records already found so that they are not found again*
__searchParameters__ | `RecordSearchParams` | *Additional parameters to search for*
__*return*__ | `Promise.<RecordPlaintext>` | *The record if found, otherwise an error*
__microcredits__ | `number` | *The number of microcredits to search for.*
__searchParameters__ | `RecordSearchParams` | *Additional parameters to search for.*
__*return*__ | `Promise.<OwnedRecord>` | *The record if found, otherwise an error.*

#### Examples

Expand All @@ -85,11 +81,11 @@ const keyProvider = new AleoKeyProvider();
const recordProvider = new NetworkRecordProvider(account, networkClient);

// The record provider can be used to find records with a given number of microcredits
const record = await recordProvider.findCreditsRecord(5000, true, []);
const record = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces: [] });

// When a record is found but not yet used, it's nonce should be added to the nonces parameter so that it is not
// found again if a subsequent search is performed
const records = await recordProvider.findCreditsRecords(5000, true, [record.nonce()]);
const records = await recordProvider.findCreditsRecords(5000, { unspent: true, nonces: [record.nonce()] });

// When the program manager is initialized with the record provider it will be used to find automatically find
// fee records and amount records for value transfers so that they do not need to be specified manually
Expand Down Expand Up @@ -123,23 +119,21 @@ Set the account used to search for records

Parameters | Type | Description
--- | --- | ---
__account__ | [Account](sdk-src_account.md) | *The account to use for searching for records*
__account__ | [Account](sdk-src_account.md) | *The account used to use for searching for records.*

---

### `findCreditsRecords(microcredits, unspent, nonces, searchParameters) ► Promise.<RecordPlaintext>`
### `findCreditsRecords(microcredits, searchParameters) ► Promise.<Array.<OwnedRecord>>`

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

Find a list of credit records with a given number of microcredits by via the official Aleo API

Parameters | Type | Description
--- | --- | ---
__microcredits__ | `Array.<number>` | *The number of microcredits to search for*
__unspent__ | `boolean` | *Whether or not the record is unspent*
__nonces__ | `Array.<string>` | *Nonces of records already found so that they are not found again*
__searchParameters__ | `RecordSearchParams` | *Additional parameters to search for*
__*return*__ | `Promise.<RecordPlaintext>` | *The record if found, otherwise an error*
__microcredits__ | `Array.<number>` | *The number of microcredits to search for.*
__searchParameters__ | `RecordSearchParams` | *Additional parameters to search for.*
__*return*__ | `Promise.<Array.<OwnedRecord>>` | *The records if found, otherwise an error.*

#### Examples

Expand All @@ -150,11 +144,11 @@ const keyProvider = new AleoKeyProvider();
const recordProvider = new NetworkRecordProvider(account, networkClient);

// The record provider can be used to find records with a given number of microcredits
const record = await recordProvider.findCreditsRecord(5000, true, []);
const record = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces: [] });

// When a record is found but not yet used, it's nonce should be added to the nonces parameter so that it is not
// found again if a subsequent search is performed
const records = await recordProvider.findCreditsRecords(5000, true, [record.nonce()]);
const records = await recordProvider.findCreditsRecords(5000, { unspent: true, nonces: [record.nonce()] });

// When the program manager is initialized with the record provider it will be used to find automatically find
// fee records and amount records for value transfers so that they do not need to be specified manually
Expand All @@ -164,19 +158,17 @@ programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwn

---

### `findCreditsRecord(microcredits, unspent, nonces, searchParameters) ► Promise.<RecordPlaintext>`
### `findCreditsRecord(microcredits, searchParameters) ► Promise.<OwnedRecord>`

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

Find a credit record with a given number of microcredits by via the official Aleo API

Parameters | Type | Description
--- | --- | ---
__microcredits__ | `number` | *The number of microcredits to search for*
__unspent__ | `boolean` | *Whether or not the record is unspent*
__nonces__ | `Array.<string>` | *Nonces of records already found so that they are not found again*
__searchParameters__ | `RecordSearchParams` | *Additional parameters to search for*
__*return*__ | `Promise.<RecordPlaintext>` | *The record if found, otherwise an error*
__microcredits__ | `number` | *The number of microcredits to search for.*
__searchParameters__ | `RecordSearchParams` | *Additional parameters to search for.*
__*return*__ | `Promise.<OwnedRecord>` | *The record if found, otherwise an error.*

#### Examples

Expand All @@ -187,11 +179,11 @@ const keyProvider = new AleoKeyProvider();
const recordProvider = new NetworkRecordProvider(account, networkClient);

// The record provider can be used to find records with a given number of microcredits
const record = await recordProvider.findCreditsRecord(5000, true, []);
const record = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces: [] });

// When a record is found but not yet used, it's nonce should be added to the nonces parameter so that it is not
// found again if a subsequent search is performed
const records = await recordProvider.findCreditsRecords(5000, true, [record.nonce()]);
const records = await recordProvider.findCreditsRecords(5000, { unspent: true, nonces: [record.nonce()] });

// When the program manager is initialized with the record provider it will be used to find automatically find
// fee records and amount records for value transfers so that they do not need to be specified manually
Expand All @@ -201,31 +193,27 @@ programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwn

---

### `findRecord(unspent, nonces, searchParameters) ► Promise.<RecordPlaintext>`
### `findRecord(searchParameters) ► Promise.<OwnedRecord>`

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

Find an arbitrary record. WARNING: This function is not implemented yet and will throw an error.

Parameters | Type | Description
--- | --- | ---
__unspent__ | `boolean` | **
__nonces__ | `Array` | **
__searchParameters__ | `RecordSearchParams` | **
__*return*__ | `Promise.<RecordPlaintext>` | **
__*return*__ | `Promise.<OwnedRecord>` | **

---

### `findRecords(unspent, nonces, searchParameters) ► Promise.<Array>`
### `findRecords(searchParameters) ► Promise.<Array>`

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

Find multiple records from a specified program.

Parameters | Type | Description
--- | --- | ---
__unspent__ | `boolean` | **
__nonces__ | `Array` | **
__searchParameters__ | `RecordSearchParams` | **
__*return*__ | `Promise.<Array>` | **

Expand All @@ -249,5 +237,5 @@ const recordProvider = new NetworkRecordProvider(account, networkClient);

// The record provider can be used to find records with a given number of microcredits and the block height search
// can be used to find records within a given block height range
const record = await recordProvider.findCreditsRecord(5000, true, [], params);
const record = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces: [], ...params });
```
Loading
Loading