Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
delete blank project and fix issues 161, 164, 165
Browse files Browse the repository at this point in the history
  • Loading branch information
icerove committed Nov 2, 2019
1 parent 54f6486 commit 2c69773
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 470 deletions.
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,31 @@ near <command>

### Commands

For account:
```bash
near login # create a developer account
near create_account <accountId> # create a developer account with masterAccount, publicKey and initialBalance
near view <accountId> # view account state
near keys <accountId> # view account public keys
near send <sender> <receiver> <amount> # send tokens to given receiver
near stake <accountId> <publicKey> <amount> # create staking transaction (base58 encoded)
near delete <accountId> <beneficiaryId> # delete an account and transfer funds to beneficiary account
```

For smart contract:
```bash
near create_account <accountId> # create a developer account
near state <accountId> # view account
near tx-status <hash> # lookup transaction status by hash
near build # build your smart contract
near deploy # deploy your smart contract
near call <contractName> <methodName> # schedule smart contract call which
[args] # can modify state
near view <contractName> <methodName> # make smart contract call which can
[args] # view state
near state <accountId> # view account
near send <receiver> <amount> # send tokens to given receiver
near clean # clean the build environment
near new_project [projectDir] # create a new blank project
near stake [accountId] [publicKey] [amount] # create staking transaction
near login # create a developer account
```

For transactions:
```bash
near tx-status <hash> # lookup transaction status by hash
```

### Options
Expand All @@ -51,4 +59,7 @@ near <command>
| --helperUrl | NEAR contract helper URL | [string] | |
| --keyPath | Path to master account key | [string] | |
| --homeDir | Where to look for master account | [string] |"~/.near" |
| --accountId, --account_id | Unique identifier for the account | [string] | |
| --accountId, --account_id | Unique identifier for the account | [string] [required]| |
| --masterAccount | Account used to create requested account. | [string] [required]| |
| --publicKey | Public key to initialize the account with | [string] [required]| |
| --initialBalance | Number of tokens to transfer to newly account | [string] [required]| |
128 changes: 59 additions & 69 deletions bin/near
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@ const exitOnError = async function(promise) {
}
}

//For smart contract:
const { spawn } = require('child_process');
const build = {
command: 'build',
desc: 'build your smart contract',
handler: (argv) => {
const gulp = spawn('gulp');
gulp.stdout.on('data', function (data) {
console.log(data.toString());
});
gulp.stderr.on('data', function (data) {
console.log(data.toString());
});
gulp.on('exit', function (code) {
process.exit(code);
});
}
};

const deploy = {
command: 'deploy',
desc: 'deploy your smart contract',
Expand Down Expand Up @@ -46,34 +65,22 @@ const callViewFunction = {
handler: (argv) => exitOnError(main.callViewFunction(argv))
};

const sendMoney = {
command: 'send <sender> <receiver> <amount>',
desc: 'send tokens to given receiver',
builder: (yargs) => yargs,
handler: (argv) => exitOnError(main.sendMoney(argv))
};

const { spawn } = require('child_process');
const build = {
command: 'build',
desc: 'build your smart contract',
handler: (argv) => {
const gulp = spawn('gulp');
gulp.stdout.on('data', function (data) {
console.log(data.toString());
});
gulp.stderr.on('data', function (data) {
console.log(data.toString());
});
gulp.on('exit', function (code) {
process.exit(code);
});
}
const clean = {
command: 'clean',
desc: 'clean the build environment',
builder: (yargs) => yargs
.option('outDir', {
desc: 'build directory',
type: 'string',
default: './out'
}),
handler: (argv) => exitOnError(main.clean(argv))
};

//For Account:
const createAccount = {
command: 'create_account <accountId>',
desc: 'create a developer account',
desc: 'create a developer account with --masterAccount, --publicKey and --initialBalance',
builder: (yargs) => yargs
.option('accountId', {
desc: 'Unique identifier for the newly created account',
Expand All @@ -100,14 +107,14 @@ const createAccount = {

const login = {
command: 'login',
desc: 'create a developer account',
desc: 'logging into NEAR wallet',
builder: (yargs) => yargs,
handler: (argv) => exitOnError(main.login(argv))
};

const viewAccount = {
command: 'state <accountId>',
desc: 'view account',
command: 'view <accountId>',
desc: 'view account state',
builder: (yargs) => yargs
.option('accountId', {
desc: 'Account to view',
Expand All @@ -118,8 +125,8 @@ const viewAccount = {
};

const deleteAccount = {
command: 'delete_account <accountId> <beneficiaryId>',
desc: 'delete an account and transfer funds to beneficiary account.',
command: 'delete <accountId> <beneficiaryId>',
desc: 'delete an account and transfer funds to beneficiary account',
builder: (yargs) => yargs
.option('accountId', {
desc: 'Account to view',
Expand All @@ -146,52 +153,16 @@ const keys = {
handler: (argv) => exitOnError(main.keys(argv))
};

const txStatus = {
command: 'tx-status <hash>',
desc: 'lookup transaction status by hash',
builder: (yargs) => yargs
.option('hash', {
desc: 'base58-encoded hash',
type: 'string',
required: true
}),
handler: (argv) => exitOnError(main.txStatus(argv))
};

const clean = {
command: 'clean',
desc: 'clean the build environment',
builder: (yargs) => yargs
.option('outDir', {
desc: 'build directory',
type: 'string',
default: './out'
}),
handler: (argv) => exitOnError(main.clean(argv))
};

const newProject = {
command: 'new_project [projectDir]',
desc: 'create a new blank project',
builder: (yargs) => yargs
.option('projectDir', {
desc: 'project directory',
type: 'string',
default: '.'
}),
handler: (argv) => exitOnError(main.newProject(argv))
};

const stake = {
command: 'stake [accountId] [publicKey] [amount]',
command: 'stake <accountId> <stakeKey> <amount>',
desc: 'create staking transaction',
builder: (yargs) => yargs
.option('accountId', {
desc: 'Account to stake on',
type: 'string',
required: true,
})
.option('publicKey', {
.option('stakeKey', {
descr: 'Public key to stake with (base58 encoded)',
type: 'string',
required: true,
Expand All @@ -202,7 +173,27 @@ const stake = {
required: true,
}),
handler: (argv) => exitOnError(main.stake(argv))
}
};

const sendMoney = {
command: 'send <sender> <receiver> <amount>',
desc: 'send tokens to given receiver',
builder: (yargs) => yargs,
handler: (argv) => exitOnError(main.sendMoney(argv))
};

//For transaction:
const txStatus = {
command: 'tx-status <hash>',
desc: 'lookup transaction status by hash',
builder: (yargs) => yargs
.option('hash', {
desc: 'base58-encoded hash',
type: 'string',
required: true
}),
handler: (argv) => exitOnError(main.txStatus(argv))
};

let config = require('../get-config')();
yargs // eslint-disable-line
Expand Down Expand Up @@ -245,7 +236,6 @@ yargs // eslint-disable-line
.command(viewAccount)
.command(sendMoney)
.command(clean)
.command(newProject)
.command(stake)
.command(login)
.config(config)
Expand Down
2 changes: 0 additions & 2 deletions blank_project/.gitattributes

This file was deleted.

6 changes: 0 additions & 6 deletions blank_project/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions blank_project/assembly/main.ts

This file was deleted.

13 changes: 0 additions & 13 deletions blank_project/assembly/model.ts

This file was deleted.

6 changes: 0 additions & 6 deletions blank_project/assembly/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions blank_project/gulpfile.js

This file was deleted.

1 change: 0 additions & 1 deletion blank_project/neardev/shared-test-staging/test.near.json

This file was deleted.

1 change: 0 additions & 1 deletion blank_project/neardev/shared-test/test.near.json

This file was deleted.

4 changes: 0 additions & 4 deletions blank_project/out/.gitignore

This file was deleted.

30 changes: 0 additions & 30 deletions blank_project/package.json

This file was deleted.

38 changes: 0 additions & 38 deletions blank_project/src/index.html

This file was deleted.

Loading

0 comments on commit 2c69773

Please sign in to comment.