GithubHelp home page GithubHelp logo

titan-suite / cli Goto Github PK

View Code? Open in Web Editor NEW
14.0 7.0 1.0 496 KB

CLI for Titan Suite

Home Page: https://titan-suite.com

License: Apache License 2.0

JavaScript 13.11% Shell 1.72% Batchfile 0.10% TypeScript 85.07%
blockchain aion titan-suite cli solidity smart-contracts aionnetwork typescript ethereum

cli's Introduction

Titan CLI

The complete Smart Contract development CLI

oclif Version CircleCI

Downloads/week License Chat

Usage

npm i -g @titan-suite/cli

module.exports = {
  defaultBlockchain: "aion",
  blockchains: {
    aion: {
      networks: {
        development: {
          host: "http://TITAN.DEV.NODE",
          defaultAccount: "",
          password: ""
        },
        mainnet: {
          host:
            "http://api.nodesmith.io/v1/aion/mainnet/jsonrpc?apiKey=API_KEY",
          defaultAccount: "",
          password: ""
        },
        testnet: {
          host:
            "https://api.nodesmith.io/v1/aion/testnet/jsonrpc?apiKey=API_KEY",
          defaultAccount: "",
          password: ""
        }
      }
    },
    ethereum: {
      networks: {
        development: {
          host: "http://127.0.0.1:8545",
          defaultAccount: "",
          password: ""
        }
      }
    }
  }
};

Commands

Help

  • titan --help

You can also run titan <command> --help for more details about the command

titan compile

Compile a Solidity smart contract

  • titan compile path/to/contracts/Example.sol
  • Compile a specific contract withing a file
    • titan compile -n SpecificContract path/to/contracts/ManyContracts.sol
  • Output more details about the contract
    • titan compile -d path/to/contracts/Example.sol
  • The details of the compiled contract will be stored as ./build/bots/<contractName>.json

titan console

Interact with an AION node with an injected aion-web3 instance

  • titan console

titan create

Create a new contract or test file

  • titan create contract Test

titan deploy

Deploy a smart contract to an AION node

  • titan deploy path/to/contracts/Example.sol
  • Deploy a specific contract within a contract file:
    • titan deploy -n Test path/to/contracts/Example.sol
  • Pass parameters: - titan deploy -p 5 path/to/contracts/Example.sol
  • The details of the deployed contract will be stored as ./build/bots/<contractName>.json

titan exec

Run Javascript files within your project

  • titan exec path/to/script

titan init

Generate an empty Titan project

  • in the current directory: titan init
  • in a new directory: titan init <name>

titan lint

Lint a smart contract

  • titan lint path/to/contracts/Example.sol
  • lint multiple files within a directory
    • titan lint path/to/contracts/**/*.sol

titan migrate

  • Create a migration file:

    // migrations/simple_migration.js
    
    const Simple = require("../build/bolts/Simple.json");
    module.exports = async deployer => {
      deployer
        .deploy(Simple)
        .then(address => {
          console.log(address);
        })
        .catch(e => {
          console.error(e);
        });
    };
  • titan migrate path/to/migration.js

titan networks

titan test

Run unit tests

  • titan test path/to/test/testExample.js

titan unlock

Unlock an account

You may be prompted to enter an AION address and/or password

  • titan unlock
  • with the account specified
    • titan unlock -a <0x..>
  • with both the account and password specified
    • titan unlock -a <0x...> -p <pwd>

titan unpack

Start a new project with a pre-built dApp

  • titan unpack
    • choose a pack from the options
  • titan unpack <name>


Test

  • Create a titanrc.js as specified above
  • yarn test

Community

Join us on Gitter

cli's People

Contributors

tcrowe avatar tojen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ben-haim

cli's Issues

Unable to compile any contracts

OS : Ubuntu 18.04 LTS

Node : v8.10.0

Npm : 3.5.2

