Skip to content

Commit 66a6daa

Browse files
Ludo GalabruLudo Galabru
authored andcommitted
chore: fix stacks-devnet-js
1 parent fe3702b commit 66a6daa

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

Cargo.lock

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ deno_core = { path = "./vendor/deno/core", optional = true }
3131
deno_runtime = { path = "./vendor/deno/runtime", optional = true }
3232
deno = { path = "./vendor/deno/cli", optional = true }
3333
# clarity_repl = { package = "clarity-repl", path = "../../clarity-repl", features = ["cli"] }
34-
clarity_repl = { package = "clarity-repl", version = "=0.27.0" }
34+
clarity_repl = { package = "clarity-repl", version = "=0.28.0" }
3535
bip39 = { version = "1.0.1", default-features = false }
3636
aes = "0.7.5"
3737
base64 = "0.13.0"

examples/counter/tests/counter_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Clarinet, Tx, Chain, Account, Contract, types } from 'https://deno.land/x/clarinet@v0.28.0/index.ts';
1+
import { Clarinet, Tx, Chain, Account, Contract, types } from '../../../deno/index.ts';
22
import { assertEquals } from "https://deno.land/std@0.90.0/testing/asserts.ts";
33

44
Clarinet.test({
@@ -22,7 +22,7 @@ Clarinet.test({
2222
block.receipts[2].result
2323
.expectOk()
2424
.expectUint(16);
25-
25+
2626
block = chain.mineBlock([
2727
Tx.contractCall("counter", "increment", [types.uint(1)], wallet_1.address),
2828
Tx.contractCall("counter", "increment", [types.uint(4)], wallet_1.address),
@@ -56,7 +56,7 @@ Clarinet.test({
5656

5757
Clarinet.test({
5858
name: "Test with pre-setup",
59-
beforeContractsDeployment: async (chain: Chain, accounts: Map<string, Account>) => {
59+
preDeployment: async (chain: Chain, accounts: Map<string, Account>) => {
6060
chain.mineEmptyBlock(100);
6161
},
6262
async fn(chain: Chain, accounts: Map<string, Account>, contracts: Map<string, Contract>) {

node-bindings/src/lib.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ extern crate error_chain;
55
mod serde;
66

77
use clarinet_lib::bip39::{Language, Mnemonic};
8+
use clarinet_lib::deployment;
89
use clarinet_lib::integrate::{self, DevnetEvent, DevnetOrchestrator};
910
use clarinet_lib::types::{
1011
compute_addresses, AccountConfig, BitcoinBlockData, BitcoinChainEvent,
11-
ChainUpdatedWithBlockData, DevnetConfigFile, PoxStackingOrder, StacksChainEvent,
12-
DEFAULT_DERIVATION_PATH,
12+
ChainUpdatedWithBlockData, DevnetConfigFile, PoxStackingOrder, ProjectManifest,
13+
StacksChainEvent, DEFAULT_DERIVATION_PATH,
1314
};
1415
use core::panic;
1516
use neon::prelude::*;
@@ -55,15 +56,19 @@ impl StacksDevnet {
5556
let channel = cx.channel();
5657

5758
let manifest_path = get_manifest_path_or_exit(Some(manifest_path.into()));
58-
let devnet = DevnetOrchestrator::new(manifest_path, Some(devnet_overrides));
59+
let manifest =
60+
ProjectManifest::from_path(&manifest_path).expect("Syntax error in Clarinet.toml.");
61+
let (deployment, _) = deployment::read_or_default_to_generated_deployment(&manifest, &None)
62+
.expect("Unable to generate deployment");
63+
let devnet = DevnetOrchestrator::new(manifest, Some(devnet_overrides));
5964

6065
let node_url = devnet.get_stacks_node_url();
6166

6267
thread::spawn(move || {
6368
if let Ok(DevnetCommand::Start(callback)) = rx.recv() {
6469
// Start devnet
6570
let (devnet_events_rx, terminator_tx) =
66-
match integrate::run_devnet(devnet, Some(log_tx), false) {
71+
match integrate::run_devnet(devnet, deployment, Some(log_tx), false) {
6772
Ok((Some(devnet_events_rx), Some(terminator_tx), _)) => {
6873
(devnet_events_rx, terminator_tx)
6974
}
@@ -158,6 +163,11 @@ impl StacksDevnet {
158163

159164
for account in accounts.iter() {
160165
let account_settings = account.downcast_or_throw::<JsObject, _>(&mut cx)?;
166+
let label = account_settings
167+
.get(&mut cx, "label")?
168+
.downcast_or_throw::<JsString, _>(&mut cx)?
169+
.value(&mut cx);
170+
161171
let id = account_settings
162172
.get(&mut cx, "id")?
163173
.downcast_or_throw::<JsString, _>(&mut cx)?
@@ -199,6 +209,7 @@ impl StacksDevnet {
199209
let (address, _, _) = compute_addresses(&mnemonic, &derivation, is_mainnet);
200210

201211
let account = AccountConfig {
212+
label,
202213
mnemonic,
203214
address,
204215
derivation,
@@ -591,7 +602,6 @@ fn main(mut cx: ModuleContext) -> NeonResult<()> {
591602
}
592603

593604
fn get_manifest_path_or_exit(path: Option<String>) -> PathBuf {
594-
println!("");
595605
if let Some(path) = path {
596606
let manifest_path = PathBuf::from(path);
597607
if !manifest_path.exists() {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub extern crate clarity_repl;
2121
#[macro_use]
2222
pub mod macros;
2323

24-
mod deployment;
24+
pub mod deployment;
2525
pub mod indexer;
2626
pub mod integrate;
2727
#[cfg(feature = "cli")]

0 commit comments

Comments
 (0)