Skip to content

Commit

Permalink
refactor: handle at-block
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocaillard committed Jan 17, 2025
1 parent b0f46ec commit 042750b
Show file tree
Hide file tree
Showing 13 changed files with 300 additions and 343 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"rust-analyzer.check.command": "clippy",
"rust-analyzer.check.workspace": true,
// rust-analyzer hack:
// manually set --workspace in extraArgs so that it's always set only one time
"rust-analyzer.check.workspace": false,
"rust-analyzer.check.extraArgs": [
"--workspace",
"--exclude=clarinet-sdk-wasm",
"--exclude=clarity-jupyter-kernel"
]
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion components/clarinet-sdk-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "clarinet-sdk-wasm"
version.workspace = true
# version.workspace = true
version = "2.13.0-beta1"
edition = "2021"
license = "GPL-3.0"
repository = "https://github.com/hirosystems/clarinet"
Expand Down
8 changes: 7 additions & 1 deletion components/clarinet-sdk-wasm/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ impl SDK {
.interpreter
.clarity_datastore
.set_http_client(self.http_client.clone());

self.session = Some(session);
Ok(())
}
Expand All @@ -383,7 +384,7 @@ impl SDK {
.ok_or("Failed to parse manifest location")?;

let ProjectCache {
session,
mut session,
contracts_interfaces,
contracts_locations,
accounts,
Expand All @@ -392,6 +393,11 @@ impl SDK {
None => self.setup_session(&manifest_location).await?,
};

session
.interpreter
.clarity_datastore
.set_http_client(self.http_client.clone());

self.deployer = session.interpreter.get_tx_sender().to_string();

self.contracts_interfaces = contracts_interfaces;
Expand Down
4 changes: 2 additions & 2 deletions components/clarinet-sdk/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hirosystems/clarinet-sdk-browser",
"version": "2.12.0",
"version": "2.13.0-beta1",
"description": "A SDK to interact with Clarity Smart Contracts in the browser",
"homepage": "https://www.hiro.so/clarinet",
"repository": {
Expand Down Expand Up @@ -28,7 +28,7 @@
"license": "GPL-3.0",
"readme": "./README.md",
"dependencies": {
"@hirosystems/clarinet-sdk-wasm-browser": "^2.12.0",
"@hirosystems/clarinet-sdk-wasm-browser": "2.13.0-beta1",
"@stacks/transactions": "^6.13.0",
"sync-request": "^6.1.0"
}
Expand Down
4 changes: 4 additions & 0 deletions components/clarinet-sdk/common/src/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import request, { HttpVerb, Options as HttpOptions } from "sync-request";
const encoder = new TextEncoder();

export function httpClient(method: HttpVerb, path: string, options?: HttpOptions): Uint8Array {
console.log("-".repeat(20));
console.log("httpClient", method, path, options);
const response = request(method, path, options);
if (typeof response.body === "string") {
return encoder.encode(response.body);
}
console.log("httpClient response", response.statusCode);
console.log("-".repeat(20));
return response.body;
}
4 changes: 2 additions & 2 deletions components/clarinet-sdk/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hirosystems/clarinet-sdk",
"version": "2.12.0",
"version": "2.13.0-beta1",
"description": "A SDK to interact with Clarity Smart Contracts in node.js",
"homepage": "https://www.hiro.so/clarinet",
"repository": {
Expand Down Expand Up @@ -61,7 +61,7 @@
"license": "GPL-3.0",
"readme": "./README.md",
"dependencies": {
"@hirosystems/clarinet-sdk-wasm": "^2.12.0",
"@hirosystems/clarinet-sdk-wasm": "2.13.0-beta1",
"@stacks/transactions": "^6.13.0",
"kolorist": "^1.8.0",
"prompts": "^2.4.2",
Expand Down
2 changes: 1 addition & 1 deletion components/clarinet-sdk/node/tests/remote-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ beforeEach(async () => {
await simnet.initEmptySession({
enabled: true,
api_url: "http://localhost:3999",
initial_height: 186,
initial_height: 56,
});
});

Expand Down
Loading

0 comments on commit 042750b

Please sign in to comment.