Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring error handling #915

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/staging-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-05-14
toolchain: nightly-2024-08-12
override: true
components: rustfmt, rust-src

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-05-14
toolchain: nightly-2024-08-12
override: true
components: rustfmt, rust-src

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-05-14
toolchain: nightly-2024-08-12
override: true
components: rustfmt, rust-src

Expand Down
11 changes: 5 additions & 6 deletions create-leo-app/template-node-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ async function localProgramExecution(program, programName, aleoFunction, inputs)
programManager.setKeyProvider(keyProvider);

// Pre-synthesize the program keys and then cache them in memory using key provider
const keyPair = await programManager.synthesizeKeys(hello_hello_program, aleoFunction, inputs);
try {
const keyPair = await programManager.synthesizeKeys(hello_hello_program, aleoFunction, inputs);

if (keyPair instanceof Error) {
throw new Error(`Failed to synthesize keys: ${keyPair.message}`);
} else {
programManager.keyProvider.cacheKeys(`${programName}:${aleoFunction}`, keyPair);
}

programManager.keyProvider.cacheKeys(`${programName}:${aleoFunction}`, keyPair);
} catch (e) {
throw new Error(`Failed to synthesize keys: ${e.message}`);
}

// Specify parameters for the key provider to use search for program keys. In particular specify the cache key
// that was used to cache the keys in the previous step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getLocalKey, preDownloadBondingKeys, preDownloadTransferKeys } from "./
await initThreadPool();

/// Build transfer public transaction without connection to the internet
async function buildTransferPublicTxOffline(recipientAddress: Address, amount: number, latestStateRoot: string, keyPaths: {}): Promise<Error | Transaction> {
async function buildTransferPublicTxOffline(recipientAddress: Address, amount: number, latestStateRoot: string, keyPaths: {}): Promise<Transaction> {
// Create an offline program manager
const programManager = new ProgramManager();

Expand Down Expand Up @@ -47,7 +47,7 @@ async function buildTransferPublicTxOffline(recipientAddress: Address, amount: n
}

/// Build bonding and unbonding transactions without connection to the internet
async function buildBondingTxOffline(stakerAddress: Address, validatorAddress: Address, withdrawalAddress: Address, amount: number, latestStateRoot: string, keyPaths: {}): Promise<Error | Transaction[]> {
async function buildBondingTxOffline(stakerAddress: Address, validatorAddress: Address, withdrawalAddress: Address, amount: number, latestStateRoot: string, keyPaths: {}): Promise<Transaction[]> {
// Create an offline program manager
const programManager = new ProgramManager();

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-05-14"
channel = "nightly-2024-08-12"
components = [ "rust-std", "rust-src" ]
targets = [ "wasm32-unknown-unknown" ]
2 changes: 1 addition & 1 deletion sdk/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class Account {
* Attempts to create an account from a private key ciphertext
* @param {PrivateKeyCiphertext | string} ciphertext
* @param {string} password
* @returns {PrivateKey | Error}
* @returns {PrivateKey}
*
* @example
* const ciphertext = PrivateKey.newEncrypted("password");
Expand Down
Loading
Loading