$ npm install -g @astar-network/swanky-cli
$ swanky COMMAND
running command...
$ swanky (--version|-V|-v)
@astar-network/swanky-cli/0.1.6 darwin-x64 node-v18.2.0
$ swanky --help [COMMAND]
USAGE
$ swanky COMMAND
...
swanky call
swanky check
swanky compile
swanky deploy
swanky help [COMMAND]
swanky init PROJECT_NAME
swanky node start
swanky version
Call a method on a smart contract
USAGE
$ swanky call -m <value> [-a <value>] [-d] [-g <value>] [-n <value>]
FLAGS
-a, --args=<value>
-d, --dry
-g, --gas=<value>
-m, --message=<value> (required)
-n, --network=<value> Network name to connect to
DESCRIPTION
Call a method on a smart contract
See code: dist/commands/call/index.ts
Check installed package versions and compatibility
USAGE
$ swanky check
DESCRIPTION
Check installed package versions and compatibility
See code: dist/commands/check/index.ts
Compile the smart contract(s) in your contracts directory
USAGE
$ swanky compile [-s]
FLAGS
-s, --silent Don't display compilation output
DESCRIPTION
Compile the smart contract(s) in your contracts directory
See code: dist/commands/compile/index.ts
Deploy contract to a running node
USAGE
$ swanky deploy --account <value> -c <value> -g <value> [-a <value>] [-n <value>]
FLAGS
-a, --args=<value>...
-c, --contract=<value> (required)
-g, --gas=<value> (required)
-n, --network=<value> Network name to connect to
--account=<value> (required) Alias of account to be used
See code: dist/commands/deploy/index.ts
Display help for swanky.
USAGE
$ swanky help [COMMAND] [-n]
ARGUMENTS
COMMAND Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for swanky.
See code: @oclif/plugin-help
Generate a new smart contract environment
USAGE
$ swanky init [PROJECT_NAME] [--swanky-node] [--template blank|flipper|psp22]
ARGUMENTS
PROJECT_NAME directory name of new project
FLAGS
--swanky-node
--template=<option> <options: blank|flipper|psp22>
DESCRIPTION
Generate a new smart contract environment
See code: dist/commands/init/index.ts
Start a local node
USAGE
$ swanky node start
DESCRIPTION
Start a local node
USAGE
$ swanky version [--json] [--verbose]
FLAGS
--verbose Show additional information about the CLI.
GLOBAL FLAGS
--json Format output as json.
FLAG DESCRIPTIONS
--verbose Show additional information about the CLI.
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
See code: @oclif/plugin-version
A newly generated project will have a swanky.config.json
file.
{
"node": {
"localPath": "/path/to/swanky-node",
"polkadotPalletVersions": "polkadot-v0.9.27",
"supportedInk": "v3.3.1"
},
"accounts": [
{
"alias": "alice",
"mnemonic": "//Alice"
},
{
"alias": "bob",
"mnemonic": "//Bob"
}
],
"networks": {
"local": {
"url": "ws://127.0.0.1:9944"
},
"astar": {
"url": "wss://rpc.astar.network"
},
"shiden": {
"url": "wss://rpc.shiden.astar.network"
},
"shibuya": {
"url": "wss://rpc.shibuya.astar.network"
}
}
}
You can deploy/call wasm smart contracts on any chains supporting the substrate contracts module (pallet-contracts
) by swanky-cli.
--network
flag is available for deploy
and call
commands. For example,
swanky deploy --account alice --gas 100000000000 --contract flipper --args true --network shibuya
By default, swanky init
prepares local/astar/shiden/shibuya endpoint for you.
To add networks or change endpoint to interact with, you need to update swanky.config.json
networks
section.
"networks": {
"local": {
"url": "ws://127.0.0.1:9944"
},
"your_network": {
"url": "wss://your.network"
}
}
- config file format is very likely to change as the tool is under active development
contracts
section keeps history of all deployments of specific contractaccounts
should ONLY hold dev accounts. The more secure solution will be added in the upcoming release- at runtime, only
localPath
andnodeAddress
fields ofnode
object are being used.