Skip to content
Javascript SDK for interacting with Clarity smart contracts
TypeScript Scheme JavaScript Shell
Branch: master
Clone or download
Latest commit 93df053 Jul 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Lint fix, run lint on circleCI, lerna package lock update Jul 1, 2019
.vscode Return debugOutput on deployContract (not currently used in test beca… Jun 27, 2019
packages version bumps Jul 9, 2019
tools Update git tag and binary dists for latest native clarity-cli Jun 7, 2019
.codecov.yml Prevent codecov from failing PR checks with coverage changes -- repor… Jun 12, 2019
.editorconfig
.gitignore Implement programmatically runnable dev-app-gen using yeoman-environment Jun 23, 2019
CONTRIBUTING.md Update LICENSE / README / CONTRIBUTING May 24, 2019
LICENSE Update LICENSE / README / CONTRIBUTING May 24, 2019
README.md Add README instructions for generator usage Jun 17, 2019
appveyor.yml
lerna.json v0.1.10-alpha.0 Jul 9, 2019
package-lock.json 1. use fs-extra instead of fs Jul 1, 2019
package.json
tsconfig.build.json * Enable strictNullChecks and fix all violations. Jun 12, 2019
tsconfig.json Update version from merge, fix tslint Jun 17, 2019

README.md

Clarity JS SDK

A development environment, testing framework, and deployment tool for Clarity smart contracts.

Features:

  • TypeScript / JavaScript framework for building smart contracts using test driven development.
  • [WIP] Library for interacting with smart contracts from a dapp (a web3 equivalent).
  • [WIP] Type declaration generation (.d.ts) for easy and safer interactions with smart contracts.
  • [roadmap] Language-server-protocol implementation.
  • [roadmap] Code coverage generation.

Usage

Smart Contract Development

TypeScript

Quick Start:

npm init yo clarity-dev
npm test

See generator-clarity-dev for more details.

JavaScript

Quick Start:

Not yet available

clarity-cli

npm install -g @blockstack/clarity-cli
clarity help

See clarity-cli/README.md for detailed usage.

clarity-tutorials

TODO: Determine and document intended usage of this package.

npm install @blockstack/clarity-tutorials

Local Development

Repo structure and project build instructions for contributors.

Requirements

  • Node.js v10 or higher is required.
  • Several packages require the native clarity-cli binary -- distributes are automatically installed on MacOS, Windows (64-bit), and Linux (64-bit).

    It will be compiled from source if using an OS or architecture not listed. This requires the Rust toolchain -- rustup is the recommended installer. A C compiler must also be available (gcc, clang, and msvc are supported). See clarity-native-bin for more details.

Build Instructions

  • Open terminal / command prompt to the root project directory containg the top-level package.json.
  • Run npm install. This automatically triggers lerna bootstrap to configure local packages in the repo.

Pulling Updates

Run npm run rebuild when pulling repo changes to an already setup local environment. This ensures the local environment is setup correctly after any changes to cross-dependencies or new libs.

Rebuild does the following:

  • Removes node_modules directories, removes the compiled packages/*/lib directories, removes the *.tsbuildinfo cached build metadata.
  • Runs lerna bootstrap to install dependencies and configures cross-dependency symlinks.
  • Runs tsc --build [...] on all packages.

Project Structure

This is a multi-package monorepo.

  • TypeScript module path mapping is used for packages with cross-dependencies. These paths are specified in the default tsconfig.json files. This is the config picked up by an editor/IDE/debugger for mapping absolute package names back to their source code in the monorepo.
  • TypeScript project references are used for npm build and package publishing. This is configured in the tsconfig.build.json files.
  • Lerna is used to manage multiple packages in the monorepo.

The Lerna features in use:

  • lerna bootstrap - Setup packages in the current Lerna repo; installs all of their dependencies and links any cross-dependencies.
  • lerna run [npm script] - Run an npm script in each package that contains that script, e.g. lerna run lint.
  • lerna version - Identify packages that have been updated since last release, increment package.json versions, commit to git. See docs for details.
  • lerna publish - Publish packages that have been updated since the last time a release was made.

File Tree

.
├── package.json
├── lerna.json
├── tsconfig.json
├── tsconfig.build.json
└── packages/
    ├── lib-a/
    │   ├── package.json
    │   ├── tsconfig.json
    │   ├── tsconfig.build.json
    │   ├── src/
    │   │   └── index.ts
    │   └── test/
    │       ├── **/*.ts [test source files]
    │       └── mocha.opts
    └── lib-a/
        ├── package.json
        ├── tsconfig.json
        ├── tsconfig.build.json
        ├── src/
        │   └── index.ts
        └── test/
            ├── **/*.ts [test source files]
            └── mocha.opts

Publishing

Run the following commands:

npm run rebuild
npm run test
npm run version-bump
npm run pub
You can’t perform that action at this time.