Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@digicatapult/sqnc-process-management

Package Overview
Dependencies
Maintainers
0
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@digicatapult/sqnc-process-management

SQNC Process Management Flow

  • 2.2.105
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
344
decreased by-43.79%
Maintainers
0
Weekly downloads
 
Created
Source

sqnc-process-management

A Library for managing restricted process flows in the Sequence (SQNC) ledger-based system.

Getting started

For the basic application to work and for locally run tests to work docker-compose up must be run.

The build command should be run first to create the converted ts files.

npm run build

To start the basic application

npm run local

To install npm CLI tool. It will be linked to local binaries so can be executed as process-management

npm i -g

using CLI

process-management help

Options

sqnc-process-management takes the following arguments to configure the Polkadot.js API connection:

variablerequireddefaultdescription
hostNlocalhostThe hostname of the sqnc-node the API should connect to
portN9944The port of the sqnc-node the API should connect to
userY-The Substrate URI representing the private key to use when making sqnc-node transactions. //Alice for dev chain

For the full list of available restrictions see sqnc-node

Help

Returns all available commands

$ process-management
Usage: process management [options] [command]

a command line interface for managing chain processes

Options:
  -v, --version                     output current version
  --help                            display help for command

Commands:
  list [options]                    A command for listing all active process flows
  create [options] <json>           A command for persisting process flows onto the chain
  disable [options] <id> <version>  A command for disabling an existing process flows. Required process ID and version
  help [command]                    display help for command

Create Process Command

$ process-management help create
Usage: process management create [options] <json>

A command for persisting process flows onto the chain

Options:
  --dryRun           to validate process and response locally before persisting on the chain, default - false
  --verbose          Returns all information about the transation, default - false
  -h, --host <host>  substrate blockchain host address or FQDM, default - "localhost" (default: "localhost")
  -p, --port <port>  specify host port number if it is not a default, default - 9944 (default: "9944")
  -f, --file <file>  path to file containing process flows to loads
  -u, --user <user>  specify substrate blockchain user URI
  --help             display help for command

#
# example
#

$ process-management create -h localhost -p 9944 -u //Alice '[{"name":"A test","version":1,"program":[{"restriction":{"FixedNumberOfOutputs":{"numOutputs":1}}},{"restriction":{"None":{}}},{"op":"Or"}]}]'

{
  'A test': {
    message: 'Transaction for new process A test has been successfully submitted',
    process: {
      id: 'A test',
      version: 1,
      status: 'Enabled',
      program: [
        { restriction: { FixedNumberOfOutputs: { numOutputs: 1 } } },
        { restriction: { None: {} } },
        { op: 'Or' }
      ]
    }
  }
}

Or use a .json file

process-management create -h localhost -p 9944 -u //Alice "$(cat exampleProcess.json)"

Disable Process Command

$ process-management help disable
Usage: process management disable [options] <id> <version>

A command for disabling an existing process flows. Required process ID and version

Arguments:
  id                 a valid process id that you would like to disable
  version            a version number of a process

Options:
  --dryRun           to validate process and response locally before persisting on the chain, default - false
  -h, --host <host>  substrate blockchain host address or FQDM, default - "localhost" (default: "localhost")
  -p, --port <port>  specify host port number if it is not a default, default - 9944 (default: "9944")
  --print            print debugging info
  -u, --user <user>  specify substrate blockchain user URI
  --help             display help for command

#
# example
#

# let's create so we have something to disable
$ process-management create -u //Alice -f ./exampleProcess.json

{
  'B test': {
    message: 'Transaction for new process B test has been successfully submitted',
    process: {
      id: 'B test',
      version: 1,
      status: 'Enabled',
      program: [
        { restriction: { FixedNumberOfOutputs: { numOutputs: 1 } } },
        { restriction: { None: {} } },
        { op: 'Or' }
      ]
    }
  }
}

$ process-management disable -u //Alice 'B test' '1'

{
  message: 'Process has been disabled',
  process: { id: 'B test', version: 1, status: 'Disabled' }
}

List Processes Command

$ process-management list --help
Usage: process management list [options]

A command for listing all active process flows

Options:
  -h, --host <host>  substrate blockchain host address or FQDM, default - "localhost" (default: "localhost")
  -p, --port <port>  specify host port number if it is not a default, default - 9944 (default: "9944")
  --raw              print processes with hex values and extra keys such as "createdAtHash"
  --active           returns only active process flows
  --disabled         returns only disabled process flows
  --print            print debugging info
  --help             display help for command

#
# example
#

$ process-management list --active
[
  {
    id: 'default',
    version: 1,
    status: 'Enabled',
    program: [ { restriction: { none: null } } ]
  }
]

Running tests

Unit tests can be run without docker using:

npm run test:unit

To run the integration test suite first bring up the test dependency services using docker

docker compose -f ./docker-compose-test.yaml up -d

And then to run the tests

npm run test

FAQs

Package last updated on 26 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc