Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

feat: simplify local substrate process management #138

Merged
merged 4 commits into from
Jun 27, 2022

Conversation

harrysolovay
Copy link
Contributor

One can point to a Substrate project or exe.

const process = await substrateProcess({
  path: "./node-template",
  dev: true,
});

They can then reference the process in a beacon.

const chain = C.chain(new C.ProxyBeacon(process.url));

This makes interacting with a local (likely a development) chain a breeze.

This is abstracted over by the test utils. One can do as follows.

import * as C from "../mod.ts";

// Init the local test chain
const node = await C.test.node();

// Reference it
const chain = C.test.chain(node);

// Grab Alice's public key
const alice = await chain.address.alice.asPublicKeyBytes();

// Read her balance
const result = await chain
  .pallet("System")
  .entry("Account", alice)
  .read();

console.log({ result });

// Terminate the local chain when you're done
node.close();

@harrysolovay harrysolovay merged commit afdb686 into main Jun 27, 2022
@harrysolovay harrysolovay deleted the decouple-local-init-from-client branch June 27, 2022 15:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant