diff --git a/.circleci/config.yml b/.circleci/config.yml index e9a368e19..ad5133910 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -99,7 +99,7 @@ jobs: - run: working_directory: create-leo-app/template-node command: | - yarn start + yarn dev template-node-ts: executor: rust-node @@ -108,7 +108,7 @@ jobs: - run: working_directory: create-leo-app/template-node-ts command: | - yarn start + yarn dev template-extension: executor: rust-node diff --git a/create-leo-app/template-node-ts/package.json b/create-leo-app/template-node-ts/package.json index be36c97a3..6c3e3df2f 100644 --- a/create-leo-app/template-node-ts/package.json +++ b/create-leo-app/template-node-ts/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "build": "rimraf dist/js && rollup --config", - "start": "npm run build && node dist/index.js" + "dev": "npm run build && node dist/index.js" }, "dependencies": { "@provablehq/sdk": "^0.7.0" diff --git a/create-leo-app/template-node/package.json b/create-leo-app/template-node/package.json index 0334fe2ba..a37b987a9 100644 --- a/create-leo-app/template-node/package.json +++ b/create-leo-app/template-node/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "type": "module", "scripts": { - "start": "node index.js" + "dev": "node index.js" }, "dependencies": { "@provablehq/sdk": "^0.7.0" diff --git a/create-leo-app/template-offline-public-transaction-ts/package.json b/create-leo-app/template-offline-public-transaction-ts/package.json index 7d836216e..663095c84 100644 --- a/create-leo-app/template-offline-public-transaction-ts/package.json +++ b/create-leo-app/template-offline-public-transaction-ts/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "build": "rimraf dist/js && rollup --config", - "start": "npm run build && node dist/index.js" + "dev": "npm run build && node dist/index.js" }, "dependencies": { "@provablehq/sdk": "^0.7.0" diff --git a/package.json b/package.json index 4d144e863..5ea91538e 100644 --- a/package.json +++ b/package.json @@ -15,24 +15,23 @@ "scripts": { "build:wasm": "cd wasm && yarn build", "build:sdk": "cd sdk && yarn build", + "build:sdk-docs": "jsdoc -c sdk/jsdoc.json", "build:create-leo-app": "cd create-leo-app && yarn build", "build:all": "yarn build:wasm && yarn build:sdk && yarn build:create-leo-app", - "start:website": "cd website && yarn dev", + "deploy:wasm": "cd wasm && npm publish --access=public", + "deploy:sdk": "cd sdk && npm publish --access=public", + "deploy:create-leo-app": "cd create-leo-app && npm publish --access=public", + "deploy": "yarn build:all && yarn deploy:wasm && yarn deploy:sdk && yarn deploy:create-leo-app", "test:wasm": "cd wasm && yarn test", "test:sdk": "cd sdk && yarn test", "test": "yarn test:wasm && yarn test:sdk", "change-version": "node scripts/change-version.js", - - "deploy:wasm": "cd wasm && npm publish --access=public", - "deploy:sdk": "cd sdk && npm publish --access=public", - "deploy:create-leo-app": "cd create-leo-app && npm publish --access=public", - "deploy": "yarn build:all && yarn deploy:wasm && yarn deploy:sdk && yarn deploy:create-leo-app", - "lint": "prettier . --check", - "pretty": "prettier . --write" + "pretty": "prettier . --write", + "start:website": "cd website && yarn dev" }, "optionalDependencies": { "glob": "^11.0.0" diff --git a/sdk/docs/Account.html b/sdk/docs/Account.html index 8e9cd146a..67384c912 100644 --- a/sdk/docs/Account.html +++ b/sdk/docs/Account.html @@ -1,35 +1,35 @@ Class: Account
On this page

Account

Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from an existing private key or seed, and message signing and verification functionality. An Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key, and a public account address are derived. The private key lies at the root of an Aleo account. It is a highly sensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value transfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public address to which other users of Aleo can send Aleo credits and other records to. This class should only be used environments where the safety of the underlying key material can be assured.

Constructor

new Account()

Example
// Create a new account
-let myRandomAccount = new Account();
+    
On this page

Account

Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from an existing private key or seed, and message signing and verification functionality. An Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key, and a public account address are derived. The private key lies at the root of an Aleo account. It is a highly sensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value transfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public address to which other users of Aleo can send Aleo credits and other records to. This class should only be used environments where the safety of the underlying key material can be assured.

Constructor

new Account()

Example
// Create a new account
+const myRandomAccount = new Account();
 
 // Create an account from a randomly generated seed
-let seed = new Uint8Array([94, 91, 52, 251, 240, 230, 226, 35, 117, 253, 224, 210, 175, 13, 205, 120, 155, 214, 7, 169, 66, 62, 206, 50, 188, 40, 29, 122, 40, 250, 54, 18]);
-let mySeededAccount = new Account({seed: seed});
+const seed = new Uint8Array([94, 91, 52, 251, 240, 230, 226, 35, 117, 253, 224, 210, 175, 13, 205, 120, 155, 214, 7, 169, 66, 62, 206, 50, 188, 40, 29, 122, 40, 250, 54, 18]);
+const mySeededAccount = new Account({seed: seed});
 
 // Create an account from an existing private key
-let myExistingAccount = new Account({privateKey: 'myExistingPrivateKey'})
+const myExistingAccount = new Account({privateKey: 'myExistingPrivateKey'})
 
 // Sign a message
-let hello_world = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
-let signature = myRandomAccount.sign(hello_world)
+const hello_world = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
+const signature = myRandomAccount.sign(hello_world)
 
 // Verify a signature
-myRandomAccount.verify(hello_world, signature)

Classes

Account

Methods

(static) fromCiphertext(ciphertext, password) → {PrivateKey|Error}

Attempts to create an account from a private key ciphertext
Parameters:
NameTypeDescription
ciphertextPrivateKeyCiphertext | string
passwordstring
Returns:
Type: 
PrivateKey | Error
Example
let ciphertext = PrivateKey.newEncrypted("password");
-let account = Account.fromCiphertext(ciphertext, "password");

(static) fromCiphertext(ciphertext, password) → {PrivateKey|Error}

Attempts to create an account from a private key ciphertext
Parameters:
NameTypeDescription
ciphertextPrivateKeyCiphertext | string
passwordstring
Returns:
Type: 
PrivateKey | Error
Example
let ciphertext = PrivateKey.newEncrypted("password");
-let account = Account.fromCiphertext(ciphertext, "password");

decryptRecord(ciphertext) → {Record}

Decrypts a Record in ciphertext form into plaintext
Parameters:
NameTypeDescription
ciphertextstring
Returns:
Type: 
Record
Example
let account = new Account();
-let record = account.decryptRecord("record1ciphertext");

decryptRecord(ciphertext) → {Record}

Decrypts a Record in ciphertext form into plaintext
Parameters:
NameTypeDescription
ciphertextstring
Returns:
Type: 
Record
Example
let account = new Account();
-let record = account.decryptRecord("record1ciphertext");

decryptRecords(ciphertexts) → {Array.<Record>}

Decrypts an array of Records in ciphertext form into plaintext
Parameters:
NameTypeDescription
ciphertextsArray.<string>
Returns:
Type: 
Array.<Record>
Example
let account = new Account();
-let record = account.decryptRecords(["record1ciphertext", "record2ciphertext"]);

decryptRecords(ciphertexts) → {Array.<Record>}

Decrypts an array of Records in ciphertext form into plaintext
Parameters:
NameTypeDescription
ciphertextsArray.<string>
Returns:
Type: 
Array.<Record>
Example
let account = new Account();
-let record = account.decryptRecords(["record1ciphertext", "record2ciphertext"]);

encryptAccount(ciphertext) → {PrivateKeyCiphertext}

Encrypt the account's private key with a password
Parameters:
NameTypeDescription
ciphertextstring
Returns:
Type: 
PrivateKeyCiphertext
Example
let account = new Account();
-let ciphertext = account.encryptAccount("password");

encryptAccount(ciphertext) → {PrivateKeyCiphertext}

Encrypt the account's private key with a password
Parameters:
NameTypeDescription
ciphertextstring
Returns:
Type: 
PrivateKeyCiphertext
Example
let account = new Account();
-let ciphertext = account.encryptAccount("password");

ownsRecordCiphertext(ciphertext) → {boolean}

Determines whether the account owns a ciphertext record
Parameters:
NameTypeDescription
ciphertextRecordCipherText | string
Returns:
Type: 
boolean
Example
// Create a connection to the Aleo network and an account
-let connection = new NodeConnection("vm.aleo.org/api");
-let account = Account.fromCiphertext("ciphertext", "password");
+myRandomAccount.verify(hello_world, signature)

Classes

Account

Methods

(static) fromCiphertext(ciphertext, password) → {PrivateKey}

Attempts to create an account from a private key ciphertext
Parameters:
NameTypeDescription
ciphertextPrivateKeyCiphertext | string
passwordstring
Returns:
Type: 
PrivateKey
Example
const ciphertext = PrivateKey.newEncrypted("password");
+const account = Account.fromCiphertext(ciphertext, "password");

(static) fromCiphertext(ciphertext, password) → {PrivateKey}

Attempts to create an account from a private key ciphertext
Parameters:
NameTypeDescription
ciphertextPrivateKeyCiphertext | string
passwordstring
Returns:
Type: 
PrivateKey
Example
const ciphertext = PrivateKey.newEncrypted("password");
+const account = Account.fromCiphertext(ciphertext, "password");

decryptRecord(ciphertext) → {Record}

Decrypts a Record in ciphertext form into plaintext
Parameters:
NameTypeDescription
ciphertextstring
Returns:
Type: 
Record
Example
const account = new Account();
+const record = account.decryptRecord("record1ciphertext");

decryptRecord(ciphertext) → {Record}

Decrypts a Record in ciphertext form into plaintext
Parameters:
NameTypeDescription
ciphertextstring
Returns:
Type: 
Record
Example
const account = new Account();
+const record = account.decryptRecord("record1ciphertext");

decryptRecords(ciphertexts) → {Array.<Record>}

Decrypts an array of Records in ciphertext form into plaintext
Parameters:
NameTypeDescription
ciphertextsArray.<string>
Returns:
Type: 
Array.<Record>
Example
const account = new Account();
+const record = account.decryptRecords(["record1ciphertext", "record2ciphertext"]);

decryptRecords(ciphertexts) → {Array.<Record>}

Decrypts an array of Records in ciphertext form into plaintext
Parameters:
NameTypeDescription
ciphertextsArray.<string>
Returns:
Type: 
Array.<Record>
Example
const account = new Account();
+const record = account.decryptRecords(["record1ciphertext", "record2ciphertext"]);

encryptAccount(ciphertext) → {PrivateKeyCiphertext}

Encrypt the account's private key with a password
Parameters:
NameTypeDescription
ciphertextstring
Returns:
Type: 
PrivateKeyCiphertext
Example
const account = new Account();
+const ciphertext = account.encryptAccount("password");

encryptAccount(ciphertext) → {PrivateKeyCiphertext}

Encrypt the account's private key with a password
Parameters:
NameTypeDescription
ciphertextstring
Returns:
Type: 
PrivateKeyCiphertext
Example
const account = new Account();
+const ciphertext = account.encryptAccount("password");

ownsRecordCiphertext(ciphertext) → {boolean}

Determines whether the account owns a ciphertext record
Parameters:
NameTypeDescription
ciphertextRecordCipherText | string
Returns:
Type: 
boolean
Example
// Create a connection to the Aleo network and an account
+const connection = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const account = Account.fromCiphertext("ciphertext", "password");
 
 // Get a record from the network
-let record = connection.getBlock(1234);
-let recordCipherText = record.transactions[0].execution.transitions[0].id;
+const record = connection.getBlock(1234);
+const recordCipherText = record.transactions[0].execution.transitions[0].id;
 
 // Check if the account owns the record
 if account.ownsRecord(recordCipherText) {
@@ -38,12 +38,12 @@
     // Store the record in a local database
     // Etc.
 }

ownsRecordCiphertext(ciphertext) → {boolean}

Determines whether the account owns a ciphertext record
Parameters:
NameTypeDescription
ciphertextRecordCipherText | string
Returns:
Type: 
boolean
Example
// Create a connection to the Aleo network and an account
-let connection = new NodeConnection("vm.aleo.org/api");
-let account = Account.fromCiphertext("ciphertext", "password");
+const connection = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const account = Account.fromCiphertext("ciphertext", "password");
 
 // Get a record from the network
-let record = connection.getBlock(1234);
-let recordCipherText = record.transactions[0].execution.transitions[0].id;
+const record = connection.getBlock(1234);
+const recordCipherText = record.transactions[0].execution.transitions[0].id;
 
 // Check if the account owns the record
 if account.ownsRecord(recordCipherText) {
@@ -51,14 +51,14 @@
     // Decrypt the record and check if it's spent
     // Store the record in a local database
     // Etc.
-}

sign(message) → {Signature}

Signs a message with the account's private key. Returns a Signature.
Parameters:
NameTypeDescription
messageUint8Array
Returns:
Type: 
Signature
Example
let account = new Account();
-let message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
-account.sign(message);

sign(message) → {Signature}

Signs a message with the account's private key. Returns a Signature.
Parameters:
NameTypeDescription
messageUint8Array
Returns:
Type: 
Signature
Example
let account = new Account();
-let message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
-account.sign(message);

verify(message, signature) → {boolean}

Verifies the Signature on a message.
Parameters:
NameTypeDescription
messageUint8Array
signatureSignature
Returns:
Type: 
boolean
Example
let account = new Account();
-let message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
-let signature = account.sign(message);
-account.verify(message, signature);

verify(message, signature) → {boolean}

Verifies the Signature on a message.
Parameters:
NameTypeDescription
messageUint8Array
signatureSignature
Returns:
Type: 
boolean
Example
let account = new Account();
-let message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
-let signature = account.sign(message);
-account.verify(message, signature);
Home
\ No newline at end of file +}

sign(message) → {Signature}

Signs a message with the account's private key. Returns a Signature.
Parameters:
NameTypeDescription
messageUint8Array
Source
Returns:
Type: 
Signature
Example
const account = new Account();
+const message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
+account.sign(message);

sign(message) → {Signature}

Signs a message with the account's private key. Returns a Signature.
Parameters:
NameTypeDescription
messageUint8Array
Source
Returns:
Type: 
Signature
Example
const account = new Account();
+const message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
+account.sign(message);

verify(message, signature) → {boolean}

Verifies the Signature on a message.
Parameters:
NameTypeDescription
messageUint8Array
signatureSignature
Source
Returns:
Type: 
boolean
Example
const account = new Account();
+const message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
+const signature = account.sign(message);
+account.verify(message, signature);

verify(message, signature) → {boolean}

Verifies the Signature on a message.
Parameters:
NameTypeDescription
messageUint8Array
signatureSignature
Source
Returns:
Type: 
boolean
Example
const account = new Account();
+const message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
+const signature = account.sign(message);
+account.verify(message, signature);
\ No newline at end of file diff --git a/sdk/docs/AleoKeyProvider.html b/sdk/docs/AleoKeyProvider.html new file mode 100644 index 000000000..77fb09d6a --- /dev/null +++ b/sdk/docs/AleoKeyProvider.html @@ -0,0 +1,71 @@ +Class: AleoKeyProvider
On this page

AleoKeyProvider

AleoKeyProvider class. Implements the KeyProvider interface. Enables the retrieval of Aleo program proving and verifying keys for the credits.aleo program over http from official Aleo sources and storing and retrieving function keys from a local memory cache.

Constructor

new AleoKeyProvider()

Methods

cacheKeys(keyId, keys)

Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.
Parameters:
NameTypeDescription
keyIdstringaccess key for the cache
keysFunctionKeyPairkeys to cache

cacheKeys(keyId, keys)

Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.
Parameters:
NameTypeDescription
keyIdstringaccess key for the cache
keysFunctionKeyPairkeys to cache

clearCache()

Clear the key cache

clearCache()

Clear the key cache

containsKeys(keyId) → {boolean}

Determine if a keyId exists in the cache
Parameters:
NameTypeDescription
keyIdstringkeyId of a proving and verifying key pair
Returns:
true if the keyId exists in the cache, false otherwise
Type: 
boolean

containsKeys(keyId) → {boolean}

Determine if a keyId exists in the cache
Parameters:
NameTypeDescription
keyIdstringkeyId of a proving and verifying key pair
Returns:
true if the keyId exists in the cache, false otherwise
Type: 
boolean

deleteKeys(keyId) → {boolean}

Delete a set of keys from the cache
Parameters:
NameTypeDescription
keyIdstringkeyId of a proving and verifying key pair to delete from memory
Returns:
true if the keyId exists in the cache and was deleted, false if the key did not exist
Type: 
boolean

deleteKeys(keyId) → {boolean}

Delete a set of keys from the cache
Parameters:
NameTypeDescription
keyIdstringkeyId of a proving and verifying key pair to delete from memory
Returns:
true if the keyId exists in the cache and was deleted, false if the key did not exist
Type: 
boolean

(async) feePrivateKeys() → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for the fee_private function in the credits.aleo program
Returns:
Proving and verifying keys for the fee function
Type: 
Promise.<FunctionKeyPair>

(async) feePrivateKeys() → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for the fee_private function in the credits.aleo program
Returns:
Proving and verifying keys for the fee function
Type: 
Promise.<FunctionKeyPair>

(async) feePublicKeys() → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for the fee_public function in the credits.aleo program
Returns:
Proving and verifying keys for the fee function
Type: 
Promise.<FunctionKeyPair>

(async) feePublicKeys() → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for the fee_public function in the credits.aleo program
Returns:
Proving and verifying keys for the fee function
Type: 
Promise.<FunctionKeyPair>

(async) fetchRemoteKeys(verifierUrl, proverUrl, cacheKey) → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for a specified program from a specified url.
Parameters:
NameTypeDescription
verifierUrlstringUrl of the proving key
proverUrlstringUrl the verifying key
cacheKeystringKey to store the keys in the cache
Returns:
Proving and verifying keys for the specified program
Type: 
Promise.<FunctionKeyPair>
Example
// Create a new AleoKeyProvider object
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for value transfers
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+
+// Keys can also be fetched manually
+const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.fetchKeys(
+    CREDITS_PROGRAM_KEYS.transfer_private.prover,
+    CREDITS_PROGRAM_KEYS.transfer_private.verifier,
+);

(async) fetchRemoteKeys(verifierUrl, proverUrl, cacheKey) → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for a specified program from a specified url.
Parameters:
NameTypeDescription
verifierUrlstringUrl of the proving key
proverUrlstringUrl the verifying key
cacheKeystringKey to store the keys in the cache
Returns:
Proving and verifying keys for the specified program
Type: 
Promise.<FunctionKeyPair>
Example
// Create a new AleoKeyProvider object
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for value transfers
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+
+// Keys can also be fetched manually
+const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.fetchKeys(
+    CREDITS_PROGRAM_KEYS.transfer_private.prover,
+    CREDITS_PROGRAM_KEYS.transfer_private.verifier,
+);

(async) functionKeys(params) → {Promise.<FunctionKeyPair>}

Get arbitrary function keys from a provider
Parameters:
NameTypeDescription
paramsKeySearchParamsparameters for the key search in form of: {proverUri: string, verifierUri: string, cacheKey: string}
Returns:
Proving and verifying keys for the specified program
Type: 
Promise.<FunctionKeyPair>
Example
// Create a new object which implements the KeyProvider interface
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for value transfers
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+
+// Keys can also be fetched manually using the key provider
+const keySearchParams = { "cacheKey": "myProgram:myFunction" };
+const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.functionKeys(keySearchParams);

(async) functionKeys(params) → {Promise.<FunctionKeyPair>}

Get arbitrary function keys from a provider
Parameters:
NameTypeDescription
paramsKeySearchParamsparameters for the key search in form of: {proverUri: string, verifierUri: string, cacheKey: string}
Returns:
Proving and verifying keys for the specified program
Type: 
Promise.<FunctionKeyPair>
Example
// Create a new object which implements the KeyProvider interface
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for value transfers
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+
+// Keys can also be fetched manually using the key provider
+const keySearchParams = { "cacheKey": "myProgram:myFunction" };
+const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.functionKeys(keySearchParams);

getKeys(keyId) → {FunctionKeyPair}

Get a set of keys from the cache
Parameters:
NameTypeDescription
keyIdkeyId of a proving and verifying key pair
Returns:
Proving and verifying keys for the specified program
Type: 
FunctionKeyPair

getKeys(keyId) → {FunctionKeyPair}

Get a set of keys from the cache
Parameters:
NameTypeDescription
keyIdkeyId of a proving and verifying key pair
Returns:
Proving and verifying keys for the specified program
Type: 
FunctionKeyPair

(async) getVerifyingKey() → {Promise.<VerifyingKey>}

Gets a verifying key. If the verifying key is for a credits.aleo function, get it from the wasm cache otherwise
Returns:
Verifying key for the function
Type: 
Promise.<VerifyingKey>

(async) getVerifyingKey(verifierUri) → {Promise.<VerifyingKey>}

Gets a verifying key. If the verifying key is for a credits.aleo function, get it from the wasm cache otherwise
Parameters:
NameTypeDescription
verifierUristring
Returns:
Verifying key for the function
Type: 
Promise.<VerifyingKey>

(async) joinKeys() → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for the join function in the credits.aleo program
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

(async) joinKeys() → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for the join function in the credits.aleo program
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

(async) splitKeys() → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for the split function in the credits.aleo program
Returns:
Proving and verifying keys for the split function
Type: 
Promise.<FunctionKeyPair>

(async) splitKeys() → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for the split function in the credits.aleo program
Returns:
Proving and verifying keys for the split function
Type: 
Promise.<FunctionKeyPair>

(async) transferKeys(visibility) → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for the transfer functions in the credits.aleo program
Parameters:
NameTypeDescription
visibilitystringVisibility of the transfer function
Returns:
Proving and verifying keys for the transfer functions
Type: 
Promise.<FunctionKeyPair>
Example
// Create a new AleoKeyProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for value transfers
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+
+// Keys can also be fetched manually
+const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");

(async) transferKeys(visibility) → {Promise.<FunctionKeyPair>}

Returns the proving and verifying keys for the transfer functions in the credits.aleo program
Parameters:
NameTypeDescription
visibilitystringVisibility of the transfer function
Returns:
Proving and verifying keys for the transfer functions
Type: 
Promise.<FunctionKeyPair>
Example
// Create a new AleoKeyProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for value transfers
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+
+// Keys can also be fetched manually
+const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");

useCache(useCache)

Use local memory to store keys
Parameters:
NameTypeDescription
useCachebooleanwhether to store keys in local memory

useCache(useCache)

Use local memory to store keys
Parameters:
NameTypeDescription
useCachebooleanwhether to store keys in local memory
\ No newline at end of file diff --git a/sdk/docs/AleoKeyProviderParams.html b/sdk/docs/AleoKeyProviderParams.html new file mode 100644 index 000000000..c4b2d5342 --- /dev/null +++ b/sdk/docs/AleoKeyProviderParams.html @@ -0,0 +1,3 @@ +Class: AleoKeyProviderParams
On this page

AleoKeyProviderParams

AleoKeyProviderParams search parameter for the AleoKeyProvider. It allows for the specification of a proverUri and verifierUri to fetch keys via HTTP from a remote resource as well as a unique cacheKey to store the keys in memory.

Constructor

new AleoKeyProviderParams(params)

Create a new AleoKeyProviderParams object which implements the KeySearchParams interface. Users can optionally specify a url for the proverUri & verifierUri to fetch keys via HTTP from a remote resource as well as a unique cacheKey to store the keys in memory for future use. If no proverUri or verifierUri is specified, a cachekey must be provided.
Parameters:
NameTypeDescription
paramsAleoKeyProviderInitParamsOptional search parameters

Classes

AleoKeyProviderParams
\ No newline at end of file diff --git a/sdk/docs/AleoKeyProviderParams_AleoKeyProviderParams.html b/sdk/docs/AleoKeyProviderParams_AleoKeyProviderParams.html new file mode 100644 index 000000000..01c07083e --- /dev/null +++ b/sdk/docs/AleoKeyProviderParams_AleoKeyProviderParams.html @@ -0,0 +1,3 @@ +Class: AleoKeyProviderParams
On this page

AleoKeyProviderParams# AleoKeyProviderParams

new AleoKeyProviderParams(params)

Create a new AleoKeyProviderParams object which implements the KeySearchParams interface. Users can optionally specify a url for the proverUri & verifierUri to fetch keys via HTTP from a remote resource as well as a unique cacheKey to store the keys in memory for future use. If no proverUri or verifierUri is specified, a cachekey must be provided.
Parameters:
NameTypeDescription
paramsAleoKeyProviderInitParamsOptional search parameters
\ No newline at end of file diff --git a/sdk/docs/AleoNetworkClient.html b/sdk/docs/AleoNetworkClient.html index d98259076..0e8b47e7a 100644 --- a/sdk/docs/AleoNetworkClient.html +++ b/sdk/docs/AleoNetworkClient.html @@ -1,31 +1,167 @@ -Class: AleoNetworkClient
On this page

AleoNetworkClient

Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes. The methods provided in this class provide information on the Aleo Blockchain

Constructor

new AleoNetworkClient(host)

Parameters:
NameTypeDescription
hoststring
Example
// Connection to a local node
-let local_connection = new AleoNetworkClient("http://localhost:3030");
+Class: AleoNetworkClient
On this page

AleoNetworkClient

Client library that encapsulates REST calls to publicly exposed endpoints of Aleo nodes. The methods provided in this allow users to query public information from the Aleo blockchain and submit transactions to the network.

Constructor

new AleoNetworkClient(host)

Parameters:
NameTypeDescription
hoststring
Example
// Connection to a local node
+const localNetworkClient = new AleoNetworkClient("http://localhost:3030");
 
 // Connection to a public beacon node
-let public_connection = new AleoNetworkClient("https://api.explorer.aleo.org/v1");

Classes

AleoNetworkClient

Methods

(async) findUnspentRecords()

Attempts to find unspent records in the Aleo blockchain for a specified private key
Example
// Find all unspent records
+const publicnetworkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");

Methods

(async) findUnspentRecords(startHeight, endHeight, privateKey, amounts, maxMicrocredits, nonces)

Attempts to find unspent records in the Aleo blockchain for a specified private key.
Parameters:
NameTypeDescription
startHeightnumberThe height at which to start searching for unspent records
endHeightnumberThe height at which to stop searching for unspent records
privateKeystring | PrivateKeyThe private key to use to find unspent records
amountsArray.<number>The amounts (in microcredits) to search for (eg. [100, 200, 3000])
maxMicrocreditsnumberThe maximum number of microcredits to search for
noncesArray.<string>The nonces of already found records to exclude from the search
Example
// Find all unspent records
 const privateKey = "[PRIVATE_KEY]";
-let records = connection.findUnspentRecords(0, undefined, privateKey);
+const records = networkClient.findUnspentRecords(0, undefined, privateKey);
 
 // Find specific amounts
 const startHeight = 500000;
 const amounts = [600000, 1000000];
-let records = connection.findUnspentRecords(startHeight, undefined, privateKey, amounts);
+const records = networkClient.findUnspentRecords(startHeight, undefined, privateKey, amounts);
 
 // Find specific amounts with a maximum number of cumulative microcredits
 const maxMicrocredits = 100000;
-let records = connection.findUnspentRecords(startHeight, undefined, privateKey, undefined, maxMicrocredits);

(async) findUnspentRecords(startHeight, endHeight, privateKey, amounts, maxMicrocredits) → {Promise.<(Array.<RecordPlaintext>|Error)>}

Attempts to find unspent records in the Aleo blockchain for a specified private key
Parameters:
NameTypeDescription
startHeightnumber
endHeightnumber | undefined
privateKeystring | undefined
amountsArray | undefined
maxMicrocreditsnumber | undefined
Returns:
Type: 
Promise.<(Array.<RecordPlaintext>|Error)>
Example
// Find all unspent records
+const records = networkClient.findUnspentRecords(startHeight, undefined, privateKey, undefined, maxMicrocredits);

(async) findUnspentRecords(startHeight, endHeight, privateKey, amounts, maxMicrocredits, nonces) → {Promise.<Array.<RecordPlaintext>>}

Attempts to find unspent records in the Aleo blockchain for a specified private key.
Parameters:
NameTypeDescription
startHeightnumberThe height at which to start searching for unspent records
endHeightnumberThe height at which to stop searching for unspent records
privateKeystring | PrivateKeyThe private key to use to find unspent records
amountsArray.<number>The amounts (in microcredits) to search for (eg. [100, 200, 3000])
maxMicrocreditsnumberThe maximum number of microcredits to search for
noncesArray.<string>The nonces of already found records to exclude from the search
Returns:
Type: 
Promise.<Array.<RecordPlaintext>>
Example
// Find all unspent records
 const privateKey = "[PRIVATE_KEY]";
-let records = connection.findUnspentRecords(0, undefined, privateKey);
+const records = networkClient.findUnspentRecords(0, undefined, privateKey);
 
 // Find specific amounts
 const startHeight = 500000;
 const amounts = [600000, 1000000];
-let records = connection.findUnspentRecords(startHeight, undefined, privateKey, amounts);
+const records = networkClient.findUnspentRecords(startHeight, undefined, privateKey, amounts);
 
 // Find specific amounts with a maximum number of cumulative microcredits
 const maxMicrocredits = 100000;
-let records = connection.findUnspentRecords(startHeight, undefined, privateKey, undefined, maxMicrocredits);

getAccount()

Return the Aleo account used in the node connection
Example
let account = connection.getAccount();

getAccount() → {Account|undefined}

Return the Aleo account used in the node connection
Returns:
Type: 
Account | undefined
Example
let account = connection.getAccount();

(async) getBlock(height)

Returns the block contents of the block at the specified block height
Parameters:
NameTypeDescription
heightnumber
Example
let block = connection.getBlock(1234);

(async) getBlock(height) → {Promise.<(Block|Error)>}

Returns the block contents of the block at the specified block height
Parameters:
NameTypeDescription
heightnumber
Returns:
Type: 
Promise.<(Block|Error)>
Example
let block = connection.getBlock(1234);

(async) getBlockRange(start, end)

Returns a range of blocks between the specified block heights
Parameters:
NameTypeDescription
startnumber
endnumber
Example
let blockRange = connection.getBlockRange(2050, 2100);

(async) getBlockRange(start, end) → {Promise.<(Array.<Block>|Error)>}

Returns a range of blocks between the specified block heights
Parameters:
NameTypeDescription
startnumber
endnumber
Returns:
Type: 
Promise.<(Array.<Block>|Error)>
Example
let blockRange = connection.getBlockRange(2050, 2100);

(async) getLatestBlock()

Returns the block contents of the latest block
Example
let latestHeight = connection.getLatestBlock();

(async) getLatestBlock() → {Promise.<(Block|Error)>}

Returns the block contents of the latest block
Returns:
Type: 
Promise.<(Block|Error)>
Example
let latestHeight = connection.getLatestBlock();

(async) getLatestHash()

Returns the hash of the last published block
Example
let latestHash = connection.getLatestHash();

(async) getLatestHash() → {Promise.<(string|Error)>}

Returns the hash of the last published block
Returns:
Type: 
Promise.<(string|Error)>
Example
let latestHash = connection.getLatestHash();

(async) getLatestHeight()

Returns the latest block height
Example
let latestHeight = connection.getLatestHeight();

(async) getLatestHeight() → {Promise.<(number|Error)>}

Returns the latest block height
Returns:
Type: 
Promise.<(number|Error)>
Example
let latestHeight = connection.getLatestHeight();

(async) getProgram(programId)

Returns the source code of a program
Parameters:
NameTypeDescription
programIdstring
Example
let program = connection.getProgram("foo.aleo");

(async) getProgram(programId) → {Promise.<(string|Error)>}

Returns the source code of a program
Parameters:
NameTypeDescription
programIdstring
Returns:
Type: 
Promise.<(string|Error)>
Example
let program = connection.getProgram("foo.aleo");

(async) getStateRoot()

Returns the latest state/merkle root of the Aleo blockchain
Example
let stateRoot = connection.getStateRoot();

(async) getStateRoot() → {Promise.<(string|Error)>}

Returns the latest state/merkle root of the Aleo blockchain
Returns:
Type: 
Promise.<(string|Error)>
Example
let stateRoot = connection.getStateRoot();

(async) getTransaction(id)

Returns a transaction by its unique identifier
Parameters:
NameTypeDescription
idstring
Example
let transaction = connection.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");

(async) getTransaction(id) → {Promise.<(Transaction|Error)>}

Returns a transaction by its unique identifier
Parameters:
NameTypeDescription
idstring
Returns:
Type: 
Promise.<(Transaction|Error)>
Example
let transaction = connection.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");

(async) getTransactions(height)

Returns the transactions present at the specified block height
Parameters:
NameTypeDescription
heightnumber
Example
let transactions = connection.getTransactions(654);

(async) getTransactions(height) → {Promise.<(Array.<Transaction>|Error)>}

Returns the transactions present at the specified block height
Parameters:
NameTypeDescription
heightnumber
Returns:
Type: 
Promise.<(Array.<Transaction>|Error)>
Example
let transactions = connection.getTransactions(654);

(async) getTransactionsInMempool()

Returns the transactions in the memory pool.
Example
let transactions = connection.getTransactionsInMempool();

(async) getTransactionsInMempool() → {Promise.<(Array.<Transaction>|Error)>}

Returns the transactions in the memory pool.
Returns:
Type: 
Promise.<(Array.<Transaction>|Error)>
Example
let transactions = connection.getTransactionsInMempool();

(async) getTransitionId()

Returns the transition id by its unique identifier
Example
let transition = connection.getTransitionId("2429232855236830926144356377868449890830704336664550203176918782554219952323field");

(async) getTransitionId(transition_id) → {Promise.<(Transition|Error)>}

Returns the transition id by its unique identifier
Parameters:
NameTypeDescription
transition_idstring
Returns:
Type: 
Promise.<(Transition|Error)>
Example
let transition = connection.getTransitionId("2429232855236830926144356377868449890830704336664550203176918782554219952323field");

setAccount(account)

Set an account
Parameters:
NameTypeDescription
accountAccount
Example
let account = new Account();
-connection.setAccount(account);

setAccount(account)

Set an account
Parameters:
NameTypeDescription
accountAccount
Example
let account = new Account();
-connection.setAccount(account);
Home
\ No newline at end of file +const records = networkClient.findUnspentRecords(startHeight, undefined, privateKey, undefined, maxMicrocredits);

getAccount()

Return the Aleo account used in the networkClient
Source
Example
const account = networkClient.getAccount();

getAccount() → {Account|undefined}

Return the Aleo account used in the networkClient
Source
Returns:
Type: 
Account | undefined
Example
const account = networkClient.getAccount();

(async) getBlock(height)

Returns the contents of the block at the specified block height.
Parameters:
NameTypeDescription
heightnumber
Source
Example
const block = networkClient.getBlock(1234);

(async) getBlock(height) → {Promise.<BlockJSON>}

Returns the contents of the block at the specified block height.
Parameters:
NameTypeDescription
heightnumber
Source
Returns:
Type: 
Promise.<BlockJSON>
Example
const block = networkClient.getBlock(1234);

(async) getBlockRange(start, end)

Returns a range of blocks between the specified block heights.
Parameters:
NameTypeDescription
startnumber
endnumber
Source
Example
const blockRange = networkClient.getBlockRange(2050, 2100);

(async) getBlockRange(start, end) → {Promise.<Array.<BlockJSON>>}

Returns a range of blocks between the specified block heights.
Parameters:
NameTypeDescription
startnumber
endnumber
Source
Returns:
Type: 
Promise.<Array.<BlockJSON>>
Example
const blockRange = networkClient.getBlockRange(2050, 2100);

(async) getDeploymentTransactionForProgram(program) → {TransactionJSON}

Returns the deployment transaction associated with a specified program.
Parameters:
NameTypeDescription
programProgram | string
Source
Returns:
Type: 
TransactionJSON

(async) getDeploymentTransactionForProgram(program) → {TransactionJSON}

Returns the deployment transaction associated with a specified program.
Parameters:
NameTypeDescription
programProgram | string
Source
Returns:
Type: 
TransactionJSON

(async) getDeploymentTransactionIDForProgram(program) → {TransactionJSON}

Returns the deployment transaction id associated with the specified program.
Parameters:
NameTypeDescription
programProgram | string
Source
Returns:
Type: 
TransactionJSON

(async) getDeploymentTransactionIDForProgram(program) → {TransactionJSON}

Returns the deployment transaction id associated with the specified program.
Parameters:
NameTypeDescription
programProgram | string
Source
Returns:
Type: 
TransactionJSON

(async) getDeploymentTransactioObjectnForProgram(program) → {TransactionJSON}

Returns the deployment transaction associated with a specified program as a wasm object.
Parameters:
NameTypeDescription
programProgram | string
Source
Returns:
Type: 
TransactionJSON

(async) getDeploymentTransactioObjectnForProgram(program) → {TransactionJSON}

Returns the deployment transaction associated with a specified program as a wasm object.
Parameters:
NameTypeDescription
programProgram | string
Source
Returns:
Type: 
TransactionJSON

(async) getLatestBlock()

Returns the contents of the latest block.
Source
Example
const latestHeight = networkClient.getLatestBlock();

(async) getLatestBlock() → {Promise.<BlockJSON>}

Returns the contents of the latest block.
Source
Returns:
Type: 
Promise.<BlockJSON>
Example
const latestHeight = networkClient.getLatestBlock();

(async) getLatestCommittee() → {Promise.<object>}

Returns the latest committee.
Source
Returns:
A javascript object containing the latest committee
Type: 
Promise.<object>

(async) getLatestCommittee() → {Promise.<object>}

Returns the latest committee.
Source
Returns:
A javascript object containing the latest committee
Type: 
Promise.<object>

(async) getLatestHeight()

Returns the latest block height.
Source
Example
const latestHeight = networkClient.getLatestHeight();

(async) getLatestHeight() → {Promise.<number>}

Returns the latest block height.
Source
Returns:
Type: 
Promise.<number>
Example
const latestHeight = networkClient.getLatestHeight();

(async) getProgram(programId) → {Promise.<string>}

Returns the source code of a program given a program ID.
Parameters:
NameTypeDescription
programIdstringThe program ID of a program deployed to the Aleo Network
Source
Returns:
Source code of the program
Type: 
Promise.<string>
Example
const program = networkClient.getProgram("hello_hello.aleo");
+const expectedSource = "program hello_hello.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n"
+assert.equal(program, expectedSource);

(async) getProgram(programId) → {Promise.<string>}

Returns the source code of a program given a program ID.
Parameters:
NameTypeDescription
programIdstringThe program ID of a program deployed to the Aleo Network
Source
Returns:
Source code of the program
Type: 
Promise.<string>
Example
const program = networkClient.getProgram("hello_hello.aleo");
+const expectedSource = "program hello_hello.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n"
+assert.equal(program, expectedSource);

(async) getProgramImportNames(inputProgram) → {Array.<string>}

Get a list of the program names that a program imports.
Parameters:
NameTypeDescription
inputProgramProgram | stringThe program id or program source code to get the imports of
Source
Returns:
- The list of program names that the program imports
Type: 
Array.<string>
Example
const programImportsNames = networkClient.getProgramImports("double_test.aleo");
+const expectedImportsNames = ["multiply_test.aleo"];
+assert.deepStrictEqual(programImportsNames, expectedImportsNames);

(async) getProgramImportNames(inputProgram) → {Array.<string>}

Get a list of the program names that a program imports.
Parameters:
NameTypeDescription
inputProgramProgram | stringThe program id or program source code to get the imports of
Source
Returns:
- The list of program names that the program imports
Type: 
Array.<string>
Example
const programImportsNames = networkClient.getProgramImports("double_test.aleo");
+const expectedImportsNames = ["multiply_test.aleo"];
+assert.deepStrictEqual(programImportsNames, expectedImportsNames);

(async) getProgramImports(inputProgram) → {Promise.<ProgramImports>}

Returns an object containing the source code of a program and the source code of all programs it imports
Parameters:
NameTypeDescription
inputProgramProgram | stringThe program ID or program source code of a program deployed to the Aleo Network
Source
Returns:
Object of the form { "program_id": "program_source", .. } containing program id & source code for all program imports
Type: 
Promise.<ProgramImports>
Example
const double_test_source = "import multiply_test.aleo;\n\nprogram double_test.aleo;\n\nfunction double_it:\n    input r0 as u32.private;\n    call multiply_test.aleo/multiply 2u32 r0 into r1;\n    output r1 as u32.private;\n"
+const double_test = Program.fromString(double_test_source);
+const expectedImports = {
+    "multiply_test.aleo": "program multiply_test.aleo;\n\nfunction multiply:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    mul r0 r1 into r2;\n    output r2 as u32.private;\n"
+}
+
+// Imports can be fetched using the program ID, source code, or program object
+let programImports = await networkClient.getProgramImports("double_test.aleo");
+assert.deepStrictEqual(programImports, expectedImports);
+
+// Using the program source code
+programImports = await networkClient.getProgramImports(double_test_source);
+assert.deepStrictEqual(programImports, expectedImports);
+
+// Using the program object
+programImports = await networkClient.getProgramImports(double_test);
+assert.deepStrictEqual(programImports, expectedImports);

(async) getProgramImports(inputProgram) → {Promise.<ProgramImports>}

Returns an object containing the source code of a program and the source code of all programs it imports
Parameters:
NameTypeDescription
inputProgramProgram | stringThe program ID or program source code of a program deployed to the Aleo Network
Source
Returns:
Object of the form { "program_id": "program_source", .. } containing program id & source code for all program imports
Type: 
Promise.<ProgramImports>
Example
const double_test_source = "import multiply_test.aleo;\n\nprogram double_test.aleo;\n\nfunction double_it:\n    input r0 as u32.private;\n    call multiply_test.aleo/multiply 2u32 r0 into r1;\n    output r1 as u32.private;\n"
+const double_test = Program.fromString(double_test_source);
+const expectedImports = {
+    "multiply_test.aleo": "program multiply_test.aleo;\n\nfunction multiply:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    mul r0 r1 into r2;\n    output r2 as u32.private;\n"
+}
+
+// Imports can be fetched using the program ID, source code, or program object
+let programImports = await networkClient.getProgramImports("double_test.aleo");
+assert.deepStrictEqual(programImports, expectedImports);
+
+// Using the program source code
+programImports = await networkClient.getProgramImports(double_test_source);
+assert.deepStrictEqual(programImports, expectedImports);
+
+// Using the program object
+programImports = await networkClient.getProgramImports(double_test);
+assert.deepStrictEqual(programImports, expectedImports);

(async) getProgramMappingNames(programId)

Returns the names of the mappings of a program.
Parameters:
NameTypeDescription
programIdstringThe program ID to get the mappings of (e.g. "credits.aleo")
Source
Example
const mappings = networkClient.getProgramMappingNames("credits.aleo");
+const expectedMappings = ["account"];
+assert.deepStrictEqual(mappings, expectedMappings);

(async) getProgramMappingNames(programId) → {Promise.<Array.<string>>}

Returns the names of the mappings of a program.
Parameters:
NameTypeDescription
programIdstringThe program ID to get the mappings of (e.g. "credits.aleo")
Source
Returns:
Type: 
Promise.<Array.<string>>
Example
const mappings = networkClient.getProgramMappingNames("credits.aleo");
+const expectedMappings = ["account"];
+assert.deepStrictEqual(mappings, expectedMappings);

(async) getProgramMappingPlaintext(programId, mappingName, key) → {Promise.<string>}

Returns the value of a mapping as a wasm Plaintext object. Returning an object in this format allows it to be converted to a Js type and for its internal members to be inspected if it's a struct or array.
Parameters:
NameTypeDescription
programIdstringThe program ID to get the mapping value of (e.g. "credits.aleo")
mappingNamestringThe name of the mapping to get the value of (e.g. "account")
keystring | PlaintextThe key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
Source
Returns:
String representation of the value of the mapping
Type: 
Promise.<string>
Example
// Get the bond state as an account.
+const unbondedState = networkClient.getMappingPlaintext("credits.aleo", "bonded", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px");
+
+// Get the two members of the object individually.
+const validator = unbondedState.getMember("validator");
+const microcredits = unbondedState.getMember("microcredits");
+
+// Ensure the expected values are correct.
+assert.equal(validator, "aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd");
+assert.equal(microcredits, BigInt("9007199254740991"));
+
+// Get a JS object representation of the unbonded state.
+const unbondedStateObject = unbondedState.toObject();
+
+const expectedState = {
+    validator: "aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd",
+    microcredits: BigInt("9007199254740991")
+};
+assert.equal(unbondedState, expectedState);

(async) getProgramMappingPlaintext(programId, mappingName, key) → {Promise.<string>}

Returns the value of a mapping as a wasm Plaintext object. Returning an object in this format allows it to be converted to a Js type and for its internal members to be inspected if it's a struct or array.
Parameters:
NameTypeDescription
programIdstringThe program ID to get the mapping value of (e.g. "credits.aleo")
mappingNamestringThe name of the mapping to get the value of (e.g. "account")
keystring | PlaintextThe key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
Source
Returns:
String representation of the value of the mapping
Type: 
Promise.<string>
Example
// Get the bond state as an account.
+const unbondedState = networkClient.getMappingPlaintext("credits.aleo", "bonded", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px");
+
+// Get the two members of the object individually.
+const validator = unbondedState.getMember("validator");
+const microcredits = unbondedState.getMember("microcredits");
+
+// Ensure the expected values are correct.
+assert.equal(validator, "aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd");
+assert.equal(microcredits, BigInt("9007199254740991"));
+
+// Get a JS object representation of the unbonded state.
+const unbondedStateObject = unbondedState.toObject();
+
+const expectedState = {
+    validator: "aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd",
+    microcredits: BigInt("9007199254740991")
+};
+assert.equal(unbondedState, expectedState);

(async) getProgramMappingValue(programId, mappingName, key) → {Promise.<string>}

Returns the value of a program's mapping for a specific key.
Parameters:
NameTypeDescription
programIdstringThe program ID to get the mapping value of (e.g. "credits.aleo")
mappingNamestringThe name of the mapping to get the value of (e.g. "account")
keystring | PlaintextThe key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
Source
Returns:
String representation of the value of the mapping
Type: 
Promise.<string>
Example
// Get public balance of an account
+const mappingValue = networkClient.getMappingValue("credits.aleo", "account", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px");
+const expectedValue = "0u64";
+assert.equal(mappingValue, expectedValue);

(async) getProgramMappingValue(programId, mappingName, key) → {Promise.<string>}

Returns the value of a program's mapping for a specific key.
Parameters:
NameTypeDescription
programIdstringThe program ID to get the mapping value of (e.g. "credits.aleo")
mappingNamestringThe name of the mapping to get the value of (e.g. "account")
keystring | PlaintextThe key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
Source
Returns:
String representation of the value of the mapping
Type: 
Promise.<string>
Example
// Get public balance of an account
+const mappingValue = networkClient.getMappingValue("credits.aleo", "account", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px");
+const expectedValue = "0u64";
+assert.equal(mappingValue, expectedValue);

(async) getProgramObject(inputProgram) → {Promise.<Program>}

Returns a program object from a program ID or program source code.
Parameters:
NameTypeDescription
inputProgramstringThe program ID or program source code of a program deployed to the Aleo Network
Source
Returns:
Source code of the program
Type: 
Promise.<Program>
Example
const programID = "hello_hello.aleo";
+const programSource = "program hello_hello.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n"
+
+// Get program object from program ID or program source code
+const programObjectFromID = await networkClient.getProgramObject(programID);
+const programObjectFromSource = await networkClient.getProgramObject(programSource);
+
+// Both program objects should be equal
+assert.equal(programObjectFromID.to_string(), programObjectFromSource.to_string());

(async) getProgramObject(inputProgram) → {Promise.<Program>}

Returns a program object from a program ID or program source code.
Parameters:
NameTypeDescription
inputProgramstringThe program ID or program source code of a program deployed to the Aleo Network
Source
Returns:
Source code of the program
Type: 
Promise.<Program>
Example
const programID = "hello_hello.aleo";
+const programSource = "program hello_hello.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n"
+
+// Get program object from program ID or program source code
+const programObjectFromID = await networkClient.getProgramObject(programID);
+const programObjectFromSource = await networkClient.getProgramObject(programSource);
+
+// Both program objects should be equal
+assert.equal(programObjectFromID.to_string(), programObjectFromSource.to_string());

(async) getStateRoot()

Returns the latest state/merkle root of the Aleo blockchain.
Source
Example
const stateRoot = networkClient.getStateRoot();

(async) getStateRoot() → {Promise.<string>}

Returns the latest state/merkle root of the Aleo blockchain.
Source
Returns:
Type: 
Promise.<string>
Example
const stateRoot = networkClient.getStateRoot();

(async) getTransaction(id)

Returns a transaction by its unique identifier.
Parameters:
NameTypeDescription
idstring
Source
Example
const transaction = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");

(async) getTransaction(id) → {Promise.<TransactionJSON>}

Returns a transaction by its unique identifier.
Parameters:
NameTypeDescription
idstring
Source
Returns:
Type: 
Promise.<TransactionJSON>
Example
const transaction = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");

(async) getTransactionObject(transactionId)

Returns a transaction as a wasm object. Getting a transaction of this type will allow the ability for the inputs, outputs, and records to be searched for and displayed.
Parameters:
NameTypeDescription
transactionIdstring
Source
Examples
const transactionObject = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");
+// Get the transaction inputs as a JS array.
+const transactionOutputs = transactionObject.inputs(true);
+
+// Get the transaction outputs as a JS object.
+const transactionInputs = transactionObject.outputs(true);
+
+// Get any records generated in transitions in the transaction as a JS object.
+const records = transactionObject.records();
+
+// Get the transaction type.
+const transactionType = transactionObject.transactionType();
+assert.equal(transactionType, "Execute");
+
+// Get a JS representation of all inputs, outputs, and transaction metadata.
+const transactionSummary = transactionObject.summary();
const transaction = networkClient.getTransactionObject("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");

(async) getTransactionObject(transactionId) → {Promise.<Transaction>}

Returns a transaction as a wasm object. Getting a transaction of this type will allow the ability for the inputs, outputs, and records to be searched for and displayed.
Parameters:
NameTypeDescription
transactionIdstring
Source
Returns:
Type: 
Promise.<Transaction>
Examples
const transactionObject = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");
+// Get the transaction inputs as a JS array.
+const transactionOutputs = transactionObject.inputs(true);
+
+// Get the transaction outputs as a JS object.
+const transactionInputs = transactionObject.outputs(true);
+
+// Get any records generated in transitions in the transaction as a JS object.
+const records = transactionObject.records();
+
+// Get the transaction type.
+const transactionType = transactionObject.transactionType();
+assert.equal(transactionType, "Execute");
+
+// Get a JS representation of all inputs, outputs, and transaction metadata.
+const transactionSummary = transactionObject.summary();
const transaction = networkClient.getTransactionObject("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");

(async) getTransactionObjects(height)

Returns an array of transactions as wasm objects present at the specified block height.
Parameters:
NameTypeDescription
heightnumber
Source
Example
const transactions = networkClient.getTransactionObjects(654);
+
+let transaction_summaries = transactions.map(transaction => transaction.summary());

(async) getTransactionObjects(height) → {Promise.<Array.<Transaction>>}

Returns an array of transactions as wasm objects present at the specified block height.
Parameters:
NameTypeDescription
heightnumber
Source
Returns:
Type: 
Promise.<Array.<Transaction>>
Example
const transactions = networkClient.getTransactionObjects(654);
+
+let transaction_summaries = transactions.map(transaction => transaction.summary());

(async) getTransactionObjectsInMempool()

Returns the transactions in the memory pool as wasm objects.
Source
Example
const transactions = networkClient.getTransactionsInMempool();

(async) getTransactionObjectsInMempool() → {Promise.<Array.<Transaction>>}

Returns the transactions in the memory pool as wasm objects.
Source
Returns:
Type: 
Promise.<Array.<Transaction>>
Example
const transactions = networkClient.getTransactionsInMempool();

(async) getTransactions(height)

Returns the transactions present at the specified block height.
Parameters:
NameTypeDescription
heightnumber
Source
Example
const transactions = networkClient.getTransactions(654);

(async) getTransactions(height) → {Promise.<Array.<TransactionJSON>>}

Returns the transactions present at the specified block height.
Parameters:
NameTypeDescription
heightnumber
Source
Returns:
Type: 
Promise.<Array.<TransactionJSON>>
Example
const transactions = networkClient.getTransactions(654);

(async) getTransactionsInMempool()

Returns the transactions in the memory pool.
Source
Example
const transactions = networkClient.getTransactionsInMempool();

(async) getTransactionsInMempool() → {Promise.<Array.<TransactionJSON>>}

Returns the transactions in the memory pool.
Source
Returns:
Type: 
Promise.<Array.<TransactionJSON>>
Example
const transactions = networkClient.getTransactionsInMempool();

(async) getTransitionId(inputOrOutputID)

Returns the transition ID of the transition corresponding to the ID of the input or output.
Parameters:
NameTypeDescription
inputOrOutputIDstringID of the input or output.
Source
Example
const transitionId = networkClient.getTransitionId("2429232855236830926144356377868449890830704336664550203176918782554219952323field");

(async) getTransitionId(inputOrOutputID) → {Promise.<string>}

Returns the transition ID of the transition corresponding to the ID of the input or output.
Parameters:
NameTypeDescription
inputOrOutputIDstringID of the input or output.
Source
Returns:
Type: 
Promise.<string>
Example
const transitionId = networkClient.getTransitionId("2429232855236830926144356377868449890830704336664550203176918782554219952323field");

setAccount(account)

Set an account to use in networkClient calls
Parameters:
NameTypeDescription
accountAccount
Source
Example
const account = new Account();
+networkClient.setAccount(account);

setAccount(account)

Set an account to use in networkClient calls
Parameters:
NameTypeDescription
accountAccount
Source
Example
const account = new Account();
+networkClient.setAccount(account);

setHost(host, host)

Set a new host for the networkClient
Parameters:
NameTypeDescription
hoststringThe address of a node hosting the Aleo API
host
Source

setHost(host, host)

Set a new host for the networkClient
Parameters:
NameTypeDescription
hoststringThe address of a node hosting the Aleo API
host
Source

(async) submitSolution(solution)

Submit a solution to the Aleo network.
Parameters:
NameTypeDescription
solutionstringThe string representation of the solution desired to be submitted to the network.
Source

(async) submitSolution(solution) → {Promise.<string>}

Submit a solution to the Aleo network.
Parameters:
NameTypeDescription
solutionstringThe string representation of the solution desired to be submitted to the network.
Source
Returns:
Type: 
Promise.<string>

(async) submitTransaction(transaction) → {string}

Submit an execute or deployment transaction to the Aleo network.
Parameters:
NameTypeDescription
transactionTransaction | stringThe transaction to submit to the network
Source
Returns:
- The transaction id of the submitted transaction or the resulting error
Type: 
string

(async) submitTransaction(transaction) → {string}

Submit an execute or deployment transaction to the Aleo network.
Parameters:
NameTypeDescription
transactionTransaction | stringThe transaction to submit to the network
Source
Returns:
- The transaction id of the submitted transaction or the resulting error
Type: 
string
\ No newline at end of file diff --git a/sdk/docs/BlockHeightSearch.html b/sdk/docs/BlockHeightSearch.html new file mode 100644 index 000000000..d11d45bea --- /dev/null +++ b/sdk/docs/BlockHeightSearch.html @@ -0,0 +1,13 @@ +Class: BlockHeightSearch
On this page

BlockHeightSearch

BlockHeightSearch is a RecordSearchParams implementation that allows for searching for records within a given block height range.

Constructor

new BlockHeightSearch()

Example
// Create a new BlockHeightSearch
+const params = new BlockHeightSearch(89995, 99995);
+
+// Create a new NetworkRecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+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 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);
\ No newline at end of file diff --git a/sdk/docs/ExecuteOptions.html b/sdk/docs/ExecuteOptions.html new file mode 100644 index 000000000..560fae6e1 --- /dev/null +++ b/sdk/docs/ExecuteOptions.html @@ -0,0 +1,3 @@ +Interface: ExecuteOptions
On this page

ExecuteOptions

Represents the options for executing a transaction in the Aleo network. This interface is used to specify the parameters required for building and submitting an execution transaction.
Properties
NameTypeAttributesDescription
programNamestringThe name of the program containing the function to be executed.
functionNamestringThe name of the function to execute within the program.
feenumberThe fee to be paid for the transaction.
privateFeebooleanIf true, uses a private record to pay the fee; otherwise, uses the account's public credit balance.
inputsArray.<string>The inputs to the function being executed.
recordSearchParamsRecordSearchParams<optional>
Optional parameters for searching for a record to pay the execution transaction fee.
keySearchParamsKeySearchParams<optional>
Optional parameters for finding the matching proving & verifying keys for the function.
feeRecordstring | RecordPlaintext<optional>
Optional fee record to use for the transaction.
provingKeyProvingKey<optional>
Optional proving key to use for the transaction.
verifyingKeyVerifyingKey<optional>
Optional verifying key to use for the transaction.
privateKeyPrivateKey<optional>
Optional private key to use for the transaction.
offlineQueryOfflineQuery<optional>
Optional offline query if creating transactions in an offline environment.
programstring | Program<optional>
Optional program source code to use for the transaction.
importsProgramImports<optional>
Optional programs that the program being executed imports.
\ No newline at end of file diff --git a/sdk/docs/FunctionKeyProvider.html b/sdk/docs/FunctionKeyProvider.html new file mode 100644 index 000000000..8c9ee36ec --- /dev/null +++ b/sdk/docs/FunctionKeyProvider.html @@ -0,0 +1,69 @@ +Interface: FunctionKeyProvider
On this page

FunctionKeyProvider

KeyProvider interface. Enables the retrieval of public proving and verifying keys for Aleo Programs.

Members

bondPublicKeys :Promise.<FunctionKeyPair>

Get bond_public function keys from the credits.aleo program
Type:
  • Promise.<FunctionKeyPair>

bondValidatorKeys :Promise.<FunctionKeyPair>

Get bond_validator function keys from the credits.aleo program
Type:
  • Promise.<FunctionKeyPair>

cacheKeys :void

Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.
Type:
  • void

claimUnbondPublicKeys :Promise.<FunctionKeyPair>

Get unbond_public function keys from the credits.aleo program
Type:
  • Promise.<FunctionKeyPair>

feePrivateKeys :Promise.<FunctionKeyPair>

Get fee_private function keys from the credits.aleo program
Type:
  • Promise.<FunctionKeyPair>

feePublicKeys :Promise.<FunctionKeyPair>

Get fee_public function keys from the credits.aleo program
Type:
  • Promise.<FunctionKeyPair>

functionKeys :Promise.<FunctionKeyPair>

Get arbitrary function keys from a provider
Type:
  • Promise.<FunctionKeyPair>
Example
// Create a search object which implements the KeySearchParams interface
+class IndexDbSearch implements KeySearchParams {
+    db: string
+    keyId: string
+    constructor(params: {db: string, keyId: string}) {
+        this.db = params.db;
+        this.keyId = params.keyId;
+    }
+}
+
+// Create a new object which implements the KeyProvider interface
+class IndexDbKeyProvider implements FunctionKeyProvider {
+    async functionKeys(params: KeySearchParams): Promise<FunctionKeyPair> {
+        return new Promise((resolve, reject) => {
+            const request = indexedDB.open(params.db, 1);
+
+            request.onupgradeneeded = function(e) {
+                const db = e.target.result;
+                if (!db.objectStoreNames.contains('keys')) {
+                    db.createObjectStore('keys', { keyPath: 'id' });
+                }
+            };
+
+            request.onsuccess = function(e) {
+                const db = e.target.result;
+                const transaction = db.transaction(["keys"], "readonly");
+                const store = transaction.objectStore("keys");
+                const request = store.get(params.keyId);
+                request.onsuccess = function(e) {
+                    if (request.result) {
+                        resolve(request.result as FunctionKeyPair);
+                    } else {
+                        reject(new Error("Key not found"));
+                    }
+                };
+                request.onerror = function(e) { reject(new Error("Error fetching key")); };
+            };
+
+            request.onerror = function(e) { reject(new Error("Error opening database")); };
+        });
+    }
+
+    // implement the other methods...
+}
+
+
+const keyProvider = new AleoKeyProvider();
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for value transfers
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+
+// Keys can also be fetched manually
+const searchParams = new IndexDbSearch({db: "keys", keyId: "credits.aleo:transferPrivate"});
+const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.functionKeys(searchParams);

joinKeys :Promise.<FunctionKeyPair>

Get join function keys from the credits.aleo program
Type:
  • Promise.<FunctionKeyPair>

splitKeys :Promise.<FunctionKeyPair>

Get split function keys from the credits.aleo program
Type:
  • Promise.<FunctionKeyPair>

transferKeys :Promise.<FunctionKeyPair>

Get keys for a variant of the transfer function from the credits.aleo program
Type:
  • Promise.<FunctionKeyPair>
Example
// Create a new object which implements the KeyProvider interface
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for value transfers
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+
+// Keys can also be fetched manually
+const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");

unBondPublicKeys :Promise.<FunctionKeyPair>

Get unbond_public function keys from the credits.aleo program
Type:
  • Promise.<FunctionKeyPair>
\ No newline at end of file diff --git a/sdk/docs/KeySearchParams.html b/sdk/docs/KeySearchParams.html new file mode 100644 index 000000000..e3d40774c --- /dev/null +++ b/sdk/docs/KeySearchParams.html @@ -0,0 +1,3 @@ +Interface: KeySearchParams
On this page

KeySearchParams

Interface for record search parameters. This allows for arbitrary search parameters to be passed to record provider implementations.
\ No newline at end of file diff --git a/sdk/docs/NetworkRecordProvider.html b/sdk/docs/NetworkRecordProvider.html new file mode 100644 index 000000000..f17cd9ce3 --- /dev/null +++ b/sdk/docs/NetworkRecordProvider.html @@ -0,0 +1,63 @@ +Class: NetworkRecordProvider
On this page

NetworkRecordProvider

A record provider implementation that uses the official Aleo API to find records for usage in program execution and deployment, wallet functionality, and other use cases.

Constructor

new NetworkRecordProvider()

Methods

(async) findCreditsRecord(microcredits, unspent, nonces, searchParameters) → {Promise.<RecordPlaintext>}

Find a credit record with a given number of microcredits by via the official Aleo API
Parameters:
NameTypeDescription
microcreditsnumberThe number of microcredits to search for
unspentbooleanWhether or not the record is unspent
noncesArray.<string>Nonces of records already found so that they are not found again
searchParametersRecordSearchParamsAdditional parameters to search for
Returns:
The record if found, otherwise an error
Type: 
Promise.<RecordPlaintext>
Example
// Create a new NetworkRecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+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, []);
+
+// 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()]);
+
+// 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
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);

(async) findCreditsRecord(microcredits, unspent, nonces, searchParameters) → {Promise.<RecordPlaintext>}

Find a credit record with a given number of microcredits by via the official Aleo API
Parameters:
NameTypeDescription
microcreditsnumberThe number of microcredits to search for
unspentbooleanWhether or not the record is unspent
noncesArray.<string>Nonces of records already found so that they are not found again
searchParametersRecordSearchParamsAdditional parameters to search for
Returns:
The record if found, otherwise an error
Type: 
Promise.<RecordPlaintext>
Example
// Create a new NetworkRecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+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, []);
+
+// 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()]);
+
+// 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
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);

(async) findCreditsRecords(microcredits, unspent, nonces, searchParameters) → {Promise.<RecordPlaintext>}

Find a list of credit records with a given number of microcredits by via the official Aleo API
Parameters:
NameTypeDescription
microcreditsArray.<number>The number of microcredits to search for
unspentbooleanWhether or not the record is unspent
noncesArray.<string>Nonces of records already found so that they are not found again
searchParametersRecordSearchParamsAdditional parameters to search for
Returns:
The record if found, otherwise an error
Type: 
Promise.<RecordPlaintext>
Example
// Create a new NetworkRecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+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, []);
+
+// 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()]);
+
+// 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
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);

(async) findCreditsRecords(microcredits, unspent, nonces, searchParameters) → {Promise.<RecordPlaintext>}

Find a list of credit records with a given number of microcredits by via the official Aleo API
Parameters:
NameTypeDescription
microcreditsArray.<number>The number of microcredits to search for
unspentbooleanWhether or not the record is unspent
noncesArray.<string>Nonces of records already found so that they are not found again
searchParametersRecordSearchParamsAdditional parameters to search for
Returns:
The record if found, otherwise an error
Type: 
Promise.<RecordPlaintext>
Example
// Create a new NetworkRecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+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, []);
+
+// 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()]);
+
+// 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
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);

(async) findRecord()

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

(async) findRecord(unspent, noncesopt, searchParametersopt) → {Promise.<RecordPlaintext>}

Find an arbitrary record. WARNING: This function is not implemented yet and will throw an error.
Parameters:
NameTypeAttributesDescription
unspentboolean
noncesArray<optional>
searchParametersRecordSearchParams<optional>
Returns:
Type: 
Promise.<RecordPlaintext>

(async) findRecords()

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

(async) findRecords(unspent, noncesopt, searchParametersopt) → {Promise.<Array>}

Find multiple arbitrary records. WARNING: This function is not implemented yet and will throw an error.
Parameters:
NameTypeAttributesDescription
unspentboolean
noncesArray<optional>
searchParametersRecordSearchParams<optional>
Returns:
Type: 
Promise.<Array>

setAccount(account)

Set the account used to search for records
Parameters:
NameTypeDescription
accountAccountThe account to use for searching for records

setAccount(account)

Set the account used to search for records
Parameters:
NameTypeDescription
accountAccountThe account to use for searching for records
\ No newline at end of file diff --git a/sdk/docs/OfflineKeyProvider.html b/sdk/docs/OfflineKeyProvider.html new file mode 100644 index 000000000..64f6c9704 --- /dev/null +++ b/sdk/docs/OfflineKeyProvider.html @@ -0,0 +1,100 @@ +Class: OfflineKeyProvider
On this page

OfflineKeyProvider

A key provider meant for building transactions offline on devices such as hardware wallets. This key provider is not able to contact the internet for key material and instead relies on the user to insert Aleo function proving & verifying keys from local storage prior to usage.

Constructor

new OfflineKeyProvider()

Example
// Create an offline program manager
+const programManager = new ProgramManager();
+
+// Create a temporary account for the execution of the program
+const account = new Account();
+programManager.setAccount(account);
+
+// Create the proving keys from the key bytes on the offline machine
+console.log("Creating proving keys from local key files");
+const program = "program hello_hello.aleo; function hello: input r0 as u32.public; input r1 as u32.private; add r0 r1 into r2; output r2 as u32.private;";
+const myFunctionProver = await getLocalKey("/path/to/my/function/hello_hello.prover");
+const myFunctionVerifier = await getLocalKey("/path/to/my/function/hello_hello.verifier");
+const feePublicProvingKeyBytes = await getLocalKey("/path/to/credits.aleo/feePublic.prover");
+
+myFunctionProvingKey = ProvingKey.fromBytes(myFunctionProver);
+myFunctionVerifyingKey = VerifyingKey.fromBytes(myFunctionVerifier);
+const feePublicProvingKey = ProvingKey.fromBytes(feePublicKeyBytes);
+
+// Create an offline key provider
+console.log("Creating offline key provider");
+const offlineKeyProvider = new OfflineKeyProvider();
+
+// Cache the keys
+// Cache the proving and verifying keys for the custom hello function
+OfflineKeyProvider.cacheKeys("hello_hello.aleo/hello", myFunctionProvingKey, myFunctionVerifyingKey);
+
+// Cache the proving key for the fee_public function (the verifying key is automatically cached)
+OfflineKeyProvider.insertFeePublicKey(feePublicProvingKey);
+
+// Create an offline query using the latest state root in order to create the inclusion proof
+const offlineQuery = new OfflineQuery("latestStateRoot");
+
+// Insert the key provider into the program manager
+programManager.setKeyProvider(offlineKeyProvider);
+
+// Create the offline search params
+const offlineSearchParams = new OfflineSearchParams("hello_hello.aleo/hello");
+
+// Create the offline transaction
+const offlineExecuteTx = <Transaction>await this.buildExecutionTransaction("hello_hello.aleo", "hello", 1, false, ["5u32", "5u32"], undefined, offlineSearchParams, undefined, undefined, undefined, undefined, offlineQuery, program);
+
+// Broadcast the transaction later on a machine with internet access
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const txId = await networkClient.broadcastTransaction(offlineExecuteTx);

Methods

bondPublicKeys() → {Promise.<FunctionKeyPair>}

Get bond_public function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the bond_public function
Type: 
Promise.<FunctionKeyPair>

bondPublicKeys() → {Promise.<FunctionKeyPair>}

Get bond_public function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the bond_public function
Type: 
Promise.<FunctionKeyPair>

bondValidatorKeys() → {Promise.<FunctionKeyPair>}

Get bond_validator function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the bond_public function
Type: 
Promise.<FunctionKeyPair>

bondValidatorKeys() → {Promise.<FunctionKeyPair>}

Get bond_validator function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the bond_public function
Type: 
Promise.<FunctionKeyPair>

cacheKeys(keyId, keys)

Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.
Parameters:
NameTypeDescription
keyIdstringaccess key for the cache
keysFunctionKeyPairkeys to cache

cacheKeys(keyId, keys) → {void}

Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.
Parameters:
NameTypeDescription
keyIdstringaccess key for the cache
keysFunctionKeyPairkeys to cache
Returns:
Type: 
void

claimUnbondPublicKeys() → {Promise.<FunctionKeyPair>}

Get unbond_public function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the unbond_public function
Type: 
Promise.<FunctionKeyPair>

claimUnbondPublicKeys() → {Promise.<FunctionKeyPair>}

Get unbond_public function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the unbond_public function
Type: 
Promise.<FunctionKeyPair>

feePrivateKeys() → {Promise.<FunctionKeyPair>}

Get fee_private function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

feePrivateKeys() → {Promise.<FunctionKeyPair>}

Get fee_private function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

feePublicKeys() → {Promise.<FunctionKeyPair>}

Get fee_public function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

feePublicKeys() → {Promise.<FunctionKeyPair>}

Get fee_public function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

functionKeys(params) → {Promise.<FunctionKeyPair>}

Get arbitrary function key from the offline key provider cache.
Parameters:
NameTypeDescription
paramsKeySearchParams | undefinedOptional search parameters for the key provider
Returns:
Proving and verifying keys for the specified program
Type: 
Promise.<FunctionKeyPair>
Example
/// First cache the keys from local offline resources
+const offlineKeyProvider = new OfflineKeyProvider();
+const myFunctionVerifyingKey = VerifyingKey.fromString("verifier...");
+const myFunctionProvingKeyBytes = await readBinaryFile('./resources/myfunction.prover');
+const myFunctionProvingKey = ProvingKey.fromBytes(myFunctionProvingKeyBytes);
+
+/// Cache the keys for future use with a memorable locator
+offlineKeyProvider.cacheKeys("myprogram.aleo/myfunction", [myFunctionProvingKey, myFunctionVerifyingKey]);
+
+/// When they're needed, retrieve the keys from the cache
+
+/// First create a search parameter object with the same locator used to cache the keys
+const keyParams = new OfflineSearchParams("myprogram.aleo/myfunction");
+
+/// Then retrieve the keys
+const [myFunctionProver, myFunctionVerifier] = await offlineKeyProvider.functionKeys(keyParams);

functionKeys(params) → {Promise.<FunctionKeyPair>}

Get arbitrary function key from the offline key provider cache.
Parameters:
NameTypeDescription
paramsKeySearchParams | undefinedOptional search parameters for the key provider
Returns:
Proving and verifying keys for the specified program
Type: 
Promise.<FunctionKeyPair>
Example
/// First cache the keys from local offline resources
+const offlineKeyProvider = new OfflineKeyProvider();
+const myFunctionVerifyingKey = VerifyingKey.fromString("verifier...");
+const myFunctionProvingKeyBytes = await readBinaryFile('./resources/myfunction.prover');
+const myFunctionProvingKey = ProvingKey.fromBytes(myFunctionProvingKeyBytes);
+
+/// Cache the keys for future use with a memorable locator
+offlineKeyProvider.cacheKeys("myprogram.aleo/myfunction", [myFunctionProvingKey, myFunctionVerifyingKey]);
+
+/// When they're needed, retrieve the keys from the cache
+
+/// First create a search parameter object with the same locator used to cache the keys
+const keyParams = new OfflineSearchParams("myprogram.aleo/myfunction");
+
+/// Then retrieve the keys
+const [myFunctionProver, myFunctionVerifier] = await offlineKeyProvider.functionKeys(keyParams);

insertBondPublicKeys(provingKey)

Insert the proving and verifying keys for the bond_public function 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 bond_public before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertBondPublicKeys(provingKey)

Insert the proving and verifying keys for the bond_public function 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 bond_public before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertClaimUnbondPublicKeys(provingKey)

Insert the proving and verifying keys for the claim_unbond_public function 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 claim_unbond_public before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertClaimUnbondPublicKeys(provingKey)

Insert the proving and verifying keys for the claim_unbond_public function 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 claim_unbond_public before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertFeePrivateKeys(provingKey)

Insert the proving and verifying keys for the fee_private function 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 fee_private before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertFeePrivateKeys(provingKey)

Insert the proving and verifying keys for the fee_private function 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 fee_private before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertFeePublicKeys(provingKey)

Insert the proving and verifying keys for the fee_public function 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 fee_public before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertFeePublicKeys(provingKey)

Insert the proving and verifying keys for the fee_public function 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 fee_public before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertJoinKeys(provingKey)

Insert the proving and verifying keys for the join function 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 join before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertJoinKeys(provingKey)

Insert the proving and verifying keys for the join function 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 join before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertSetValidatorStateKeys(provingKey)

Insert the proving and verifying keys for the set_validator_state function 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 set_validator_state before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertSetValidatorStateKeys(provingKey)

Insert the proving and verifying keys for the set_validator_state function 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 set_validator_state before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertSplitKeys(provingKey)

Insert the proving and verifying keys for the split function 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 split before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertSplitKeys(provingKey)

Insert the proving and verifying keys for the split function 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 split before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertTransferPrivateKeys(provingKey)

Insert the proving and verifying keys for the transfer_private function 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 transfer_private before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertTransferPrivateKeys(provingKey)

Insert the proving and verifying keys for the transfer_private function 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 transfer_private before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertTransferPrivateToPublicKeys(provingKey)

Insert the proving and verifying keys for the transfer_private_to_public function 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 transfer_private_to_public before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertTransferPrivateToPublicKeys(provingKey)

Insert the proving and verifying keys for the transfer_private_to_public function 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 transfer_private_to_public before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertTransferPublicKeys(provingKey)

Insert the proving and verifying keys for the transfer_public function 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 transfer_public before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertTransferPublicKeys(provingKey)

Insert the proving and verifying keys for the transfer_public function 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 transfer_public before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertTransferPublicToPrivateKeys(provingKey)

Insert the proving and verifying keys for the transfer_public_to_private function 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 transfer_public_to_private before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

insertTransferPublicToPrivateKeys(provingKey)

Insert the proving and verifying keys for the transfer_public_to_private function 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 transfer_public_to_private before inserting them into the cache.
Parameters:
NameTypeDescription
provingKey

joinKeys() → {Promise.<FunctionKeyPair>}

Get join function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

joinKeys() → {Promise.<FunctionKeyPair>}

Get join function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

splitKeys() → {Promise.<FunctionKeyPair>}

Get split function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

splitKeys() → {Promise.<FunctionKeyPair>}

Get split function keys from the credits.aleo program. The keys must be cached prior to calling this method for it to work.
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

transferKeys(visibility) → {Promise.<FunctionKeyPair>}

Get keys for a variant of the transfer function from the credits.aleo program.
Parameters:
NameTypeDescription
visibilitystringVisibility of the transfer function (private, public, privateToPublic, publicToPrivate)
Returns:
Proving and verifying keys for the specified transfer function
Type: 
Promise.<FunctionKeyPair>
Example
// Create a new OfflineKeyProvider
+const offlineKeyProvider = new OfflineKeyProvider();
+
+// Cache the keys for future use with the official locator
+const transferPublicProvingKeyBytes = await readBinaryFile('./resources/transfer_public.prover.a74565e');
+const transferPublicProvingKey = ProvingKey.fromBytes(transferPublicProvingKeyBytes);
+
+// Cache the transfer_public keys for future use with the OfflinKeyProvider's convenience method for
+// transfer_public (the verifying key will be cached automatically)
+offlineKeyProvider.insertTransferPublicKeys(transferPublicProvingKey);
+
+/// When they're needed, retrieve the keys from the cache
+const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");

transferKeys(visibility) → {Promise.<FunctionKeyPair>}

Get keys for a variant of the transfer function from the credits.aleo program.
Parameters:
NameTypeDescription
visibilitystringVisibility of the transfer function (private, public, privateToPublic, publicToPrivate)
Returns:
Proving and verifying keys for the specified transfer function
Type: 
Promise.<FunctionKeyPair>
Example
// Create a new OfflineKeyProvider
+const offlineKeyProvider = new OfflineKeyProvider();
+
+// Cache the keys for future use with the official locator
+const transferPublicProvingKeyBytes = await readBinaryFile('./resources/transfer_public.prover.a74565e');
+const transferPublicProvingKey = ProvingKey.fromBytes(transferPublicProvingKeyBytes);
+
+// Cache the transfer_public keys for future use with the OfflinKeyProvider's convenience method for
+// transfer_public (the verifying key will be cached automatically)
+offlineKeyProvider.insertTransferPublicKeys(transferPublicProvingKey);
+
+/// When they're needed, retrieve the keys from the cache
+const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");

(async) unBondPublicKeys() → {Promise.<FunctionKeyPair>}

Get unbond_public function keys from the credits.aleo program
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

(async) unBondPublicKeys() → {Promise.<FunctionKeyPair>}

Get unbond_public function keys from the credits.aleo program
Returns:
Proving and verifying keys for the join function
Type: 
Promise.<FunctionKeyPair>

verifyCreditsKeys() → {boolean}

Determines if the keys for a given credits function match the expected keys.
Returns:
Whether the keys match the expected keys
Type: 
boolean

verifyCreditsKeys(locator, provingKey, verifyingKey) → {boolean}

Determines if the keys for a given credits function match the expected keys.
Parameters:
NameTypeDescription
locatorstring
provingKeyProvingKey
verifyingKeyVerifyingKey
Returns:
Whether the keys match the expected keys
Type: 
boolean
\ No newline at end of file diff --git a/sdk/docs/OfflineSearchParams.html b/sdk/docs/OfflineSearchParams.html new file mode 100644 index 000000000..152aa66c4 --- /dev/null +++ b/sdk/docs/OfflineSearchParams.html @@ -0,0 +1,7 @@ +Class: OfflineSearchParams
On this page

OfflineSearchParams

Search parameters for the offline key provider. This class implements the KeySearchParams interface and includes a convenience method for creating a new instance of this class for each function of the credits.aleo program.

Constructor

new OfflineSearchParams(cacheKey, verifyCreditsKeys)

Create a new OfflineSearchParams instance.
Parameters:
NameTypeDefaultDescription
cacheKeystringKey used to store the local function proving & verifying keys. This should be stored under the naming convention "programName/functionName" (i.e. "myprogram.aleo/myfunction")
verifyCreditsKeysbooleanfalseWhether to verify the keys against the credits.aleo program, defaults to false, but should be set to true if using keys from the credits.aleo program
Example
// If storing a key for a custom program function
+offlineSearchParams = new OfflineSearchParams("myprogram.aleo/myfunction");
+
+// If storing a key for a credits.aleo program function
+bondPublicKeyParams = OfflineSearchParams.bondPublicKeyParams();

Classes

OfflineSearchParams

Methods

(static) bondPublicKeyParams()

Create a new OfflineSearchParams instance for the bond_public function of the credits.aleo program.

(static) bondPublicKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the bond_public function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) bondValidatorKeyParams()

Create a new OfflineSearchParams instance for the bond_validator function of the credits.aleo program.

(static) bondValidatorKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the bond_validator function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) claimUnbondPublicKeyParams()

Create a new OfflineSearchParams instance for the claim_unbond_public function of the

(static) claimUnbondPublicKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the claim_unbond_public function of the
Returns:
Type: 
OfflineSearchParams

(static) feePrivateKeyParams()

Create a new OfflineSearchParams instance for the fee_private function of the credits.aleo program.

(static) feePrivateKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the fee_private function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) feePublicKeyParams()

Create a new OfflineSearchParams instance for the fee_public function of the credits.aleo program.

(static) feePublicKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the fee_public function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) inclusionKeyParams()

Create a new OfflineSearchParams instance for the inclusion prover function.

(static) inclusionKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the inclusion prover function.
Returns:
Type: 
OfflineSearchParams

(static) joinKeyParams()

Create a new OfflineSearchParams instance for the join function of the credits.aleo program.

(static) joinKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the join function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) setValidatorStateKeyParams()

Create a new OfflineSearchParams instance for the set_validator_state function of the credits.aleo program.

(static) setValidatorStateKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the set_validator_state function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) splitKeyParams()

Create a new OfflineSearchParams instance for the split function of the credits.aleo program.

(static) splitKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the split function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) transferPrivateKeyParams()

Create a new OfflineSearchParams instance for the transfer_private function of the credits.aleo program.

(static) transferPrivateKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the transfer_private function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) transferPrivateToPublicKeyParams()

Create a new OfflineSearchParams instance for the transfer_private_to_public function of the credits.aleo program.

(static) transferPrivateToPublicKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the transfer_private_to_public function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) transferPublicAsSignerKeyParams()

Create a new OfflineSearchParams instance for the transfer_public_as_signer function of the credits.aleo program.

(static) transferPublicAsSignerKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the transfer_public_as_signer function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) transferPublicKeyParams()

Create a new OfflineSearchParams instance for the transfer_public function of the credits.aleo program.

(static) transferPublicKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the transfer_public function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) transferPublicToPrivateKeyParams()

Create a new OfflineSearchParams instance for the transfer_public_to_private function of the credits.aleo program.

(static) transferPublicToPrivateKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the transfer_public_to_private function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams

(static) unbondPublicKeyParams()

Create a new OfflineSearchParams instance for the unbond_public function of the credits.aleo program.

(static) unbondPublicKeyParams() → {OfflineSearchParams}

Create a new OfflineSearchParams instance for the unbond_public function of the credits.aleo program.
Returns:
Type: 
OfflineSearchParams
\ No newline at end of file diff --git a/sdk/docs/OfflineSearchParams_OfflineSearchParams.html b/sdk/docs/OfflineSearchParams_OfflineSearchParams.html new file mode 100644 index 000000000..6bc503006 --- /dev/null +++ b/sdk/docs/OfflineSearchParams_OfflineSearchParams.html @@ -0,0 +1,3 @@ +Class: OfflineSearchParams
On this page

OfflineSearchParams# OfflineSearchParams

new OfflineSearchParams(cacheKey, verifyCreditsKeys)

Create a new OfflineSearchParams instance.
Parameters:
NameTypeDescription
cacheKeystringKey used to store the local function proving & verifying keys. This should be stored under the naming convention "programName/functionName" (i.e. "myprogram.aleo/myfunction")
verifyCreditsKeysbooleanWhether to verify the keys against the credits.aleo program, defaults to false, but should be set to true if using keys from the credits.aleo program
\ No newline at end of file diff --git a/sdk/docs/ProgramManager.html b/sdk/docs/ProgramManager.html new file mode 100644 index 000000000..eecad1e58 --- /dev/null +++ b/sdk/docs/ProgramManager.html @@ -0,0 +1,401 @@ +Class: ProgramManager
On this page

ProgramManager

The ProgramManager class is used to execute and deploy programs on the Aleo network and create value transfers.

Constructor

new ProgramManager(host, keyProvider, recordProvider)

Create a new instance of the ProgramManager
Parameters:
NameTypeDescription
hoststring | undefinedA host uri running the official Aleo API
keyProviderFunctionKeyProvider | undefinedA key provider that implements FunctionKeyProvider interface
recordProviderRecordProvider | undefinedA record provider that implements RecordProvider interface

Classes

ProgramManager

Methods

(async) bondPublic(staker_address, validator_address, withdrawal_address, amount, options)

Bond credits to validator.
Parameters:
NameTypeDescription
staker_addressstringAddress of the staker who is bonding the credits
validator_addressstringAddress of the validator to bond to, if this address is the same as the signer (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 1,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
withdrawal_addressstringAddress to withdraw the staked credits to when unbond_public is called.
amountnumberThe amount of credits to bond
optionsOptionsOptions for the execution
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bonding transaction
+const tx_id = await programManager.bondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);

(async) bondPublic(staker_address, validator_address, withdrawal_address, amount, options)

Bond credits to validator.
Parameters:
NameTypeDescription
staker_addressstringAddress of the staker who is bonding the credits
validator_addressstringAddress of the validator to bond to, if this address is the same as the signer (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 1,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
withdrawal_addressstringAddress to withdraw the staked credits to when unbond_public is called.
amountnumberThe amount of credits to bond
optionsOptionsOptions for the execution
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bonding transaction
+const tx_id = await programManager.bondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);

(async) bondValidator(validator_address, withdrawal_address, amount, commission, options)

Build transaction to bond a validator.
Parameters:
NameTypeDescription
validator_addressstringAddress of the validator to bond to, if this address is the same as the staker (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
withdrawal_addressstringAddress to withdraw the staked credits to when unbond_public is called.
amountnumberThe amount of credits to bond
commissionnumberThe commission rate for the validator (must be between 0 and 100 - an error will be thrown if it is not)
optionsPartial.<ExecuteOptions>Override default execution options.
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bonding transaction
+const tx_id = await programManager.bondValidator("aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);

(async) bondValidator(validator_address, withdrawal_address, amount, commission, options)

Build transaction to bond a validator.
Parameters:
NameTypeDescription
validator_addressstringAddress of the validator to bond to, if this address is the same as the staker (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
withdrawal_addressstringAddress to withdraw the staked credits to when unbond_public is called.
amountnumberThe amount of credits to bond
commissionnumberThe commission rate for the validator (must be between 0 and 100 - an error will be thrown if it is not)
optionsPartial.<ExecuteOptions>Override default execution options.
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bonding transaction
+const tx_id = await programManager.bondValidator("aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);

(async) buildBondPublicTransaction(staker_address, validator_address, withdrawal_address, amount, options)

Build transaction to bond credits to a validator for later submission to the Aleo Network
Parameters:
NameTypeDescription
staker_addressstringAddress of the staker who is bonding the credits
validator_addressstringAddress of the validator to bond to, if this address is the same as the staker (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
withdrawal_addressstringAddress to withdraw the staked credits to when unbond_public is called.
amountnumberThe amount of credits to bond
optionsPartial.<ExecuteOptions>Override default execution options.
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bonding transaction object for later submission
+const tx = await programManager.buildBondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
+console.log(tx);
+
+// The transaction can be later submitted to the network using the network client.
+const result = await programManager.networkClient.submitTransaction(tx);

(async) buildBondPublicTransaction(staker_address, validator_address, withdrawal_address, amount, options)

Build transaction to bond credits to a validator for later submission to the Aleo Network
Parameters:
NameTypeDescription
staker_addressstringAddress of the staker who is bonding the credits
validator_addressstringAddress of the validator to bond to, if this address is the same as the staker (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
withdrawal_addressstringAddress to withdraw the staked credits to when unbond_public is called.
amountnumberThe amount of credits to bond
optionsPartial.<ExecuteOptions>Override default execution options.
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bonding transaction object for later submission
+const tx = await programManager.buildBondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
+console.log(tx);
+
+// The transaction can be later submitted to the network using the network client.
+const result = await programManager.networkClient.submitTransaction(tx);

(async) buildBondValidatorTransaction(validator_address, withdrawal_address, amount, commission, options)

Build a bond_validator transaction for later submission to the Aleo Network.
Parameters:
NameTypeDescription
validator_addressstringAddress of the validator to bond to, if this address is the same as the staker (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
withdrawal_addressstringAddress to withdraw the staked credits to when unbond_public is called.
amountnumberThe amount of credits to bond
commissionnumberThe commission rate for the validator (must be between 0 and 100 - an error will be thrown if it is not)
optionsPartial.<ExecuteOptions>Override default execution options.
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bond validator transaction object for later use.
+const tx = await programManager.buildBondValidatorTransaction("aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
+console.log(tx);
+
+// The transaction can later be submitted to the network using the network client.
+const tx_id = await programManager.networkClient.submitTransaction(tx);

(async) buildBondValidatorTransaction(validator_address, withdrawal_address, amount, commission, options)

Build a bond_validator transaction for later submission to the Aleo Network.
Parameters:
NameTypeDescription
validator_addressstringAddress of the validator to bond to, if this address is the same as the staker (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
withdrawal_addressstringAddress to withdraw the staked credits to when unbond_public is called.
amountnumberThe amount of credits to bond
commissionnumberThe commission rate for the validator (must be between 0 and 100 - an error will be thrown if it is not)
optionsPartial.<ExecuteOptions>Override default execution options.
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bond validator transaction object for later use.
+const tx = await programManager.buildBondValidatorTransaction("aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
+console.log(tx);
+
+// The transaction can later be submitted to the network using the network client.
+const tx_id = await programManager.networkClient.submitTransaction(tx);

(async) buildClaimUnbondPublicTransaction(staker_address, options) → {Promise.<Transaction>}

Build a transaction to claim unbonded public credits in the Aleo network.
Parameters:
NameTypeDescription
staker_addressstringThe address of the staker who is claiming the credits.
optionsPartial.<ExecuteOptions>Override default execution options.
Returns:
- A promise that resolves to the transaction or an error message.
Type: 
Promise.<Transaction>
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to claim unbonded credits.
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+
+// Create the claim unbonded transaction object for later use.
+const tx = await programManager.buildClaimUnbondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j");
+console.log(tx);
+
+// The transaction can be submitted later to the network using the network client.
+programManager.networkClient.submitTransaction(tx);

(async) buildClaimUnbondPublicTransaction(staker_address, options) → {Promise.<Transaction>}

Build a transaction to claim unbonded public credits in the Aleo network.
Parameters:
NameTypeDescription
staker_addressstringThe address of the staker who is claiming the credits.
optionsPartial.<ExecuteOptions>Override default execution options.
Returns:
- A promise that resolves to the transaction or an error message.
Type: 
Promise.<Transaction>
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to claim unbonded credits.
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+
+// Create the claim unbonded transaction object for later use.
+const tx = await programManager.buildClaimUnbondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j");
+console.log(tx);
+
+// The transaction can be submitted later to the network using the network client.
+programManager.networkClient.submitTransaction(tx);

(async) buildExecutionTransaction(options) → {Promise.<Transaction>}

Builds an execution transaction for submission to the Aleo network.
Parameters:
NameTypeDescription
optionsExecuteOptionsThe options for the execution transaction.
Returns:
- A promise that resolves to the transaction or an error.
Type: 
Promise.<Transaction>
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for executions
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+
+// Build and execute the transaction
+const transaction = await programManager.buildExecutionTransaction({
+  programName: "hello_hello.aleo",
+  functionName: "hello_hello",
+  fee: 0.020,
+  privateFee: false,
+  inputs: ["5u32", "5u32"],
+  keySearchParams: { "cacheKey": "hello_hello:hello" }
+});
+const result = await programManager.networkClient.submitTransaction(transaction);

(async) buildExecutionTransaction(options) → {Promise.<Transaction>}

Builds an execution transaction for submission to the Aleo network.
Parameters:
NameTypeDescription
optionsExecuteOptionsThe options for the execution transaction.
Returns:
- A promise that resolves to the transaction or an error.
Type: 
Promise.<Transaction>
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for executions
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+
+// Build and execute the transaction
+const transaction = await programManager.buildExecutionTransaction({
+  programName: "hello_hello.aleo",
+  functionName: "hello_hello",
+  fee: 0.020,
+  privateFee: false,
+  inputs: ["5u32", "5u32"],
+  keySearchParams: { "cacheKey": "hello_hello:hello" }
+});
+const result = await programManager.networkClient.submitTransaction(transaction);

(async) buildSetValidatorStateTransaction(validator_state, options)

Build a set_validator_state transaction for later usage. This function allows a validator to set their state to be either opened or closed to new stakers. When the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator. When the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond. This function serves two primary purposes: 1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers. 2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them.
Parameters:
NameTypeDescription
validator_stateboolean
optionsPartial.<ExecuteOptions>Override default execution options
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("ValidatorPrivateKey"));
+
+// Create the bonding transaction
+const tx = await programManager.buildSetValidatorStateTransaction(true);
+
+// The transaction can be submitted later to the network using the network client.
+programManager.networkClient.submitTransaction(tx);

(async) buildSetValidatorStateTransaction(validator_state, options)

Build a set_validator_state transaction for later usage. This function allows a validator to set their state to be either opened or closed to new stakers. When the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator. When the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond. This function serves two primary purposes: 1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers. 2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them.
Parameters:
NameTypeDescription
validator_stateboolean
optionsPartial.<ExecuteOptions>Override default execution options
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("ValidatorPrivateKey"));
+
+// Create the bonding transaction
+const tx = await programManager.buildSetValidatorStateTransaction(true);
+
+// The transaction can be submitted later to the network using the network client.
+programManager.networkClient.submitTransaction(tx);

(async) buildTransferPublicAsSignerTransaction(amount, recipient, transferType, fee, privateFee, recordSearchParams, amountRecord, feeRecord, privateKey, offlineQuery) → {Promise.<string>}

Build a transfer_public_as_signer transaction to transfer credits to another account for later submission to the Aleo network
Parameters:
NameTypeDescription
amountnumberThe amount of credits to transfer
recipientstringThe recipient of the transfer
transferTypestringThe type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
feenumberThe fee to pay for the transfer
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for finding the amount and fee records for the transfer transaction
amountRecordRecordPlaintext | stringOptional amount record to use for the transfer
feeRecordRecordPlaintext | stringOptional fee record to use for the transfer
privateKeyPrivateKey | undefinedOptional private key to use for the transfer transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
The transaction id of the transfer transaction
Type: 
Promise.<string>

(async) buildTransferPublicAsSignerTransaction(amount, recipient, transferType, fee, privateFee, recordSearchParams, amountRecord, feeRecord, privateKey, offlineQuery) → {Promise.<string>}

Build a transfer_public_as_signer transaction to transfer credits to another account for later submission to the Aleo network
Parameters:
NameTypeDescription
amountnumberThe amount of credits to transfer
recipientstringThe recipient of the transfer
transferTypestringThe type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
feenumberThe fee to pay for the transfer
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for finding the amount and fee records for the transfer transaction
amountRecordRecordPlaintext | stringOptional amount record to use for the transfer
feeRecordRecordPlaintext | stringOptional fee record to use for the transfer
privateKeyPrivateKey | undefinedOptional private key to use for the transfer transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
The transaction id of the transfer transaction
Type: 
Promise.<string>

(async) buildTransferPublicTransaction(amount, recipient, transferType, fee, privateFee, recordSearchParams, amountRecord, feeRecord, privateKey, offlineQuery) → {Promise.<string>}

Build a transfer_public transaction to transfer credits to another account for later submission to the Aleo network
Parameters:
NameTypeDescription
amountnumberThe amount of credits to transfer
recipientstringThe recipient of the transfer
transferTypestringThe type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
feenumberThe fee to pay for the transfer
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for finding the amount and fee records for the transfer transaction
amountRecordRecordPlaintext | stringOptional amount record to use for the transfer
feeRecordRecordPlaintext | stringOptional fee record to use for the transfer
privateKeyPrivateKey | undefinedOptional private key to use for the transfer transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
The transaction id of the transfer transaction
Type: 
Promise.<string>

(async) buildTransferPublicTransaction(amount, recipient, transferType, fee, privateFee, recordSearchParams, amountRecord, feeRecord, privateKey, offlineQuery) → {Promise.<string>}

Build a transfer_public transaction to transfer credits to another account for later submission to the Aleo network
Parameters:
NameTypeDescription
amountnumberThe amount of credits to transfer
recipientstringThe recipient of the transfer
transferTypestringThe type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
feenumberThe fee to pay for the transfer
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for finding the amount and fee records for the transfer transaction
amountRecordRecordPlaintext | stringOptional amount record to use for the transfer
feeRecordRecordPlaintext | stringOptional fee record to use for the transfer
privateKeyPrivateKey | undefinedOptional private key to use for the transfer transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
The transaction id of the transfer transaction
Type: 
Promise.<string>

(async) buildTransferTransaction(amount, recipient, transferType, fee, privateFee, recordSearchParams, amountRecord, feeRecord, privateKey, offlineQuery) → {Promise.<string>}

Build a transaction to transfer credits to another account for later submission to the Aleo network
Parameters:
NameTypeDescription
amountnumberThe amount of credits to transfer
recipientstringThe recipient of the transfer
transferTypestringThe type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
feenumberThe fee to pay for the transfer
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for finding the amount and fee records for the transfer transaction
amountRecordRecordPlaintext | stringOptional amount record to use for the transfer
feeRecordRecordPlaintext | stringOptional fee record to use for the transfer
privateKeyPrivateKey | undefinedOptional private key to use for the transfer transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
The transaction id of the transfer transaction
Type: 
Promise.<string>
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for executions
+const programName = "hello_hello.aleo";
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+await programManager.initialize();
+const tx_id = await programManager.transfer(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "private", 0.2)
+const transaction = await programManager.networkClient.getTransaction(tx_id);

(async) buildTransferTransaction(amount, recipient, transferType, fee, privateFee, recordSearchParams, amountRecord, feeRecord, privateKey, offlineQuery) → {Promise.<string>}

Build a transaction to transfer credits to another account for later submission to the Aleo network
Parameters:
NameTypeDescription
amountnumberThe amount of credits to transfer
recipientstringThe recipient of the transfer
transferTypestringThe type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
feenumberThe fee to pay for the transfer
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for finding the amount and fee records for the transfer transaction
amountRecordRecordPlaintext | stringOptional amount record to use for the transfer
feeRecordRecordPlaintext | stringOptional fee record to use for the transfer
privateKeyPrivateKey | undefinedOptional private key to use for the transfer transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
The transaction id of the transfer transaction
Type: 
Promise.<string>
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for executions
+const programName = "hello_hello.aleo";
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+await programManager.initialize();
+const tx_id = await programManager.transfer(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "private", 0.2)
+const transaction = await programManager.networkClient.getTransaction(tx_id);

(async) buildUnbondPublicTransaction(staker_address, amount, options) → {Promise.<Transaction>}

Build a transaction to unbond public credits from a validator in the Aleo network.
Parameters:
NameTypeDescription
staker_addressstringThe address of the staker who is unbonding the credits.
amountnumberThe amount of credits to unbond (scaled by 1,000,000).
optionsPartial.<ExecuteOptions>Override default execution options.
Returns:
- A promise that resolves to the transaction or an error message.
Type: 
Promise.<Transaction>
Example
// Create a keyProvider to handle key management.
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to unbond credits.
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+const tx = await programManager.buildUnbondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", 2000000);
+console.log(tx);
+
+// The transaction can be submitted later to the network using the network client.
+programManager.networkClient.submitTransaction(tx);

(async) buildUnbondPublicTransaction(staker_address, amount, options) → {Promise.<Transaction>}

Build a transaction to unbond public credits from a validator in the Aleo network.
Parameters:
NameTypeDescription
staker_addressstringThe address of the staker who is unbonding the credits.
amountnumberThe amount of credits to unbond (scaled by 1,000,000).
optionsPartial.<ExecuteOptions>Override default execution options.
Returns:
- A promise that resolves to the transaction or an error message.
Type: 
Promise.<Transaction>
Example
// Create a keyProvider to handle key management.
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to unbond credits.
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+const tx = await programManager.buildUnbondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", 2000000);
+console.log(tx);
+
+// The transaction can be submitted later to the network using the network client.
+programManager.networkClient.submitTransaction(tx);

(async) claimUnbondPublic(staker_address, options)

Claim unbonded credits. If credits have been unbonded by the account executing this function, this method will claim them and add them to the public balance of the account.
Parameters:
NameTypeDescription
staker_addressstringAddress of the staker who is claiming the credits
optionsExecuteOptions
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bonding transaction
+const tx_id = await programManager.claimUnbondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j");

(async) claimUnbondPublic(staker_address, options)

Claim unbonded credits. If credits have been unbonded by the account executing this function, this method will claim them and add them to the public balance of the account.
Parameters:
NameTypeDescription
staker_addressstringAddress of the staker who is claiming the credits
optionsExecuteOptions
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bonding transaction
+const tx_id = await programManager.claimUnbondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j");

createProgramFromSource(program) → {Program}

Create a program object from a program's source code
Parameters:
NameTypeDescription
programstringProgram source code
Returns:
The program object
Type: 
Program

createProgramFromSource(program) → {Program}

Create a program object from a program's source code
Parameters:
NameTypeDescription
programstringProgram source code
Returns:
The program object
Type: 
Program

creditsProgram() → {Program}

Get the credits program object
Returns:
The credits program object
Type: 
Program

creditsProgram() → {Program}

Get the credits program object
Returns:
The credits program object
Type: 
Program

(async) deploy(program, fee, privateFee, recordSearchParams, feeRecord, privateKey) → {string}

Deploy an Aleo program to the Aleo network
Parameters:
NameTypeDescription
programstringProgram source code
feenumberFee to pay for the transaction
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for searching for a record to use pay the deployment fee
feeRecordstring | RecordPlaintext | undefinedOptional Fee record to use for the transaction
privateKeyPrivateKey | undefinedOptional private key to use for the transaction
Returns:
The transaction id of the deployed program or a failure message from the network
Type: 
string
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for deployments
+const program = "program hello_hello.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n";
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+
+// Define a fee in credits
+const fee = 1.2;
+
+// Deploy the program
+const tx_id = await programManager.deploy(program, fee);
+
+// Verify the transaction was successful
+const transaction = await programManager.networkClient.getTransaction(tx_id);

(async) deploy(program, fee, privateFee, recordSearchParams, feeRecord, privateKey) → {string}

Deploy an Aleo program to the Aleo network
Parameters:
NameTypeDescription
programstringProgram source code
feenumberFee to pay for the transaction
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for searching for a record to use pay the deployment fee
feeRecordstring | RecordPlaintext | undefinedOptional Fee record to use for the transaction
privateKeyPrivateKey | undefinedOptional private key to use for the transaction
Returns:
The transaction id of the deployed program or a failure message from the network
Type: 
string
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for deployments
+const program = "program hello_hello.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n";
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+
+// Define a fee in credits
+const fee = 1.2;
+
+// Deploy the program
+const tx_id = await programManager.deploy(program, fee);
+
+// Verify the transaction was successful
+const transaction = await programManager.networkClient.getTransaction(tx_id);

(async) execute(options) → {Promise.<Transaction>}

Builds an execution transaction for submission to the Aleo network.
Parameters:
NameTypeDescription
optionsExecuteOptionsThe options for the execution transaction.
Returns:
- A promise that resolves to the transaction or an error.
Type: 
Promise.<Transaction>
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for executions
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+
+// Build and execute the transaction
+const transaction = await programManager.execute({
+  programName: "hello_hello.aleo",
+  functionName: "hello_hello",
+  fee: 0.020,
+  privateFee: false,
+  inputs: ["5u32", "5u32"],
+  keySearchParams: { "cacheKey": "hello_hello:hello" }
+});
+const result = await programManager.networkClient.submitTransaction(transaction);

(async) execute(options) → {Promise.<Transaction>}

Builds an execution transaction for submission to the Aleo network.
Parameters:
NameTypeDescription
optionsExecuteOptionsThe options for the execution transaction.
Returns:
- A promise that resolves to the transaction or an error.
Type: 
Promise.<Transaction>
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for executions
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+
+// Build and execute the transaction
+const transaction = await programManager.execute({
+  programName: "hello_hello.aleo",
+  functionName: "hello_hello",
+  fee: 0.020,
+  privateFee: false,
+  inputs: ["5u32", "5u32"],
+  keySearchParams: { "cacheKey": "hello_hello:hello" }
+});
+const result = await programManager.networkClient.submitTransaction(transaction);

(async) join(recordOne, recordTwo, fee, privateFee, recordSearchParams, feeRecord, privateKey, offlineQuery) → {Promise.<string>}

Join two credits records into a single credits record
Parameters:
NameTypeDescription
recordOneRecordPlaintext | stringFirst credits record to join
recordTwoRecordPlaintext | stringSecond credits record to join
feenumberFee in credits pay for the join transaction
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for finding the fee record to use to pay the fee for the join transaction
feeRecordRecordPlaintext | string | undefinedFee record to use for the join transaction
privateKeyPrivateKey | undefinedPrivate key to use for the join transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
Type: 
Promise.<string>

(async) join(recordOne, recordTwo, fee, privateFee, recordSearchParams, feeRecord, privateKey, offlineQuery) → {Promise.<string>}

Join two credits records into a single credits record
Parameters:
NameTypeDescription
recordOneRecordPlaintext | stringFirst credits record to join
recordTwoRecordPlaintext | stringSecond credits record to join
feenumberFee in credits pay for the join transaction
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for finding the fee record to use to pay the fee for the join transaction
feeRecordRecordPlaintext | string | undefinedFee record to use for the join transaction
privateKeyPrivateKey | undefinedPrivate key to use for the join transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
Type: 
Promise.<string>

(async) run(program, function_name, inputs, proveExecution, imports, keySearchParams, provingKey, verifyingKey, privateKey, offlineQuery) → {Promise.<string>}

Run an Aleo program in offline mode
Parameters:
NameTypeDescription
programstringProgram source code containing the function to be executed
function_namestringFunction name to execute
inputsArray.<string>Inputs to the function
proveExecutionnumberWhether to prove the execution of the function and return an execution transcript that contains the proof.
importsArray.<string> | undefinedOptional imports to the program
keySearchParamsKeySearchParams | undefinedOptional parameters for finding the matching proving & verifying keys for the function
provingKeyProvingKey | undefinedOptional proving key to use for the transaction
verifyingKeyVerifyingKey | undefinedOptional verifying key to use for the transaction
privateKeyPrivateKey | undefinedOptional private key to use for the transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
Type: 
Promise.<string>
Example
import { Account, Program } from '@provablehq/sdk';
+
+/// Create the source for the "helloworld" program
+const program = "program helloworld.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n";
+const programManager = new ProgramManager();
+
+/// Create a temporary account for the execution of the program
+const account = new Account();
+programManager.setAccount(account);
+
+/// Get the response and ensure that the program executed correctly
+const executionResponse = await programManager.run(program, "hello", ["5u32", "5u32"]);
+const result = executionResponse.getOutputs();
+assert(result === ["10u32"]);

(async) run(program, function_name, inputs, proveExecution, imports, keySearchParams, provingKey, verifyingKey, privateKey, offlineQuery) → {Promise.<string>}

Run an Aleo program in offline mode
Parameters:
NameTypeDescription
programstringProgram source code containing the function to be executed
function_namestringFunction name to execute
inputsArray.<string>Inputs to the function
proveExecutionnumberWhether to prove the execution of the function and return an execution transcript that contains the proof.
importsArray.<string> | undefinedOptional imports to the program
keySearchParamsKeySearchParams | undefinedOptional parameters for finding the matching proving & verifying keys for the function
provingKeyProvingKey | undefinedOptional proving key to use for the transaction
verifyingKeyVerifyingKey | undefinedOptional verifying key to use for the transaction
privateKeyPrivateKey | undefinedOptional private key to use for the transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
Type: 
Promise.<string>
Example
import { Account, Program } from '@provablehq/sdk';
+
+/// Create the source for the "helloworld" program
+const program = "program helloworld.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n";
+const programManager = new ProgramManager();
+
+/// Create a temporary account for the execution of the program
+const account = new Account();
+programManager.setAccount(account);
+
+/// Get the response and ensure that the program executed correctly
+const executionResponse = await programManager.run(program, "hello", ["5u32", "5u32"]);
+const result = executionResponse.getOutputs();
+assert(result === ["10u32"]);

setAccount(account)

Set the account to use for transaction submission to the Aleo network
Parameters:
NameTypeDescription
accountAccountAccount to use for transaction submission

setAccount(account)

Set the account to use for transaction submission to the Aleo network
Parameters:
NameTypeDescription
accountAccountAccount to use for transaction submission

setHost(host)

Set the host peer to use for transaction submission to the Aleo network
Parameters:
NameTypeDescription
hoststringPeer url to use for transaction submission

setHost(host)

Set the host peer to use for transaction submission to the Aleo network
Parameters:
NameTypeDescription
hoststringPeer url to use for transaction submission

setKeyProvider(keyProvider)

Set the key provider that provides the proving and verifying keys for programs
Parameters:
NameTypeDescription
keyProviderFunctionKeyProvider

setKeyProvider(keyProvider)

Set the key provider that provides the proving and verifying keys for programs
Parameters:
NameTypeDescription
keyProviderFunctionKeyProvider

setRecordProvider(recordProvider)

Set the record provider that provides records for transactions
Parameters:
NameTypeDescription
recordProviderRecordProvider

setRecordProvider(recordProvider)

Set the record provider that provides records for transactions
Parameters:
NameTypeDescription
recordProviderRecordProvider

(async) setValidatorState(validator_state, options)

Submit a set_validator_state transaction to the Aleo Network. This function allows a validator to set their state to be either opened or closed to new stakers. When the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator. When the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond. This function serves two primary purposes: 1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers. 2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them.
Parameters:
NameTypeDescription
validator_stateboolean
optionsPartial.<ExecuteOptions>Override default execution options
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("ValidatorPrivateKey"));
+
+// Create the bonding transaction
+const tx_id = await programManager.setValidatorState(true);

(async) setValidatorState(validator_state, options)

Submit a set_validator_state transaction to the Aleo Network. This function allows a validator to set their state to be either opened or closed to new stakers. When the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator. When the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond. This function serves two primary purposes: 1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers. 2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them.
Parameters:
NameTypeDescription
validator_stateboolean
optionsPartial.<ExecuteOptions>Override default execution options
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("ValidatorPrivateKey"));
+
+// Create the bonding transaction
+const tx_id = await programManager.setValidatorState(true);

(async) split(splitAmount, amountRecord, privateKey, offlineQuery) → {Promise.<string>}

Split credits into two new credits records
Parameters:
NameTypeDescription
splitAmountnumberAmount in microcredits to split from the original credits record
amountRecordRecordPlaintext | stringAmount record to use for the split transaction
privateKeyPrivateKey | undefinedOptional private key to use for the split transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
Type: 
Promise.<string>
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for executions
+const programName = "hello_hello.aleo";
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+const record = "{  owner: aleo184vuwr5u7u0ha5f5k44067dd2uaqewxx6pe5ltha5pv99wvhfqxqv339h4.private,  microcredits: 45000000u64.private,  _nonce: 4106205762862305308495708971985748592380064201230396559307556388725936304984group.public}"
+const tx_id = await programManager.split(25000000, record);
+const transaction = await programManager.networkClient.getTransaction(tx_id);

(async) split(splitAmount, amountRecord, privateKey, offlineQuery) → {Promise.<string>}

Split credits into two new credits records
Parameters:
NameTypeDescription
splitAmountnumberAmount in microcredits to split from the original credits record
amountRecordRecordPlaintext | stringAmount record to use for the split transaction
privateKeyPrivateKey | undefinedOptional private key to use for the split transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
Type: 
Promise.<string>
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for executions
+const programName = "hello_hello.aleo";
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+const record = "{  owner: aleo184vuwr5u7u0ha5f5k44067dd2uaqewxx6pe5ltha5pv99wvhfqxqv339h4.private,  microcredits: 45000000u64.private,  _nonce: 4106205762862305308495708971985748592380064201230396559307556388725936304984group.public}"
+const tx_id = await programManager.split(25000000, record);
+const transaction = await programManager.networkClient.getTransaction(tx_id);

(async) synthesizeKeys(program, function_id, inputs, privateKey) → {Promise.<FunctionKeyPair>}

Pre-synthesize proving and verifying keys for a program
Parameters:
NameTypeDescription
programstringThe program source code to synthesize keys for
function_idstringThe function id to synthesize keys for
inputsArray.<string>Sample inputs to the function
privateKeyPrivateKey | undefinedOptional private key to use for the key synthesis
Returns:
Type: 
Promise.<FunctionKeyPair>

(async) synthesizeKeys(program, function_id, inputs, privateKey) → {Promise.<FunctionKeyPair>}

Pre-synthesize proving and verifying keys for a program
Parameters:
NameTypeDescription
programstringThe program source code to synthesize keys for
function_idstringThe function id to synthesize keys for
inputsArray.<string>Sample inputs to the function
privateKeyPrivateKey | undefinedOptional private key to use for the key synthesis
Returns:
Type: 
Promise.<FunctionKeyPair>

(async) transfer(amount, recipient, transferType, fee, privateFee, recordSearchParams, amountRecord, feeRecord, privateKey, offlineQuery) → {Promise.<string>}

Transfer credits to another account
Parameters:
NameTypeDescription
amountnumberThe amount of credits to transfer
recipientstringThe recipient of the transfer
transferTypestringThe type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
feenumberThe fee to pay for the transfer
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for finding the amount and fee records for the transfer transaction
amountRecordRecordPlaintext | stringOptional amount record to use for the transfer
feeRecordRecordPlaintext | stringOptional fee record to use for the transfer
privateKeyPrivateKey | undefinedOptional private key to use for the transfer transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
The transaction id of the transfer transaction
Type: 
Promise.<string>
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for executions
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+await programManager.initialize();
+const tx_id = await programManager.transfer(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "private", 0.2)
+const transaction = await programManager.networkClient.getTransaction(tx_id);

(async) transfer(amount, recipient, transferType, fee, privateFee, recordSearchParams, amountRecord, feeRecord, privateKey, offlineQuery) → {Promise.<string>}

Transfer credits to another account
Parameters:
NameTypeDescription
amountnumberThe amount of credits to transfer
recipientstringThe recipient of the transfer
transferTypestringThe type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
feenumberThe fee to pay for the transfer
privateFeebooleanUse a private record to pay the fee. If false this will use the account's public credit balance
recordSearchParamsRecordSearchParams | undefinedOptional parameters for finding the amount and fee records for the transfer transaction
amountRecordRecordPlaintext | stringOptional amount record to use for the transfer
feeRecordRecordPlaintext | stringOptional fee record to use for the transfer
privateKeyPrivateKey | undefinedOptional private key to use for the transfer transaction
offlineQueryOfflineQuery | undefinedOptional offline query if creating transactions in an offline environment
Returns:
The transaction id of the transfer transaction
Type: 
Promise.<string>
Example
// Create a new NetworkClient, KeyProvider, and RecordProvider
+const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+const keyProvider = new AleoKeyProvider();
+const recordProvider = new NetworkRecordProvider(account, networkClient);
+
+// Initialize a program manager with the key provider to automatically fetch keys for executions
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+await programManager.initialize();
+const tx_id = await programManager.transfer(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "private", 0.2)
+const transaction = await programManager.networkClient.getTransaction(tx_id);

(async) unbondPublic(staker_address, amount, options)

Unbond a specified amount of staked credits.
Parameters:
NameTypeDescription
staker_addressstringAddress of the staker who is unbonding the credits
amountnumberAmount of credits to unbond. If the address of the executor of this function is an existing validator, it will subtract this amount of credits from the validator's staked credits. If there are less than 1,000,000 credits staked pool after the unbond, the validator will be removed from the validator set. If the address of the executor of this function is not a validator and has credits bonded as a delegator, it will subtract this amount of credits from the delegator's staked credits. If there are less than 10 credits bonded after the unbond operation, the delegator will be removed from the validator's staking pool.
optionsExecuteOptionsOptions for the execution
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bonding transaction and send it to the network
+const tx_id = await programManager.unbondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", 10);

(async) unbondPublic(staker_address, amount, options)

Unbond a specified amount of staked credits.
Parameters:
NameTypeDescription
staker_addressstringAddress of the staker who is unbonding the credits
amountnumberAmount of credits to unbond. If the address of the executor of this function is an existing validator, it will subtract this amount of credits from the validator's staked credits. If there are less than 1,000,000 credits staked pool after the unbond, the validator will be removed from the validator set. If the address of the executor of this function is not a validator and has credits bonded as a delegator, it will subtract this amount of credits from the delegator's staked credits. If there are less than 10 credits bonded after the unbond operation, the delegator will be removed from the validator's staking pool.
optionsExecuteOptionsOptions for the execution
Returns:
string
Example
// Create a keyProvider to handle key management
+const keyProvider = new AleoKeyProvider();
+keyProvider.useCache = true;
+
+// Create a new ProgramManager with the key that will be used to bond credits
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+programManager.setAccount(new Account("YourPrivateKey"));
+
+// Create the bonding transaction and send it to the network
+const tx_id = await programManager.unbondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", 10);

verifyExecution(executionResponse) → {boolean}

Verify a proof of execution from an offline execution
Parameters:
NameTypeDescription
executionResponseexecutionResponse
Returns:
True if the proof is valid, false otherwise
Type: 
boolean

verifyExecution(executionResponse) → {boolean}

Verify a proof of execution from an offline execution
Parameters:
NameTypeDescription
executionResponseexecutionResponse
Returns:
True if the proof is valid, false otherwise
Type: 
boolean

verifyProgram(program)

Verify a program is valid
Parameters:
NameTypeDescription
programstringThe program source code

verifyProgram(program) → {boolean}

Verify a program is valid
Parameters:
NameTypeDescription
programstringThe program source code
Returns:
Type: 
boolean
\ No newline at end of file diff --git a/sdk/docs/ProgramManager_ProgramManager.html b/sdk/docs/ProgramManager_ProgramManager.html new file mode 100644 index 000000000..55f32e459 --- /dev/null +++ b/sdk/docs/ProgramManager_ProgramManager.html @@ -0,0 +1,3 @@ +Class: ProgramManager
On this page

ProgramManager# ProgramManager

\ No newline at end of file diff --git a/sdk/docs/RecordProvider.html b/sdk/docs/RecordProvider.html new file mode 100644 index 000000000..261cf72c1 --- /dev/null +++ b/sdk/docs/RecordProvider.html @@ -0,0 +1,46 @@ +Interface: RecordProvider
On this page

RecordProvider

Interface for a record provider. A record provider is used to find records for use in deployment and execution transactions on the Aleo Network. A default implementation is provided by the NetworkRecordProvider class. However, a custom implementation can be provided (say if records are synced locally to a database from the network) by implementing this interface.

Members

findCreditsRecord :Promise.<RecordPlaintext>

Find a credits.aleo record with a given number of microcredits from the chosen provider
Type:
  • Promise.<RecordPlaintext>
Example
// A class implementing record provider can be used to find a record with a given number of microcredits
+const record = await recordProvider.findCreditsRecord(5000, true, []);
+
+// When a record is found but not yet used, its nonce should be added to the nonces array so that it is not
+// found again if a subsequent search is performed
+const record2 = await recordProvider.findCreditsRecord(5000, true, [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
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);

findCreditsRecords :Promise.<Array>

Find a list of credit.aleo records with a given number of microcredits from the chosen provider
Type:
  • Promise.<Array>
Example
// A class implementing record provider can be used to find a record with a given number of microcredits
+const records = await recordProvider.findCreditsRecords([5000, 5000], true, []);
+
+// When a record is found but not yet used, it's nonce should be added to the nonces array so that it is not
+// found again if a subsequent search is performed
+const nonces = [];
+records.forEach(record => { nonces.push(record.nonce()) });
+const records2 = await recordProvider.findCreditsRecord(5000, true, nonces);
+
+// 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
+const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);

findRecord :Promise.<RecordPlaintext>

Find an arbitrary record
Type:
  • Promise.<RecordPlaintext>
Example
// The RecordSearchParams interface can be used to create parameters for custom record searches which can then
+// be passed to the record provider. An example of how this would be done for the credits.aleo program is shown
+// below.
+
+class CustomRecordSearch implements RecordSearchParams {
+    startHeight: number;
+    endHeight: number;
+    amount: number;
+    program: string;
+    recordName: string;
+    constructor(startHeight: number, endHeight: number, credits: number, maxRecords: number, programName: string, recordName: string) {
+        this.startHeight = startHeight;
+        this.endHeight = endHeight;
+        this.amount = amount;
+        this.program = programName;
+        this.recordName = recordName;
+    }
+}
+
+const params = new CustomRecordSearch(0, 100, 5000, "credits.aleo", "credits");
+
+const record = await recordProvider.findRecord(true, [], params);

findRecords :Promise.<Array>

Find multiple records from arbitrary programs
Type:
  • Promise.<Array>
\ No newline at end of file diff --git a/sdk/docs/RecordSearchParams.html b/sdk/docs/RecordSearchParams.html new file mode 100644 index 000000000..bf7cb71bb --- /dev/null +++ b/sdk/docs/RecordSearchParams.html @@ -0,0 +1,3 @@ +Interface: RecordSearchParams
On this page

RecordSearchParams

Interface for record search parameters. This allows for arbitrary search parameters to be passed to record provider implementations.
\ No newline at end of file diff --git a/sdk/docs/account.ts.html b/sdk/docs/account.ts.html index 9a2401d9b..4eb500b55 100644 --- a/sdk/docs/account.ts.html +++ b/sdk/docs/account.ts.html @@ -1,13 +1,13 @@ -Source: account.ts
On this page

account.ts

import {
+Source: account.ts
On this page

account.ts

import {
   Address,
   PrivateKey,
   Signature,
   ViewKey,
   PrivateKeyCiphertext,
   RecordCiphertext,
-} from "@provablehq/wasm";
+} from "./wasm";
 
 interface AccountParam {
   privateKey?: string;
@@ -27,18 +27,18 @@
  *
  * @example
  * // Create a new account
- * let myRandomAccount = new Account();
+ * const myRandomAccount = new Account();
  *
  * // Create an account from a randomly generated seed
- * let seed = new Uint8Array([94, 91, 52, 251, 240, 230, 226, 35, 117, 253, 224, 210, 175, 13, 205, 120, 155, 214, 7, 169, 66, 62, 206, 50, 188, 40, 29, 122, 40, 250, 54, 18]);
- * let mySeededAccount = new Account({seed: seed});
+ * const seed = new Uint8Array([94, 91, 52, 251, 240, 230, 226, 35, 117, 253, 224, 210, 175, 13, 205, 120, 155, 214, 7, 169, 66, 62, 206, 50, 188, 40, 29, 122, 40, 250, 54, 18]);
+ * const mySeededAccount = new Account({seed: seed});
  *
  * // Create an account from an existing private key
- * let myExistingAccount = new Account({privateKey: 'myExistingPrivateKey'})
+ * const myExistingAccount = new Account({privateKey: 'myExistingPrivateKey'})
  *
  * // Sign a message
- * let hello_world = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
- * let signature = myRandomAccount.sign(hello_world)
+ * const hello_world = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
+ * const signature = myRandomAccount.sign(hello_world)
  *
  * // Verify a signature
  * myRandomAccount.verify(hello_world, signature)
@@ -63,11 +63,11 @@
    * Attempts to create an account from a private key ciphertext
    * @param {PrivateKeyCiphertext | string} ciphertext
    * @param {string} password
-   * @returns {PrivateKey | Error}
+   * @returns {PrivateKey}
    *
    * @example
-   * let ciphertext = PrivateKey.newEncrypted("password");
-   * let account = Account.fromCiphertext(ciphertext, "password");
+   * const ciphertext = PrivateKey.newEncrypted("password");
+   * const account = Account.fromCiphertext(ciphertext, "password");
    */
   public static fromCiphertext(ciphertext: PrivateKeyCiphertext | string, password: string) {
     try {
@@ -111,8 +111,8 @@
    * @returns {PrivateKeyCiphertext}
    *
    * @example
-   * let account = new Account();
-   * let ciphertext = account.encryptAccount("password");
+   * const account = new Account();
+   * const ciphertext = account.encryptAccount("password");
    */
   encryptAccount(password: string) {
     return this._privateKey.toCiphertext(password);
@@ -124,8 +124,8 @@
    * @returns {Record}
    *
    * @example
-   * let account = new Account();
-   * let record = account.decryptRecord("record1ciphertext");
+   * const account = new Account();
+   * const record = account.decryptRecord("record1ciphertext");
    */
   decryptRecord(ciphertext: string) {
     return this._viewKey.decrypt(ciphertext);
@@ -137,8 +137,8 @@
    * @returns {Record[]}
    *
    * @example
-   * let account = new Account();
-   * let record = account.decryptRecords(["record1ciphertext", "record2ciphertext"]);
+   * const account = new Account();
+   * const record = account.decryptRecords(["record1ciphertext", "record2ciphertext"]);
    */
   decryptRecords(ciphertexts: string[]) {
     return ciphertexts.map((ciphertext) => this._viewKey.decrypt(ciphertext));
@@ -151,12 +151,12 @@
    *
    * @example
    * // Create a connection to the Aleo network and an account
-   * let connection = new NodeConnection("vm.aleo.org/api");
-   * let account = Account.fromCiphertext("ciphertext", "password");
+   * const connection = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+   * const account = Account.fromCiphertext("ciphertext", "password");
    *
    * // Get a record from the network
-   * let record = connection.getBlock(1234);
-   * let recordCipherText = record.transactions[0].execution.transitions[0].id;
+   * const record = connection.getBlock(1234);
+   * const recordCipherText = record.transactions[0].execution.transitions[0].id;
    *
    * // Check if the account owns the record
    * if account.ownsRecord(recordCipherText) {
@@ -189,8 +189,8 @@
    * @returns {Signature}
    *
    * @example
-   * let account = new Account();
-   * let message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
+   * const account = new Account();
+   * const message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
    * account.sign(message);
    */
   sign(message: Uint8Array) {
@@ -205,13 +205,14 @@
    * @returns {boolean}
    *
    * @example
-   * let account = new Account();
-   * let message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
-   * let signature = account.sign(message);
+   * const account = new Account();
+   * const message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
+   * const signature = account.sign(message);
    * account.verify(message, signature);
    */
   verify(message: Uint8Array, signature: Signature) {
     return this._address.verify(message, signature);
   }
+
 }
-
+
\ No newline at end of file diff --git a/sdk/docs/data/search.json b/sdk/docs/data/search.json index 1e166d79c..dce00df90 100644 --- a/sdk/docs/data/search.json +++ b/sdk/docs/data/search.json @@ -1 +1 @@ -{"list":[{"title":"Account","link":"Account"},{"title":"Account.fromCiphertext","link":"Account ▸ fromCiphertext","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account.fromCiphertext","link":"Account ▸ fromCiphertext","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#decryptRecord","link":"Account ▸ decryptRecord","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#decryptRecord","link":"Account ▸ decryptRecord","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#decryptRecords","link":"Account ▸ decryptRecords","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#decryptRecords","link":"Account ▸ decryptRecords","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#encryptAccount","link":"Account ▸ encryptAccount","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#encryptAccount","link":"Account ▸ encryptAccount","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#ownsRecordCiphertext","link":"Account ▸ ownsRecordCiphertext","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#ownsRecordCiphertext","link":"Account ▸ ownsRecordCiphertext","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#sign","link":"Account ▸ sign","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#sign","link":"Account ▸ sign","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#verify","link":"Account ▸ verify","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"Account#verify","link":"Account ▸ verify","description":"Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from\nan existing private key or seed, and message signing and verification functionality.\n\nAn Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,\nand a public account address are derived. The private key lies at the root of an Aleo account. It is a highly\nsensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value\ntransfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public\naddress to which other users of Aleo can send Aleo credits and other records to. This class should only be used\nenvironments where the safety of the underlying key material can be assured."},{"title":"AleoNetworkClient","link":"AleoNetworkClient"},{"title":"AleoNetworkClient#findUnspentRecords","link":"AleoNetworkClient ▸ findUnspentRecords","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#findUnspentRecords","link":"AleoNetworkClient ▸ findUnspentRecords","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getAccount","link":"AleoNetworkClient ▸ getAccount","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getAccount","link":"AleoNetworkClient ▸ getAccount","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getBlock","link":"AleoNetworkClient ▸ getBlock","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getBlock","link":"AleoNetworkClient ▸ getBlock","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getBlockRange","link":"AleoNetworkClient ▸ getBlockRange","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getBlockRange","link":"AleoNetworkClient ▸ getBlockRange","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getLatestBlock","link":"AleoNetworkClient ▸ getLatestBlock","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getLatestBlock","link":"AleoNetworkClient ▸ getLatestBlock","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getLatestHash","link":"AleoNetworkClient ▸ getLatestHash","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getLatestHash","link":"AleoNetworkClient ▸ getLatestHash","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getLatestHeight","link":"AleoNetworkClient ▸ getLatestHeight","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getLatestHeight","link":"AleoNetworkClient ▸ getLatestHeight","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getProgram","link":"AleoNetworkClient ▸ getProgram","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getProgram","link":"AleoNetworkClient ▸ getProgram","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getStateRoot","link":"AleoNetworkClient ▸ getStateRoot","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getStateRoot","link":"AleoNetworkClient ▸ getStateRoot","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getTransaction","link":"AleoNetworkClient ▸ getTransaction","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getTransaction","link":"AleoNetworkClient ▸ getTransaction","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getTransactions","link":"AleoNetworkClient ▸ getTransactions","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getTransactions","link":"AleoNetworkClient ▸ getTransactions","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getTransactionsInMempool","link":"AleoNetworkClient ▸ getTransactionsInMempool","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getTransactionsInMempool","link":"AleoNetworkClient ▸ getTransactionsInMempool","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getTransitionId","link":"AleoNetworkClient ▸ getTransitionId","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#getTransitionId","link":"AleoNetworkClient ▸ getTransitionId","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#setAccount","link":"AleoNetworkClient ▸ setAccount","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"AleoNetworkClient#setAccount","link":"AleoNetworkClient ▸ setAccount","description":"Connection management class that encapsulates REST calls to publicly exposed endpoints of Aleo nodes.\nThe methods provided in this class provide information on the Aleo Blockchain"},{"title":"DevelopmentClient","link":"DevelopmentClient","description":"Creates a new DevelopmentClient to interact with an Aleo Development Server."}]} \ No newline at end of file +{"list":[{"title":"Account","link":"Account"},{"title":"Account.fromCiphertext","link":"fromCiphertext","description":"Attempts to create an account from a private key ciphertext"},{"title":"Account.fromCiphertext","link":"fromCiphertext","description":"Attempts to create an account from a private key ciphertext"},{"title":"Account#decryptRecord","link":"decryptRecord","description":"Decrypts a Record in ciphertext form into plaintext"},{"title":"Account#decryptRecord","link":"decryptRecord","description":"Decrypts a Record in ciphertext form into plaintext"},{"title":"Account#decryptRecords","link":"decryptRecords","description":"Decrypts an array of Records in ciphertext form into plaintext"},{"title":"Account#decryptRecords","link":"decryptRecords","description":"Decrypts an array of Records in ciphertext form into plaintext"},{"title":"Account#encryptAccount","link":"encryptAccount","description":"Encrypt the account's private key with a password"},{"title":"Account#encryptAccount","link":"encryptAccount","description":"Encrypt the account's private key with a password"},{"title":"Account#ownsRecordCiphertext","link":"ownsRecordCiphertext","description":"Determines whether the account owns a ciphertext record"},{"title":"Account#ownsRecordCiphertext","link":"ownsRecordCiphertext","description":"Determines whether the account owns a ciphertext record"},{"title":"Account#sign","link":"sign","description":"Signs a message with the account's private key.\nReturns a Signature."},{"title":"Account#sign","link":"sign","description":"Signs a message with the account's private key.\nReturns a Signature."},{"title":"Account#verify","link":"verify","description":"Verifies the Signature on a message."},{"title":"Account#verify","link":"verify","description":"Verifies the Signature on a message."},{"title":"AleoKeyProvider","link":"AleoKeyProvider"},{"title":"AleoKeyProvider#cacheKeys","link":"cacheKeys","description":"Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId\nexists in the cache using the containsKeys method prior to calling this method if overwriting is not desired."},{"title":"AleoKeyProvider#cacheKeys","link":"cacheKeys","description":"Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId\nexists in the cache using the containsKeys method prior to calling this method if overwriting is not desired."},{"title":"AleoKeyProvider#clearCache","link":"clearCache","description":"Clear the key cache"},{"title":"AleoKeyProvider#clearCache","link":"clearCache","description":"Clear the key cache"},{"title":"AleoKeyProvider#containsKeys","link":"containsKeys","description":"Determine if a keyId exists in the cache"},{"title":"AleoKeyProvider#containsKeys","link":"containsKeys","description":"Determine if a keyId exists in the cache"},{"title":"AleoKeyProvider#deleteKeys","link":"deleteKeys","description":"Delete a set of keys from the cache"},{"title":"AleoKeyProvider#deleteKeys","link":"deleteKeys","description":"Delete a set of keys from the cache"},{"title":"AleoKeyProvider#feePrivateKeys","link":"feePrivateKeys","description":"Returns the proving and verifying keys for the fee_private function in the credits.aleo program"},{"title":"AleoKeyProvider#feePrivateKeys","link":"feePrivateKeys","description":"Returns the proving and verifying keys for the fee_private function in the credits.aleo program"},{"title":"AleoKeyProvider#feePublicKeys","link":"feePublicKeys","description":"Returns the proving and verifying keys for the fee_public function in the credits.aleo program"},{"title":"AleoKeyProvider#feePublicKeys","link":"feePublicKeys","description":"Returns the proving and verifying keys for the fee_public function in the credits.aleo program"},{"title":"AleoKeyProvider#fetchRemoteKeys","link":"fetchRemoteKeys","description":"Returns the proving and verifying keys for a specified program from a specified url."},{"title":"AleoKeyProvider#fetchRemoteKeys","link":"fetchRemoteKeys","description":"Returns the proving and verifying keys for a specified program from a specified url."},{"title":"AleoKeyProvider#functionKeys","link":"functionKeys","description":"Get arbitrary function keys from a provider"},{"title":"AleoKeyProvider#functionKeys","link":"functionKeys","description":"Get arbitrary function keys from a provider"},{"title":"AleoKeyProvider#getKeys","link":"getKeys","description":"Get a set of keys from the cache"},{"title":"AleoKeyProvider#getKeys","link":"getKeys","description":"Get a set of keys from the cache"},{"title":"AleoKeyProvider#getVerifyingKey","link":"getVerifyingKey","description":"Gets a verifying key. If the verifying key is for a credits.aleo function, get it from the wasm cache otherwise"},{"title":"AleoKeyProvider#getVerifyingKey","link":"getVerifyingKey","description":"Gets a verifying key. If the verifying key is for a credits.aleo function, get it from the wasm cache otherwise"},{"title":"AleoKeyProvider#joinKeys","link":"joinKeys","description":"Returns the proving and verifying keys for the join function in the credits.aleo program"},{"title":"AleoKeyProvider#joinKeys","link":"joinKeys","description":"Returns the proving and verifying keys for the join function in the credits.aleo program"},{"title":"AleoKeyProvider#splitKeys","link":"splitKeys","description":"Returns the proving and verifying keys for the split function in the credits.aleo program"},{"title":"AleoKeyProvider#splitKeys","link":"splitKeys","description":"Returns the proving and verifying keys for the split function in the credits.aleo program"},{"title":"AleoKeyProvider#transferKeys","link":"transferKeys","description":"Returns the proving and verifying keys for the transfer functions in the credits.aleo program"},{"title":"AleoKeyProvider#transferKeys","link":"transferKeys","description":"Returns the proving and verifying keys for the transfer functions in the credits.aleo program"},{"title":"AleoKeyProvider#useCache","link":"useCache","description":"Use local memory to store keys"},{"title":"AleoKeyProvider#useCache","link":"useCache","description":"Use local memory to store keys"},{"title":"AleoKeyProviderParams","link":"AleoKeyProviderParams","description":"Create a new AleoKeyProviderParams object which implements the KeySearchParams interface. Users can optionally\nspecify a url for the proverUri & verifierUri to fetch keys via HTTP from a remote resource as well as a unique\ncacheKey to store the keys in memory for future use. If no proverUri or verifierUri is specified, a cachekey must\nbe provided."},{"title":"AleoKeyProviderParams#AleoKeyProviderParams","link":"AleoKeyProviderParams","description":"Create a new AleoKeyProviderParams object which implements the KeySearchParams interface. Users can optionally\nspecify a url for the proverUri & verifierUri to fetch keys via HTTP from a remote resource as well as a unique\ncacheKey to store the keys in memory for future use. If no proverUri or verifierUri is specified, a cachekey must\nbe provided."},{"title":"AleoNetworkClient","link":"AleoNetworkClient"},{"title":"AleoNetworkClient#findUnspentRecords","link":"findUnspentRecords","description":"Attempts to find unspent records in the Aleo blockchain for a specified private key."},{"title":"AleoNetworkClient#findUnspentRecords","link":"findUnspentRecords","description":"Attempts to find unspent records in the Aleo blockchain for a specified private key."},{"title":"AleoNetworkClient#getAccount","link":"getAccount","description":"Return the Aleo account used in the networkClient"},{"title":"AleoNetworkClient#getAccount","link":"getAccount","description":"Return the Aleo account used in the networkClient"},{"title":"AleoNetworkClient#getBlock","link":"getBlock","description":"Returns the contents of the block at the specified block height."},{"title":"AleoNetworkClient#getBlock","link":"getBlock","description":"Returns the contents of the block at the specified block height."},{"title":"AleoNetworkClient#getBlockRange","link":"getBlockRange","description":"Returns a range of blocks between the specified block heights."},{"title":"AleoNetworkClient#getBlockRange","link":"getBlockRange","description":"Returns a range of blocks between the specified block heights."},{"title":"AleoNetworkClient#getDeploymentTransactionForProgram","link":"getDeploymentTransactionForProgram","description":"Returns the deployment transaction associated with a specified program."},{"title":"AleoNetworkClient#getDeploymentTransactionForProgram","link":"getDeploymentTransactionForProgram","description":"Returns the deployment transaction associated with a specified program."},{"title":"AleoNetworkClient#getDeploymentTransactionIDForProgram","link":"getDeploymentTransactionIDForProgram","description":"Returns the deployment transaction id associated with the specified program."},{"title":"AleoNetworkClient#getDeploymentTransactionIDForProgram","link":"getDeploymentTransactionIDForProgram","description":"Returns the deployment transaction id associated with the specified program."},{"title":"AleoNetworkClient#getDeploymentTransactioObjectnForProgram","link":"getDeploymentTransactioObjectnForProgram","description":"Returns the deployment transaction associated with a specified program as a wasm object."},{"title":"AleoNetworkClient#getDeploymentTransactioObjectnForProgram","link":"getDeploymentTransactioObjectnForProgram","description":"Returns the deployment transaction associated with a specified program as a wasm object."},{"title":"AleoNetworkClient#getLatestBlock","link":"getLatestBlock","description":"Returns the contents of the latest block."},{"title":"AleoNetworkClient#getLatestBlock","link":"getLatestBlock","description":"Returns the contents of the latest block."},{"title":"AleoNetworkClient#getLatestCommittee","link":"getLatestCommittee","description":"Returns the latest committee."},{"title":"AleoNetworkClient#getLatestCommittee","link":"getLatestCommittee","description":"Returns the latest committee."},{"title":"AleoNetworkClient#getLatestHeight","link":"getLatestHeight","description":"Returns the latest block height."},{"title":"AleoNetworkClient#getLatestHeight","link":"getLatestHeight","description":"Returns the latest block height."},{"title":"AleoNetworkClient#getProgram","link":"getProgram","description":"Returns the source code of a program given a program ID."},{"title":"AleoNetworkClient#getProgram","link":"getProgram","description":"Returns the source code of a program given a program ID."},{"title":"AleoNetworkClient#getProgramImportNames","link":"getProgramImportNames","description":"Get a list of the program names that a program imports."},{"title":"AleoNetworkClient#getProgramImportNames","link":"getProgramImportNames","description":"Get a list of the program names that a program imports."},{"title":"AleoNetworkClient#getProgramImports","link":"getProgramImports","description":"Returns an object containing the source code of a program and the source code of all programs it imports"},{"title":"AleoNetworkClient#getProgramImports","link":"getProgramImports","description":"Returns an object containing the source code of a program and the source code of all programs it imports"},{"title":"AleoNetworkClient#getProgramMappingNames","link":"getProgramMappingNames","description":"Returns the names of the mappings of a program."},{"title":"AleoNetworkClient#getProgramMappingNames","link":"getProgramMappingNames","description":"Returns the names of the mappings of a program."},{"title":"AleoNetworkClient#getProgramMappingPlaintext","link":"getProgramMappingPlaintext","description":"Returns the value of a mapping as a wasm Plaintext object. Returning an\nobject in this format allows it to be converted to a Js type and for its\ninternal members to be inspected if it's a struct or array."},{"title":"AleoNetworkClient#getProgramMappingPlaintext","link":"getProgramMappingPlaintext","description":"Returns the value of a mapping as a wasm Plaintext object. Returning an\nobject in this format allows it to be converted to a Js type and for its\ninternal members to be inspected if it's a struct or array."},{"title":"AleoNetworkClient#getProgramMappingValue","link":"getProgramMappingValue","description":"Returns the value of a program's mapping for a specific key."},{"title":"AleoNetworkClient#getProgramMappingValue","link":"getProgramMappingValue","description":"Returns the value of a program's mapping for a specific key."},{"title":"AleoNetworkClient#getProgramObject","link":"getProgramObject","description":"Returns a program object from a program ID or program source code."},{"title":"AleoNetworkClient#getProgramObject","link":"getProgramObject","description":"Returns a program object from a program ID or program source code."},{"title":"AleoNetworkClient#getStateRoot","link":"getStateRoot","description":"Returns the latest state/merkle root of the Aleo blockchain."},{"title":"AleoNetworkClient#getStateRoot","link":"getStateRoot","description":"Returns the latest state/merkle root of the Aleo blockchain."},{"title":"AleoNetworkClient#getTransaction","link":"getTransaction","description":"Returns a transaction by its unique identifier."},{"title":"AleoNetworkClient#getTransaction","link":"getTransaction","description":"Returns a transaction by its unique identifier."},{"title":"AleoNetworkClient#getTransactionObject","link":"getTransactionObject","description":"Returns a transaction as a wasm object. Getting a transaction of this type will allow the ability for the inputs,\noutputs, and records to be searched for and displayed."},{"title":"AleoNetworkClient#getTransactionObject","link":"getTransactionObject","description":"Returns a transaction as a wasm object. Getting a transaction of this type will allow the ability for the inputs,\noutputs, and records to be searched for and displayed."},{"title":"AleoNetworkClient#getTransactionObjects","link":"getTransactionObjects","description":"Returns an array of transactions as wasm objects present at the specified block height."},{"title":"AleoNetworkClient#getTransactionObjects","link":"getTransactionObjects","description":"Returns an array of transactions as wasm objects present at the specified block height."},{"title":"AleoNetworkClient#getTransactionObjectsInMempool","link":"getTransactionObjectsInMempool","description":"Returns the transactions in the memory pool as wasm objects."},{"title":"AleoNetworkClient#getTransactionObjectsInMempool","link":"getTransactionObjectsInMempool","description":"Returns the transactions in the memory pool as wasm objects."},{"title":"AleoNetworkClient#getTransactions","link":"getTransactions","description":"Returns the transactions present at the specified block height."},{"title":"AleoNetworkClient#getTransactions","link":"getTransactions","description":"Returns the transactions present at the specified block height."},{"title":"AleoNetworkClient#getTransactionsInMempool","link":"getTransactionsInMempool","description":"Returns the transactions in the memory pool."},{"title":"AleoNetworkClient#getTransactionsInMempool","link":"getTransactionsInMempool","description":"Returns the transactions in the memory pool."},{"title":"AleoNetworkClient#getTransitionId","link":"getTransitionId","description":"Returns the transition ID of the transition corresponding to the ID of the input or output."},{"title":"AleoNetworkClient#getTransitionId","link":"getTransitionId","description":"Returns the transition ID of the transition corresponding to the ID of the input or output."},{"title":"AleoNetworkClient#setAccount","link":"setAccount","description":"Set an account to use in networkClient calls"},{"title":"AleoNetworkClient#setAccount","link":"setAccount","description":"Set an account to use in networkClient calls"},{"title":"AleoNetworkClient#setHost","link":"setHost","description":"Set a new host for the networkClient"},{"title":"AleoNetworkClient#setHost","link":"setHost","description":"Set a new host for the networkClient"},{"title":"AleoNetworkClient#submitSolution","link":"submitSolution","description":"Submit a solution to the Aleo network."},{"title":"AleoNetworkClient#submitSolution","link":"submitSolution","description":"Submit a solution to the Aleo network."},{"title":"AleoNetworkClient#submitTransaction","link":"submitTransaction","description":"Submit an execute or deployment transaction to the Aleo network."},{"title":"AleoNetworkClient#submitTransaction","link":"submitTransaction","description":"Submit an execute or deployment transaction to the Aleo network."},{"title":"BlockHeightSearch","link":"BlockHeightSearch"},{"title":"ExecuteOptions","link":"ExecuteOptions","description":"Represents the options for executing a transaction in the Aleo network.\nThis interface is used to specify the parameters required for building and submitting an execution transaction."},{"title":"FunctionKeyProvider","link":"FunctionKeyProvider","description":"KeyProvider interface. Enables the retrieval of public proving and verifying keys for Aleo Programs."},{"title":"FunctionKeyProvider#bondPublicKeys","link":"bondPublicKeys","description":"Get bond_public function keys from the credits.aleo program"},{"title":"FunctionKeyProvider#bondValidatorKeys","link":"bondValidatorKeys","description":"Get bond_validator function keys from the credits.aleo program"},{"title":"FunctionKeyProvider#cacheKeys","link":"cacheKeys","description":"Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId\nexists in the cache using the containsKeys method prior to calling this method if overwriting is not desired."},{"title":"FunctionKeyProvider#claimUnbondPublicKeys","link":"claimUnbondPublicKeys","description":"Get unbond_public function keys from the credits.aleo program"},{"title":"FunctionKeyProvider#feePrivateKeys","link":"feePrivateKeys","description":"Get fee_private function keys from the credits.aleo program"},{"title":"FunctionKeyProvider#feePublicKeys","link":"feePublicKeys","description":"Get fee_public function keys from the credits.aleo program"},{"title":"FunctionKeyProvider#functionKeys","link":"functionKeys","description":"Get arbitrary function keys from a provider"},{"title":"FunctionKeyProvider#joinKeys","link":"joinKeys","description":"Get join function keys from the credits.aleo program"},{"title":"FunctionKeyProvider#splitKeys","link":"splitKeys","description":"Get split function keys from the credits.aleo program"},{"title":"FunctionKeyProvider#transferKeys","link":"transferKeys","description":"Get keys for a variant of the transfer function from the credits.aleo program"},{"title":"FunctionKeyProvider#unBondPublicKeys","link":"unBondPublicKeys","description":"Get unbond_public function keys from the credits.aleo program"},{"title":"KeySearchParams","link":"KeySearchParams","description":"Interface for record search parameters. This allows for arbitrary search parameters to be passed to record provider\nimplementations."},{"title":"NetworkRecordProvider","link":"NetworkRecordProvider"},{"title":"NetworkRecordProvider#findCreditsRecord","link":"findCreditsRecord","description":"Find a credit record with a given number of microcredits by via the official Aleo API"},{"title":"NetworkRecordProvider#findCreditsRecord","link":"findCreditsRecord","description":"Find a credit record with a given number of microcredits by via the official Aleo API"},{"title":"NetworkRecordProvider#findCreditsRecords","link":"findCreditsRecords","description":"Find a list of credit records with a given number of microcredits by via the official Aleo API"},{"title":"NetworkRecordProvider#findCreditsRecords","link":"findCreditsRecords","description":"Find a list of credit records with a given number of microcredits by via the official Aleo API"},{"title":"NetworkRecordProvider#findRecord","link":"findRecord","description":"Find an arbitrary record. WARNING: This function is not implemented yet and will throw an error."},{"title":"NetworkRecordProvider#findRecord","link":"findRecord","description":"Find an arbitrary record. WARNING: This function is not implemented yet and will throw an error."},{"title":"NetworkRecordProvider#findRecords","link":"findRecords","description":"Find multiple arbitrary records. WARNING: This function is not implemented yet and will throw an error."},{"title":"NetworkRecordProvider#findRecords","link":"findRecords","description":"Find multiple arbitrary records. WARNING: This function is not implemented yet and will throw an error."},{"title":"NetworkRecordProvider#setAccount","link":"setAccount","description":"Set the account used to search for records"},{"title":"NetworkRecordProvider#setAccount","link":"setAccount","description":"Set the account used to search for records"},{"title":"OfflineKeyProvider","link":"OfflineKeyProvider"},{"title":"OfflineKeyProvider#bondPublicKeys","link":"bondPublicKeys","description":"Get bond_public function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#bondPublicKeys","link":"bondPublicKeys","description":"Get bond_public function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#bondValidatorKeys","link":"bondValidatorKeys","description":"Get bond_validator function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#bondValidatorKeys","link":"bondValidatorKeys","description":"Get bond_validator function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#cacheKeys","link":"cacheKeys","description":"Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId\nexists in the cache using the containsKeys method prior to calling this method if overwriting is not desired."},{"title":"OfflineKeyProvider#cacheKeys","link":"cacheKeys","description":"Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId\nexists in the cache using the containsKeys method prior to calling this method if overwriting is not desired."},{"title":"OfflineKeyProvider#claimUnbondPublicKeys","link":"claimUnbondPublicKeys","description":"Get unbond_public function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#claimUnbondPublicKeys","link":"claimUnbondPublicKeys","description":"Get unbond_public function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#feePrivateKeys","link":"feePrivateKeys","description":"Get fee_private function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#feePrivateKeys","link":"feePrivateKeys","description":"Get fee_private function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#feePublicKeys","link":"feePublicKeys","description":"Get fee_public function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#feePublicKeys","link":"feePublicKeys","description":"Get fee_public function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#functionKeys","link":"functionKeys","description":"Get arbitrary function key from the offline key provider cache."},{"title":"OfflineKeyProvider#functionKeys","link":"functionKeys","description":"Get arbitrary function key from the offline key provider cache."},{"title":"OfflineKeyProvider#insertBondPublicKeys","link":"insertBondPublicKeys","description":"Insert the proving and verifying keys for the bond_public function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for bond_public before inserting them into the cache."},{"title":"OfflineKeyProvider#insertBondPublicKeys","link":"insertBondPublicKeys","description":"Insert the proving and verifying keys for the bond_public function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for bond_public before inserting them into the cache."},{"title":"OfflineKeyProvider#insertClaimUnbondPublicKeys","link":"insertClaimUnbondPublicKeys","description":"Insert the proving and verifying keys for the claim_unbond_public function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for claim_unbond_public before inserting them into the cache."},{"title":"OfflineKeyProvider#insertClaimUnbondPublicKeys","link":"insertClaimUnbondPublicKeys","description":"Insert the proving and verifying keys for the claim_unbond_public function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for claim_unbond_public before inserting them into the cache."},{"title":"OfflineKeyProvider#insertFeePrivateKeys","link":"insertFeePrivateKeys","description":"Insert the proving and verifying keys for the fee_private function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for fee_private before inserting them into the cache."},{"title":"OfflineKeyProvider#insertFeePrivateKeys","link":"insertFeePrivateKeys","description":"Insert the proving and verifying keys for the fee_private function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for fee_private before inserting them into the cache."},{"title":"OfflineKeyProvider#insertFeePublicKeys","link":"insertFeePublicKeys","description":"Insert the proving and verifying keys for the fee_public function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for fee_public before inserting them into the cache."},{"title":"OfflineKeyProvider#insertFeePublicKeys","link":"insertFeePublicKeys","description":"Insert the proving and verifying keys for the fee_public function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for fee_public before inserting them into the cache."},{"title":"OfflineKeyProvider#insertJoinKeys","link":"insertJoinKeys","description":"Insert the proving and verifying keys for the join function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for join before inserting them into the cache."},{"title":"OfflineKeyProvider#insertJoinKeys","link":"insertJoinKeys","description":"Insert the proving and verifying keys for the join function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for join before inserting them into the cache."},{"title":"OfflineKeyProvider#insertSetValidatorStateKeys","link":"insertSetValidatorStateKeys","description":"Insert the proving and verifying keys for the set_validator_state function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for set_validator_state before inserting them into the cache."},{"title":"OfflineKeyProvider#insertSetValidatorStateKeys","link":"insertSetValidatorStateKeys","description":"Insert the proving and verifying keys for the set_validator_state function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for set_validator_state before inserting them into the cache."},{"title":"OfflineKeyProvider#insertSplitKeys","link":"insertSplitKeys","description":"Insert the proving and verifying keys for the split function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for split before inserting them into the cache."},{"title":"OfflineKeyProvider#insertSplitKeys","link":"insertSplitKeys","description":"Insert the proving and verifying keys for the split function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for split before inserting them into the cache."},{"title":"OfflineKeyProvider#insertTransferPrivateKeys","link":"insertTransferPrivateKeys","description":"Insert the proving and verifying keys for the transfer_private function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for transfer_private before inserting them into the cache."},{"title":"OfflineKeyProvider#insertTransferPrivateKeys","link":"insertTransferPrivateKeys","description":"Insert the proving and verifying keys for the transfer_private function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for transfer_private before inserting them into the cache."},{"title":"OfflineKeyProvider#insertTransferPrivateToPublicKeys","link":"insertTransferPrivateToPublicKeys","description":"Insert the proving and verifying keys for the transfer_private_to_public function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for transfer_private_to_public before inserting them into the cache."},{"title":"OfflineKeyProvider#insertTransferPrivateToPublicKeys","link":"insertTransferPrivateToPublicKeys","description":"Insert the proving and verifying keys for the transfer_private_to_public function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for transfer_private_to_public before inserting them into the cache."},{"title":"OfflineKeyProvider#insertTransferPublicKeys","link":"insertTransferPublicKeys","description":"Insert the proving and verifying keys for the transfer_public function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for transfer_public before inserting them into the cache."},{"title":"OfflineKeyProvider#insertTransferPublicKeys","link":"insertTransferPublicKeys","description":"Insert the proving and verifying keys for the transfer_public function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for transfer_public before inserting them into the cache."},{"title":"OfflineKeyProvider#insertTransferPublicToPrivateKeys","link":"insertTransferPublicToPrivateKeys","description":"Insert the proving and verifying keys for the transfer_public_to_private function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for transfer_public_to_private before inserting them into the cache."},{"title":"OfflineKeyProvider#insertTransferPublicToPrivateKeys","link":"insertTransferPublicToPrivateKeys","description":"Insert the proving and verifying keys for the transfer_public_to_private function into the cache. Only the proving key needs\nto be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check\nthat the keys match the expected checksum for transfer_public_to_private before inserting them into the cache."},{"title":"OfflineKeyProvider#joinKeys","link":"joinKeys","description":"Get join function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#joinKeys","link":"joinKeys","description":"Get join function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#splitKeys","link":"splitKeys","description":"Get split function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#splitKeys","link":"splitKeys","description":"Get split function keys from the credits.aleo program. The keys must be cached prior to calling this\nmethod for it to work."},{"title":"OfflineKeyProvider#transferKeys","link":"transferKeys","description":"Get keys for a variant of the transfer function from the credits.aleo program."},{"title":"OfflineKeyProvider#transferKeys","link":"transferKeys","description":"Get keys for a variant of the transfer function from the credits.aleo program."},{"title":"OfflineKeyProvider#unBondPublicKeys","link":"unBondPublicKeys","description":"Get unbond_public function keys from the credits.aleo program"},{"title":"OfflineKeyProvider#unBondPublicKeys","link":"unBondPublicKeys","description":"Get unbond_public function keys from the credits.aleo program"},{"title":"OfflineKeyProvider#verifyCreditsKeys","link":"verifyCreditsKeys","description":"Determines if the keys for a given credits function match the expected keys."},{"title":"OfflineKeyProvider#verifyCreditsKeys","link":"verifyCreditsKeys","description":"Determines if the keys for a given credits function match the expected keys."},{"title":"OfflineSearchParams","link":"OfflineSearchParams","description":"Create a new OfflineSearchParams instance."},{"title":"OfflineSearchParams.bondPublicKeyParams","link":"bondPublicKeyParams","description":"Create a new OfflineSearchParams instance for the bond_public function of the credits.aleo program."},{"title":"OfflineSearchParams.bondPublicKeyParams","link":"bondPublicKeyParams","description":"Create a new OfflineSearchParams instance for the bond_public function of the credits.aleo program."},{"title":"OfflineSearchParams.bondValidatorKeyParams","link":"bondValidatorKeyParams","description":"Create a new OfflineSearchParams instance for the bond_validator function of the credits.aleo program."},{"title":"OfflineSearchParams.bondValidatorKeyParams","link":"bondValidatorKeyParams","description":"Create a new OfflineSearchParams instance for the bond_validator function of the credits.aleo program."},{"title":"OfflineSearchParams.claimUnbondPublicKeyParams","link":"claimUnbondPublicKeyParams","description":"Create a new OfflineSearchParams instance for the claim_unbond_public function of the"},{"title":"OfflineSearchParams.claimUnbondPublicKeyParams","link":"claimUnbondPublicKeyParams","description":"Create a new OfflineSearchParams instance for the claim_unbond_public function of the"},{"title":"OfflineSearchParams.feePrivateKeyParams","link":"feePrivateKeyParams","description":"Create a new OfflineSearchParams instance for the fee_private function of the credits.aleo program."},{"title":"OfflineSearchParams.feePrivateKeyParams","link":"feePrivateKeyParams","description":"Create a new OfflineSearchParams instance for the fee_private function of the credits.aleo program."},{"title":"OfflineSearchParams.feePublicKeyParams","link":"feePublicKeyParams","description":"Create a new OfflineSearchParams instance for the fee_public function of the credits.aleo program."},{"title":"OfflineSearchParams.feePublicKeyParams","link":"feePublicKeyParams","description":"Create a new OfflineSearchParams instance for the fee_public function of the credits.aleo program."},{"title":"OfflineSearchParams.inclusionKeyParams","link":"inclusionKeyParams","description":"Create a new OfflineSearchParams instance for the inclusion prover function."},{"title":"OfflineSearchParams.inclusionKeyParams","link":"inclusionKeyParams","description":"Create a new OfflineSearchParams instance for the inclusion prover function."},{"title":"OfflineSearchParams.joinKeyParams","link":"joinKeyParams","description":"Create a new OfflineSearchParams instance for the join function of the credits.aleo program."},{"title":"OfflineSearchParams.joinKeyParams","link":"joinKeyParams","description":"Create a new OfflineSearchParams instance for the join function of the credits.aleo program."},{"title":"OfflineSearchParams.setValidatorStateKeyParams","link":"setValidatorStateKeyParams","description":"Create a new OfflineSearchParams instance for the set_validator_state function of the credits.aleo program."},{"title":"OfflineSearchParams.setValidatorStateKeyParams","link":"setValidatorStateKeyParams","description":"Create a new OfflineSearchParams instance for the set_validator_state function of the credits.aleo program."},{"title":"OfflineSearchParams.splitKeyParams","link":"splitKeyParams","description":"Create a new OfflineSearchParams instance for the split function of the credits.aleo program."},{"title":"OfflineSearchParams.splitKeyParams","link":"splitKeyParams","description":"Create a new OfflineSearchParams instance for the split function of the credits.aleo program."},{"title":"OfflineSearchParams.transferPrivateKeyParams","link":"transferPrivateKeyParams","description":"Create a new OfflineSearchParams instance for the transfer_private function of the credits.aleo program."},{"title":"OfflineSearchParams.transferPrivateKeyParams","link":"transferPrivateKeyParams","description":"Create a new OfflineSearchParams instance for the transfer_private function of the credits.aleo program."},{"title":"OfflineSearchParams.transferPrivateToPublicKeyParams","link":"transferPrivateToPublicKeyParams","description":"Create a new OfflineSearchParams instance for the transfer_private_to_public function of the credits.aleo program."},{"title":"OfflineSearchParams.transferPrivateToPublicKeyParams","link":"transferPrivateToPublicKeyParams","description":"Create a new OfflineSearchParams instance for the transfer_private_to_public function of the credits.aleo program."},{"title":"OfflineSearchParams.transferPublicAsSignerKeyParams","link":"transferPublicAsSignerKeyParams","description":"Create a new OfflineSearchParams instance for the transfer_public_as_signer function of the credits.aleo program."},{"title":"OfflineSearchParams.transferPublicAsSignerKeyParams","link":"transferPublicAsSignerKeyParams","description":"Create a new OfflineSearchParams instance for the transfer_public_as_signer function of the credits.aleo program."},{"title":"OfflineSearchParams.transferPublicKeyParams","link":"transferPublicKeyParams","description":"Create a new OfflineSearchParams instance for the transfer_public function of the credits.aleo program."},{"title":"OfflineSearchParams.transferPublicKeyParams","link":"transferPublicKeyParams","description":"Create a new OfflineSearchParams instance for the transfer_public function of the credits.aleo program."},{"title":"OfflineSearchParams.transferPublicToPrivateKeyParams","link":"transferPublicToPrivateKeyParams","description":"Create a new OfflineSearchParams instance for the transfer_public_to_private function of the credits.aleo program."},{"title":"OfflineSearchParams.transferPublicToPrivateKeyParams","link":"transferPublicToPrivateKeyParams","description":"Create a new OfflineSearchParams instance for the transfer_public_to_private function of the credits.aleo program."},{"title":"OfflineSearchParams.unbondPublicKeyParams","link":"unbondPublicKeyParams","description":"Create a new OfflineSearchParams instance for the unbond_public function of the credits.aleo program."},{"title":"OfflineSearchParams.unbondPublicKeyParams","link":"unbondPublicKeyParams","description":"Create a new OfflineSearchParams instance for the unbond_public function of the credits.aleo program."},{"title":"OfflineSearchParams#OfflineSearchParams","link":"OfflineSearchParams","description":"Create a new OfflineSearchParams instance."},{"title":"ProgramManager","link":"ProgramManager","description":"Create a new instance of the ProgramManager"},{"title":"ProgramManager#bondPublic","link":"bondPublic","description":"Bond credits to validator."},{"title":"ProgramManager#bondPublic","link":"bondPublic","description":"Bond credits to validator."},{"title":"ProgramManager#bondValidator","link":"bondValidator","description":"Build transaction to bond a validator."},{"title":"ProgramManager#bondValidator","link":"bondValidator","description":"Build transaction to bond a validator."},{"title":"ProgramManager#buildBondPublicTransaction","link":"buildBondPublicTransaction","description":"Build transaction to bond credits to a validator for later submission to the Aleo Network"},{"title":"ProgramManager#buildBondPublicTransaction","link":"buildBondPublicTransaction","description":"Build transaction to bond credits to a validator for later submission to the Aleo Network"},{"title":"ProgramManager#buildBondValidatorTransaction","link":"buildBondValidatorTransaction","description":"Build a bond_validator transaction for later submission to the Aleo Network."},{"title":"ProgramManager#buildBondValidatorTransaction","link":"buildBondValidatorTransaction","description":"Build a bond_validator transaction for later submission to the Aleo Network."},{"title":"ProgramManager#buildClaimUnbondPublicTransaction","link":"buildClaimUnbondPublicTransaction","description":"Build a transaction to claim unbonded public credits in the Aleo network."},{"title":"ProgramManager#buildClaimUnbondPublicTransaction","link":"buildClaimUnbondPublicTransaction","description":"Build a transaction to claim unbonded public credits in the Aleo network."},{"title":"ProgramManager#buildExecutionTransaction","link":"buildExecutionTransaction","description":"Builds an execution transaction for submission to the Aleo network."},{"title":"ProgramManager#buildExecutionTransaction","link":"buildExecutionTransaction","description":"Builds an execution transaction for submission to the Aleo network."},{"title":"ProgramManager#buildSetValidatorStateTransaction","link":"buildSetValidatorStateTransaction","description":"Build a set_validator_state transaction for later usage.\n\nThis function allows a validator to set their state to be either opened or closed to new stakers.\nWhen the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator.\nWhen the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond.\n\nThis function serves two primary purposes:\n1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers.\n2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them."},{"title":"ProgramManager#buildSetValidatorStateTransaction","link":"buildSetValidatorStateTransaction","description":"Build a set_validator_state transaction for later usage.\n\nThis function allows a validator to set their state to be either opened or closed to new stakers.\nWhen the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator.\nWhen the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond.\n\nThis function serves two primary purposes:\n1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers.\n2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them."},{"title":"ProgramManager#buildTransferPublicAsSignerTransaction","link":"buildTransferPublicAsSignerTransaction","description":"Build a transfer_public_as_signer transaction to transfer credits to another account for later submission to the Aleo network"},{"title":"ProgramManager#buildTransferPublicAsSignerTransaction","link":"buildTransferPublicAsSignerTransaction","description":"Build a transfer_public_as_signer transaction to transfer credits to another account for later submission to the Aleo network"},{"title":"ProgramManager#buildTransferPublicTransaction","link":"buildTransferPublicTransaction","description":"Build a transfer_public transaction to transfer credits to another account for later submission to the Aleo network"},{"title":"ProgramManager#buildTransferPublicTransaction","link":"buildTransferPublicTransaction","description":"Build a transfer_public transaction to transfer credits to another account for later submission to the Aleo network"},{"title":"ProgramManager#buildTransferTransaction","link":"buildTransferTransaction","description":"Build a transaction to transfer credits to another account for later submission to the Aleo network"},{"title":"ProgramManager#buildTransferTransaction","link":"buildTransferTransaction","description":"Build a transaction to transfer credits to another account for later submission to the Aleo network"},{"title":"ProgramManager#buildUnbondPublicTransaction","link":"buildUnbondPublicTransaction","description":"Build a transaction to unbond public credits from a validator in the Aleo network."},{"title":"ProgramManager#buildUnbondPublicTransaction","link":"buildUnbondPublicTransaction","description":"Build a transaction to unbond public credits from a validator in the Aleo network."},{"title":"ProgramManager#claimUnbondPublic","link":"claimUnbondPublic","description":"Claim unbonded credits. If credits have been unbonded by the account executing this function, this method will\nclaim them and add them to the public balance of the account."},{"title":"ProgramManager#claimUnbondPublic","link":"claimUnbondPublic","description":"Claim unbonded credits. If credits have been unbonded by the account executing this function, this method will\nclaim them and add them to the public balance of the account."},{"title":"ProgramManager#createProgramFromSource","link":"createProgramFromSource","description":"Create a program object from a program's source code"},{"title":"ProgramManager#createProgramFromSource","link":"createProgramFromSource","description":"Create a program object from a program's source code"},{"title":"ProgramManager#creditsProgram","link":"creditsProgram","description":"Get the credits program object"},{"title":"ProgramManager#creditsProgram","link":"creditsProgram","description":"Get the credits program object"},{"title":"ProgramManager#deploy","link":"deploy","description":"Deploy an Aleo program to the Aleo network"},{"title":"ProgramManager#deploy","link":"deploy","description":"Deploy an Aleo program to the Aleo network"},{"title":"ProgramManager#execute","link":"execute","description":"Builds an execution transaction for submission to the Aleo network."},{"title":"ProgramManager#execute","link":"execute","description":"Builds an execution transaction for submission to the Aleo network."},{"title":"ProgramManager#join","link":"join","description":"Join two credits records into a single credits record"},{"title":"ProgramManager#join","link":"join","description":"Join two credits records into a single credits record"},{"title":"ProgramManager#ProgramManager","link":"ProgramManager","description":"Create a new instance of the ProgramManager"},{"title":"ProgramManager#run","link":"run","description":"Run an Aleo program in offline mode"},{"title":"ProgramManager#run","link":"run","description":"Run an Aleo program in offline mode"},{"title":"ProgramManager#setAccount","link":"setAccount","description":"Set the account to use for transaction submission to the Aleo network"},{"title":"ProgramManager#setAccount","link":"setAccount","description":"Set the account to use for transaction submission to the Aleo network"},{"title":"ProgramManager#setHost","link":"setHost","description":"Set the host peer to use for transaction submission to the Aleo network"},{"title":"ProgramManager#setHost","link":"setHost","description":"Set the host peer to use for transaction submission to the Aleo network"},{"title":"ProgramManager#setKeyProvider","link":"setKeyProvider","description":"Set the key provider that provides the proving and verifying keys for programs"},{"title":"ProgramManager#setKeyProvider","link":"setKeyProvider","description":"Set the key provider that provides the proving and verifying keys for programs"},{"title":"ProgramManager#setRecordProvider","link":"setRecordProvider","description":"Set the record provider that provides records for transactions"},{"title":"ProgramManager#setRecordProvider","link":"setRecordProvider","description":"Set the record provider that provides records for transactions"},{"title":"ProgramManager#setValidatorState","link":"setValidatorState","description":"Submit a set_validator_state transaction to the Aleo Network.\n\nThis function allows a validator to set their state to be either opened or closed to new stakers.\nWhen the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator.\nWhen the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond.\n\nThis function serves two primary purposes:\n1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers.\n2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them."},{"title":"ProgramManager#setValidatorState","link":"setValidatorState","description":"Submit a set_validator_state transaction to the Aleo Network.\n\nThis function allows a validator to set their state to be either opened or closed to new stakers.\nWhen the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator.\nWhen the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond.\n\nThis function serves two primary purposes:\n1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers.\n2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them."},{"title":"ProgramManager#split","link":"split","description":"Split credits into two new credits records"},{"title":"ProgramManager#split","link":"split","description":"Split credits into two new credits records"},{"title":"ProgramManager#synthesizeKeys","link":"synthesizeKeys","description":"Pre-synthesize proving and verifying keys for a program"},{"title":"ProgramManager#synthesizeKeys","link":"synthesizeKeys","description":"Pre-synthesize proving and verifying keys for a program"},{"title":"ProgramManager#transfer","link":"transfer","description":"Transfer credits to another account"},{"title":"ProgramManager#transfer","link":"transfer","description":"Transfer credits to another account"},{"title":"ProgramManager#unbondPublic","link":"unbondPublic","description":"Unbond a specified amount of staked credits."},{"title":"ProgramManager#unbondPublic","link":"unbondPublic","description":"Unbond a specified amount of staked credits."},{"title":"ProgramManager#verifyExecution","link":"verifyExecution","description":"Verify a proof of execution from an offline execution"},{"title":"ProgramManager#verifyExecution","link":"verifyExecution","description":"Verify a proof of execution from an offline execution"},{"title":"ProgramManager#verifyProgram","link":"verifyProgram","description":"Verify a program is valid"},{"title":"ProgramManager#verifyProgram","link":"verifyProgram","description":"Verify a program is valid"},{"title":"RecordProvider","link":"RecordProvider","description":"Interface for a record provider. A record provider is used to find records for use in deployment and execution\ntransactions on the Aleo Network. A default implementation is provided by the NetworkRecordProvider class. However,\na custom implementation can be provided (say if records are synced locally to a database from the network) by\nimplementing this interface."},{"title":"RecordProvider#findCreditsRecord","link":"findCreditsRecord","description":"Find a credits.aleo record with a given number of microcredits from the chosen provider"},{"title":"RecordProvider#findCreditsRecords","link":"findCreditsRecords","description":"Find a list of credit.aleo records with a given number of microcredits from the chosen provider"},{"title":"RecordProvider#findRecord","link":"findRecord","description":"Find an arbitrary record"},{"title":"RecordProvider#findRecords","link":"findRecords","description":"Find multiple records from arbitrary programs"},{"title":"RecordSearchParams","link":"RecordSearchParams","description":"Interface for record search parameters. This allows for arbitrary search parameters to be passed to record provider\nimplementations."}]} \ No newline at end of file diff --git a/sdk/docs/function-key-provider.ts.html b/sdk/docs/function-key-provider.ts.html new file mode 100644 index 000000000..8236f7bfe --- /dev/null +++ b/sdk/docs/function-key-provider.ts.html @@ -0,0 +1,617 @@ +Source: function-key-provider.ts
On this page

function-key-provider.ts

import {
+    CREDITS_PROGRAM_KEYS,
+    KEY_STORE,
+    Key,
+    PRIVATE_TRANSFER,
+    PRIVATE_TO_PUBLIC_TRANSFER,
+    PUBLIC_TRANSFER,
+    PUBLIC_TO_PRIVATE_TRANSFER,
+    PUBLIC_TRANSFER_AS_SIGNER,
+} from "./constants";
+
+import {
+    ProvingKey,
+    VerifyingKey,
+} from "./wasm";
+
+import { get } from "./utils";
+
+type FunctionKeyPair = [ProvingKey, VerifyingKey];
+type CachedKeyPair = [Uint8Array, Uint8Array];
+type AleoKeyProviderInitParams = {
+    proverUri?: string;
+    verifierUri?: string;
+    cacheKey?: string;
+};
+
+/**
+ * Interface for record search parameters. This allows for arbitrary search parameters to be passed to record provider
+ * implementations.
+ */
+interface KeySearchParams {
+    [key: string]: any; // This allows for arbitrary keys with any type values
+}
+
+/**
+ * AleoKeyProviderParams search parameter for the AleoKeyProvider. It allows for the specification of a proverUri and
+ * verifierUri to fetch keys via HTTP from a remote resource as well as a unique cacheKey to store the keys in memory.
+ */
+class AleoKeyProviderParams implements KeySearchParams {
+    name: string | undefined;
+    proverUri: string | undefined;
+    verifierUri: string | undefined;
+    cacheKey: string | undefined;
+
+    /**
+     * Create a new AleoKeyProviderParams object which implements the KeySearchParams interface. Users can optionally
+     * specify a url for the proverUri & verifierUri to fetch keys via HTTP from a remote resource as well as a unique
+     * cacheKey to store the keys in memory for future use. If no proverUri or verifierUri is specified, a cachekey must
+     * be provided.
+     *
+     * @param { AleoKeyProviderInitParams } params - Optional search parameters
+     */
+    constructor(params: {proverUri?: string, verifierUri?: string, cacheKey?: string, name?: string}) {
+        this.proverUri = params.proverUri;
+        this.verifierUri = params.verifierUri;
+        this.cacheKey = params.cacheKey;
+        this.name = params.name;
+    }
+}
+
+/**
+ * KeyProvider interface. Enables the retrieval of public proving and verifying keys for Aleo Programs.
+ */
+interface FunctionKeyProvider {
+    /**
+     * Get bond_public function keys from the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the bond_public function
+     */
+    bondPublicKeys(): Promise<FunctionKeyPair>;
+
+    /**
+     * Get bond_validator function keys from the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the bond_validator function
+     */
+    bondValidatorKeys(): Promise<FunctionKeyPair>;
+
+    /**
+     * Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId
+     * exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.
+     *
+     * @param {string} keyId access key for the cache
+     * @param {FunctionKeyPair} keys keys to cache
+     */
+    cacheKeys(keyId: string, keys: FunctionKeyPair): void;
+
+    /**
+     * Get unbond_public function keys from the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the unbond_public function
+     */
+    claimUnbondPublicKeys(): Promise<FunctionKeyPair>;
+
+    /**
+     * Get arbitrary function keys from a provider
+     *
+     * @param {KeySearchParams | undefined} params - Optional search parameters for the key provider
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified program
+     *
+     * @example
+     * // Create a search object which implements the KeySearchParams interface
+     * class IndexDbSearch implements KeySearchParams {
+     *     db: string
+     *     keyId: string
+     *     constructor(params: {db: string, keyId: string}) {
+     *         this.db = params.db;
+     *         this.keyId = params.keyId;
+     *     }
+     * }
+     *
+     * // Create a new object which implements the KeyProvider interface
+     * class IndexDbKeyProvider implements FunctionKeyProvider {
+     *     async functionKeys(params: KeySearchParams): Promise<FunctionKeyPair> {
+     *         return new Promise((resolve, reject) => {
+     *             const request = indexedDB.open(params.db, 1);
+     *
+     *             request.onupgradeneeded = function(e) {
+     *                 const db = e.target.result;
+     *                 if (!db.objectStoreNames.contains('keys')) {
+     *                     db.createObjectStore('keys', { keyPath: 'id' });
+     *                 }
+     *             };
+     *
+     *             request.onsuccess = function(e) {
+     *                 const db = e.target.result;
+     *                 const transaction = db.transaction(["keys"], "readonly");
+     *                 const store = transaction.objectStore("keys");
+     *                 const request = store.get(params.keyId);
+     *                 request.onsuccess = function(e) {
+     *                     if (request.result) {
+     *                         resolve(request.result as FunctionKeyPair);
+     *                     } else {
+     *                         reject(new Error("Key not found"));
+     *                     }
+     *                 };
+     *                 request.onerror = function(e) { reject(new Error("Error fetching key")); };
+     *             };
+     *
+     *             request.onerror = function(e) { reject(new Error("Error opening database")); };
+     *         });
+     *     }
+     *
+     *     // implement the other methods...
+     * }
+     *
+     *
+     * const keyProvider = new AleoKeyProvider();
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for value transfers
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+     *
+     * // Keys can also be fetched manually
+     * const searchParams = new IndexDbSearch({db: "keys", keyId: "credits.aleo:transferPrivate"});
+     * const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.functionKeys(searchParams);
+     */
+    functionKeys(params?: KeySearchParams): Promise<FunctionKeyPair>;
+
+    /**
+     * Get fee_private function keys from the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    feePrivateKeys(): Promise<FunctionKeyPair>;
+
+    /**
+     * Get fee_public function keys from the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    feePublicKeys(): Promise<FunctionKeyPair>;
+
+    /**
+     * Get join function keys from the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    joinKeys(): Promise<FunctionKeyPair>;
+
+    /**
+     * Get split function keys from the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    splitKeys(): Promise<FunctionKeyPair>;
+
+    /**
+     * Get keys for a variant of the transfer function from the credits.aleo program
+     *
+     * @param {string} visibility Visibility of the transfer function (private, public, privateToPublic, publicToPrivate)
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified transfer function
+     *
+     * @example
+     * // Create a new object which implements the KeyProvider interface
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const keyProvider = new AleoKeyProvider();
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for value transfers
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+     *
+     * // Keys can also be fetched manually
+     * const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");
+     */
+    transferKeys(visibility: string): Promise<FunctionKeyPair>;
+
+    /**
+     * Get unbond_public function keys from the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    unBondPublicKeys(): Promise<FunctionKeyPair>;
+
+}
+
+
+/**
+ * AleoKeyProvider class. Implements the KeyProvider interface. Enables the retrieval of Aleo program proving and
+ * verifying keys for the credits.aleo program over http from official Aleo sources and storing and retrieving function
+ * keys from a local memory cache.
+ */
+class AleoKeyProvider implements FunctionKeyProvider {
+    cache: Map<string, CachedKeyPair>;
+    cacheOption: boolean;
+    keyUris: string;
+
+    async fetchBytes(
+        url = "/",
+    ): Promise<Uint8Array> {
+        try {
+        const response = await get(url);
+        const data = await response.arrayBuffer();
+        return new Uint8Array(data);
+        } catch (error: any) {
+            throw new Error("Error fetching data." + error.message);
+        }
+    }
+
+    constructor() {
+        this.keyUris = KEY_STORE;
+        this.cache = new Map<string, CachedKeyPair>();
+        this.cacheOption = false;
+    }
+
+    /**
+     * Use local memory to store keys
+     *
+     * @param {boolean} useCache whether to store keys in local memory
+     */
+    useCache(useCache: boolean) {
+        this.cacheOption = useCache;
+    }
+
+    /**
+     * Clear the key cache
+     */
+    clearCache() {
+        this.cache.clear();
+    }
+
+    /**
+     * Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId
+     * exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.
+     *
+     * @param {string} keyId access key for the cache
+     * @param {FunctionKeyPair} keys keys to cache
+     */
+    cacheKeys(keyId: string, keys: FunctionKeyPair) {
+        const [provingKey, verifyingKey] = keys;
+        this.cache.set(keyId, [provingKey.toBytes(), verifyingKey.toBytes()]);
+    }
+
+    /**
+     * Determine if a keyId exists in the cache
+     *
+     * @param {string} keyId keyId of a proving and verifying key pair
+     * @returns {boolean} true if the keyId exists in the cache, false otherwise
+     */
+    containsKeys(keyId: string): boolean {
+        return this.cache.has(keyId)
+    }
+
+    /**
+     * Delete a set of keys from the cache
+     *
+     * @param {string} keyId keyId of a proving and verifying key pair to delete from memory
+     * @returns {boolean} true if the keyId exists in the cache and was deleted, false if the key did not exist
+     */
+    deleteKeys(keyId: string): boolean {
+        return this.cache.delete(keyId)
+    }
+
+    /**
+     * Get a set of keys from the cache
+     * @param keyId keyId of a proving and verifying key pair
+     *
+     * @returns {FunctionKeyPair} Proving and verifying keys for the specified program
+     */
+    getKeys(keyId: string): FunctionKeyPair {
+        console.debug(`Checking if key exists in cache. KeyId: ${keyId}`)
+        if (this.cache.has(keyId)) {
+            const [provingKeyBytes, verifyingKeyBytes] = <CachedKeyPair>this.cache.get(keyId);
+            return [ProvingKey.fromBytes(provingKeyBytes), VerifyingKey.fromBytes(verifyingKeyBytes)];
+        } else {
+            throw new Error("Key not found in cache.");
+        }
+    }
+
+    /**
+     * Get arbitrary function keys from a provider
+     *
+     * @param {KeySearchParams} params parameters for the key search in form of: {proverUri: string, verifierUri: string, cacheKey: string}
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified program
+     *
+     * @example
+     * // Create a new object which implements the KeyProvider interface
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const keyProvider = new AleoKeyProvider();
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for value transfers
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+     *
+     * // Keys can also be fetched manually using the key provider
+     * const keySearchParams = { "cacheKey": "myProgram:myFunction" };
+     * const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.functionKeys(keySearchParams);
+     */
+    async functionKeys(params?: KeySearchParams): Promise<FunctionKeyPair> {
+        if (params) {
+            let proverUrl;
+            let verifierUrl;
+            let cacheKey;
+            if ("name" in params && typeof params["name"] == "string") {
+                let key = CREDITS_PROGRAM_KEYS.getKey(params["name"]);
+                return this.fetchCreditsKeys(key);
+            }
+
+            if ("proverUri" in params && typeof params["proverUri"] == "string") {
+                proverUrl = params["proverUri"];
+            }
+
+            if ("verifierUri" in params && typeof params["verifierUri"] == "string") {
+                verifierUrl = params["verifierUri"];
+            }
+
+            if ("cacheKey" in params && typeof params["cacheKey"] == "string") {
+                cacheKey = params["cacheKey"];
+            }
+
+            if (proverUrl && verifierUrl) {
+                return await this.fetchRemoteKeys(proverUrl, verifierUrl, cacheKey);
+            }
+
+            if (cacheKey) {
+                return this.getKeys(cacheKey);
+            }
+        }
+        throw new Error("Invalid parameters provided, must provide either a cacheKey and/or a proverUrl and a verifierUrl");
+    }
+
+    /**
+     * Returns the proving and verifying keys for a specified program from a specified url.
+     *
+     * @param {string} verifierUrl Url of the proving key
+     * @param {string} proverUrl Url the verifying key
+     * @param {string} cacheKey Key to store the keys in the cache
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified program
+     *
+     * @example
+     * // Create a new AleoKeyProvider object
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const keyProvider = new AleoKeyProvider();
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for value transfers
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+     *
+     * // Keys can also be fetched manually
+     * const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.fetchKeys(
+     *     CREDITS_PROGRAM_KEYS.transfer_private.prover,
+     *     CREDITS_PROGRAM_KEYS.transfer_private.verifier,
+     * );
+     */
+    async fetchRemoteKeys(proverUrl: string, verifierUrl: string, cacheKey?: string): Promise<FunctionKeyPair> {
+        try {
+            // If cache is enabled, check if the keys have already been fetched and return them if they have
+            if (this.cacheOption) {
+                if (!cacheKey) {
+                    cacheKey = proverUrl;
+                }
+                const value = this.cache.get(cacheKey);
+                if (typeof value !== "undefined") {
+                    return [ProvingKey.fromBytes(value[0]), VerifyingKey.fromBytes(value[1])];
+                } else {
+                    console.debug("Fetching proving keys from url " + proverUrl);
+                    const provingKey = <ProvingKey>ProvingKey.fromBytes(await this.fetchBytes(proverUrl))
+                    console.debug("Fetching verifying keys " + verifierUrl);
+                    const verifyingKey = <VerifyingKey>(await this.getVerifyingKey(verifierUrl));
+                    this.cache.set(cacheKey, [provingKey.toBytes(), verifyingKey.toBytes()]);
+                    return [provingKey, verifyingKey];
+                }
+            }
+            else {
+                // If cache is disabled, fetch the keys and return them
+                const provingKey = <ProvingKey>ProvingKey.fromBytes(await this.fetchBytes(proverUrl))
+                const verifyingKey = <VerifyingKey>(await this.getVerifyingKey(verifierUrl));
+                return [provingKey, verifyingKey];
+            }
+        } catch (error: any) {
+            throw new Error(`Error: ${error.message} fetching fee proving and verifying keys from ${proverUrl} and ${verifierUrl}.`);
+        }
+    }
+
+    /***
+     * Fetches the proving key from a remote source.
+     *
+     * @param proverUrl
+     * @param cacheKey
+     *
+     * @returns {Promise<ProvingKey>} Proving key for the specified program
+     */
+    async fetchProvingKey(proverUrl: string, cacheKey?: string): Promise<ProvingKey> {
+        try {
+            // If cache is enabled, check if the keys have already been fetched and return them if they have
+            if (this.cacheOption) {
+                if (!cacheKey) {
+                    cacheKey = proverUrl;
+                }
+                const value = this.cache.get(cacheKey);
+                if (typeof value !== "undefined") {
+                    return ProvingKey.fromBytes(value[0]);
+                } else {
+                    console.debug("Fetching proving keys from url " + proverUrl);
+                    const provingKey = <ProvingKey>ProvingKey.fromBytes(await this.fetchBytes(proverUrl));
+                    return provingKey;
+                }
+            }
+            else {
+                const provingKey = <ProvingKey>ProvingKey.fromBytes(await this.fetchBytes(proverUrl));
+                return provingKey;
+            }
+        } catch (error: any) {
+            throw new Error(`Error: ${error.message} fetching fee proving keys from ${proverUrl}`);
+        }
+    }
+
+    async fetchCreditsKeys(key: Key): Promise<FunctionKeyPair> {
+        try {
+            if (!this.cache.has(key.locator) || !this.cacheOption) {
+                const verifying_key = key.verifyingKey()
+                const proving_key = <ProvingKey>await this.fetchProvingKey(key.prover, key.locator);
+                if (this.cacheOption) {
+                    this.cache.set(CREDITS_PROGRAM_KEYS.bond_public.locator, [proving_key.toBytes(), verifying_key.toBytes()]);
+                }
+                return [proving_key, verifying_key];
+            } else {
+                const keyPair = <CachedKeyPair>this.cache.get(key.locator);
+                return [ProvingKey.fromBytes(keyPair[0]), VerifyingKey.fromBytes(keyPair[1])];
+            }
+        } catch (error: any) {
+            throw new Error(`Error: fetching credits.aleo keys: ${error.message}`);
+        }
+    }
+
+    async bondPublicKeys(): Promise<FunctionKeyPair> {
+        return this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.bond_public);
+    }
+
+    bondValidatorKeys(): Promise<FunctionKeyPair> {
+        return this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.bond_validator);
+    }
+
+    claimUnbondPublicKeys(): Promise<FunctionKeyPair> {
+        return this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.claim_unbond_public)
+    }
+
+    /**
+     * Returns the proving and verifying keys for the transfer functions in the credits.aleo program
+     * @param {string} visibility Visibility of the transfer function
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the transfer functions
+     *
+     * @example
+     * // Create a new AleoKeyProvider
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const keyProvider = new AleoKeyProvider();
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for value transfers
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+     *
+     * // Keys can also be fetched manually
+     * const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");
+     */
+    async transferKeys(visibility: string): Promise<FunctionKeyPair> {
+        if (PRIVATE_TRANSFER.has(visibility)) {
+            return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_private);
+        } else if (PRIVATE_TO_PUBLIC_TRANSFER.has(visibility)) {
+            return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_private_to_public);
+        } else if (PUBLIC_TRANSFER.has(visibility)) {
+            return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_public);
+        } else if (PUBLIC_TRANSFER_AS_SIGNER.has(visibility)) {
+            return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_public_as_signer);
+        } else if (PUBLIC_TO_PRIVATE_TRANSFER.has(visibility)) {
+            return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_public_to_private);
+        } else {
+            throw new Error("Invalid visibility type");
+        }
+    }
+
+    /**
+     * Returns the proving and verifying keys for the join function in the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    async joinKeys(): Promise<FunctionKeyPair> {
+        return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.join);
+    }
+
+    /**
+     * Returns the proving and verifying keys for the split function in the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the split function
+     * */
+    async splitKeys(): Promise<FunctionKeyPair> {
+        return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.split);
+    }
+
+    /**
+     * Returns the proving and verifying keys for the fee_private function in the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the fee function
+     */
+    async feePrivateKeys(): Promise<FunctionKeyPair> {
+        return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.fee_private);
+    }
+
+    /**
+     * Returns the proving and verifying keys for the fee_public function in the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the fee function
+     */
+    async feePublicKeys(): Promise<FunctionKeyPair> {
+        return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.fee_public);
+    }
+
+    /**
+     * Gets a verifying key. If the verifying key is for a credits.aleo function, get it from the wasm cache otherwise
+     *
+     * @returns {Promise<VerifyingKey>} Verifying key for the function
+     */
+    // attempt to fetch it from the network
+    async getVerifyingKey(verifierUri: string): Promise<VerifyingKey> {
+        switch (verifierUri) {
+            case CREDITS_PROGRAM_KEYS.bond_public.verifier:
+                return CREDITS_PROGRAM_KEYS.bond_public.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.bond_validator.verifier:
+                return CREDITS_PROGRAM_KEYS.bond_validator.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.claim_unbond_public.verifier:
+                return CREDITS_PROGRAM_KEYS.claim_unbond_public.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.fee_private.verifier:
+                return CREDITS_PROGRAM_KEYS.fee_private.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.fee_public.verifier:
+                return CREDITS_PROGRAM_KEYS.fee_public.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.inclusion.verifier:
+                return CREDITS_PROGRAM_KEYS.inclusion.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.join.verifier:
+                return CREDITS_PROGRAM_KEYS.join.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.set_validator_state.verifier:
+                return CREDITS_PROGRAM_KEYS.set_validator_state.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.split.verifier:
+                return CREDITS_PROGRAM_KEYS.split.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.transfer_private.verifier:
+                return CREDITS_PROGRAM_KEYS.transfer_private.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.transfer_private_to_public.verifier:
+                return CREDITS_PROGRAM_KEYS.transfer_private_to_public.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.transfer_public.verifier:
+                return CREDITS_PROGRAM_KEYS.transfer_public.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.transfer_public_as_signer.verifier:
+                return CREDITS_PROGRAM_KEYS.transfer_public_as_signer.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.transfer_public_to_private.verifier:
+                return CREDITS_PROGRAM_KEYS.transfer_public_to_private.verifyingKey();
+            case CREDITS_PROGRAM_KEYS.unbond_public.verifier:
+                return CREDITS_PROGRAM_KEYS.unbond_public.verifyingKey();
+            default:
+                try {
+                    /// Try to fetch the verifying key from the network as a string
+                    const response = await get(verifierUri);
+                    const text = await response.text();
+                    return <VerifyingKey>VerifyingKey.fromString(text);
+                } catch (e) {
+                    /// If that fails, try to fetch the verifying key from the network as bytes
+                    try {
+                    return <VerifyingKey>VerifyingKey.fromBytes(await this.fetchBytes(verifierUri));
+                    } catch (inner: any) {
+                        throw new Error("Invalid verifying key. Error: " + inner.message);
+                    }
+                }
+        }
+    }
+
+    unBondPublicKeys(): Promise<FunctionKeyPair> {
+        return this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.unbond_public);
+    }
+}
+
+export {AleoKeyProvider, AleoKeyProviderParams, AleoKeyProviderInitParams, CachedKeyPair, FunctionKeyPair, FunctionKeyProvider, KeySearchParams}
+
\ No newline at end of file diff --git a/sdk/docs/index.html b/sdk/docs/index.html index 75a9d4a61..62249c473 100644 --- a/sdk/docs/index.html +++ b/sdk/docs/index.html @@ -1,3 +1,3 @@ -Aleo SDK
On this page

Aleo SDK

@provablehq/sdk

Aleo high-level utilities in javascript to handle Accounts, Records, and Node connections in the browser.

Makes use of @provablehq/wasm under the hood.

Happy hacking!

Build Guide

  1. To build the project, go to the project's root and execute npm install && npm run build.

Documentation

  1. To view the documentation, open docs/index.html.
  2. To regenerate the documentation, run npx jsdoc --configure jsdoc.json --verbose

Aleo Tools

Aleo SDK account generator

Aleo Home

You can visit the SnarkVM repo and SnarkOS repo to go deep into the code of aleo infrastructure

Home
\ No newline at end of file +
On this page

Website

Zero-Knowledge Web App SDK

The Aleo SDK provides tools for building zero-knowledge applications. It consists of several TypeScript & JavaScript libraries which provide the following functionality:

  1. Aleo account management
  2. Web-based program execution and deployment
  3. Aleo credit transfers
  4. Management of program state and data
  5. Communication with the Aleo network

All of this functionality is demonstrated on Provable.tools.

The Aleo SDK is divided into three TypeScript/JavaScript packages:

1. Aleo SDK - Build Zero-Knowledge Web Apps

Aleo SDK

The official Aleo SDK providing JavaScript/TypeScript tools for creating zero-knowledge applications.

⚡ Build your own app

Start here with the Aleo SDK Readme to get started building your first zero-knowledge web app.

Source: Aleo SDK

2. Create-Leo-App - Zero-Knowledge Web App Examples

Create Leo App

Create-leo-app provides zero-knowledge web app examples in common web frameworks such as React. Developers looking to start with working examples should start here.

Source: sdk/create-leo-app

3. Aleo Wasm - Zero-Knowledge Algorithms in JavaScript + WebAssembly

Create Leo AppCreate Leo AppAleo-Wasm

Aleo Wasm is a Rust crate which compiles the Aleo source code responsible for creating and executing zero-knowledge programs into WebAssembly.

When compiled with wasm-pack, JavaScript bindings are generated for the WebAssembly allowing Aleo zero-knowledge programs to be used in the browser and Node.js. This package is available on NPM (linked above). The Aleo Wasm readme provides instructions for compiling this crate and using it in web projects for those interested in building from source.

❗ Currently, program execution is only available in web browsers. However, account, program, and data management within NodeJS is functional.

Source: Aleo Wasm

📚 Documentation

API Documentation

API Documentation, tutorials for the Aleo SDK, and documentation on how to build Leo and Aleo Instructions programs can be found on the Leo Developer Docs page.

SDK Readme

The SDK readme provides concepts core to executing zero-knowledge programs in the web and several detailed examples of how to use the SDK to build web apps using Aleo.

Aleo Wasm Readme

The Aleo Wasm readme provides instructions for compiling the Aleo Wasm crate and using it in web projects. Those who want to build from source or create their own WebAssembly bindings should start here.

❤️ Contributors

Thanks goes to these wonderful people (emoji key):

Mike Turner
Mike Turner

💻 🚧 💬 👀
Brent C
Brent C

💻 🚧 💬 👀
Collin Chin
Collin Chin

💻 🚧 💬 👀
Howard Wu
Howard Wu

💻 🤔 🔬 👀
Raymond Chu
Raymond Chu

💻 🤔 🔬 👀
d0cd
d0cd

💻 🤔 🔬 👀
Alessandro Coglio
Alessandro Coglio

📖 🔬 👀
a h
a h

💻 📖
Anthony DiPrinzio
Anthony DiPrinzio

💻
Ali Mousa
Ali Mousa

💻
Ivan Litteri
Ivan Litteri

💻
Nacho Avecilla
Nacho Avecilla

💻
ljedrz
ljedrz

💻
Facundo Olano
Facundo Olano

💻
Nicolas Continanza
Nicolas Continanza

💻
Mike
Mike

💻
Javier Rodríguez Chatruc
Javier Rodríguez Chatruc

💻
Pablo Deymonnaz
Pablo Deymonnaz

💻
Bob Niu
Bob Niu

💻
sptg
sptg

💻
Hamza Khchichine
Hamza Khchichine

💻
Kendrick
Kendrick

💻
Dependabot
Dependabot

💻
All Contributors
All Contributors

📖
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

\ No newline at end of file diff --git a/sdk/docs/network-client.ts.html b/sdk/docs/network-client.ts.html new file mode 100644 index 000000000..fa23316d4 --- /dev/null +++ b/sdk/docs/network-client.ts.html @@ -0,0 +1,827 @@ +Source: network-client.ts
On this page

network-client.ts

import { get, post, parseJSON, logAndThrow } from "./utils";
+import { Account } from "./account";
+import { BlockJSON } from "./models/blockJSON";
+import { TransactionJSON } from "./models/transaction/transactionJSON";
+import {
+  Plaintext,
+  RecordCiphertext,
+  Program,
+  RecordPlaintext,
+  PrivateKey,
+  Transaction,
+} from "./wasm";
+
+type ProgramImports = { [key: string]: string | Program };
+
+interface AleoNetworkClientOptions {
+  headers?: { [key: string]: string };
+}
+
+/**
+ * Client library that encapsulates REST calls to publicly exposed endpoints of Aleo nodes. The methods provided in this
+ * allow users to query public information from the Aleo blockchain and submit transactions to the network.
+ *
+ * @param {string} host
+ * @example
+ * // Connection to a local node
+ * const localNetworkClient = new AleoNetworkClient("http://localhost:3030");
+ *
+ * // Connection to a public beacon node
+ * const publicnetworkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+ */
+class AleoNetworkClient {
+  host: string;
+  headers: { [key: string]: string };
+  account: Account | undefined;
+
+  constructor(host: string, options?: AleoNetworkClientOptions) {
+    this.host = host + "/%%NETWORK%%";
+
+    if (options && options.headers) {
+      this.headers = options.headers;
+
+    } else {
+      this.headers = {
+        // This is replaced by the actual version by a Rollup plugin
+        "X-Aleo-SDK-Version": "%%VERSION%%",
+      };
+    }
+  }
+
+  /**
+   * Set an account to use in networkClient calls
+   *
+   * @param {Account} account
+   * @example
+   * const account = new Account();
+   * networkClient.setAccount(account);
+   */
+  setAccount(account: Account) {
+    this.account = account;
+  }
+
+  /**
+   * Return the Aleo account used in the networkClient
+   *
+   * @example
+   * const account = networkClient.getAccount();
+   */
+  getAccount(): Account | undefined {
+    return this.account;
+  }
+
+  /**
+   * Set a new host for the networkClient
+   *
+   * @param {string} host The address of a node hosting the Aleo API
+   * @param host
+   */
+  setHost(host: string) {
+    this.host = host + "/%%NETWORK%%";
+  }
+
+  async fetchData<Type>(
+      url = "/",
+  ): Promise<Type> {
+    try {
+      const response = await get(this.host + url, {
+        headers: this.headers
+      });
+
+      const text = await response.text();
+      return parseJSON(text);
+
+    } catch (error) {
+      throw new Error("Error fetching data.");
+    }
+  }
+
+  /**
+   * Attempts to find unspent records in the Aleo blockchain for a specified private key.
+   * @param {number} startHeight - The height at which to start searching for unspent records
+   * @param {number} endHeight - The height at which to stop searching for unspent records
+   * @param {string | PrivateKey} privateKey - The private key to use to find unspent records
+   * @param {number[]} amounts - The amounts (in microcredits) to search for (eg. [100, 200, 3000])
+   * @param {number} maxMicrocredits - The maximum number of microcredits to search for
+   * @param {string[]} nonces - The nonces of already found records to exclude from the search
+   *
+   * @example
+   * // Find all unspent records
+   * const privateKey = "[PRIVATE_KEY]";
+   * const records = networkClient.findUnspentRecords(0, undefined, privateKey);
+   *
+   * // Find specific amounts
+   * const startHeight = 500000;
+   * const amounts = [600000, 1000000];
+   * const records = networkClient.findUnspentRecords(startHeight, undefined, privateKey, amounts);
+   *
+   * // Find specific amounts with a maximum number of cumulative microcredits
+   * const maxMicrocredits = 100000;
+   * const records = networkClient.findUnspentRecords(startHeight, undefined, privateKey, undefined, maxMicrocredits);
+   */
+  async findUnspentRecords(
+      startHeight: number,
+      endHeight: number | undefined,
+      privateKey: string | PrivateKey | undefined,
+      amounts: number[] | undefined,
+      maxMicrocredits?: number | undefined,
+      nonces?: string[] | undefined,
+  ): Promise<Array<RecordPlaintext>> {
+    nonces = nonces || [];
+    // Ensure start height is not negative
+    if (startHeight < 0) {
+      throw new Error("Start height must be greater than or equal to 0");
+    }
+
+    // Initialize search parameters
+    const records = new Array<RecordPlaintext>();
+    let start;
+    let end;
+    let resolvedPrivateKey: PrivateKey;
+    let failures = 0;
+    let totalRecordValue = BigInt(0);
+    let latestHeight: number;
+
+    // Ensure a private key is present to find owned records
+    if (typeof privateKey === "undefined") {
+      if (typeof this.account === "undefined") {
+        throw new Error("Private key must be specified in an argument to findOwnedRecords or set in the AleoNetworkClient");
+      } else {
+        resolvedPrivateKey = this.account._privateKey;
+      }
+    } else {
+      try {
+        resolvedPrivateKey = privateKey instanceof PrivateKey ? privateKey : PrivateKey.from_string(privateKey);
+      } catch (error) {
+        throw new Error("Error parsing private key provided.");
+      }
+    }
+    const viewKey = resolvedPrivateKey.to_view_key();
+
+    // Get the latest height to ensure the range being searched is valid
+    try {
+      const blockHeight = await this.getLatestHeight();
+      if (typeof blockHeight === "number") {
+        latestHeight = blockHeight;
+      } else {
+        throw new Error("Error fetching latest block height.");
+      }
+    } catch (error) {
+      throw new Error("Error fetching latest block height.");
+    }
+
+    // If no end height is specified or is greater than the latest height, set the end height to the latest height
+    if (typeof endHeight === "number" && endHeight <= latestHeight) {
+      end = endHeight
+    } else {
+      end = latestHeight;
+    }
+
+    // If the starting is greater than the ending height, return an error
+    if (startHeight > end) {
+      throw new Error("Start height must be less than or equal to end height.");
+    }
+
+    // Iterate through blocks in reverse order in chunks of 50
+    while (end > startHeight) {
+      start = end - 50;
+      if (start < startHeight) {
+        start = startHeight;
+      }
+      try {
+        // Get 50 blocks (or the difference between the start and end if less than 50)
+        const blocks = await this.getBlockRange(start, end);
+        end = start;
+        // Iterate through blocks to find unspent records
+        for (let i = 0; i < blocks.length; i++) {
+          const block = blocks[i];
+          const transactions = block.transactions;
+          if (!(typeof transactions === "undefined")) {
+            for (let j = 0; j < transactions.length; j++) {
+              const confirmedTransaction = transactions[j];
+              // Search for unspent records in execute transactions of credits.aleo
+              if (confirmedTransaction.type == "execute") {
+                const transaction = confirmedTransaction.transaction;
+                if (transaction.execution && !(typeof transaction.execution.transitions == "undefined")) {
+                  for (let k = 0; k < transaction.execution.transitions.length; k++) {
+                    const transition = transaction.execution.transitions[k];
+                    // Only search for unspent records in credits.aleo (for now)
+                    if (transition.program !== "credits.aleo") {
+                      continue;
+                    }
+                    if (!(typeof transition.outputs == "undefined")) {
+                      for (let l = 0; l < transition.outputs.length; l++) {
+                        const output = transition.outputs[l];
+                        if (output.type === "record") {
+                          try {
+                            // Create a wasm record ciphertext object from the found output
+                            const record = RecordCiphertext.fromString(output.value);
+                            // Determine if the record is owned by the specified view key
+                            if (record.isOwner(viewKey)) {
+                              // Decrypt the record and get the serial number
+                              const recordPlaintext = record.decrypt(viewKey);
+
+                              // If the record has already been found, skip it
+                              const nonce = recordPlaintext.nonce();
+                              if (nonces.includes(nonce)) {
+                                continue;
+                              }
+
+                              // Otherwise record the nonce that has been found
+                              const serialNumber = recordPlaintext.serialNumberString(resolvedPrivateKey, "credits.aleo", "credits");
+                              // Attempt to see if the serial number is spent
+                              try {
+                                await this.getTransitionId(serialNumber);
+                              } catch (error) {
+                                // If it's not found, add it to the list of unspent records
+                                if (!amounts) {
+                                  records.push(recordPlaintext);
+                                  // If the user specified a maximum number of microcredits, check if the search has found enough
+                                  if (typeof maxMicrocredits === "number") {
+                                    totalRecordValue += recordPlaintext.microcredits();
+                                    // Exit if the search has found the amount specified
+                                    if (totalRecordValue >= BigInt(maxMicrocredits)) {
+                                      return records;
+                                    }
+                                  }
+                                }
+                                // If the user specified a list of amounts, check if the search has found them
+                                if (!(typeof amounts === "undefined") && amounts.length > 0) {
+                                  let amounts_found = 0;
+                                  if (recordPlaintext.microcredits() > amounts[amounts_found]) {
+                                      amounts_found += 1;
+                                      records.push(recordPlaintext);
+                                      // If the user specified a maximum number of microcredits, check if the search has found enough
+                                      if (typeof maxMicrocredits === "number") {
+                                        totalRecordValue += recordPlaintext.microcredits();
+                                        // Exit if the search has found the amount specified
+                                        if (totalRecordValue >= BigInt(maxMicrocredits)) {
+                                          return records;
+                                        }
+                                      }
+                                      if (records.length >= amounts.length) {
+                                        return records;
+                                      }
+                                  }
+                                }
+                              }
+                            }
+                          } catch (error) {
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      } catch (error) {
+        // If there is an error fetching blocks, log it and keep searching
+        console.warn("Error fetching blocks in range: " + start.toString() + "-" + end.toString());
+        console.warn("Error: ", error);
+        failures += 1;
+        if (failures > 10) {
+          console.warn("10 failures fetching records reached. Returning records fetched so far");
+          return records;
+        }
+      }
+    }
+    return records;
+  }
+
+  /**
+   * Returns the contents of the block at the specified block height.
+   *
+   * @param {number} height
+   * @example
+   * const block = networkClient.getBlock(1234);
+   */
+  async getBlock(height: number): Promise<BlockJSON> {
+    try {
+      const block = await this.fetchData<BlockJSON>("/block/" + height);
+      return block;
+    } catch (error) {
+      throw new Error("Error fetching block.");
+    }
+  }
+
+  /**
+   * Returns a range of blocks between the specified block heights.
+   *
+   * @param {number} start
+   * @param {number} end
+   * @example
+   * const blockRange = networkClient.getBlockRange(2050, 2100);
+   */
+  async getBlockRange(start: number, end: number): Promise<Array<BlockJSON>> {
+    try {
+      return await this.fetchData<Array<BlockJSON>>("/blocks?start=" + start + "&end=" + end);
+    } catch (error) {
+      const errorMessage = `Error fetching blocks between ${start} and ${end}.`;
+      throw new Error(errorMessage);
+    }
+  }
+
+  /**
+   * Returns the deployment transaction id associated with the specified program.
+   *
+   * @param {Program | string} program
+   * @returns {TransactionJSON}
+   */
+  async getDeploymentTransactionIDForProgram(program: Program | string): Promise<string> {
+    if (program instanceof Program) {
+      program = program.toString();
+    }
+    try {
+      const id = await this.fetchData<string>("/find/transactionID/deployment/" + program);
+      return id.replace("\"", "")
+    } catch (error) {
+      throw new Error("Error fetching deployment transaction for program.");
+    }
+  }
+
+  /**
+   * Returns the deployment transaction associated with a specified program.
+   *
+   * @param {Program | string} program
+   * @returns {TransactionJSON}
+   */
+  async getDeploymentTransactionForProgram(program: Program | string): Promise<TransactionJSON> {
+    try {
+      const transaction_id = <string>await this.getDeploymentTransactionIDForProgram(program);
+      return <TransactionJSON>await this.getTransaction(transaction_id);
+    } catch (error) {
+      throw new Error("Error fetching deployment transaction for program.");
+    }
+  }
+
+  /**
+   * Returns the deployment transaction associated with a specified program as a wasm object.
+   *
+   * @param {Program | string} program
+   * @returns {TransactionJSON}
+   */
+  async getDeploymentTransactioObjectnForProgram(program: Program | string): Promise<Transaction> {
+    try {
+      const transaction_id = <string>await this.getDeploymentTransactionIDForProgram(program);
+      return await this.getTransactionObject(transaction_id);
+    } catch (error) {
+      throw new Error("Error fetching deployment transaction for program.");
+    }
+  }
+
+  /**
+   * Returns the contents of the latest block.
+   *
+   * @example
+   * const latestHeight = networkClient.getLatestBlock();
+   */
+  async getLatestBlock(): Promise<BlockJSON> {
+    try {
+      return await this.fetchData<BlockJSON>("/block/latest") as BlockJSON;
+    } catch (error) {
+      throw new Error("Error fetching latest block.");
+    }
+  }
+
+  /**
+   * Returns the latest committee.
+   *
+   * @returns {Promise<object>} A javascript object containing the latest committee
+   */
+  async getLatestCommittee(): Promise<object> {
+    try {
+      return await this.fetchData<object>("/committee/latest");
+    } catch (error) {
+      throw new Error("Error fetching latest block.");
+    }
+  }
+
+  /**
+   * Returns the latest block height.
+   *
+   * @example
+   * const latestHeight = networkClient.getLatestHeight();
+   */
+  async getLatestHeight(): Promise<number> {
+    try {
+      return Number(await this.fetchData<bigint>("/block/height/latest"));
+    } catch (error) {
+      throw new Error("Error fetching latest height.");
+    }
+  }
+
+  /**
+   * Returns the source code of a program given a program ID.
+   *
+   * @param {string} programId The program ID of a program deployed to the Aleo Network
+   * @return {Promise<string>} Source code of the program
+   *
+   * @example
+   * const program = networkClient.getProgram("hello_hello.aleo");
+   * const expectedSource = "program hello_hello.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n"
+   * assert.equal(program, expectedSource);
+   */
+  async getProgram(programId: string): Promise<string> {
+    try {
+      return await this.fetchData<string>("/program/" + programId)
+    } catch (error) {
+      throw new Error("Error fetching program");
+    }
+  }
+
+  /**
+   * Returns a program object from a program ID or program source code.
+   *
+   * @param {string} inputProgram The program ID or program source code of a program deployed to the Aleo Network
+   * @return {Promise<Program>} Source code of the program
+   *
+   * @example
+   * const programID = "hello_hello.aleo";
+   * const programSource = "program hello_hello.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n"
+   *
+   * // Get program object from program ID or program source code
+   * const programObjectFromID = await networkClient.getProgramObject(programID);
+   * const programObjectFromSource = await networkClient.getProgramObject(programSource);
+   *
+   * // Both program objects should be equal
+   * assert.equal(programObjectFromID.to_string(), programObjectFromSource.to_string());
+   */
+  async getProgramObject(inputProgram: string): Promise<Program> {
+    try {
+      return Program.fromString(inputProgram);
+    } catch (error) {
+      try {
+        return Program.fromString(<string>(await this.getProgram(inputProgram)));
+      } catch (error) {
+        throw new Error(`${inputProgram} is neither a program name or a valid program`);
+      }
+    }
+  }
+
+  /**
+   *  Returns an object containing the source code of a program and the source code of all programs it imports
+   *
+   * @param {Program | string} inputProgram The program ID or program source code of a program deployed to the Aleo Network
+   * @returns {Promise<ProgramImports>} Object of the form { "program_id": "program_source", .. } containing program id & source code for all program imports
+   *
+   * @example
+   * const double_test_source = "import multiply_test.aleo;\n\nprogram double_test.aleo;\n\nfunction double_it:\n    input r0 as u32.private;\n    call multiply_test.aleo/multiply 2u32 r0 into r1;\n    output r1 as u32.private;\n"
+   * const double_test = Program.fromString(double_test_source);
+   * const expectedImports = {
+   *     "multiply_test.aleo": "program multiply_test.aleo;\n\nfunction multiply:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    mul r0 r1 into r2;\n    output r2 as u32.private;\n"
+   * }
+   *
+   * // Imports can be fetched using the program ID, source code, or program object
+   * let programImports = await networkClient.getProgramImports("double_test.aleo");
+   * assert.deepStrictEqual(programImports, expectedImports);
+   *
+   * // Using the program source code
+   * programImports = await networkClient.getProgramImports(double_test_source);
+   * assert.deepStrictEqual(programImports, expectedImports);
+   *
+   * // Using the program object
+   * programImports = await networkClient.getProgramImports(double_test);
+   * assert.deepStrictEqual(programImports, expectedImports);
+   */
+  async getProgramImports(inputProgram: Program | string): Promise<ProgramImports> {
+    try {
+      const imports: ProgramImports = {};
+
+      // Get the program object or fail if the program is not valid or does not exist
+      const program = inputProgram instanceof Program ? inputProgram : <Program>(await this.getProgramObject(inputProgram));
+
+      // Get the list of programs that the program imports
+      const importList = program.getImports();
+
+      // Recursively get any imports that the imported programs have in a depth first search order
+      for (let i = 0; i < importList.length; i++) {
+        const import_id = importList[i];
+        if (!imports.hasOwnProperty(import_id)) {
+          const programSource = <string>await this.getProgram(import_id);
+          const nestedImports = <ProgramImports>await this.getProgramImports(import_id);
+          for (const key in nestedImports) {
+            if (!imports.hasOwnProperty(key)) {
+              imports[key] = nestedImports[key];
+            }
+          }
+          imports[import_id] = programSource;
+        }
+      }
+      return imports;
+    } catch (error: any) {
+      logAndThrow("Error fetching program imports: " + error.message);
+    }
+  }
+
+  /**
+   * Get a list of the program names that a program imports.
+   *
+   * @param {Program | string} inputProgram - The program id or program source code to get the imports of
+   * @returns {string[]} - The list of program names that the program imports
+   *
+   * @example
+   * const programImportsNames = networkClient.getProgramImports("double_test.aleo");
+   * const expectedImportsNames = ["multiply_test.aleo"];
+   * assert.deepStrictEqual(programImportsNames, expectedImportsNames);
+   */
+  async getProgramImportNames(inputProgram: Program | string): Promise<string[]> {
+    try {
+      const program = inputProgram instanceof Program ? inputProgram : <Program>(await this.getProgramObject(inputProgram));
+      return program.getImports();
+    } catch (error: any) {
+      throw new Error("Error fetching program imports with error: " + error.message);
+    }
+  }
+
+  /**
+   * Returns the names of the mappings of a program.
+   *
+   * @param {string} programId - The program ID to get the mappings of (e.g. "credits.aleo")
+   * @example
+   * const mappings = networkClient.getProgramMappingNames("credits.aleo");
+   * const expectedMappings = ["account"];
+   * assert.deepStrictEqual(mappings, expectedMappings);
+   */
+  async getProgramMappingNames(programId: string): Promise<Array<string>> {
+    try {
+      return await this.fetchData<Array<string>>("/program/" + programId + "/mappings")
+    } catch (error) {
+      throw new Error("Error fetching program mappings - ensure the program exists on chain before trying again");
+    }
+  }
+
+  /**
+   * Returns the value of a program's mapping for a specific key.
+   *
+   * @param {string} programId - The program ID to get the mapping value of (e.g. "credits.aleo")
+   * @param {string} mappingName - The name of the mapping to get the value of (e.g. "account")
+   * @param {string | Plaintext} key - The key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
+   * @return {Promise<string>} String representation of the value of the mapping
+   *
+   * @example
+   * // Get public balance of an account
+   * const mappingValue = networkClient.getMappingValue("credits.aleo", "account", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px");
+   * const expectedValue = "0u64";
+   * assert.equal(mappingValue, expectedValue);
+   */
+  async getProgramMappingValue(programId: string, mappingName: string, key: string | Plaintext): Promise<string> {
+    try {
+      const keyString = key instanceof Plaintext ? key.toString() : key;
+      return await this.fetchData<string>("/program/" + programId + "/mapping/" + mappingName + "/" + keyString)
+    } catch (error) {
+      throw new Error("Error fetching mapping value - ensure the mapping exists and the key is correct");
+    }
+  }
+
+
+  /**
+   * Returns the value of a mapping as a wasm Plaintext object. Returning an
+   * object in this format allows it to be converted to a Js type and for its
+   * internal members to be inspected if it's a struct or array.
+   *
+   * @example
+   * // Get the bond state as an account.
+   * const unbondedState = networkClient.getMappingPlaintext("credits.aleo", "bonded", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px");
+   *
+   * // Get the two members of the object individually.
+   * const validator = unbondedState.getMember("validator");
+   * const microcredits = unbondedState.getMember("microcredits");
+   *
+   * // Ensure the expected values are correct.
+   * assert.equal(validator, "aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd");
+   * assert.equal(microcredits, BigInt("9007199254740991"));
+   *
+   * // Get a JS object representation of the unbonded state.
+   * const unbondedStateObject = unbondedState.toObject();
+   *
+   * const expectedState = {
+   *     validator: "aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd",
+   *     microcredits: BigInt("9007199254740991")
+   * };
+   * assert.equal(unbondedState, expectedState);
+   *
+   * @param {string} programId - The program ID to get the mapping value of (e.g. "credits.aleo")
+   * @param {string} mappingName - The name of the mapping to get the value of (e.g. "account")
+   * @param {string | Plaintext} key - The key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
+   *
+   * @return {Promise<string>} String representation of the value of the mapping
+   */
+  async getProgramMappingPlaintext(programId: string, mappingName: string, key: string | Plaintext): Promise<Plaintext> {
+    try {
+      const keyString = key instanceof Plaintext ? key.toString() : key;
+      const value = await this.fetchData<string>("/program/" + programId + "/mapping/" + mappingName + "/" + keyString);
+      return Plaintext.fromString(value);
+    } catch (error) {
+      throw new Error("Failed to fetch mapping value");
+    }
+  }
+
+  /**
+   * Returns the latest state/merkle root of the Aleo blockchain.
+   *
+   * @example
+   * const stateRoot = networkClient.getStateRoot();
+   */
+  async getStateRoot(): Promise<string> {
+    try {
+      return await this.fetchData<string>("/stateRoot/latest");
+    } catch (error) {
+      throw new Error("Error fetching Aleo state root");
+    }
+  }
+
+  /**
+   * Returns a transaction by its unique identifier.
+   *
+   * @param {string} id
+   * @example
+   * const transaction = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");
+   */
+  async getTransaction(transactionId: string): Promise<TransactionJSON> {
+    try {
+    return await this.fetchData<TransactionJSON>("/transaction/" + transactionId);
+    } catch (error) {
+      throw new Error("Error fetching transaction.");
+    }
+  }
+
+  /**
+   * Returns a transaction as a wasm object. Getting a transaction of this type will allow the ability for the inputs,
+   * outputs, and records to be searched for and displayed.
+   *
+   * @example
+   * const transactionObject = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");
+   * // Get the transaction inputs as a JS array.
+   * const transactionOutputs = transactionObject.inputs(true);
+   *
+   * // Get the transaction outputs as a JS object.
+   * const transactionInputs = transactionObject.outputs(true);
+   *
+   * // Get any records generated in transitions in the transaction as a JS object.
+   * const records = transactionObject.records();
+   *
+   * // Get the transaction type.
+   * const transactionType = transactionObject.transactionType();
+   * assert.equal(transactionType, "Execute");
+   *
+   * // Get a JS representation of all inputs, outputs, and transaction metadata.
+   * const transactionSummary = transactionObject.summary();
+   *
+   * @param {string} transactionId
+   * @example
+   * const transaction = networkClient.getTransactionObject("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");
+   */
+  async getTransactionObject(transactionId: string): Promise<Transaction> {
+    try {
+      const transaction = await this.fetchData<string>("/transaction/" + transactionId);
+      return Transaction.fromString(transaction);
+    } catch (error) {
+      throw new Error("Error fetching transaction.");
+    }
+  }
+
+  /**
+   * Returns the transactions present at the specified block height.
+   *
+   * @param {number} height
+   * @example
+   * const transactions = networkClient.getTransactions(654);
+   */
+  async getTransactions(height: number): Promise<Array<TransactionJSON>> {
+    try {
+    return await this.fetchData<Array<TransactionJSON>>("/block/" + height.toString() + "/transactions");
+    } catch (error) {
+      throw new Error("Error fetching transactions.");
+    }
+  }
+
+  /**
+   * Returns an array of transactions as wasm objects present at the specified block height.
+   *
+   * @param {number} height
+   * @example
+   * const transactions = networkClient.getTransactionObjects(654);
+   *
+   * let transaction_summaries = transactions.map(transaction => transaction.summary());
+   */
+  async getTransactionObjects(height: number): Promise<Array<Transaction>> {
+    try {
+      return (await this.fetchData<Array<string>>("/block/" + height.toString() + "/transactions"))
+          .reduce<Array<Transaction>>((acc, transaction) => {
+              acc.push(Transaction.fromString(transaction));
+              return acc;
+            }, []);
+    } catch (error) {
+      throw new Error("Error fetching transactions.");
+    }
+  }
+
+  /**
+   * Returns the transactions in the memory pool.
+   *
+   * @example
+   * const transactions = networkClient.getTransactionsInMempool();
+   */
+  async getTransactionsInMempool(): Promise<Array<TransactionJSON>> {
+    try {
+      return await this.fetchData<Array<TransactionJSON>>("/memoryPool/transactions");
+    } catch (error) {
+      throw new Error("Error fetching transactions from mempool.");
+    }
+  }
+
+  /**
+   * Returns the transactions in the memory pool as wasm objects.
+   *
+   * @example
+   * const transactions = networkClient.getTransactionsInMempool();
+   */
+  async getTransactionObjectsInMempool(): Promise<Array<Transaction>> {
+    try {
+      return (await this.fetchData<Array<string>>("/memoryPool/transactions"))
+          .reduce<Array<Transaction>>((acc, transaction) => {
+        acc.push(Transaction.fromString(transaction));
+        return acc;
+      }, []);
+    } catch (error) {
+      throw new Error("Error fetching transactions from mempool.");
+    }
+  }
+
+  /**
+   * Returns the transition ID of the transition corresponding to the ID of the input or output.
+   * @param {string} inputOrOutputID - ID of the input or output.
+   *
+   * @example
+   * const transitionId = networkClient.getTransitionId("2429232855236830926144356377868449890830704336664550203176918782554219952323field");
+   */
+  async getTransitionId(inputOrOutputID: string): Promise<string> {
+    try {
+      return await this.fetchData<string>("/find/transitionID/" + inputOrOutputID);
+    } catch (error) {
+      throw new Error("Error fetching transition ID.");
+    }
+  }
+
+  /**
+   * Submit an execute or deployment transaction to the Aleo network.
+   *
+   * @param {Transaction | string} transaction  - The transaction to submit to the network
+   * @returns {string} - The transaction id of the submitted transaction or the resulting error
+   */
+  async submitTransaction(transaction: Transaction | string): Promise<string> {
+    const transaction_string = transaction instanceof Transaction ? transaction.toString() : transaction;
+    try {
+      const response = await post(this.host + "/transaction/broadcast", {
+        body: transaction_string,
+        headers: Object.assign({}, this.headers, {
+          "Content-Type": "application/json",
+        }),
+      });
+
+      try {
+        const text = await response.text();
+        return parseJSON(text);
+
+      } catch (error: any) {
+        throw new Error(`Error posting transaction. Aleo network response: ${error.message}`);
+      }
+    } catch (error: any) {
+      throw new Error(`Error posting transaction: No response received: ${error.message}`);
+    }
+  }
+
+  /**
+   * Submit a solution to the Aleo network.
+   *
+   * @param {string} solution The string representation of the solution desired to be submitted to the network.
+   */
+  async submitSolution(solution: string): Promise<string> {
+    try {
+      const response = await post(this.host + "/solution/broadcast", {
+        body: solution,
+        headers: Object.assign({}, this.headers, {
+          "Content-Type": "application/json",
+        }),
+      });
+
+      try {
+        const text = await response.text();
+        return parseJSON(text);
+
+      } catch (error: any) {
+        throw new Error(`Error posting transaction. Aleo network response: ${error.message}`);
+      }
+    } catch (error: any) {
+      throw new Error(`Error posting transaction: No response received: ${error.message}`);
+    }
+  }
+}
+
+export { AleoNetworkClient, AleoNetworkClientOptions, ProgramImports }
+
\ No newline at end of file diff --git a/sdk/docs/offline-key-provider.ts.html b/sdk/docs/offline-key-provider.ts.html new file mode 100644 index 000000000..2112cd3a6 --- /dev/null +++ b/sdk/docs/offline-key-provider.ts.html @@ -0,0 +1,609 @@ +Source: offline-key-provider.ts
On this page

offline-key-provider.ts

import {
+    CachedKeyPair,
+    FunctionKeyPair,
+    FunctionKeyProvider,
+    KeySearchParams,
+} from "./function-key-provider";
+
+import {
+    ProvingKey,
+    VerifyingKey,
+} from "./wasm";
+
+import {
+    CREDITS_PROGRAM_KEYS,
+    PRIVATE_TRANSFER,
+    PRIVATE_TO_PUBLIC_TRANSFER,
+    PUBLIC_TRANSFER,
+    PUBLIC_TO_PRIVATE_TRANSFER,
+    PUBLIC_TRANSFER_AS_SIGNER,
+} from "./constants";
+
+/**
+ * Search parameters for the offline key provider. This class implements the KeySearchParams interface and includes
+ * a convenience method for creating a new instance of this class for each function of the credits.aleo program.
+ *
+ * @example
+ * // If storing a key for a custom program function
+ * offlineSearchParams = new OfflineSearchParams("myprogram.aleo/myfunction");
+ *
+ * // If storing a key for a credits.aleo program function
+ * bondPublicKeyParams = OfflineSearchParams.bondPublicKeyParams();
+ */
+class OfflineSearchParams implements KeySearchParams {
+    cacheKey: string | undefined;
+    verifyCreditsKeys: boolean | undefined;
+
+    /**
+     * Create a new OfflineSearchParams instance.
+     *
+     * @param {string} cacheKey - Key used to store the local function proving & verifying keys. This should be stored
+     * under the naming convention "programName/functionName" (i.e. "myprogram.aleo/myfunction")
+     * @param {boolean} verifyCreditsKeys - Whether to verify the keys against the credits.aleo program,
+     * defaults to false, but should be set to true if using keys from the credits.aleo program
+     */
+    constructor(cacheKey: string, verifyCreditsKeys = false) {
+        this.cacheKey = cacheKey;
+        this.verifyCreditsKeys = verifyCreditsKeys;
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the bond_public function of the credits.aleo program.
+     */
+    static bondPublicKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.bond_public.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the bond_validator function of the credits.aleo program.
+     */
+    static bondValidatorKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.bond_validator.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the claim_unbond_public function of the
+     */
+    static claimUnbondPublicKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.claim_unbond_public.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the fee_private function of the credits.aleo program.
+     */
+    static feePrivateKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.fee_private.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the fee_public function of the credits.aleo program.
+     */
+    static feePublicKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.fee_public.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the inclusion prover function.
+     */
+    static inclusionKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.inclusion.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the join function of the credits.aleo program.
+     */
+    static joinKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.join.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the set_validator_state function of the credits.aleo program.
+     */
+    static setValidatorStateKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.set_validator_state.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the split function of the credits.aleo program.
+     */
+    static splitKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.split.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the transfer_private function of the credits.aleo program.
+     */
+    static transferPrivateKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.transfer_private.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the transfer_private_to_public function of the credits.aleo program.
+     */
+    static transferPrivateToPublicKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.transfer_private_to_public.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the transfer_public function of the credits.aleo program.
+     */
+    static transferPublicKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.transfer_public.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the transfer_public_as_signer function of the credits.aleo program.
+     */
+    static transferPublicAsSignerKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.transfer_public_as_signer.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the transfer_public_to_private function of the credits.aleo program.
+     */
+    static transferPublicToPrivateKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.transfer_public_to_private.locator, true);
+    }
+
+    /**
+     * Create a new OfflineSearchParams instance for the unbond_public function of the credits.aleo program.
+     */
+    static unbondPublicKeyParams(): OfflineSearchParams {
+        return new OfflineSearchParams(CREDITS_PROGRAM_KEYS.unbond_public.locator, true);
+    }
+}
+
+/**
+ * A key provider meant for building transactions offline on devices such as hardware wallets. This key provider is not
+ * able to contact the internet for key material and instead relies on the user to insert Aleo function proving &
+ * verifying keys from local storage prior to usage.
+ *
+ * @example
+ * // Create an offline program manager
+ * const programManager = new ProgramManager();
+ *
+ * // Create a temporary account for the execution of the program
+ * const account = new Account();
+ * programManager.setAccount(account);
+ *
+ * // Create the proving keys from the key bytes on the offline machine
+ * console.log("Creating proving keys from local key files");
+ * const program = "program hello_hello.aleo; function hello: input r0 as u32.public; input r1 as u32.private; add r0 r1 into r2; output r2 as u32.private;";
+ * const myFunctionProver = await getLocalKey("/path/to/my/function/hello_hello.prover");
+ * const myFunctionVerifier = await getLocalKey("/path/to/my/function/hello_hello.verifier");
+ * const feePublicProvingKeyBytes = await getLocalKey("/path/to/credits.aleo/feePublic.prover");
+ *
+ * myFunctionProvingKey = ProvingKey.fromBytes(myFunctionProver);
+ * myFunctionVerifyingKey = VerifyingKey.fromBytes(myFunctionVerifier);
+ * const feePublicProvingKey = ProvingKey.fromBytes(feePublicKeyBytes);
+ *
+ * // Create an offline key provider
+ * console.log("Creating offline key provider");
+ * const offlineKeyProvider = new OfflineKeyProvider();
+ *
+ * // Cache the keys
+ * // Cache the proving and verifying keys for the custom hello function
+ * OfflineKeyProvider.cacheKeys("hello_hello.aleo/hello", myFunctionProvingKey, myFunctionVerifyingKey);
+ *
+ * // Cache the proving key for the fee_public function (the verifying key is automatically cached)
+ * OfflineKeyProvider.insertFeePublicKey(feePublicProvingKey);
+ *
+ * // Create an offline query using the latest state root in order to create the inclusion proof
+ * const offlineQuery = new OfflineQuery("latestStateRoot");
+ *
+ * // Insert the key provider into the program manager
+ * programManager.setKeyProvider(offlineKeyProvider);
+ *
+ * // Create the offline search params
+ * const offlineSearchParams = new OfflineSearchParams("hello_hello.aleo/hello");
+ *
+ * // Create the offline transaction
+ * const offlineExecuteTx = <Transaction>await this.buildExecutionTransaction("hello_hello.aleo", "hello", 1, false, ["5u32", "5u32"], undefined, offlineSearchParams, undefined, undefined, undefined, undefined, offlineQuery, program);
+ *
+ * // Broadcast the transaction later on a machine with internet access
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+ * const txId = await networkClient.broadcastTransaction(offlineExecuteTx);
+ */
+class OfflineKeyProvider implements FunctionKeyProvider {
+    cache: Map<string, CachedKeyPair>;
+
+    constructor() {
+        this.cache = new Map<string, CachedKeyPair>();
+    }
+
+    /**
+     * Get bond_public function keys from the credits.aleo program. The keys must be cached prior to calling this
+     * method for it to work.
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the bond_public function
+     */
+    bondPublicKeys(): Promise<FunctionKeyPair> {
+        return this.functionKeys(OfflineSearchParams.bondPublicKeyParams());
+    };
+
+    /**
+     * Get bond_validator function keys from the credits.aleo program. The keys must be cached prior to calling this
+     * method for it to work.
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the bond_public function
+     */
+    bondValidatorKeys(): Promise<FunctionKeyPair> {
+        return this.functionKeys(OfflineSearchParams.bondValidatorKeyParams());
+    };
+
+
+    /**
+     * Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId
+     * exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.
+     *
+     * @param {string} keyId access key for the cache
+     * @param {FunctionKeyPair} keys keys to cache
+     */
+    cacheKeys(keyId: string, keys: FunctionKeyPair): void {
+        const [provingKey, verifyingKey] = keys;
+        this.cache.set(keyId, [provingKey.toBytes(), verifyingKey.toBytes()]);
+    };
+
+    /**
+     * Get unbond_public function keys from the credits.aleo program. The keys must be cached prior to calling this
+     * method for it to work.
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the unbond_public function
+     */
+    claimUnbondPublicKeys(): Promise<FunctionKeyPair> {
+        return this.functionKeys(OfflineSearchParams.claimUnbondPublicKeyParams());
+    };
+
+    /**
+     * Get arbitrary function key from the offline key provider cache.
+     *
+     * @param {KeySearchParams | undefined} params - Optional search parameters for the key provider
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified program
+     *
+     * @example
+     * /// First cache the keys from local offline resources
+     * const offlineKeyProvider = new OfflineKeyProvider();
+     * const myFunctionVerifyingKey = VerifyingKey.fromString("verifier...");
+     * const myFunctionProvingKeyBytes = await readBinaryFile('./resources/myfunction.prover');
+     * const myFunctionProvingKey = ProvingKey.fromBytes(myFunctionProvingKeyBytes);
+     *
+     * /// Cache the keys for future use with a memorable locator
+     * offlineKeyProvider.cacheKeys("myprogram.aleo/myfunction", [myFunctionProvingKey, myFunctionVerifyingKey]);
+     *
+     * /// When they're needed, retrieve the keys from the cache
+     *
+     * /// First create a search parameter object with the same locator used to cache the keys
+     * const keyParams = new OfflineSearchParams("myprogram.aleo/myfunction");
+     *
+     * /// Then retrieve the keys
+     * const [myFunctionProver, myFunctionVerifier] = await offlineKeyProvider.functionKeys(keyParams);
+     */
+    functionKeys(params?: KeySearchParams): Promise<FunctionKeyPair> {
+        return new Promise((resolve, reject) => {
+            if (params === undefined) {
+                reject(new Error("No search parameters provided, cannot retrieve keys"));
+            } else {
+                const keyId = params.cacheKey;
+                const verifyCreditsKeys = params.verifyCreditsKeys;
+                if (this.cache.has(keyId)) {
+                    const [provingKeyBytes, verifyingKeyBytes] = this.cache.get(keyId) as CachedKeyPair;
+                    const provingKey = ProvingKey.fromBytes(provingKeyBytes);
+                    const verifyingKey = VerifyingKey.fromBytes(verifyingKeyBytes);
+                    if (verifyCreditsKeys) {
+                        const keysMatchExpected = this.verifyCreditsKeys(keyId, provingKey, verifyingKey)
+                        if (!keysMatchExpected) {
+                            reject (new Error(`Cached keys do not match expected keys for ${keyId}`));
+                        }
+                    }
+                    resolve([provingKey, verifyingKey]);
+                } else {
+                    reject(new Error("Keys not found in cache for " + keyId));
+                }
+            }
+        });
+    };
+
+    /**
+     * Determines if the keys for a given credits function match the expected keys.
+     *
+     * @returns {boolean} Whether the keys match the expected keys
+     */
+    verifyCreditsKeys(locator: string, provingKey: ProvingKey, verifyingKey: VerifyingKey): boolean {
+        switch (locator) {
+            case CREDITS_PROGRAM_KEYS.bond_public.locator:
+                return provingKey.isBondPublicProver() && verifyingKey.isBondPublicVerifier();
+            case CREDITS_PROGRAM_KEYS.claim_unbond_public.locator:
+                return provingKey.isClaimUnbondPublicProver() && verifyingKey.isClaimUnbondPublicVerifier();
+            case CREDITS_PROGRAM_KEYS.fee_private.locator:
+                return provingKey.isFeePrivateProver() && verifyingKey.isFeePrivateVerifier();
+            case CREDITS_PROGRAM_KEYS.fee_public.locator:
+                return provingKey.isFeePublicProver() && verifyingKey.isFeePublicVerifier();
+            case CREDITS_PROGRAM_KEYS.inclusion.locator:
+                return provingKey.isInclusionProver() && verifyingKey.isInclusionVerifier();
+            case CREDITS_PROGRAM_KEYS.join.locator:
+                return provingKey.isJoinProver() && verifyingKey.isJoinVerifier();
+            case CREDITS_PROGRAM_KEYS.set_validator_state.locator:
+                return provingKey.isSetValidatorStateProver() && verifyingKey.isSetValidatorStateVerifier();
+            case CREDITS_PROGRAM_KEYS.split.locator:
+                return provingKey.isSplitProver() && verifyingKey.isSplitVerifier();
+            case CREDITS_PROGRAM_KEYS.transfer_private.locator:
+                return provingKey.isTransferPrivateProver() && verifyingKey.isTransferPrivateVerifier();
+            case CREDITS_PROGRAM_KEYS.transfer_private_to_public.locator:
+                return provingKey.isTransferPrivateToPublicProver() && verifyingKey.isTransferPrivateToPublicVerifier();
+            case CREDITS_PROGRAM_KEYS.transfer_public.locator:
+                return provingKey.isTransferPublicProver() && verifyingKey.isTransferPublicVerifier();
+            case CREDITS_PROGRAM_KEYS.transfer_public_to_private.locator:
+                return provingKey.isTransferPublicToPrivateProver() && verifyingKey.isTransferPublicToPrivateVerifier();
+            case CREDITS_PROGRAM_KEYS.unbond_public.locator:
+                return provingKey.isUnbondPublicProver() && verifyingKey.isUnbondPublicVerifier();
+            default:
+                return false;
+        }
+    }
+
+    /**
+     * Get fee_private function keys from the credits.aleo program. The keys must be cached prior to calling this
+     * method for it to work.
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    feePrivateKeys(): Promise<FunctionKeyPair> {
+        return this.functionKeys(OfflineSearchParams.feePrivateKeyParams());
+    };
+
+    /**
+     * Get fee_public function keys from the credits.aleo program. The keys must be cached prior to calling this
+     * method for it to work.
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    feePublicKeys(): Promise<FunctionKeyPair> {
+        return this.functionKeys(OfflineSearchParams.feePublicKeyParams());
+    };
+
+    /**
+     * Get join function keys from the credits.aleo program. The keys must be cached prior to calling this
+     * method for it to work.
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    joinKeys(): Promise<FunctionKeyPair> {
+        return this.functionKeys(OfflineSearchParams.joinKeyParams());
+    };
+
+    /**
+     * Get split function keys from the credits.aleo program. The keys must be cached prior to calling this
+     * method for it to work.
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    splitKeys(): Promise<FunctionKeyPair> {
+        return this.functionKeys(OfflineSearchParams.splitKeyParams());
+    };
+
+    /**
+     * Get keys for a variant of the transfer function from the credits.aleo program.
+     *
+     *
+     * @param {string} visibility Visibility of the transfer function (private, public, privateToPublic, publicToPrivate)
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified transfer function
+     *
+     * @example
+     * // Create a new OfflineKeyProvider
+     * const offlineKeyProvider = new OfflineKeyProvider();
+     *
+     * // Cache the keys for future use with the official locator
+     * const transferPublicProvingKeyBytes = await readBinaryFile('./resources/transfer_public.prover.a74565e');
+     * const transferPublicProvingKey = ProvingKey.fromBytes(transferPublicProvingKeyBytes);
+     *
+     * // Cache the transfer_public keys for future use with the OfflinKeyProvider's convenience method for
+     * // transfer_public (the verifying key will be cached automatically)
+     * offlineKeyProvider.insertTransferPublicKeys(transferPublicProvingKey);
+     *
+     * /// When they're needed, retrieve the keys from the cache
+     * const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");
+     */
+    transferKeys(visibility: string): Promise<FunctionKeyPair> {
+        if (PRIVATE_TRANSFER.has(visibility)) {
+            return this.functionKeys(OfflineSearchParams.transferPrivateKeyParams());
+        } else if (PRIVATE_TO_PUBLIC_TRANSFER.has(visibility)) {
+            return this.functionKeys(OfflineSearchParams.transferPrivateToPublicKeyParams());
+        } else if (PUBLIC_TRANSFER.has(visibility)) {
+            return this.functionKeys(OfflineSearchParams.transferPublicKeyParams());
+        } else if (PUBLIC_TRANSFER_AS_SIGNER.has(visibility)) {
+            return this.functionKeys(OfflineSearchParams.transferPublicAsSignerKeyParams());
+        } else if (PUBLIC_TO_PRIVATE_TRANSFER.has(visibility)) {
+            return this.functionKeys(OfflineSearchParams.transferPublicToPrivateKeyParams());
+        } else {
+            throw new Error("Invalid visibility type");
+        }
+    };
+
+    /**
+     * Get unbond_public function keys from the credits.aleo program
+     *
+     * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
+     */
+    async unBondPublicKeys(): Promise<FunctionKeyPair> {
+        return this.functionKeys(OfflineSearchParams.unbondPublicKeyParams());
+    };
+
+    /**
+     * Insert the proving and verifying keys for the bond_public function 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 bond_public before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertBondPublicKeys(provingKey: ProvingKey) {
+        if (provingKey.isBondPublicProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.bond_public.locator, [provingKey.toBytes(), VerifyingKey.bondPublicVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for bond_public");
+        }
+    }
+
+    /**
+     * Insert the proving and verifying keys for the claim_unbond_public function 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 claim_unbond_public before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertClaimUnbondPublicKeys(provingKey: ProvingKey) {
+        if (provingKey.isClaimUnbondPublicProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.claim_unbond_public.locator, [provingKey.toBytes(), VerifyingKey.claimUnbondPublicVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for claim_unbond_public");
+        }
+    }
+
+    /**
+     * Insert the proving and verifying keys for the fee_private function 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 fee_private before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertFeePrivateKeys(provingKey: ProvingKey) {
+        if (provingKey.isFeePrivateProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.fee_private.locator, [provingKey.toBytes(), VerifyingKey.feePrivateVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for fee_private");
+        }
+    }
+
+    /**
+     * Insert the proving and verifying keys for the fee_public function 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 fee_public before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertFeePublicKeys(provingKey: ProvingKey) {
+        if (provingKey.isFeePublicProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.fee_public.locator, [provingKey.toBytes(), VerifyingKey.feePublicVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for fee_public");
+        }
+    }
+
+    /**
+     * Insert the proving and verifying keys for the join function 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 join before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertJoinKeys(provingKey: ProvingKey) {
+        if (provingKey.isJoinProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.join.locator, [provingKey.toBytes(), VerifyingKey.joinVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for join");
+        }
+    }
+
+    /**
+     * Insert the proving and verifying keys for the set_validator_state function 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 set_validator_state before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertSetValidatorStateKeys(provingKey: ProvingKey) {
+        if (provingKey.isSetValidatorStateProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.set_validator_state.locator, [provingKey.toBytes(), VerifyingKey.setValidatorStateVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for set_validator_state");
+        }
+    }
+
+    /**
+     * Insert the proving and verifying keys for the split function 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 split before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertSplitKeys(provingKey: ProvingKey) {
+        if (provingKey.isSplitProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.split.locator, [provingKey.toBytes(), VerifyingKey.splitVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for split");
+        }
+    }
+
+    /**
+     * Insert the proving and verifying keys for the transfer_private function 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 transfer_private before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertTransferPrivateKeys(provingKey: ProvingKey) {
+        if (provingKey.isTransferPrivateProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.transfer_private.locator, [provingKey.toBytes(), VerifyingKey.transferPrivateVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for transfer_private");
+        }
+    }
+
+    /**
+     * Insert the proving and verifying keys for the transfer_private_to_public function 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 transfer_private_to_public before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertTransferPrivateToPublicKeys(provingKey: ProvingKey) {
+        if (provingKey.isTransferPrivateToPublicProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.transfer_private_to_public.locator, [provingKey.toBytes(), VerifyingKey.transferPrivateToPublicVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for transfer_private_to_public");
+        }
+    }
+
+    /**
+     * Insert the proving and verifying keys for the transfer_public function 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 transfer_public before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertTransferPublicKeys(provingKey: ProvingKey) {
+        if (provingKey.isTransferPublicProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.transfer_public.locator, [provingKey.toBytes(), VerifyingKey.transferPublicVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for transfer_public");
+        }
+    }
+
+    /**
+     * Insert the proving and verifying keys for the transfer_public_to_private function 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 transfer_public_to_private before inserting them into the cache.
+     *
+     * @param provingKey
+     */
+    insertTransferPublicToPrivateKeys(provingKey: ProvingKey) {
+        if (provingKey.isTransferPublicToPrivateProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.transfer_public_to_private.locator, [provingKey.toBytes(), VerifyingKey.transferPublicToPrivateVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for transfer_public_to_private");
+        }
+    }
+
+    insertUnbondPublicKeys(provingKey: ProvingKey) {
+        if (provingKey.isUnbondPublicProver()) {
+            this.cache.set(CREDITS_PROGRAM_KEYS.unbond_public.locator, [provingKey.toBytes(), VerifyingKey.unbondPublicVerifier().toBytes()]);
+        } else {
+            throw new Error("Attempted to insert invalid proving keys for unbond_public");
+        }
+    }
+}
+
+
+export {OfflineKeyProvider, OfflineSearchParams}
+
\ No newline at end of file diff --git a/sdk/docs/program-manager.ts.html b/sdk/docs/program-manager.ts.html new file mode 100644 index 000000000..04095c6d3 --- /dev/null +++ b/sdk/docs/program-manager.ts.html @@ -0,0 +1,1302 @@ +Source: program-manager.ts
On this page

program-manager.ts

import { Account } from "./account";
+import { AleoNetworkClient, ProgramImports } from "./network-client";
+
+import {
+    RecordProvider,
+    RecordSearchParams,
+} from "./record-provider";
+
+import {
+    AleoKeyProvider,
+    AleoKeyProviderParams,
+    FunctionKeyPair,
+    FunctionKeyProvider,
+    KeySearchParams,
+} from "./function-key-provider";
+
+import {
+    ExecutionResponse,
+    Execution as FunctionExecution,
+    OfflineQuery,
+    RecordPlaintext,
+    PrivateKey,
+    Program,
+    ProvingKey,
+    VerifyingKey,
+    Transaction,
+    ProgramManager as WasmProgramManager,
+    verifyFunctionExecution,
+} from "./wasm";
+
+import {
+    CREDITS_PROGRAM_KEYS,
+    PRIVATE_TRANSFER_TYPES,
+    VALID_TRANSFER_TYPES,
+} from "./constants";
+
+import { logAndThrow } from "./utils";
+
+/**
+ * Represents the options for executing a transaction in the Aleo network.
+ * This interface is used to specify the parameters required for building and submitting an execution transaction.
+ *
+ * @property {string} programName - The name of the program containing the function to be executed.
+ * @property {string} functionName - The name of the function to execute within the program.
+ * @property {number} fee - The fee to be paid for the transaction.
+ * @property {boolean} privateFee - If true, uses a private record to pay the fee; otherwise, uses the account's public credit balance.
+ * @property {string[]} inputs - The inputs to the function being executed.
+ * @property {RecordSearchParams} [recordSearchParams] - Optional parameters for searching for a record to pay the execution transaction fee.
+ * @property {KeySearchParams} [keySearchParams] - Optional parameters for finding the matching proving & verifying keys for the function.
+ * @property {string | RecordPlaintext} [feeRecord] - Optional fee record to use for the transaction.
+ * @property {ProvingKey} [provingKey] - Optional proving key to use for the transaction.
+ * @property {VerifyingKey} [verifyingKey] - Optional verifying key to use for the transaction.
+ * @property {PrivateKey} [privateKey] - Optional private key to use for the transaction.
+ * @property {OfflineQuery} [offlineQuery] - Optional offline query if creating transactions in an offline environment.
+ * @property {string | Program} [program] - Optional program source code to use for the transaction.
+ * @property {ProgramImports} [imports] - Optional programs that the program being executed imports.
+ */
+interface ExecuteOptions {
+    programName: string;
+    functionName: string;
+    fee: number;
+    privateFee: boolean;
+    inputs: string[];
+    recordSearchParams?: RecordSearchParams;
+    keySearchParams?: KeySearchParams;
+    feeRecord?: string | RecordPlaintext;
+    provingKey?: ProvingKey;
+    verifyingKey?: VerifyingKey;
+    privateKey?: PrivateKey;
+    offlineQuery?: OfflineQuery;
+    program?: string | Program;
+    imports?: ProgramImports;
+}
+
+/**
+ * The ProgramManager class is used to execute and deploy programs on the Aleo network and create value transfers.
+ */
+class ProgramManager {
+    account: Account | undefined;
+    keyProvider: FunctionKeyProvider;
+    host: string;
+    networkClient: AleoNetworkClient;
+    recordProvider: RecordProvider | undefined;
+
+    /** Create a new instance of the ProgramManager
+     *
+     * @param { string | undefined } host A host uri running the official Aleo API
+     * @param { FunctionKeyProvider | undefined } keyProvider A key provider that implements {@link FunctionKeyProvider} interface
+     * @param { RecordProvider | undefined } recordProvider A record provider that implements {@link RecordProvider} interface
+     */
+    constructor(host?: string | undefined, keyProvider?: FunctionKeyProvider | undefined, recordProvider?: RecordProvider | undefined) {
+        this.host = host ? host : 'https://api.explorer.provable.com/v1';
+        this.networkClient = new AleoNetworkClient(this.host);
+
+        this.keyProvider = keyProvider ? keyProvider : new AleoKeyProvider();
+        this.recordProvider = recordProvider;
+    }
+
+    /**
+     * Set the account to use for transaction submission to the Aleo network
+     *
+     * @param {Account} account Account to use for transaction submission
+     */
+    setAccount(account: Account) {
+        this.account = account;
+    }
+
+    /**
+     * Set the key provider that provides the proving and verifying keys for programs
+     *
+     * @param {FunctionKeyProvider} keyProvider
+     */
+    setKeyProvider(keyProvider: FunctionKeyProvider) {
+        this.keyProvider = keyProvider;
+    }
+
+    /**
+     * Set the host peer to use for transaction submission to the Aleo network
+     *
+     * @param host {string} Peer url to use for transaction submission
+     */
+    setHost(host: string) {
+        this.host = host;
+        this.networkClient.setHost(host);
+    }
+
+    /**
+     * Set the record provider that provides records for transactions
+     *
+     * @param {RecordProvider} recordProvider
+     */
+    setRecordProvider(recordProvider: RecordProvider) {
+        this.recordProvider = recordProvider;
+    }
+
+    /**
+     * Deploy an Aleo program to the Aleo network
+     *
+     * @param {string} program Program source code
+     * @param {number} fee Fee to pay for the transaction
+     * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
+     * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for searching for a record to use
+     * pay the deployment fee
+     * @param {string | RecordPlaintext | undefined} feeRecord Optional Fee record to use for the transaction
+     * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction
+     * @returns {string} The transaction id of the deployed program or a failure message from the network
+     *
+     * @example
+     * // Create a new NetworkClient, KeyProvider, and RecordProvider
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const keyProvider = new AleoKeyProvider();
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for deployments
+     * const program = "program hello_hello.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n";
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     *
+     * // Define a fee in credits
+     * const fee = 1.2;
+     *
+     * // Deploy the program
+     * const tx_id = await programManager.deploy(program, fee);
+     *
+     * // Verify the transaction was successful
+     * const transaction = await programManager.networkClient.getTransaction(tx_id);
+     */
+    async deploy(
+        program: string,
+        fee: number,
+        privateFee: boolean,
+        recordSearchParams?: RecordSearchParams,
+        feeRecord?: string | RecordPlaintext,
+        privateKey?: PrivateKey,
+    ): Promise<string> {
+        // Ensure the program is valid and does not exist on the network
+        try {
+            const programObject = Program.fromString(program);
+            let programSource;
+            try {
+                programSource = await this.networkClient.getProgram(programObject.id());
+            } catch (e) {
+                // Program does not exist on the network, deployment can proceed
+                console.log(`Program ${programObject.id()} does not exist on the network, deploying...`);
+            }
+            if (typeof programSource == "string") {
+                throw (`Program ${programObject.id()} already exists on the network, please rename your program`);
+            }
+        } catch (e: any) {
+            logAndThrow(`Error validating program: ${e.message}`);
+        }
+
+        // Get the private key from the account if it is not provided in the parameters
+        let deploymentPrivateKey = privateKey;
+        if (typeof privateKey === "undefined" && typeof this.account !== "undefined") {
+            deploymentPrivateKey = this.account.privateKey();
+        }
+
+        if (typeof deploymentPrivateKey === "undefined") {
+            throw("No private key provided and no private key set in the ProgramManager");
+        }
+
+        // Get the fee record from the account if it is not provided in the parameters
+        try {
+            feeRecord = privateFee ? <RecordPlaintext>await this.getCreditsRecord(fee, [], feeRecord, recordSearchParams) : undefined;
+        } catch (e: any) {
+            logAndThrow(`Error finding fee record. Record finder response: '${e.message}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
+        }
+
+        // Get the proving and verifying keys from the key provider
+        let feeKeys;
+        try {
+            feeKeys = privateFee ? <FunctionKeyPair>await this.keyProvider.feePrivateKeys() : <FunctionKeyPair>await this.keyProvider.feePublicKeys();
+        } catch (e: any) {
+            logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
+        }
+        const [feeProvingKey, feeVerifyingKey] = feeKeys;
+
+        // Resolve the program imports if they exist
+        let imports;
+        try {
+            imports = await this.networkClient.getProgramImports(program);
+        } catch (e: any) {
+            logAndThrow(`Error finding program imports. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network and the program is deployed to the network.`);
+        }
+
+        // Build a deployment transaction and submit it to the network
+        const tx = await WasmProgramManager.buildDeploymentTransaction(deploymentPrivateKey, program, fee, feeRecord, this.host, imports, feeProvingKey, feeVerifyingKey);
+        return await this.networkClient.submitTransaction(tx);
+    }
+
+    /**
+     * Builds an execution transaction for submission to the Aleo network.
+     *
+     * @param {ExecuteOptions} options - The options for the execution transaction.
+     * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error.
+     *
+     * @example
+     * // Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for executions
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     *
+     * // Build and execute the transaction
+     * const transaction = await programManager.buildExecutionTransaction({
+     *   programName: "hello_hello.aleo",
+     *   functionName: "hello_hello",
+     *   fee: 0.020,
+     *   privateFee: false,
+     *   inputs: ["5u32", "5u32"],
+     *   keySearchParams: { "cacheKey": "hello_hello:hello" }
+     * });
+     * const result = await programManager.networkClient.submitTransaction(transaction);
+     */
+    async buildExecutionTransaction(options: ExecuteOptions): Promise<Transaction> {
+        // Destructure the options object to access the parameters
+        const {
+            programName,
+            functionName,
+            fee,
+            privateFee,
+            inputs,
+            recordSearchParams,
+            keySearchParams,
+            privateKey,
+            offlineQuery
+        } = options;
+
+        let feeRecord = options.feeRecord;
+        let provingKey = options.provingKey;
+        let verifyingKey = options.verifyingKey;
+        let program = options.program;
+        let imports = options.imports;
+
+        // Ensure the function exists on the network
+        if (program === undefined) {
+            try {
+                program = <string>(await this.networkClient.getProgram(programName));
+            } catch (e: any) {
+                logAndThrow(`Error finding ${programName}. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network the program is deployed to the network.`);
+            }
+        } else if (program instanceof Program) {
+            program = program.toString();
+        }
+
+        // Get the private key from the account if it is not provided in the parameters
+        let executionPrivateKey = privateKey;
+        if (typeof privateKey === "undefined" && typeof this.account !== "undefined") {
+            executionPrivateKey = this.account.privateKey();
+        }
+
+        if (typeof executionPrivateKey === "undefined") {
+            throw("No private key provided and no private key set in the ProgramManager");
+        }
+
+        // Get the fee record from the account if it is not provided in the parameters
+        try {
+            feeRecord = privateFee ? <RecordPlaintext>await this.getCreditsRecord(fee, [], feeRecord, recordSearchParams) : undefined;
+        } catch (e: any) {
+            logAndThrow(`Error finding fee record. Record finder response: '${e.message}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
+        }
+
+        // Get the fee proving and verifying keys from the key provider
+        let feeKeys;
+        try {
+            feeKeys = privateFee ? <FunctionKeyPair>await this.keyProvider.feePrivateKeys() : <FunctionKeyPair>await this.keyProvider.feePublicKeys();
+        } catch (e: any) {
+            logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
+        }
+        const [feeProvingKey, feeVerifyingKey] = feeKeys;
+
+        // If the function proving and verifying keys are not provided, attempt to find them using the key provider
+        if (!provingKey || !verifyingKey) {
+            try {
+                [provingKey, verifyingKey] = <FunctionKeyPair>await this.keyProvider.functionKeys(keySearchParams);
+            } catch (e) {
+                console.log(`Function keys not found. Key finder response: '${e}'. The function keys will be synthesized`)
+            }
+        }
+
+        // Resolve the program imports if they exist
+        const numberOfImports = Program.fromString(program).getImports().length;
+        if (numberOfImports > 0 && !imports) {
+            try {
+                imports = <ProgramImports>await this.networkClient.getProgramImports(programName);
+            } catch (e: any) {
+                logAndThrow(`Error finding program imports. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network and the program is deployed to the network.`);
+            }
+        }
+
+        // Build an execution transaction and submit it to the network
+        return await WasmProgramManager.buildExecutionTransaction(executionPrivateKey, program, functionName, inputs, fee, feeRecord, this.host, imports, provingKey, verifyingKey, feeProvingKey, feeVerifyingKey, offlineQuery);
+    }
+
+    /**
+     * Builds an execution transaction for submission to the Aleo network.
+     *
+     * @param {ExecuteOptions} options - The options for the execution transaction.
+     * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error.
+     *
+     * @example
+     * // Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for executions
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     *
+     * // Build and execute the transaction
+     * const transaction = await programManager.execute({
+     *   programName: "hello_hello.aleo",
+     *   functionName: "hello_hello",
+     *   fee: 0.020,
+     *   privateFee: false,
+     *   inputs: ["5u32", "5u32"],
+     *   keySearchParams: { "cacheKey": "hello_hello:hello" }
+     * });
+     * const result = await programManager.networkClient.submitTransaction(transaction);
+     */
+    async execute(options: ExecuteOptions): Promise<string> {
+        const tx = <Transaction>await this.buildExecutionTransaction(options);
+        return await this.networkClient.submitTransaction(tx);
+    }
+
+    /**
+     * Run an Aleo program in offline mode
+     *
+     * @param {string} program Program source code containing the function to be executed
+     * @param {string} function_name Function name to execute
+     * @param {string[]} inputs Inputs to the function
+     * @param {number} proveExecution Whether to prove the execution of the function and return an execution transcript
+     * that contains the proof.
+     * @param {string[] | undefined} imports Optional imports to the program
+     * @param {KeySearchParams | undefined} keySearchParams Optional parameters for finding the matching proving &
+     * verifying keys for the function
+     * @param {ProvingKey | undefined} provingKey Optional proving key to use for the transaction
+     * @param {VerifyingKey | undefined} verifyingKey Optional verifying key to use for the transaction
+     * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction
+     * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
+     * @returns {Promise<string>}
+     *
+     * @example
+     * import { Account, Program } from '@provablehq/sdk';
+     *
+     * /// Create the source for the "helloworld" program
+     * const program = "program helloworld.aleo;\n\nfunction hello:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n";
+     * const programManager = new ProgramManager();
+     *
+     * /// Create a temporary account for the execution of the program
+     * const account = new Account();
+     * programManager.setAccount(account);
+     *
+     * /// Get the response and ensure that the program executed correctly
+     * const executionResponse = await programManager.run(program, "hello", ["5u32", "5u32"]);
+     * const result = executionResponse.getOutputs();
+     * assert(result === ["10u32"]);
+     */
+    async run(
+        program: string,
+        function_name: string,
+        inputs: string[],
+        proveExecution: boolean,
+        imports?: ProgramImports,
+        keySearchParams?: KeySearchParams,
+        provingKey?: ProvingKey,
+        verifyingKey?: VerifyingKey,
+        privateKey?: PrivateKey,
+        offlineQuery?: OfflineQuery,
+    ): Promise<ExecutionResponse> {
+        // Get the private key from the account if it is not provided in the parameters
+        let executionPrivateKey = privateKey;
+        if (typeof privateKey === "undefined" && typeof this.account !== "undefined") {
+            executionPrivateKey = this.account.privateKey();
+        }
+
+        if (typeof executionPrivateKey === "undefined") {
+            throw("No private key provided and no private key set in the ProgramManager");
+        }
+
+        // If the function proving and verifying keys are not provided, attempt to find them using the key provider
+        if (!provingKey || !verifyingKey) {
+            try {
+                [provingKey, verifyingKey] = <FunctionKeyPair>await this.keyProvider.functionKeys(keySearchParams);
+            } catch (e) {
+                console.log(`Function keys not found. Key finder response: '${e}'. The function keys will be synthesized`)
+            }
+        }
+
+        // Run the program offline and return the result
+        console.log("Running program offline")
+        console.log("Proving key: ", provingKey);
+        console.log("Verifying key: ", verifyingKey);
+        return WasmProgramManager.executeFunctionOffline(executionPrivateKey, program, function_name, inputs, proveExecution, false, imports, provingKey, verifyingKey, this.host, offlineQuery);
+    }
+
+    /**
+     * Join two credits records into a single credits record
+     *
+     * @param {RecordPlaintext | string} recordOne First credits record to join
+     * @param {RecordPlaintext | string} recordTwo Second credits record to join
+     * @param {number} fee Fee in credits pay for the join transaction
+     * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
+     * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the fee record to use
+     * to pay the fee for the join transaction
+     * @param {RecordPlaintext | string | undefined} feeRecord Fee record to use for the join transaction
+     * @param {PrivateKey | undefined} privateKey Private key to use for the join transaction
+     * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
+     * @returns {Promise<string>}
+     */
+    async join(
+        recordOne: RecordPlaintext | string,
+        recordTwo: RecordPlaintext | string,
+        fee: number,
+        privateFee: boolean,
+        recordSearchParams?: RecordSearchParams | undefined,
+        feeRecord?: RecordPlaintext | string | undefined,
+        privateKey?: PrivateKey,
+        offlineQuery?: OfflineQuery,
+    ): Promise<string> {
+        // Get the private key from the account if it is not provided in the parameters
+        let executionPrivateKey = privateKey;
+        if (typeof privateKey === "undefined" && typeof this.account !== "undefined") {
+            executionPrivateKey = this.account.privateKey();
+        }
+
+        if (typeof executionPrivateKey === "undefined") {
+            throw("No private key provided and no private key set in the ProgramManager");
+        }
+
+        // Get the proving and verifying keys from the key provider
+        let feeKeys;
+        let joinKeys
+        try {
+            feeKeys = privateFee ? <FunctionKeyPair>await this.keyProvider.feePrivateKeys() : <FunctionKeyPair>await this.keyProvider.feePublicKeys();
+            joinKeys = <FunctionKeyPair>await this.keyProvider.joinKeys();
+        } catch (e: any) {
+            logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
+        }
+        const [feeProvingKey, feeVerifyingKey] = feeKeys;
+        const [joinProvingKey, joinVerifyingKey] = joinKeys;
+
+        // Get the fee record from the account if it is not provided in the parameters
+        try {
+            feeRecord = privateFee ? <RecordPlaintext>await this.getCreditsRecord(fee, [], feeRecord, recordSearchParams) : undefined;
+        } catch (e: any) {
+            logAndThrow(`Error finding fee record. Record finder response: '${e.message}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
+        }
+
+        // Validate the records provided are valid plaintext records
+        try {
+            recordOne = recordOne instanceof RecordPlaintext ? recordOne : RecordPlaintext.fromString(recordOne);
+            recordTwo = recordTwo instanceof RecordPlaintext ? recordTwo : RecordPlaintext.fromString(recordTwo);
+        } catch (e: any) {
+            logAndThrow('Records provided are not valid. Please ensure they are valid plaintext records.')
+        }
+
+        // Build an execution transaction and submit it to the network
+        const tx = await WasmProgramManager.buildJoinTransaction(executionPrivateKey, recordOne, recordTwo, fee, feeRecord, this.host, joinProvingKey, joinVerifyingKey, feeProvingKey, feeVerifyingKey, offlineQuery);
+        return await this.networkClient.submitTransaction(tx);
+    }
+
+    /**
+     * Split credits into two new credits records
+     *
+     * @param {number} splitAmount Amount in microcredits to split from the original credits record
+     * @param {RecordPlaintext | string} amountRecord Amount record to use for the split transaction
+     * @param {PrivateKey | undefined} privateKey Optional private key to use for the split transaction
+     * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
+     * @returns {Promise<string>}
+     *
+     * @example
+     * // Create a new NetworkClient, KeyProvider, and RecordProvider
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const keyProvider = new AleoKeyProvider();
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for executions
+     * const programName = "hello_hello.aleo";
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * const record = "{  owner: aleo184vuwr5u7u0ha5f5k44067dd2uaqewxx6pe5ltha5pv99wvhfqxqv339h4.private,  microcredits: 45000000u64.private,  _nonce: 4106205762862305308495708971985748592380064201230396559307556388725936304984group.public}"
+     * const tx_id = await programManager.split(25000000, record);
+     * const transaction = await programManager.networkClient.getTransaction(tx_id);
+     */
+    async split(splitAmount: number, amountRecord: RecordPlaintext | string, privateKey?: PrivateKey, offlineQuery?: OfflineQuery): Promise<string> {
+        // Get the private key from the account if it is not provided in the parameters
+        let executionPrivateKey = privateKey;
+        if (typeof executionPrivateKey === "undefined" && typeof this.account !== "undefined") {
+            executionPrivateKey = this.account.privateKey();
+        }
+
+        if (typeof executionPrivateKey === "undefined") {
+            throw("No private key provided and no private key set in the ProgramManager");
+        }
+
+        // Get the split keys from the key provider
+        let splitKeys;
+        try {
+            splitKeys = <FunctionKeyPair>await this.keyProvider.splitKeys();
+        } catch (e: any) {
+            logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
+        }
+        const [splitProvingKey, splitVerifyingKey] = splitKeys;
+
+        // Validate the record to be split
+        try {
+            amountRecord = amountRecord instanceof RecordPlaintext ? amountRecord : RecordPlaintext.fromString(amountRecord);
+        } catch (e: any) {
+            logAndThrow("Record provided is not valid. Please ensure it is a valid plaintext record.");
+        }
+
+        // Build an execution transaction and submit it to the network
+        const tx = await WasmProgramManager.buildSplitTransaction(executionPrivateKey, splitAmount, amountRecord, this.host, splitProvingKey, splitVerifyingKey, offlineQuery);
+        return await this.networkClient.submitTransaction(tx);
+    }
+
+    /**
+     * Pre-synthesize proving and verifying keys for a program
+     *
+     * @param program {string} The program source code to synthesize keys for
+     * @param function_id {string} The function id to synthesize keys for
+     * @param inputs {Array<string>}  Sample inputs to the function
+     * @param privateKey {PrivateKey | undefined} Optional private key to use for the key synthesis
+     *
+     * @returns {Promise<FunctionKeyPair>}
+     */
+    async synthesizeKeys(
+        program: string,
+        function_id: string,
+        inputs: Array<string>,
+        privateKey?: PrivateKey,
+    ): Promise<FunctionKeyPair> {
+        // Resolve the program imports if they exist
+        let imports;
+
+        let executionPrivateKey = privateKey;
+        if (typeof executionPrivateKey === "undefined") {
+            if (typeof this.account !== "undefined") {
+                executionPrivateKey = this.account.privateKey();
+            } else {
+                executionPrivateKey = new PrivateKey();
+            }
+        }
+
+        // Attempt to run an offline execution of the program and extract the proving and verifying keys
+        try {
+            imports = await this.networkClient.getProgramImports(program);
+            const keyPair = await WasmProgramManager.synthesizeKeyPair(
+                executionPrivateKey,
+                program,
+                function_id,
+                inputs,
+                imports
+            );
+            return [<ProvingKey>keyPair.provingKey(), <VerifyingKey>keyPair.verifyingKey()];
+        } catch (e: any) {
+            logAndThrow(`Could not synthesize keys - error ${e.message}. Please ensure the program is valid and the inputs are correct.`);
+        }
+    }
+
+    /**
+     * Build a transaction to transfer credits to another account for later submission to the Aleo network
+     *
+     * @param {number} amount The amount of credits to transfer
+     * @param {string} recipient The recipient of the transfer
+     * @param {string} transferType The type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
+     * @param {number} fee The fee to pay for the transfer
+     * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
+     * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the amount and fee
+     * records for the transfer transaction
+     * @param {RecordPlaintext | string} amountRecord Optional amount record to use for the transfer
+     * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer
+     * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
+     * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
+     * @returns {Promise<string>} The transaction id of the transfer transaction
+     *
+     * @example
+     * // Create a new NetworkClient, KeyProvider, and RecordProvider
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const keyProvider = new AleoKeyProvider();
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for executions
+     * const programName = "hello_hello.aleo";
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * await programManager.initialize();
+     * const tx_id = await programManager.transfer(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "private", 0.2)
+     * const transaction = await programManager.networkClient.getTransaction(tx_id);
+     */
+    async buildTransferTransaction(
+        amount: number,
+        recipient: string,
+        transferType: string,
+        fee: number,
+        privateFee: boolean,
+        recordSearchParams?: RecordSearchParams,
+        amountRecord?: RecordPlaintext | string,
+        feeRecord?: RecordPlaintext | string,
+        privateKey?: PrivateKey,
+        offlineQuery?: OfflineQuery
+    ): Promise<Transaction> {
+        // Validate the transfer type
+        transferType = <string>validateTransferType(transferType);
+
+        // Get the private key from the account if it is not provided in the parameters
+        let executionPrivateKey = privateKey;
+        if (typeof executionPrivateKey === "undefined" && typeof this.account !== "undefined") {
+            executionPrivateKey = this.account.privateKey();
+        }
+
+        if (typeof executionPrivateKey === "undefined") {
+            throw("No private key provided and no private key set in the ProgramManager");
+        }
+
+        // Get the proving and verifying keys from the key provider
+        let feeKeys;
+        let transferKeys
+        try {
+            feeKeys = privateFee ? <FunctionKeyPair>await this.keyProvider.feePrivateKeys() : <FunctionKeyPair>await this.keyProvider.feePublicKeys();
+            transferKeys = <FunctionKeyPair>await this.keyProvider.transferKeys(transferType);
+        } catch (e: any) {
+            logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
+        }
+        const [feeProvingKey, feeVerifyingKey] = feeKeys;
+        const [transferProvingKey, transferVerifyingKey] = transferKeys;
+
+        // Get the amount and fee record from the account if it is not provided in the parameters
+        try {
+            // Track the nonces of the records found so no duplicate records are used
+            const nonces: string[] = [];
+            if (requiresAmountRecord(transferType)) {
+                // If the transfer type is private and requires an amount record, get it from the record provider
+                amountRecord = <RecordPlaintext>await this.getCreditsRecord(fee, [], amountRecord, recordSearchParams);
+                nonces.push(amountRecord.nonce());
+            } else {
+                amountRecord = undefined;
+            }
+            feeRecord = privateFee ? <RecordPlaintext>await this.getCreditsRecord(fee, nonces, feeRecord, recordSearchParams) : undefined;
+        } catch (e: any) {
+            logAndThrow(`Error finding fee record. Record finder response: '${e.message}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
+        }
+
+        // Build an execution transaction and submit it to the network
+        return await WasmProgramManager.buildTransferTransaction(executionPrivateKey, amount, recipient, transferType, amountRecord, fee, feeRecord, this.host, transferProvingKey, transferVerifyingKey, feeProvingKey, feeVerifyingKey, offlineQuery);
+    }
+
+    /**
+     * Build a transfer_public transaction to transfer credits to another account for later submission to the Aleo network
+     *
+     * @param {number} amount The amount of credits to transfer
+     * @param {string} recipient The recipient of the transfer
+     * @param {string} transferType The type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
+     * @param {number} fee The fee to pay for the transfer
+     * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
+     * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the amount and fee
+     * records for the transfer transaction
+     * @param {RecordPlaintext | string} amountRecord Optional amount record to use for the transfer
+     * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer
+     * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
+     * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
+     * @returns {Promise<string>} The transaction id of the transfer transaction
+     */
+    async buildTransferPublicTransaction(
+        amount: number,
+        recipient: string,
+        fee: number,
+        privateKey?: PrivateKey,
+        offlineQuery?: OfflineQuery
+    ): Promise<Transaction> {
+        return this.buildTransferTransaction(amount, recipient, "public", fee, false, undefined, undefined, undefined, privateKey, offlineQuery);
+    }
+
+    /**
+     * Build a transfer_public_as_signer transaction to transfer credits to another account for later submission to the Aleo network
+     *
+     * @param {number} amount The amount of credits to transfer
+     * @param {string} recipient The recipient of the transfer
+     * @param {string} transferType The type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
+     * @param {number} fee The fee to pay for the transfer
+     * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
+     * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the amount and fee
+     * records for the transfer transaction
+     * @param {RecordPlaintext | string} amountRecord Optional amount record to use for the transfer
+     * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer
+     * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
+     * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
+     * @returns {Promise<string>} The transaction id of the transfer transaction
+     */
+    async buildTransferPublicAsSignerTransaction(
+        amount: number,
+        recipient: string,
+        fee: number,
+        privateKey?: PrivateKey,
+        offlineQuery?: OfflineQuery
+    ): Promise<Transaction> {
+        return this.buildTransferTransaction(amount, recipient, "public", fee, false, undefined, undefined, undefined, privateKey, offlineQuery);
+    }
+
+    /**
+     * Transfer credits to another account
+     *
+     * @param {number} amount The amount of credits to transfer
+     * @param {string} recipient The recipient of the transfer
+     * @param {string} transferType The type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
+     * @param {number} fee The fee to pay for the transfer
+     * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
+     * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the amount and fee
+     * records for the transfer transaction
+     * @param {RecordPlaintext | string} amountRecord Optional amount record to use for the transfer
+     * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer
+     * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
+     * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
+     * @returns {Promise<string>} The transaction id of the transfer transaction
+     *
+     * @example
+     * // Create a new NetworkClient, KeyProvider, and RecordProvider
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * const keyProvider = new AleoKeyProvider();
+     * const recordProvider = new NetworkRecordProvider(account, networkClient);
+     *
+     * // Initialize a program manager with the key provider to automatically fetch keys for executions
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * await programManager.initialize();
+     * const tx_id = await programManager.transfer(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "private", 0.2)
+     * const transaction = await programManager.networkClient.getTransaction(tx_id);
+     */
+    async transfer(
+        amount: number,
+        recipient: string,
+        transferType: string,
+        fee: number,
+        privateFee: boolean,
+        recordSearchParams?: RecordSearchParams,
+        amountRecord?: RecordPlaintext | string,
+        feeRecord?: RecordPlaintext | string,
+        privateKey?: PrivateKey,
+        offlineQuery?: OfflineQuery
+    ): Promise<string> {
+        const tx = <Transaction>await this.buildTransferTransaction(amount, recipient, transferType, fee, privateFee, recordSearchParams, amountRecord, feeRecord, privateKey, offlineQuery);
+        return await this.networkClient.submitTransaction(tx);
+    }
+
+    /**
+     * Build transaction to bond credits to a validator for later submission to the Aleo Network
+     *
+     * @example
+     * // Create a keyProvider to handle key management
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     *
+     * // Create a new ProgramManager with the key that will be used to bond credits
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+     * programManager.setAccount(new Account("YourPrivateKey"));
+     *
+     * // Create the bonding transaction object for later submission
+     * const tx = await programManager.buildBondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
+     * console.log(tx);
+     *
+     * // The transaction can be later submitted to the network using the network client.
+     * const result = await programManager.networkClient.submitTransaction(tx);
+     *
+     * @returns string
+     * @param {string} staker_address Address of the staker who is bonding the credits
+     * @param {string} validator_address Address of the validator to bond to, if this address is the same as the staker (i.e. the
+     * executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently
+     * requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing
+     * validator and is different from the address of the executor of this function, it will bond the credits to that
+     * validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
+     * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.
+     * @param {number} amount The amount of credits to bond
+     * @param {Partial<ExecuteOptions>} options - Override default execution options.
+     */
+    async buildBondPublicTransaction(staker_address: string, validator_address: string, withdrawal_address: string, amount: number, options: Partial<ExecuteOptions> = {}) {
+        const scaledAmount = Math.trunc(amount * 1000000);
+
+        const {
+            programName = "credits.aleo",
+            functionName = "bond_public",
+            fee = options.fee || 0.86,
+            privateFee = false,
+            inputs = [staker_address, validator_address, withdrawal_address, `${scaledAmount.toString()}u64`],
+            keySearchParams = new AleoKeyProviderParams({
+                proverUri: CREDITS_PROGRAM_KEYS.bond_public.prover,
+                verifierUri: CREDITS_PROGRAM_KEYS.bond_public.verifier,
+                cacheKey: "credits.aleo/bond_public"
+            }),
+            program = this.creditsProgram(),
+            ...additionalOptions
+        } = options;
+
+        const executeOptions: ExecuteOptions = {
+            programName,
+            functionName,
+            fee,
+            privateFee,
+            inputs,
+            keySearchParams,
+            ...additionalOptions
+        };
+
+        return await this.buildExecutionTransaction(executeOptions);
+    }
+
+    /**
+     * Bond credits to validator.
+     *
+     * @example
+     * // Create a keyProvider to handle key management
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     *
+     * // Create a new ProgramManager with the key that will be used to bond credits
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+     * programManager.setAccount(new Account("YourPrivateKey"));
+     *
+     * // Create the bonding transaction
+     * const tx_id = await programManager.bondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
+     *
+     * @returns string
+     * @param {string} staker_address Address of the staker who is bonding the credits
+     * @param {string} validator_address Address of the validator to bond to, if this address is the same as the signer (i.e. the
+     * executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently
+     * requires a minimum of 1,000,000 credits to bond (subject to change). If the address is specified is an existing
+     * validator and is different from the address of the executor of this function, it will bond the credits to that
+     * validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
+     * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.
+     * @param {number} amount The amount of credits to bond
+     * @param {Options} options Options for the execution
+     */
+    async bondPublic(staker_address: string, validator_address: string, withdrawal_address:string, amount: number, options: Partial<ExecuteOptions> = {}) {
+        const tx = <Transaction>await this.buildBondPublicTransaction(staker_address, validator_address, withdrawal_address, amount, options);
+        return await this.networkClient.submitTransaction(tx);
+    }
+
+    /**
+     * Build a bond_validator transaction for later submission to the Aleo Network.
+     *
+     * @example
+     * // Create a keyProvider to handle key management
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     *
+     * // Create a new ProgramManager with the key that will be used to bond credits
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+     * programManager.setAccount(new Account("YourPrivateKey"));
+     *
+     * // Create the bond validator transaction object for later use.
+     * const tx = await programManager.buildBondValidatorTransaction("aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
+     * console.log(tx);
+     *
+     * // The transaction can later be submitted to the network using the network client.
+     * const tx_id = await programManager.networkClient.submitTransaction(tx);
+     *
+     * @returns string
+     * @param {string} validator_address Address of the validator to bond to, if this address is the same as the staker (i.e. the
+     * executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently
+     * requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing
+     * validator and is different from the address of the executor of this function, it will bond the credits to that
+     * validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
+     * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.
+     * @param {number} amount The amount of credits to bond
+     * @param {number} commission The commission rate for the validator (must be between 0 and 100 - an error will be thrown if it is not)
+     * @param {Partial<ExecuteOptions>} options - Override default execution options.
+     */
+    async buildBondValidatorTransaction(validator_address: string, withdrawal_address: string, amount: number, commission: number, options: Partial<ExecuteOptions> = {}) {
+        const scaledAmount = Math.trunc(amount * 1000000);
+
+        const adjustedCommission = Math.trunc(commission)
+
+        const {
+            programName = "credits.aleo",
+            functionName = "bond_validator",
+            fee = options.fee || 0.86,
+            privateFee = false,
+            inputs = [validator_address, withdrawal_address, `${scaledAmount.toString()}u64`, `${adjustedCommission.toString()}u8`],
+            keySearchParams = new AleoKeyProviderParams({
+                proverUri: CREDITS_PROGRAM_KEYS.bond_validator.prover,
+                verifierUri: CREDITS_PROGRAM_KEYS.bond_validator.verifier,
+                cacheKey: "credits.aleo/bond_validator"
+            }),
+            program = this.creditsProgram(),
+            ...additionalOptions
+        } = options;
+
+        const executeOptions: ExecuteOptions = {
+            programName,
+            functionName,
+            fee,
+            privateFee,
+            inputs,
+            keySearchParams,
+            ...additionalOptions
+        };
+
+        return await this.buildExecutionTransaction(executeOptions);
+    }
+
+    /**
+     * Build transaction to bond a validator.
+     *
+     * @example
+     * // Create a keyProvider to handle key management
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     *
+     * // Create a new ProgramManager with the key that will be used to bond credits
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+     * programManager.setAccount(new Account("YourPrivateKey"));
+     *
+     * // Create the bonding transaction
+     * const tx_id = await programManager.bondValidator("aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
+     *
+     * @returns string
+     * @param {string} validator_address Address of the validator to bond to, if this address is the same as the staker (i.e. the
+     * executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently
+     * requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing
+     * validator and is different from the address of the executor of this function, it will bond the credits to that
+     * validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.
+     * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.
+     * @param {number} amount The amount of credits to bond
+     * @param {number} commission The commission rate for the validator (must be between 0 and 100 - an error will be thrown if it is not)
+     * @param {Partial<ExecuteOptions>} options - Override default execution options.
+     */
+    async bondValidator(validator_address: string, withdrawal_address: string, amount: number, commission: number, options: Partial<ExecuteOptions> = {}) {
+        const tx = <Transaction>await this.buildBondValidatorTransaction(validator_address, withdrawal_address, amount, commission, options);
+        return await this.networkClient.submitTransaction(tx);
+    }
+
+    /**
+     * Build a transaction to unbond public credits from a validator in the Aleo network.
+     *
+     * @param {string} staker_address - The address of the staker who is unbonding the credits.
+     * @param {number} amount - The amount of credits to unbond (scaled by 1,000,000).
+     * @param {Partial<ExecuteOptions>} options - Override default execution options.
+     * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error message.
+     *
+     * @example
+     * // Create a keyProvider to handle key management.
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     *
+     * // Create a new ProgramManager with the key that will be used to unbond credits.
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+     * const tx = await programManager.buildUnbondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", 2000000);
+     * console.log(tx);
+     *
+     * // The transaction can be submitted later to the network using the network client.
+     * programManager.networkClient.submitTransaction(tx);
+     */
+    async buildUnbondPublicTransaction(staker_address: string, amount: number, options: Partial<ExecuteOptions> = {}): Promise<Transaction> {
+        const scaledAmount = Math.trunc(amount * 1000000);
+
+        const {
+            programName = "credits.aleo",
+            functionName = "unbond_public",
+            fee = options.fee || 1.3,
+            privateFee = false,
+            inputs = [staker_address, `${scaledAmount.toString()}u64`],
+            keySearchParams = new AleoKeyProviderParams({
+                proverUri: CREDITS_PROGRAM_KEYS.unbond_public.prover,
+                verifierUri: CREDITS_PROGRAM_KEYS.unbond_public.verifier,
+                cacheKey: "credits.aleo/unbond_public"
+            }),
+            program = this.creditsProgram(),
+            ...additionalOptions
+        } = options;
+
+        const executeOptions: ExecuteOptions = {
+            programName,
+            functionName,
+            fee,
+            privateFee,
+            inputs,
+            keySearchParams,
+            ...additionalOptions
+        };
+
+        return this.buildExecutionTransaction(executeOptions);
+    }
+
+    /**
+     * Unbond a specified amount of staked credits.
+     *
+     * @example
+     * // Create a keyProvider to handle key management
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     *
+     * // Create a new ProgramManager with the key that will be used to bond credits
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+     * programManager.setAccount(new Account("YourPrivateKey"));
+     *
+     * // Create the bonding transaction and send it to the network
+     * const tx_id = await programManager.unbondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", 10);
+     *
+     * @returns string
+     * @param {string} staker_address Address of the staker who is unbonding the credits
+     * @param {number} amount Amount of credits to unbond. If the address of the executor of this function is an
+     * existing validator, it will subtract this amount of credits from the validator's staked credits. If there are
+     * less than 1,000,000 credits staked pool after the unbond, the validator will be removed from the validator set.
+     * If the address of the executor of this function is not a validator and has credits bonded as a delegator, it will
+     * subtract this amount of credits from the delegator's staked credits. If there are less than 10 credits bonded
+     * after the unbond operation, the delegator will be removed from the validator's staking pool.
+     * @param {ExecuteOptions} options Options for the execution
+     */
+    async unbondPublic(staker_address: string, amount: number, options: Partial<ExecuteOptions> = {}): Promise<string> {
+        const tx = <Transaction>await this.buildUnbondPublicTransaction(staker_address, amount, options);
+        return await this.networkClient.submitTransaction(tx);
+    }
+
+    /**
+     * Build a transaction to claim unbonded public credits in the Aleo network.
+     *
+     * @param {string} staker_address - The address of the staker who is claiming the credits.
+     * @param {Partial<ExecuteOptions>} options - Override default execution options.
+     * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error message.
+     *
+     * @example
+     * // Create a keyProvider to handle key management
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     *
+     * // Create a new ProgramManager with the key that will be used to claim unbonded credits.
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+     *
+     * // Create the claim unbonded transaction object for later use.
+     * const tx = await programManager.buildClaimUnbondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j");
+     * console.log(tx);
+     *
+     * // The transaction can be submitted later to the network using the network client.
+     * programManager.networkClient.submitTransaction(tx);
+     */
+    async buildClaimUnbondPublicTransaction(staker_address: string, options: Partial<ExecuteOptions> = {}): Promise<Transaction> {
+        const {
+            programName = "credits.aleo",
+            functionName = "claim_unbond_public",
+            fee = options.fee || 2,
+            privateFee = false,
+            inputs = [staker_address],
+            keySearchParams = new AleoKeyProviderParams({
+                proverUri: CREDITS_PROGRAM_KEYS.claim_unbond_public.prover,
+                verifierUri: CREDITS_PROGRAM_KEYS.claim_unbond_public.verifier,
+                cacheKey: "credits.aleo/claim_unbond_public"
+            }),
+            program = this.creditsProgram(),
+            ...additionalOptions
+        } = options;
+
+        const executeOptions: ExecuteOptions = {
+            programName,
+            functionName,
+            fee,
+            privateFee,
+            inputs,
+            keySearchParams,
+            ...additionalOptions
+        };
+
+        return await this.buildExecutionTransaction(executeOptions);
+    }
+
+    /**
+     * Claim unbonded credits. If credits have been unbonded by the account executing this function, this method will
+     * claim them and add them to the public balance of the account.
+     *
+     * @example
+     * // Create a keyProvider to handle key management
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     *
+     * // Create a new ProgramManager with the key that will be used to bond credits
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+     * programManager.setAccount(new Account("YourPrivateKey"));
+     *
+     * // Create the bonding transaction
+     * const tx_id = await programManager.claimUnbondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j");
+     *
+     * @param {string} staker_address Address of the staker who is claiming the credits
+     * @param {ExecuteOptions} options
+     * @returns string
+     */
+    async claimUnbondPublic(staker_address: string, options: Partial<ExecuteOptions> = {}): Promise<string> {
+        const tx = <Transaction>await this.buildClaimUnbondPublicTransaction(staker_address, options);
+        return await this.networkClient.submitTransaction(tx);
+    }
+
+    /**
+     * Build a set_validator_state transaction for later usage.
+     *
+     * This function allows a validator to set their state to be either opened or closed to new stakers.
+     * When the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator.
+     * When the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond.
+     *
+     * This function serves two primary purposes:
+     * 1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers.
+     * 2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them.
+     *
+     * @example
+     * // Create a keyProvider to handle key management
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     *
+     * // Create a new ProgramManager with the key that will be used to bond credits
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+     * programManager.setAccount(new Account("ValidatorPrivateKey"));
+     *
+     * // Create the bonding transaction
+     * const tx = await programManager.buildSetValidatorStateTransaction(true);
+     *
+     * // The transaction can be submitted later to the network using the network client.
+     * programManager.networkClient.submitTransaction(tx);
+     *
+     * @returns string
+     * @param {boolean} validator_state
+     * @param {Partial<ExecuteOptions>} options - Override default execution options
+     */
+    async buildSetValidatorStateTransaction(validator_state: boolean, options: Partial<ExecuteOptions> = {}) {
+        const {
+            programName = "credits.aleo",
+            functionName = "set_validator_state",
+            fee = 1,
+            privateFee = false,
+            inputs = [validator_state.toString()],
+            keySearchParams = new AleoKeyProviderParams({
+                proverUri: CREDITS_PROGRAM_KEYS.set_validator_state.prover,
+                verifierUri: CREDITS_PROGRAM_KEYS.set_validator_state.verifier,
+                cacheKey: "credits.aleo/set_validator_state"
+            }),
+            ...additionalOptions
+        } = options;
+
+        const executeOptions: ExecuteOptions = {
+            programName,
+            functionName,
+            fee,
+            privateFee,
+            inputs,
+            keySearchParams,
+            ...additionalOptions
+        };
+
+        return await this.execute(executeOptions);
+    }
+
+    /**
+     * Submit a set_validator_state transaction to the Aleo Network.
+     *
+     * This function allows a validator to set their state to be either opened or closed to new stakers.
+     * When the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator.
+     * When the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond.
+     *
+     * This function serves two primary purposes:
+     * 1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers.
+     * 2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them.
+     *
+     * @example
+     * // Create a keyProvider to handle key management
+     * const keyProvider = new AleoKeyProvider();
+     * keyProvider.useCache = true;
+     *
+     * // Create a new ProgramManager with the key that will be used to bond credits
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
+     * programManager.setAccount(new Account("ValidatorPrivateKey"));
+     *
+     * // Create the bonding transaction
+     * const tx_id = await programManager.setValidatorState(true);
+     *
+     * @returns string
+     * @param {boolean} validator_state
+     * @param {Partial<ExecuteOptions>} options - Override default execution options
+     */
+    async setValidatorState(validator_state: boolean, options: Partial<ExecuteOptions> = {}) {
+        const tx = <string>await this.buildSetValidatorStateTransaction(validator_state, options);
+        return this.networkClient.submitTransaction(tx);
+    }
+
+    /**
+     * Verify a proof of execution from an offline execution
+     *
+     * @param {executionResponse} executionResponse
+     * @returns {boolean} True if the proof is valid, false otherwise
+     */
+    verifyExecution(executionResponse: ExecutionResponse): boolean {
+        try {
+            const execution = <FunctionExecution>executionResponse.getExecution();
+            const function_id = executionResponse.getFunctionId();
+            const program = executionResponse.getProgram();
+            const verifyingKey = executionResponse.getVerifyingKey();
+            return verifyFunctionExecution(execution, verifyingKey, program, function_id);
+        } catch(e) {
+            console.warn("The execution was not found in the response, cannot verify the execution");
+            return false;
+        }
+    }
+
+    /**
+     * Create a program object from a program's source code
+     *
+     * @param {string} program Program source code
+     * @returns {Program} The program object
+     */
+    createProgramFromSource(program: string): Program {
+        return Program.fromString(program);
+    }
+
+    /**
+     * Get the credits program object
+     *
+     * @returns {Program} The credits program object
+     */
+    creditsProgram(): Program {
+        return Program.getCreditsProgram();
+    }
+
+    /**
+     * Verify a program is valid
+     *
+     * @param {string} program The program source code
+     */
+    verifyProgram(program: string): boolean {
+        try {
+            <Program>Program.fromString(program);
+            return true;
+        } catch (e) {
+            return false;
+        }
+    }
+
+    // Internal utility function for getting a credits.aleo record
+    async getCreditsRecord(amount: number, nonces: string[], record?: RecordPlaintext | string, params?: RecordSearchParams): Promise<RecordPlaintext> {
+        try {
+            return record instanceof RecordPlaintext ? record : RecordPlaintext.fromString(<string>record);
+        } catch (e) {
+            try {
+                const recordProvider = <RecordProvider>this.recordProvider;
+                return <RecordPlaintext>(await recordProvider.findCreditsRecord(amount, true, nonces, params))
+            } catch (e: any) {
+                logAndThrow(`Error finding fee record. Record finder response: '${e.message}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
+            }
+        }
+    }
+}
+
+// Ensure the transfer type requires an amount record
+function requiresAmountRecord(transferType: string): boolean {
+    return PRIVATE_TRANSFER_TYPES.has(transferType);
+}
+
+// Validate the transfer type
+function validateTransferType(transferType: string): string {
+    return VALID_TRANSFER_TYPES.has(transferType) ? transferType :
+        logAndThrow(`Invalid transfer type '${transferType}'. Valid transfer types are 'private', 'privateToPublic', 'public', and 'publicToPrivate'.`);
+}
+
+export { ProgramManager }
+
\ No newline at end of file diff --git a/sdk/docs/record-provider.ts.html b/sdk/docs/record-provider.ts.html new file mode 100644 index 000000000..d1baceb6f --- /dev/null +++ b/sdk/docs/record-provider.ts.html @@ -0,0 +1,306 @@ +Source: record-provider.ts
On this page

record-provider.ts

import { RecordPlaintext } from "./wasm";
+import { logAndThrow } from "./utils";
+import { Account } from "./account";
+import { AleoNetworkClient } from "./network-client";
+
+/**
+ * Interface for record search parameters. This allows for arbitrary search parameters to be passed to record provider
+ * implementations.
+ */
+interface RecordSearchParams {
+    [key: string]: any; // This allows for arbitrary keys with any type values
+}
+
+/**
+ * Interface for a record provider. A record provider is used to find records for use in deployment and execution
+ * transactions on the Aleo Network. A default implementation is provided by the NetworkRecordProvider class. However,
+ * a custom implementation can be provided (say if records are synced locally to a database from the network) by
+ * implementing this interface.
+ */
+interface RecordProvider {
+    account: Account
+
+    /**
+     * Find a credits.aleo record with a given number of microcredits from the chosen provider
+     *
+     * @param {number} microcredits The number of microcredits to search for
+     * @param {boolean} unspent Whether or not the record is unspent
+     * @param {string[]} nonces Nonces of records already found so they are not found again
+     * @param {RecordSearchParams} searchParameters Additional parameters to search for
+     * @returns {Promise<RecordPlaintext>} The record if found, otherwise an error
+     *
+     * @example
+     * // A class implementing record provider can be used to find a record with a given number of microcredits
+     * const record = await recordProvider.findCreditsRecord(5000, true, []);
+     *
+     * // When a record is found but not yet used, its nonce should be added to the nonces array so that it is not
+     * // found again if a subsequent search is performed
+     * const record2 = await recordProvider.findCreditsRecord(5000, true, [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
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+     */
+    findCreditsRecord(microcredits: number, unspent: boolean,  nonces?: string[], searchParameters?: RecordSearchParams): Promise<RecordPlaintext>;
+
+    /**
+     * Find a list of credit.aleo records with a given number of microcredits from the chosen provider
+     *
+     * @param {number} microcreditAmounts A list of separate microcredit amounts to search for (e.g. [5000, 100000])
+     * @param {boolean} unspent Whether or not the record is unspent
+     * @param {string[]} nonces Nonces of records already found so that they are not found again
+     * @param {RecordSearchParams} searchParameters Additional parameters to search for
+     * @returns {Promise<RecordPlaintext[]>} A list of records with a value greater or equal to the amounts specified if such records exist, otherwise an error
+     *
+     * @example
+     * // A class implementing record provider can be used to find a record with a given number of microcredits
+     * const records = await recordProvider.findCreditsRecords([5000, 5000], true, []);
+     *
+     * // When a record is found but not yet used, it's nonce should be added to the nonces array so that it is not
+     * // found again if a subsequent search is performed
+     * const nonces = [];
+     * records.forEach(record => { nonces.push(record.nonce()) });
+     * const records2 = await recordProvider.findCreditsRecord(5000, true, nonces);
+     *
+     * // 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
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+     */
+    findCreditsRecords(microcreditAmounts: number[], unspent: boolean, nonces?: string[], searchParameters?: RecordSearchParams): Promise<RecordPlaintext[]>;
+
+    /**
+     * Find an arbitrary record
+     * @param {boolean} unspent Whether or not the record is unspent
+     * @param {string[]} nonces Nonces of records already found so that they are not found again
+     * @param {RecordSearchParams} searchParameters Additional parameters to search for
+     * @returns {Promise<RecordPlaintext>} The record if found, otherwise an error
+     *
+     * @example
+     * // The RecordSearchParams interface can be used to create parameters for custom record searches which can then
+     * // be passed to the record provider. An example of how this would be done for the credits.aleo program is shown
+     * // below.
+     *
+     * class CustomRecordSearch implements RecordSearchParams {
+     *     startHeight: number;
+     *     endHeight: number;
+     *     amount: number;
+     *     program: string;
+     *     recordName: string;
+     *     constructor(startHeight: number, endHeight: number, credits: number, maxRecords: number, programName: string, recordName: string) {
+     *         this.startHeight = startHeight;
+     *         this.endHeight = endHeight;
+     *         this.amount = amount;
+     *         this.program = programName;
+     *         this.recordName = recordName;
+     *     }
+     * }
+     *
+     * const params = new CustomRecordSearch(0, 100, 5000, "credits.aleo", "credits");
+     *
+     * const record = await recordProvider.findRecord(true, [], params);
+     */
+    findRecord(unspent: boolean, nonces?: string[], searchParameters?: RecordSearchParams): Promise<RecordPlaintext>;
+
+    /**
+     * Find multiple records from arbitrary programs
+     *
+     * @param {boolean} unspent Whether or not the record is unspent
+     * @param {string[]} nonces Nonces of records already found so that they are not found again
+     * @param {RecordSearchParams} searchParameters Additional parameters to search for
+     * @returns {Promise<RecordPlaintext>} The record if found, otherwise an error
+     *
+     * // The RecordSearchParams interface can be used to create parameters for custom record searches which can then
+     * // be passed to the record provider. An example of how this would be done for the credits.aleo program is shown
+     * // below.
+     *
+     * class CustomRecordSearch implements RecordSearchParams {
+     *     startHeight: number;
+     *     endHeight: number;
+     *     amount: number;
+     *     maxRecords: number;
+     *     programName: string;
+     *     recordName: string;
+     *     constructor(startHeight: number, endHeight: number, credits: number, maxRecords: number, programName: string, recordName: string) {
+     *         this.startHeight = startHeight;
+     *         this.endHeight = endHeight;
+     *         this.amount = amount;
+     *         this.maxRecords = maxRecords;
+     *         this.programName = programName;
+     *         this.recordName = recordName;
+     *     }
+     * }
+     *
+     * const params = new CustomRecordSearch(0, 100, 5000, 2, "credits.aleo", "credits");
+     * const records = await recordProvider.findRecord(true, [], params);
+     */
+    findRecords(unspent: boolean, nonces?: string[], searchParameters?: RecordSearchParams): Promise<RecordPlaintext[]>;
+}
+
+/**
+ * A record provider implementation that uses the official Aleo API to find records for usage in program execution and
+ * deployment, wallet functionality, and other use cases.
+ */
+class NetworkRecordProvider implements RecordProvider {
+    account: Account;
+    networkClient: AleoNetworkClient;
+    constructor(account: Account, networkClient: AleoNetworkClient) {
+        this.account = account;
+        this.networkClient = networkClient;
+    }
+
+    /**
+     * Set the account used to search for records
+     *
+     * @param {Account} account The account to use for searching for records
+     */
+    setAccount(account: Account) {
+        this.account = account;
+    }
+
+    /**
+     * Find a list of credit records with a given number of microcredits by via the official Aleo API
+     *
+     * @param {number[]} microcredits The number of microcredits to search for
+     * @param {boolean} unspent Whether or not the record is unspent
+     * @param {string[]} nonces Nonces of records already found so that they are not found again
+     * @param {RecordSearchParams} searchParameters Additional parameters to search for
+     * @returns {Promise<RecordPlaintext>} The record if found, otherwise an error
+     *
+     * @example
+     * // Create a new NetworkRecordProvider
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * 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, []);
+     *
+     * // 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()]);
+     *
+     * // 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
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+     *
+     * */
+    async findCreditsRecords(microcredits: number[], unspent: boolean, nonces?: string[], searchParameters?: RecordSearchParams): Promise<RecordPlaintext[]> {
+        let startHeight = 0;
+        let endHeight = 0;
+
+        if (searchParameters) {
+            if ("startHeight" in searchParameters && typeof searchParameters["endHeight"] == "number") {
+                startHeight = searchParameters["startHeight"];
+            }
+
+            if ("endHeight" in searchParameters && typeof searchParameters["endHeight"] == "number") {
+                endHeight = searchParameters["endHeight"];
+            }
+        }
+
+        // If the end height is not specified, use the current block height
+        if (endHeight == 0) {
+            const end = await this.networkClient.getLatestHeight();
+            endHeight = end;
+        }
+
+        // If the start height is greater than the end height, throw an error
+        if (startHeight >= endHeight) {
+            logAndThrow("Start height must be less than end height");
+        }
+
+        return await this.networkClient.findUnspentRecords(startHeight, endHeight, this.account.privateKey(), microcredits, undefined, nonces);
+    }
+
+    /**
+     * Find a credit record with a given number of microcredits by via the official Aleo API
+     *
+     * @param {number} microcredits The number of microcredits to search for
+     * @param {boolean} unspent Whether or not the record is unspent
+     * @param {string[]} nonces Nonces of records already found so that they are not found again
+     * @param {RecordSearchParams} searchParameters Additional parameters to search for
+     * @returns {Promise<RecordPlaintext>} The record if found, otherwise an error
+     *
+     * @example
+     * // Create a new NetworkRecordProvider
+     * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+     * 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, []);
+     *
+     * // 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()]);
+     *
+     * // 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
+     * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
+     * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
+     */
+    async findCreditsRecord(microcredits: number, unspent: boolean, nonces?: string[], searchParameters?: RecordSearchParams): Promise<RecordPlaintext> {
+        let records = null;
+
+        try {
+            records = await this.findCreditsRecords([microcredits], unspent, nonces, searchParameters);
+        } catch (e) {}
+
+        if (records && records.length > 0) {
+            return records[0];
+        }
+
+        console.error("Record not found with error:", records);
+        throw new Error("Record not found");
+    }
+
+    /**
+     * Find an arbitrary record. WARNING: This function is not implemented yet and will throw an error.
+     */
+    async findRecord(unspent: boolean, nonces?: string[], searchParameters?: RecordSearchParams): Promise<RecordPlaintext> {
+        throw new Error("Method not implemented.");
+    }
+
+    /**
+     * Find multiple arbitrary records. WARNING: This function is not implemented yet and will throw an error.
+     */
+    async findRecords(unspent: boolean, nonces?: string[], searchParameters?: RecordSearchParams): Promise<RecordPlaintext[]> {
+        throw new Error("Method not implemented.");
+    }
+
+}
+
+/**
+ * BlockHeightSearch is a RecordSearchParams implementation that allows for searching for records within a given
+ * block height range.
+ *
+ * @example
+ * // Create a new BlockHeightSearch
+ * const params = new BlockHeightSearch(89995, 99995);
+ *
+ * // Create a new NetworkRecordProvider
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
+ * 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 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);
+ *
+ */
+class BlockHeightSearch implements RecordSearchParams {
+    startHeight: number;
+    endHeight: number;
+    constructor(startHeight: number, endHeight: number) {
+        this.startHeight = startHeight;
+        this.endHeight = endHeight;
+    }
+}
+
+export { BlockHeightSearch, NetworkRecordProvider, RecordProvider, RecordSearchParams};
+
\ No newline at end of file diff --git a/sdk/docs/scripts/core.js b/sdk/docs/scripts/core.js index d5e5a4303..47ae5e7c8 100644 --- a/sdk/docs/scripts/core.js +++ b/sdk/docs/scripts/core.js @@ -11,12 +11,46 @@ var MIN_FONT_SIZE = 10; var localStorage = window.localStorage; function getTheme() { - var body = document.body; + var theme = localStorage.getItem(themeLocalStorageKey); + + if (theme) return theme; + + theme = document.body.getAttribute('data-theme'); + + switch (theme) { + case 'dark': + case 'light': + return theme; + case 'fallback-dark': + if ( + // eslint-disable-next-line no-undef + window.matchMedia('(prefers-color-scheme)').matches && + // eslint-disable-next-line no-undef + window.matchMedia('(prefers-color-scheme: light)').matches + ) { + return 'light'; + } + + return 'dark'; + + case 'fallback-light': + if ( + // eslint-disable-next-line no-undef + window.matchMedia('(prefers-color-scheme)').matches && + // eslint-disable-next-line no-undef + window.matchMedia('(prefers-color-scheme: dark)').matches + ) { + return 'dark'; + } - return body.getAttribute('data-theme'); + return 'light'; + + default: + return 'dark'; + } } -function updateTheme(theme) { +function localUpdateTheme(theme) { var body = document.body; var svgUse = document.querySelectorAll('.theme-svg-use'); var iconID = theme === 'dark' ? '#light-theme-icon' : '#dark-theme-icon'; @@ -28,7 +62,10 @@ function updateTheme(theme) { svgUse.forEach(function (svg) { svg.setAttribute('xlink:href', iconID); }); +} +function updateTheme(theme) { + localUpdateTheme(theme); localStorage.setItem(themeLocalStorageKey, theme); } @@ -44,17 +81,7 @@ function toggleTheme() { (function () { var theme = getTheme(); - var themeStoredInLocalStorage = localStorage.getItem(themeLocalStorageKey); - - if (themeStoredInLocalStorage) { - if (theme === themeStoredInLocalStorage) { - return; - } - - updateTheme(themeStoredInLocalStorage); - } else { - localStorage.setItem(themeLocalStorageKey, theme); - } + updateTheme(theme); })(); /** @@ -145,12 +172,15 @@ function bringElementIntoView(element, updateHistory = true) { /** * tocbotInstance is defined in layout.tmpl * It is defined when we are initializing tocbot. - * + * */ // eslint-disable-next-line no-undef if (tocbotInstance) { - // eslint-disable-next-line no-undef - setTimeout(() => tocbotInstance.updateTocListActiveElement(element), 60) + setTimeout( + // eslint-disable-next-line no-undef + () => tocbotInstance.updateTocListActiveElement(element), + 60 + ); } var navbar = document.querySelector('.navbar-container'); var body = document.querySelector('.main-content'); @@ -249,7 +279,6 @@ function addAnchor() { * @param {string} value */ function copy(value) { - console.log(value); const el = document.createElement('textarea'); el.value = value; @@ -401,9 +430,9 @@ function getFontSize() { return currentFontSize; } -function updateFontSize(fontSize) { +function localUpdateFontSize(fontSize) { html.style.fontSize = fontSize + 'px'; - localStorage.setItem(fontSizeLocalStorageKey, fontSize); + var fontSizeText = document.querySelector( '#b77a68a492f343baabea06fad81f651e' ); @@ -413,6 +442,11 @@ function updateFontSize(fontSize) { } } +function updateFontSize(fontSize) { + localUpdateFontSize(fontSize); + localStorage.setItem(fontSizeLocalStorageKey, fontSize); +} + (function () { var fontSize = getFontSize(); var fontSizeInLocalStorage = localStorage.getItem(fontSizeLocalStorageKey); @@ -452,8 +486,9 @@ function fontSizeTooltip() { return `
- ";return'
'+('
'+t.toLocaleUpperCase()+"
")+e+"
"}function getPreDiv(){var e=document.createElement("div");return e.classList.add("pre-div"),e}function processAllPre(){var e=document.querySelectorAll("pre"),t=document.querySelector("#PeOAagUepe"),o=document.querySelector("#VuAckcnZhf"),n=0,i=0,c=(t&&(i=t.getBoundingClientRect().height),o&&(n=o.getBoundingClientRect().height),window.innerHeight-n-i-250);e.forEach(function(e,t){var o,n=e.parentNode;n&&"true"===n.getAttribute("data-skip-pre-process")||(n=getPreDiv(),o=getPreTopBar(t="ScDloZOMdL"+t,e.getAttribute("data-lang")||"code"),n.innerHTML=o,e.style.maxHeight=c+"px",e.id=t,e.classList.add("prettyprint"),e.parentNode.insertBefore(n,e),n.appendChild(e))})}function highlightAndBringLineIntoView(){var e=window.location.hash.replace("#line","");try{var t='[data-line-number="'+e+'"',o=document.querySelector(t);o.scrollIntoView(),o.parentNode.classList.add("selected")}catch(e){console.error(e)}}function getFontSize(){var e=16;try{e=Number.parseInt(html.style.fontSize.split("px")[0],10)}catch(e){console.log(e)}return e}function updateFontSize(e){html.style.fontSize=e+"px",localStorage.setItem(fontSizeLocalStorageKey,e);var t=document.querySelector("#b77a68a492f343baabea06fad81f651e");t&&(t.innerHTML=e)}function incrementFont(e){var t=getFontSize();ttocbotInstance.updateTocListActiveElement(e),60),o=document.querySelector(".navbar-container"),n=document.querySelector(".main-content"),i=e.getBoundingClientRect().top,c=16,o&&(c+=o.scrollHeight),n&&n.scrollBy(0,i-c),t&&history.pushState(null,null,"#"+e.id))}function bringLinkToView(e){e.preventDefault(),e.stopPropagation();var e=e.currentTarget.getAttribute("href");!e||(e=document.getElementById(e.slice(1)))&&bringElementIntoView(e)}function bringIdToViewOnMount(){var e,t;isSourcePage()||""!==(e=window.location.hash)&&((t=document.getElementById(e.slice(1)))||(e=decodeURI(e),t=document.getElementById(e.slice(1))),t&&bringElementIntoView(t,!1))}function createAnchorElement(e){var t=document.createElement("a");return t.textContent="#",t.href="#"+e,t.classList.add("link-anchor"),t.onclick=bringLinkToView,t}function addAnchor(){var e=document.querySelector(".main-content").querySelector("section");[e.querySelectorAll("h1"),e.querySelectorAll("h2"),e.querySelectorAll("h3"),e.querySelectorAll("h4")].forEach(function(e){e.forEach(function(e){var t=createAnchorElement(e.id);e.classList.add("has-anchor"),e.append(t)})})}function copy(e){const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}function showTooltip(e){var t=document.getElementById(e);t.classList.add("show-tooltip"),setTimeout(function(){t.classList.remove("show-tooltip")},3e3)}function copyFunction(e){var t=document.getElementById(e);copy((t.querySelector(".linenums")||t.querySelector("code")).innerText.trim().replace(/(^\t)/gm,"")),showTooltip("tooltip-"+e)}function hideTocOnSourcePage(){isSourcePage()&&(document.querySelector(".toc-container").style.display="none")}function getPreTopBar(e,t=""){e='";return'
'+('
'+t.toLocaleUpperCase()+"
")+e+"
"}function getPreDiv(){var e=document.createElement("div");return e.classList.add("pre-div"),e}function processAllPre(){var e=document.querySelectorAll("pre"),t=document.querySelector("#PeOAagUepe"),o=document.querySelector("#VuAckcnZhf"),n=0,i=0,c=(t&&(i=t.getBoundingClientRect().height),o&&(n=o.getBoundingClientRect().height),window.innerHeight-n-i-250);e.forEach(function(e,t){var o,n=e.parentNode;n&&"true"===n.getAttribute("data-skip-pre-process")||(n=getPreDiv(),o=getPreTopBar(t="ScDloZOMdL"+t,e.getAttribute("data-lang")||"code"),n.innerHTML=o,e.style.maxHeight=c+"px",e.id=t,e.classList.add("prettyprint"),e.parentNode.insertBefore(n,e),n.appendChild(e))})}function highlightAndBringLineIntoView(){var e=window.location.hash.replace("#line","");try{var t='[data-line-number="'+e+'"',o=document.querySelector(t);o.scrollIntoView(),o.parentNode.classList.add("selected")}catch(e){console.error(e)}}function getFontSize(){var e=16;try{e=Number.parseInt(html.style.fontSize.split("px")[0],10)}catch(e){console.log(e)}return e}function localUpdateFontSize(e){html.style.fontSize=e+"px";var t=document.querySelector("#b77a68a492f343baabea06fad81f651e");t&&(t.innerHTML=e)}function updateFontSize(e){localUpdateFontSize(e),localStorage.setItem(fontSizeLocalStorageKey,e)}function incrementFont(e){var t=getFontSize();t
- `}function initTooltip(){tippy(".theme-toggle",{content:"Toggle Theme",delay:500}),tippy(".search-button",{content:"Search",delay:500}),tippy(".font-size",{content:"Change font size",delay:500}),tippy(".codepen-button",{content:"Open code in CodePen",placement:"left"}),tippy(".copy-code",{content:"Copy this code",placement:"left"}),tippy(".font-size",{content:fontSizeTooltip(),trigger:"click",interactive:!0,allowHTML:!0,placement:"left"})}function fixTable(){for(const t of document.querySelectorAll("table")){if(t.classList.contains("hljs-ln"))return;var e=document.createElement("div");e.classList.add("table-div"),t.parentNode.insertBefore(e,t),e.appendChild(t)}}function hideMobileMenu(){var e=document.querySelector("#mobile-sidebar"),t=document.querySelector("#mobile-menu"),o=t.querySelector("use");e&&e.classList.remove("show"),t&&t.setAttribute("data-isopen","false"),o&&o.setAttribute("xlink:href","#menu-icon")}function showMobileMenu(){var e=document.querySelector("#mobile-sidebar"),t=document.querySelector("#mobile-menu"),o=t.querySelector("use");e&&e.classList.add("show"),t&&t.setAttribute("data-isopen","true"),o&&o.setAttribute("xlink:href","#close-icon")}function onMobileMenuClick(){("true"===document.querySelector("#mobile-menu").getAttribute("data-isopen")?hideMobileMenu:showMobileMenu)()}function initMobileMenu(){var e=document.querySelector("#mobile-menu");e&&e.addEventListener("click",onMobileMenuClick)}function addHrefToSidebarTitle(){document.querySelectorAll(".sidebar-title-anchor").forEach(function(e){e.setAttribute("href",baseURL)})}function onDomContentLoaded(){var e=document.querySelectorAll(".theme-toggle");initMobileMenu(),e&&e.forEach(function(e){e.addEventListener("click",toggleTheme)}),hljs.addPlugin({"after:highlightElement":function(e){e.el.parentNode.setAttribute("data-lang","code")}}),hljs.highlightAll(),hljs.initLineNumbersOnLoad({singleLine:!0}),initAccordion(),addAnchor(),processAllPre(),hideTocOnSourcePage(),setTimeout(function(){bringIdToViewOnMount(),isSourcePage()&&highlightAndBringLineIntoView()},1e3),initTooltip(),fixTable(),addHrefToSidebarTitle()}!function(){var e=getTheme(),t=localStorage.getItem(themeLocalStorageKey);t?e!==t&&updateTheme(t):localStorage.setItem(themeLocalStorageKey,e)}(),function(){var e=getFontSize(),t=localStorage.getItem(fontSizeLocalStorageKey);t?(t=Number.parseInt(t,10))!==e&&updateFontSize(t):updateFontSize(e)}(),window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",e=>{e=new URL(e.newURL);""!==e.hash&&bringIdToViewOnMount(e.hash)}); \ No newline at end of file + `}function initTooltip(){tippy(".theme-toggle",{content:"Toggle Theme",delay:500}),tippy(".search-button",{content:"Search",delay:500}),tippy(".font-size",{content:"Change font size",delay:500}),tippy(".codepen-button",{content:"Open code in CodePen",placement:"left"}),tippy(".copy-code",{content:"Copy this code",placement:"left"}),tippy(".font-size",{content:fontSizeTooltip(),trigger:"click",interactive:!0,allowHTML:!0,placement:"left"})}function fixTable(){for(const t of document.querySelectorAll("table")){if(t.classList.contains("hljs-ln"))return;var e=document.createElement("div");e.classList.add("table-div"),t.parentNode.insertBefore(e,t),e.appendChild(t)}}function hideMobileMenu(){var e=document.querySelector("#mobile-sidebar"),t=document.querySelector("#mobile-menu"),o=t.querySelector("use");e&&e.classList.remove("show"),t&&t.setAttribute("data-isopen","false"),o&&o.setAttribute("xlink:href","#menu-icon")}function showMobileMenu(){var e=document.querySelector("#mobile-sidebar"),t=document.querySelector("#mobile-menu"),o=t.querySelector("use");e&&e.classList.add("show"),t&&t.setAttribute("data-isopen","true"),o&&o.setAttribute("xlink:href","#close-icon")}function onMobileMenuClick(){("true"===document.querySelector("#mobile-menu").getAttribute("data-isopen")?hideMobileMenu:showMobileMenu)()}function initMobileMenu(){var e=document.querySelector("#mobile-menu");e&&e.addEventListener("click",onMobileMenuClick)}function addHrefToSidebarTitle(){document.querySelectorAll(".sidebar-title-anchor").forEach(function(e){e.setAttribute("href",baseURL)})}function highlightActiveLinkInSidebar(){var e=document.location.href.split("/");const t=decodeURI(e[e.length-1]);let o=document.querySelector(`.sidebar a[href*='${t}']`);if(!o)try{o=document.querySelector(`.sidebar a[href*='${t.split("#")[0]}']`)}catch(e){return void console.error(e)}o&&(o.parentElement.classList.add("active"),o.scrollIntoView())}function onDomContentLoaded(){var e=document.querySelectorAll(".theme-toggle");initMobileMenu(),e&&e.forEach(function(e){e.addEventListener("click",toggleTheme)}),hljs.addPlugin({"after:highlightElement":function(e){e.el.parentNode.setAttribute("data-lang","code")}}),hljs.highlightAll(),hljs.initLineNumbersOnLoad({singleLine:!0}),initAccordion(),addAnchor(),processAllPre(),hideTocOnSourcePage(),setTimeout(function(){bringIdToViewOnMount(),isSourcePage()&&highlightAndBringLineIntoView()},1e3),initTooltip(),fixTable(),addHrefToSidebarTitle(),highlightActiveLinkInSidebar()}updateTheme(getTheme()),function(){var e=getFontSize(),t=localStorage.getItem(fontSizeLocalStorageKey);t?(t=Number.parseInt(t,10))!==e&&updateFontSize(t):updateFontSize(e)}(),window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",e=>{e=new URL(e.newURL);""!==e.hash&&bringIdToViewOnMount(e.hash)}),window.addEventListener("storage",e=>{"undefined"!==e.newValue&&(initTooltip(),e.key===themeLocalStorageKey&&localUpdateTheme(e.newValue),e.key===fontSizeLocalStorageKey&&localUpdateFontSize(e.newValue))}); \ No newline at end of file diff --git a/sdk/docs/scripts/search.min.js b/sdk/docs/scripts/search.min.js index c20e606b0..5358bced8 100644 --- a/sdk/docs/scripts/search.min.js +++ b/sdk/docs/scripts/search.min.js @@ -1,6 +1,6 @@ -const searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainer=document.querySelector("#PkfLWpAbet"),searchWrapper=document.querySelector("#iCxFxjkHbP"),searchCloseButton=document.querySelector("#VjLlGakifb"),searchInput=document.querySelector("#vpcKVYIppa"),resultBox=document.querySelector("#fWwVHRuDuN");function showResultText(e){resultBox.innerHTML=`${e}`}function hideSearch(){window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,searchContainer&&(searchContainer.style.display="none")}function listenCloseKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenCloseKey))}function showSearch(){try{hideMobileMenu()}catch(e){console.error(e)}window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),searchContainer&&(searchContainer.style.display="flex",window.addEventListener("keyup",listenCloseKey)),searchInput&&searchInput.focus()}async function fetchAllData(){var{hostname:e,protocol:t,port:n}=location,t=t+"//"+e+(""!==n?":"+n:"")+baseURL,e=new URL("data/search.json",t);const a=await fetch(e);n=(await a.json()).list;return n}function onClickSearchItem(t){const n=t.currentTarget;if(n){const a=n.getAttribute("href")||"";t=a.split("#")[1]||"";let e=document.getElementById(t);e||(t=decodeURI(t),e=document.getElementById(t)),e&&setTimeout(function(){bringElementIntoView(e)},100)}}function buildSearchResult(e){let t="";var n=/(<([^>]+)>)/gi;for(const s of e){const{title:c="",description:i=""}=s.item;var a=s.item.link.replace('.*/,""),o=c.replace(n,""),r=i.replace(n,"");t+=` - -
${o}
-
${r||"No description available."}
-
+const searchId="LiBfqbJVcV",searchHash="#"+searchId,searchContainer=document.querySelector("#PkfLWpAbet"),searchWrapper=document.querySelector("#iCxFxjkHbP"),searchCloseButton=document.querySelector("#VjLlGakifb"),searchInput=document.querySelector("#vpcKVYIppa"),resultBox=document.querySelector("#fWwVHRuDuN");function showResultText(e){resultBox.innerHTML=`${e}`}function hideSearch(){window.location.hash===searchHash&&history.go(-1),window.onhashchange=null,searchContainer&&(searchContainer.style.display="none")}function listenCloseKey(e){"Escape"===e.key&&(hideSearch(),window.removeEventListener("keyup",listenCloseKey))}function showSearch(){try{hideMobileMenu()}catch(e){console.error(e)}window.onhashchange=hideSearch,window.location.hash!==searchHash&&history.pushState(null,null,searchHash),searchContainer&&(searchContainer.style.display="flex",window.addEventListener("keyup",listenCloseKey)),searchInput&&searchInput.focus()}async function fetchAllData(){var{hostname:e,protocol:t,port:n}=location,t=t+"//"+e+(""!==n?":"+n:"")+baseURL,e=new URL("data/search.json",t);const a=await fetch(e);n=(await a.json()).list;return n}function onClickSearchItem(t){const n=t.currentTarget;if(n){const a=n.getAttribute("href")||"";t=a.split("#")[1]||"";let e=document.getElementById(t);e||(t=decodeURI(t),e=document.getElementById(t)),e&&setTimeout(function(){bringElementIntoView(e)},100)}}function buildSearchResult(e){let t="";var n=/(<([^>]+)>)/gi;for(const s of e){const{title:c="",description:i=""}=s.item;var a=s.item.link.replace('.*/,""),o=c.replace(n,""),r=i.replace(n,"");t+=` + +
${o}
+
${r||"No description available."}
+
`}return t}function getSearchResult(e,t,n){var t={...{shouldSort:!0,threshold:.4,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:t}},a=Fuse.createIndex(t.keys,e);const o=new Fuse(e,t,a),r=o.search(n);return 20{o=null,a||t.apply(this,e)},n),a&&!o&&t.apply(this,e)}}let searchData;async function search(e){e=e.target.value;if(resultBox)if(e){if(!searchData){showResultText("Loading...");try{searchData=await fetchAllData()}catch(e){return console.log(e),void showResultText("Failed to load result.")}}e=getSearchResult(searchData,["title","description"],e);e.length?resultBox.innerHTML=buildSearchResult(e):showResultText("No result found! Try some different combination.")}else showResultText("Type anything to view search result");else console.error("Search result container not found")}function onDomContentLoaded(){const e=document.querySelectorAll(".search-button");var t=debounce(search,300);searchCloseButton&&searchCloseButton.addEventListener("click",hideSearch),e&&e.forEach(function(e){e.addEventListener("click",showSearch)}),searchContainer&&searchContainer.addEventListener("click",hideSearch),searchWrapper&&searchWrapper.addEventListener("click",function(e){e.stopPropagation()}),searchInput&&searchInput.addEventListener("keyup",t),window.location.hash===searchHash&&showSearch()}window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",function(){window.location.hash===searchHash&&showSearch()}); \ No newline at end of file diff --git a/sdk/docs/sdk/docs/public/aleo.svg b/sdk/docs/sdk/docs/public/aleo.svg new file mode 100644 index 000000000..aba4ea2da --- /dev/null +++ b/sdk/docs/sdk/docs/public/aleo.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/sdk/docs/styles/clean-jsdoc-theme-base.css b/sdk/docs/styles/clean-jsdoc-theme-base.css index 8a41c293a..070a022f2 100644 --- a/sdk/docs/styles/clean-jsdoc-theme-base.css +++ b/sdk/docs/styles/clean-jsdoc-theme-base.css @@ -1,46 +1,54 @@ @font-face { - font-family: 'heading'; - src: url('../fonts/WorkSans-Bold.ttf') format('truetype'); - font-display: swap; + font-display: swap; + font-family: 'heading'; + src: url('../fonts/WorkSans-Bold.ttf') format('truetype'); + } @font-face { - font-family: 'body'; - src: url('../fonts/OpenSans-Regular.ttf') format('truetype'); - font-display: swap; + font-display: swap; + font-family: 'body'; + src: url('../fonts/OpenSans-Regular.ttf') format('truetype'); + } @font-face { - font-family: 'code'; - src: url('../fonts/Inconsolata-Regular.ttf') format('truetype'); - font-display: swap; + font-display: swap; + font-family: 'code'; + src: url('../fonts/Inconsolata-Regular.ttf') format('truetype'); + } :root { - --outer-wrapper-max-width: 65rem; + --outer-wrapper-max-width: 65rem; + } * { - box-sizing: border-box; - margin: 0; - padding: 0; + box-sizing: border-box; + margin: 0; + padding: 0; + } html, body { - min-height: 100%; - width: 100%; - line-height: 1.75; + line-height: 1.75; + min-height: 100%; + width: 100%; + } body { - font-family: 'body'; - overflow-x: hidden; - position: relative; + font-family: 'body'; + overflow-x: hidden; + position: relative; + } b { - font-family: heading; + font-family: heading; + } h1, @@ -49,213 +57,258 @@ h3, h4, h5, h6 { - font-family: 'heading'; - font-weight: normal; - line-height: 1.75; + font-family: 'heading'; + font-weight: normal; + line-height: 1.75; + } h1 { - font-size: 3.5rem; - margin: 0; + font-size: 3.5rem; + margin: 0; + } h2 { - font-size: 2.25rem; - margin: 2rem 0 0; + font-size: 2.25rem; + margin: 2rem 0 0; + } h3 { - font-size: 1.5rem; + font-size: 1.5rem; + } h4 { - font-size: 1.25rem; + font-size: 1.25rem; + } h5 { - font-size: 1rem; + font-size: 1rem; + } h6 { - font-size: 1rem; + font-size: 1rem; + } img { - max-width: 100%; + max-width: 100%; + } a { - text-decoration: none; + text-decoration: none; + } a:hover { - text-decoration: underline; + text-decoration: underline; + } /* badges */ + a img { - margin-right: 0.5rem; + margin-right: 0.5rem; + } p { - margin: 1rem 0; + margin: 1rem 0; + } article ul { - list-style: none; + list-style: disc; } article ul li, article ol li { - padding: 0.5rem 0; + padding: 0.5rem 0; + } article ol, article ul { - padding-left: 3rem; + padding-left: 2rem; + } article ol p, article ul p { - margin: 0; + margin: 0; + } /* stylelint-disable-next-line */ .variation { - display: none; + display: none; + } .signature-attributes { - font-style: italic; - font-weight: lighter; + font-style: italic; + font-weight: lighter; + } .ancestors a { - text-decoration: none; + text-decoration: none; + } .important { - font-weight: bold; + font-weight: bold; + } .signature { - font-family: 'code'; + font-family: 'code'; + } .name { - font-family: 'code'; - font-weight: bold; + font-family: 'code'; + font-weight: bold; + } blockquote { - font-size: 0.875rem; - padding: 0.0625rem 1.25rem; - border-radius: 1rem; - margin: 0.5rem 0; + border-radius: 1rem; + font-size: 0.875rem; + margin: 0.5rem 0; + padding: 0.0625rem 1.25rem; + } .details { - border-radius: 1rem; - margin: 1rem 0; + border-radius: 1rem; + margin: 1rem 0; + } .details .details-item-container { - display: flex; - padding: 1rem 2rem; + display: flex; + padding: 1rem 2rem; + } dt { - font-family: heading; + font-family: heading; + } .details dt { - float: left; - min-width: 11rem; + float: left; + min-width: 11rem; + } .details ul { - margin: 0; - display: inline-flex; - list-style-type: none; + display: inline-flex; + list-style-type: none; + margin: 0; + } .details ul li { - display: inline-flex; - margin-right: 0.6125rem; - padding: 0; - word-break: break-word; + display: inline-flex; + margin-right: 0.6125rem; + padding: 0; + word-break: break-word; + } /* stylelint-disable-next-line */ .details ul li p { - margin: 0; + margin: 0; + } /* stylelint-disable */ .details pre.prettyprint { - margin: 0; + margin: 0; + } /* stylelint-enable */ .details .object-value { - padding-top: 0; + padding-top: 0; + } .description { - margin-bottom: 2rem; + margin-bottom: 2rem; + } .method-member-container table { - margin-top: 1rem; + margin-top: 1rem; + } .pre-div .hljs-ln { - margin: 0; + margin: 0; + } .code-caption { - font-size: 0.875rem; + font-size: 0.875rem; + } .prettyprint { - font-size: 0.875rem; - overflow: auto; + font-size: 0.875rem; + overflow: auto; + } +/* stylelint-disable-next-line selector-no-qualifying-type,rule-empty-line-before */ pre.prettyprint { - margin-top: 3rem; + margin-top: 3rem; + } .prettyprint.source { - width: inherit; + width: inherit; + } .prettyprint code { - display: block; - font-size: 1rem; - line-height: 1.75; - padding: 0 0 1rem; + display: block; + font-size: 1rem; + line-height: 1.75; + padding: 0 0 1rem; + } .prettyprint .compact { - padding: 0; + padding: 0; + } +/* stylelint-disable-next-line selector-no-qualifying-type,rule-empty-line-before */ h4.name { - margin-top: 0.5rem; + margin-top: 0.5rem; + } .params, .props, table { - border-collapse: separate; - border-spacing: 0 0.5rem; - border-radius: 0.5rem; - font-size: 0.875rem; - margin: 0; - width: 100%; + border-collapse: separate; + border-radius: 0.5rem; + border-spacing: 0 0.5rem; + font-size: 0.875rem; + margin: 0; + width: 100%; + } table td:first-child, @@ -263,8 +316,9 @@ table td:first-child, table thead th:first-child, .params thead th:first-child, .props thead th:first-child { - border-top-left-radius: 1rem; - border-bottom-left-radius: 1rem; + border-bottom-left-radius: 1rem; + border-top-left-radius: 1rem; + } table td:last-child, @@ -272,21 +326,24 @@ table td:last-child, table thead th:last-child, .params thead th:last-child, .props thead th:last-child { - border-top-right-radius: 1rem; - border-bottom-right-radius: 1rem; + border-bottom-right-radius: 1rem; + border-top-right-radius: 1rem; + } table th, .params th { - position: sticky; - top: 0; + position: sticky; + top: 0; + } .params .name, .props .name, .name code { - font-family: 'code'; - font-size: 1rem; + font-family: 'code'; + font-size: 1rem; + } .params td, @@ -295,681 +352,808 @@ table th, .props th, th, td { - display: table-cell; - margin: 0; - padding: 1rem 2rem; - text-align: left; - vertical-align: top; + display: table-cell; + margin: 0; + padding: 1rem 2rem; + text-align: left; + vertical-align: top; + } .params thead tr, .props thead tr { - font-weight: bold; + font-weight: bold; + } /* stylelint-disable */ .params .params thead tr, .props .props thead tr { - font-weight: bold; + font-weight: bold; + } .params td.description > p:first-child, .props td.description > p:first-child { - margin-top: 0; - padding-top: 0; + margin-top: 0; + padding-top: 0; + } .params td.description > p:last-child, .props td.description > p:last-child { - margin-bottom: 0; - padding-bottom: 0; + margin-bottom: 0; + padding-bottom: 0; + } dl.param-type { - margin-bottom: 1rem; - padding-bottom: 1rem; + margin-bottom: 1rem; + padding-bottom: 1rem; + } /* stylelint-enable */ .param-type dt, .param-type dd { - display: inline-block; + display: inline-block; + } .param-type dd { - font-family: 'code'; - font-size: 1rem; + font-family: 'code'; + font-size: 1rem; + } code { - border-radius: 0.3rem; - font-family: 'code'; - font-size: 1rem; - padding: 0.1rem 0.4rem; + border-radius: 0.3rem; + font-family: 'code'; + font-size: 1rem; + padding: 0.1rem 0.4rem; + } .mt-20 { - margin-top: 1.5rem; + margin-top: 1.5rem; + } .codepen-form { - bottom: 0; - position: absolute; - right: 0.6125rem; + bottom: 0; + position: absolute; + right: 0.6125rem; + } .body-wrapper { - display: flex; - flex-direction: column; - height: 100vh; - position: relative; + display: flex; + flex-direction: column; + height: 100vh; + position: relative; + } .sidebar-container { - position: fixed; - display: flex; - padding: 1rem; - top: 0; - bottom: 0; - left: 0; - width: 25rem; - z-index: 10; + bottom: 0; + display: flex; + left: 0; + padding: 1rem; + position: fixed; + top: 0; + width: 25rem; + z-index: 10; + } .sidebar { - border-radius: 1rem; - flex: 1; - padding: 1.5rem 0; - overflow: hidden; - display: flex; - flex-direction: column; + border-radius: 1rem; + display: flex; + flex: 1; + flex-direction: column; + overflow: hidden; + padding: 1.5rem 0; + } .sidebar-title { - margin: 0; - padding: 0 2rem; - text-decoration: none; - font-size: 1.5rem; - font-family: heading; + font-family: heading; + font-size: 1.5rem; + margin: 0 0 2rem; + padding: 0 2rem; + text-decoration: none; + } .sidebar-title:hover { - text-decoration: none; + text-decoration: none; + } .sidebar-items-container { - margin-top: 5rem; - overflow: auto; - flex: 1; - position: relative; + flex: 1; + overflow: auto; + position: relative; + } .sidebar-section-title { - padding: 0.5rem 2rem; - font-family: heading; - font-size: 1.25rem; - border-radius: 1rem; + border-radius: 1rem; + font-family: heading; + font-size: 1.25rem; + padding: 0.5rem 2rem; + } .with-arrow { - align-items: center; - cursor: pointer; - display: flex; + align-items: center; + cursor: pointer; + display: flex; + } .with-arrow div { - flex: 1; + flex: 1; + } .with-arrow svg { - height: 1rem; - width: 1rem; - transition: transform 0.3s; + height: 1rem; + transition: transform 0.3s; + width: 1rem; + } .with-arrow[data-isopen='true'] svg { - transform: rotate(180deg); + transform: rotate(180deg); + } .sidebar-section-children-container { - border-radius: 0.5rem; - overflow: hidden; + border-radius: 0.5rem; + overflow: hidden; + } .sidebar-section-children a { - display: block; - width: 100%; - padding: 0.25rem 2rem; + display: block; + padding: 0.25rem 2rem; + width: 100%; + } .sidebar-section-children a { - text-decoration: none; + text-decoration: none; + } .with-arrow[data-isopen='false'] + .sidebar-section-children-container { - height: 0; - overflow: hidden; + height: 0; + overflow: hidden; + } .with-arrow[data-isopen='true'] + .sidebar-section-children-container { - height: auto; + height: auto; + } .toc-container { - position: fixed; - top: 0; - right: 4rem; - bottom: 0; - width: 16rem; - z-index: 10; + bottom: 0; + position: fixed; + right: 4rem; + top: 0; + width: 16rem; + z-index: 10; + } .toc-content { - padding-top: 10rem; - display: flex; - flex-direction: column; - height: 100%; + display: flex; + flex-direction: column; + height: 100%; + padding-top: 10rem; + } +/* stylelint-disable-next-line selector-max-id,rule-empty-line-before */ #eed4d2a0bfd64539bb9df78095dec881 { - margin: 2rem 0; - flex: 1; - overflow: auto; + flex: 1; + margin: 2rem 0; + overflow: auto; + } .toc-list { - padding-left: 1rem; - list-style: none; + list-style: none; + padding-left: 1rem; + } .toc-link { - display: block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - width: 100%; + display: block; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 100%; + } .toc-link.is-active-link { - font-family: heading; + font-family: heading; + } .has-anchor { - position: relative; + position: relative; + } .link-anchor { - padding: 0 0.5rem; + padding: 0 0.5rem; + } .has-anchor .link-anchor { - position: absolute; - left: 0; - top: 0; - transform: translateX(-100%); - text-decoration: none; - visibility: hidden; + left: 0; + position: absolute; + text-decoration: none; + top: 0; + transform: translateX(-100%); + visibility: hidden; + } .has-anchor:hover .link-anchor { - visibility: visible; + visibility: visible; + } .navbar-container { - position: fixed; - z-index: 10; - top: 0; - left: 25rem; - right: 25rem; - height: 7rem; - padding-top: 1rem; - display: flex; - justify-content: center; + display: flex; + height: 7rem; + justify-content: center; + left: 25rem; + padding-top: 1rem; + position: fixed; + right: 25rem; + top: 0; + z-index: 10; + } .navbar { - display: flex; - padding: 1rem 4rem 1rem 2rem; - flex: 1; - max-width: var(--outer-wrapper-max-width); + display: flex; + flex: 1; + max-width: var(--outer-wrapper-max-width); + padding: 1rem 4rem 1rem 2rem; + } .navbar-left-items { - display: flex; - flex: 1; + display: flex; + flex: 1; + } .navbar-right-items { - display: flex; + display: flex; + } .icon-button svg { - height: 1rem; - width: 1rem; + height: 1rem; + width: 1rem; + } .icon-button { - background: transparent; - position: relative; - display: inline-flex; - border: 0; - padding: 0.5rem; - border-radius: 50%; - cursor: pointer; - transition: background 0.3s; + background: transparent; + border: 0; + border-radius: 50%; + cursor: pointer; + display: inline-flex; + padding: 0.5rem; + position: relative; + transition: background 0.3s; + } .navbar-right-item { - display: flex; - justify-content: center; - align-items: center; - margin: 0 0.25rem; + align-items: center; + display: flex; + justify-content: center; + margin: 0 0.25rem; + } .navbar-item { - border-radius: 0.5rem; - overflow: hidden; + border-radius: 0.5rem; + overflow: hidden; + } .navbar-item a { - display: inline-block; - padding: 1rem 2rem; - text-decoration: none; - transition: 0.3s; + display: inline-block; + padding: 1rem 2rem; + text-decoration: none; + transition: 0.3s; + } .font-size-tooltip { - display: flex; - align-items: center; - margin: 0 -0.5rem; + align-items: center; + display: flex; + margin: 0 -0.5rem; + } .font-size-tooltip .icon-button.disabled { - pointer-events: none; + pointer-events: none; + } .main-content { - position: relative; - flex: 1; - overflow: auto; - display: flex; - flex-direction: column; - align-items: center; - padding: 7rem 25rem 0; + align-items: center; + display: flex; + flex: 1; + flex-direction: column; + overflow: auto; + padding: 7rem 25rem 0; + position: relative; + } .main-wrapper { - width: 100%; - max-width: var(--outer-wrapper-max-width); - padding: 0 4rem 1rem; + max-width: var(--outer-wrapper-max-width); + padding: 0 4rem 1rem; + width: 100%; + } .p-h-n { - padding: 0.4rem 1rem; + padding: 0.4rem 1rem; + } .footer { - width: 100%; - margin: 5rem 0 0 0; - border-radius: 1rem; - font-size: 0.875rem; - display: flex; - justify-content: center; + border-radius: 1rem; + display: flex; + font-size: 0.875rem; + justify-content: center; + margin-top: 5rem; + width: 100%; + } .source-page + .footer { - margin-top: 3rem; + margin-top: 3rem; + } .footer .wrapper { - flex: 1; - padding: 1rem 2rem; - max-width: var(--outer-wrapper-max-width); + flex: 1; + max-width: var(--outer-wrapper-max-width); + padding: 1rem 2rem; + } pre { - position: relative; + position: relative; + } .hljs table td { - background: transparent; - padding: 0 0.6125rem; - line-height: 1.5; - border-radius: 0; + background: transparent; + border-radius: 0; + line-height: 1.5; + padding: 0 0.6125rem; + } .hljs .hljs-ln-numbers { - width: 2rem; - white-space: nowrap; - /* user-select: none; */ - padding-left: 1.5rem; + padding-left: 1.5rem; + user-select: none; + white-space: nowrap; + width: 2rem; + } .hljs-ln-line.hljs-ln-numbers::before { - content: attr(data-line-number); + content: attr(data-line-number); + } .pre-div { - position: relative; - border-radius: 1rem; - overflow: hidden; - margin: 2rem 0; + border-radius: 1rem; + margin: 2rem 0; + overflow: hidden; + position: relative; + } .pre-top-bar-container { - align-items: center; - display: flex; - justify-content: space-between; - left: 0; - padding: 0.3125rem 1.5rem; - position: absolute; - right: 0; - top: 0; + align-items: center; + display: flex; + justify-content: space-between; + left: 0; + padding: 0.3125rem 1.5rem; + position: absolute; + right: 0; + top: 0; + } .code-copy-icon-container { - align-items: center; - border-radius: 50%; - cursor: pointer; - display: flex; - height: 1.875rem; - justify-content: center; - transition: 0.3s; - width: 1.875rem; + align-items: center; + border-radius: 50%; + cursor: pointer; + display: flex; + height: 1.875rem; + justify-content: center; + transition: 0.3s; + width: 1.875rem; + } .code-copy-icon-container > div { - margin-top: 0.25rem; - position: relative; + margin-top: 0.25rem; + position: relative; + } .sm-icon { - height: 1rem; - width: 1rem; + height: 1rem; + width: 1rem; + } .code-lang-name { - font-family: 'body'; - font-size: 0.75rem; + font-family: 'body'; + font-size: 0.75rem; + } .tooltip { - border-radius: 0.3125rem; - opacity: 0; - padding: 0.1875rem 0.5rem; - position: absolute; - right: 2rem; - top: 0.3125rem; - transform: scale(0); - transition: 0.3s; + border-radius: 0.3125rem; + opacity: 0; + padding: 0.1875rem 0.5rem; + position: absolute; + right: 2rem; + top: 0.3125rem; + transform: scale(0); + transition: 0.3s; + } .show-tooltip { - opacity: 1; - transform: scale(1); + opacity: 1; + transform: scale(1); + } .allow-overflow { - overflow: auto; + overflow: auto; + } .bold { - font-family: heading; + font-family: heading; + } .search-container { - position: fixed; - top: 0; - bottom: 0; - right: 0; - left: 0; - justify-content: center; - z-index: 50; - align-items: flex-start; + align-items: flex-start; + bottom: 0; + justify-content: center; + left: 0; + position: fixed; + right: 0; + top: 0; + z-index: 50; + } .search-container .wrapper { - width: 100%; - max-width: 60rem; - padding: 4rem 2rem 2rem; - border-radius: 1rem; - margin: 3rem 25rem; - position: relative; + border-radius: 1rem; + margin: 3rem 25rem; + max-width: 60rem; + padding: 4rem 2rem 2rem; + position: relative; + width: 100%; + } .search-close-button { - position: absolute; - top: 1rem; - right: 1rem; + position: absolute; + right: 1rem; + top: 1rem; + } .search-result-c-text { - display: flex; - justify-content: center; - user-select: none; + display: flex; + justify-content: center; + user-select: none; + } .search-result-c { - min-height: 20rem; - max-height: 40rem; - overflow: auto; - padding: 2rem 0; + max-height: 40rem; + min-height: 20rem; + overflow: auto; + padding: 2rem 0; + } .search-box-c { - width: 100%; - position: relative; - display: flex; - align-items: center; + align-items: center; + display: flex; + position: relative; + width: 100%; + } .search-box-c svg { - height: 1.5rem; - width: 1.5rem; - position: absolute; - left: 1.5rem; + height: 1.5rem; + left: 1.5rem; + position: absolute; + width: 1.5rem; + } .search-input { - border: none; - border-radius: 1rem; - width: 100%; - flex: 1; - padding: 1rem 2rem 1rem 4rem; - font-family: body; - font-size: 1.25rem; + border: 0; + border-radius: 1rem; + flex: 1; + font-family: body; + font-size: 1.25rem; + padding: 1rem 2rem 1rem 4rem; + width: 100%; + } .search-result-item { - display: block; - text-decoration: none; - padding: 1rem; - border-radius: 1rem; - margin: 1rem 0; + border-radius: 1rem; + display: block; + margin: 1rem 0; + padding: 1rem; + text-decoration: none; + } .search-result-item:hover { - text-decoration: none; + text-decoration: none; + } .search-result-item:active { - text-decoration: none; + text-decoration: none; + } .search-result-item-title { - font-family: heading; - font-size: 1.5rem; - margin: 0; + font-family: heading; + font-size: 1.5rem; + margin: 0; + } .search-result-item-p { - font-size: 0.875rem; - margin: 0; + font-size: 0.875rem; + margin: 0; + } .mobile-menu-icon-container { - display: none; - position: fixed; - bottom: 1.5rem; - right: 2rem; - z-index: 30; + bottom: 1.5rem; + display: none; + position: fixed; + right: 2rem; + z-index: 30; + } .mobile-menu-icon-container .icon-button svg { - height: 2rem; - width: 2rem; + height: 2rem; + width: 2rem; + } .mobile-sidebar-container { - position: fixed; - top: 0; - right: 0; - left: 0; - bottom: 0; - padding: 1rem; - z-index: 25; + bottom: 0; + display: none; + left: 0; + padding: 1rem; + position: fixed; + right: 0; + top: 0; + z-index: 25; - display: none; } .mobile-sidebar-container.show { - display: block; + display: block; + } .mobile-sidebar-wrapper { - border-radius: 1rem; - height: 100%; - width: 100%; - display: flex; - flex-direction: column; - padding-top: 2rem; + border-radius: 1rem; + display: flex; + flex-direction: column; + height: 100%; + padding-top: 2rem; + width: 100%; + } .mobile-nav-links { - display: flex; - flex-wrap: wrap; - padding-top: 2rem; + display: flex; + flex-wrap: wrap; + padding-top: 2rem; + } .mobile-sidebar-items-c { - flex: 1; - overflow: auto; + flex: 1; + overflow: auto; + } .mobile-navbar-actions { - display: flex; - padding: 1rem; + display: flex; + padding: 1rem; + } .rel { - position: relative; + position: relative; + } .icon-button.codepen-button svg { - height: 1.5rem; - width: 1.5rem; + height: 1.5rem; + width: 1.5rem; + } .table-div { - width: 100%; - overflow: auto; -} + overflow: auto; + width: 100%; -.tag-default { - overflow: auto; } -/* scroll bar */ -::-webkit-scrollbar { - width: 0.3125rem; - height: 0.3125rem; -} +.tag-default { + overflow: auto; -::-webkit-scrollbar-thumb, -::-webkit-scrollbar-track { - border-radius: 1rem; } @media screen and (max-width: 100em) { - .toc-container { + + .toc-container { display: none; - } - .main-content { - padding: 7rem 0 0 25rem; - } +} + +.main-content { + padding: 7rem 0 0 25rem; - .search-container .wrapper { - margin-right: 1rem; - } +} - .navbar-container { - /* For scrollbar */ +.search-container .wrapper { + margin-right: 1rem; + +} + +.navbar-container { + /* For scrollbar */ right: 1rem; - } + +} + } @media screen and (min-width: 65em) { - .mobile-sidebar-container.show { + + .mobile-sidebar-container.show { display: none; - } + +} + } @media screen and (max-width: 65em) { - h1 { + + h1 { font-size: 3rem; - } - h2 { - font-size: 2rem; - } +} + +h2 { + font-size: 2rem; + +} - h3 { - font-size: 1.875; - } +h3 { + font-size: 1.875; - h4, +} + +h4, h5, h6 { - font-size: 1rem; - } + font-size: 1rem; - .main-wrapper { - padding: 0 1rem 1rem; - } +} - .search-result-c { - max-height: 25rem; - } +.main-wrapper { + padding: 0 1rem 1rem; - .mobile-menu-icon-container { - display: block; - } +} - .sidebar-container { - display: none; - } +.search-result-c { + max-height: 25rem; - .search-container .wrapper { - margin-left: 1rem; - } +} - .main-content { - padding-left: 0; - padding-top: 1rem; - } +.mobile-menu-icon-container { + display: block; - .navbar-container { - display: none; - } +} + +.sidebar-container { + display: none; + +} + +.search-container .wrapper { + margin-left: 1rem; + +} + +.main-content { + padding-left: 0; + padding-top: 1rem; + +} - .source-page + .footer, +.navbar-container { + display: none; + +} + +.source-page + .footer, .footer { - margin-top: 2rem; - } + margin-top: 2rem; - .has-anchor:hover .link-anchor { - visibility: hidden; - } } + +.has-anchor:hover .link-anchor { + visibility: hidden; + +} + +} + +.child-tutorial-container { + display: flex; + flex-direction: row; + flex-wrap: wrap; + +} + +.child-tutorial { + border: 1px solid; + border-radius: 10px; + display: block; + margin: 5px; + padding: 10px 16px; + +} + +.child-tutorial:hover { + text-decoration: none; + +} + diff --git a/sdk/docs/styles/clean-jsdoc-theme-dark.css b/sdk/docs/styles/clean-jsdoc-theme-dark.css index 63de899cc..78cc519b2 100644 --- a/sdk/docs/styles/clean-jsdoc-theme-dark.css +++ b/sdk/docs/styles/clean-jsdoc-theme-dark.css @@ -10,7 +10,7 @@ body { a, a:active { - color: #00bbff; + color: #0bf; } hr { @@ -43,6 +43,8 @@ h6 { background: #252525; } + + .with-arrow { fill: #999; } @@ -51,6 +53,10 @@ h6 { background: #292929; } +.sidebar-section-children.active { + background: #444; +} + .sidebar-section-children a:hover { background: #2c2c2c; } @@ -86,8 +92,8 @@ h6 { } .navbar-item a:active { - color: #aaa; background-color: #222; + color: #aaa; } .navbar-item:hover { @@ -105,8 +111,8 @@ h6 { .toc-link { color: #777; - transition: color 0.3s; font-size: 0.875rem; + transition: color 0.3s; } .toc-link.is-active-link { @@ -193,7 +199,6 @@ samp { color: #eee; } -/* stylelint-enable */ table .name, .params .name, @@ -396,12 +401,12 @@ blockquote { background: #222; } -/* scroll bar */ -::-webkit-scrollbar-track { - background: #333; + +.child-tutorial { + border-color: #555; + color: #f3f3f3; } -::-webkit-scrollbar-thumb { - background: #555; - outline: 0.06125rem solid #555; +.child-tutorial:hover { + background: #222; } diff --git a/sdk/docs/styles/clean-jsdoc-theme-light.css b/sdk/docs/styles/clean-jsdoc-theme-light.css index a900941ef..ee47d2a7d 100644 --- a/sdk/docs/styles/clean-jsdoc-theme-light.css +++ b/sdk/docs/styles/clean-jsdoc-theme-light.css @@ -1,20 +1,25 @@ .light ::selection { - background: #ffce76; - color: #1d1919; + background: #ffce76; + color: #1d1919; + } +/* stylelint-disable-next-line selector-no-qualifying-type,rule-empty-line-before */ body.light { - background-color: #fff; - color: #111; + background-color: #fff; + color: #111; + } .light a, .light a:active { - color: #007bff; + color: #007bff; + } .light hr { - color: #f7f7f7; + color: #f7f7f7; + } .light h1, @@ -23,231 +28,293 @@ body.light { .light h4, .light h5, .light h6 { - color: #111; + color: #111; + } .light .sidebar { - background-color: #f7f7f7; - color: #222; + background-color: #f7f7f7; + color: #222; + } .light .sidebar-title { - color: #222; + color: #222; + } .light .sidebar-section-title { - color: #222; + color: #222; + } -.light .sidebar-section-title:hover { - background: #eee; +.light .sidebar-section-title:hover, +.light .sidebar-section-title.active { + background: #eee; } + .light .with-arrow { - fill: #111; + fill: #111; + } .light .sidebar-section-children-container { - background: #eee; + background: #eee; +} + +.light .sidebar-section-children.active { + background: #ccc; } + + + .light .sidebar-section-children a:hover { - background: #e0e0e0; + background: #e0e0e0; + } .light .sidebar-section-children a { - color: #111; + color: #111; + } .light .navbar-container { - background: #fff; + background: #fff; + } .light .icon-button svg, .light .navbar-item a { - color: #222; - fill: #222; + color: #222; + fill: #222; + } .light .tippy-box { - background: #eee; - color: #111; + background: #eee; + color: #111; + } .light .tippy-arrow { - color: #f1f1f1; + color: #f1f1f1; + } +/* stylelint-disable-next-line selector-max-compound-selectors,rule-empty-line-before */ .light .font-size-tooltip .icon-button svg { - fill: #111; + fill: #111; + } +/* stylelint-disable-next-line selector-max-compound-selectors, rule-empty-line-before */ .light .font-size-tooltip .icon-button.disabled svg { - fill: #999; + fill: #999; + } .light .icon-button:hover { - background: #ddd; + background: #ddd; + } .light .icon-button:active { - background: #ccc; + background: #ccc; + } .light .navbar-item a:active { - color: #333; - background-color: #eee; + background-color: #eee; + color: #333; + } .light .navbar-item:hover { - background: #f7f7f7; + background: #f7f7f7; + } .light .footer { - background: #f7f7f7; - color: #111; + background: #f7f7f7; + color: #111; + } .light .footer a { - color: #111; + color: #111; + } .light .toc-link { - color: #999; - transition: color 0.3s; - font-size: 0.875rem; + color: #999; + font-size: 0.875rem; + transition: color 0.3s; + } .light .toc-link.is-active-link { - color: #111; + color: #111; + } .light .has-anchor .link-anchor { - color: #ddd; + color: #ddd; + } .light .has-anchor .link-anchor:hover { - color: #ccc; + color: #ccc; + } .light .signature-attributes { - color: #aaa; + color: #aaa; + } .light .ancestors { - color: #999; + color: #999; + } .light .ancestors a { - color: #999 !important; + color: #999 !important; + } .light .important { - color: #ee1313; + color: #ee1313; + } .light .type-signature { - color: #00918e; + color: #00918e; + } .light .name, .light .name a { - color: #293a80; + color: #293a80; + } .light .details { - background: #f9f9f9; - color: #101010; + background: #f9f9f9; + color: #101010; + } .light .member-item-container strong, .light .method-member-container strong { - color: #000; + color: #000; + } .light .prettyprint { - background: #f7f7f7; + background: #f7f7f7; + } .light .pre-div { - background: #f7f7f7; + background: #f7f7f7; + } .light .hljs .hljs-ln-numbers { - color: #aaa; + color: #aaa; + } .light .hljs .selected { - background: #ccc; + background: #ccc; + } +/* stylelint-disable-next-line selector-no-qualifying-type,rule-empty-line-before */ .light table.hljs-ln td { - background: none; + background: none; + } +/* stylelint-disable-next-line selector-max-compound-selectors,rule-empty-line-before */ .light .hljs .selected .hljs-ln-numbers { - color: #444; + color: #444; + } .light .pre-top-bar-container { - background-color: #eee; + background-color: #eee; + } .light .prettyprint code { - background-color: #f7f7f7; + background-color: #f7f7f7; + } .light table .name, .light .params .name, .light .props .name, .light .name code { - color: #4d4e53; + color: #4d4e53; + } .light table td, .light .params td { - background: #f7f7f7; + background: #f7f7f7; + } +/* stylelint-disable-next-line selector-max-compound-selectors,rule-empty-line-before */ .light table thead th, .light .params thead th, .light .props thead th { - background-color: #eee; - color: #111; + background-color: #eee; + color: #111; + } /* stylelint-disable */ .light table .params thead tr, .light .params .params thead tr, .light .props .props thead tr { - background-color: #eee; - color: #111; + background-color: #eee; + color: #111; + } .light .disabled { - color: #454545; + color: #454545; + } .light .code-lang-name { - color: #ff0000; + color: #ff0000; + } .light .tooltip { - background: #ffce76; - color: #000; + background: #ffce76; + color: #000; + } /* Code */ .light .hljs-comment, .light .hljs-quote { - color: #a0a1a7; + color: #a0a1a7; + } .light .hljs-doctag, .light .hljs-keyword, .light .hljs-formula { - color: #a626a4; + color: #a626a4; + } .light .hljs-section, @@ -255,11 +322,13 @@ body.light { .light .hljs-selector-tag, .light .hljs-deletion, .light .hljs-subst { - color: #e45649; + color: #e45649; + } .light .hljs-literal { - color: #0184bb; + color: #0184bb; + } .light .hljs-string, @@ -267,7 +336,8 @@ body.light { .light .hljs-addition, .light .hljs-attribute, .light .hljs-meta .hljs-string { - color: #50a14f; + color: #50a14f; + } .light .hljs-attr, @@ -278,7 +348,8 @@ body.light { .light .hljs-selector-attr, .light .hljs-selector-pseudo, .light .hljs-number { - color: #986801; + color: #986801; + } .light .hljs-symbol, @@ -287,102 +358,125 @@ body.light { .light .hljs-meta, .light .hljs-selector-id, .light .hljs-title { - color: #4078f2; + color: #4078f2; + } .light .hljs-built_in, .light .hljs-title.class_, .light .hljs-class .hljs-title { - color: #c18401; + color: #c18401; + } .light .hljs-emphasis { - font-style: italic; + font-style: italic; + } .light .hljs-strong { - font-weight: bold; + font-weight: bold; + } .light .hljs-link { - text-decoration: underline; + text-decoration: underline; + } /* Code Ends */ .light blockquote { - background: #eee; - color: #111; + background: #eee; + color: #111; + } .light code { - background: #ddd; - color: #000; + background: #ddd; + color: #000; + } .light .search-container { - background: rgba(0, 0, 0, 0.1); + background: rgba(0, 0, 0, 0.1); + } .light .search-close-button svg { - fill: #f00; + fill: #f00; + } .light .search-container .wrapper { - background: #eee; + background: #eee; + } .light .search-result-c { - color: #aaa; + color: #aaa; + } .light .search-box-c svg { - fill: #333; + fill: #333; + } .light .search-input { - background: #f7f7f7; - color: #111; + background: #f7f7f7; + color: #111; + } .light .search-result-item { - background: #f7f7f7; + background: #f7f7f7; + } .light .search-result-item:hover { - background: #e9e9e9; + background: #e9e9e9; + } .light .search-result-item:active { - background: #f7f7f7; + background: #f7f7f7; + } .light .search-result-item-title { - color: #111; + color: #111; + } .light .search-result-item-p { - color: #aaa; + color: #aaa; + } .light .mobile-menu-icon-container .icon-button { - background: #e5e5e5; + background: #e5e5e5; + } .light .mobile-sidebar-container { - background: #fff; + background: #fff; + } .light .mobile-sidebar-wrapper { - background: #f7f7f7; + background: #f7f7f7; + } -/* scroll bar */ -.light ::-webkit-scrollbar-track { - background: #ddd; +.light .child-tutorial { + border-color: #aaa; + color: #222; + } -.light ::-webkit-scrollbar-thumb { - background: #aaa; - outline: 0.06125rem solid #aaa; +.light .child-tutorial:hover { + background: #ccc; + } + diff --git a/sdk/docs/styles/clean-jsdoc-theme-scrollbar.css b/sdk/docs/styles/clean-jsdoc-theme-scrollbar.css new file mode 100644 index 000000000..4bcc3f1bc --- /dev/null +++ b/sdk/docs/styles/clean-jsdoc-theme-scrollbar.css @@ -0,0 +1,30 @@ +::-webkit-scrollbar { + height: 0.3125rem; + width: 0.3125rem; + +} + +::-webkit-scrollbar-thumb, +::-webkit-scrollbar-track { + border-radius: 1rem; +} + +::-webkit-scrollbar-track { + background: #333; +} + +::-webkit-scrollbar-thumb { + background: #555; + outline: 0.06125rem solid #555; +} + + +.light ::-webkit-scrollbar-track { + background: #ddd; + +} + +.light ::-webkit-scrollbar-thumb { + background: #aaa; + outline: 0.06125rem solid #aaa; +} \ No newline at end of file diff --git a/sdk/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css b/sdk/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css new file mode 100644 index 000000000..ced379500 --- /dev/null +++ b/sdk/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css @@ -0,0 +1 @@ +@font-face{font-display:swap;font-family:"heading";src:url(../fonts/WorkSans-Bold.ttf)format("truetype")}@font-face{font-display:swap;font-family:"body";src:url(../fonts/OpenSans-Regular.ttf)format("truetype")}@font-face{font-display:swap;font-family:"code";src:url(../fonts/Inconsolata-Regular.ttf)format("truetype")}:root{--outer-wrapper-max-width:65rem}*{box-sizing:border-box;margin:0;padding:0}html,body{line-height:1.75;min-height:100%;width:100%}body{font-family:"body";overflow-x:hidden;position:relative}b{font-family:heading}h1,h2,h3,h4,h5,h6{font-family:"heading";font-weight:400;line-height:1.75}h1{font-size:3.5rem;margin:0}h2{font-size:2.25rem;margin:2rem 0 0}h3{font-size:1.5rem}h4{font-size:1.25rem}h5{font-size:1rem}h6{font-size:1rem}img{max-width:100%}a{text-decoration:none}a:hover{text-decoration:underline}a img{margin-right:.5rem}p{margin:1rem 0}article ul{list-style:disc}article ul li,article ol li{padding:.5rem 0}article ol,article ul{padding-left:2rem}article ol p,article ul p{margin:0}.variation{display:none}.signature-attributes{font-style:italic;font-weight:lighter}.ancestors a{text-decoration:none}.important{font-weight:700}.signature{font-family:"code"}.name{font-family:"code";font-weight:700}blockquote{border-radius:1rem;font-size:.875rem;margin:.5rem 0;padding:.0625rem 1.25rem}.details{border-radius:1rem;margin:1rem 0}.details .details-item-container{display:flex;padding:1rem 2rem}dt{font-family:heading}.details dt{float:left;min-width:11rem}.details ul{display:inline-flex;list-style-type:none;margin:0}.details ul li{display:inline-flex;margin-right:.6125rem;padding:0;word-break:break-word}.details ul li p{margin:0}.details pre.prettyprint{margin:0}.details .object-value{padding-top:0}.description{margin-bottom:2rem}.method-member-container table{margin-top:1rem}.pre-div .hljs-ln{margin:0}.code-caption{font-size:.875rem}.prettyprint{font-size:.875rem;overflow:auto}pre.prettyprint{margin-top:3rem}.prettyprint.source{width:inherit}.prettyprint code{display:block;font-size:1rem;line-height:1.75;padding:0 0 1rem}.prettyprint .compact{padding:0}h4.name{margin-top:.5rem}.params,.props,table{border-collapse:separate;border-radius:.5rem;border-spacing:0 .5rem;font-size:.875rem;margin:0;width:100%}table td:first-child,.params td:first-child,table thead th:first-child,.params thead th:first-child,.props thead th:first-child{border-bottom-left-radius:1rem;border-top-left-radius:1rem}table td:last-child,.params td:last-child,table thead th:last-child,.params thead th:last-child,.props thead th:last-child{border-bottom-right-radius:1rem;border-top-right-radius:1rem}table th,.params th{position:sticky;top:0}.params .name,.props .name,.name code{font-family:"code";font-size:1rem}.params td,.params th,.props td,.props th,th,td{display:table-cell;margin:0;padding:1rem 2rem;text-align:left;vertical-align:top}.params thead tr,.props thead tr{font-weight:700}.params .params thead tr,.props .props thead tr{font-weight:700}.params td.description>p:first-child,.props td.description>p:first-child{margin-top:0;padding-top:0}.params td.description>p:last-child,.props td.description>p:last-child{margin-bottom:0;padding-bottom:0}dl.param-type{margin-bottom:1rem;padding-bottom:1rem}.param-type dt,.param-type dd{display:inline-block}.param-type dd{font-family:"code";font-size:1rem}code{border-radius:.3rem;font-family:"code";font-size:1rem;padding:.1rem .4rem}.mt-20{margin-top:1.5rem}.codepen-form{bottom:0;position:absolute;right:.6125rem}.body-wrapper{display:flex;flex-direction:column;height:100vh;position:relative}.sidebar-container{bottom:0;display:flex;left:0;padding:1rem;position:fixed;top:0;width:25rem;z-index:10}.sidebar{border-radius:1rem;display:flex;flex:1;flex-direction:column;overflow:hidden;padding:1.5rem 0}.sidebar-title{font-family:heading;font-size:1.5rem;margin:0 0 2rem;padding:0 2rem;text-decoration:none}.sidebar-title:hover{text-decoration:none}.sidebar-items-container{flex:1;overflow:auto;position:relative}.sidebar-section-title{border-radius:1rem;font-family:heading;font-size:1.25rem;padding:.5rem 2rem}.with-arrow{align-items:center;cursor:pointer;display:flex}.with-arrow div{flex:1}.with-arrow svg{height:1rem;transition:transform .3s;width:1rem}.with-arrow[data-isopen=true] svg{transform:rotate(180deg)}.sidebar-section-children-container{border-radius:.5rem;overflow:hidden}.sidebar-section-children a{display:block;padding:.25rem 2rem;width:100%}.sidebar-section-children a{text-decoration:none}.with-arrow[data-isopen=false]+.sidebar-section-children-container{height:0;overflow:hidden}.with-arrow[data-isopen=true]+.sidebar-section-children-container{height:auto}.toc-container{bottom:0;position:fixed;right:4rem;top:0;width:16rem;z-index:10}.toc-content{display:flex;flex-direction:column;height:100%;padding-top:10rem}#eed4d2a0bfd64539bb9df78095dec881{flex:1;margin:2rem 0;overflow:auto}.toc-list{list-style:none;padding-left:1rem}.toc-link{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.toc-link.is-active-link{font-family:heading}.has-anchor{position:relative}.link-anchor{padding:0 .5rem}.has-anchor .link-anchor{left:0;position:absolute;text-decoration:none;top:0;transform:translateX(-100%);visibility:hidden}.has-anchor:hover .link-anchor{visibility:visible}.navbar-container{display:flex;height:7rem;justify-content:center;left:25rem;padding-top:1rem;position:fixed;right:25rem;top:0;z-index:10}.navbar{display:flex;flex:1;max-width:var(--outer-wrapper-max-width);padding:1rem 4rem 1rem 2rem}.navbar-left-items{display:flex;flex:1}.navbar-right-items{display:flex}.icon-button svg{height:1rem;width:1rem}.icon-button{background:0 0;border:0;border-radius:50%;cursor:pointer;display:inline-flex;padding:.5rem;position:relative;transition:background .3s}.navbar-right-item{align-items:center;display:flex;justify-content:center;margin:0 .25rem}.navbar-item{border-radius:.5rem;overflow:hidden}.navbar-item a{display:inline-block;padding:1rem 2rem;text-decoration:none;transition:.3s}.font-size-tooltip{align-items:center;display:flex;margin:0-.5rem}.font-size-tooltip .icon-button.disabled{pointer-events:none}.main-content{align-items:center;display:flex;flex:1;flex-direction:column;overflow:auto;padding:7rem 25rem 0;position:relative}.main-wrapper{max-width:var(--outer-wrapper-max-width);padding:0 4rem 1rem;width:100%}.p-h-n{padding:.4rem 1rem}.footer{border-radius:1rem;display:flex;font-size:.875rem;justify-content:center;margin-top:5rem;width:100%}.source-page+.footer{margin-top:3rem}.footer .wrapper{flex:1;max-width:var(--outer-wrapper-max-width);padding:1rem 2rem}pre{position:relative}.hljs table td{background:0 0;border-radius:0;line-height:1.5;padding:0 .6125rem}.hljs .hljs-ln-numbers{padding-left:1.5rem;user-select:none;white-space:nowrap;width:2rem}.hljs-ln-line.hljs-ln-numbers::before{content:attr(data-line-number)}.pre-div{border-radius:1rem;margin:2rem 0;overflow:hidden;position:relative}.pre-top-bar-container{align-items:center;display:flex;justify-content:space-between;left:0;padding:.3125rem 1.5rem;position:absolute;right:0;top:0}.code-copy-icon-container{align-items:center;border-radius:50%;cursor:pointer;display:flex;height:1.875rem;justify-content:center;transition:.3s;width:1.875rem}.code-copy-icon-container>div{margin-top:.25rem;position:relative}.sm-icon{height:1rem;width:1rem}.code-lang-name{font-family:"body";font-size:.75rem}.tooltip{border-radius:.3125rem;opacity:0;padding:.1875rem .5rem;position:absolute;right:2rem;top:.3125rem;transform:scale(0);transition:.3s}.show-tooltip{opacity:1;transform:scale(1)}.allow-overflow{overflow:auto}.bold{font-family:heading}.search-container{align-items:flex-start;bottom:0;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:50}.search-container .wrapper{border-radius:1rem;margin:3rem 25rem;max-width:60rem;padding:4rem 2rem 2rem;position:relative;width:100%}.search-close-button{position:absolute;right:1rem;top:1rem}.search-result-c-text{display:flex;justify-content:center;user-select:none}.search-result-c{max-height:40rem;min-height:20rem;overflow:auto;padding:2rem 0}.search-box-c{align-items:center;display:flex;position:relative;width:100%}.search-box-c svg{height:1.5rem;left:1.5rem;position:absolute;width:1.5rem}.search-input{border:0;border-radius:1rem;flex:1;font-family:body;font-size:1.25rem;padding:1rem 2rem 1rem 4rem;width:100%}.search-result-item{border-radius:1rem;display:block;margin:1rem 0;padding:1rem;text-decoration:none}.search-result-item:hover{text-decoration:none}.search-result-item:active{text-decoration:none}.search-result-item-title{font-family:heading;font-size:1.5rem;margin:0}.search-result-item-p{font-size:.875rem;margin:0}.mobile-menu-icon-container{bottom:1.5rem;display:none;position:fixed;right:2rem;z-index:30}.mobile-menu-icon-container .icon-button svg{height:2rem;width:2rem}.mobile-sidebar-container{bottom:0;display:none;left:0;padding:1rem;position:fixed;right:0;top:0;z-index:25}.mobile-sidebar-container.show{display:block}.mobile-sidebar-wrapper{border-radius:1rem;display:flex;flex-direction:column;height:100%;padding-top:2rem;width:100%}.mobile-nav-links{display:flex;flex-wrap:wrap;padding-top:2rem}.mobile-sidebar-items-c{flex:1;overflow:auto}.mobile-navbar-actions{display:flex;padding:1rem}.rel{position:relative}.icon-button.codepen-button svg{height:1.5rem;width:1.5rem}.table-div{overflow:auto;width:100%}.tag-default{overflow:auto}@media screen and (max-width:100em){.toc-container{display:none}.main-content{padding:7rem 0 0 25rem}.search-container .wrapper{margin-right:1rem}.navbar-container{right:1rem}}@media screen and (min-width:65em){.mobile-sidebar-container.show{display:none}}@media screen and (max-width:65em){h1{font-size:3rem}h2{font-size:2rem}h3{font-size:1.875}h4,h5,h6{font-size:1rem}.main-wrapper{padding:0 1rem 1rem}.search-result-c{max-height:25rem}.mobile-menu-icon-container{display:block}.sidebar-container{display:none}.search-container .wrapper{margin-left:1rem}.main-content{padding-left:0;padding-top:1rem}.navbar-container{display:none}.source-page+.footer,.footer{margin-top:2rem}.has-anchor:hover .link-anchor{visibility:hidden}}.child-tutorial-container{display:flex;flex-direction:row;flex-wrap:wrap}.child-tutorial{border:1px solid;border-radius:10px;display:block;margin:5px;padding:10px 16px}.child-tutorial:hover{text-decoration:none}::selection{background:#ffce76;color:#222}body{background-color:#1a1a1a;color:#fff}a,a:active{color:#0bf}hr{color:#222}h1,h2,h3,h4,h5,h6{color:#fff}.sidebar{background-color:#222;color:#999}.sidebar-title{color:#999}.sidebar-section-title{color:#999}.sidebar-section-title:hover{background:#252525}.with-arrow{fill:#999}.sidebar-section-children-container{background:#292929}.sidebar-section-children.active{background:#444}.sidebar-section-children a:hover{background:#2c2c2c}.sidebar-section-children a{color:#fff}.navbar-container{background:#1a1a1a}.icon-button svg,.navbar-item a{color:#999;fill:#999}.font-size-tooltip .icon-button svg{fill:#fff}.font-size-tooltip .icon-button.disabled{background:#999}.icon-button:hover{background:#333}.icon-button:active{background:#444}.navbar-item a:active{background-color:#222;color:#aaa}.navbar-item:hover{background:#202020}.footer{background:#222;color:#999}.footer a{color:#999}.toc-link{color:#777;font-size:.875rem;transition:color .3s}.toc-link.is-active-link{color:#fff}.has-anchor .link-anchor{color:#555}.has-anchor .link-anchor:hover{color:#888}tt,code,kbd,samp{background:#333}.signature-attributes{color:#aaa}.ancestors{color:#999}.ancestors a{color:#999!important}.important{color:#c51313}.type-signature{color:#00918e}.name,.name a{color:#f7f7f7}.details{background:#222;color:#fff}.prettyprint{background:#222}.member-item-container strong,.method-member-container strong{color:#fff}.pre-top-bar-container{background:#292929}.prettyprint.source,.prettyprint code{background-color:#222;color:#c9d1d9}.pre-div{background-color:#222}.hljs .hljs-ln-numbers{color:#777}.hljs .selected{background:#444}.hljs .selected .hljs-ln-numbers{color:#eee}table .name,.params .name,.props .name,.name code{color:#fff}table td,.params td{background-color:#292929}table thead th,.params thead th,.props thead th{background-color:#222;color:#fff}table .params thead tr,.params .params thead tr,.props .props thead tr{background-color:#222;color:#fff}.disabled{color:#aaa}.code-lang-name{color:#ff8a00}.tooltip{background:#ffce76;color:#222}.hljs-comment{color:#8b949e}.hljs-doctag,.hljs-keyword,.hljs-template-tag,.hljs-variable.language_{color:#ff7b72}.hljs-template-variable,.hljs-type{color:#30ac7c}.hljs-meta,.hljs-string,.hljs-regexp{color:#a5d6ff}.hljs-title.class_,.hljs-title{color:#ffa657}.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}blockquote{background:#222;color:#fff}.search-container{background:rgba(255,255,255,.1)}.icon-button.search-close-button svg{fill:#a00}.search-container .wrapper{background:#222}.search-result-c{color:#666}.search-box-c{fill:#333}.search-input{background:#333;color:#fff}.search-box-c svg{fill:#fff}.search-result-item{background:#333}.search-result-item:hover{background:#444}.search-result-item:active{background:#555}.search-result-item-title{color:#fff}.search-result-item-p{color:#aaa}.mobile-menu-icon-container .icon-button{background:#333}.mobile-sidebar-container{background:#1a1a1a}.mobile-sidebar-wrapper{background:#222}.child-tutorial{border-color:#555;color:#f3f3f3}.child-tutorial:hover{background:#222}.light ::selection{background:#ffce76;color:#1d1919}body.light{background-color:#fff;color:#111}.light a,.light a:active{color:#007bff}.light hr{color:#f7f7f7}.light h1,.light h2,.light h3,.light h4,.light h5,.light h6{color:#111}.light .sidebar{background-color:#f7f7f7;color:#222}.light .sidebar-title{color:#222}.light .sidebar-section-title{color:#222}.light .sidebar-section-title:hover,.light .sidebar-section-title.active{background:#eee}.light .with-arrow{fill:#111}.light .sidebar-section-children-container{background:#eee}.light .sidebar-section-children.active{background:#ccc}.light .sidebar-section-children a:hover{background:#e0e0e0}.light .sidebar-section-children a{color:#111}.light .navbar-container{background:#fff}.light .icon-button svg,.light .navbar-item a{color:#222;fill:#222}.light .tippy-box{background:#eee;color:#111}.light .tippy-arrow{color:#f1f1f1}.light .font-size-tooltip .icon-button svg{fill:#111}.light .font-size-tooltip .icon-button.disabled svg{fill:#999}.light .icon-button:hover{background:#ddd}.light .icon-button:active{background:#ccc}.light .navbar-item a:active{background-color:#eee;color:#333}.light .navbar-item:hover{background:#f7f7f7}.light .footer{background:#f7f7f7;color:#111}.light .footer a{color:#111}.light .toc-link{color:#999;font-size:.875rem;transition:color .3s}.light .toc-link.is-active-link{color:#111}.light .has-anchor .link-anchor{color:#ddd}.light .has-anchor .link-anchor:hover{color:#ccc}.light .signature-attributes{color:#aaa}.light .ancestors{color:#999}.light .ancestors a{color:#999!important}.light .important{color:#ee1313}.light .type-signature{color:#00918e}.light .name,.light .name a{color:#293a80}.light .details{background:#f9f9f9;color:#101010}.light .member-item-container strong,.light .method-member-container strong{color:#000}.light .prettyprint{background:#f7f7f7}.light .pre-div{background:#f7f7f7}.light .hljs .hljs-ln-numbers{color:#aaa}.light .hljs .selected{background:#ccc}.light table.hljs-ln td{background:0 0}.light .hljs .selected .hljs-ln-numbers{color:#444}.light .pre-top-bar-container{background-color:#eee}.light .prettyprint code{background-color:#f7f7f7}.light table .name,.light .params .name,.light .props .name,.light .name code{color:#4d4e53}.light table td,.light .params td{background:#f7f7f7}.light table thead th,.light .params thead th,.light .props thead th{background-color:#eee;color:#111}.light table .params thead tr,.light .params .params thead tr,.light .props .props thead tr{background-color:#eee;color:#111}.light .disabled{color:#454545}.light .code-lang-name{color:red}.light .tooltip{background:#ffce76;color:#000}.light .hljs-comment,.light .hljs-quote{color:#a0a1a7}.light .hljs-doctag,.light .hljs-keyword,.light .hljs-formula{color:#a626a4}.light .hljs-section,.light .hljs-name,.light .hljs-selector-tag,.light .hljs-deletion,.light .hljs-subst{color:#e45649}.light .hljs-literal{color:#0184bb}.light .hljs-string,.light .hljs-regexp,.light .hljs-addition,.light .hljs-attribute,.light .hljs-meta .hljs-string{color:#50a14f}.light .hljs-attr,.light .hljs-variable,.light .hljs-template-variable,.light .hljs-type,.light .hljs-selector-class,.light .hljs-selector-attr,.light .hljs-selector-pseudo,.light .hljs-number{color:#986801}.light .hljs-symbol,.light .hljs-bullet,.light .hljs-link,.light .hljs-meta,.light .hljs-selector-id,.light .hljs-title{color:#4078f2}.light .hljs-built_in,.light .hljs-title.class_,.light .hljs-class .hljs-title{color:#c18401}.light .hljs-emphasis{font-style:italic}.light .hljs-strong{font-weight:700}.light .hljs-link{text-decoration:underline}.light blockquote{background:#eee;color:#111}.light code{background:#ddd;color:#000}.light .search-container{background:rgba(0,0,0,.1)}.light .search-close-button svg{fill:red}.light .search-container .wrapper{background:#eee}.light .search-result-c{color:#aaa}.light .search-box-c svg{fill:#333}.light .search-input{background:#f7f7f7;color:#111}.light .search-result-item{background:#f7f7f7}.light .search-result-item:hover{background:#e9e9e9}.light .search-result-item:active{background:#f7f7f7}.light .search-result-item-title{color:#111}.light .search-result-item-p{color:#aaa}.light .mobile-menu-icon-container .icon-button{background:#e5e5e5}.light .mobile-sidebar-container{background:#fff}.light .mobile-sidebar-wrapper{background:#f7f7f7}.light .child-tutorial{border-color:#aaa;color:#222}.light .child-tutorial:hover{background:#ccc} \ No newline at end of file diff --git a/sdk/docs/styles/clean-jsdoc-theme.min.css b/sdk/docs/styles/clean-jsdoc-theme.min.css index 188d27479..35a696a0f 100644 --- a/sdk/docs/styles/clean-jsdoc-theme.min.css +++ b/sdk/docs/styles/clean-jsdoc-theme.min.css @@ -1 +1 @@ -@font-face{font-family:"heading";src:url(../fonts/WorkSans-Bold.ttf)format("truetype");font-display:swap}@font-face{font-family:"body";src:url(../fonts/OpenSans-Regular.ttf)format("truetype");font-display:swap}@font-face{font-family:"code";src:url(../fonts/Inconsolata-Regular.ttf)format("truetype");font-display:swap}:root{--outer-wrapper-max-width:65rem}*{box-sizing:border-box;margin:0;padding:0}html,body{min-height:100%;width:100%;line-height:1.75}body{font-family:"body";overflow-x:hidden;position:relative}b{font-family:heading}h1,h2,h3,h4,h5,h6{font-family:"heading";font-weight:400;line-height:1.75}h1{font-size:3.5rem;margin:0}h2{font-size:2.25rem;margin:2rem 0 0}h3{font-size:1.5rem}h4{font-size:1.25rem}h5{font-size:1rem}h6{font-size:1rem}img{max-width:100%}a{text-decoration:none}a:hover{text-decoration:underline}a img{margin-right:.5rem}p{margin:1rem 0}article ul{list-style:none}article ul li,article ol li{padding:.5rem 0}article ol,article ul{padding-left:3rem}article ol p,article ul p{margin:0}.variation{display:none}.signature-attributes{font-style:italic;font-weight:lighter}.ancestors a{text-decoration:none}.important{font-weight:700}.signature{font-family:"code"}.name{font-family:"code";font-weight:700}blockquote{font-size:.875rem;padding:.0625rem 1.25rem;border-radius:1rem;margin:.5rem 0}.details{border-radius:1rem;margin:1rem 0}.details .details-item-container{display:flex;padding:1rem 2rem}dt{font-family:heading}.details dt{float:left;min-width:11rem}.details ul{margin:0;display:inline-flex;list-style-type:none}.details ul li{display:inline-flex;margin-right:.6125rem;padding:0;word-break:break-word}.details ul li p{margin:0}.details pre.prettyprint{margin:0}.details .object-value{padding-top:0}.description{margin-bottom:2rem}.method-member-container table{margin-top:1rem}.pre-div .hljs-ln{margin:0}.code-caption{font-size:.875rem}.prettyprint{font-size:.875rem;overflow:auto}pre.prettyprint{margin-top:3rem}.prettyprint.source{width:inherit}.prettyprint code{display:block;font-size:1rem;line-height:1.75;padding:0 0 1rem}.prettyprint .compact{padding:0}h4.name{margin-top:.5rem}.params,.props,table{border-collapse:separate;border-spacing:0 .5rem;border-radius:.5rem;font-size:.875rem;margin:0;width:100%}table td:first-child,.params td:first-child,table thead th:first-child,.params thead th:first-child,.props thead th:first-child{border-top-left-radius:1rem;border-bottom-left-radius:1rem}table td:last-child,.params td:last-child,table thead th:last-child,.params thead th:last-child,.props thead th:last-child{border-top-right-radius:1rem;border-bottom-right-radius:1rem}table th,.params th{position:sticky;top:0}.params .name,.props .name,.name code{font-family:"code";font-size:1rem}.params td,.params th,.props td,.props th,th,td{display:table-cell;margin:0;padding:1rem 2rem;text-align:left;vertical-align:top}.params thead tr,.props thead tr{font-weight:700}.params .params thead tr,.props .props thead tr{font-weight:700}.params td.description>p:first-child,.props td.description>p:first-child{margin-top:0;padding-top:0}.params td.description>p:last-child,.props td.description>p:last-child{margin-bottom:0;padding-bottom:0}dl.param-type{margin-bottom:1rem;padding-bottom:1rem}.param-type dt,.param-type dd{display:inline-block}.param-type dd{font-family:"code";font-size:1rem}code{border-radius:.3rem;font-family:"code";font-size:1rem;padding:.1rem .4rem}.mt-20{margin-top:1.5rem}.codepen-form{bottom:0;position:absolute;right:.6125rem}.body-wrapper{display:flex;flex-direction:column;height:100vh;position:relative}.sidebar-container{position:fixed;display:flex;padding:1rem;top:0;bottom:0;left:0;width:25rem;z-index:10}.sidebar{border-radius:1rem;flex:1;padding:1.5rem 0;overflow:hidden;display:flex;flex-direction:column}.sidebar-title{margin:0;padding:0 2rem;text-decoration:none;font-size:1.5rem;font-family:heading}.sidebar-title:hover{text-decoration:none}.sidebar-items-container{margin-top:5rem;overflow:auto;flex:1;position:relative}.sidebar-section-title{padding:.5rem 2rem;font-family:heading;font-size:1.25rem;border-radius:1rem}.with-arrow{align-items:center;cursor:pointer;display:flex}.with-arrow div{flex:1}.with-arrow svg{height:1rem;width:1rem;transition:transform .3s}.with-arrow[data-isopen=true] svg{transform:rotate(180deg)}.sidebar-section-children-container{border-radius:.5rem;overflow:hidden}.sidebar-section-children a{display:block;width:100%;padding:.25rem 2rem}.sidebar-section-children a{text-decoration:none}.with-arrow[data-isopen=false]+.sidebar-section-children-container{height:0;overflow:hidden}.with-arrow[data-isopen=true]+.sidebar-section-children-container{height:auto}.toc-container{position:fixed;top:0;right:4rem;bottom:0;width:16rem;z-index:10}.toc-content{padding-top:10rem;display:flex;flex-direction:column;height:100%}#eed4d2a0bfd64539bb9df78095dec881{margin:2rem 0;flex:1;overflow:auto}.toc-list{padding-left:1rem;list-style:none}.toc-link{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.toc-link.is-active-link{font-family:heading}.has-anchor{position:relative}.link-anchor{padding:0 .5rem}.has-anchor .link-anchor{position:absolute;left:0;top:0;transform:translateX(-100%);text-decoration:none;visibility:hidden}.has-anchor:hover .link-anchor{visibility:visible}.navbar-container{position:fixed;z-index:10;top:0;left:25rem;right:25rem;height:7rem;padding-top:1rem;display:flex;justify-content:center}.navbar{display:flex;padding:1rem 4rem 1rem 2rem;flex:1;max-width:var(--outer-wrapper-max-width)}.navbar-left-items{display:flex;flex:1}.navbar-right-items{display:flex}.icon-button svg{height:1rem;width:1rem}.icon-button{background:0 0;position:relative;display:inline-flex;border:0;padding:.5rem;border-radius:50%;cursor:pointer;transition:background .3s}.navbar-right-item{display:flex;justify-content:center;align-items:center;margin:0 .25rem}.navbar-item{border-radius:.5rem;overflow:hidden}.navbar-item a{display:inline-block;padding:1rem 2rem;text-decoration:none;transition:.3s}.font-size-tooltip{display:flex;align-items:center;margin:0-.5rem}.font-size-tooltip .icon-button.disabled{pointer-events:none}.main-content{position:relative;flex:1;overflow:auto;display:flex;flex-direction:column;align-items:center;padding:7rem 25rem 0}.main-wrapper{width:100%;max-width:var(--outer-wrapper-max-width);padding:0 4rem 1rem}.p-h-n{padding:.4rem 1rem}.footer{width:100%;margin:5rem 0 0 0;border-radius:1rem;font-size:.875rem;display:flex;justify-content:center}.source-page+.footer{margin-top:3rem}.footer .wrapper{flex:1;padding:1rem 2rem;max-width:var(--outer-wrapper-max-width)}pre{position:relative}.hljs table td{background:0 0;padding:0 .6125rem;line-height:1.5;border-radius:0}.hljs .hljs-ln-numbers{width:2rem;white-space:nowrap;padding-left:1.5rem}.hljs-ln-line.hljs-ln-numbers::before{content:attr(data-line-number)}.pre-div{position:relative;border-radius:1rem;overflow:hidden;margin:2rem 0}.pre-top-bar-container{align-items:center;display:flex;justify-content:space-between;left:0;padding:.3125rem 1.5rem;position:absolute;right:0;top:0}.code-copy-icon-container{align-items:center;border-radius:50%;cursor:pointer;display:flex;height:1.875rem;justify-content:center;transition:.3s;width:1.875rem}.code-copy-icon-container>div{margin-top:.25rem;position:relative}.sm-icon{height:1rem;width:1rem}.code-lang-name{font-family:"body";font-size:.75rem}.tooltip{border-radius:.3125rem;opacity:0;padding:.1875rem .5rem;position:absolute;right:2rem;top:.3125rem;transform:scale(0);transition:.3s}.show-tooltip{opacity:1;transform:scale(1)}.allow-overflow{overflow:auto}.bold{font-family:heading}.search-container{position:fixed;top:0;bottom:0;right:0;left:0;justify-content:center;z-index:50;align-items:flex-start}.search-container .wrapper{width:100%;max-width:60rem;padding:4rem 2rem 2rem;border-radius:1rem;margin:3rem 25rem;position:relative}.search-close-button{position:absolute;top:1rem;right:1rem}.search-result-c-text{display:flex;justify-content:center;user-select:none}.search-result-c{min-height:20rem;max-height:40rem;overflow:auto;padding:2rem 0}.search-box-c{width:100%;position:relative;display:flex;align-items:center}.search-box-c svg{height:1.5rem;width:1.5rem;position:absolute;left:1.5rem}.search-input{border:0;border-radius:1rem;width:100%;flex:1;padding:1rem 2rem 1rem 4rem;font-family:body;font-size:1.25rem}.search-result-item{display:block;text-decoration:none;padding:1rem;border-radius:1rem;margin:1rem 0}.search-result-item:hover{text-decoration:none}.search-result-item:active{text-decoration:none}.search-result-item-title{font-family:heading;font-size:1.5rem;margin:0}.search-result-item-p{font-size:.875rem;margin:0}.mobile-menu-icon-container{display:none;position:fixed;bottom:1.5rem;right:2rem;z-index:30}.mobile-menu-icon-container .icon-button svg{height:2rem;width:2rem}.mobile-sidebar-container{position:fixed;top:0;right:0;left:0;bottom:0;padding:1rem;z-index:25;display:none}.mobile-sidebar-container.show{display:block}.mobile-sidebar-wrapper{border-radius:1rem;height:100%;width:100%;display:flex;flex-direction:column;padding-top:2rem}.mobile-nav-links{display:flex;flex-wrap:wrap;padding-top:2rem}.mobile-sidebar-items-c{flex:1;overflow:auto}.mobile-navbar-actions{display:flex;padding:1rem}.rel{position:relative}.icon-button.codepen-button svg{height:1.5rem;width:1.5rem}.table-div{width:100%;overflow:auto}.tag-default{overflow:auto}::-webkit-scrollbar{width:.3125rem;height:.3125rem}::-webkit-scrollbar-thumb,::-webkit-scrollbar-track{border-radius:1rem}@media screen and (max-width:100em){.toc-container{display:none}.main-content{padding:7rem 0 0 25rem}.search-container .wrapper{margin-right:1rem}.navbar-container{right:1rem}}@media screen and (min-width:65em){.mobile-sidebar-container.show{display:none}}@media screen and (max-width:65em){h1{font-size:3rem}h2{font-size:2rem}h3{font-size:1.875}h4,h5,h6{font-size:1rem}.main-wrapper{padding:0 1rem 1rem}.search-result-c{max-height:25rem}.mobile-menu-icon-container{display:block}.sidebar-container{display:none}.search-container .wrapper{margin-left:1rem}.main-content{padding-left:0;padding-top:1rem}.navbar-container{display:none}.source-page+.footer,.footer{margin-top:2rem}.has-anchor:hover .link-anchor{visibility:hidden}}::selection{background:#ffce76;color:#222}body{background-color:#1a1a1a;color:#fff}a,a:active{color:#0bf}hr{color:#222}h1,h2,h3,h4,h5,h6{color:#fff}.sidebar{background-color:#222;color:#999}.sidebar-title{color:#999}.sidebar-section-title{color:#999}.sidebar-section-title:hover{background:#252525}.with-arrow{fill:#999}.sidebar-section-children-container{background:#292929}.sidebar-section-children a:hover{background:#2c2c2c}.sidebar-section-children a{color:#fff}.navbar-container{background:#1a1a1a}.icon-button svg,.navbar-item a{color:#999;fill:#999}.font-size-tooltip .icon-button svg{fill:#fff}.font-size-tooltip .icon-button.disabled{background:#999}.icon-button:hover{background:#333}.icon-button:active{background:#444}.navbar-item a:active{color:#aaa;background-color:#222}.navbar-item:hover{background:#202020}.footer{background:#222;color:#999}.footer a{color:#999}.toc-link{color:#777;transition:color .3s;font-size:.875rem}.toc-link.is-active-link{color:#fff}.has-anchor .link-anchor{color:#555}.has-anchor .link-anchor:hover{color:#888}tt,code,kbd,samp{background:#333}.signature-attributes{color:#aaa}.ancestors{color:#999}.ancestors a{color:#999!important}.important{color:#c51313}.type-signature{color:#00918e}.name,.name a{color:#f7f7f7}.details{background:#222;color:#fff}.prettyprint{background:#222}.member-item-container strong,.method-member-container strong{color:#fff}.pre-top-bar-container{background:#292929}.prettyprint.source,.prettyprint code{background-color:#222;color:#c9d1d9}.pre-div{background-color:#222}.hljs .hljs-ln-numbers{color:#777}.hljs .selected{background:#444}.hljs .selected .hljs-ln-numbers{color:#eee}table .name,.params .name,.props .name,.name code{color:#fff}table td,.params td{background-color:#292929}table thead th,.params thead th,.props thead th{background-color:#222;color:#fff}table .params thead tr,.params .params thead tr,.props .props thead tr{background-color:#222;color:#fff}.disabled{color:#aaa}.code-lang-name{color:#ff8a00}.tooltip{background:#ffce76;color:#222}.hljs-comment{color:#8b949e}.hljs-doctag,.hljs-keyword,.hljs-template-tag,.hljs-variable.language_{color:#ff7b72}.hljs-template-variable,.hljs-type{color:#30ac7c}.hljs-meta,.hljs-string,.hljs-regexp{color:#a5d6ff}.hljs-title.class_,.hljs-title{color:#ffa657}.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}blockquote{background:#222;color:#fff}.search-container{background:rgba(255,255,255,.1)}.icon-button.search-close-button svg{fill:#a00}.search-container .wrapper{background:#222}.search-result-c{color:#666}.search-box-c{fill:#333}.search-input{background:#333;color:#fff}.search-box-c svg{fill:#fff}.search-result-item{background:#333}.search-result-item:hover{background:#444}.search-result-item:active{background:#555}.search-result-item-title{color:#fff}.search-result-item-p{color:#aaa}.mobile-menu-icon-container .icon-button{background:#333}.mobile-sidebar-container{background:#1a1a1a}.mobile-sidebar-wrapper{background:#222}::-webkit-scrollbar-track{background:#333}::-webkit-scrollbar-thumb{background:#555;outline:.06125rem solid #555}.light ::selection{background:#ffce76;color:#1d1919}body.light{background-color:#fff;color:#111}.light a,.light a:active{color:#007bff}.light hr{color:#f7f7f7}.light h1,.light h2,.light h3,.light h4,.light h5,.light h6{color:#111}.light .sidebar{background-color:#f7f7f7;color:#222}.light .sidebar-title{color:#222}.light .sidebar-section-title{color:#222}.light .sidebar-section-title:hover{background:#eee}.light .with-arrow{fill:#111}.light .sidebar-section-children-container{background:#eee}.light .sidebar-section-children a:hover{background:#e0e0e0}.light .sidebar-section-children a{color:#111}.light .navbar-container{background:#fff}.light .icon-button svg,.light .navbar-item a{color:#222;fill:#222}.light .tippy-box{background:#eee;color:#111}.light .tippy-arrow{color:#f1f1f1}.light .font-size-tooltip .icon-button svg{fill:#111}.light .font-size-tooltip .icon-button.disabled svg{fill:#999}.light .icon-button:hover{background:#ddd}.light .icon-button:active{background:#ccc}.light .navbar-item a:active{color:#333;background-color:#eee}.light .navbar-item:hover{background:#f7f7f7}.light .footer{background:#f7f7f7;color:#111}.light .footer a{color:#111}.light .toc-link{color:#999;transition:color .3s;font-size:.875rem}.light .toc-link.is-active-link{color:#111}.light .has-anchor .link-anchor{color:#ddd}.light .has-anchor .link-anchor:hover{color:#ccc}.light .signature-attributes{color:#aaa}.light .ancestors{color:#999}.light .ancestors a{color:#999!important}.light .important{color:#ee1313}.light .type-signature{color:#00918e}.light .name,.light .name a{color:#293a80}.light .details{background:#f9f9f9;color:#101010}.light .member-item-container strong,.light .method-member-container strong{color:#000}.light .prettyprint{background:#f7f7f7}.light .pre-div{background:#f7f7f7}.light .hljs .hljs-ln-numbers{color:#aaa}.light .hljs .selected{background:#ccc}.light table.hljs-ln td{background:0 0}.light .hljs .selected .hljs-ln-numbers{color:#444}.light .pre-top-bar-container{background-color:#eee}.light .prettyprint code{background-color:#f7f7f7}.light table .name,.light .params .name,.light .props .name,.light .name code{color:#4d4e53}.light table td,.light .params td{background:#f7f7f7}.light table thead th,.light .params thead th,.light .props thead th{background-color:#eee;color:#111}.light table .params thead tr,.light .params .params thead tr,.light .props .props thead tr{background-color:#eee;color:#111}.light .disabled{color:#454545}.light .code-lang-name{color:red}.light .tooltip{background:#ffce76;color:#000}.light .hljs-comment,.light .hljs-quote{color:#a0a1a7}.light .hljs-doctag,.light .hljs-keyword,.light .hljs-formula{color:#a626a4}.light .hljs-section,.light .hljs-name,.light .hljs-selector-tag,.light .hljs-deletion,.light .hljs-subst{color:#e45649}.light .hljs-literal{color:#0184bb}.light .hljs-string,.light .hljs-regexp,.light .hljs-addition,.light .hljs-attribute,.light .hljs-meta .hljs-string{color:#50a14f}.light .hljs-attr,.light .hljs-variable,.light .hljs-template-variable,.light .hljs-type,.light .hljs-selector-class,.light .hljs-selector-attr,.light .hljs-selector-pseudo,.light .hljs-number{color:#986801}.light .hljs-symbol,.light .hljs-bullet,.light .hljs-link,.light .hljs-meta,.light .hljs-selector-id,.light .hljs-title{color:#4078f2}.light .hljs-built_in,.light .hljs-title.class_,.light .hljs-class .hljs-title{color:#c18401}.light .hljs-emphasis{font-style:italic}.light .hljs-strong{font-weight:700}.light .hljs-link{text-decoration:underline}.light blockquote{background:#eee;color:#111}.light code{background:#ddd;color:#000}.light .search-container{background:rgba(0,0,0,.1)}.light .search-close-button svg{fill:red}.light .search-container .wrapper{background:#eee}.light .search-result-c{color:#aaa}.light .search-box-c svg{fill:#333}.light .search-input{background:#f7f7f7;color:#111}.light .search-result-item{background:#f7f7f7}.light .search-result-item:hover{background:#e9e9e9}.light .search-result-item:active{background:#f7f7f7}.light .search-result-item-title{color:#111}.light .search-result-item-p{color:#aaa}.light .mobile-menu-icon-container .icon-button{background:#e5e5e5}.light .mobile-sidebar-container{background:#fff}.light .mobile-sidebar-wrapper{background:#f7f7f7}.light ::-webkit-scrollbar-track{background:#ddd}.light ::-webkit-scrollbar-thumb{background:#aaa;outline:.06125rem solid #aaa} \ No newline at end of file +@font-face{font-display:swap;font-family:"heading";src:url(../fonts/WorkSans-Bold.ttf)format("truetype")}@font-face{font-display:swap;font-family:"body";src:url(../fonts/OpenSans-Regular.ttf)format("truetype")}@font-face{font-display:swap;font-family:"code";src:url(../fonts/Inconsolata-Regular.ttf)format("truetype")}:root{--outer-wrapper-max-width:65rem}*{box-sizing:border-box;margin:0;padding:0}html,body{line-height:1.75;min-height:100%;width:100%}body{font-family:"body";overflow-x:hidden;position:relative}b{font-family:heading}h1,h2,h3,h4,h5,h6{font-family:"heading";font-weight:400;line-height:1.75}h1{font-size:3.5rem;margin:0}h2{font-size:2.25rem;margin:2rem 0 0}h3{font-size:1.5rem}h4{font-size:1.25rem}h5{font-size:1rem}h6{font-size:1rem}img{max-width:100%}a{text-decoration:none}a:hover{text-decoration:underline}a img{margin-right:.5rem}p{margin:1rem 0}article ul{list-style:disc}article ul li,article ol li{padding:.5rem 0}article ol,article ul{padding-left:2rem}article ol p,article ul p{margin:0}.variation{display:none}.signature-attributes{font-style:italic;font-weight:lighter}.ancestors a{text-decoration:none}.important{font-weight:700}.signature{font-family:"code"}.name{font-family:"code";font-weight:700}blockquote{border-radius:1rem;font-size:.875rem;margin:.5rem 0;padding:.0625rem 1.25rem}.details{border-radius:1rem;margin:1rem 0}.details .details-item-container{display:flex;padding:1rem 2rem}dt{font-family:heading}.details dt{float:left;min-width:11rem}.details ul{display:inline-flex;list-style-type:none;margin:0}.details ul li{display:inline-flex;margin-right:.6125rem;padding:0;word-break:break-word}.details ul li p{margin:0}.details pre.prettyprint{margin:0}.details .object-value{padding-top:0}.description{margin-bottom:2rem}.method-member-container table{margin-top:1rem}.pre-div .hljs-ln{margin:0}.code-caption{font-size:.875rem}.prettyprint{font-size:.875rem;overflow:auto}pre.prettyprint{margin-top:3rem}.prettyprint.source{width:inherit}.prettyprint code{display:block;font-size:1rem;line-height:1.75;padding:0 0 1rem}.prettyprint .compact{padding:0}h4.name{margin-top:.5rem}.params,.props,table{border-collapse:separate;border-radius:.5rem;border-spacing:0 .5rem;font-size:.875rem;margin:0;width:100%}table td:first-child,.params td:first-child,table thead th:first-child,.params thead th:first-child,.props thead th:first-child{border-bottom-left-radius:1rem;border-top-left-radius:1rem}table td:last-child,.params td:last-child,table thead th:last-child,.params thead th:last-child,.props thead th:last-child{border-bottom-right-radius:1rem;border-top-right-radius:1rem}table th,.params th{position:sticky;top:0}.params .name,.props .name,.name code{font-family:"code";font-size:1rem}.params td,.params th,.props td,.props th,th,td{display:table-cell;margin:0;padding:1rem 2rem;text-align:left;vertical-align:top}.params thead tr,.props thead tr{font-weight:700}.params .params thead tr,.props .props thead tr{font-weight:700}.params td.description>p:first-child,.props td.description>p:first-child{margin-top:0;padding-top:0}.params td.description>p:last-child,.props td.description>p:last-child{margin-bottom:0;padding-bottom:0}dl.param-type{margin-bottom:1rem;padding-bottom:1rem}.param-type dt,.param-type dd{display:inline-block}.param-type dd{font-family:"code";font-size:1rem}code{border-radius:.3rem;font-family:"code";font-size:1rem;padding:.1rem .4rem}.mt-20{margin-top:1.5rem}.codepen-form{bottom:0;position:absolute;right:.6125rem}.body-wrapper{display:flex;flex-direction:column;height:100vh;position:relative}.sidebar-container{bottom:0;display:flex;left:0;padding:1rem;position:fixed;top:0;width:25rem;z-index:10}.sidebar{border-radius:1rem;display:flex;flex:1;flex-direction:column;overflow:hidden;padding:1.5rem 0}.sidebar-title{font-family:heading;font-size:1.5rem;margin:0 0 2rem;padding:0 2rem;text-decoration:none}.sidebar-title:hover{text-decoration:none}.sidebar-items-container{flex:1;overflow:auto;position:relative}.sidebar-section-title{border-radius:1rem;font-family:heading;font-size:1.25rem;padding:.5rem 2rem}.with-arrow{align-items:center;cursor:pointer;display:flex}.with-arrow div{flex:1}.with-arrow svg{height:1rem;transition:transform .3s;width:1rem}.with-arrow[data-isopen=true] svg{transform:rotate(180deg)}.sidebar-section-children-container{border-radius:.5rem;overflow:hidden}.sidebar-section-children a{display:block;padding:.25rem 2rem;width:100%}.sidebar-section-children a{text-decoration:none}.with-arrow[data-isopen=false]+.sidebar-section-children-container{height:0;overflow:hidden}.with-arrow[data-isopen=true]+.sidebar-section-children-container{height:auto}.toc-container{bottom:0;position:fixed;right:4rem;top:0;width:16rem;z-index:10}.toc-content{display:flex;flex-direction:column;height:100%;padding-top:10rem}#eed4d2a0bfd64539bb9df78095dec881{flex:1;margin:2rem 0;overflow:auto}.toc-list{list-style:none;padding-left:1rem}.toc-link{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.toc-link.is-active-link{font-family:heading}.has-anchor{position:relative}.link-anchor{padding:0 .5rem}.has-anchor .link-anchor{left:0;position:absolute;text-decoration:none;top:0;transform:translateX(-100%);visibility:hidden}.has-anchor:hover .link-anchor{visibility:visible}.navbar-container{display:flex;height:7rem;justify-content:center;left:25rem;padding-top:1rem;position:fixed;right:25rem;top:0;z-index:10}.navbar{display:flex;flex:1;max-width:var(--outer-wrapper-max-width);padding:1rem 4rem 1rem 2rem}.navbar-left-items{display:flex;flex:1}.navbar-right-items{display:flex}.icon-button svg{height:1rem;width:1rem}.icon-button{background:0 0;border:0;border-radius:50%;cursor:pointer;display:inline-flex;padding:.5rem;position:relative;transition:background .3s}.navbar-right-item{align-items:center;display:flex;justify-content:center;margin:0 .25rem}.navbar-item{border-radius:.5rem;overflow:hidden}.navbar-item a{display:inline-block;padding:1rem 2rem;text-decoration:none;transition:.3s}.font-size-tooltip{align-items:center;display:flex;margin:0-.5rem}.font-size-tooltip .icon-button.disabled{pointer-events:none}.main-content{align-items:center;display:flex;flex:1;flex-direction:column;overflow:auto;padding:7rem 25rem 0;position:relative}.main-wrapper{max-width:var(--outer-wrapper-max-width);padding:0 4rem 1rem;width:100%}.p-h-n{padding:.4rem 1rem}.footer{border-radius:1rem;display:flex;font-size:.875rem;justify-content:center;margin-top:5rem;width:100%}.source-page+.footer{margin-top:3rem}.footer .wrapper{flex:1;max-width:var(--outer-wrapper-max-width);padding:1rem 2rem}pre{position:relative}.hljs table td{background:0 0;border-radius:0;line-height:1.5;padding:0 .6125rem}.hljs .hljs-ln-numbers{padding-left:1.5rem;user-select:none;white-space:nowrap;width:2rem}.hljs-ln-line.hljs-ln-numbers::before{content:attr(data-line-number)}.pre-div{border-radius:1rem;margin:2rem 0;overflow:hidden;position:relative}.pre-top-bar-container{align-items:center;display:flex;justify-content:space-between;left:0;padding:.3125rem 1.5rem;position:absolute;right:0;top:0}.code-copy-icon-container{align-items:center;border-radius:50%;cursor:pointer;display:flex;height:1.875rem;justify-content:center;transition:.3s;width:1.875rem}.code-copy-icon-container>div{margin-top:.25rem;position:relative}.sm-icon{height:1rem;width:1rem}.code-lang-name{font-family:"body";font-size:.75rem}.tooltip{border-radius:.3125rem;opacity:0;padding:.1875rem .5rem;position:absolute;right:2rem;top:.3125rem;transform:scale(0);transition:.3s}.show-tooltip{opacity:1;transform:scale(1)}.allow-overflow{overflow:auto}.bold{font-family:heading}.search-container{align-items:flex-start;bottom:0;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:50}.search-container .wrapper{border-radius:1rem;margin:3rem 25rem;max-width:60rem;padding:4rem 2rem 2rem;position:relative;width:100%}.search-close-button{position:absolute;right:1rem;top:1rem}.search-result-c-text{display:flex;justify-content:center;user-select:none}.search-result-c{max-height:40rem;min-height:20rem;overflow:auto;padding:2rem 0}.search-box-c{align-items:center;display:flex;position:relative;width:100%}.search-box-c svg{height:1.5rem;left:1.5rem;position:absolute;width:1.5rem}.search-input{border:0;border-radius:1rem;flex:1;font-family:body;font-size:1.25rem;padding:1rem 2rem 1rem 4rem;width:100%}.search-result-item{border-radius:1rem;display:block;margin:1rem 0;padding:1rem;text-decoration:none}.search-result-item:hover{text-decoration:none}.search-result-item:active{text-decoration:none}.search-result-item-title{font-family:heading;font-size:1.5rem;margin:0}.search-result-item-p{font-size:.875rem;margin:0}.mobile-menu-icon-container{bottom:1.5rem;display:none;position:fixed;right:2rem;z-index:30}.mobile-menu-icon-container .icon-button svg{height:2rem;width:2rem}.mobile-sidebar-container{bottom:0;display:none;left:0;padding:1rem;position:fixed;right:0;top:0;z-index:25}.mobile-sidebar-container.show{display:block}.mobile-sidebar-wrapper{border-radius:1rem;display:flex;flex-direction:column;height:100%;padding-top:2rem;width:100%}.mobile-nav-links{display:flex;flex-wrap:wrap;padding-top:2rem}.mobile-sidebar-items-c{flex:1;overflow:auto}.mobile-navbar-actions{display:flex;padding:1rem}.rel{position:relative}.icon-button.codepen-button svg{height:1.5rem;width:1.5rem}.table-div{overflow:auto;width:100%}.tag-default{overflow:auto}@media screen and (max-width:100em){.toc-container{display:none}.main-content{padding:7rem 0 0 25rem}.search-container .wrapper{margin-right:1rem}.navbar-container{right:1rem}}@media screen and (min-width:65em){.mobile-sidebar-container.show{display:none}}@media screen and (max-width:65em){h1{font-size:3rem}h2{font-size:2rem}h3{font-size:1.875}h4,h5,h6{font-size:1rem}.main-wrapper{padding:0 1rem 1rem}.search-result-c{max-height:25rem}.mobile-menu-icon-container{display:block}.sidebar-container{display:none}.search-container .wrapper{margin-left:1rem}.main-content{padding-left:0;padding-top:1rem}.navbar-container{display:none}.source-page+.footer,.footer{margin-top:2rem}.has-anchor:hover .link-anchor{visibility:hidden}}.child-tutorial-container{display:flex;flex-direction:row;flex-wrap:wrap}.child-tutorial{border:1px solid;border-radius:10px;display:block;margin:5px;padding:10px 16px}.child-tutorial:hover{text-decoration:none}::selection{background:#ffce76;color:#222}body{background-color:#1a1a1a;color:#fff}a,a:active{color:#0bf}hr{color:#222}h1,h2,h3,h4,h5,h6{color:#fff}.sidebar{background-color:#222;color:#999}.sidebar-title{color:#999}.sidebar-section-title{color:#999}.sidebar-section-title:hover{background:#252525}.with-arrow{fill:#999}.sidebar-section-children-container{background:#292929}.sidebar-section-children.active{background:#444}.sidebar-section-children a:hover{background:#2c2c2c}.sidebar-section-children a{color:#fff}.navbar-container{background:#1a1a1a}.icon-button svg,.navbar-item a{color:#999;fill:#999}.font-size-tooltip .icon-button svg{fill:#fff}.font-size-tooltip .icon-button.disabled{background:#999}.icon-button:hover{background:#333}.icon-button:active{background:#444}.navbar-item a:active{background-color:#222;color:#aaa}.navbar-item:hover{background:#202020}.footer{background:#222;color:#999}.footer a{color:#999}.toc-link{color:#777;font-size:.875rem;transition:color .3s}.toc-link.is-active-link{color:#fff}.has-anchor .link-anchor{color:#555}.has-anchor .link-anchor:hover{color:#888}tt,code,kbd,samp{background:#333}.signature-attributes{color:#aaa}.ancestors{color:#999}.ancestors a{color:#999!important}.important{color:#c51313}.type-signature{color:#00918e}.name,.name a{color:#f7f7f7}.details{background:#222;color:#fff}.prettyprint{background:#222}.member-item-container strong,.method-member-container strong{color:#fff}.pre-top-bar-container{background:#292929}.prettyprint.source,.prettyprint code{background-color:#222;color:#c9d1d9}.pre-div{background-color:#222}.hljs .hljs-ln-numbers{color:#777}.hljs .selected{background:#444}.hljs .selected .hljs-ln-numbers{color:#eee}table .name,.params .name,.props .name,.name code{color:#fff}table td,.params td{background-color:#292929}table thead th,.params thead th,.props thead th{background-color:#222;color:#fff}table .params thead tr,.params .params thead tr,.props .props thead tr{background-color:#222;color:#fff}.disabled{color:#aaa}.code-lang-name{color:#ff8a00}.tooltip{background:#ffce76;color:#222}.hljs-comment{color:#8b949e}.hljs-doctag,.hljs-keyword,.hljs-template-tag,.hljs-variable.language_{color:#ff7b72}.hljs-template-variable,.hljs-type{color:#30ac7c}.hljs-meta,.hljs-string,.hljs-regexp{color:#a5d6ff}.hljs-title.class_,.hljs-title{color:#ffa657}.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}blockquote{background:#222;color:#fff}.search-container{background:rgba(255,255,255,.1)}.icon-button.search-close-button svg{fill:#a00}.search-container .wrapper{background:#222}.search-result-c{color:#666}.search-box-c{fill:#333}.search-input{background:#333;color:#fff}.search-box-c svg{fill:#fff}.search-result-item{background:#333}.search-result-item:hover{background:#444}.search-result-item:active{background:#555}.search-result-item-title{color:#fff}.search-result-item-p{color:#aaa}.mobile-menu-icon-container .icon-button{background:#333}.mobile-sidebar-container{background:#1a1a1a}.mobile-sidebar-wrapper{background:#222}.child-tutorial{border-color:#555;color:#f3f3f3}.child-tutorial:hover{background:#222}.light ::selection{background:#ffce76;color:#1d1919}body.light{background-color:#fff;color:#111}.light a,.light a:active{color:#007bff}.light hr{color:#f7f7f7}.light h1,.light h2,.light h3,.light h4,.light h5,.light h6{color:#111}.light .sidebar{background-color:#f7f7f7;color:#222}.light .sidebar-title{color:#222}.light .sidebar-section-title{color:#222}.light .sidebar-section-title:hover,.light .sidebar-section-title.active{background:#eee}.light .with-arrow{fill:#111}.light .sidebar-section-children-container{background:#eee}.light .sidebar-section-children.active{background:#ccc}.light .sidebar-section-children a:hover{background:#e0e0e0}.light .sidebar-section-children a{color:#111}.light .navbar-container{background:#fff}.light .icon-button svg,.light .navbar-item a{color:#222;fill:#222}.light .tippy-box{background:#eee;color:#111}.light .tippy-arrow{color:#f1f1f1}.light .font-size-tooltip .icon-button svg{fill:#111}.light .font-size-tooltip .icon-button.disabled svg{fill:#999}.light .icon-button:hover{background:#ddd}.light .icon-button:active{background:#ccc}.light .navbar-item a:active{background-color:#eee;color:#333}.light .navbar-item:hover{background:#f7f7f7}.light .footer{background:#f7f7f7;color:#111}.light .footer a{color:#111}.light .toc-link{color:#999;font-size:.875rem;transition:color .3s}.light .toc-link.is-active-link{color:#111}.light .has-anchor .link-anchor{color:#ddd}.light .has-anchor .link-anchor:hover{color:#ccc}.light .signature-attributes{color:#aaa}.light .ancestors{color:#999}.light .ancestors a{color:#999!important}.light .important{color:#ee1313}.light .type-signature{color:#00918e}.light .name,.light .name a{color:#293a80}.light .details{background:#f9f9f9;color:#101010}.light .member-item-container strong,.light .method-member-container strong{color:#000}.light .prettyprint{background:#f7f7f7}.light .pre-div{background:#f7f7f7}.light .hljs .hljs-ln-numbers{color:#aaa}.light .hljs .selected{background:#ccc}.light table.hljs-ln td{background:0 0}.light .hljs .selected .hljs-ln-numbers{color:#444}.light .pre-top-bar-container{background-color:#eee}.light .prettyprint code{background-color:#f7f7f7}.light table .name,.light .params .name,.light .props .name,.light .name code{color:#4d4e53}.light table td,.light .params td{background:#f7f7f7}.light table thead th,.light .params thead th,.light .props thead th{background-color:#eee;color:#111}.light table .params thead tr,.light .params .params thead tr,.light .props .props thead tr{background-color:#eee;color:#111}.light .disabled{color:#454545}.light .code-lang-name{color:red}.light .tooltip{background:#ffce76;color:#000}.light .hljs-comment,.light .hljs-quote{color:#a0a1a7}.light .hljs-doctag,.light .hljs-keyword,.light .hljs-formula{color:#a626a4}.light .hljs-section,.light .hljs-name,.light .hljs-selector-tag,.light .hljs-deletion,.light .hljs-subst{color:#e45649}.light .hljs-literal{color:#0184bb}.light .hljs-string,.light .hljs-regexp,.light .hljs-addition,.light .hljs-attribute,.light .hljs-meta .hljs-string{color:#50a14f}.light .hljs-attr,.light .hljs-variable,.light .hljs-template-variable,.light .hljs-type,.light .hljs-selector-class,.light .hljs-selector-attr,.light .hljs-selector-pseudo,.light .hljs-number{color:#986801}.light .hljs-symbol,.light .hljs-bullet,.light .hljs-link,.light .hljs-meta,.light .hljs-selector-id,.light .hljs-title{color:#4078f2}.light .hljs-built_in,.light .hljs-title.class_,.light .hljs-class .hljs-title{color:#c18401}.light .hljs-emphasis{font-style:italic}.light .hljs-strong{font-weight:700}.light .hljs-link{text-decoration:underline}.light blockquote{background:#eee;color:#111}.light code{background:#ddd;color:#000}.light .search-container{background:rgba(0,0,0,.1)}.light .search-close-button svg{fill:red}.light .search-container .wrapper{background:#eee}.light .search-result-c{color:#aaa}.light .search-box-c svg{fill:#333}.light .search-input{background:#f7f7f7;color:#111}.light .search-result-item{background:#f7f7f7}.light .search-result-item:hover{background:#e9e9e9}.light .search-result-item:active{background:#f7f7f7}.light .search-result-item-title{color:#111}.light .search-result-item-p{color:#aaa}.light .mobile-menu-icon-container .icon-button{background:#e5e5e5}.light .mobile-sidebar-container{background:#fff}.light .mobile-sidebar-wrapper{background:#f7f7f7}.light .child-tutorial{border-color:#aaa;color:#222}.light .child-tutorial:hover{background:#ccc}::-webkit-scrollbar{height:.3125rem;width:.3125rem}::-webkit-scrollbar-thumb,::-webkit-scrollbar-track{border-radius:1rem}::-webkit-scrollbar-track{background:#333}::-webkit-scrollbar-thumb{background:#555;outline:.06125rem solid #555}.light ::-webkit-scrollbar-track{background:#ddd}.light ::-webkit-scrollbar-thumb{background:#aaa;outline:.06125rem solid #aaa} \ No newline at end of file diff --git a/sdk/jsdoc.json b/sdk/jsdoc.json index 6fc5ed67d..4edcdd4d9 100644 --- a/sdk/jsdoc.json +++ b/sdk/jsdoc.json @@ -1,6 +1,6 @@ { "source": { - "include": ["src/account.ts", "src/dev-server-client.ts", "src/key-provider.ts", "src/network-client.ts", "src/program-manager.ts", "src/record-provider.ts"], + "include": ["sdk/src/account.ts", "sdk/src/function-key-provider.ts", "sdk/src/network-client.ts", "sdk/src/offline-key-provider.ts", "sdk/src/program-manager.ts", "sdk/src/record-provider.ts"], "includePattern": ".+\\.ts?$" }, "tags": { @@ -10,14 +10,14 @@ "opts": { "encoding": "utf8", "readme": "./README.md", - "destination": "docs/", + "destination": "sdk/docs/", "recurse": true, "verbose": true, "template": "./node_modules/clean-jsdoc-theme", "theme_opts": { "default_theme": "dark", - "static_dir": ["./public"], - "homepageTitle": "Aleo SDK" + "static_dir": ["sdk/docs/public"], + "homepageTitle": "Provable SDK" } }, "markdown": { diff --git a/sdk/package.json b/sdk/package.json index bebc2b24a..e14f0d1ce 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@provablehq/sdk", - "version": "0.7.0", + "version": "0.7.6", "description": "A Software Development Kit (SDK) for Zero-Knowledge Transactions", "collaborators": [ "The Provable Team" @@ -30,7 +30,7 @@ ], "scripts": { "build": "rimraf dist && rollup -c rollup.config.js", - "test": "rimraf tmp && rollup -c rollup.test.js && mocha tmp/**/*.test.js --parallel --timeout 60000" + "test": "rimraf tmp && rollup -c rollup.test.js && mocha tmp/**/*.test.js --timeout 60000" }, "repository": { "type": "git", @@ -47,8 +47,9 @@ }, "homepage": "https://github.com/ProvableHQ/sdk#readme", "dependencies": { - "@provablehq/wasm": "^0.7.0", + "@provablehq/wasm": "^0.7.6", "comlink": "^4.4.1", + "core-js": "^3.38.1", "mime": "^3.0.0", "sync-request": "^6.1.0" }, @@ -60,10 +61,9 @@ "@types/sinon": "^17.0.3", "@typescript-eslint/eslint-plugin": "^5.41.0", "@typescript-eslint/parser": "^5.41.0", - "better-docs": "^2.7.2", + "better-docs": "^2.7.3", "chai": "^5.1.1", - "clean-jsdoc-theme": "^4.1.8", - "core-js": "^3.38.1", + "clean-jsdoc-theme": "^4.3.0", "cpr": "^3.0.1", "eslint": "^8.26.0", "eslint-config-prettier": "^8.5.0", diff --git a/sdk/src/browser.ts b/sdk/src/browser.ts index 6bff23642..932dc1cae 100644 --- a/sdk/src/browser.ts +++ b/sdk/src/browser.ts @@ -2,12 +2,27 @@ import "./polyfill/shared"; import { Account } from "./account"; import { AleoNetworkClient, ProgramImports } from "./network-client"; -import { Block } from "./models/block"; -import { Execution } from "./models/execution"; -import { Input } from "./models/input"; -import { Output } from "./models/output"; -import { TransactionModel } from "./models/transactionModel"; -import { Transition } from "./models/transition"; +import { BlockJSON, Header, Metadata } from "./models/blockJSON"; +import { ConfirmedTransactionJSON } from "./models/confirmed_transaction"; +import { DeploymentJSON, VerifyingKeys } from "./models/deployment/deploymentJSON"; +import { DeploymentObject } from "./models/deployment/deploymentObject"; +import { ExecutionJSON, FeeExecutionJSON } from "./models/execution/executionJSON"; +import { ExecutionObject, FeeExecutionObject } from "./models/execution/executionObject"; +import { FinalizeJSON } from "./models/finalizeJSON"; +import { FunctionObject } from "./models/functionObject"; +import { InputJSON } from "./models/input/inputJSON"; +import { InputObject } from "./models/input/inputObject"; +import { OutputJSON } from "./models/output/outputJSON"; +import { OutputObject } from "./models/output/outputObject"; +import { OwnerJSON } from "./models/owner/ownerJSON"; +import { PlaintextArray} from "./models/plaintext/array"; +import { PlaintextLiteral} from "./models/plaintext/literal"; +import { PlaintextObject } from "./models/plaintext/plaintext"; +import { PlaintextStruct} from "./models/plaintext/struct"; +import { TransactionJSON } from "./models/transaction/transactionJSON"; +import { TransactionObject } from "./models/transaction/transactionObject"; +import { TransitionJSON } from "./models/transition/transitionJSON"; +import { TransitionObject } from "./models/transition/transitionObject"; import { AleoKeyProvider, AleoKeyProviderParams, @@ -41,10 +56,13 @@ export { logAndThrow } from "./utils"; export { Address, + Ciphertext, Execution as FunctionExecution, ExecutionResponse, Field, + Group, OfflineQuery, + Plaintext, PrivateKey, PrivateKeyCiphertext, Program, @@ -53,7 +71,9 @@ export { RecordCiphertext, RecordPlaintext, Signature, + Scalar, Transaction, + Transition, VerifyingKey, ViewKey, initThreadPool, @@ -81,21 +101,41 @@ export { AleoKeyProviderParams, AleoKeyProviderInitParams, AleoNetworkClient, - Block, + BlockJSON, BlockHeightSearch, CachedKeyPair, - Execution, + ConfirmedTransactionJSON, + DeploymentJSON, + DeploymentObject, + ExecutionJSON, + ExecutionObject, + FeeExecutionJSON, + FeeExecutionObject, + FinalizeJSON, + FunctionObject, FunctionKeyPair, FunctionKeyProvider, - Input, + Header, + InputJSON, + InputObject, KeySearchParams, + Metadata, NetworkRecordProvider, ProgramImports, OfflineKeyProvider, OfflineSearchParams, - Output, + OwnerJSON, + PlaintextArray, + PlaintextLiteral, + PlaintextObject, + PlaintextStruct, + OutputJSON, + OutputObject, RecordProvider, RecordSearchParams, - TransactionModel, - Transition, + TransactionJSON, + TransactionObject, + TransitionJSON, + TransitionObject, + VerifyingKeys, }; diff --git a/sdk/src/models/block.ts b/sdk/src/models/blockJSON.ts similarity index 72% rename from sdk/src/models/block.ts rename to sdk/src/models/blockJSON.ts index 5f9775c5a..51bacc1ed 100644 --- a/sdk/src/models/block.ts +++ b/sdk/src/models/blockJSON.ts @@ -1,10 +1,10 @@ -import { ConfirmedTransaction } from "./confirmed_transaction"; +import { ConfirmedTransactionJSON } from "./confirmed_transaction"; -export type Block = { +export type BlockJSON = { block_hash: string; previous_hash: string; header: Header; - transactions?: (ConfirmedTransaction)[]; + transactions?: (ConfirmedTransactionJSON)[]; signature: string; } export type Header = { diff --git a/sdk/src/models/confirmed_transaction.ts b/sdk/src/models/confirmed_transaction.ts index d4ad953af..af350ad6f 100644 --- a/sdk/src/models/confirmed_transaction.ts +++ b/sdk/src/models/confirmed_transaction.ts @@ -1,7 +1,10 @@ -import { TransactionModel } from "./transactionModel"; +import { TransactionJSON } from "./transaction/transactionJSON"; +import { FinalizeJSON } from "./finalizeJSON"; -export type ConfirmedTransaction = { +export interface ConfirmedTransactionJSON { + status: string type: string; - id: string; - transaction: TransactionModel; + index: number; + transaction: TransactionJSON; + finalize: FinalizeJSON[]; } diff --git a/sdk/src/models/deployment/deploymentJSON.ts b/sdk/src/models/deployment/deploymentJSON.ts new file mode 100644 index 000000000..ac7321125 --- /dev/null +++ b/sdk/src/models/deployment/deploymentJSON.ts @@ -0,0 +1,7 @@ +export type VerifyingKeys = [string, [string, string]]; + +export interface DeploymentJSON { + "edition" : number, + "program" : string, + "verifying_keys" : VerifyingKeys, +} \ No newline at end of file diff --git a/sdk/src/models/deployment/deploymentObject.ts b/sdk/src/models/deployment/deploymentObject.ts new file mode 100644 index 000000000..27c88238b --- /dev/null +++ b/sdk/src/models/deployment/deploymentObject.ts @@ -0,0 +1,7 @@ +import { FunctionObject } from "../functionObject"; + +export interface DeploymentObject { + "edition" : number, + "program" : string, + "functions" : FunctionObject[], +} \ No newline at end of file diff --git a/sdk/src/models/execution.ts b/sdk/src/models/execution.ts deleted file mode 100644 index adf87ff4c..000000000 --- a/sdk/src/models/execution.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Transition } from "./transition"; - -export type Execution = { - edition: number; - transitions?: (Transition)[]; -} diff --git a/sdk/src/models/execution/executionJSON.ts b/sdk/src/models/execution/executionJSON.ts new file mode 100644 index 000000000..027d56d18 --- /dev/null +++ b/sdk/src/models/execution/executionJSON.ts @@ -0,0 +1,13 @@ +import { TransitionJSON } from "../transition/transitionJSON"; + +export interface ExecutionJSON { + transitions: TransitionJSON[]; + proof: string; + global_state_root: string; +} + +export interface FeeExecutionJSON { + transition: TransitionJSON; + proof: string; + global_state_root: string; +} \ No newline at end of file diff --git a/sdk/src/models/execution/executionObject.ts b/sdk/src/models/execution/executionObject.ts new file mode 100644 index 000000000..043675a65 --- /dev/null +++ b/sdk/src/models/execution/executionObject.ts @@ -0,0 +1,13 @@ +import { TransitionObject } from "../transition/transitionObject"; + +export interface ExecutionObject { + transitions: TransitionObject[]; + proof: string; + global_state_root: string; +} + +export interface FeeExecutionObject { + transition: TransitionObject; + proof: string; + global_state_root: string; +} diff --git a/sdk/src/models/finalizeJSON.ts b/sdk/src/models/finalizeJSON.ts new file mode 100644 index 000000000..f81b78bea --- /dev/null +++ b/sdk/src/models/finalizeJSON.ts @@ -0,0 +1,6 @@ +export interface FinalizeJSON { + "type": string; + "mapping_id": string; + "key_id": string; + "value_id": string; +} diff --git a/sdk/src/models/functionObject.ts b/sdk/src/models/functionObject.ts new file mode 100644 index 000000000..cef5a2f1e --- /dev/null +++ b/sdk/src/models/functionObject.ts @@ -0,0 +1,9 @@ +import { VerifyingKey } from "../wasm"; + +export interface FunctionObject { + "name" : string, + "constraints" : number, + "variables" : number, + "verifyingKey" : string | VerifyingKey, + "certificate" : string, +} \ No newline at end of file diff --git a/sdk/src/models/input.ts b/sdk/src/models/input.ts deleted file mode 100644 index 77f12dacb..000000000 --- a/sdk/src/models/input.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type Input = { - type: string; - id: string; - tag?: string; - origin?: Origin; - value?: string; -} -export type Origin = { - commitment: string; -} diff --git a/sdk/src/models/input/inputJSON.ts b/sdk/src/models/input/inputJSON.ts new file mode 100644 index 000000000..fbe9cbf2f --- /dev/null +++ b/sdk/src/models/input/inputJSON.ts @@ -0,0 +1,9 @@ +/** + * Object representation of an Input as raw JSON returned from a SnarkOS node. + */ +export interface InputJSON { + type: string; + id: string; + tag?: string; + value?: string; +} \ No newline at end of file diff --git a/sdk/src/models/input/inputObject.ts b/sdk/src/models/input/inputObject.ts new file mode 100644 index 000000000..4dc3a2ce3 --- /dev/null +++ b/sdk/src/models/input/inputObject.ts @@ -0,0 +1,15 @@ +/** + * Aleo function Input represented as a typed typescript object. + */ +import { Ciphertext, Field, Plaintext } from "../../wasm"; +import { PlaintextObject } from "../plaintext/plaintext"; + +/** + * Object representation of an Input as raw JSON returned from a SnarkOS node. + */ +export interface InputObject { + type: "string", + id: "string" | Field, + tag?: string | Field, + value?: Ciphertext | Plaintext | PlaintextObject, +} \ No newline at end of file diff --git a/sdk/src/models/output.ts b/sdk/src/models/output/outputJSON.ts similarity index 50% rename from sdk/src/models/output.ts rename to sdk/src/models/output/outputJSON.ts index df7161984..3537f0484 100644 --- a/sdk/src/models/output.ts +++ b/sdk/src/models/output/outputJSON.ts @@ -1,6 +1,6 @@ -export type Output = { +export interface OutputJSON { type: string; id: string; - checksum: string; + checksum?: string; value: string; } diff --git a/sdk/src/models/output/outputObject.ts b/sdk/src/models/output/outputObject.ts new file mode 100644 index 000000000..6ff84cad6 --- /dev/null +++ b/sdk/src/models/output/outputObject.ts @@ -0,0 +1,18 @@ +/** + * Aleo function Input represented as a typed typescript object. + */ +import { Field, Ciphertext, Plaintext } from "../../wasm"; +import { PlaintextObject } from "../plaintext/plaintext"; + +/** + * Object representation of an Input as raw JSON returned from a SnarkOS node. + */ +export interface OutputObject { + type: string, + id: string | Field, + value?: Ciphertext | Plaintext | PlaintextObject, + checksum?: string | Field, + program?: string, + function?: string, + arguments?: Array | Array<OutputObject> +} \ No newline at end of file diff --git a/sdk/src/models/owner/ownerJSON.ts b/sdk/src/models/owner/ownerJSON.ts new file mode 100644 index 000000000..b167b6aee --- /dev/null +++ b/sdk/src/models/owner/ownerJSON.ts @@ -0,0 +1,4 @@ +export interface OwnerJSON { + address: string; + signature: string; +} \ No newline at end of file diff --git a/sdk/src/models/owner/ownerObject.ts b/sdk/src/models/owner/ownerObject.ts new file mode 100644 index 000000000..93c80f948 --- /dev/null +++ b/sdk/src/models/owner/ownerObject.ts @@ -0,0 +1,6 @@ +import { Address, Signature } from "../../wasm"; + +export interface OwnerObject { + address: string | Address; + signature: string | Signature; +} \ No newline at end of file diff --git a/sdk/src/models/plaintext/array.ts b/sdk/src/models/plaintext/array.ts new file mode 100644 index 000000000..00628103c --- /dev/null +++ b/sdk/src/models/plaintext/array.ts @@ -0,0 +1,4 @@ +import { PlaintextLiteral } from "./literal"; +import { PlaintextStruct } from "./struct"; + +export type PlaintextArray = PlaintextLiteral[] | PlaintextStruct[] | PlaintextArray[]; \ No newline at end of file diff --git a/sdk/src/models/plaintext/literal.ts b/sdk/src/models/plaintext/literal.ts new file mode 100644 index 000000000..d1ebd875f --- /dev/null +++ b/sdk/src/models/plaintext/literal.ts @@ -0,0 +1 @@ +export type PlaintextLiteral = boolean | bigint | number | string; \ No newline at end of file diff --git a/sdk/src/models/plaintext/plaintext.ts b/sdk/src/models/plaintext/plaintext.ts new file mode 100644 index 000000000..91a375696 --- /dev/null +++ b/sdk/src/models/plaintext/plaintext.ts @@ -0,0 +1,6 @@ +import { Plaintext } from "../../wasm"; +import { PlaintextArray } from "./array"; +import { PlaintextLiteral } from "./literal"; +import { PlaintextStruct } from "./struct"; + +export type PlaintextObject = PlaintextArray| PlaintextLiteral | PlaintextStruct | Plaintext; \ No newline at end of file diff --git a/sdk/src/models/plaintext/struct.ts b/sdk/src/models/plaintext/struct.ts new file mode 100644 index 000000000..91dad63f5 --- /dev/null +++ b/sdk/src/models/plaintext/struct.ts @@ -0,0 +1,6 @@ +import { PlaintextArray } from "./array"; +import { PlaintextLiteral } from "./literal"; + +export type PlaintextStruct = { + [key: string]: PlaintextArray | PlaintextLiteral | PlaintextStruct; +} \ No newline at end of file diff --git a/sdk/src/models/transaction/transactionJSON.ts b/sdk/src/models/transaction/transactionJSON.ts new file mode 100644 index 000000000..5271a39aa --- /dev/null +++ b/sdk/src/models/transaction/transactionJSON.ts @@ -0,0 +1,12 @@ +import { DeploymentJSON } from "../deployment/deploymentJSON"; +import { ExecutionJSON, FeeExecutionJSON } from "../execution/executionJSON"; +import { OwnerJSON } from "../owner/ownerJSON"; + +export interface TransactionJSON { + type: string; + id: string; + deployment?: DeploymentJSON; + execution?: ExecutionJSON; + fee: FeeExecutionJSON; + owner?: OwnerJSON; +} \ No newline at end of file diff --git a/sdk/src/models/transaction/transactionObject.ts b/sdk/src/models/transaction/transactionObject.ts new file mode 100644 index 000000000..e8aa0daf4 --- /dev/null +++ b/sdk/src/models/transaction/transactionObject.ts @@ -0,0 +1,15 @@ +import { DeploymentObject } from "../deployment/deploymentObject"; +import { ExecutionObject, FeeExecutionObject } from "../execution/executionObject"; +import { OwnerObject } from "../owner/ownerObject"; + +export interface TransactionObject { + type : string; + id : string; + execution?: ExecutionObject; + deployment? : DeploymentObject; + fee: FeeExecutionObject; + owner?: OwnerObject; + feeAmount? : bigint; + baseFee? : bigint; + priorityFee? : bigint; +} diff --git a/sdk/src/models/transactionModel.ts b/sdk/src/models/transactionModel.ts deleted file mode 100644 index 33135f67d..000000000 --- a/sdk/src/models/transactionModel.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Execution } from "./execution"; - -export type TransactionModel = { - type: string; - id: string; - execution: Execution; -} diff --git a/sdk/src/models/transition.ts b/sdk/src/models/transition.ts deleted file mode 100644 index 97ceda887..000000000 --- a/sdk/src/models/transition.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Input } from "./input"; -import { Output } from "./output"; - -export type Transition = { - id: string; - program: string; - function: string; - inputs?: (Input)[]; - outputs?: (Output)[]; - proof: string; - tpk: string; - tcm: string; - fee: number; -} diff --git a/sdk/src/models/transition/transitionJSON.ts b/sdk/src/models/transition/transitionJSON.ts new file mode 100644 index 000000000..eca98b00f --- /dev/null +++ b/sdk/src/models/transition/transitionJSON.ts @@ -0,0 +1,14 @@ +import { InputJSON } from "../input/inputJSON"; +import { OutputJSON } from "../output/outputJSON"; + +export interface TransitionJSON { + id: string; + program: string; + function: string; + inputs?: (InputJSON)[]; + outputs?: (OutputJSON)[]; + proof: string; + tpk: string; + tcm: string; + fee: bigint; +} \ No newline at end of file diff --git a/sdk/src/models/transition/transitionObject.ts b/sdk/src/models/transition/transitionObject.ts new file mode 100644 index 000000000..86799c066 --- /dev/null +++ b/sdk/src/models/transition/transitionObject.ts @@ -0,0 +1,16 @@ +import { InputObject } from "../input/inputObject"; +import { OutputObject } from "../output/outputObject"; +import { Field, Group } from "../../wasm"; + +export interface TransitionObject { + id: string; + program: string; + function: string; + inputs?: (InputObject)[]; + outputs?: (OutputObject)[]; + proof: string; + tpk: string | Group; + tcm: string | Field; + scm: string | Field; + fee: bigint; +} \ No newline at end of file diff --git a/sdk/src/network-client.ts b/sdk/src/network-client.ts index 39b6515e2..031fa3130 100644 --- a/sdk/src/network-client.ts +++ b/sdk/src/network-client.ts @@ -1,14 +1,16 @@ import { get, post, parseJSON, logAndThrow } from "./utils"; import { Account } from "./account"; -import { Block } from "./models/block"; -import { TransactionModel } from "./models/transactionModel"; +import { BlockJSON } from "./models/blockJSON"; +import { TransactionJSON } from "./models/transaction/transactionJSON"; import { + Plaintext, RecordCiphertext, Program, RecordPlaintext, PrivateKey, Transaction, } from "./wasm"; +import { ConfirmedTransactionJSON } from "./models/confirmed_transaction"; type ProgramImports = { [key: string]: string | Program }; @@ -79,24 +81,44 @@ class AleoNetworkClient { this.host = host + "/%%NETWORK%%"; } + /** + * Fetches data from the Aleo network and returns it as a JSON object. + * + * @param url + */ async fetchData<Type>( url = "/", ): Promise<Type> { + try { + return parseJSON(await this.fetchRaw(url)); + } catch (error) { + throw new Error("Error fetching data."); + } + } + + /** + * Fetches data from the Aleo network and returns it as an unparsed string. + * + * This method should be used when it is desired to reconstitute data returned + * from the network into a WASM object. + * + * @param url + */ + async fetchRaw( + url = "/", + ): Promise<string> { try { const response = await get(this.host + url, { headers: this.headers }); - - const text = await response.text(); - return parseJSON(text); - + return await response.text(); } catch (error) { throw new Error("Error fetching data."); } } /** - * Attempts to find unspent records in the Aleo blockchain for a specified private key + * Attempts to find unspent records in the Aleo blockchain for a specified private key. * @param {number} startHeight - The height at which to start searching for unspent records * @param {number} endHeight - The height at which to stop searching for unspent records * @param {string | PrivateKey} privateKey - The private key to use to find unspent records @@ -291,15 +313,15 @@ class AleoNetworkClient { } /** - * Returns the contents of the block at the specified block height + * Returns the contents of the block at the specified block height. * * @param {number} height * @example * const block = networkClient.getBlock(1234); */ - async getBlock(height: number): Promise<Block> { + async getBlock(height: number): Promise<BlockJSON> { try { - const block = await this.fetchData<Block>("/block/" + height); + const block = await this.fetchData<BlockJSON>("/block/" + height); return block; } catch (error) { throw new Error("Error fetching block."); @@ -307,16 +329,16 @@ class AleoNetworkClient { } /** - * Returns a range of blocks between the specified block heights + * Returns a range of blocks between the specified block heights. * * @param {number} start * @param {number} end * @example * const blockRange = networkClient.getBlockRange(2050, 2100); */ - async getBlockRange(start: number, end: number): Promise<Array<Block>> { + async getBlockRange(start: number, end: number): Promise<Array<BlockJSON>> { try { - return await this.fetchData<Array<Block>>("/blocks?start=" + start + "&end=" + end); + return await this.fetchData<Array<BlockJSON>>("/blocks?start=" + start + "&end=" + end); } catch (error) { const errorMessage = `Error fetching blocks between ${start} and ${end}.`; throw new Error(errorMessage); @@ -324,10 +346,10 @@ class AleoNetworkClient { } /** - * Returns the deployment transaction id associated with the specified program + * Returns the deployment transaction id associated with the specified program. * * @param {Program | string} program - * @returns {TransactionModel} + * @returns {TransactionJSON} */ async getDeploymentTransactionIDForProgram(program: Program | string): Promise<string> { if (program instanceof Program) { @@ -342,36 +364,51 @@ class AleoNetworkClient { } /** - * Returns the deployment transaction associated with a specified program + * Returns the deployment transaction associated with a specified program. + * + * @param {Program | string} program + * @returns {TransactionJSON} + */ + async getDeploymentTransactionForProgram(program: Program | string): Promise<TransactionJSON> { + try { + const transaction_id = <string>await this.getDeploymentTransactionIDForProgram(program); + return <TransactionJSON>await this.getTransaction(transaction_id); + } catch (error) { + throw new Error("Error fetching deployment transaction for program."); + } + } + + /** + * Returns the deployment transaction associated with a specified program as a wasm object. * * @param {Program | string} program - * @returns {TransactionModel} + * @returns {TransactionJSON} */ - async getDeploymentTransactionForProgram(program: Program | string): Promise<TransactionModel> { + async getDeploymentTransactioObjectnForProgram(program: Program | string): Promise<Transaction> { try { const transaction_id = <string>await this.getDeploymentTransactionIDForProgram(program); - return <TransactionModel>await this.getTransaction(transaction_id); + return await this.getTransactionObject(transaction_id); } catch (error) { throw new Error("Error fetching deployment transaction for program."); } } /** - * Returns the contents of the latest block + * Returns the contents of the latest block. * * @example * const latestHeight = networkClient.getLatestBlock(); */ - async getLatestBlock(): Promise<Block> { + async getLatestBlock(): Promise<BlockJSON> { try { - return await this.fetchData<Block>("/block/latest") as Block; + return await this.fetchData<BlockJSON>("/block/latest") as BlockJSON; } catch (error) { throw new Error("Error fetching latest block."); } } /** - * Returns the latest committee + * Returns the latest committee. * * @returns {Promise<object>} A javascript object containing the latest committee */ @@ -384,7 +421,7 @@ class AleoNetworkClient { } /** - * Returns the latest block height + * Returns the latest block height. * * @example * const latestHeight = networkClient.getLatestHeight(); @@ -398,7 +435,7 @@ class AleoNetworkClient { } /** - * Returns the source code of a program given a program ID + * Returns the source code of a program given a program ID. * * @param {string} programId The program ID of a program deployed to the Aleo Network * @return {Promise<string>} Source code of the program @@ -417,7 +454,7 @@ class AleoNetworkClient { } /** - * Returns a program object from a program ID or program source code + * Returns a program object from a program ID or program source code. * * @param {string} inputProgram The program ID or program source code of a program deployed to the Aleo Network * @return {Promise<Program>} Source code of the program @@ -501,7 +538,7 @@ class AleoNetworkClient { } /** - * Get a list of the program names that a program imports + * Get a list of the program names that a program imports. * * @param {Program | string} inputProgram - The program id or program source code to get the imports of * @returns {string[]} - The list of program names that the program imports @@ -521,7 +558,7 @@ class AleoNetworkClient { } /** - * Returns the names of the mappings of a program + * Returns the names of the mappings of a program. * * @param {string} programId - The program ID to get the mappings of (e.g. "credits.aleo") * @example @@ -538,11 +575,11 @@ class AleoNetworkClient { } /** - * Returns the value of a program's mapping for a specific key + * Returns the value of a program's mapping for a specific key. * * @param {string} programId - The program ID to get the mapping value of (e.g. "credits.aleo") * @param {string} mappingName - The name of the mapping to get the value of (e.g. "account") - * @param {string} key - The key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px") + * @param {string | Plaintext} key - The key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px") * @return {Promise<string>} String representation of the value of the mapping * * @example @@ -551,16 +588,60 @@ class AleoNetworkClient { * const expectedValue = "0u64"; * assert.equal(mappingValue, expectedValue); */ - async getProgramMappingValue(programId: string, mappingName: string, key: string): Promise<string> { + async getProgramMappingValue(programId: string, mappingName: string, key: string | Plaintext): Promise<string> { try { - return await this.fetchData<string>("/program/" + programId + "/mapping/" + mappingName + "/" + key) + const keyString = key instanceof Plaintext ? key.toString() : key; + return await this.fetchData<string>("/program/" + programId + "/mapping/" + mappingName + "/" + keyString) } catch (error) { throw new Error("Error fetching mapping value - ensure the mapping exists and the key is correct"); } } + /** - * Returns the latest state/merkle root of the Aleo blockchain + * Returns the value of a mapping as a wasm Plaintext object. Returning an + * object in this format allows it to be converted to a Js type and for its + * internal members to be inspected if it's a struct or array. + * + * @example + * // Get the bond state as an account. + * const unbondedState = networkClient.getMappingPlaintext("credits.aleo", "bonded", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px"); + * + * // Get the two members of the object individually. + * const validator = unbondedState.getMember("validator"); + * const microcredits = unbondedState.getMember("microcredits"); + * + * // Ensure the expected values are correct. + * assert.equal(validator, "aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd"); + * assert.equal(microcredits, BigInt("9007199254740991")); + * + * // Get a JS object representation of the unbonded state. + * const unbondedStateObject = unbondedState.toObject(); + * + * const expectedState = { + * validator: "aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd", + * microcredits: BigInt("9007199254740991") + * }; + * assert.equal(unbondedState, expectedState); + * + * @param {string} programId - The program ID to get the mapping value of (e.g. "credits.aleo") + * @param {string} mappingName - The name of the mapping to get the value of (e.g. "account") + * @param {string | Plaintext} key - The key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px") + * + * @return {Promise<string>} String representation of the value of the mapping + */ + async getProgramMappingPlaintext(programId: string, mappingName: string, key: string | Plaintext): Promise<Plaintext> { + try { + const keyString = key instanceof Plaintext ? key.toString() : key; + const value = await this.fetchRaw("/program/" + programId + "/mapping/" + mappingName + "/" + keyString); + return Plaintext.fromString(JSON.parse(value)); + } catch (error) { + throw new Error("Failed to fetch mapping value." + error); + } + } + + /** + * Returns the latest state/merkle root of the Aleo blockchain. * * @example * const stateRoot = networkClient.getStateRoot(); @@ -574,44 +655,79 @@ class AleoNetworkClient { } /** - * Returns a transaction by its unique identifier + * Returns a transaction by its unique identifier. * * @param {string} id * @example * const transaction = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj"); */ - async getTransaction(id: string): Promise<TransactionModel> { + async getTransaction(transactionId: string): Promise<TransactionJSON> { try { - return await this.fetchData<TransactionModel>("/transaction/" + id); + return await this.fetchData<TransactionJSON>("/transaction/" + transactionId); } catch (error) { throw new Error("Error fetching transaction."); } } /** - * Returns the transactions present at the specified block height + * Returns a transaction as a wasm object. Getting a transaction of this type will allow the ability for the inputs, + * outputs, and records to be searched for and displayed. + * + * @example + * const transactionObject = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj"); + * // Get the transaction inputs as a JS array. + * const transactionOutputs = transactionObject.inputs(true); + * + * // Get the transaction outputs as a JS object. + * const transactionInputs = transactionObject.outputs(true); + * + * // Get any records generated in transitions in the transaction as a JS object. + * const records = transactionObject.records(); + * + * // Get the transaction type. + * const transactionType = transactionObject.transactionType(); + * assert.equal(transactionType, "Execute"); + * + * // Get a JS representation of all inputs, outputs, and transaction metadata. + * const transactionSummary = transactionObject.summary(); + * + * @param {string} transactionId + * @example + * const transaction = networkClient.getTransactionObject("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj"); + */ + async getTransactionObject(transactionId: string): Promise<Transaction> { + try { + const transaction = await this.fetchRaw("/transaction/" + transactionId); + return Transaction.fromString(transaction); + } catch (error) { + throw new Error("Error fetching transaction."); + } + } + + /** + * Returns the transactions present at the specified block height. * * @param {number} height * @example * const transactions = networkClient.getTransactions(654); */ - async getTransactions(height: number): Promise<Array<TransactionModel>> { + async getTransactions(height: number): Promise<Array<ConfirmedTransactionJSON>> { try { - return await this.fetchData<Array<TransactionModel>>("/block/" + height.toString() + "/transactions"); + return await this.fetchData<Array<ConfirmedTransactionJSON>>("/block/" + height.toString() + "/transactions"); } catch (error) { - throw new Error("Error fetching transactions."); + throw new Error("Error fetching transactions. " + error); } } /** - * Returns the transactions in the memory pool. + * Returns the transactions in the memory pool. This method requires access to a validator's REST API. * * @example * const transactions = networkClient.getTransactionsInMempool(); */ - async getTransactionsInMempool(): Promise<Array<TransactionModel>> { + async getTransactionsInMempool(): Promise<Array<TransactionJSON>> { try { - return await this.fetchData<Array<TransactionModel>>("/memoryPool/transactions"); + return await this.fetchData<Array<TransactionJSON>>("/memoryPool/transactions"); } catch (error) { throw new Error("Error fetching transactions from mempool."); } @@ -633,7 +749,7 @@ class AleoNetworkClient { } /** - * Submit an execute or deployment transaction to the Aleo network + * Submit an execute or deployment transaction to the Aleo network. * * @param {Transaction | string} transaction - The transaction to submit to the network * @returns {string} - The transaction id of the submitted transaction or the resulting error @@ -659,6 +775,32 @@ class AleoNetworkClient { throw new Error(`Error posting transaction: No response received: ${error.message}`); } } + + /** + * Submit a solution to the Aleo network. + * + * @param {string} solution The string representation of the solution desired to be submitted to the network. + */ + async submitSolution(solution: string): Promise<string> { + try { + const response = await post(this.host + "/solution/broadcast", { + body: solution, + headers: Object.assign({}, this.headers, { + "Content-Type": "application/json", + }), + }); + + try { + const text = await response.text(); + return parseJSON(text); + + } catch (error: any) { + throw new Error(`Error posting transaction. Aleo network response: ${error.message}`); + } + } catch (error: any) { + throw new Error(`Error posting transaction: No response received: ${error.message}`); + } + } } export { AleoNetworkClient, AleoNetworkClientOptions, ProgramImports } diff --git a/sdk/src/polyfill/worker.ts b/sdk/src/polyfill/worker.ts index 8f979db29..7e05d61a9 100644 --- a/sdk/src/polyfill/worker.ts +++ b/sdk/src/polyfill/worker.ts @@ -32,10 +32,11 @@ globalThis.Worker = class Worker extends EventTarget { } const code = ` - const { workerData } = require("node:worker_threads"); - - import(workerData.polyfill) - .then(() => import(workerData.url)) + import("node:worker_threads") + .then(({ workerData }) => { + return import(workerData.polyfill) + .then(() => import(workerData.url)) + }) .catch((e) => { // TODO maybe it should send a message to the parent? console.error(e.stack); diff --git a/sdk/src/utils.ts b/sdk/src/utils.ts index d92420a45..f2f6740db 100644 --- a/sdk/src/utils.ts +++ b/sdk/src/utils.ts @@ -8,7 +8,6 @@ export function parseJSON(json: string): any { function revive(key: string, value: any, context: any) { if (Number.isInteger(value)) { return BigInt(context.source); - } else { return value; } diff --git a/sdk/src/wasm.ts b/sdk/src/wasm.ts index 8258e8a6f..1ba048720 100644 --- a/sdk/src/wasm.ts +++ b/sdk/src/wasm.ts @@ -1,10 +1,13 @@ export { Address, + Ciphertext, Execution, ExecutionResponse, Field, + Group, OfflineQuery, Metadata, + Plaintext, PrivateKey, PrivateKeyCiphertext, Program, @@ -12,8 +15,10 @@ export { ProvingKey, RecordCiphertext, RecordPlaintext, + Scalar, Signature, Transaction, + Transition, VerifyingKey, ViewKey, initThreadPool, diff --git a/sdk/tests/arithmetic.test.ts b/sdk/tests/arithmetic.test.ts new file mode 100644 index 000000000..34ccc1b3e --- /dev/null +++ b/sdk/tests/arithmetic.test.ts @@ -0,0 +1,104 @@ +import sinon from "sinon"; +import { expect } from "chai"; +import { Field, Scalar, Group} from "../src/node"; + +describe('Field and Group Arithmetic Tests', () => { + afterEach(() => { + sinon.restore(); + }); + + describe('Field and Group arithmetic', () => { + it('Check field arithmetic functions work as expected', () => { + // Create the 2 field element. + const a = Field.fromString("2field"); + // Create the inverse of the 2 field element. + const ainv = a.inverse(); + // Create another 2 scale element. + const b = Field.fromString("2field"); + // Double the field through addition. + const c = a.add(b); + // Double the field through the double operation. + const d = a.double(); + // Create the 8 field from string. + const eight = Field.fromString("8field"); + // Create the 0 field. + const zero = Field.zero(); + // Create the 0 field through adding a and ainv. + const zero_inv = a.add(ainv); + // Create the zero element through subtraction (same operation as a + ainv). + const zero_sub = a.subtract(b); + // Take the 2 element to the power 4. + const two_power_four = a.pow(c); + // Multiply the two element by the 8 element. + const two_times_eight = a.multiply(eight); + // Ensure two elements of the same value are equal. + expect(a.equals(b)).equal(true); + // Ensure adding 2 same valued elements and the doubling operation lead to the same value. + expect(c.equals(d)).equal(true); + // Ensure that a + ainv i zero. + expect(zero_inv.equals(zero)).equal(true); + // Ensure that 2 - 2 (i.e. 2 + inv(2)) == 0. + expect(zero_sub.equals(zero)).equal(true); + // Ensure 2^4 & 2*8 are equal. + expect(two_power_four.equals(two_times_eight)).equal(true); + }); + + it('Check scalar field arithmetic', () => { + // Create the 2 scalar element. + const a = Scalar.fromString("2scalar"); + // Create the inverse of the 2 scalar element. + const ainv = a.inverse(); + // Create another 2 scale element. + const b = Scalar.fromString("2scalar"); + // Double the scalar through addition. + const c = a.add(b); + // Double the scalar through the double operation. + const d = a.double(); + // Create the 8 scalar from string. + const eight = Scalar.fromString("8scalar"); + // Create the 0 scalar. + const zero = Scalar.zero(); + // Create the 0 scalar through adding a and ainv. + const zero_inv = a.add(ainv); + // Create the zero element through subtraction (same operation as a + ainv). + const zero_sub = a.subtract(b); + // Take the 2 element to the power 4. + const two_power_four = a.pow(c); + // Multiply the two element by the 8 element. + const two_times_eight = a.multiply(eight); + // Ensure two elements of the same value are equal. + expect(a.equals(b)).equal(true); + // Ensure adding 2 same valued elements and the doubling operation lead to the same value. + expect(c.equals(d)).equal(true); + // Ensure that a + ainv i zero. + expect(zero_inv.equals(zero)).equal(true); + // Ensure that 2 - 2 (i.e. 2 + inv(2)) == 0. + expect(zero_sub.equals(zero)).equal(true); + // Ensure 2^4 & 2*8 are equal. + expect(two_power_four.equals(two_times_eight)).equal(true); + }); + + it('Test group operations', () => { + // Get the 2 element of the group. + const G = Group.fromString("2group"); + // Get the point at infinity (i.e. "0"/additive identity in elliptic curves). + const Ginf = Group.zero(); + // Get a 2 element of the scalar field. + const a = Scalar.fromString("2scalar"); + // Double the point through addition. + const b = G.add(G); + // Double the point through the addition operation. + const c = G.double(); + // Do a point doubling through scalar multiplication. + const d = G.scalarMultiply(a); + // Find point (x, -y) + const G_inv= G.inverse(); + // Ensure addition and doubling landed on the same point. + expect(b.equals(c)).equals(true); + // Ensure point doubling and scalar multiplication by 2scalar ends up as the same element as doubling. + expect(c.equals(d)).equals(true); + // Ensure adding the inverse element leads to the point at infinity. + expect((G.add(G_inv)).equals(Ginf)).equals(true); + }); + }); +}); diff --git a/sdk/tests/key-provider.test.ts b/sdk/tests/key-provider.test.ts index d3bc18c8f..50562abd5 100644 --- a/sdk/tests/key-provider.test.ts +++ b/sdk/tests/key-provider.test.ts @@ -20,7 +20,6 @@ describe('KeyProvider', () => { expect(e).instanceof(Error); } }); - it('Should use cache when set and not use it when not', async () => { // Ensure the cache properly downloads and stores keys keyProvider.useCache(true); diff --git a/sdk/tests/network-client.test.ts b/sdk/tests/network-client.test.ts index 3c4535dce..a74ef7d4a 100644 --- a/sdk/tests/network-client.test.ts +++ b/sdk/tests/network-client.test.ts @@ -1,9 +1,16 @@ import sinon from "sinon"; import { expect } from "chai"; -import {Account, Block, AleoNetworkClient, TransactionModel} from "../src/node"; -import {beaconAddressString, beaconPrivateKeyString} from "./data/account-data"; -import {log} from "console"; - +import { + Account, + BlockJSON, + AleoNetworkClient, + TransactionObject, + InputObject, + OutputObject, + ExecutionObject +} from "../src/node"; +import { beaconPrivateKeyString } from "./data/account-data"; +import { DeploymentObject, ExecutionJSON, InputJSON, OutputJSON, Plaintext, PlaintextObject, Transition, TransitionObject } from "../src/node"; async function catchError(f: () => Promise<any>): Promise<Error | null> { try { @@ -16,12 +23,15 @@ async function catchError(f: () => Promise<any>): Promise<Error | null> { } -async function expectThrows(f: () => Promise<any>, message: string): Promise<void> { +async function expectThrowsMessage(f: () => Promise<any>, message: string): Promise<void> { const error = await catchError(f); expect(error).not.equal(null); expect(error!.message).equal(message); } - +async function expectThrows(f: () => Promise<any>): Promise<void> { + const error = await catchError(f); + expect(error).not.equal(null); +} describe('NodeConnection', () => { let connection: AleoNetworkClient; @@ -48,11 +58,11 @@ describe('NodeConnection', () => { describe('getBlock', () => { it.skip('should return a Block object', async () => { const block = await connection.getBlock(1); - expect((block as Block).block_hash).equal("ab1eddc3np4h6duwf5a7ht6u0x5maa08780l885j6xq0s7l88df0qrq3d72me"); + expect((block as BlockJSON).block_hash).equal("ab1eddc3np4h6duwf5a7ht6u0x5maa08780l885j6xq0s7l88df0qrq3d72me"); }); it('should throw an error if the request fails', async () => { - await expectThrows( + await expectThrowsMessage( () => connection.getBlock(99999999), "Error fetching block.", ); @@ -63,13 +73,13 @@ describe('NodeConnection', () => { it.skip('should return an array of Block objects', async () => { const blockRange = await connection.getBlockRange(1, 3); expect(Array.isArray(blockRange)).equal(true); - expect((blockRange as Block[]).length).equal(3); - expect(((blockRange as Block[])[0] as Block).block_hash).equal("ab1eddc3np4h6duwf5a7ht6u0x5maa08780l885j6xq0s7l88df0qrq3d72me"); - expect(((blockRange as Block[])[1] as Block).block_hash).equal("ab1uqmm97qk5gzhgwh6308h48aszazhfnn0xdq84lrj7e7myyrf9yyqmqdf42"); + expect((blockRange as BlockJSON[]).length).equal(3); + expect(((blockRange as BlockJSON[])[0] as BlockJSON).block_hash).equal("ab1eddc3np4h6duwf5a7ht6u0x5maa08780l885j6xq0s7l88df0qrq3d72me"); + expect(((blockRange as BlockJSON[])[1] as BlockJSON).block_hash).equal("ab1uqmm97qk5gzhgwh6308h48aszazhfnn0xdq84lrj7e7myyrf9yyqmqdf42"); }); it('should throw an error if the request fails', async () => { - await expectThrows( + await expectThrowsMessage( () => connection.getBlockRange(999999999, 1000000000), "Error fetching blocks between 999999999 and 1000000000.", ); @@ -85,7 +95,7 @@ describe('NodeConnection', () => { it('should throw an error if the request fails', async () => { const program_id = "a" + (Math.random()).toString(32).substring(2) + ".aleo"; - await expectThrows( + await expectThrowsMessage( () => connection.getProgram(program_id), "Error fetching program", ); @@ -95,7 +105,7 @@ describe('NodeConnection', () => { describe('getLatestBlock', () => { it('should return a Block object', async () => { const latestBlock = await connection.getLatestBlock(); - expect(typeof (latestBlock as Block).block_hash).equal('string'); + expect(typeof (latestBlock as BlockJSON).block_hash).equal('string'); }); it('should set the X-Aleo-SDK-Version header', async () => { @@ -143,7 +153,6 @@ describe('NodeConnection', () => { it('should throw an error if the request fails', async () => { await expectThrows( () => connection.getTransactions(999999999), - "Error fetching transactions.", ); }); }); @@ -187,22 +196,22 @@ describe('NodeConnection', () => { describe('findUnspentRecords', () => { it('should fail if block heights or private keys are incorrectly specified', async () => { - await expectThrows( + await expectThrowsMessage( () => connection.findUnspentRecords(5, 0, beaconPrivateKeyString, undefined, undefined, []), "Start height must be less than or equal to end height.", ); - await expectThrows( + await expectThrowsMessage( () => connection.findUnspentRecords(-5, 5, beaconPrivateKeyString, undefined, undefined, []), "Start height must be greater than or equal to 0", ); - await expectThrows( + await expectThrowsMessage( () => connection.findUnspentRecords(0, 5, "definitelynotaprivatekey", undefined, undefined, []), "Error parsing private key provided.", ); - await expectThrows( + await expectThrowsMessage( () => connection.findUnspentRecords(0, 5, undefined, undefined, undefined, []), "Private key must be specified in an argument to findOwnedRecords or set in the AleoNetworkClient", ); @@ -225,4 +234,167 @@ describe('NodeConnection', () => { } }); }); + + describe('Test API methods that return wasm objects', () => { + it('Plaintext returned from the API should have expected properties', async () => { + const transactions = await connection.getTransactions(27400); + if (transactions.length > 0) { + // Check a struct variant of a plaintext object. + let plaintext = await connection.getProgramMappingPlaintext("credits.aleo", "committee", "aleo17m3l8a4hmf3wypzkf5lsausfdwq9etzyujd0vmqh35ledn2sgvqqzqkqal"); + expect(plaintext.plaintextType()).equal("struct"); + + // Ensure the JS object representation matches the wasm representation. + const isOpen = <Plaintext>plaintext.find("is_open").toObject(); + const commission = <Plaintext>plaintext.find("commission").toObject(); + const plaintextObject = plaintext.toObject(); + expect(plaintextObject.is_open).equal(isOpen); + expect(plaintextObject.commission).equal(commission); + + // Check a literal variant of a plaintext object. + plaintext = await connection.getProgramMappingPlaintext("credits.aleo", "account", "aleo17m3l8a4hmf3wypzkf5lsausfdwq9etzyujd0vmqh35ledn2sgvqqzqkqal"); + expect(plaintext.plaintextType()).equal("u64"); + expect(plaintext.toObject()).a("bigint"); + } + }); + + it('should have correct data within the wasm object and summary object for an execution transaction', async () => { + // Get the first transaction at block 24700 on testnet. + const transactions = await connection.getTransactions(27400); + if (transactions.length > 0) { + const transaction = await connection.getTransactionObject("at1fjy6s9md2v4rgcn3j3q4qndtfaa2zvg58a4uha0rujvrn4cumu9qfazxdd"); + const transition = <Transition>transaction.transitions()[0]; + const summary = <TransactionObject>transaction.summary(true); + + // Ensure the transaction metadata was correctly computed. + expect(transaction.id()).equal("at1fjy6s9md2v4rgcn3j3q4qndtfaa2zvg58a4uha0rujvrn4cumu9qfazxdd"); + expect(transaction.isExecute()).equal(true); + expect(transaction.isFee()).equals(false); + expect(transaction.isDeploy()).equals(false); + expect(transaction.records().length).equals( 1); + + // Check the transition object contains the correct transition metadata + expect(transition.programId()).equals("puzzle_arcade_coin_v001.aleo") + expect(transition.functionName()).equals("mint"); + expect(transition.inputs(true).length).equals(2); + expect(transition.outputs(true).length).equals(1); + expect(transition.tpk().toString()).equals("6666707959509237020554863505720154589525217196021270704042929032892063700604group"); + expect(transition.tcm().toString()).equals("5140704971235445395514301730284508935687584564904251867869912904008739082032field"); + expect(transition.scm().toString()).equals("4048085747685910464005835076598544744404883618916202014212851266936759881218field"); + + // Ensure the object summary returns the correct transaction metadata. + const execution = <ExecutionObject>summary.execution; + expect(summary.type).equals(transaction.transactionType()); + expect(summary.feeAmount).equals(transaction.feeAmount()); + expect(execution.transitions.length).equals(2); + expect(<string>execution.transitions[0].tpk).equals("6666707959509237020554863505720154589525217196021270704042929032892063700604group"); + expect(<string>execution.transitions[0].tcm).equals("5140704971235445395514301730284508935687584564904251867869912904008739082032field"); + expect(<string>execution.transitions[0].scm).equals("4048085747685910464005835076598544744404883618916202014212851266936759881218field"); + expect(execution.transitions[0].function).equals("mint"); + expect(summary.id).equals(transaction.id()); + expect(summary.feeAmount).equals(transaction.feeAmount()); + expect(summary.baseFee).equals(transaction.baseFeeAmount()); + expect(summary.priorityFee).equals(transaction.priorityFeeAmount()); + + // Check inputs. + const transition_summary = <TransitionObject>execution.transitions[0]; + const transition_inputs = <InputObject[]>transition_summary.inputs; + const transition_outputs = <OutputObject[]>transition_summary.outputs; + // Ensure the transition_summary matches the wasm object. + expect(transition_summary.tpk).equals(transition.tpk().toString()); + expect(transition_summary.tcm).equals(transition.tcm().toString()); + expect(transition_summary.scm).equals(transition.scm().toString()); + expect(transition_summary.function).equals(transition.functionName()); + expect(transition_summary.id).equals(transition.id()); + expect(transition_summary.program).equals(transition.programId()); + expect(transition_inputs.length).equals(transition.inputs(true).length); + expect(transition_outputs.length).equals(transition.outputs(true).length); + + // // Check the summary's inputs and outputs match expected values. + const transition_input_1 = <InputObject>transition_inputs[0]; + const transition_input_2 = <InputObject>transition_inputs[1]; + const transition_output_1 = <OutputObject>transition_outputs[0]; + expect(transition_input_1.type).equals("public"); + expect(transition_input_2.type).equals("public"); + expect(<string>transition_input_1.value).equals("aleo1mltea0uj6865k5qvvf4er424wg8kqgh4ldlkgav7qzrzrw3mmvgq5rj3s8"); + expect(transition_output_1.type).equals("record"); + expect(<string>transition_output_1.id).equals("5572694414900952602617575422938223520445524449912062453787036904987112234218field"); + expect(<string>transition_output_1.checksum).equals("976841447793933847827686780055501802433867163411662643088590532874495495156field"); + expect(<string>transition_output_1.value).equals("record1qyqsqkh52naqk7l62m9rw3emwm0swuttcs7qs6lqqeu2czc34mv7h2c8qyrxzmt0w4h8ggcqqgqsq5de236vn6h0z3cvecduyzmqmaw0ue8wk4a9a5z89r7qxv53cwgg4xqpmzq9tv35fzyt6xfem9f74qcx9qsj90e6gzajfetc874q6g9snrzkgw"); + } + }); + + it('should have correct data within the wasm object and summary object for a deployment transaction', async () => { + // Get the deployment transaction for token_registry.aleo + const transactions = await connection.getTransactions(27400); + if (transactions.length === 0) { + const transaction = await connection.getTransactionObject("at15mwg0jyhvpjjrfxwrlwzn8puusnmy7r3xzvpjht4e5gzgnp68q9qd0qqec"); + const summary = <TransactionObject>transaction.summary(true); + const deployment = <DeploymentObject>summary.deployment; + + // Ensure the transaction metadata was correctly computed. + expect(transaction.id()).equal("at15mwg0jyhvpjjrfxwrlwzn8puusnmy7r3xzvpjht4e5gzgnp68q9qd0qqec"); + expect(transaction.isExecute()).equal(false); + expect(transaction.isFee()).equals(false); + expect(transaction.isDeploy()).equals(true); + expect(transaction.records().length).equals( 0); + + // Ensure the object summary returns the correct general transaction metadata. + expect(summary.type).equals(transaction.transactionType()); + expect(summary.feeAmount).equals(transaction.feeAmount()); + expect(summary.execution).equals(undefined); + expect(summary.id).equals(transaction.id()); + expect(summary.feeAmount).equals(transaction.feeAmount()); + expect(summary.baseFee).equals(transaction.baseFeeAmount()); + expect(summary.priorityFee).equals(transaction.priorityFeeAmount()); + expect(deployment.program).equals("token_registry.aleo"); + expect(deployment.functions.length).equals(22); + } + }); + + it('Should give the correct JSON response when requesting multiple transactions', async () => { + const transactions = await connection.getTransactions(27400); + if (transactions.length > 0) { + expect(transactions.length).equal(4); + expect(transactions[0].status).equal("accepted"); + expect(transactions[0].type).equal("execute"); + expect(transactions[0].index).equal(BigInt(0)); + expect(transactions[0].finalize.length).equal(1); + expect(transactions[0].transaction.id).equal("at1fjy6s9md2v4rgcn3j3q4qndtfaa2zvg58a4uha0rujvrn4cumu9qfazxdd"); + expect(transactions[0].transaction.type).equal("execute"); + + const execution = <ExecutionJSON>transactions[0].transaction.execution; + expect(execution.transitions.length).equal(1); + expect(execution.transitions[0].id).equal("au1j529auupdhlc2jcl802fm2uf3khcwm7xt7wxkrl2jv3pvj7zhu8qvna5pp"); + expect(execution.transitions[0].program).equal("puzzle_arcade_coin_v001.aleo"); + expect(execution.transitions[0].function).equal("mint"); + expect((<InputJSON[]>execution.transitions[0].inputs).length).equal(2); + + // Get outputs and ensure they have the correct values. + const outputs = <OutputJSON[]>execution.transitions[0].outputs + expect(outputs.length).equal(1); + expect(outputs[0].type).equal("record"); + expect(outputs[0].id).equal("5572694414900952602617575422938223520445524449912062453787036904987112234218field"); + expect(outputs[0].value).equal("record1qyqsqkh52naqk7l62m9rw3emwm0swuttcs7qs6lqqeu2czc34mv7h2c8qyrxzmt0w4h8ggcqqgqsq5de236vn6h0z3cvecduyzmqmaw0ue8wk4a9a5z89r7qxv53cwgg4xqpmzq9tv35fzyt6xfem9f74qcx9qsj90e6gzajfetc874q6g9snrzkgw"); + expect(<string>outputs[0].checksum).equal("976841447793933847827686780055501802433867163411662643088590532874495495156field"); + expect(transactions[0].transaction.fee.proof).equal("proof1qyqsqqqqqqqqqqqpqqqqqqqqqqqys4nj07zk5yc2xrzccul4ghsyjd3zh86wpxk2jy7r4fludh27jsjaf4saz40sss0e22ge74xgz5spqxqpe56uw3c6c27p80glmxwegkkkdpxfnd6yww2pwsrtwtl8c0a80dyd7jfw66retckp7uk93qcx5qt7h2xql37xx4umft9aqrlls2xgtuxvvap3j6d7l4gkdwy3dtn5xg32zr7ywndpl3dle54fdnku0kq3c6f0f4lqmrd3dmmdg6tu7cqmx4h3d9lc56duws2y3628fpfw2v4877pf2v4exvlx4h5mrl5zaeqq6rht59wewjnuzsvhwkjrrxl6ur9mr4mxluahrg3zug7vrmg43p6x4fsrgztun49a5qrtmelv64fgpdeyk4m2dp0y3zwet4wmj2cx4euausakj2k4paeql74xn7yv63m5evt9uymx3ygav8ysj58hd3q0sp8a79cvd83s0rmq2gy443mpe2tfdamxzufpz9jts4fhe9sf7mk82fc602wv279mughzztu3t93k3q8glzqaj3ltjx4cnvr3a99ukngxunvzgw6wd77msg396vffn8gtlhe5fepzkum3q9xvqpd4hqymr7qyx0q7vup99443kyvrh0v962gc26p47zghgsh9hfmah46vd9jej9drvwn25sm8mrysew7zwr5r24yqup2jlh9k0pdtswus7mw0gnlzsphpqc4n6ck23932ekrt438ntuxenzzjk8y2qh006ddvztzky6stq8ylyzh2ezcn75pnzsql8aq6ky2kawwllsqay4eymmth2k22nlk2g7l2gyzkgg7vw5gsnavdfp5vq09dzwm30uq7348qwd3eqna6j7zyygexdwgdtrt5pf3ankyl360s2mxmrxsu2zy9ghw99dk7vv7dh9hcfrsy8j8ezygjc72dtzra4vqgpmq7ufpkhurw7mhl70eg674zxfehhaugfn44h70efq3azy00nuqh8ncztrkzq0zut90r4aeyd9f43qw33309zf62selcyq22f7u4cywxgjxac6vs8nmfrcdtthys7jghcct8v3zal00nx3vyjn0qa7lzpjphg653779sqzhhrwjy588mjp9dpvzvpslsd594as2zgumz9l0qy673u6sp4ukfyln6jjdyz5n03xcn7ntdl69uqwdpajg8l4d782sxqvqqqqqqqqqqpwj6l0njz3pyaa6d4k7jf3shynxuamh48qlg02vsl9cdd9cqh050mndm6a77ldye0jtyu882yj4zsqqvfkqadh2gvhlwqmrlfvn79wn0uh006uyes4cptqytgm6w9ufefqzdpz0vr85nl34cjvs849p6efvqqxvrklggzu92te588dtal4n8pr9q2fnl2e46v83z0flcyt398xspzcl4920jaj54umh60ndhh6rqhqudna94uftlhfxk0652lruhxpw2xcncjm5lywt4tzu8et0kg9rwqyqqruc9kg"); + expect(transactions[0].transaction.fee.global_state_root).equal("sr13gjf6m2h2evlyvqdmrg0k69wlnpzruasxeekytx3gj7xf5ht6sxs27ldvh"); + expect(transactions[0].transaction.fee.transition.function).equal("fee_public"); + expect(transactions[0].transaction.fee.transition.program).equal("credits.aleo"); + + // Check the fee inputs. + const feeInputs = <InputJSON[]>transactions[0].transaction.fee.transition.inputs; + expect(feeInputs.length).equal(3); + expect(feeInputs[0].type).equal("public"); + // expect(feeInputs[0].value).equal("1449u64"); + expect(feeInputs[0].id).equal("4386982425102730230159169800986934827054209772356695389341764668009606015212field"); + + // Check the fee outputs. + const feeOutputs = <OutputJSON[]>transactions[0].transaction.fee.transition.outputs; + expect(feeOutputs.length).equal(1); + expect(feeOutputs[0].type).equal("future"); + expect(feeOutputs[0].id).equal("5266202420911953477603237216561767366202408116662663021354607932182034937240field"); + expect(feeOutputs[0].value).equal("{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo193cgzzpr5lcwq6rmzq4l2ctg5f4mznead080mclfgrc0e5k0w5pstfdfps,\n 1449u64\n ]\n}"); + } + }); + }) }); diff --git a/sdk/tests/program-manager.test.ts b/sdk/tests/program-manager.test.ts index 429ad5d7f..f7033ab7d 100644 --- a/sdk/tests/program-manager.test.ts +++ b/sdk/tests/program-manager.test.ts @@ -23,7 +23,7 @@ describe('Program Manager', () => { describe('Offline query', () => { it.skip('The offline query should work as expected', async () => { - const offlineQuery = new OfflineQuery(stateRoot); + const offlineQuery = new OfflineQuery(1, stateRoot); const record_plaintext = RecordPlaintext.fromString(statePathRecord); const commitment = record_plaintext.commitment("credits.aleo", "credits").toString(); offlineQuery.addStatePath(commitment, recordStatePath); diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index a38dea04d..d5ea9531b 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -94,7 +94,7 @@ checksum = "7e4f181fc1a372e8ceff89612e5c9b13f72bff5b066da9f8d6827ae65af492c4" [[package]] name = "aleo-wasm" -version = "0.7.0" +version = "0.7.6" dependencies = [ "anyhow", "async-trait", @@ -1538,8 +1538,9 @@ dependencies = [ [[package]] name = "snarkvm-algorithms" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59d91040c5a51a3c335741aa4fbb8176a612d44760f040c7d9d5833653c6691e" dependencies = [ "aleo-std", "anyhow", @@ -1569,8 +1570,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8208642e213e2e20a07d7ceb7facb2e080be99714d55d2ebc67dcdbd6b4aef8b" dependencies = [ "snarkvm-circuit-account", "snarkvm-circuit-algorithms", @@ -1583,8 +1585,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-account" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca4758873037211d81f1d40bfdd6ae1904aabb7298a4217ff83baaddca7f70b7" dependencies = [ "snarkvm-circuit-algorithms", "snarkvm-circuit-network", @@ -1594,8 +1597,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-algorithms" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eec8ca5e7f6b08e6854e31be1c1207cf6ca26da64f91912d264b0752b14f51cf" dependencies = [ "snarkvm-circuit-types", "snarkvm-console-algorithms", @@ -1604,8 +1608,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-collections" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a709a676a90ce395b811d138698995b515ecc39186772ff7f3c3bb1e1654fbc" dependencies = [ "snarkvm-circuit-algorithms", "snarkvm-circuit-types", @@ -1614,8 +1619,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-environment" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "789c270e95ca1707e3f7d7bd0cc6e90a144cc3a502fe08afde553d6ac0bba9b1" dependencies = [ "indexmap", "itertools", @@ -1632,13 +1638,15 @@ dependencies = [ [[package]] name = "snarkvm-circuit-environment-witness" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6ad62fa4ac3a96440d5ebbda604d9cadaf89d518ecd9b062538213820f37c45" [[package]] name = "snarkvm-circuit-network" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb397309d0c2ddae4fa21fe28b676801e1b4ac352c51c19d7f5fb5f71d968b2d" dependencies = [ "snarkvm-circuit-algorithms", "snarkvm-circuit-collections", @@ -1648,8 +1656,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-program" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c32c9e1d5f97212a8f78083b73141d38ee65b120fbd30494fbb76829cb41414" dependencies = [ "paste", "snarkvm-circuit-account", @@ -1663,8 +1672,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aff3706d5b770254d967c4771e684424f2440d774945c671fa45883eb5d59e0" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-address", @@ -1678,8 +1688,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-address" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0973cefa284be203c7b6e8f408d8115a8520fc10fa0e717c2560fca2ee1f07af" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -1691,8 +1702,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-boolean" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7137bc6814f983597d6f50d2f88e7dce90237f34586526fbc8d77f841b5455b" dependencies = [ "snarkvm-circuit-environment", "snarkvm-console-types-boolean", @@ -1700,8 +1712,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-field" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee531ed89f191a5714684e65c7c271eb1af87bec71abbbc9928e325c0e80674" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -1710,8 +1723,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-group" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2696c6891bf303cfe71ead8378d98f7faea98c76311ef3d15c85191598ddd481" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -1722,8 +1736,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-integers" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85f70807c61d48cabe62b59e5e93fcbb107b62835176c2fe10dcd7a98d02ce15" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -1734,8 +1749,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-scalar" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aba07230428833ac7eecd478f18baa6370b1eb68fe1f1ef93fc3e6c37312e8b6" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -1745,8 +1761,9 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-string" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30fb5a0a45eb4982902325912636a82e601b002fadff3d8415e489129c6a846c" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -1757,8 +1774,9 @@ dependencies = [ [[package]] name = "snarkvm-console" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157d8026f2ad796f03a4d41753a9cf2496625d829bb785020e83c2d5554e246a" dependencies = [ "snarkvm-console-account", "snarkvm-console-algorithms", @@ -1770,8 +1788,9 @@ dependencies = [ [[package]] name = "snarkvm-console-account" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "909aeac3e1fd4e0f4e56b0ed74d590b9c1a4ff9ab6144fb9b6b81483f0705b99" dependencies = [ "bs58", "snarkvm-console-network", @@ -1781,8 +1800,9 @@ dependencies = [ [[package]] name = "snarkvm-console-algorithms" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7271e3a4e79b8e23a2461695b84e7d22e329b2089b9b05365627f9e6f3e17cb8" dependencies = [ "blake2s_simd", "smallvec", @@ -1794,8 +1814,9 @@ dependencies = [ [[package]] name = "snarkvm-console-collections" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b330afcf51263442b406b260b18d04b91ce395133390290c637ca79c38973b8" dependencies = [ "aleo-std", "rayon", @@ -1805,8 +1826,9 @@ dependencies = [ [[package]] name = "snarkvm-console-network" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63d8154a1456f6e4d0ff458a1107d98c596e095a5ef1fd019cbcfa4ea2e6bf6f" dependencies = [ "anyhow", "indexmap", @@ -1828,8 +1850,9 @@ dependencies = [ [[package]] name = "snarkvm-console-network-environment" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20fd9b2abd65743d04f45533941af710fece03d6ab6adf577000cfbaeb845f32" dependencies = [ "anyhow", "bech32", @@ -1846,8 +1869,9 @@ dependencies = [ [[package]] name = "snarkvm-console-program" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7340c6fb347209fe846765b1b2911c63f72c788615f6150c3c588c0b8195a410" dependencies = [ "enum-iterator", "enum_index", @@ -1868,8 +1892,9 @@ dependencies = [ [[package]] name = "snarkvm-console-types" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d66f03c46d92eaf59d18451fad067728e0a5e17618c2447cd82969294c0221" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-address", @@ -1883,8 +1908,9 @@ dependencies = [ [[package]] name = "snarkvm-console-types-address" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c9cd4cd1f8c2f9129a25d51922a5b1ce6a79719202435c24579998b0e2794ee" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -1894,16 +1920,18 @@ dependencies = [ [[package]] name = "snarkvm-console-types-boolean" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "909a71996dd113a07e748d818145223af9893d4c2c45a9fc165b8426f97a0571" dependencies = [ "snarkvm-console-network-environment", ] [[package]] name = "snarkvm-console-types-field" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edf76e7ef6c508d01a8a1b2a1340262127eb48253984ac1aca98bdb4f43c662f" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -1912,8 +1940,9 @@ dependencies = [ [[package]] name = "snarkvm-console-types-group" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "223bcd81ed18834c042dcf077f71805f28fcb976549b35f8ca47b52f39fe317f" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -1923,8 +1952,9 @@ dependencies = [ [[package]] name = "snarkvm-console-types-integers" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08a392d380a382749b75225552ec27c86b5f33adea11dd7a1774c8927781aeca" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -1934,8 +1964,9 @@ dependencies = [ [[package]] name = "snarkvm-console-types-scalar" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7b7d745b3c27eee7dd4d3a8278341617c9aa10783c7919e3eb3efe7084e0853" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -1945,8 +1976,9 @@ dependencies = [ [[package]] name = "snarkvm-console-types-string" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98f1048223dc7839e19a2fb60666801fd0fefdcb5a5987394ffe7603f928bc45" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -1956,8 +1988,9 @@ dependencies = [ [[package]] name = "snarkvm-curves" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02bbd49b827182dd51c3054ec04528ab4eebb61883f0e7d8efeeb53800f684e5" dependencies = [ "rand", "rayon", @@ -1970,8 +2003,9 @@ dependencies = [ [[package]] name = "snarkvm-fields" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b47d900853fbebdb22cf609b7f2cef3e352032c07d11759ee22027d07e758" dependencies = [ "aleo-std", "anyhow", @@ -1987,8 +2021,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-authority" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b24b9e54725e0eb3d3dea16159a0e5871fc5a48a7a93ad30c45914a87509d1" dependencies = [ "anyhow", "rand", @@ -1999,8 +2034,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-block" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eec668a611a2e15e927943914253bfd3b9a6f709fd56a8f40bc75046cd07d77e" dependencies = [ "indexmap", "rayon", @@ -2019,8 +2055,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-committee" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a6cb54ae8d7dc233164123c0be74786c746ed07a525d3c5b3ad1df368560f8" dependencies = [ "indexmap", "rayon", @@ -2031,8 +2068,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-batch-certificate" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "550fbc76ff67e050f480751fc52930015e6ccaeea852ad8eddb5ec595e804375" dependencies = [ "indexmap", "rayon", @@ -2044,8 +2082,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-batch-header" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0451c6227e6cb15688129fa24cf0f5a49120e0e26c89e61fbfcd8a9c0ba4ad40" dependencies = [ "indexmap", "rayon", @@ -2056,8 +2095,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-data" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee5a38e42c52112d9ceb2331ded74d4e68040979471a5a1d9041165e83e43291" dependencies = [ "bytes", "serde_json", @@ -2066,8 +2106,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-subdag" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adbcd2d0dbc7dbe837dfb30de786ac341dd88afdb973b3a2a4c076a39d414e2e" dependencies = [ "indexmap", "rayon", @@ -2081,8 +2122,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-transmission-id" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44e348c47cb47148043240680a89839210d6bdfbcd8fcffe4df7b7b99e25411d" dependencies = [ "snarkvm-console", "snarkvm-ledger-puzzle", @@ -2090,8 +2132,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-puzzle" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7251252c6b6d48ccdfeee38f63127f01bcd1da1edcc8e73f71de5f33719cb059" dependencies = [ "aleo-std", "anyhow", @@ -2110,8 +2153,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-puzzle-epoch" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1e0de23eabafe1380f54556a694c1a9a3574767fb4dd49c9c15975641a30e66" dependencies = [ "aleo-std", "anyhow", @@ -2131,8 +2175,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-query" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d0a7c91e30017cf69a2f8d1636ea682b54a674c555d3d23b9f74d0cf376482" dependencies = [ "async-trait", "reqwest", @@ -2144,8 +2189,9 @@ dependencies = [ [[package]] name = "snarkvm-ledger-store" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "184854df19e419bc4f363713f1c5ba73248fa98e184edec881aba77b397b77cd" dependencies = [ "aleo-std-storage", "anyhow", @@ -2167,8 +2213,9 @@ dependencies = [ [[package]] name = "snarkvm-parameters" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73c31bcc6cc152a8a9fc6992e32edba8f885b736d9ed67c4d9eead979e51d009" dependencies = [ "aleo-std", "anyhow", @@ -2195,8 +2242,9 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01171b6362e9b10f0a1b19364e86758c79f5469227d25ad677a37d675c31f172" dependencies = [ "aleo-std", "anyhow", @@ -2226,8 +2274,9 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-process" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6576f8a4e376780da7a047a8424ddcc3d991192802fc4e333af275aa90c9bf37" dependencies = [ "aleo-std", "colored", @@ -2250,8 +2299,9 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-program" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baea91c7ea8d8584bbe632340dd90cc56b4cc2127025981c298113d227bb587a" dependencies = [ "indexmap", "paste", @@ -2264,8 +2314,9 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-snark" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fe2b943d82c5361917cbac96fbf8060f030ae0555efc9cfe0bd13e1e45680cb" dependencies = [ "bincode", "once_cell", @@ -2277,8 +2328,9 @@ dependencies = [ [[package]] name = "snarkvm-utilities" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c395af67af40e35bb22a1996acbc01119ba129199f6e2b498bf91706754c98" dependencies = [ "aleo-std", "anyhow", @@ -2298,8 +2350,9 @@ dependencies = [ [[package]] name = "snarkvm-utilities-derives" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "857e98d8e92501c0c6a8102e3f2714a550bf2455977d05c25a10a45b5f8ce047" dependencies = [ "proc-macro2", "quote 1.0.36", @@ -2308,8 +2361,9 @@ dependencies = [ [[package]] name = "snarkvm-wasm" -version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=3d42aa04a058cd5f46a1880b421313e1c04a63dc#3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5981943d156ed0fc8e4a4c9a7e0e263335069d345b5904d24386787ee257581" dependencies = [ "getrandom", "snarkvm-circuit-network", diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 453a2cac4..5c1061892 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aleo-wasm" -version = "0.7.0" +version = "0.7.6" authors = [ "The Provable Team" ] description = "WebAssembly based toolkit for developing zero-knowledge applications with Aleo" homepage = "https://provable.com" @@ -22,49 +22,33 @@ crate-type = [ "cdylib", "rlib" ] doctest = false [dependencies.snarkvm-circuit-network] -version = "0.16.19" -git = "https://github.com/AleoNet/snarkVM.git" -rev = "3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" [dependencies.snarkvm-console] -version = "0.16.19" -git = "https://github.com/AleoNet/snarkVM.git" -rev = "3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" features = [ "wasm" ] [dependencies.snarkvm-ledger-block] -version = "0.16.19" -git = "https://github.com/AleoNet/snarkVM.git" -rev = "3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" features = [ "wasm" ] [dependencies.snarkvm-ledger-query] -version = "0.16.19" -git = "https://github.com/AleoNet/snarkVM.git" -rev = "3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" features = [ "async", "wasm" ] [dependencies.snarkvm-ledger-store] -version = "0.16.19" -git = "https://github.com/AleoNet/snarkVM.git" -rev = "3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" [dependencies.snarkvm-parameters] -version = "0.16.19" -git = "https://github.com/AleoNet/snarkVM.git" -rev = "3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" features = [ "wasm" ] [dependencies.snarkvm-synthesizer] -version = "0.16.19" -git = "https://github.com/AleoNet/snarkVM.git" -rev = "3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" features = [ "async", "wasm" ] [dependencies.snarkvm-wasm] -version = "0.16.19" -git = "https://github.com/AleoNet/snarkVM.git" -rev = "3d42aa04a058cd5f46a1880b421313e1c04a63dc" +version = "1.1.0" features = [ "console", "fields", "utilities" ] [dependencies.anyhow] diff --git a/wasm/build.js b/wasm/build.js index 78dc78441..53f9e33a0 100644 --- a/wasm/build.js +++ b/wasm/build.js @@ -55,21 +55,26 @@ async function buildJS(network) { const { initThreadPool: wasmInitThreadPool, Address, + Ciphertext, Execution, ExecutionResponse, Field, + Group, Metadata, OfflineQuery, + Plaintext, Private, PrivateKey, PrivateKeyCiphertext, Program, - ProvingKey, + ProvingKey, RecordCiphertext, RecordPlaintext, ProgramManager, + Scalar, Signature, Transaction, + Transition, ViewKey, VerifyingKey, verifyFunctionExecution, @@ -92,9 +97,11 @@ async function initThreadPool(threads) { export { initThreadPool, Address, + Ciphertext, Execution, ExecutionResponse, Field, + Group, Metadata, OfflineQuery, PrivateKey, @@ -103,9 +110,12 @@ export { ProvingKey, RecordCiphertext, RecordPlaintext, + Plaintext, ProgramManager, Signature, + Scalar, Transaction, + Transition, ViewKey, VerifyingKey, verifyFunctionExecution, @@ -193,11 +203,14 @@ export function initThreadPool(threads?: number): Promise<void>; export { Address, + Ciphertext, Execution, ExecutionResponse, Field, + Group, Metadata, OfflineQuery, + Plaintext, PrivateKey, PrivateKeyCiphertext, Program, @@ -205,8 +218,10 @@ export { RecordCiphertext, RecordPlaintext, ProgramManager, + Scalar, Signature, Transaction, + Transition, ViewKey, VerifyingKey, verifyFunctionExecution, diff --git a/wasm/package.json b/wasm/package.json index 968fbc8c8..f2a9fa7e3 100644 --- a/wasm/package.json +++ b/wasm/package.json @@ -1,6 +1,6 @@ { "name": "@provablehq/wasm", - "version": "0.7.0", + "version": "0.7.6", "description": "Wasm build for the SDK", "collaborators": [ "The Provable Team" diff --git a/wasm/src/ledger/transaction.rs b/wasm/src/ledger/transaction.rs index fefb07d5b..e54d217b6 100644 --- a/wasm/src/ledger/transaction.rs +++ b/wasm/src/ledger/transaction.rs @@ -19,10 +19,12 @@ use crate::{ object, output_to_js_value, types::native::{FromBytes, ToBytes, TransactionNative, U64Native}, + Address, Field, Group, RecordCiphertext, RecordPlaintext, + Signature, Transition, VerifyingKey, ViewKey, @@ -84,6 +86,7 @@ impl Transaction { /// Returns true if the transaction contains the given serial number. /// /// @param {boolean} True if the transaction contains the given serial number. + #[wasm_bindgen(js_name = constainsSerialNumber)] pub fn contains_serial_number(&self, serial_number: &Field) -> bool { self.0.contains_serial_number(serial_number) } @@ -91,21 +94,25 @@ impl Transaction { /// Returns true if the transaction contains the given commitment. /// /// @param {boolean} True if the transaction contains the given commitment. + #[wasm_bindgen(js_name = constainsCommitment)] pub fn contains_commitment(&self, commitment: &Field) -> bool { self.0.contains_commitment(commitment) } /// Find a record in the transaction by the record's commitment. + #[wasm_bindgen(js_name = findRecord)] pub fn find_record(&self, commitment: &Field) -> Option<RecordCiphertext> { self.0.find_record(commitment).map(|record_ciphertext| RecordCiphertext::from(record_ciphertext)) } /// Returns the transaction's base fee. + #[wasm_bindgen(js_name = baseFeeAmount)] pub fn base_fee_amount(&self) -> u64 { self.0.base_fee_amount().map(|fee| *fee).unwrap_or(0) } /// Returns the transaction's total fee. + #[wasm_bindgen(js_name = feeAmount)] pub fn fee_amount(&self) -> u64 { self.0.fee_amount().map(|fee| *fee).unwrap_or(0) } @@ -113,6 +120,7 @@ impl Transaction { /// Returns the transaction's priority fee. /// /// returns {bigint} The transaction's priority fee. + #[wasm_bindgen(js_name = priorityFeeAmount)] pub fn priority_fee_amount(&self) -> u64 { self.0.priority_fee_amount().map(|fee| *fee).unwrap_or(0) } @@ -120,6 +128,7 @@ impl Transaction { /// Returns true if the transaction is a deployment transaction. /// /// @returns {boolean} True if the transaction is a deployment transaction + #[wasm_bindgen(js_name = isDeploy)] pub fn is_deploy(&self) -> bool { self.0.is_deploy() } @@ -127,6 +136,7 @@ impl Transaction { /// Returns true if the transaction is an execution transaction. /// /// @returns {boolean} True if the transaction is an execution transaction + #[wasm_bindgen(js_name = isExecute)] pub fn is_execute(&self) -> bool { self.0.is_execute() } @@ -134,6 +144,7 @@ impl Transaction { /// Returns true if the transaction is a fee transaction. /// /// @returns {boolean} True if the transaction is a fee transaction + #[wasm_bindgen(js_name = isFee)] pub fn is_fee(&self) -> bool { self.0.is_fee() } @@ -143,6 +154,7 @@ impl Transaction { /// @param {ViewKey} view_key View key used to decrypt the ciphertext /// /// @returns {Array<RecordPlaintext>} Array of record plaintext objects + #[wasm_bindgen(js_name = ownedRecords)] pub fn owned_records(&self, view_key: &ViewKey) -> Array { self.0 .records() @@ -187,7 +199,7 @@ impl Transaction { /// @returns {Object} Transaction summary pub fn summary(&self, convert_to_js: bool) -> Object { // If the transaction is an execution, create an array of transitions. - let transitions = if self.0.is_execute() { + let execution = if self.0.is_execute() { let transitions = self.0.transitions().map(|transition| { // Collect the inputs and outputs. let inputs = transition.inputs().iter().map(|input| { @@ -197,9 +209,9 @@ impl Transaction { output_to_js_value(output, convert_to_js) }).collect::<Array>(); object! { - "programId" : transition.program_id().to_string(), - "functionName" : transition.function_name().to_string(), - "transitionID" : transition.id().to_string(), + "program" : transition.program_id().to_string(), + "function" : transition.function_name().to_string(), + "id" : transition.id().to_string(), "inputs" : inputs, "outputs" : outputs, "tpk" : if convert_to_js { JsValue::from_str(&transition.tpk().to_string()) } else { JsValue::from(Group::from(transition.tpk())) }, @@ -207,39 +219,91 @@ impl Transaction { "scm" : if convert_to_js { JsValue::from_str(&transition.scm().to_string()) } else { JsValue::from(Field::from(transition.scm())) }, } }).collect::<Array>(); - JsValue::from(transitions) + let execution = self.0.execution().unwrap(); + let execution_object = object! { + "global_state_root" : execution.global_state_root().to_string(), + "proof" : execution.proof().map(|proof| proof.to_string()).unwrap_or("".to_string()), + "transitions" : transitions, + }; + JsValue::from(execution_object) } else { - JsValue::NULL + JsValue::UNDEFINED }; // If the transaction is a deployment, summarize the deployment. let deployment = if let Some(deployment) = self.0.deployment() { - let functions = deployment.verifying_keys().iter().map(|(function_name, (verifying_key, _))| { + let functions = deployment.verifying_keys().iter().map(|(function_name, (verifying_key, certificate))| { // Create the initial function object. object! { - "functionName" : function_name.to_string(), + "name" : function_name.to_string(), "constraints" : verifying_key.circuit_info.num_constraints as u32, "variables" : verifying_key.num_variables() as u32, "verifyingKey": if convert_to_js { JsValue::from_str(&verifying_key.to_string()) } else { JsValue::from(VerifyingKey::from(verifying_key)) }, + "certificate" : certificate.to_string(), } }).collect::<Array>(); + // Create the deployment object. JsValue::from(object! { - "programId" : deployment.program_id().to_string(), + "edition" : deployment.edition(), + "program" : deployment.program_id().to_string(), "functions" : functions, }) } else { - JsValue::NULL + JsValue::UNDEFINED + }; + + let owner = self.0.owner().map(|owner| { + let owner = object! { + "address" : if convert_to_js { JsValue::from_str(&owner.address().to_string()) } else { JsValue::from( Address::from(owner.address())) }, + "signature" : if convert_to_js { JsValue::from_str(&owner.signature().to_string()) } else { JsValue::from( Signature::from(owner.signature()) ) }, + }; + JsValue::from(owner) + }) + .unwrap_or_else(|| JsValue::UNDEFINED); + + // Extract the fee execution. + let fee = match &self.0 { + TransactionNative::Deploy(_, _, _, fee) => Some(fee), + TransactionNative::Execute(_, _, fee) => fee.as_ref(), + TransactionNative::Fee(_, fee) => Some(fee), + }; + + let fee_execution = if let Some(fee) = fee { + // Collect the inputs and outputs. + let inputs = fee.inputs().iter().map(|input| input_to_js_value(input, convert_to_js)).collect::<Array>(); + let outputs = + fee.outputs().iter().map(|output| output_to_js_value(output, convert_to_js)).collect::<Array>(); + let fee_transition = object! { + "program" : fee.program_id().to_string(), + "function" : fee.function_name().to_string(), + "id" : fee.id().to_string(), + "inputs" : inputs, + "outputs" : outputs, + "tpk" : if convert_to_js { JsValue::from_str(&fee.tpk().to_string()) } else { JsValue::from(Group::from(fee.tpk())) }, + "tcm" : if convert_to_js { JsValue::from_str(&fee.tcm().to_string()) } else { JsValue::from(Field::from(fee.tcm())) }, + "scm" : if convert_to_js { JsValue::from_str(&fee.scm().to_string()) } else { JsValue::from(Field::from(fee.scm())) }, + }; + let execution_object = object! { + "global_state_root" : fee.global_state_root().to_string(), + "proof" : fee.proof().map(|proof| proof.to_string()).unwrap_or("".to_string()), + "transition" : fee_transition, + }; + JsValue::from(execution_object) + } else { + JsValue::UNDEFINED }; object! { - "transactionId" : self.transaction_id().to_string(), - "transactionType" : self.transaction_type().to_string(), - "fee" : *self.0.fee_amount().unwrap_or(U64Native::new(0)), + "id" : self.id().to_string(), + "type" : self.transaction_type().to_string(), + "execution" : execution, + "deployment" : deployment, + "fee" : fee_execution, + "owner" : owner, + "feeAmount" : *self.0.fee_amount().unwrap_or(U64Native::new(0)), "baseFee" : *self.0.base_fee_amount().unwrap_or(U64Native::new(0)), "priorityFee" : *self.0.priority_fee_amount().unwrap_or(U64Native::new(0)), - "transitions" : transitions, - "deployment" : deployment, } } @@ -250,8 +314,7 @@ impl Transaction { /// value can be used to lookup the transaction data on-chain. /// /// @returns {string} TransactionId - #[wasm_bindgen(js_name = transactionId)] - pub fn transaction_id(&self) -> String { + pub fn id(&self) -> String { self.0.id().to_string() } @@ -273,6 +336,27 @@ impl Transaction { pub fn transitions(&self) -> Array { self.0.transitions().map(|transition| JsValue::from(Transition::from(transition))).collect::<Array>() } + + /// Get the verifying keys in a transaction. + pub fn verifying_keys(&self) -> Array { + self.0 + .deployment() + .map(|deployment| { + deployment + .verifying_keys() + .iter() + .map(|(function_name, (verifying_key, certificate))| { + object! { + "program" : deployment.program_id().to_string(), + "function" : function_name.to_string(), + "verifyingKey" : verifying_key.to_string(), + "certificate" : certificate.to_string(), + } + }) + .collect::<Array>() + }) + .unwrap_or_else(|| Array::new()) + } } impl Deref for Transaction { @@ -330,7 +414,7 @@ mod tests { #[wasm_bindgen_test] fn test_transaction_string_constructor_and_accessor_methods() { let transaction = Transaction::from_string(TRANSACTION_STRING).unwrap(); - let transaction_id = transaction.transaction_id(); + let transaction_id = transaction.id(); let transaction_type = transaction.transaction_type(); let recovered_string = transaction.to_string(); assert_eq!(transaction_id, TRANSACTION_ID); @@ -372,27 +456,35 @@ mod tests { fn test_transaction_summary_provides_expected_values() { let transaction = Transaction::from_string(TRANSACTION_STRING).unwrap(); let summary = transaction.summary(true); - let transaction_id = Reflect::get(&summary, &JsValue::from_str("transactionId")).unwrap().as_string().unwrap(); + let transaction_id = Reflect::get(&summary, &JsValue::from_str("id")).unwrap().as_string().unwrap(); assert_eq!(transaction_id, TRANSACTION_ID); - let transaction_type = - Reflect::get(&summary, &JsValue::from_str("transactionType")).unwrap().as_string().unwrap(); + let transaction_type = Reflect::get(&summary, &JsValue::from_str("type")).unwrap().as_string().unwrap(); assert_eq!(transaction_type, "execute"); assert!(Reflect::get(&summary, &JsValue::from_str("baseFee")).unwrap().is_bigint()); - assert!(Reflect::get(&summary, &JsValue::from_str("fee")).unwrap().is_bigint()); + assert!(Reflect::get(&summary, &JsValue::from_str("feeAmount")).unwrap().is_bigint()); assert!(Reflect::get(&summary, &JsValue::from_str("priorityFee")).unwrap().is_bigint()); - // Get the transitions. - let transitions = Array::from(&Reflect::get(&summary, &JsValue::from_str("transitions")).unwrap()).to_vec(); + // Get the execution. + let execution = Object::from(Reflect::get(&summary, &JsValue::from_str("execution")).unwrap()); + let transitions = Array::from(&Reflect::get(&execution, &JsValue::from_str("transitions")).unwrap()).to_vec(); assert_eq!(transitions.len(), 2); + let global_state_root = + Reflect::get(&execution, &JsValue::from_str("global_state_root")).unwrap().as_string().unwrap(); + let proof = Reflect::get(&execution, &JsValue::from_str("proof")).unwrap().as_string().unwrap(); + assert_eq!(&global_state_root, "sr1cxx6uf72kla7hzu65m394fljpup39h3efe97xsn2wm2gl9apjgyqdr94ud"); + assert_eq!( + &proof, + "proof1qyqsqqqqqqqqqqqpqqqqqqqqqqqvs2nmr0pnyufteq8wtf080x3vwfh5yk08d6pjmedl8j7gx6a42das2ul7rm9x6wn5tvars43nudvqq9gshva80utleuytjesa4vmkq4cv6kfcm6axn2pwf7klzk402gf9qn5t0ssz3mut0ycjcjwss4e76qrh46q8r8calfmrwmpmwj2j063rsgtvq4v85v8gzlyyy233f90pztncnx9pr65l28vuqwx86n0p2xqws3lw0a2qs4smanr5eq78rgn2t2vtvnfu07589676v86kjxdfc6nqdvmghjvc25zzh7qwj2jxmk5qtu5ecxd8mpx00mjs4q2sen68w57zk6c3e7xnm7jeelrqhuexaae9n8v9ddagrl27wwn8zg8vwv9srrar48d0aqslsmzt6lqnxq2mwn0y89zxtrsfs8uzphrc3geu9y5pn2m90k45s5cqt4ypw8rqea53qprslzcs0xpuhc6gc59lfxk0fz49wj70pxe4wczpnxcendf6f7ep49svrsamw2nn39y02dt3l85ztqr09hcxd6h9382cq2s3j890g6ezu2lktszy278dxhuxj47qmmjs2m2p78ud9s3m7pkrusrqwj65f6qv4h0spx0jsrs0vcyapz868egt4g6jf9zwmdkfn5d4966234td44gzcvzwghl2tcxxpl0vt70366upqd7se7pf8vmlvujalgwglgzu2tnrp474nmuvewflrd6eg8j6usg5c6l5vydrkjav4lqx8n4d83nre9qex57ut3nunlyccedx3npxuqzu4fk6293yxxd0sd05jrtxkjpckqrvaaxnng22j9dxnlrvxm24ql5880tdnd8mwsmhz9hf4tnwlrl65xu2x9tuqz5c4nsha95hqlksj3mapzmc5672md4hckakxfpt28znt0st8p3xwt05a3usl3remvc9e5ng8quakjgax4aquczfqvdxzwstm8et5tgdptkt84wnklwn5c8cy93ezx7rh4jve5dn2t8zcn32vph0d8sx583j6uqz6sg8mjs6upgdsf47d6ageygydpve89p3tsshx5vt98jzet9hnkfacky5hpxgqlgnm0dvchgylg3prq05gq7kzdu8narls66gg7nxml0hzqsrh0lqez38m40dzt9zzg985frap8m43ehfk5z9lpsazc7jx0fyp2qcrncdqvqqqqqqqqqqqkfq8j9ez9zl7gycv3wzsjez8amk3lkrptn62v0xp805dmckhl38k3hn0vc5v54wre6m0n8mcvz3qyq2fchjxd29juplmjywlrfz83zkq2ev6mxryx5dz43tcwneamnpa5m6ezycmqed4dsfrm342e3693qqq8gj3sheypdtugcnxfuvw5pqn5glpxc8hy8efn8z366lm6l46luqpfn0c6cv8jnfkqg8x0djhm97ex4w43ljp2q3p48puy5qg7plrl3082j669dptpvp62h8wrmvl4ggsyqqxqxmd4" + ); // Check the transfer_public transition. let transition = Object::from(transitions[0].clone()); assert_eq!( - Reflect::get(&transition, &JsValue::from_str("programId")).unwrap().as_string().unwrap(), + Reflect::get(&transition, &JsValue::from_str("program")).unwrap().as_string().unwrap(), "credits.aleo" ); assert_eq!( - Reflect::get(&transition, &JsValue::from_str("functionName")).unwrap().as_string().unwrap(), + Reflect::get(&transition, &JsValue::from_str("function")).unwrap().as_string().unwrap(), "transfer_public" ); assert_eq!( @@ -411,8 +503,21 @@ mod tests { // Check inputs. let inputs = Array::from(&Reflect::get(&transition, &JsValue::from_str("inputs")).unwrap()).to_vec(); assert_eq!(inputs.len(), 2); - assert_eq!(inputs[0].as_string().unwrap(), "aleo1nde82xqshcyjq2r3qjel7pphk3zfs928w5dqhuc6g2ywquef7srsmrpjgr"); - assert!(inputs[1].is_bigint()); + assert_eq!(Reflect::get(&inputs[0], &JsValue::from_str("type")).unwrap().as_string().unwrap(), "public"); + assert_eq!( + Reflect::get(&inputs[0], &JsValue::from_str("id")).unwrap().as_string().unwrap(), + "4751135245718319934677221244600857477393936843410399077399851644790898074286field" + ); + assert_eq!( + Reflect::get(&inputs[0], &JsValue::from_str("value")).unwrap().as_string().unwrap(), + "aleo1nde82xqshcyjq2r3qjel7pphk3zfs928w5dqhuc6g2ywquef7srsmrpjgr" + ); + assert_eq!(Reflect::get(&inputs[1], &JsValue::from_str("type")).unwrap().as_string().unwrap(), "public"); + assert_eq!( + Reflect::get(&inputs[1], &JsValue::from_str("id")).unwrap().as_string().unwrap(), + "1879683531456735826402444579986765299787803396630464445477045553705002014280field" + ); + assert!(Reflect::get(&inputs[1], &JsValue::from_str("value")).unwrap().is_bigint()); // Check outputs and future arguments. let outputs = Array::from(&Reflect::get(&transition, &JsValue::from_str("outputs")).unwrap()).to_vec(); @@ -421,12 +526,9 @@ mod tests { // Check transfer_public output. assert_eq!(outputs.len(), 1); assert_eq!(Reflect::get(&output, &JsValue::from_str("type")).unwrap().as_string().unwrap(), "future"); + assert_eq!(Reflect::get(&output, &JsValue::from_str("program")).unwrap().as_string().unwrap(), "credits.aleo"); assert_eq!( - Reflect::get(&output, &JsValue::from_str("programId")).unwrap().as_string().unwrap(), - "credits.aleo" - ); - assert_eq!( - Reflect::get(&output, &JsValue::from_str("functionName")).unwrap().as_string().unwrap(), + Reflect::get(&output, &JsValue::from_str("function")).unwrap().as_string().unwrap(), "transfer_public" ); @@ -446,11 +548,11 @@ mod tests { // Check fee_public transition. let transition = Object::from(transitions[1].clone()); assert_eq!( - Reflect::get(&transition, &JsValue::from_str("programId")).unwrap().as_string().unwrap(), + Reflect::get(&transition, &JsValue::from_str("program")).unwrap().as_string().unwrap(), "credits.aleo" ); assert_eq!( - Reflect::get(&transition, &JsValue::from_str("functionName")).unwrap().as_string().unwrap(), + Reflect::get(&transition, &JsValue::from_str("function")).unwrap().as_string().unwrap(), "fee_public" ); assert_eq!( @@ -469,10 +571,10 @@ mod tests { // Check inputs. let inputs = Array::from(&Reflect::get(&transition, &JsValue::from_str("inputs")).unwrap()).to_vec(); assert_eq!(inputs.len(), 3); - assert!(inputs[0].is_bigint()); - assert!(inputs[1].is_bigint()); + assert!(Reflect::get(&inputs[0], &JsValue::from_str("value")).unwrap().is_bigint()); + assert!(Reflect::get(&inputs[1], &JsValue::from_str("value")).unwrap().is_bigint()); assert_eq!( - inputs[2].as_string().unwrap(), + Reflect::get(&inputs[2], &JsValue::from_str("value")).unwrap().as_string().unwrap(), "4485998228444633245424449325268791226620568930423610568011053349827561756688field" ); @@ -483,14 +585,64 @@ mod tests { // Check fee_public output. assert_eq!(outputs.len(), 1); assert_eq!(Reflect::get(&output, &JsValue::from_str("type")).unwrap().as_string().unwrap(), "future"); + assert_eq!(Reflect::get(&output, &JsValue::from_str("program")).unwrap().as_string().unwrap(), "credits.aleo"); + assert_eq!(Reflect::get(&output, &JsValue::from_str("function")).unwrap().as_string().unwrap(), "fee_public"); + + // Check the future arguments. + let future_arguments = Array::from(&Reflect::get(&output, &JsValue::from_str("arguments")).unwrap()).to_vec(); + assert_eq!(future_arguments.len(), 2); assert_eq!( - Reflect::get(&output, &JsValue::from_str("programId")).unwrap().as_string().unwrap(), + future_arguments[0].as_string().unwrap(), + "aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f" + ); + assert!(future_arguments[1].is_bigint()); + + // Check the fee execution. + let fee_execution = Object::from(Reflect::get(&summary, &JsValue::from_str("fee")).unwrap()); + let fee_transition = Object::from(Reflect::get(&fee_execution, &JsValue::from_str("transition")).unwrap()); + let fee_stateroot = + Reflect::get(&fee_execution, &JsValue::from_str("global_state_root")).unwrap().as_string().unwrap(); + assert_eq!(&fee_stateroot, "sr1cxx6uf72kla7hzu65m394fljpup39h3efe97xsn2wm2gl9apjgyqdr94ud"); + assert_eq!( + Reflect::get(&fee_transition, &JsValue::from_str("program")).unwrap().as_string().unwrap(), "credits.aleo" ); assert_eq!( - Reflect::get(&output, &JsValue::from_str("functionName")).unwrap().as_string().unwrap(), + Reflect::get(&fee_transition, &JsValue::from_str("function")).unwrap().as_string().unwrap(), "fee_public" ); + assert_eq!( + Reflect::get(&transition, &JsValue::from_str("tpk")).unwrap().as_string().unwrap(), + "5133974047416696841315369281389544483681028470433387841583387079449986330429group" + ); + assert_eq!( + Reflect::get(&transition, &JsValue::from_str("tcm")).unwrap().as_string().unwrap(), + "795609109724429421407275371955802534344227027480936262614604311690962025301field" + ); + assert_eq!( + Reflect::get(&transition, &JsValue::from_str("scm")).unwrap().as_string().unwrap(), + "3903849113674739385296398736730232388289952783409244858026975082444581569623field" + ); + + // Check inputs. + let inputs = Array::from(&Reflect::get(&fee_transition, &JsValue::from_str("inputs")).unwrap()).to_vec(); + assert_eq!(inputs.len(), 3); + assert!(Reflect::get(&inputs[0], &JsValue::from_str("value")).unwrap().is_bigint()); + assert!(Reflect::get(&inputs[1], &JsValue::from_str("value")).unwrap().is_bigint()); + assert_eq!( + Reflect::get(&inputs[2], &JsValue::from_str("value")).unwrap().as_string().unwrap(), + "4485998228444633245424449325268791226620568930423610568011053349827561756688field" + ); + + // Check outputs and future arguments. + let outputs = Array::from(&Reflect::get(&fee_transition, &JsValue::from_str("outputs")).unwrap()).to_vec(); + let output = Object::from(outputs[0].clone()); + + // Check fee_public output. + assert_eq!(outputs.len(), 1); + assert_eq!(Reflect::get(&output, &JsValue::from_str("type")).unwrap().as_string().unwrap(), "future"); + assert_eq!(Reflect::get(&output, &JsValue::from_str("program")).unwrap().as_string().unwrap(), "credits.aleo"); + assert_eq!(Reflect::get(&output, &JsValue::from_str("function")).unwrap().as_string().unwrap(), "fee_public"); // Check the future arguments. let future_arguments = Array::from(&Reflect::get(&output, &JsValue::from_str("arguments")).unwrap()).to_vec(); diff --git a/wasm/src/ledger/transition.rs b/wasm/src/ledger/transition.rs index 4f1884f59..0d8d2b23f 100644 --- a/wasm/src/ledger/transition.rs +++ b/wasm/src/ledger/transition.rs @@ -96,6 +96,7 @@ impl Transition { /// Returns true if the transition contains the given commitment. /// /// @param {boolean} True if the transition contains the given commitment. + #[wasm_bindgen(js_name = containsCommitment)] pub fn contains_commitment(&self, commitment: &Field) -> bool { self.0.contains_commitment(commitment) } @@ -105,11 +106,13 @@ impl Transition { /// @param {Field} serial_number The serial number to check for /// /// @returns {bool} True if the transition contains a serial number, false otherwise + #[wasm_bindgen(js_name = containsSerialNumber)] pub fn contains_serial_number(&self, serial_number: &Field) -> bool { self.0.contains_serial_number(serial_number) } /// Find a record in the transition by the record's commitment. + #[wasm_bindgen(js_name = findRecord)] pub fn find_record(&self, commitment: &Field) -> Option<RecordCiphertext> { self.0.find_record(commitment).map(|record_ciphertext| RecordCiphertext::from(record_ciphertext)) } @@ -119,6 +122,7 @@ impl Transition { /// @param {ViewKey} view_key The view key of the record owner. /// /// @returns {Array<RecordPlaintext>} Array of record plaintext objects + #[wasm_bindgen(js_name = ownedRecords)] pub fn owned_records(&self, view_key: &ViewKey) -> Array { self.0 .records() @@ -323,11 +327,16 @@ mod tests { assert_eq!(inputs.length(), 2); assert_eq!(Reflect::get(&input_1, &JsValue::from_str("type")).unwrap().as_string().unwrap(), "record"); assert_eq!( - Reflect::get(&input_1, &JsValue::from_str("serialNumber")).unwrap().as_string().unwrap(), + Reflect::get(&input_1, &JsValue::from_str("id")).unwrap().as_string().unwrap(), INPUT_RECORD_SERIAL_NUMBER ); assert_eq!(Reflect::get(&input_1, &JsValue::from_str("tag")).unwrap().as_string().unwrap(), INPUT_RECORD_TAG); - assert!(input_2.is_bigint()); + assert_eq!( + Reflect::get(&input_2, &JsValue::from_str("id")).unwrap().as_string().unwrap(), + "4155661860779318196369465902681808025430867777096367712868886959018716227815field" + ); + assert_eq!(Reflect::get(&input_2, &JsValue::from_str("type")).unwrap().as_string().unwrap(), "public"); + assert!(Reflect::get(&input_2, &JsValue::from_str("value")).unwrap().is_bigint()); } #[wasm_bindgen_test] @@ -343,27 +352,25 @@ mod tests { // Ensure the record output is correct. assert_eq!(Reflect::get(&output_1, &JsValue::from_str("type")).unwrap().as_string().unwrap(), "record"); assert_eq!( - Reflect::get(&output_1, &JsValue::from_str("commitment")).unwrap().as_string().unwrap(), + Reflect::get(&output_1, &JsValue::from_str("id")).unwrap().as_string().unwrap(), OUTPUT_RECORD_COMMITMENT ); assert_eq!( Reflect::get(&output_1, &JsValue::from_str("checksum")).unwrap().as_string().unwrap(), OUTPUT_CHECKSUM ); - assert_eq!( - Reflect::get(&output_1, &JsValue::from_str("recordCiphertext")).unwrap().as_string().unwrap(), - OUTPUT_RECORD - ); + assert_eq!(Reflect::get(&output_1, &JsValue::from_str("value")).unwrap().as_string().unwrap(), OUTPUT_RECORD); // Ensure the future output is correct. let arguments = Array::from(&Reflect::get(&output_2, &JsValue::from_str("arguments")).unwrap()); + assert_eq!(Reflect::get(&output_2, &JsValue::from_str("type")).unwrap().as_string().unwrap(), "future"); assert_eq!( - Reflect::get(&output_2, &JsValue::from_str("programId")).unwrap().as_string().unwrap(), + Reflect::get(&output_2, &JsValue::from_str("program")).unwrap().as_string().unwrap(), "token_registry.aleo" ); assert_eq!( - Reflect::get(&output_2, &JsValue::from_str("functionName")).unwrap().as_string().unwrap(), + Reflect::get(&output_2, &JsValue::from_str("function")).unwrap().as_string().unwrap(), "burn_private" ); diff --git a/wasm/src/programs/data/helpers/future.rs b/wasm/src/programs/data/helpers/future.rs index 6cd35dd2e..8e78ac060 100644 --- a/wasm/src/programs/data/helpers/future.rs +++ b/wasm/src/programs/data/helpers/future.rs @@ -18,19 +18,16 @@ use crate::{ object, plaintext_to_js_value, types::native::{ArgumentNative, FutureNative}, + Field, Plaintext, }; -use js_sys::{Array, JsString, Reflect}; +use crate::types::native::FieldNative; +use js_sys::{Array, Reflect}; use wasm_bindgen::JsValue; /// Convert a future to a javascript value. -pub fn future_to_js_value(argument: &FutureNative, convert_to_js: bool) -> JsValue { - let future_object = object! { - "type" : "future", - "programId" : argument.program_id().to_string(), - "functionName" : argument.function_name().to_string(), - }; +pub fn future_to_js_value(argument: &FutureNative, convert_to_js: bool, id: &FieldNative) -> JsValue { let arguments = argument .arguments() .iter() @@ -42,9 +39,15 @@ pub fn future_to_js_value(argument: &FutureNative, convert_to_js: bool) -> JsVal JsValue::from(Plaintext::from(plaintext)) } } - ArgumentNative::Future(future) => future_to_js_value(future, convert_to_js), + ArgumentNative::Future(future) => future_to_js_value(future, convert_to_js, id), }) .collect::<Array>(); - Reflect::set(&future_object, &JsString::from("arguments"), &JsValue::from(&arguments)).unwrap(); + let future_object = object! { + "type" : "future", + "id" : if convert_to_js { JsValue::from(&id.to_string()) } else { JsValue::from(Field::from(id)) }, + "program" : argument.program_id().to_string(), + "function" : argument.function_name().to_string(), + "arguments" : arguments, + }; JsValue::from(future_object) } diff --git a/wasm/src/programs/data/helpers/input.rs b/wasm/src/programs/data/helpers/input.rs index 2f928b559..2512edced 100644 --- a/wasm/src/programs/data/helpers/input.rs +++ b/wasm/src/programs/data/helpers/input.rs @@ -16,70 +16,67 @@ use crate::{object, plaintext_to_js_value, types::native::InputNative, Ciphertext, Field, Plaintext}; -use js_sys::{JsString, Reflect}; +use js_sys::Reflect; use wasm_bindgen::JsValue; pub fn input_to_js_value(input: &InputNative, convert_to_js: bool) -> JsValue { match input { - InputNative::Constant(_, plaintext) => { - if let Some(plaintext) = plaintext { + InputNative::Constant(id, plaintext) => { + let value = if let Some(plaintext) = plaintext { if convert_to_js { plaintext_to_js_value(plaintext) } else { JsValue::from(Plaintext::from(plaintext)) } } else { - JsValue::NULL - } + JsValue::UNDEFINED + }; + let constant_input = object! { + "type": "constant", + "id": if convert_to_js { JsValue::from(&id.to_string()) } else { JsValue::from(Field::from(id)) }, + "value": value, + }; + JsValue::from(constant_input) } - InputNative::Public(_, plaintext) => { - if let Some(plaintext) = plaintext { + InputNative::Public(id, plaintext) => { + let value = if let Some(plaintext) = plaintext { if convert_to_js { plaintext_to_js_value(plaintext) } else { JsValue::from(Plaintext::from(plaintext)) } } else { - JsValue::NULL - } + JsValue::UNDEFINED + }; + let public_input = object! { + "type" : "public", + "id" : if convert_to_js { JsValue::from(&id.to_string()) } else { JsValue::from(Field::from(id)) }, + "value" : value, + }; + JsValue::from(public_input) } - InputNative::Private(_, ciphertext) => { - if let Some(ciphertext) = ciphertext { + InputNative::Private(id, ciphertext) => { + let value = if let Some(ciphertext) = ciphertext { if convert_to_js { JsValue::from_str(&ciphertext.to_string()) } else { JsValue::from(Ciphertext::from(ciphertext)) } } else { - JsValue::NULL - } + JsValue::UNDEFINED + }; + let private_input = object! { + "type" : "private", + "id" : if convert_to_js { JsValue::from(&id.to_string()) } else { JsValue::from(Field::from(id)) }, + "value" : value, + }; + JsValue::from(private_input) } InputNative::Record(serial_number, tag) => { let record = object! { "type": "record", + "id": if convert_to_js { JsValue::from(serial_number.to_string()) } else { JsValue::from(Field::from(serial_number)) }, + "tag" : if convert_to_js { JsValue::from(Field::from(tag).to_string()) } else { JsValue::from(Field::from(tag)) }, }; - if convert_to_js { - Reflect::set(&record, &JsString::from("serialNumber"), &JsValue::from(serial_number.to_string())) - .unwrap(); - Reflect::set(&record, &JsString::from("tag"), &JsValue::from(Field::from(tag).to_string())).unwrap(); - } else { - Reflect::set(&record, &JsString::from("serialNumber"), &JsValue::from(Field::from(serial_number))) - .unwrap(); - Reflect::set(&record, &JsString::from("tag"), &JsValue::from(Field::from(tag))).unwrap(); - } JsValue::from(record) } InputNative::ExternalRecord(input_commitment) => { let external_record = object! { - "type": "extneralRecord", + "type": "externalRecord", + "id" : if convert_to_js { JsValue::from(input_commitment.to_string()) } else { JsValue::from(Field::from(input_commitment)) }, }; - if convert_to_js { - Reflect::set( - &external_record, - &JsString::from("inputCommitment"), - &JsValue::from(input_commitment.to_string()), - ) - .unwrap(); - } else { - Reflect::set( - &external_record, - &JsString::from("inputCommitment"), - &JsValue::from(Field::from(input_commitment)), - ) - .unwrap(); - } JsValue::from(external_record) } } diff --git a/wasm/src/programs/data/helpers/output.rs b/wasm/src/programs/data/helpers/output.rs index 385cdd3cd..dd442cbbd 100644 --- a/wasm/src/programs/data/helpers/output.rs +++ b/wasm/src/programs/data/helpers/output.rs @@ -25,94 +25,86 @@ use crate::{ RecordCiphertext, }; -use js_sys::{JsString, Object, Reflect}; +use js_sys::Reflect; use wasm_bindgen::JsValue; pub fn output_to_js_value(output: &OutputNative, convert_to_js: bool) -> JsValue { let js_value = match output { - OutputNative::Constant(_, plaintext) => { - if let Some(plaintext) = plaintext { + OutputNative::Constant(id, plaintext) => { + let value = if let Some(plaintext) = plaintext { if convert_to_js { plaintext_to_js_value(plaintext) } else { JsValue::from(Plaintext::from(plaintext)) } } else { - JsValue::NULL - } + JsValue::UNDEFINED + }; + let constant = object! { + "type" : "constant", + "id" : if convert_to_js { JsValue::from(id.to_string()) } else { JsValue::from(Field::from(id)) }, + "value" : value, + }; + JsValue::from(constant) } - OutputNative::Public(_, plaintext) => { - if let Some(plaintext) = plaintext { + OutputNative::Public(id, plaintext) => { + let value = if let Some(plaintext) = plaintext { if convert_to_js { plaintext_to_js_value(plaintext) } else { JsValue::from(Plaintext::from(plaintext)) } } else { - JsValue::NULL - } + JsValue::UNDEFINED + }; + let public_output = object! { + "type" : "constant", + "id" : if convert_to_js { JsValue::from(id.to_string()) } else { JsValue::from(Field::from(id)) }, + "value" : value, + }; + JsValue::from(public_output) } - OutputNative::Private(_, ciphertext) => { - if let Some(ciphertext) = ciphertext { + OutputNative::Private(id, ciphertext) => { + let value = if let Some(ciphertext) = ciphertext { if convert_to_js { JsValue::from_str(&ciphertext.to_string()) } else { JsValue::from(Ciphertext::from(ciphertext)) } } else { - JsValue::NULL - } + JsValue::UNDEFINED + }; + let private_output = object! { + "type" : "constant", + "id" : if convert_to_js { JsValue::from(id.to_string()) } else { JsValue::from(Field::from(id)) }, + "value" : value, + }; + JsValue::from(private_output) } OutputNative::Record(commitment, checksum, record_ciphertext) => { - // Create a record object. + let value = if let Some(record_ciphertext) = record_ciphertext { + if convert_to_js { + JsValue::from(record_ciphertext.to_string()) + } else { + JsValue::from(RecordCiphertext::from(record_ciphertext)) + } + } else { + JsValue::UNDEFINED + }; let record = object! { "type": "record", + "id": if convert_to_js { JsValue::from(commitment.to_string()) } else { JsValue::from(Field::from(commitment)) }, + "checksum": if convert_to_js { JsValue::from(checksum.to_string()) } else { JsValue::from(Field::from(checksum)) }, + "value" : value, }; - - // Create a record object. - if convert_to_js { - Reflect::set(&record, &JsString::from("commitment"), &JsValue::from(commitment.to_string())).unwrap(); - Reflect::set(&record, &JsString::from("checksum"), &JsValue::from(checksum.to_string())).unwrap(); - if let Some(record_ciphertext) = record_ciphertext { - Reflect::set( - &record, - &JsString::from("recordCiphertext"), - &JsValue::from(record_ciphertext.to_string()), - ) - .unwrap(); - } - } else { - Reflect::set(&record, &JsString::from("commitment"), &JsValue::from(Field::from(commitment))).unwrap(); - Reflect::set(&record, &JsString::from("checksum"), &JsValue::from(Field::from(checksum))).unwrap(); - if let Some(record_ciphertext) = record_ciphertext { - Reflect::set( - &record, - &JsString::from("recordCiphertext"), - &JsValue::from(RecordCiphertext::from(record_ciphertext)), - ) - .unwrap(); - } - } - JsValue::from(&record) + JsValue::from(record) } OutputNative::ExternalRecord(output_commitment) => { - let external_record_object = Object::new(); - Reflect::set(&external_record_object, &JsString::from("type"), &JsString::from("externalRecord")).unwrap(); - if convert_to_js { - Reflect::set( - &external_record_object, - &JsString::from("outputCommitment"), - &JsString::from(output_commitment.to_string()), - ) - .unwrap(); - } else { - Reflect::set( - &external_record_object, - &JsString::from("outputCommitment"), - &JsValue::from(Field::from(output_commitment)), - ) - .unwrap(); - } + let external_record_object = object! { + "type": "external_record", + "id": if convert_to_js { JsValue::from(output_commitment.to_string()) } else { JsValue::from(Field::from(output_commitment)) }, + }; JsValue::from(external_record_object) } - OutputNative::Future(_, future) => { - if let Some(future) = future { - future_to_js_value(future, convert_to_js) + OutputNative::Future(id, future) => { + let value = if let Some(future) = future { + future_to_js_value(future, convert_to_js, id) } else { - JsValue::NULL - } + JsValue::UNDEFINED + }; + JsValue::from(&value) } }; js_value diff --git a/wasm/src/programs/data/plaintext.rs b/wasm/src/programs/data/plaintext.rs index 0d1cb52bc..9e68a20df 100644 --- a/wasm/src/programs/data/plaintext.rs +++ b/wasm/src/programs/data/plaintext.rs @@ -57,12 +57,12 @@ impl Plaintext { /// /// @param {string} name The name of the plaintext member to find. /// - /// @returns {Plaintext | undefined} The plaintext member. - pub fn find(&self, name: String) -> Option<Plaintext> { - let identifier = IdentifierNative::from_str(&name).ok()?; + /// @returns {Plaintext} The plaintext member. + pub fn find(&self, name: String) -> Result<Plaintext, String> { + let identifier = IdentifierNative::from_str(&name).map_err(|e| e.to_string())?; match self.0.find(&[identifier]) { - Ok(plaintext) => Some(Plaintext(plaintext)), - Err(_) => None, + Ok(plaintext) => Ok(Plaintext(plaintext)), + Err(e) => Err(e.to_string()), } } @@ -72,6 +72,7 @@ impl Plaintext { } /// Encrypt a plaintext with a transition view key. + #[wasm_bindgen(js_name = encryptSymmetric)] pub fn encrypt_symmetric(&self, transition_view_key: &Field) -> Result<Ciphertext, String> { self.0.encrypt_symmetric(**transition_view_key).map_err(|e| e.to_string()).map(Ciphertext::from) } @@ -116,6 +117,18 @@ impl Plaintext { self.0.to_string() } + /// Gives the type of the plaintext. + /// + /// @returns {string} The type of the plaintext. + #[wasm_bindgen(js_name = "plaintextType")] + pub fn plaintext_type(&self) -> String { + match &self.0 { + PlaintextNative::Literal(literal, _) => literal.to_type().type_name().to_string(), + PlaintextNative::Struct(..) => "struct".to_string(), + PlaintextNative::Array(..) => "array".to_string(), + } + } + /// Attempt to convert the plaintext to a JS object. /// /// @returns {Object} The JS object representation of the plaintext. @@ -165,7 +178,7 @@ mod tests { use wasm_bindgen_test::wasm_bindgen_test; - const STRUCT: &str = "{ microcredits: 100000000u64, height: 1653124u32 }"; + const STRUCT: &str = "{\n microcredits: 100000000u64,\n height: 1653124u32\n}"; const NESTED_STRUCT: &str = "{ player: aleo13nnjqa7h2u4mpl95guz97nhzkhlde750zsjnw59tkgdwc85lyurs295lxc, health: 100u8, inventory: { coins: 5u32, snacks: { candies: 5u64, vegetals: 6u64 } }, secret: 2group, cipher: 2scalar, is_alive: true }"; diff --git a/wasm/src/programs/manager/execute.rs b/wasm/src/programs/manager/execute.rs index b24d8f511..4ca185633 100644 --- a/wasm/src/programs/manager/execute.rs +++ b/wasm/src/programs/manager/execute.rs @@ -15,7 +15,6 @@ // along with the Aleo SDK library. If not, see <https://www.gnu.org/licenses/>. use super::*; -use core::ops::Add; use crate::{ execute_fee, @@ -31,14 +30,19 @@ use crate::{ use crate::types::native::{ CurrentAleo, + CurrentNetwork, IdentifierNative, ProcessNative, ProgramNative, RecordPlaintextNative, TransactionNative, }; +use core::ops::Add; use js_sys::{Array, Object}; use rand::{rngs::StdRng, SeedableRng}; +use snarkvm_console::prelude::Network; +use snarkvm_ledger_query::QueryTrait; +use snarkvm_synthesizer::prelude::cost_in_microcredits_v1; use std::str::FromStr; #[wasm_bindgen] @@ -284,12 +288,17 @@ impl ProgramManager { let node_url = url.as_deref().unwrap_or(DEFAULT_URL); let program = ProgramNative::from_str(program).map_err(|err| err.to_string())?; let locator = program.id().to_string().add("/").add(function); - if let Some(offline_query) = offline_query { + + let block_height = if let Some(offline_query) = offline_query { + let block_height = offline_query.current_block_height().map_err(|e| e.to_string())?; trace.prepare_async(offline_query).await.map_err(|err| err.to_string())?; + block_height } else { let query = QueryNative::from(node_url); + let block_height = query.current_block_height_async().await.map_err(|e| e.to_string())?; trace.prepare_async(query).await.map_err(|err| err.to_string())?; - } + block_height + }; let execution = trace.prove_execution::<CurrentAleo, _>(&locator, rng).map_err(|e| e.to_string())?; // Get the storage cost in bytes for the program execution @@ -306,7 +315,11 @@ impl ProgramManager { let stack = process.get_stack(program_id).map_err(|e| e.to_string())?; // Calculate the finalize cost for the function identified in the transition - let cost = cost_in_microcredits(stack, function_name).map_err(|e| e.to_string())?; + let cost = if block_height >= CurrentNetwork::CONSENSUS_V2_HEIGHT { + cost_in_microcredits_v2(stack, function_name).map_err(|e| e.to_string())? + } else { + cost_in_microcredits_v1(stack, function_name).map_err(|e| e.to_string())? + }; // Accumulate the finalize cost. finalize_cost = finalize_cost @@ -339,6 +352,6 @@ impl ProgramManager { let stack = process.get_stack(program.id()).map_err(|e| e.to_string())?; - cost_in_microcredits(stack, &function_id).map_err(|e| e.to_string()) + cost_in_microcredits_v2(stack, &function_id).map_err(|e| e.to_string()) } } diff --git a/wasm/src/programs/manager/mod.rs b/wasm/src/programs/manager/mod.rs index 7fcd6457c..d719692ca 100644 --- a/wasm/src/programs/manager/mod.rs +++ b/wasm/src/programs/manager/mod.rs @@ -25,7 +25,7 @@ const DEFAULT_URL: &str = "https://api.explorer.provable.com/v1"; use crate::{KeyPair, PrivateKey, ProvingKey, RecordPlaintext, VerifyingKey}; use crate::types::native::{ - cost_in_microcredits, + cost_in_microcredits_v2, deployment_cost, IdentifierNative, ProcessNative, diff --git a/wasm/src/programs/offline_query.rs b/wasm/src/programs/offline_query.rs index 14f3e4cc9..ad85f0092 100644 --- a/wasm/src/programs/offline_query.rs +++ b/wasm/src/programs/offline_query.rs @@ -31,6 +31,7 @@ use std::str::FromStr; #[wasm_bindgen] #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] pub struct OfflineQuery { + block_height: u32, state_paths: IndexMap<Field<CurrentNetwork>, StatePath<CurrentNetwork>>, state_root: <CurrentNetwork as Network>::StateRoot, } @@ -39,9 +40,15 @@ pub struct OfflineQuery { impl OfflineQuery { /// Creates a new offline query object. The state root is required to be passed in as a string #[wasm_bindgen(constructor)] - pub fn new(state_root: &str) -> Result<OfflineQuery, String> { + pub fn new(block_height: u32, state_root: &str) -> Result<OfflineQuery, String> { let state_root = <CurrentNetwork as Network>::StateRoot::from_str(state_root).map_err(|e| e.to_string())?; - Ok(Self { state_paths: IndexMap::new(), state_root }) + Ok(Self { block_height, state_paths: IndexMap::new(), state_root }) + } + + /// Add a new block height to the offline query object. + #[wasm_bindgen(js_name = "addBlockHeight")] + pub fn add_block_height(&mut self, block_height: u32) { + self.block_height = block_height; } /// Add a new state path to the offline query object. @@ -93,6 +100,14 @@ impl QueryTrait<CurrentNetwork> for OfflineQuery { ) -> anyhow::Result<StatePath<CurrentNetwork>> { self.state_paths.get(commitment).cloned().ok_or(anyhow!("State path not found for commitment")) } + + fn current_block_height(&self) -> anyhow::Result<u32> { + Ok(self.block_height) + } + + async fn current_block_height_async(&self) -> anyhow::Result<u32> { + Ok(self.block_height) + } } #[cfg(test)] @@ -101,15 +116,14 @@ mod tests { use wasm_bindgen_test::*; - const OFFLINE_QUERY: &str = - r#"{"state_paths":{},"state_root":"sr1wjueje6hy86yw9j4lhl7jwvhjxwunw34paj4k3cn2wm5h5r2syfqd83yw4"}"#; + const OFFLINE_QUERY: &str = r#"{"block_height":0,"state_paths":{},"state_root":"sr1wjueje6hy86yw9j4lhl7jwvhjxwunw34paj4k3cn2wm5h5r2syfqd83yw4"}"#; //const RECORD: &str = "{ owner: aleo1rlwt9w0fl242h40w454m68vttd6vm4lmetu5r57unm5g354y9yzsyexf0y.private, microcredits: 1000000u64.private, _nonce: 2899260364216345893364017846447050369739821279831870104066405119445828210771group.public}"; //const RECORD_STATE_PATH: &str = "path1q96tnxt82uslg3ck2h7ll6fej7gemjd6x58k2k68zdfmwj7sd2q39u24qgqqqqqqqz8vhmupdu4wg3cv08ul4sjlz6je764cznh6ye9qkuc57272er7qzzy3nhhnyfxkvfs2m8zplzsxq2ctf2u5edwp0yavvyxsz54c99qrfs9aay3vhyecmc8f560glgmqv9c0awkg3upuj9rtm5u8t36dyyz7jsksttvfdkd75znvh6h83lqpq6q0eclym87t8ra2days24ew5racm54fffl3z4u2c29tzwykys7plxmct7khyuddgh6268ywgzyfzxe4uqm5svma27ptqccznezwmkj0vcpma3e9vu5lun96knvf5qus44sz5093p5wcdxwkjjr356knt65wjpnzpek2ad789req5e67rqqwrln54hlvhefl2xg36g6n2dn06k6l5jwn3y8xtlfg60wcr5huzvxluvc62x7sx74rpvjldq67v7fmtj0n3mvmczqg5dunz8aa7dumzpkehlddjk7gpjcn0fselmwx08ggf0vtfr4lvr6mpjycgtvfres5qwsgsu25xd27p23f4czqalhf3fhyvg4evwa2u4y27f2q59khvhjsfkqrr67gkw23s47vrmql5q0uk8cp63dpr4ttdehtq8rls0zmj2qvtns3uqeg2fann8e777nhmsddggxn3x67203309kngauujtuw0g8436902ggxze9cfprv8nh8n265phfls95ud9lfzwnvj80let33cpt2x5c5avy0czx3m5vv3ra8r0cw2f2e22dz72lzwkl3c5z8qfuupgs7xhpg42areg227kkflyhpn0cj260yhpeg567fkskljmv7zckqwz6rnk6l2yg7xpeyc3dy907wefjn5w35prnacapd4acn20qeldgwwmuev0d8t6tz02x2kv8qg9sxhakx6fmw5rd35fda735pchuct5gcg9v7559gaxswfjytkkhslq44kvj8ld2pj29xvvqdlsn6zez45pyyzk022z5wng8yez9mttc0s26mxfrlk4qe9znxxqxlcfapv326qjzpt849p28f5rjv3za44u8c9ddny3lm2svj3fnrqr0uy7skg4dqfpq4n6js4r56pexg3w667ruzkkejgla4gxfg5e3sph7z0gty2ksyss2eafg236dqunyghdd0p7pttvey0765ry52vccqmlp859j9tgzgg9v7559gaxswfjytkkhslq44kvj8ld2pj29xvvqdlsn6zez45pyyzk022z5wng8yez9mttc0s26mxfrlk4qe9znxxqxlcfapv326qjzpt849p28f5rjv3za44u8c9ddny3lm2svj3fnrqr0uy7skg4dqfpq4n6js4r56pexg3w667ruzkkejgla4gxfg5e3sph7z0gty2ksyss2eafg236dqunyghdd0p7pttvey0765ry52vccqmlp859j9tgzgg9v7559gaxswfjytkkhslq44kvj8ld2pj29xvvqdlsn6zez45pyyzk022z5wng8yez9mttc0s26mxfrlk4qe9znxxqxlcfapv326qjzpt849p28f5rjv3za44u8c9ddny3lm2svj3fnrqr0uy7skg4dqfpq4n6js4r56pexg3w667ruzkkejgla4gxfg5e3sph7z0gty2ksyxqgy0ryzze4sllaq3hvhsk90h2qhx308xmfg63n740w6wjrk3qgl99r8gr9efj5yeddqdetk6n8cww9sawuhes4l5tan0zctne6n6px58ez93eujhk4qrreq9m0a9m54s93f4zvfa25k0a4w79gfl9grp5qsqqqqqqqqqqzr7mae3y6kkgqc3q3u2cte5vu328u7slgw9dnw9zu4x6uyvt5apykyzgq7g2pjq384shpxqvenrf2xzqpe6era69vcprljemjfu7rq98km83fkceft37tef3l5yd0u3d0vklnrre0xxus0x4cuy48dafs9q8a9z296cvk40q48sva0ndq7uhz4fk87xxrkku9x487afcaus0fpqqsqqqqqqqqqqzzpt849p28f5rjv3za44u8c9ddny3lm2svj3fnrqr0uy7skg4dqgcnhf9dy704t3qcqwfz2zn23tyaax8uyfw9rflmz807edsq542qdss2eafg236dqunyghdd0p7pttvey0765ry52vccqmlp859j9tgzgg9v7559gaxswfjytkkhslq44kvj8ld2pj29xvvqdlsn6zez45pyyzk022z5wng8yez9mttc0s26mxfrlk4qe9znxxqxlcfapv326qjzpt849p28f5rjv3za44u8c9ddny3lm2svj3fnrqr0uy7skg4dqfpq4n6js4r56pexg3w667ruzkkejgla4gxfg5e3sph7z0gty2ksyss2eafg236dqunyghdd0p7pttvey0765ry52vccqmlp859j9tgzgg9v7559gaxswfjytkkhslq44kvj8ld2pj29xvvqdlsn6zez45pyyzk022z5wng8yez9mttc0s26mxfrlk4qe9znxxqxlcfapv326qjzpt849p28f5rjv3za44u8c9ddny3lm2svj3fnrqr0uy7skg4dqfpq4n6js4r56pexg3w667ruzkkejgla4gxfg5e3sph7z0gty2ksyss2eafg236dqunyghdd0p7pttvey0765ry52vccqmlp859j9tgzgg9v7559gaxswfjytkkhslq44kvj8ld2pj29xvvqdlsn6zez45pyyzk022z5wng8yez9mttc0s26mxfrlk4qe9znxxqxlcfapv326qjzpt849p28f5rjv3za44u8c9ddny3lm2svj3fnrqr0uy7skg4dqfvfkqsgfjgwe874pq983afd72ptcv6hx664appmslfk2jptvjecdqqqqqqqqqqqqppq4n6js4r56pexg3w667ruzkkejgla4gxfg5e3sph7z0gty2ksyss2eafg236dqunyghdd0p7pttvey0765ry52vccqmlp859j9tgzgg9v7559gaxswfjytkkhslq44kvj8ld2pj29xvvqdlsn6zez45pyyzk022z5wng8yez9mttc0s26mxfrlk4qe9znxxqxlcfapv326qjzpt849p28f5rjv3za44u8c9ddny3lm2svj3fnrqr0uy7skg4dqgqgqqzk3ftj0dmy8gphrl85l8cfgrf8vpzdflzw7zu4ppfnxsn3vv2wqvatgjpp5234t647yyh37w3jmz37yyur5c5cg4rxgpwjecnpm2xsrceze3ptsf2gw50t0zznhzx0an9ezz8zfa37kxkw8ucw7f3gwlvqsyqqqqqqqqqqq0ylf8je3k7c464x6fpcur8s7ju93yum7kyq0p6hjkqdg24smwsz9vllufwczy2t0v3elfsv5ymkh8rp34acu9cc0rhjut7d9x684cqvyzk022z5wng8yez9mttc0s26mxfrlk4qe9znxxqxlcfapv326qjzpt849p28f5rjv3za44u8c9ddny3lm2svj3fnrqr0uy7skg4dqfpq4n6js4r56pexg3w667ruzkkejgla4gxfg5e3sph7z0gty2ksyqypq8m5dp6ejcmzg46vm4ng7xvxrya7dd4z5qam2afc8gclnkz50cgsgkwy6dt"; const STATE_ROOT: &str = "sr1wjueje6hy86yw9j4lhl7jwvhjxwunw34paj4k3cn2wm5h5r2syfqd83yw4"; #[wasm_bindgen_test] fn test_to_string_and_from_string() { - let offline_query = OfflineQuery::new(STATE_ROOT).unwrap(); + let offline_query = OfflineQuery::new(0, STATE_ROOT).unwrap(); assert_eq!(offline_query.to_string(), OFFLINE_QUERY); let offline_query_from_str = OfflineQuery::from_string(OFFLINE_QUERY).unwrap(); diff --git a/wasm/src/record/record_plaintext.rs b/wasm/src/record/record_plaintext.rs index 5a54ab464..5d52ac2e4 100644 --- a/wasm/src/record/record_plaintext.rs +++ b/wasm/src/record/record_plaintext.rs @@ -68,6 +68,7 @@ impl RecordPlaintext { Self::from_str(record).map_err(|_| "The record plaintext string provided was invalid".into()) } + #[wasm_bindgen(js_name = getMember)] pub fn get_member(&self, input: String) -> Result<Plaintext, String> { let entry = self .0 @@ -140,7 +141,7 @@ impl RecordPlaintext { /// assert(JSON.stringify(record_plaintext_object) == JSON.stringify(expected_object)); /// /// @returns {Object} Javascript object representation of the record - #[wasm_bindgen(js_name = "getRecordMembers")] + #[wasm_bindgen(js_name = "toJsObject")] pub fn to_js_object(&self) -> Result<Object, String> { record_to_js_object(&self.0) } diff --git a/wasm/src/types/field.rs b/wasm/src/types/field.rs index 5184d0d2d..84f85f7fb 100644 --- a/wasm/src/types/field.rs +++ b/wasm/src/types/field.rs @@ -18,13 +18,14 @@ use crate::{ types::native::{FieldNative, LiteralNative, PlaintextNative, Uniform}, Plaintext, }; -use snarkvm_console::prelude::{Double, One, Pow}; +use snarkvm_console::prelude::{Double, One, Pow, Zero}; use std::ops::Deref; use once_cell::sync::OnceCell; use std::str::FromStr; use wasm_bindgen::prelude::wasm_bindgen; +/// Field element. #[wasm_bindgen] #[derive(Clone, Debug, Eq, PartialEq)] pub struct Field(FieldNative); @@ -87,6 +88,11 @@ impl Field { Field(-self.0) } + /// Get the zero element of the field. + pub fn zero() -> Field { + Field(FieldNative::zero()) + } + /// Get the one element of the field. pub fn one() -> Field { Field(FieldNative::one()) @@ -96,6 +102,11 @@ impl Field { pub fn double(&self) -> Field { Field(self.0.double()) } + + /// Check if one field element equals another. + pub fn equals(&self, other: &Field) -> bool { + self.0 == FieldNative::from(other) + } } impl Deref for Field { diff --git a/wasm/src/types/group.rs b/wasm/src/types/group.rs index 51b99ffca..039dc5c7a 100644 --- a/wasm/src/types/group.rs +++ b/wasm/src/types/group.rs @@ -22,13 +22,13 @@ use crate::{ Field, Plaintext, }; -use snarkvm_console::prelude::Double; -use std::ops::Deref; +use snarkvm_console::prelude::{Double, Zero}; use once_cell::sync::OnceCell; -use std::str::FromStr; +use std::{ops::Deref, str::FromStr}; use wasm_bindgen::prelude::wasm_bindgen; +/// Elliptic curve element. #[wasm_bindgen] #[derive(Clone, Debug, Eq, PartialEq)] pub struct Group(GroupNative); @@ -77,6 +77,7 @@ impl Group { } /// Multiply a group element by a scalar element. + #[wasm_bindgen(js_name = scalarMultiply)] pub fn scalar_multiply(&self, scalar: &Scalar) -> Group { Group(self.0 * **scalar) } @@ -86,10 +87,26 @@ impl Group { Group(self.0.double()) } - /// Get the negation of the group element. - pub fn negate(&self) -> Group { + /// Get the inverse of the group element. This is the reflection of the point about the axis + /// of symmetry i.e. (x,y) -> (x, -y). + pub fn inverse(&self) -> Group { Group(-self.0) } + + /// Check if one group element equals another. + pub fn equals(&self, other: &Group) -> bool { + self.0 == GroupNative::from(other) + } + + /// Get the group identity element under the group operation (i.e. the point at infinity.) + pub fn zero() -> Group { + Group::from(GroupNative::zero()) + } + + /// Get the generator of the group. + pub fn generator() -> Group { + Group::from(GroupNative::generator()) + } } impl Deref for Group { diff --git a/wasm/src/types/native.rs b/wasm/src/types/native.rs index 88694464a..1e3459e73 100644 --- a/wasm/src/types/native.rs +++ b/wasm/src/types/native.rs @@ -41,7 +41,7 @@ use snarkvm_ledger_block::{Execution, Input, Output, Transaction, Transition}; pub use snarkvm_ledger_query::Query; pub use snarkvm_ledger_store::helpers::memory::BlockMemory; pub use snarkvm_synthesizer::{ - process::{cost_in_microcredits, deployment_cost}, + process::{cost_in_microcredits_v2, deployment_cost}, snark::{ProvingKey, VerifyingKey}, Process, Program, diff --git a/wasm/src/types/scalar.rs b/wasm/src/types/scalar.rs index 0d6933b98..65b5389df 100644 --- a/wasm/src/types/scalar.rs +++ b/wasm/src/types/scalar.rs @@ -15,7 +15,7 @@ // along with the Aleo SDK library. If not, see <https://www.gnu.org/licenses/>. use crate::types::native::{PlaintextNative, ScalarNative, Uniform}; -use snarkvm_console::prelude::{Double, One, Pow}; +use snarkvm_console::prelude::{Double, One, Pow, Zero}; use std::ops::Deref; use crate::{types::native::LiteralNative, Plaintext}; @@ -23,6 +23,7 @@ use once_cell::sync::OnceCell; use std::str::FromStr; use wasm_bindgen::prelude::wasm_bindgen; +/// Scalar field element. #[wasm_bindgen] #[derive(Clone, Debug, Eq, PartialEq)] pub struct Scalar(ScalarNative); @@ -54,22 +55,22 @@ impl Scalar { Scalar(ScalarNative::rand(rng)) } - /// Add two field elements. + /// Add two scalar elements. pub fn add(&self, other: &Scalar) -> Scalar { Scalar(self.0 + other.0) } - /// Subtract two field elements. + /// Subtract two scalar elements. pub fn subtract(&self, other: &Scalar) -> Scalar { Scalar(self.0 - other.0) } - /// Multiply two field elements. + /// Multiply two scalar elements. pub fn multiply(&self, other: &Scalar) -> Scalar { Scalar(self.0 * other.0) } - /// Divide two field elements. + /// Divide two scalar elements. pub fn divide(&self, other: &Scalar) -> Scalar { Scalar(self.0 / other.0) } @@ -79,12 +80,12 @@ impl Scalar { Scalar(self.0.double()) } - /// Power of a field element. + /// Power of a scalar element. pub fn pow(&self, other: &Scalar) -> Scalar { Scalar(self.0.pow(other.0)) } - /// Invert the field element. + /// Invert the scalar element. pub fn inverse(&self) -> Scalar { Scalar(-self.0) } @@ -93,6 +94,16 @@ impl Scalar { pub fn one() -> Scalar { Scalar(ScalarNative::one()) } + + /// Creates a zero valued element of the scalar field + pub fn zero() -> Scalar { + Scalar(ScalarNative::zero()) + } + + /// Check if one scalar element equals another. + pub fn equals(&self, other: &Scalar) -> bool { + self.0 == ScalarNative::from(other) + } } impl Deref for Scalar { diff --git a/website/package.json b/website/package.json index 543468cf2..914802823 100644 --- a/website/package.json +++ b/website/package.json @@ -14,7 +14,7 @@ "deploy": "gh-pages -d dist" }, "dependencies": { - "@provablehq/sdk": "^0.7.0", + "@provablehq/sdk": "^0.7.6", "@ant-design/icons": "^4.4.0", "@codemirror/language": "^6.8.0", "@codemirror/legacy-modes": "^6.3.3", diff --git a/yarn.lock b/yarn.lock index d91e0c7a5..954a134c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -105,7 +105,7 @@ resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.4.tgz" integrity sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ== -"@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.0.0-0 || ^8.0.0-0 <8.0.0", "@babel/core@^7.12.0", "@babel/core@^7.13.0", "@babel/core@^7.17.2", "@babel/core@^7.23.7", "@babel/core@^7.24.5", "@babel/core@^7.4.0 || ^8.0.0-0 <8.0.0", "@babel/core@^7.7.5": +"@babel/core@^7.17.2", "@babel/core@^7.23.7", "@babel/core@^7.24.5", "@babel/core@^7.7.5": version "7.25.2" resolved "https://registry.npmjs.org/@babel/core/-/core-7.25.2.tgz" integrity sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA== @@ -1263,7 +1263,7 @@ style-mod "^4.0.0" w3c-keyname "^2.2.4" -"@codemirror/view@^6.0.0", "@codemirror/view@^6.17.0", "@codemirror/view@^6.23.0", "@codemirror/view@^6.27.0", "@codemirror/view@>=6.0.0": +"@codemirror/view@^6.0.0", "@codemirror/view@^6.17.0", "@codemirror/view@^6.23.0", "@codemirror/view@^6.27.0": version "6.33.0" resolved "https://registry.npmjs.org/@codemirror/view/-/view-6.33.0.tgz" integrity sha512-AroaR3BvnjRW8fiZBalAaK+ZzB5usGgI014YKElYZvQdNH5ZIidHlO+cyf/2rWzyBFRkvG6VhiXeAEbC53P2YQ== @@ -1299,6 +1299,56 @@ resolved "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz" integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg== +"@esbuild/aix-ppc64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz#51299374de171dbd80bb7d838e1cfce9af36f353" + integrity sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ== + +"@esbuild/android-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz#bafb75234a5d3d1b690e7c2956a599345e84a2fd" + integrity sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA== + +"@esbuild/android-arm64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz#984b4f9c8d0377443cc2dfcef266d02244593622" + integrity sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ== + +"@esbuild/android-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz#58565291a1fe548638adb9c584237449e5e14018" + integrity sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw== + +"@esbuild/android-arm@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.19.tgz#5898f7832c2298bc7d0ab53701c57beb74d78b4d" + integrity sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A== + +"@esbuild/android-arm@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.18.20.tgz#fedb265bc3a589c84cc11f810804f234947c3682" + integrity sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw== + +"@esbuild/android-arm@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.23.1.tgz#5eb8c652d4c82a2421e3395b808e6d9c42c862ee" + integrity sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ== + +"@esbuild/android-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.19.tgz#658368ef92067866d95fb268719f98f363d13ae1" + integrity sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww== + +"@esbuild/android-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.18.20.tgz#35cf419c4cfc8babe8893d296cd990e9e9f756f2" + integrity sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg== + +"@esbuild/android-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.23.1.tgz#ae19d665d2f06f0f48a6ac9a224b3f672e65d517" + integrity sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg== + "@esbuild/darwin-arm64@0.17.19": version "0.17.19" resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz" @@ -1314,6 +1364,281 @@ resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz" integrity sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q== +"@esbuild/darwin-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz#7751d236dfe6ce136cce343dce69f52d76b7f6cb" + integrity sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw== + +"@esbuild/darwin-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz#d70d5790d8bf475556b67d0f8b7c5bdff053d85d" + integrity sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ== + +"@esbuild/darwin-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz#c58353b982f4e04f0d022284b8ba2733f5ff0931" + integrity sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw== + +"@esbuild/freebsd-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz#cacd171665dd1d500f45c167d50c6b7e539d5fd2" + integrity sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ== + +"@esbuild/freebsd-arm64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz#98755cd12707f93f210e2494d6a4b51b96977f54" + integrity sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw== + +"@esbuild/freebsd-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz#f9220dc65f80f03635e1ef96cfad5da1f446f3bc" + integrity sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA== + +"@esbuild/freebsd-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz#0769456eee2a08b8d925d7c00b79e861cb3162e4" + integrity sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ== + +"@esbuild/freebsd-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz#c1eb2bff03915f87c29cece4c1a7fa1f423b066e" + integrity sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ== + +"@esbuild/freebsd-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz#69bd8511fa013b59f0226d1609ac43f7ce489730" + integrity sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g== + +"@esbuild/linux-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz#38e162ecb723862c6be1c27d6389f48960b68edb" + integrity sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg== + +"@esbuild/linux-arm64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz#bad4238bd8f4fc25b5a021280c770ab5fc3a02a0" + integrity sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA== + +"@esbuild/linux-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz#8050af6d51ddb388c75653ef9871f5ccd8f12383" + integrity sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g== + +"@esbuild/linux-arm@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz#1a2cd399c50040184a805174a6d89097d9d1559a" + integrity sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA== + +"@esbuild/linux-arm@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz#3e617c61f33508a27150ee417543c8ab5acc73b0" + integrity sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg== + +"@esbuild/linux-arm@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz#ecaabd1c23b701070484990db9a82f382f99e771" + integrity sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ== + +"@esbuild/linux-ia32@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz#e28c25266b036ce1cabca3c30155222841dc035a" + integrity sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ== + +"@esbuild/linux-ia32@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz#699391cccba9aee6019b7f9892eb99219f1570a7" + integrity sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA== + +"@esbuild/linux-ia32@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz#3ed2273214178109741c09bd0687098a0243b333" + integrity sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ== + +"@esbuild/linux-loong64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz#0f887b8bb3f90658d1a0117283e55dbd4c9dcf72" + integrity sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ== + +"@esbuild/linux-loong64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz#e6fccb7aac178dd2ffb9860465ac89d7f23b977d" + integrity sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg== + +"@esbuild/linux-loong64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz#a0fdf440b5485c81b0fbb316b08933d217f5d3ac" + integrity sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw== + +"@esbuild/linux-mips64el@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz#f5d2a0b8047ea9a5d9f592a178ea054053a70289" + integrity sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A== + +"@esbuild/linux-mips64el@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz#eeff3a937de9c2310de30622a957ad1bd9183231" + integrity sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ== + +"@esbuild/linux-mips64el@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz#e11a2806346db8375b18f5e104c5a9d4e81807f6" + integrity sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q== + +"@esbuild/linux-ppc64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz#876590e3acbd9fa7f57a2c7d86f83717dbbac8c7" + integrity sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg== + +"@esbuild/linux-ppc64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz#2f7156bde20b01527993e6881435ad79ba9599fb" + integrity sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA== + +"@esbuild/linux-ppc64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz#06a2744c5eaf562b1a90937855b4d6cf7c75ec96" + integrity sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw== + +"@esbuild/linux-riscv64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz#7f49373df463cd9f41dc34f9b2262d771688bf09" + integrity sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA== + +"@esbuild/linux-riscv64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz#6628389f210123d8b4743045af8caa7d4ddfc7a6" + integrity sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A== + +"@esbuild/linux-riscv64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz#65b46a2892fc0d1af4ba342af3fe0fa4a8fe08e7" + integrity sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA== + +"@esbuild/linux-s390x@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz#e2afd1afcaf63afe2c7d9ceacd28ec57c77f8829" + integrity sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q== + +"@esbuild/linux-s390x@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz#255e81fb289b101026131858ab99fba63dcf0071" + integrity sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ== + +"@esbuild/linux-s390x@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz#e71ea18c70c3f604e241d16e4e5ab193a9785d6f" + integrity sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw== + +"@esbuild/linux-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz#8a0e9738b1635f0c53389e515ae83826dec22aa4" + integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== + +"@esbuild/linux-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz#c7690b3417af318a9b6f96df3031a8865176d338" + integrity sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w== + +"@esbuild/linux-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz#d47f97391e80690d4dfe811a2e7d6927ad9eed24" + integrity sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ== + +"@esbuild/netbsd-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz#c29fb2453c6b7ddef9a35e2c18b37bda1ae5c462" + integrity sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q== + +"@esbuild/netbsd-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz#30e8cd8a3dded63975e2df2438ca109601ebe0d1" + integrity sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A== + +"@esbuild/netbsd-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz#44e743c9778d57a8ace4b72f3c6b839a3b74a653" + integrity sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA== + +"@esbuild/openbsd-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz#05c5a1faf67b9881834758c69f3e51b7dee015d7" + integrity sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q== + +"@esbuild/openbsd-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz#95e75a391403cb10297280d524d66ce04c920691" + integrity sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g== + +"@esbuild/openbsd-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz#7812af31b205055874c8082ea9cf9ab0da6217ae" + integrity sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg== + +"@esbuild/openbsd-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz#2e58ae511bacf67d19f9f2dcd9e8c5a93f00c273" + integrity sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA== + +"@esbuild/sunos-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz#722eaf057b83c2575937d3ffe5aeb16540da7273" + integrity sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg== + +"@esbuild/sunos-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz#d5c275c3b4e73c9b0ecd38d1ca62c020f887ab9d" + integrity sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ== + +"@esbuild/sunos-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz#adb022b959d18d3389ac70769cef5a03d3abd403" + integrity sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA== + +"@esbuild/win32-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz#9aa9dc074399288bdcdd283443e9aeb6b9552b6f" + integrity sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag== + +"@esbuild/win32-arm64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz#73bc7f5a9f8a77805f357fab97f290d0e4820ac9" + integrity sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg== + +"@esbuild/win32-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz#84906f50c212b72ec360f48461d43202f4c8b9a2" + integrity sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A== + +"@esbuild/win32-ia32@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz#95ad43c62ad62485e210f6299c7b2571e48d2b03" + integrity sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw== + +"@esbuild/win32-ia32@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz#ec93cbf0ef1085cc12e71e0d661d20569ff42102" + integrity sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g== + +"@esbuild/win32-ia32@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz#5e3eacc515820ff729e90d0cb463183128e82fac" + integrity sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ== + +"@esbuild/win32-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz#8cfaf2ff603e9aabb910e9c0558c26cf32744061" + integrity sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA== + +"@esbuild/win32-x64@0.18.20": + version "0.18.20" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz#786c5f41f043b07afb1af37683d7c33668858f6d" + integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ== + +"@esbuild/win32-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz#81fd50d11e2c32b2d6241470e3185b70c7b30699" + integrity sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg== + "@eslint-community/eslint-utils@^4.2.0": version "4.4.0" resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz" @@ -1419,14 +1744,6 @@ resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz" integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": - version "0.3.25" - resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz" - integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== - dependencies: - "@jridgewell/resolve-uri" "^3.1.0" - "@jridgewell/sourcemap-codec" "^1.4.14" - "@jridgewell/trace-mapping@0.3.9": version "0.3.9" resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz" @@ -1435,6 +1752,14 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": + version "0.3.25" + resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + "@jsdoc/salty@^0.2.4": version "0.2.8" resolved "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.8.tgz" @@ -1488,6 +1813,46 @@ resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.5.4.tgz" integrity sha512-Df8SHuXgF1p+aonBMcDPEsaahNo2TCwuie7VXED4FVyECvdXfRT9unapm54NssV9tF3OQFKBFOdlje4T43VO0w== +"@next/swc-darwin-x64@13.5.4": + version "13.5.4" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.4.tgz#fa11bb97bf06cd45cbd554354b46bf93e22c025b" + integrity sha512-siPuUwO45PnNRMeZnSa8n/Lye5ZX93IJom9wQRB5DEOdFrw0JjOMu1GINB8jAEdwa7Vdyn1oJ2xGNaQpdQQ9Pw== + +"@next/swc-linux-arm64-gnu@13.5.4": + version "13.5.4" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.4.tgz#dd3a482cd6871ed23b049066a0f3c4c2f955dc88" + integrity sha512-l/k/fvRP/zmB2jkFMfefmFkyZbDkYW0mRM/LB+tH5u9pB98WsHXC0WvDHlGCYp3CH/jlkJPL7gN8nkTQVrQ/2w== + +"@next/swc-linux-arm64-musl@13.5.4": + version "13.5.4" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.4.tgz#ed6d7abaf5712cff2752ce5300d6bacc6aff1b18" + integrity sha512-YYGb7SlLkI+XqfQa8VPErljb7k9nUnhhRrVaOdfJNCaQnHBcvbT7cx/UjDQLdleJcfyg1Hkn5YSSIeVfjgmkTg== + +"@next/swc-linux-x64-gnu@13.5.4": + version "13.5.4" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.4.tgz#977a040388e8a685a3a85e0dbdff90a4ee2a7189" + integrity sha512-uE61vyUSClnCH18YHjA8tE1prr/PBFlBFhxBZis4XBRJoR+txAky5d7gGNUIbQ8sZZ7LVkSVgm/5Fc7mwXmRAg== + +"@next/swc-linux-x64-musl@13.5.4": + version "13.5.4" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.4.tgz#3e29a0ad8efc016196c3a120da04397eea328b2a" + integrity sha512-qVEKFYML/GvJSy9CfYqAdUexA6M5AklYcQCW+8JECmkQHGoPxCf04iMh7CPR7wkHyWWK+XLt4Ja7hhsPJtSnhg== + +"@next/swc-win32-arm64-msvc@13.5.4": + version "13.5.4" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.4.tgz#18a236c3fe5a48d24b56d939e6a05488bb682b7e" + integrity sha512-mDSQfqxAlfpeZOLPxLymZkX0hYF3juN57W6vFHTvwKlnHfmh12Pt7hPIRLYIShk8uYRsKPtMTth/EzpwRI+u8w== + +"@next/swc-win32-ia32-msvc@13.5.4": + version "13.5.4" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.4.tgz#255132243ab6fb20d3c7c92a585e2c4fa50368fe" + integrity sha512-aoqAT2XIekIWoriwzOmGFAvTtVY5O7JjV21giozBTP5c6uZhpvTWRbmHXbmsjZqY4HnEZQRXWkSAppsIBweKqw== + +"@next/swc-win32-x64-msvc@13.5.4": + version "13.5.4" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.4.tgz#cc542907b55247c5634d9a8298e1c143a1847e25" + integrity sha512-cyRvlAxwlddlqeB9xtPSfNSCRy8BOa4wtMo0IuI9P7Y0XT2qpDrpFKRyZ7kUngZis59mPVla5k8X1oOJ8RxDYg== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" @@ -1496,7 +1861,7 @@ "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5": +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": version "2.0.5" resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== @@ -1514,20 +1879,10 @@ resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -"@provablehq/sdk@^0.7.0", "@provablehq/sdk@file:/Users/privacydaddy/dev/sdk/sdk": - version "0.7.0" - resolved "file:sdk" - dependencies: - "@provablehq/wasm" "^0.7.0" - comlink "^4.4.1" - mime "^3.0.0" - sync-request "^6.1.0" - -"@provablehq/wasm@^0.7.0", "@provablehq/wasm@file:/Users/privacydaddy/dev/sdk/wasm": - version "0.7.0" - resolved "file:wasm" - dependencies: - yarn "^1.22.22" +"@provablehq/wasm@^0.7.2": + version "0.7.2" + resolved "https://registry.yarnpkg.com/@provablehq/wasm/-/wasm-0.7.2.tgz#3beb59583078ec40175ee76454760e8468912e2b" + integrity sha512-RARdSoyml70goROIJx7wI/1+TEiHz9q44aeUO5WxVeCBwjkkGDgFJWVSWFzlnehvKTB5yFa/vo7pgXvU45zzqA== "@rc-component/async-validator@^5.0.3": version "5.0.4" @@ -1692,11 +2047,86 @@ estree-walker "^2.0.2" picomatch "^2.3.1" +"@rollup/rollup-android-arm-eabi@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz#8b613b9725e8f9479d142970b106b6ae878610d5" + integrity sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w== + +"@rollup/rollup-android-arm64@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz#654ca1049189132ff602bfcf8df14c18da1f15fb" + integrity sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA== + "@rollup/rollup-darwin-arm64@4.22.4": version "4.22.4" resolved "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz" integrity sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q== +"@rollup/rollup-darwin-x64@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz#42bd19d292a57ee11734c980c4650de26b457791" + integrity sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw== + +"@rollup/rollup-linux-arm-gnueabihf@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz#f23555ee3d8fe941c5c5fd458cd22b65eb1c2232" + integrity sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ== + +"@rollup/rollup-linux-arm-musleabihf@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz#f3bbd1ae2420f5539d40ac1fde2b38da67779baa" + integrity sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg== + +"@rollup/rollup-linux-arm64-gnu@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz#7abe900120113e08a1f90afb84c7c28774054d15" + integrity sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw== + +"@rollup/rollup-linux-arm64-musl@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz#9e655285c8175cd44f57d6a1e8e5dedfbba1d820" + integrity sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA== + +"@rollup/rollup-linux-powerpc64le-gnu@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz#9a79ae6c9e9d8fe83d49e2712ecf4302db5bef5e" + integrity sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg== + +"@rollup/rollup-linux-riscv64-gnu@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz#67ac70eca4ace8e2942fabca95164e8874ab8128" + integrity sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA== + +"@rollup/rollup-linux-s390x-gnu@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz#9f883a7440f51a22ed7f99e1d070bd84ea5005fc" + integrity sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q== + +"@rollup/rollup-linux-x64-gnu@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz#70116ae6c577fe367f58559e2cffb5641a1dd9d0" + integrity sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg== + +"@rollup/rollup-linux-x64-musl@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz#f473f88219feb07b0b98b53a7923be716d1d182f" + integrity sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g== + +"@rollup/rollup-win32-arm64-msvc@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz#4349482d17f5d1c58604d1c8900540d676f420e0" + integrity sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw== + +"@rollup/rollup-win32-ia32-msvc@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz#a6fc39a15db618040ec3c2a24c1e26cb5f4d7422" + integrity sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g== + +"@rollup/rollup-win32-x64-msvc@4.22.4": + version "4.22.4" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz#3dd5d53e900df2a40841882c02e56f866c04d202" + integrity sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q== + "@rtsao/scc@^1.1.0": version "1.1.0" resolved "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz" @@ -1709,13 +2139,6 @@ dependencies: type-detect "4.0.8" -"@sinonjs/fake-timers@^13.0.1": - version "13.0.2" - resolved "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.2.tgz" - integrity sha512-4Bb+oqXZTSTZ1q27Izly9lv8B9dlV61CROxPiVtywwzv5SnytJqhvYe6FclHYuXml4cd1VHPo1zd5PmTeJozvA== - dependencies: - "@sinonjs/commons" "^3.0.1" - "@sinonjs/fake-timers@11.2.2": version "11.2.2" resolved "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz" @@ -1723,6 +2146,13 @@ dependencies: "@sinonjs/commons" "^3.0.0" +"@sinonjs/fake-timers@^13.0.1": + version "13.0.2" + resolved "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.2.tgz" + integrity sha512-4Bb+oqXZTSTZ1q27Izly9lv8B9dlV61CROxPiVtywwzv5SnytJqhvYe6FclHYuXml4cd1VHPo1zd5PmTeJozvA== + dependencies: + "@sinonjs/commons" "^3.0.1" + "@sinonjs/samsam@^8.0.0": version "8.0.2" resolved "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.2.tgz" @@ -1742,7 +2172,52 @@ resolved "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.7.26.tgz" integrity sha512-FF3CRYTg6a7ZVW4yT9mesxoVVZTrcSWtmZhxKCYJX9brH4CS/7PRPjAKNk6kzWgWuRoglP7hkjQcd6EpMcZEAw== -"@swc/core@^1.5.7", "@swc/core@>=1.2.50": +"@swc/core-darwin-x64@1.7.26": + version "1.7.26" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.7.26.tgz#867b7a4f094e6b64201090ca5fcbf3da7d0f3e22" + integrity sha512-az3cibZdsay2HNKmc4bjf62QVukuiMRh5sfM5kHR/JMTrLyS6vSw7Ihs3UTkZjUxkLTT8ro54LI6sV6sUQUbLQ== + +"@swc/core-linux-arm-gnueabihf@1.7.26": + version "1.7.26" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.7.26.tgz#35bb43894def296d92aaa2cc9372d48042f37777" + integrity sha512-VYPFVJDO5zT5U3RpCdHE5v1gz4mmR8BfHecUZTmD2v1JeFY6fv9KArJUpjrHEEsjK/ucXkQFmJ0jaiWXmpOV9Q== + +"@swc/core-linux-arm64-gnu@1.7.26": + version "1.7.26" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.7.26.tgz#8e2321cc4ec84cbfed8f8e16ff1ed7b854450443" + integrity sha512-YKevOV7abpjcAzXrhsl+W48Z9mZvgoVs2eP5nY+uoMAdP2b3GxC0Df1Co0I90o2lkzO4jYBpTMcZlmUXLdXn+Q== + +"@swc/core-linux-arm64-musl@1.7.26": + version "1.7.26" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.7.26.tgz#b1c16e4b23ffa9ff19973eda6ffee35d2a7de7b0" + integrity sha512-3w8iZICMkQQON0uIcvz7+Q1MPOW6hJ4O5ETjA0LSP/tuKqx30hIniCGOgPDnv3UTMruLUnQbtBwVCZTBKR3Rkg== + +"@swc/core-linux-x64-gnu@1.7.26": + version "1.7.26" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.7.26.tgz#388e2cc13a010cd28787aead2cecf31eb491836d" + integrity sha512-c+pp9Zkk2lqb06bNGkR2Looxrs7FtGDMA4/aHjZcCqATgp348hOKH5WPvNLBl+yPrISuWjbKDVn3NgAvfvpH4w== + +"@swc/core-linux-x64-musl@1.7.26": + version "1.7.26" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.7.26.tgz#51e0ff30981f26d7a5b97a7a7b5b291bad050d1a" + integrity sha512-PgtyfHBF6xG87dUSSdTJHwZ3/8vWZfNIXQV2GlwEpslrOkGqy+WaiiyE7Of7z9AvDILfBBBcJvJ/r8u980wAfQ== + +"@swc/core-win32-arm64-msvc@1.7.26": + version "1.7.26" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.7.26.tgz#a7fdcc4074c34ee6a026506b594d00323383c11f" + integrity sha512-9TNXPIJqFynlAOrRD6tUQjMq7KApSklK3R/tXgIxc7Qx+lWu8hlDQ/kVPLpU7PWvMMwC/3hKBW+p5f+Tms1hmA== + +"@swc/core-win32-ia32-msvc@1.7.26": + version "1.7.26" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.7.26.tgz#ae7be6dde798eebee2000b8fd84e01a439b5bd6a" + integrity sha512-9YngxNcG3177GYdsTum4V98Re+TlCeJEP4kEwEg9EagT5s3YejYdKwVAkAsJszzkXuyRDdnHUpYbTrPG6FiXrQ== + +"@swc/core-win32-x64-msvc@1.7.26": + version "1.7.26" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.7.26.tgz#310d607004d7319085a4dec20c0c38c3405cc05b" + integrity sha512-VR+hzg9XqucgLjXxA13MtV5O3C0bK0ywtLIBw/+a+O+Oc6mxFWHtdUeXDbIi5AiPbn0fjgVJMqYnyjGyyX8u0w== + +"@swc/core@^1.5.7": version "1.7.26" resolved "https://registry.npmjs.org/@swc/core/-/core-1.7.26.tgz" integrity sha512-f5uYFf+TmMQyYIoxkn/evWhNGuUzC730dFwAKGwBVHHVoPyak1/GvJUm6i1SKl+2Hrj9oN0i3WSoWWZ4pgI8lw== @@ -1766,7 +2241,7 @@ resolved "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz" integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ== -"@swc/helpers@*", "@swc/helpers@0.5.2": +"@swc/helpers@0.5.2": version "0.5.2" resolved "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.2.tgz" integrity sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw== @@ -1805,6 +2280,11 @@ resolved "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz" integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== +"@types/babel-types@*", "@types/babel-types@^7.0.0": + version "7.0.15" + resolved "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.15.tgz" + integrity sha512-JUgfZHUOMbtjopxiOQaaF+Uovk5wpDqpXR+XLWiOivCWSy1FccO30lvNNpCt8geFwq8VmGT2y9OMkOpA0g5O5g== + "@types/babel__core@^7.20.5": version "7.20.5" resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz" @@ -1838,11 +2318,6 @@ dependencies: "@babel/types" "^7.20.7" -"@types/babel-types@*", "@types/babel-types@^7.0.0": - version "7.0.15" - resolved "https://registry.npmjs.org/@types/babel-types/-/babel-types-7.0.15.tgz" - integrity sha512-JUgfZHUOMbtjopxiOQaaF+Uovk5wpDqpXR+XLWiOivCWSy1FccO30lvNNpCt8geFwq8VmGT2y9OMkOpA0g5O5g== - "@types/babylon@^6.16.2": version "6.16.9" resolved "https://registry.npmjs.org/@types/babylon/-/babylon-6.16.9.tgz" @@ -1966,7 +2441,7 @@ resolved "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz" integrity sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q== -"@types/markdown-it@*", "@types/markdown-it@^12.2.3": +"@types/markdown-it@^12.2.3": version "12.2.3" resolved "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz" integrity sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ== @@ -2006,7 +2481,7 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@>= 14": +"@types/node@*": version "22.5.5" resolved "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz" integrity sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA== @@ -2018,14 +2493,7 @@ resolved "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz" integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw== -"@types/node@^20": - version "20.16.5" - resolved "https://registry.npmjs.org/@types/node/-/node-20.16.5.tgz" - integrity sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA== - dependencies: - undici-types "~6.19.2" - -"@types/node@^20.8.7": +"@types/node@^20", "@types/node@^20.8.7": version "20.16.5" resolved "https://registry.npmjs.org/@types/node/-/node-20.16.5.tgz" integrity sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA== @@ -2156,7 +2624,7 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/parser@^5.0.0", "@typescript-eslint/parser@^5.41.0": +"@typescript-eslint/parser@^5.41.0": version "5.62.0" resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz" integrity sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA== @@ -2320,7 +2788,7 @@ globby "^13.2.2" magic-string "^0.30.0" -"@webassemblyjs/ast@^1.12.1", "@webassemblyjs/ast@1.12.1": +"@webassemblyjs/ast@1.12.1", "@webassemblyjs/ast@^1.12.1": version "1.12.1" resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz" integrity sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg== @@ -2421,7 +2889,7 @@ "@webassemblyjs/wasm-gen" "1.12.1" "@webassemblyjs/wasm-parser" "1.12.1" -"@webassemblyjs/wasm-parser@^1.12.1", "@webassemblyjs/wasm-parser@1.12.1": +"@webassemblyjs/wasm-parser@1.12.1", "@webassemblyjs/wasm-parser@^1.12.1": version "1.12.1" resolved "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz" integrity sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ== @@ -2508,21 +2976,16 @@ acorn@^3.1.0: resolved "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz" integrity sha512-OLUyIIZ7mF5oaAUT1w0TFqQS81q3saT46x8t7ukpPjMNk+nbs4ZHhs7ToV8EWnLYLepjETXd4XaCE4uxkMeqUw== -acorn@^4.0.4: +acorn@^4.0.4, acorn@~4.0.2: version "4.0.13" resolved "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz" integrity sha512-fu2ygVGuMmlzG8ZeRJ0bvR41nsAkxxhbyk8bZ1SS521Z7vmgJFTQQlfz/Mp/nJexGBz+v8sC9bM6+lNgskt4Ug== -"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^8, acorn@^8.11.0, acorn@^8.11.3, acorn@^8.4.1, acorn@^8.7.1, acorn@^8.8.2, acorn@^8.9.0: +acorn@^8.11.0, acorn@^8.11.3, acorn@^8.4.1, acorn@^8.7.1, acorn@^8.8.2, acorn@^8.9.0: version "8.12.1" resolved "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz" integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== -acorn@~4.0.2: - version "4.0.13" - resolved "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz" - integrity sha512-fu2ygVGuMmlzG8ZeRJ0bvR41nsAkxxhbyk8bZ1SS521Z7vmgJFTQQlfz/Mp/nJexGBz+v8sC9bM6+lNgskt4Ug== - ajv-formats@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz" @@ -2542,7 +3005,7 @@ ajv-keywords@^5.1.0: dependencies: fast-deep-equal "^3.1.3" -ajv@^6.12.4, ajv@^6.12.5, ajv@^6.9.1: +ajv@^6.12.4, ajv@^6.12.5: version "6.12.6" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -2552,7 +3015,7 @@ ajv@^6.12.4, ajv@^6.12.5, ajv@^6.9.1: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.0, ajv@^8.8.2, ajv@^8.9.0: +ajv@^8.0.0, ajv@^8.9.0: version "8.17.1" resolved "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz" integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== @@ -2562,58 +3025,6 @@ ajv@^8.0.0, ajv@^8.8.2, ajv@^8.9.0: json-schema-traverse "^1.0.0" require-from-string "^2.0.2" -"aleo-react-leo-starter@file:/Users/privacydaddy/dev/sdk/create-leo-app/template-react-leo": - version "0.0.0" - resolved "file:create-leo-app/template-react-leo" - dependencies: - "@provablehq/sdk" "^0.7.0" - comlink "^4.4.1" - react "^18.2.0" - react-dom "^18.2.0" - -"aleo-react-managed-worker-starter@file:/Users/privacydaddy/dev/sdk/create-leo-app/template-react-managed-worker": - version "0.0.0" - resolved "file:create-leo-app/template-react-managed-worker" - dependencies: - "@provablehq/sdk" "^0.7.0" - react "^18.2.0" - react-dom "^18.2.0" - -"aleo-react-typescript-starter@file:/Users/privacydaddy/dev/sdk/create-leo-app/template-react-ts": - version "0.0.0" - resolved "file:create-leo-app/template-react-ts" - dependencies: - "@provablehq/sdk" "^0.7.0" - comlink "^4.4.1" - react "^18.2.0" - react-dom "^18.2.0" - -"aleo-starter@file:/Users/privacydaddy/dev/sdk/create-leo-app/template-vanilla": - version "0.0.0" - resolved "file:create-leo-app/template-vanilla" - -"aleo-website@file:/Users/privacydaddy/dev/sdk/website": - version "0.1.0" - resolved "file:website" - dependencies: - "@ant-design/icons" "^4.4.0" - "@codemirror/language" "^6.8.0" - "@codemirror/legacy-modes" "^6.3.3" - "@codemirror/stream-parser" "^0.19.9" - "@provablehq/sdk" "^0.7.0" - "@uiw/codemirror-theme-noctis-lilac" "^4.21.8" - "@uiw/codemirror-theme-okaidia" "^4.21.7" - "@uiw/react-codemirror" "^4.21.7" - antd "^5.6.4" - axios "^1.6.0" - babel-loader "^8.2.3" - copy-to-clipboard "^3.3.1" - gh-pages "^3.1.0" - react "^18.2.0" - react-dom "^18.2.0" - react-router-dom "^6.14.1" - web-vitals "^0.2.4" - align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz" @@ -2861,7 +3272,7 @@ assertion-error@^2.0.1: resolved "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz" integrity sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA== -ast-types@^0.12.2, ast-types@0.12.4: +ast-types@0.12.4, ast-types@^0.12.2: version "0.12.4" resolved "https://registry.npmjs.org/ast-types/-/ast-types-0.12.4.tgz" integrity sha512-ky/YVYCbtVAS8TdMIaTiPFHwEpRB5z1hctepJplTr3UW5q8TDrpIMCILyk8pmLxGtn2KCtC/lSn7zOsaI7nzDw== @@ -2992,31 +3403,9 @@ batch@0.6.1: resolved "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz" integrity sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw== -"battleship@file:/Users/privacydaddy/dev/sdk/create-leo-app/template-battleship": - version "0.1.0" - resolved "file:create-leo-app/template-battleship" - dependencies: - "@ant-design/icons" "^4.4.0" - "@codemirror/language" "^6.8.0" - "@codemirror/legacy-modes" "^6.3.3" - "@codemirror/stream-parser" "^0.19.9" - "@provablehq/sdk" "^0.7.0" - "@uiw/codemirror-theme-noctis-lilac" "^4.21.8" - "@uiw/codemirror-theme-okaidia" "^4.21.7" - "@uiw/react-codemirror" "^4.21.7" - antd "^5.6.4" - axios "^1.6.0" - babel-loader "^8.2.3" - copy-to-clipboard "^3.3.1" - gh-pages "^3.1.0" - react "^18.2.0" - react-dom "^18.2.0" - react-router-dom "^6.14.1" - web-vitals "^0.2.4" - -better-docs@^2.7.2: +better-docs@^2.7.3: version "2.7.3" - resolved "https://registry.npmjs.org/better-docs/-/better-docs-2.7.3.tgz" + resolved "https://registry.yarnpkg.com/better-docs/-/better-docs-2.7.3.tgz#bdeec1b24514bc22562af2a277c2cf527abbe726" integrity sha512-OEk9e7RQUQbo1DmVo0mdsALZ+mT0SwIen7/DGnN4xKNktXKgz1j7+KQ2pObNHHVSFGu8YMQW/Ig1v6eiTkdnbw== dependencies: brace "^0.11.1" @@ -3120,7 +3509,7 @@ browser-stdout@^1.3.1: resolved "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -browserslist@^4.0.0, browserslist@^4.21.10, browserslist@^4.23.1, browserslist@^4.23.3, "browserslist@>= 4.21.0": +browserslist@^4.0.0, browserslist@^4.21.10, browserslist@^4.23.1, browserslist@^4.23.3: version "4.23.3" resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.23.3.tgz" integrity sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA== @@ -3316,7 +3705,7 @@ citty@^0.1.6: dependencies: consola "^3.2.3" -classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6, classnames@^2.3.1, classnames@^2.3.2, classnames@^2.5.1, classnames@2.x: +classnames@2.x, classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6, classnames@^2.3.1, classnames@^2.3.2, classnames@^2.5.1: version "2.5.1" resolved "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz" integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow== @@ -3335,9 +3724,9 @@ clean-css@^5.2.2, clean-css@~5.3.2: dependencies: source-map "~0.6.0" -clean-jsdoc-theme@^4.1.8: +clean-jsdoc-theme@^4.3.0: version "4.3.0" - resolved "https://registry.npmjs.org/clean-jsdoc-theme/-/clean-jsdoc-theme-4.3.0.tgz" + resolved "https://registry.yarnpkg.com/clean-jsdoc-theme/-/clean-jsdoc-theme-4.3.0.tgz#6cd55ff7b25ff6d1719ae0ff9f1cdb5ef07bf640" integrity sha512-QMrBdZ2KdPt6V2Ytg7dIt0/q32U4COpxvR0UDhPjRRKRL0o0MvRCR5YpY37/4rPF1SI1AYEKAWyof7ndCb/dzA== dependencies: "@jsdoc/salty" "^0.2.4" @@ -3406,16 +3795,16 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - color-name@1.1.3: version "1.1.3" resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + colord@^2.9.3: version "2.9.3" resolved "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz" @@ -3438,12 +3827,7 @@ comlink@^4.4.1: resolved "https://registry.npmjs.org/comlink/-/comlink-4.4.1.tgz" integrity sha512-+1dlx0aY5Jo1vHy/tSsIGpSkN4tS9rZSW8FIhG0JH/crs9wwweswIo/POr451r7bZww3hFbPAKnTpimzL/mm4Q== -commander@^10.0.0: - version "10.0.1" - resolved "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz" - integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== - -commander@^10.0.1: +commander@^10.0.0, commander@^10.0.1: version "10.0.1" resolved "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz" integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== @@ -3616,10 +4000,6 @@ cpr@^3.0.1: mkdirp "~0.5.1" rimraf "^2.5.4" -"create-leo-app@file:/Users/privacydaddy/dev/sdk/create-leo-app": - version "0.7.3" - resolved "file:create-leo-app" - create-require@^1.1.0: version "1.1.1" resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz" @@ -3794,7 +4174,7 @@ data-view-byte-offset@^1.0.0: es-errors "^1.3.0" is-data-view "^1.0.1" -dayjs@^1.11.11, "dayjs@>= 1.x": +dayjs@^1.11.11: version "1.11.13" resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz" integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg== @@ -3804,6 +4184,13 @@ de-indent@^1.0.2: resolved "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz" integrity sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg== +debug@2.6.9: + version "2.6.9" + resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + debug@^3.2.7: version "3.2.7" resolved "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz" @@ -3818,13 +4205,6 @@ debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3 dependencies: ms "^2.1.3" -debug@2.6.9: - version "2.6.9" - resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - decamelize@^1.0.0: version "1.2.0" resolved "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz" @@ -3890,16 +4270,16 @@ delayed-stream@~1.0.0: resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -depd@~1.1.2: - version "1.1.2" - resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" - integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== - depd@2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== +depd@~1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" + integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== + destroy@1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz" @@ -4086,12 +4466,7 @@ entities@^2.0.0: resolved "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz" integrity sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A== -entities@^4.2.0: - version "4.5.0" - resolved "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz" - integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== - -entities@^4.4.0: +entities@^4.2.0, entities@^4.4.0: version "4.5.0" resolved "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz" integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== @@ -4422,7 +4797,7 @@ eslint-plugin-react@^7.32.2: string.prototype.matchall "^4.0.11" string.prototype.repeat "^1.0.0" -eslint-scope@^5.1.1, eslint-scope@5.1.1: +eslint-scope@5.1.1, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz" integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== @@ -4443,7 +4818,7 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4 resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@*, "eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8", "eslint@^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7", "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0", "eslint@^6.0.0 || ^7.0.0 || ^8.0.0", "eslint@^6.0.0 || ^7.0.0 || >=8.0.0", eslint@^8.26.0, eslint@^8.38.0, eslint@^8.45.0, eslint@>=7, eslint@>=7.0.0: +eslint@^8.26.0, eslint@^8.38.0, eslint@^8.45.0: version "8.57.1" resolved "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz" integrity sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA== @@ -4611,10 +4986,6 @@ express@^4.17.3: utils-merge "1.0.1" vary "~1.1.2" -"extension-starter@file:/Users/privacydaddy/dev/sdk/create-leo-app/template-extension": - version "0.0.0" - resolved "file:create-leo-app/template-extension" - fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" @@ -4944,50 +5315,19 @@ glob-parent@^5.1.2, glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" -glob-parent@^6.0.1: +glob-parent@^6.0.1, glob-parent@^6.0.2: version "6.0.2" resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== dependencies: - is-glob "^4.0.3" - -glob-parent@^6.0.2: - version "6.0.2" - resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" - integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== - dependencies: - is-glob "^4.0.3" - -glob-to-regexp@^0.4.1: - version "0.4.1" - resolved "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz" - integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== - -glob@^10.2.2: - version "10.4.5" - resolved "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz" - integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== - dependencies: - foreground-child "^3.1.0" - jackspeak "^3.1.2" - minimatch "^9.0.4" - minipass "^7.1.2" - package-json-from-dist "^1.0.0" - path-scurry "^1.11.1" - -glob@^10.3.7: - version "10.4.5" - resolved "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz" - integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== - dependencies: - foreground-child "^3.1.0" - jackspeak "^3.1.2" - minimatch "^9.0.4" - minipass "^7.1.2" - package-json-from-dist "^1.0.0" - path-scurry "^1.11.1" + is-glob "^4.0.3" + +glob-to-regexp@^0.4.1: + version "0.4.1" + resolved "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz" + integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@^10.4.5: +glob@^10.2.2, glob@^10.3.7, glob@^10.4.5: version "10.4.5" resolved "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz" integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== @@ -5011,31 +5351,7 @@ glob@^11.0.0: package-json-from-dist "^1.0.0" path-scurry "^2.0.0" -glob@^7.0.3: - version "7.2.3" - resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.1.3: - version "7.2.3" - resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.1.4: +glob@^7.0.3, glob@^7.1.3, glob@^7.1.4: version "7.2.3" resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -5047,18 +5363,7 @@ glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^8.0.3: - version "8.1.0" - resolved "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz" - integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^5.0.1" - once "^1.3.0" - -glob@^8.1.0: +glob@^8.0.3, glob@^8.1.0: version "8.1.0" resolved "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz" integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== @@ -5288,16 +5593,6 @@ http-deceiver@^1.2.7: resolved "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz" integrity sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw== -http-errors@~1.6.2: - version "1.6.3" - resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz" - integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== - dependencies: - depd "~1.1.2" - inherits "2.0.3" - setprototypeof "1.1.0" - statuses ">= 1.4.0 < 2" - http-errors@2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz" @@ -5309,6 +5604,16 @@ http-errors@2.0.0: statuses "2.0.1" toidentifier "1.0.1" +http-errors@~1.6.2: + version "1.6.3" + resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz" + integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== + dependencies: + depd "~1.1.2" + inherits "2.0.3" + setprototypeof "1.1.0" + statuses ">= 1.4.0 < 2" + http-parser-js@>=0.5.1: version "0.5.8" resolved "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz" @@ -5392,7 +5697,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3, inherits@2, inherits@2.0.4: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -5416,16 +5721,16 @@ interpret@^3.1.1: resolved "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz" integrity sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ== -ipaddr.js@^2.0.1: - version "2.2.0" - resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz" - integrity sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA== - ipaddr.js@1.9.1: version "1.9.1" resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz" integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== +ipaddr.js@^2.0.1: + version "2.2.0" + resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz" + integrity sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA== + is-array-buffer@^3.0.4: version "3.0.4" resolved "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz" @@ -5784,7 +6089,7 @@ js2xmlparser@^4.0.2: dependencies: xmlcreate "^2.0.4" -jsdoc@^3.6.11, "jsdoc@>=3.x <=4.x": +jsdoc@^3.6.11: version "3.6.11" resolved "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.11.tgz" integrity sha512-8UCU0TYeIYD9KeLzEcAu2q8N/mx9O3phAGl32nmHlE0LpaJL71mMkP4d+QE5zWfNt50qheHtOZ0qoxVrsX5TUg== @@ -6134,7 +6439,7 @@ markdown-it-anchor@^8.4.1: resolved "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz" integrity sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA== -markdown-it@*, markdown-it@^12.3.2: +markdown-it@^12.3.2: version "12.3.2" resolved "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz" integrity sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg== @@ -6205,16 +6510,16 @@ micromatch@^4.0.2, micromatch@^4.0.4: braces "^3.0.3" picomatch "^2.3.1" -"mime-db@>= 1.43.0 < 2": - version "1.53.0" - resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.53.0.tgz" - integrity sha512-oHlN/w+3MQ3rba9rqFr6V/ypF10LSkdwUysQL7GkXoTgIWeV+tcXGA852TBxH+gsh8UWoyhR1hKcoMJTuWflpg== - mime-db@1.52.0: version "1.52.0" resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== +"mime-db@>= 1.43.0 < 2": + version "1.53.0" + resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.53.0.tgz" + integrity sha512-oHlN/w+3MQ3rba9rqFr6V/ypF10LSkdwUysQL7GkXoTgIWeV+tcXGA852TBxH+gsh8UWoyhR1hKcoMJTuWflpg== + mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: version "2.1.35" resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" @@ -6222,16 +6527,16 @@ mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, dependencies: mime-db "1.52.0" -mime@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz" - integrity sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A== - mime@1.6.0: version "1.6.0" resolved "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== +mime@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz" + integrity sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A== + mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" @@ -6295,16 +6600,16 @@ minipass@^3.0.0: dependencies: yallist "^4.0.0" -"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: - version "7.1.2" - resolved "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz" - integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== - minipass@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz" integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ== +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + minizlib@^2.1.1: version "2.1.2" resolved "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz" @@ -6385,16 +6690,16 @@ mri@^1.2.0: resolved "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz" integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== -ms@^2.1.1, ms@^2.1.3, ms@2.1.3: - version "2.1.3" - resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - ms@2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== +ms@2.1.3, ms@^2.1.1, ms@^2.1.3: + version "2.1.3" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + multicast-dns@^7.2.5: version "7.2.5" resolved "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz" @@ -6489,29 +6794,11 @@ node-forge@^1: resolved "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz" integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== -"node-offline-transaction-example@file:/Users/privacydaddy/dev/sdk/create-leo-app/template-offline-public-transaction-ts": - version "0.0.0" - resolved "file:create-leo-app/template-offline-public-transaction-ts" - dependencies: - "@provablehq/sdk" "^0.7.0" - node-releases@^2.0.18: version "2.0.18" resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz" integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== -"node-starter@file:/Users/privacydaddy/dev/sdk/create-leo-app/template-node": - version "0.0.0" - resolved "file:create-leo-app/template-node" - dependencies: - "@provablehq/sdk" "^0.7.0" - -"node-ts-starter@file:/Users/privacydaddy/dev/sdk/create-leo-app/template-node-ts": - version "0.0.0" - resolved "file:create-leo-app/template-node-ts" - dependencies: - "@provablehq/sdk" "^0.7.0" - normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" @@ -6765,16 +7052,16 @@ path-scurry@^2.0.0: lru-cache "^11.0.0" minipass "^7.1.2" -path-to-regexp@^8.1.0: - version "8.1.0" - resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.1.0.tgz" - integrity sha512-Bqn3vc8CMHty6zuD+tG23s6v2kwxslHEhTj4eYaVKGIEB+YX/2wd0/rgXLFD9G9id9KCtbVy/3ZgmvZjpa0UdQ== - path-to-regexp@0.1.10: version "0.1.10" resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz" integrity sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w== +path-to-regexp@^8.1.0: + version "8.1.0" + resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.1.0.tgz" + integrity sha512-Bqn3vc8CMHty6zuD+tG23s6v2kwxslHEhTj4eYaVKGIEB+YX/2wd0/rgXLFD9G9id9KCtbVy/3ZgmvZjpa0UdQ== + path-type@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" @@ -7085,15 +7372,6 @@ postcss-value-parser@^4.1.0, postcss-value-parser@^4.2.0: resolved "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@^8.0.9, postcss@^8.1.0, postcss@^8.2.14, postcss@^8.4.27, postcss@^8.4.31, postcss@^8.4.33, postcss@^8.4.38, postcss@^8.4.45: - version "8.4.47" - resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz" - integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== - dependencies: - nanoid "^3.3.7" - picocolors "^1.1.0" - source-map-js "^1.2.1" - postcss@8.4.31: version "8.4.31" resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz" @@ -7103,16 +7381,20 @@ postcss@8.4.31: picocolors "^1.0.0" source-map-js "^1.0.2" +postcss@^8.4.27, postcss@^8.4.33, postcss@^8.4.45: + version "8.4.47" + resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz" + integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== + dependencies: + nanoid "^3.3.7" + picocolors "^1.1.0" + source-map-js "^1.2.1" + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prettier@^3.0.0: - version "3.3.3" - resolved "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz" - integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== - prettier@2.7.1: version "2.7.1" resolved "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz" @@ -7123,6 +7405,11 @@ prettier@3.0.3: resolved "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz" integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg== +prettier@^3.0.0: + version "3.3.3" + resolved "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== + pretty-bytes@^6.1.0: version "6.1.1" resolved "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-6.1.1.tgz" @@ -7168,7 +7455,7 @@ prompts@^2.4.2: kleur "^3.0.3" sisteransi "^1.0.5" -prop-types@^15.5.9, prop-types@^15.7.2, prop-types@^15.8.1: +prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -7305,7 +7592,7 @@ punycode@^2.1.0: resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== -qs@^6.4.0, qs@6.13.0: +qs@6.13.0, qs@^6.4.0: version "6.13.0" resolved "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz" integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== @@ -7725,7 +8012,7 @@ react-docgen@^5.4.0: node-dir "^0.1.10" strip-indent "^3.0.0" -react-dom@*, "react-dom@^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0", react-dom@^17.0.2, react-dom@^18, react-dom@^18.2.0, "react-dom@>= 16.3", react-dom@>=16.0.0, react-dom@>=16.11.0, react-dom@>=16.8, react-dom@>=16.8.0, react-dom@>=16.9.0: +react-dom@^18, react-dom@^18.2.0: version "18.3.1" resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz" integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== @@ -7768,7 +8055,7 @@ react-router@6.26.2: dependencies: "@remix-run/router" "1.19.2" -react@*, "react@^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0 || ^17.0.0", react@^17.0.2, react@^18, react@^18.2.0, react@^18.3.1, "react@>= 16.3", "react@>= 16.8.0 || 17.x.x || ^18.0.0-0", react@>=16.0.0, react@>=16.11.0, react@>=16.8, react@>=16.8.0, react@>=16.9.0: +react@^18, react@^18.2.0: version "18.3.1" resolved "https://registry.npmjs.org/react/-/react-18.3.1.tgz" integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ== @@ -8033,7 +8320,7 @@ rollup-plugin-typescript2@^0.36.0: semver "^7.5.4" tslib "^2.6.2" -rollup@^1.20.0||^2.0.0||^3.0.0||^4.0.0, rollup@^2.68.0||^3.0.0, rollup@^2.78.0||^3.0.0||^4.0.0, rollup@^3.0, rollup@^3.20.2, rollup@^3.27.1, rollup@^3.27.2, rollup@>=1.26.3: +rollup@^3.20.2, rollup@^3.27.1, rollup@^3.27.2: version "3.29.5" resolved "https://registry.npmjs.org/rollup/-/rollup-3.29.5.tgz" integrity sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w== @@ -8082,25 +8369,15 @@ safe-array-concat@^1.1.2: has-symbols "^1.0.3" isarray "^2.0.5" -safe-buffer@^5.1.0, safe-buffer@>=5.1.0, safe-buffer@~5.2.0, safe-buffer@5.2.1: - version "5.2.1" - resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -safe-buffer@~5.1.0: +safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -safe-buffer@5.1.2: - version "5.1.2" - resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.1.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== safe-regex-test@^1.0.3: version "1.0.3" @@ -8181,22 +8458,7 @@ semver@^6.0.0, semver@^6.3.1: resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.7: - version "7.6.3" - resolved "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz" - integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== - -semver@^7.5.3: - version "7.6.3" - resolved "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz" - integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== - -semver@^7.5.4: - version "7.6.3" - resolved "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz" - integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== - -semver@^7.6.3: +semver@^7.3.7, semver@^7.5.3, semver@^7.5.4, semver@^7.6.3: version "7.6.3" resolved "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== @@ -8415,35 +8677,21 @@ spdy@^4.0.2: select-hose "^2.0.0" spdy-transport "^3.0.0" -"statuses@>= 1.4.0 < 2": - version "1.5.0" - resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz" - integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== - statuses@2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== +"statuses@>= 1.4.0 < 2": + version "1.5.0" + resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz" + integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== + streamsearch@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz" integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - string-convert@^0.2.0: version "0.2.1" resolved "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz" @@ -8530,6 +8778,20 @@ string.prototype.trimstart@^1.0.8: define-properties "^1.2.1" es-object-atoms "^1.0.0" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + "strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" @@ -8624,14 +8886,7 @@ supports-color@^7, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -supports-color@^8.0.0: - version "8.1.1" - resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - -supports-color@^8.1.1: +supports-color@^8.0.0, supports-color@^8.1.1: version "8.1.1" resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== @@ -8701,16 +8956,6 @@ tar@^6.1.11: mkdirp "^1.0.3" yallist "^4.0.0" -"template-nextjs@file:/Users/privacydaddy/dev/sdk/create-leo-app/template-nextjs-ts": - version "0.1.0" - resolved "file:create-leo-app/template-nextjs-ts" - dependencies: - "@provablehq/sdk" "^0.7.0" - next "13.5.4" - react "^18" - react-dom "^18" - terser-webpack-plugin "^5.3.9" - terser-webpack-plugin@^5.3.10, terser-webpack-plugin@^5.3.9: version "5.3.10" resolved "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz" @@ -8722,7 +8967,7 @@ terser-webpack-plugin@^5.3.10, terser-webpack-plugin@^5.3.9: serialize-javascript "^6.0.1" terser "^5.26.0" -terser@^5.10.0, terser@^5.15.1, terser@^5.26.0, terser@^5.4.0: +terser@^5.10.0, terser@^5.15.1, terser@^5.26.0: version "5.33.0" resolved "https://registry.npmjs.org/terser/-/terser-5.33.0.tgz" integrity sha512-JuPVaB7s1gdFKPKTelwUyRq5Sid2A3Gko2S0PncwdBq7kN9Ti9HPWDQ06MPsEDGsZeVESjKEnyGy68quBk1w6g== @@ -8875,16 +9120,16 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" -type-detect@^4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz" - integrity sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw== - type-detect@4.0.8: version "4.0.8" resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== +type-detect@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz" + integrity sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw== + type-fest@^0.20.2: version "0.20.2" resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" @@ -8952,16 +9197,16 @@ typescript@^3.2.2: resolved "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz" integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q== -"typescript@^4.1 || ^5.0", typescript@^5, typescript@^5.0.4, typescript@^5.2.2, typescript@>=2.4.0, typescript@>=2.7, "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta", typescript@>=5.5.4: - version "5.6.2" - resolved "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz" - integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== - typescript@^4.5.4: version "4.9.5" resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +typescript@^5, typescript@^5.0.4, typescript@^5.2.2: + version "5.6.2" + resolved "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz" + integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== + uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" resolved "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz" @@ -9071,7 +9316,7 @@ universalify@^2.0.0: resolved "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== -unpipe@~1.0.0, unpipe@1.0.0: +unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== @@ -9143,7 +9388,7 @@ vary@~1.1.2: resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== -"vite@^4 || ^5", "vite@^4.2.0 || ^5.0.0", vite@^4.4.12: +vite@^4.4.12: version "4.5.5" resolved "https://registry.npmjs.org/vite/-/vite-4.5.5.tgz" integrity sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ== @@ -9202,14 +9447,6 @@ wasm-pack@^0.12.1: dependencies: binary-install "^1.0.1" -watchpack@^2.4.1: - version "2.4.2" - resolved "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz" - integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== - dependencies: - glob-to-regexp "^0.4.1" - graceful-fs "^4.1.2" - watchpack@2.4.0: version "2.4.0" resolved "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz" @@ -9218,6 +9455,14 @@ watchpack@2.4.0: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" +watchpack@^2.4.1: + version "2.4.2" + resolved "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz" + integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== + dependencies: + glob-to-regexp "^0.4.1" + graceful-fs "^4.1.2" + wbuf@^1.1.0, wbuf@^1.7.3: version "1.7.3" resolved "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz" @@ -9235,7 +9480,7 @@ webidl-conversions@^3.0.0: resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== -webpack-cli@^5.1.4, webpack-cli@5.x.x: +webpack-cli@^5.1.4: version "5.1.4" resolved "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.4.tgz" integrity sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg== @@ -9315,7 +9560,7 @@ webpack-sources@^3.2.3: resolved "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -"webpack@^4.0.0 || ^5.0.0", "webpack@^4.37.0 || ^5.0.0", webpack@^5.0.0, webpack@^5.1.0, webpack@^5.20.0, webpack@^5.76.0, webpack@>=2, webpack@5.x.x: +webpack@^5.76.0: version "5.94.0" resolved "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz" integrity sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg== @@ -9344,7 +9589,7 @@ webpack-sources@^3.2.3: watchpack "^2.4.1" webpack-sources "^3.2.3" -websocket-driver@^0.7.4, websocket-driver@>=0.5.1: +websocket-driver@>=0.5.1, websocket-driver@^0.7.4: version "0.7.4" resolved "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz" integrity sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg== @@ -9556,11 +9801,6 @@ yargs@~3.10.0: decamelize "^1.0.0" window-size "0.1.0" -yarn@^1.22.22: - version "1.22.22" - resolved "https://registry.npmjs.org/yarn/-/yarn-1.22.22.tgz" - integrity sha512-prL3kGtyG7o9Z9Sv8IPfBNrWTDmXB4Qbes8A9rEzt6wkJV8mUvoirjU0Mp3GGAU06Y0XQyA3/2/RQFVuK7MTfg== - yn@3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz"