Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static flags = {
...BaseCommand.flags,
multisigFee: customFlags.number({
description: "multisig fee",
default: 5,
}),
min: flags.integer({
description: "minimum number of signatures per transaction",
default: 2,
}),
lifetime: flags.integer({
description: "lifetime of transaction",
default: 72,
}),
quantity: flags.integer({
description: "number of signatures per wallet",
default: 3,
}),
skipTests: flags.boolean({
description: "skip transaction tests",
}),
};
/**
* Run multi-signature command.
* @return {void}
*/
public async run(): Promise {
// tslint:disable-next-line: no-shadowed-variable
const { flags } = await this.initialize(MultiSignatureCommand);
const axios = require('axios')
// This overrides console.table in nodejs >= 9.x
require('console.table')
const CONTENT_TYPE_JSON = 'application/vnd.api+json'
const FETCH_TIMEOUT = 5000
const SERVICE_AGREEMENTS_PATH = '/v2/service_agreements'
const ACCOUNT_BALANCE_PATH = '/v2/user/balances'
function urlWithPath(t, path) {
const u = new URL(t)
u.pathname = path
return u.toString()
}
class SaRequester extends command.Command {
async run() {
const { args, flags } = this.parse(SaRequester)
const agreement = JSON.parse(fs.readFileSync(flags.agreement, 'utf8'))
const oracleURLs = args.file.split(/\s+/)
const addresses = await getOracleAddresses(oracleURLs)
createServiceAgreements(agreement, addresses, oracleURLs)
.then(signatures => console.table(['address', 'signature'], signatures))
.catch(e =>
console.log('Unable to create SA, got error:\n\n\t%s\n', e.message),
)
}
}
const parseError = ({ response }) => {
if (response.status === 422) {
// TODO(yorke): implement log(msg) switch on logLevel with chalk colored output
log(msg: string, logLevel: string = 'info') {
if (logLevel === 'info') {
console.debug(msg)
} else if (logLevel === 'error') {
console.error(msg)
}
}
}
// tslint:disable-next-line:max-classes-per-file
export abstract class BaseCommand extends LocalCommand {
static flags = {
...LocalCommand.flags,
privateKey: flags.string({ hidden: true }),
node: flags.string({ char: 'n', hidden: true }),
}
// This specifies whether the node needs to be synced before the command
// can be run. In most cases, this should be `true`, so that's the default.
// For commands that don't require the node is synced, add the following line
// to its definition:
// requireSynced = false
public requireSynced: boolean = true
private _web3: Web3 | null = null
private _kit: ContractKit | null = null
// This is required since we wrap the provider with a debug provider and
// there is no way to unwrap the provider afterwards.
// We need access to the original provider, so that, we can close it.
private _originalProvider: any | null = null
import { ContractKit, newKitFromWeb3 } from '@celo/contractkit'
import { CeloProvider } from '@celo/contractkit/lib/providers/celo-provider'
import { Command, flags } from '@oclif/command'
import { ParserOutput } from '@oclif/parser/lib/parse'
import Web3 from 'web3'
import { getNodeUrl } from './utils/config'
import { injectDebugProvider } from './utils/eth-debug-provider'
import { requireNodeIsSynced } from './utils/helpers'
// Base for commands that do not need web3.
export abstract class LocalCommand extends Command {
static flags = {
logLevel: flags.string({ char: 'l', hidden: true }),
help: flags.help({ char: 'h', hidden: true }),
truncate: flags.boolean({
default: true,
hidden: true,
allowNo: true,
description: 'Truncate fields to fit line',
}),
}
// TODO(yorke): implement log(msg) switch on logLevel with chalk colored output
log(msg: string, logLevel: string = 'info') {
if (logLevel === 'info') {
console.debug(msg)
} else if (logLevel === 'error') {
console.error(msg)
}
}
import { checkAppDir } from './utils/checkAppDir'
import { createApp } from './utils/createApp'
import { createAppDir } from './utils/createAppDir'
import { getProjectType } from './utils/getProjectType'
import { install } from './utils/install'
import { setAppName } from './utils/setAppName'
import { showTips } from './utils/showTips'
const { green, yellow } = chalk
class CreateDahliaApp extends Command {
static description = 'describe the command here'
static flags = {
// add --version flag to show CLI version
version: flags.version({ char: 'v' }),
help: flags.help({ char: 'h' }),
}
static args = [{ name: 'appName' }]
async run() {
const { args } = this.parse(CreateDahliaApp)
const appName: string = args.appName
if (!appName) {
return this.log(yellow('required project name, eg: '), green('create-dahlia-app myapp'))
}
const root = path.resolve(appName)
console.log(yosay('您正在初始化 dahlia 项目...'))
try {
import { SnapshotManager } from "@arkecosystem/core-snapshots";
import { flags } from "@oclif/command";
import _cliProgress from "cli-progress";
import { setUpLite } from "../utils";
import { BaseCommand } from "./command";
export class RestoreCommand extends BaseCommand {
public static description: string = "import data from specified snapshot";
public static flags = {
...BaseCommand.flags,
blocks: flags.string({
description: "blocks to import, correlates to folder name",
required: true,
}),
codec: flags.string({
description: "codec name, default is msg-lite binary",
}),
truncate: flags.boolean({
description: "empty all tables before running import",
}),
skipRestartRound: flags.boolean({
description: "skip revert to current round",
}),
signatureVerify: flags.boolean({
description: "signature verification",
}),
};
public async run(): Promise {
// tslint:disable-next-line:no-shadowed-variable
const { flags } = this.parse(RestoreCommand);
}
}
PropertyGet.flags = {
// override property command flags, they need to be boolean type, not string
...Object.assign(RuntimeBaseCommand.flags, RuntimeBaseCommand.propertyFlags({ asBoolean: true })),
namespace: flags.boolean({
description: 'whisk namespace'
}),
all: flags.boolean({
description: 'all properties'
}),
apibuild: flags.boolean({
description: 'whisk API build version'
}),
apibuildno: flags.boolean({
description: 'whisk API build number'
}),
cliversion: flags.boolean({
description: 'whisk CLI version'
})
}
PropertyGet.description = 'get property'
PropertyGet.aliases = [
'runtime:prop:get',
'rt:property:get',
'rt:prop:get'
]
module.exports = PropertyGet
import {Command, flags} from '@oclif/command'
import Listr = require('listr');
import { AppConfig } from 'json-serverless-lib';
import * as child from 'child_process';
import * as path from 'path';
import fs from 'fs';
export class Deploy extends Command {
static description = 'describe the command here'
static flags = {
help: flags.help({char: 'h'}),
// flag with no value (-f, --force)
name: flags.string({
char: 'n', // shorter flag version
description: 'name of the api/stack', // help description for flag
hidden: false, // hide from help
multiple: false, // allow setting this flag multiple times
default: 'json-serverless', // default value if flag not passed (can be a function that returns a string or undefined)
required: true, // make flag required (this is not common and you should probably use an argument instead)
}),
readonly: flags.boolean({
char: 'r', // shorter flag version
description: 'set api to readonly (true) or writeable (false)', // help description for flag
hidden: false, // hide from help
default: false, // default value if flag not passed (can be a function that returns a string or undefined)
required: false, // default value if flag not passed (can be a function that returns a string or undefined)
}),
import cli from 'cli-ux';
import * as inquirer from 'inquirer';
// Project Modules
import { appService } from '../../_service/app.service';
export default class Col extends Command {
static description = 'add new collaborators, as well ad showing the list of collaborators';
static examples = [
`$ sakku app:col`,
`$ sakku app:col -a`
];
static flags = {
help: flags.help({ char: 'h' }),
add: flags.boolean({ char: 'a', exclusive: ['edit', 'delete'] }),
edit: flags.boolean({ char: 'e', exclusive: ['add', 'delete'] }),
delete: flags.boolean({ char: 'e', exclusive: ['add', 'edit'] }),
};
static args = [
{
name: 'app',
required: false,
description: 'app id/name',
hidden: false
},
];
async run() {
const { args, flags } = this.parse(Col);
https://my-graphql-endpoint/graphql \\
-H 'Authorization: token ' \\
-H 'X-Another-Header: another-header-value' \\
-v 'variable1=value1' \\
-v 'variable2=value2' \\
-q 'query { table { column } }'
`;
GraphqurlCommand.usage = 'ENDPOINT [-q QUERY]';
GraphqurlCommand.flags = {
// add --version flag to show CLI version
version: flags.version(),
// add --help flag to show CLI version
help: flags.help({char: 'h'}),
// query for graphql
query: flags.string({
char: 'q',
description: 'graphql query to execute',
}),
// headers, comma separated if they are many
header: flags.string({
char: 'H',
description: 'request header',
multiple: true,
}),
// variables for the query
variable: flags.string({