0.1.73 • Published 1 month ago

scrypt-cli v0.1.73

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

sCrypt CLI

A CLI tool to make development of sCrypt faster and easier.

Build Status

Usage

Note: Node version 16 or greater is required.

Create a new sCrypt smart contract project

npx scrypt-cli project my-proj

or simply

npx scrypt-cli p my-proj

The command creates a new directory my-proj which contains a demo sCrypt smart contract along with needed scaffolding.

Read the projects README.md for more info on how to test and deploy the generated smart contract.

You can also use the following command to generate a stateful smart contract project:

npx scrypt-cli p --state my-proj

Lastly, you can create an sCrypt library project with the following option:

npx scrypt-cli p --lib my-lib

Install sCrypt in an existing front-end project

Currently only supports projects created by Create React App

npx create-react-app my-app --template typescript
cd my-app
git init && git add . && git commit -m "Initial commit." 
npx scrypt-cli init

Compile sCrypt smart contracts

npx scrypt-cli compile

This will search current project for classes extending SmartContract and compile them. This will produce a contract artifact file for each compiled class. The files will be stored under the artifacts directory.

The command needs to run in the root directory of the project.

Compile sCrypt Smart Contract under Watch

npx scrypt-cli compile --watch

Initiate smart contract compilation in watch mode. This mode allows you to observe real-time updates and notifications regarding any errors specific to the smart contract compilation phase, which are distinct from TypeScript errors. During watch mode, smart contracts get automatically compiled after a change is made to any of the smart contract source files.

Compile using the --asm option

npx scrypt-cli compile --asm

The --asm option is used to apply inline assembly optimizations. These are defined under the .asm/ directory in the root of the project (auto genereted when using --asm option with the project command). Read more in the docs.

Deploy sCrypt smart contracts

npx scrypt-cli deploy

This will create a deployment script template deploy.ts if it doesn't exist yet. If it does it executes it. Projects generated using the sCrypt CLI will already have deploy.ts present.

You can also run a deployment script with a different name using the f option:

npx scrypt-cli deploy -f myDeployScript.ts

Verify a deployed smart contract

With the verify you can verify that a already deployed output script was produced by the specified sCrypt code.

npx scrypt-cli verify <scriptHash> <contractPath>

The first positional argument is the double-SHA256 hash of the deployed output script, commonly used by block explorers to index scripts. The second one is the path to the file which contains the sCrypt smart contract. Note, that the file must also include all the code it depends on, i.e. third party libraries.

Using the network option, you can specify on which network the contract is deployed. This defaults to test, indicating the Bitcoin testnet:

npx scrypt-cli verify --network main <scriptHash> <contractPath>

You can also specify the version of sCrypt used during verification. By default, the command will use the version specified in package.json:

npx scrypt-cli verify -V 0.2.1-beta.9 <scriptHash> <contractPath>

Get system info

When filing an issue a lot of time it's useful to provide information about your system. You can get this information with the following command:

npx scrypt-cli system

Show version

Show the version of scrypt-cli:

npx scrypt-cli -v

Using latest version

  1. run command with latest tag:
npx scrypt-cli@latest -v

or

  1. clear cache to fetch the latest version:
npx clear-npx-cache
npx scrypt-cli -v
0.1.73

1 month ago

0.1.72

1 month ago

0.1.71

2 months ago

0.1.70

3 months ago

0.1.69

3 months ago

0.1.68

3 months ago

0.1.67

3 months ago

0.1.63

7 months ago

0.1.64

6 months ago

0.1.65

6 months ago

0.1.66

6 months ago

0.1.61

7 months ago

0.1.62

7 months ago

0.1.54

8 months ago

0.1.55

7 months ago

0.1.56

7 months ago

0.1.57

7 months ago

0.1.58

7 months ago

0.1.59

7 months ago

0.1.60

7 months ago

0.1.52

8 months ago

0.1.53

8 months ago

0.1.50

8 months ago

0.1.51

8 months ago

0.1.49

8 months ago

0.1.41

9 months ago

0.1.42

9 months ago

0.1.43

9 months ago

0.1.44

9 months ago

0.1.45

8 months ago

0.1.46

8 months ago

0.1.47

8 months ago

0.1.48

8 months ago

0.1.40

9 months ago

0.1.38

9 months ago

0.1.39

9 months ago

0.2.0-test.1

10 months ago

0.1.30

10 months ago

0.1.31

10 months ago

0.1.32

10 months ago

0.1.33

10 months ago

0.1.34

9 months ago

0.1.35

9 months ago

0.1.36

9 months ago

0.1.37

9 months ago

0.1.27

10 months ago

0.1.28

10 months ago

0.1.29

10 months ago

0.1.26

11 months ago

0.1.34-test.3

10 months ago

0.1.34-test.2

10 months ago

0.1.34-test.1

10 months ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.20

1 year ago

0.1.21

1 year ago

0.1.22

1 year ago

0.1.23

1 year ago

0.1.24

1 year ago

0.1.25

12 months ago

0.1.16

1 year ago

0.1.8

1 year ago

0.1.17

1 year ago

0.1.7

1 year ago

0.1.18

1 year ago

0.1.19

1 year ago

0.1.9

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago