forked from nervosnetwork/ckb-js-vm
-
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.
- Loading branch information
1 parent
9921ac9
commit e2d1b66
Showing
15 changed files
with
1,143 additions
and
0 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 |
---|---|---|
|
@@ -54,3 +54,5 @@ dkms.conf | |
.vscode | ||
|
||
build | ||
node_modules/ | ||
dist/ |
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,18 @@ | ||
{ | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"build:prepare": "pnpm -r install", | ||
"build": "pnpm -r run build", | ||
"docs": "typedoc" | ||
}, | ||
"devDependencies": { | ||
"esbuild": "0.24.2", | ||
"eslint": "9.18.0", | ||
"prettier": "3.4.2", | ||
"typescript": "^5.7.3" | ||
}, | ||
"pnpm": {} | ||
} |
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,3 @@ | ||
|
||
export function loadScript(offset?: number, length?: number): ArrayBuffer; | ||
export function currentCycles(): number; |
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,17 @@ | ||
{ | ||
"name": "@ckb-js-std/bindings", | ||
"version": "0.1.0", | ||
"description": "bindings for ckb-js-vm", | ||
"author": "CKB-VM Team", | ||
"license": "MIT", | ||
"private": false, | ||
"homepage": "https://github.com/nervosnetwork/ckb-js-vm", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/nervosnetwork/ckb-js-vm.git" | ||
}, | ||
"scripts": { | ||
}, | ||
"sideEffects": false, | ||
"types": "index" | ||
} |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2020", | ||
"module": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"types": [ "./index.d.ts" ] | ||
} | ||
} |
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,30 @@ | ||
{ | ||
"name": "@ckb-js-std/examples", | ||
"version": "0.1.0", | ||
"description": "Write scripts in JavaScript on CKB-VM", | ||
"author": "CKB-VM Team", | ||
"license": "MIT", | ||
"private": false, | ||
"homepage": "https://github.com/nervosnetwork/ckb-js-vm", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/nervosnetwork/ckb-js-vm.git" | ||
}, | ||
"sideEffects": false, | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.js", | ||
"scripts": { | ||
"start": "ckb-debugger --read-file dist/index.js --bin ../../build/ckb-js-vm -- -r", | ||
"build": "tsc --noEmit && esbuild src/index.ts --bundle --outfile=dist/index.js --external:ckb --target=es2022", | ||
"clean": "rm -f dist/*" | ||
}, | ||
"devDependencies": { | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@ckb-js-std/bindings": "workspace:*", | ||
"@ckb-js-std/examples": "link:" | ||
} | ||
} |
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,10 @@ | ||
import * as ckb from "ckb"; | ||
|
||
function main() { | ||
let script = ckb.loadScript(); | ||
console.log(`script length is ${script.byteLength}`); | ||
let cycles = ckb.currentCycles(); | ||
console.log(`current cycles is ${cycles}`); | ||
} | ||
|
||
main(); |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2022", | ||
"incremental": true, | ||
"allowJs": true, | ||
"importHelpers": false, | ||
"declaration": true, | ||
"declarationMap": true, | ||
"experimentalDecorators": true, | ||
"useDefineForClassFields": false, | ||
"esModuleInterop": true, | ||
"strict": true, | ||
"noImplicitAny": true, | ||
"strictBindCallApply": true, | ||
"strictNullChecks": true, | ||
"alwaysStrict": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": [ | ||
"src/**/*" | ||
] | ||
} |
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 @@ | ||
{ | ||
"extends": "./tsconfig.base.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"outDir": "./dist", | ||
"baseUrl": ".", | ||
"paths": { | ||
"ckb": ["node_modules/@ckb-js-std/bindings"] | ||
} | ||
} | ||
} |
Oops, something went wrong.