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

Commit

Permalink
Merge remote-tracking branch 'origin/master' into repl
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Nov 4, 2019
2 parents 098a262 + 54f6486 commit 4b07cb4
Show file tree
Hide file tree
Showing 23 changed files with 411 additions and 291 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tmp-project
36 changes: 36 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
env:
es6: true
node: true
jest: true
extends: 'eslint:recommended'
parserOptions:
ecmaVersion: 2018
rules:
indent:
- error
- 4
linebreak-style:
- error
- unix
quotes:
- error
- single
semi:
- error
- always
no-console: off
globals:
jasmine: true
window: true
fetch: true
Headers: true
document: true
Cookies: true
nearConfig: true
nearlib: true
near: true
walletAccount: true
contract: true
testSettings: true


11 changes: 10 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
image: node:10
image: node:12

stages:
- test

run_tests:
stage: test
tags:
- gcloud
script:
- yarn
- yarn lint
- NODE_ENV=ci yarn test

run_tests_staging:
stage: test
tags:
- gcloud
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# NEAR command line interface

[![Build Status](https://gitlab.com/near-protocol/near-shell/badges/master/pipeline.svg)](https://gitlab.com/near-protocol/near-shell/pipelines)

The [NEAR](https://near.ai/npm) protocol library as CLI tool.
More documentation [here](https://near.ai/readme)

Expand Down
33 changes: 32 additions & 1 deletion bin/near
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const createAccount = {
.option('initialBalance', {
desc: 'Number of tokens to transfer to newly created account',
type: 'string',
required: true
default: '1000000000000000000'
}),
handler: (argv) => exitOnError(main.createAccount(argv))
};
Expand All @@ -117,6 +117,35 @@ const viewAccount = {
handler: (argv) => exitOnError(main.viewAccount(argv))
};

const deleteAccount = {
command: 'delete_account <accountId> <beneficiaryId>',
desc: 'delete an account and transfer funds to beneficiary account.',
builder: (yargs) => yargs
.option('accountId', {
desc: 'Account to view',
type: 'string',
required: true
})
.option('beneficiaryId', {
desc: 'Account to transfer funds to',
type: 'string',
required: true
}),
handler: (argv) => exitOnError(main.deleteAccount(argv))
};

const keys = {
command: 'keys <accountId>',
desc: 'view account public keys',
builder: (yargs) => yargs
.option('accountId', {
desc: 'Account to view',
type: 'string',
required: true
}),
handler: (argv) => exitOnError(main.keys(argv))
};

const txStatus = {
command: 'tx-status <hash>',
desc: 'lookup transaction status by hash',
Expand Down Expand Up @@ -206,6 +235,8 @@ yargs // eslint-disable-line
})
.command(createAccount)
.command(viewAccount)
.command(deleteAccount)
.command(keys)
.command(txStatus)
.command(build)
.command(deploy)
Expand Down
8 changes: 4 additions & 4 deletions blank_project/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const gulp = require("gulp");
const nearUtils = require("near-shell/gulp-utils");
const gulp = require('gulp');
const nearUtils = require('near-shell/gulp-utils');

function build_wasm(done){
nearUtils.compile("./assembly/main.ts", "./out/main.wasm", done);
};
nearUtils.compile('./assembly/main.ts', './out/main.wasm', done);
}

const build = gulp.series(build_wasm);

Expand Down
6 changes: 3 additions & 3 deletions blank_project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "",
"version": "0.0.1",
"scripts": {
"build": "gulp",
"build": "mkdir -p out/ && gulp",
"deploy:contract": "near deploy",
"deploy:pages": "gh-pages -d src",
"deploy": "npm run build && npm run deploy:contract && npm run deploy:pages",
Expand All @@ -16,8 +16,8 @@
"gulp": "^4.0.2",
"jest": "^24.8.0",
"jest-environment-node": "^24.8.0",
"near-runtime-ts": "github:nearprotocol/near-runtime-ts#staging",
"near-shell": "file:.."
"near-runtime-ts": "^0.5.1",
"near-shell": "github:nearprotocol/near-shell"
},
"wasmStudio": {
"name": "Hello World Example",
Expand Down
100 changes: 47 additions & 53 deletions blank_project/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,53 @@
function getConfig(env) {
switch (env) {

case 'production':
case 'development':
return {
networkId: 'default',
nodeUrl: 'https://rpc.nearprotocol.com',
contractName: CONTRACT_NAME,
walletUrl: 'https://wallet.nearprotocol.com',
initialBalance: 100000000,
};
case 'staging':
return {
networkId: 'staging',
nodeUrl: 'https://staging-rpc.nearprotocol.com/',
contractName: CONTRACT_NAME,
walletUrl: 'https://near-wallet-staging.onrender.com',
initialBalance: 100000000,
};
case 'local':
return {
networkId: 'local',
nodeUrl: 'http://localhost:3030',
keyPath: `${process.env.HOME}/.near/validator_key.json`,
walletUrl: 'http://localhost:4000/wallet',
contractName: CONTRACT_NAME,
initialBalance: 100000000,
};
case 'test':
return {
networkId: 'local',
nodeUrl: 'http://localhost:3030',
contractName: CONTRACT_NAME,
masterAccount: 'test.near',
initialBalance: 100000000,
};
case 'test-remote':
case 'ci':
return {
networkId: 'shared-test',
nodeUrl: 'http://shared-test.nearprotocol.com:3030',
contractName: CONTRACT_NAME,
masterAccount: 'test.near',
initialBalance: 100000000,
};
case 'ci-staging':
return {
networkId: 'shared-test-staging',
nodeUrl: 'http://staging-shared-test.nearprotocol.com:3030',
contractName: CONTRACT_NAME,
masterAccount: 'test.near',
initialBalance: 100000000,
};
default:
throw Error(`Unconfigured environment '${env}'. Can be configured in src/config.js.`);
case 'production':
case 'development':
return {
networkId: 'default',
nodeUrl: 'https://rpc.nearprotocol.com',
contractName: CONTRACT_NAME,
walletUrl: 'https://wallet.nearprotocol.com',
};
case 'staging':
return {
networkId: 'staging',
nodeUrl: 'https://staging-rpc.nearprotocol.com/',
contractName: CONTRACT_NAME,
walletUrl: 'https://near-wallet-staging.onrender.com',
};
case 'local':
return {
networkId: 'local',
nodeUrl: 'http://localhost:3030',
keyPath: `${process.env.HOME}/.near/validator_key.json`,
walletUrl: 'http://localhost:4000/wallet',
contractName: CONTRACT_NAME,
};
case 'test':
return {
networkId: 'local',
nodeUrl: 'http://localhost:3030',
contractName: CONTRACT_NAME,
masterAccount: 'test.near',
};
case 'test-remote':
case 'ci':
return {
networkId: 'shared-test',
nodeUrl: 'http://shared-test.nearprotocol.com:3030',
contractName: CONTRACT_NAME,
masterAccount: 'test.near',
};
case 'ci-staging':
return {
networkId: 'shared-test-staging',
nodeUrl: 'http://staging-shared-test.nearprotocol.com:3030',
contractName: CONTRACT_NAME,
masterAccount: 'test.near',
};
default:
throw Error(`Unconfigured environment '${env}'. Can be configured in src/config.js.`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion blank_project/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h3>Hi, <i id="account-id"></i>!</h3>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/gh/nearprotocol/nearlib@0.11.0/dist/nearlib.js"></script>
<script src="https://cdn.jsdelivr.net/gh/nearprotocol/nearlib@0.13.2/dist/nearlib.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script src="./config.js"></script>
<script src="./main.js"></script>
Expand Down
Loading

0 comments on commit 4b07cb4

Please sign in to comment.