Skip to content

Commit

Permalink
update SDK READMEs and name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
christianwwwwwwww committed Jul 18, 2024
1 parent 7d4be98 commit 08cf198
Show file tree
Hide file tree
Showing 139 changed files with 186 additions and 392 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
steps:
- setup-sdk
- run:
working_directory: create-aleo-app/template-node
working_directory: create-leo-app/template-node
command: |
yarn start
Expand All @@ -87,7 +87,7 @@ jobs:
steps:
- setup-sdk
- run:
working_directory: create-aleo-app/template-node-ts
working_directory: create-leo-app/template-node-ts
command: |
yarn start
Expand All @@ -96,7 +96,7 @@ jobs:
steps:
- setup-sdk
- run:
working_directory: create-aleo-app/template-extension
working_directory: create-leo-app/template-extension
command: |
yarn build
Expand All @@ -105,7 +105,7 @@ jobs:
steps:
- setup-sdk
- run:
working_directory: create-aleo-app/template-react-leo
working_directory: create-leo-app/template-react-leo
command: |
yarn build
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

The [Aleo SDK](https://github.com/ProvableHQ/sdk) provides tools for building zero-knowledge applications. It consists of
several TypeScript & JavaScript libraries which provide the following functionality:
1. [Aleo account management](https://provable.tools/account)
1. [Aleo account management](https://provable.tools/account)
2. [Web-based program execution and deployment](https://provable.tools/develop)
3. [Aleo credit transfers](https://provable.tools/transfer)
4. [Management of program state and data](https://provable.tools/record)
Expand All @@ -34,17 +34,17 @@ first zero-knowledge web app.

#### Source: [`Aleo SDK`](https://www.npmjs.com/package/@provablehq/sdk)

## 2. Create-Aleo-App - Zero-Knowledge Web App Examples
<a href="https://www.npmjs.com/package/create-aleo-app"> <img alt="Create Aleo App" src="https://img.shields.io/npm/l/create-aleo-app?label=NPM%20-%20Create-Aleo-App&labelColor=green&color=blue"></a>
## 2. Create-Leo-App - Zero-Knowledge Web App Examples
<a href="https://www.npmjs.com/package/create-leo-app"> <img alt="Create Leo App" src="https://img.shields.io/npm/l/create-leo-app?label=NPM%20-%20Create-Leo-App&labelColor=green&color=blue"></a>

Create-aleo-app provides zero-knowledge web app examples in common web frameworks such as React. Developers looking to
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-aleo-app`](https://github.com/ProvableHQ/sdk/tree/testnet3/create-aleo-app)
#### Source: [`sdk/create-leo-app`](https://github.com/ProvableHQ/sdk/tree/testnet3/create-leo-app)

## 3. Aleo Wasm - Zero-Knowledge Algorithms in JavaScript + WebAssembly
<a href="https://www.npmjs.com/package/@provablehq/wasm"> <img alt="Create Aleo App" src="https://img.shields.io/npm/l/%40provablehq%2Fwasm?label=NPM%20-%20Aleo%20Wasm&labelColor=green&color=blue"></a>
<a href="https://www.npmjs.com/package/@provablehq/nodejs"> <img alt="Create Aleo App" src="https://img.shields.io/npm/l/%40provablehq%2Fnodejs?label=NPM%20-%20Aleo%20Nodejs&labelColor=green&color=blue"></a>
<a href="https://www.npmjs.com/package/@provablehq/wasm"> <img alt="Create Leo App" src="https://img.shields.io/npm/l/%40provablehq%2Fwasm?label=NPM%20-%20Aleo%20Wasm&labelColor=green&color=blue"></a>
<a href="https://www.npmjs.com/package/@provablehq/nodejs"> <img alt="Create Leo App" src="https://img.shields.io/npm/l/%40provablehq%2Fnodejs?label=NPM%20-%20Aleo%20Nodejs&labelColor=green&color=blue"></a>
<a href="https://crates.io/crates/aleo-wasm"> <img alt="Aleo-Wasm" src="https://img.shields.io/crates/v/aleo-wasm.svg?color=neon"></a>

Aleo Wasm is a Rust crate which compiles the Aleo source code responsible for creating and executing zero-knowledge programs into
Expand Down
17 changes: 8 additions & 9 deletions create-aleo-app/README.md → create-leo-app/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# create-aleo-app
# create-leo-app

## Scaffolding Your First Aleo Project

> **Compatibility Note:**
> [Node.js](https://nodejs.org/en/) version 18+
> Please use [Node.js](https://nodejs.org/en/) version 18+
With NPM:

```bash
npm create aleo-app@latest
npm create leo-app@latest
```

Then follow the prompts!
Expand All @@ -17,18 +17,17 @@ You can also directly specify the project name and the template you want to use

```bash
# npm 6.x
npm create aleo-app@latest my-aleo-app --template react
npm create leo-app@latest my-leo-app --template react

# npm 7+, extra double-dash is needed:
npm create aleo-app@latest my-aleo-app -- --template react
npm create leo-app@latest my-leo-app -- --template react
```

Currently supported template presets include:

- `vanilla`
- `react-leo`
- `node`
- `nextjs-ts`
- `Vanilla`
- `React (JavaScript + Leo, React + TypeScript, or TypeScript + Next.js)`
- `Node.js`

You can use `.` for the project name to scaffold in the current directory.

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions create-aleo-app/package.json → create-leo-app/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "create-aleo-app",
"name": "create-leo-app",
"version": "0.0.12",
"type": "module",
"license": "GPL-3.0",
"collaborators": [
"The Provable Team <[email protected]>"
"The Provable Team"
],
"bin": {
"create-aleo-app": "index.js"
"create-leo-app": "index.js"
},
"files": [
"index.js",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function Home() {
<p>
<button onClick={generateAccount}>
{account
? `Account is ${JSON.stringify(account)}`
? `Account private key is ${JSON.stringify(account)}`
: `Click to generate account`}
</button>
</p>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# React + Aleo + Leo

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/ProvableHQ/sdk/tree/testnet3/create-aleo-app/template-react-leo)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/ProvableHQ/sdk/tree/testnet3/create-leo-app/template-react-leo)

This template provides a minimal setup to get React and Aleo working in Vite
with HMR and some ESLint rules.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function App() {
<p>
<button onClick={generateAccount}>
{account
? `Account is ${JSON.stringify(account)}`
? `Account private key is ${JSON.stringify(account)}`
: `Click to generate account`}
</button>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function App() {
" output r2 as u32.private;\n";

setLoading(true);
const result = await aleoWorker.executeOffline(hello_hello_program,"hello", ["5u32", "5u32"], "APrivateKey1zkp778oUFSck3PZA5xppgp4trFwkkD6xnUXtxcBCfsq4URJ")
const result = await aleoWorker.run(hello_hello_program,"hello", ["5u32", "5u32"], "APrivateKey1zkp778oUFSck3PZA5xppgp4trFwkkD6xnUXtxcBCfsq4URJ")
setLoading(false);

alert(JSON.stringify(result));
Expand All @@ -52,7 +52,7 @@ function App() {
<button onClick={generateAccount}>
{
(account
? `Account is ${JSON.stringify(account)}`
? `Account private key is ${JSON.stringify(account)}`
: `Click to generate account`)
}
</button>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# React + Aleo + Leo

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/ProvableHQ/sdk/tree/testnet3/create-aleo-app/template-react)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/ProvableHQ/sdk/tree/testnet3/create-leo-app/template-react)

This template provides a minimal setup to get React and Aleo working in Vite
with HMR and some ESLint rules.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function App() {
<p>
<button onClick={generateAccount}>
{account
? `Account is ${JSON.stringify(account)}`
? `Account private key is ${JSON.stringify(account)}`
: `Click to generate account`}
</button>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function localProgramExecution(program, aleoFunction, inputs) {
const account = new Account();
programManager.setAccount(account);

const executionResponse = await programManager.executeOffline(
const executionResponse = await programManager.run(
program,
aleoFunction,
inputs,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/aleo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Aleo App</title>
<title>Leo App</title>
</head>
<body>
<div id="app"></div>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Account, AleoNetworkClient, NetworkRecordProvider, ProgramManager, AleoKeyProvider} from '@provablehq/sdk';

// Create a key provider that will be used to find public proving & verifying keys for Aleo programs
const keyProvider = new AleoKeyProvider();
keyProvider.useCache(true);

// Create a record provider that will be used to find records and transaction data for Aleo programs
const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");

// Use existing account with funds
const account = new Account({
privateKey: "user1PrivateKey",
});

const recordProvider = new NetworkRecordProvider(account, networkClient);

// Initialize a program manager to talk to the Aleo network with the configured key and record providers
const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
programManager.setAccount(account)

// Define an Aleo program to deploy
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";

// Define a fee to pay to deploy the program
const fee = 3.0; // 3.0 Aleo credits

// Deploy the program to the Aleo network
const tx_id = await programManager.deploy(program, fee);

// Verify the transaction was successful
const transaction = await programManager.networkClient.getTransaction(tx_id);
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"sdk",
"wasm",
"website",
"create-aleo-app",
"create-aleo-app/*"
"create-leo-app",
"create-leo-app/*"
],
"type": "module",
"scripts": {
"build:wasm": "cd wasm && yarn build",
"build:sdk": "cd sdk && yarn build",
Expand Down
Loading

0 comments on commit 08cf198

Please sign in to comment.