-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into chainhooks-edits
- Loading branch information
Showing
33 changed files
with
4,036 additions
and
71 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,3 @@ | ||
dist/ | ||
src-ts/sdk | ||
node_modules/ |
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,76 @@ | ||
[package] | ||
edition = "2021" | ||
name = "clarinet-sdk" | ||
version = "0.0.1" | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
name = "clarinet_sdk" | ||
path = "src/lib.rs" | ||
|
||
[dependencies] | ||
serde = { version = "1.0.136", features = ["derive"] } | ||
serde_json = "1.0" | ||
clarinet-files = { path = "../clarinet-files", default-features = false } | ||
clarity-repl = { path = "../clarity-repl", default-features = false, optional = true } | ||
clarinet-deployments = { path = "../clarinet-deployments", default-features = false } | ||
# WASM | ||
console_error_panic_hook = { version = "0.1", optional = true } | ||
js-sys = { version = "0.3", optional = true } | ||
serde-wasm-bindgen = { version = "0.5", optional = true } | ||
wasm-bindgen = { version = "0.2", optional = true } | ||
wasm-bindgen-futures = { version = "0.4", optional = true } | ||
web-sys = { version = "0.3", features = ["console"], optional = true } | ||
|
||
[features] | ||
default = ["wasm"] | ||
wasm = [ | ||
"wasm-bindgen", | ||
"wasm-bindgen-futures", | ||
"serde-wasm-bindgen", | ||
"js-sys", | ||
"web-sys", | ||
"console_error_panic_hook", | ||
"clarinet-deployments/wasm", | ||
"clarity-repl/wasm", | ||
"clarinet-files/wasm", | ||
] | ||
|
||
# DEV | ||
[profile.dev] | ||
inherits = "release" | ||
opt-level = 3 | ||
debug = false | ||
debug-assertions = false | ||
incremental = false | ||
codegen-units = 256 | ||
|
||
[profile.dev.build-override] | ||
inherits = "release" | ||
opt-level = 3 | ||
|
||
[package.metadata.wasm-pack.profile.dev] | ||
wasm-opt = false | ||
|
||
[package.metadata.wasm-pack.profile.dev.wasm-bindgen] | ||
debug-js-glue = false | ||
demangle-name-section = true | ||
dwarf-debug-info = false | ||
|
||
# RELEASE | ||
[profile.release] | ||
opt-level = 3 | ||
debug = false | ||
debug-assertions = false | ||
lto = true | ||
incremental = false | ||
codegen-units = 16 | ||
|
||
[package.metadata.wasm-pack.profile.release] | ||
wasm-opt = false | ||
# wasm-opt = ['-O1'] | ||
|
||
[package.metadata.wasm-pack.profile.release.wasm-bindgen] | ||
debug-js-glue = false | ||
demangle-name-section = true | ||
dwarf-debug-info = false |
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,43 @@ | ||
# Clarinet SDK | ||
|
||
## Core | ||
|
||
### Usage | ||
|
||
```ts | ||
import { Cl } from "@stacks/transactions"; | ||
import { initVM } from "obscurity-sdk"; | ||
|
||
async function main() { | ||
const vm = await initVM(); | ||
const accounts = vm.getAccounts(); | ||
const w1 = accounts.get("wallet_1"); | ||
if (!w1) return; | ||
|
||
const call = vm.callPublicFn("counter", "increment", [Cl.uint(1)], w1); | ||
console.log(call.result); // Cl.int(Cl.ok(true)) | ||
|
||
const counter = vm.getDataVar("counter", "counter"); | ||
console.log(counter); // Cl.int(2) | ||
} | ||
|
||
main(); | ||
``` | ||
|
||
## Contributing | ||
|
||
Clone the clarinet repo adn switch to the sdk component | ||
``` | ||
git clone [email protected]:hirosystems/clarinet.git | ||
cd clarinet/components/clarinet-sdk | ||
``` | ||
|
||
Open the SDK workspace in VSCode: | ||
``` | ||
code ./clarinet-sdk.code-workspace | ||
``` | ||
|
||
Compile the project (both WASM and JS): | ||
``` | ||
npm run build | ||
``` |
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 @@ | ||
{ | ||
"folders": [{ "path": "../../" }], | ||
"settings": { | ||
// "rust-analyzer.checkOnSave.command": "clippy -p clarinet-sdk -- --no-deps", | ||
// "rust-analyzer.check.command": "check", | ||
"rust-analyzer.check.overrideCommand": [ | ||
"cargo", | ||
"clippy", | ||
"--no-default-features", | ||
"--package=clarinet-sdk", | ||
"--features=wasm", | ||
"--message-format=json", | ||
"--", | ||
"--no-deps" | ||
] | ||
} | ||
} |
Oops, something went wrong.