-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 Add several generators to ddn command line tools
- Loading branch information
Showing
20 changed files
with
492 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,19 +26,7 @@ https://unpkg.com/browse/@ddn/[email protected]/index.browserify.min.js | |
|
||
放在您工程文件合适的位置 | ||
|
||
### **1.2 初始化** | ||
|
||
`js-sdk`在使用前,首先进行初始化。 | ||
|
||
`init(nethash)` | ||
|
||
- `nethash` 节点网络 | ||
|
||
``` | ||
DdnJS.init('0ab796cd') | ||
``` | ||
|
||
### **1.3 说明** | ||
### **1.2 说明** | ||
很多函数都需要传入secret、secondSecret这2个参数,分表代表密码和二级密码,下面章节不再赘述。 | ||
自定如下全局变量,用于之后章节代码演示。 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { generateDapp } from '../../plugins/generator' | ||
|
||
module.exports = { | ||
command: 'generate <name>', | ||
aliases: 'g', | ||
desc: 'Create an empty dapp from template', | ||
builder: {}, | ||
|
||
handler: function (argv) { | ||
generateDapp(argv.name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
command: 'generate [command]', | ||
aliases: 'g', | ||
desc: 'DDN generate tools.', | ||
builder: function (yargs) { | ||
return yargs.commandDir('generator') | ||
}, | ||
|
||
handler: function (argv) { | ||
console.log('Hi, please select a command, e.g: ddn g blockchain, --help') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { generateBlockchain } from '../../plugins/generator' | ||
|
||
module.exports = { | ||
command: 'blockchain <name>', | ||
aliases: 'b', | ||
desc: 'Generate new blockchain.', | ||
builder: { | ||
|
||
}, | ||
|
||
handler: function (argv) { | ||
generateBlockchain(argv.name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { generateContract } from '../../plugins/generator' | ||
|
||
module.exports = { | ||
command: 'contract <name>', | ||
aliases: 'c', | ||
desc: 'Generate new contract.', | ||
builder: { | ||
|
||
}, | ||
|
||
handler: function (argv) { | ||
generateContract(argv.name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { generateDapp } from '../../plugins/generator' | ||
|
||
module.exports = { | ||
command: 'dapp <name>', | ||
aliases: 'd', | ||
desc: 'Create an empty dapp from template.', | ||
builder: {}, | ||
|
||
handler: function (argv) { | ||
generateDapp(argv.name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { genGenesisBlock } from '../../plugins/generator' | ||
|
||
module.exports = { | ||
command: 'genesisBlock', | ||
aliases: 'gb', | ||
desc: 'Generate new genesis block.', | ||
builder: { | ||
file: { | ||
alias: 'f', | ||
describe: 'genesis accounts balance file' | ||
}, | ||
secret: { | ||
alias: 's', | ||
describe: 'genesisAccount`s secret, default is the DDN`s testnet secret' | ||
}, | ||
nethash: { | ||
alias: 'n', | ||
describe: 'Default to generate a new nethash' | ||
}, | ||
tokenPrefix: { | ||
alias: 'p', | ||
describe: 'Prefix of token.', | ||
default: 'D' | ||
}, | ||
tokenName: { | ||
alias: 't', | ||
describe: 'Name of token.', | ||
default: 'DDN' | ||
}, | ||
genesisBlockName: { | ||
alias: 'g', | ||
describe: 'Genesis block file name', | ||
default: 'genesisBlock' | ||
}, | ||
message: { | ||
alias: 'm', | ||
describe: 'message' | ||
} | ||
}, | ||
|
||
handler: function (argv) { | ||
genGenesisBlock(argv) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { genUsers } from '../../plugins/users' | ||
|
||
module.exports = { | ||
command: 'users', | ||
aliases: 'u', | ||
desc: 'Create some accounts to a file.', | ||
builder: {}, | ||
|
||
handler: function (argv) { | ||
genUsers(argv.name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.