forked from ProvableHQ/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converting to use rollup-plugin-rust instead of wasm-pack
- Loading branch information
Showing
39 changed files
with
1,231 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {Account, initThreadPool, PrivateKey, ProgramManager,} from "@aleohq/sdk"; | ||
|
||
await initThreadPool(10); | ||
|
||
const hello_hello_program = | ||
"program hello_hello.aleo;\n" + | ||
"\n" + | ||
"function 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"; | ||
|
||
async function localProgramExecution(program, aleoFunction, inputs) { | ||
const programManager = new ProgramManager(); | ||
|
||
// Create a temporary account for the execution of the program | ||
const account = new Account(); | ||
programManager.setAccount(account); | ||
|
||
const executionResponse = await programManager.executeOffline( | ||
hello_hello_program, | ||
"hello", | ||
["5u32", "5u32"], | ||
false, | ||
); | ||
return executionResponse.getOutputs(); | ||
} | ||
|
||
const start = Date.now(); | ||
console.log("Starting execute!"); | ||
const result = await localProgramExecution(); | ||
console.log(result); | ||
console.log("Execute finished!", Date.now() - start); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "node-starter", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"start": "node index.js" | ||
}, | ||
"dependencies": { | ||
"@aleohq/sdk": "^0.5.10" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
}, | ||
"devDependencies": { | ||
"@aleohq/sdk": "^0.5.10", | ||
"tslib": "^2.6.2", | ||
"vite": "^4.4.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,18 +6,23 @@ | |
"The Aleo Team <[email protected]>" | ||
], | ||
"license": "GPL-3.0", | ||
"main": "./dist/index.js", | ||
"browser": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"type": "module", | ||
"main": "./dist/node.js", | ||
"browser": "./dist/index.js", | ||
"exports": { | ||
".": { | ||
"node": "./dist/node.js", | ||
"default": "./dist/index.js" | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"scripts": { | ||
"build": "rollup -c rollup.config.node.js", | ||
"build:browser": "rollup -c rollup.config.browser.js", | ||
"build": "rimraf dist && rollup -c rollup.config.js", | ||
"prepublish": "npm run build", | ||
"clear_jest": "jest --clearCache", | ||
"dev": "tsc --watch", | ||
"test": "jest --config jest-config.json", | ||
|
@@ -38,27 +43,30 @@ | |
}, | ||
"homepage": "https://github.com/AleoHQ/sdk#readme", | ||
"dependencies": { | ||
"@aleohq/nodejs": "0.5.10", | ||
"@aleohq/wasm": "0.5.10", | ||
"@aleohq/wasm": "^0.6.0", | ||
"axios": "^1.1.3", | ||
"comlink": "^4.4.1", | ||
"jsdoc": "^3.6.11", | ||
"unfetch": "^5.0.0" | ||
"mime": "^3.0.0", | ||
"sync-request": "^6.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.4.0", | ||
"@types/mime": "^3.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.41.0", | ||
"@typescript-eslint/parser": "^5.41.0", | ||
"better-docs": "^2.7.2", | ||
"clean-jsdoc-theme": "^4.1.8", | ||
"cpr": "^3.0.1", | ||
"eslint": "^8.26.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"jest": "^29.4.2", | ||
"prettier": "2.7.1", | ||
"rimraf": "^5.0.1", | ||
"rollup": "^3.27.2", | ||
"rollup-plugin-typescript2": "^0.35.0", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"ts-jest": "^29.0.5", | ||
"typescript": "^4.8.4" | ||
"typescript": "^5.2.2" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import typescript from "rollup-plugin-typescript2"; | ||
|
||
export default { | ||
input: { | ||
index: "./src/index.ts", | ||
thread: "./src/thread.ts", | ||
worker: "./src/worker.ts", | ||
node: "./src/node.ts", | ||
"node-polyfill": "./src/node-polyfill.ts", | ||
}, | ||
output: { | ||
dir: `dist`, | ||
format: "es", | ||
sourcemap: true, | ||
}, | ||
external: [ | ||
"node:worker_threads", | ||
"node:os", | ||
"node:fs", | ||
"node:crypto", | ||
"mime/lite.js", | ||
"sync-request", | ||
"axios", | ||
"comlink", | ||
"@aleohq/wasm", | ||
"@aleohq/wasm/worker.js", | ||
], | ||
plugins: [ | ||
typescript({ | ||
tsconfig: "tsconfig.json", | ||
clean: true, | ||
}), | ||
], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import "./polyfill/crypto"; | ||
import "./polyfill/fetch"; | ||
import "./polyfill/xmlhttprequest"; | ||
import "./polyfill/worker"; | ||
|
||
if (!globalThis.self) { | ||
(globalThis as any).self = globalThis; | ||
} |
Oops, something went wrong.