$ npm list -g --depth 0
/usr/local/lib
+-- @angular/[email protected]
+-- @titan-suite/[email protected]
+-- [email protected]
`-- [email protected]

Commands run
./aion.sh

titan init

titan unpack

titan compile -d path/to/contracts/Example.sol

Error

$ titan compile -d contracts/Example.sol
(node:23938) Error Plugin: @titan-suite/cli: files attribute must be specified in /usr/local/lib/node_modules/@titan-suite/cli/package.json
module: @oclif/[email protected]
plugin: @titan-suite/cli
root: /usr/local/lib/node_modules/@titan-suite/cli
See more details with DEBUG=*
(node:23938) Error Plugin: @oclif/plugin-help: files attribute must be specified in /usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/plugin-help/package.json
module: @oclif/[email protected]
plugin: @oclif/plugin-help
root: /usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/plugin-help
See more details with DEBUG=*

Error with debug

$ DEBUG=* titan compile -d contracts/Example.sol
@oclif/config reading core plugin /usr/local/lib/node_modules/@titan-suite/cli +0ms
@oclif/config loadJSON /usr/local/lib/node_modules/@titan-suite/cli/package.json +0ms
@oclif/config loadJSON /usr/local/lib/node_modules/@titan-suite/cli/oclif.manifest.json +2ms
(node:24495) Error Plugin: @titan-suite/cli: files attribute must be specified in /usr/local/lib/node_modules/@titan-suite/cli/package.json
module: @oclif/[email protected]
plugin: @titan-suite/cli
root: /usr/local/lib/node_modules/@titan-suite/cli
See more details with DEBUG=*
Error Plugin: @titan-suite/cli: files attribute must be specified in /usr/local/lib/node_modules/@titan-suite/cli/package.json
at Plugin.warn (/usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/config/lib/plugin.js:173:19)
at Plugin.load (/usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/config/lib/plugin.js:35:18)
at
module: @oclif/[email protected]
plugin: @titan-suite/cli
root: /usr/local/lib/node_modules/@titan-suite/cli
See more details with DEBUG=*
@oclif/config loadJSON /usr/local/lib/node_modules/@titan-suite/cli/.oclif.manifest.json +2ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +1ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +20ms
@oclif/config:@titan-suite/cli loading IDs from /usr/local/lib/node_modules/@titan-suite/cli/lib/commands +0ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +0ms
@oclif/config:@titan-suite/cli found commands [ 'compile',
'console',
'deploy',
'init',
'lint',
'test',
'unlock',
'unpack' ] +8ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +10ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +0ms
@oclif/config:@titan-suite/cli require /usr/local/lib/node_modules/@titan-suite/cli/lib/commands/compile.js +2ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +201ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +0ms
@oclif/config:@titan-suite/cli require /usr/local/lib/node_modules/@titan-suite/cli/lib/commands/console.js +201ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +4ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +0ms
@oclif/config:@titan-suite/cli require /usr/local/lib/node_modules/@titan-suite/cli/lib/commands/deploy.js +5ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +166ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +1ms
@oclif/config:@titan-suite/cli require /usr/local/lib/node_modules/@titan-suite/cli/lib/commands/init.js +167ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +2ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +0ms
@oclif/config:@titan-suite/cli require /usr/local/lib/node_modules/@titan-suite/cli/lib/commands/lint.js +1ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +0ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +1ms
@oclif/config:@titan-suite/cli require /usr/local/lib/node_modules/@titan-suite/cli/lib/commands/test.js +1ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +46ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +0ms
@oclif/config:@titan-suite/cli require /usr/local/lib/node_modules/@titan-suite/cli/lib/commands/unlock.js +47ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +1ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +0ms
@oclif/config:@titan-suite/cli require /usr/local/lib/node_modules/@titan-suite/cli/lib/commands/unpack.js +0ms
@oclif/config reading user plugins pjson /home/max/.local/share/@titan-suite/cli/package.json +0ms
@oclif/config loadJSON /home/max/.local/share/@titan-suite/cli/package.json +8ms
@oclif/config loading plugins [ '@oclif/plugin-help' ] +20ms
@oclif/config reading core plugin /usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/plugin-help +0ms
@oclif/config loadJSON /usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/plugin-help/package.json +20ms
@oclif/config loadJSON /usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/plugin-help/oclif.manifest.json +2ms
(node:24495) Error Plugin: @oclif/plugin-help: files attribute must be specified in /usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/plugin-help/package.json
module: @oclif/[email protected]
plugin: @oclif/plugin-help
root: /usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/plugin-help
See more details with DEBUG=*
Error Plugin: @oclif/plugin-help: files attribute must be specified in /usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/plugin-help/package.json
at Plugin.warn (/usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/config/lib/plugin.js:173:19)
at Plugin.load (/usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/config/lib/plugin.js:35:18)
at
module: @oclif/[email protected]
plugin: @oclif/plugin-help
root: /usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/plugin-help
See more details with DEBUG=*
@oclif/config:@oclif/plugin-help using manifest from /usr/local/lib/node_modules/@titan-suite/cli/node_modules/@oclif/plugin-help/oclif.manifest.json +0ms
@oclif/config config done +3ms
@oclif/config start init hook +0ms
@oclif/config init hook done +1ms
titan init version: @oclif/[email protected] argv: [ 'compile', '-d', 'contracts/Example.sol' ] +0ms
@oclif/config runCommand compile [ '-d', 'contracts/Example.sol' ] +8ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +11ms
@oclif/config loadJSONSync /usr/local/lib/node_modules/@titan-suite/cli/tsconfig.json +0ms
@oclif/config:@titan-suite/cli require /usr/local/lib/node_modules/@titan-suite/cli/lib/commands/compile.js +42ms
@oclif/config start prerun hook +2ms
@oclif/config prerun hook done +0ms
titan:compile init version: @oclif/[email protected] argv: [ '-d', 'contracts/Example.sol' ] +0ms

I have tried reinstalling Titan CLI and Aion node but it didn't help.

Running Testnet

It would be great if you could provide some type of local testnet with the cli. the functionality would be like ganache-cli or when you run truffle develop

titan init overwrite idea

Hey guys πŸ‘‹

When I did titan init it blew away my package.json. It's not a problem as one should expect any init to write to a fresh directory. Maybe it could give a warning (y/n)? in the prompt.

Did you ever talk about that?

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Deploy error

When I try to deploy a contract I get the following error:

(node:22498) UnhandledPromiseRejectionWarning: Error: Action not allowed
at Object.InvalidResponse (/usr/local/lib/node_modules/@titan-suite/cli/node_modules/aion-web3/lib/web3/errors.js:38:16)
at /usr/local/lib/node_modules/@titan-suite/cli/node_modules/aion-web3/lib/web3/requestmanager.js:88:36
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/@titan-suite/cli/node_modules/aion-web3/lib/web3/httpprovider.js:120:13)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/@titan-suite/cli/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/@titan-suite/cli/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/@titan-suite/cli/node_modules/xhr2/lib/xhr2.js:509:12)
at IncomingMessage. (/usr/local/lib/node_modules/@titan-suite/cli/node_modules/xhr2/lib/xhr2.js:469:24)
at IncomingMessage.emit (events.js:165:20)
at endReadableNT (_stream_readable.js:1101:12)
at process._tickCallback (internal/process/next_tick.js:152:19)
(node:22498) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:22498) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.


The deploy is using the first account on the accounts list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.