New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

devphase

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devphase

Development tool for Phala Phat contracts.

  • 0.0.16
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

devPHAse

Development tool for Phala Phat contracts.

Install

Add to your projects using package manager (yarn@^1 / npm)

yarn add -D devphase
yarn add -D typescript ts-node # required peer dependencies

Features

  • Init project (creates required files and directories)
yarn devphase init
  • Starting local stack (node + pruntime + pherry)
yarn devphase stack
  • Contracts compilation
yarn devphase compile [contractName] [--watch]
  • Contracts TS bindings creation
yarn devphase typings [contractName]
  • Testing with mocha
yarn devphase test

Configuration

Create devphase.config.ts in root directory (init command in TODO)

Here is default configuration. All values are optional (merged recuresivly)

import { ProjectConfigOptions } from 'devphase';

const config : ProjectConfigOptions = {
    // project directories
    directories: {
        artifacts: 'artifacts',
        contracts: 'contracts',
        logs: 'logs',
        tests: 'tests',
        typings: 'typings'
    },
    /*
     * Stack configuration
     * {
     *     [componentName : string]: {
     *          binary: string, // path to binary; magic phrase "#DEVPHASE#" is replaced with package root dir
     *          workingDir: string, // working directory as above
     *          evns: {
     *              [name: string]: string,
     *          },
     *          args: {
     *              [name: string]: string,
     *          },
     *          timeout: number // start up timeout
     *     }
     * }
     */
    stack: {
        node: {
            port: 9944, // ws port
            binary: '#DEVPHASE#/phala-dev-stack/bin/node',
            workingDir: '#DEVPHASE#/phala-dev-stack/.data/node',
            envs: {},
            args: {
                '--dev': true,
                '--rpc-methods': 'Unsafe',
                '--block-millisecs': 6000,
                '--ws-port': '{{stack.port.port}}'
            },
            timeout: 10000,
        },
        pruntime: {
            port: 8000, // server port
            binary: '#DEVPHASE#/phala-dev-stack/bin/pruntime',
            workingDir: '#DEVPHASE#/phala-dev-stack/.data/pruntime',
            envs: {},
            args: {
                '--allow-cors': true,
                '--cores': 0,
                '--port': '{{stack.pruntime.port}}'
            },
            timeout: 2000,
        },
        pherry: {
            gkMnemonic: '//Alice', // gate keeper mnemonic
            binary: '#DEVPHASE#/phala-dev-stack/bin/pherry',
            workingDir: '#DEVPHASE#/phala-dev-stack/.data/pherry',
            envs: {},
            args: {
                '--no-wait': true,
                '--mnemonic': '{{stack.pherry.gkMnemonic}}',
                '--inject-key': '0000000000000000000000000000000000000000000000000000000000000001',
                '--substrate-ws-endpoint': 'ws://localhost:{{stack.node.port}}',
                '--pruntime-endpoint': 'http://localhost:{{stack.pruntime.port}}',
                '--dev-wait-block-ms': 1000,
            },
            timeout: 2000,
        }
    },
    /**
     * Configuration options of DevPhase instance used in testing
     */
    devPhaseOptions: {
        nodeUrl: 'ws://localhost:{{stack.node.port}}',
        nodeApiOptions: {
            types: {
                ...KhalaTypes,
                ...PhalaSDKTypes,
            }
        },
        workerUrl: 'http://localhost:{{stack.pruntime.port}}',
        accountsMnemonic: '', // default account
        accountsPaths: {
            alice: '//Alice',
            bob: '//Bob',
            charlie: '//Charlie',
            dave: '//Dave',
            eve: '//Eve',
            ferdie: '//Ferdie',
        },
        sudoAccount: 'alice',
        ss58Prefix: 30,
        clusterId: undefined, // if specified - it will be used as default cluster for deployments
    },
    /**
     * Testing configuration
     */
    testing: {
        mocha: {}, // custom mocha configuration
        envSetup: { // environment setup
            setup: {
                custom: undefined, // custom setup procedure callback; (devPhase) => Promise<void>
                timeout: 60 * 1000,
            },
            teardown: {
                custom: undefined, // custom teardown procedure callback ; (devPhase) => Promise<void>
                timeout: 10 * 1000,
            }
        },
        blockTime: 100, // overrides block time specified in node (and pherry) component
        stackLogOutput : false, // if specifed pipes output of all stack component to file (by default it is ignored)
    }
};

export default config;

Usage sample

Check usage sample repo

Sandbox

Check sandbox environment repo for easy testing with up-to-date code

TODO

check here

FAQs

Package last updated on 08 Nov 2022

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