GithubHelp home page GithubHelp logo

inkdevhub / swanky-cli Goto Github PK

View Code? Open in Web Editor NEW
70.0 70.0 29.0 2.02 MB

The all-in-one developer environment for Parity pallet-contracts based smart contracts!

Home Page: https://docs.astar.network/docs/build/wasm/swanky-suite/cli/

License: MIT License

JavaScript 0.22% Batchfile 0.02% TypeScript 87.45% Handlebars 11.47% Dockerfile 0.85%
blockchain cli webassembly

swanky-cli's People

Contributors

andabak avatar artsytechie avatar codespool avatar gluneau avatar hyunggyujang avatar ipapandinas avatar juminstock avatar kziemianek avatar midegdugarova avatar pierreossun avatar prxgr4mm3r avatar shunsukew avatar tomaszwaszczyk avatar zabuxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

swanky-cli's Issues

Proposal: Rename `init` to `new`.

I propose renaming init command to new. There are two reasons for this that come to my mind:

  1. Similarity with cargo contract -- it uses new for generating starting package/template for the project.
  2. Sometimes, users may already have a working smart contract that they wish to deploy using swanky-cli. It's currently impossible to "just" init a project - i.e. generate swanky config file. This would match the functionality of git init as well.

I can do the work, just wanted to ask for your opinions first.

Improve Contract Interaction

Overview (What and Why)

This is a collection of smaller fixes and improvements to contract interaction.

  • Deploy
    • Should either detect, or take as argument the constructor name #35 #77
      - Multi contract deploy:
      - allow more than one contract to be listed in the deploy command and deploy them sequentially
  • Compile
    • support —-release flag #76
      - running typechain complier inside Swanky -
      - consider Sumi as alternative parser
      - TODO @PierreOssun elaborate feature here (from your perspective)
  • Call
    • dynamically add command and argument options (either from prebuilt types, or on-the-fly) and verify them before making the call #98
  • Node
    • pass CORS whitelist as a param and config property #74 #78
  • General:
    • centralised error handling (see comment), also takes care of #57

How

{Describe what needs to be done.}

  • Constructor arguments
  • Multi-contract deploy
  • Release flag on compile
  • command name options from compiled types
  • CORS whitelist as a param and config prop

Typechain compiler and alternatives is an investigation task, and if implementation needed will be moved to a separate ticket.

Definition of Done

  • above features implemented and merged

Open Issues and Blockers

Conflicting packages

In the last version (1.0.0-rc.4), the following conflicting packages were found:

image

Nothing happened when trying to compile

Version: @astar-network/swanky-cli/0.2.0 darwin-x64 node-v16.15.1

after

$ swanky init testproj

choose flipper

$ swanky contract compile flipper

Nothing happened and just show message as
✔ Contract compiled successfully

Installers/Distribution

Overview (What and Why)

Why: Current flow is download, extract, and link to /usr/local/bin. It is not user friendly.

What: Implement a user friendly way to auto update the tool is needed.

Idea:
- worth considering packing as .pkg, or .deb (certificate needed)
- also, look into brew, apt distribution

How

  • Investigate distribution options
  • Produce an analysis doc

Definition of Done

{Write definition of done, how to verify}

  • Analysis document with recommended distribution modes published

Open Issues and Blockers

check command fails if run before a deployment

Initially there's no contracts section in swanky.config.json, so the check command fails with:
TypeError: swankyConfig.contracts is not itterable

Solution:

  1. add the contract field with initial contract info on init
  2. add the same on adding a new contract with swanky contract new
  3. configure check command so it can run outside of swanky project environment, but give a warning about it. (contract(s) will not be checked)

Test reports should be generated under test folder

Overview (What and Why)

Test reports should be generated under test folder instead of ./artifacts/testReports

Currently, testReports are generated at ./artifacts/testReports
But ./test/{contract name}/testReports is more appropreate.

[BUG] deploy command halt when OutOfGas

Description
swanky contract deploy command halts at Deploying status when gas is insufficient.
Screen Shot 2023-02-09 at 22 10 35

Steps to Reproduce
swanky version

@astar-network/swanky-cli/1.0.11 darwin-arm64 node-v18.10.0

Steps

swanky init sample
swanky contract compile flipper
swanky contract deploy flipper --gas 100000000 --args true --account alice 

(swanky-node is running in background.)

Expected
Exits process with error information

Template for package.json should be changed.

package.json generated after swanky init would be wrong.
I think package.json.tpl should be changed as follow. (object of scripts key)

{
,,,,
  "scripts": {
    ,,,,
    "compile": "swanky contract compile",
    "deploy": "swanky contract deploy"
  },
,,,
}

Is this a template matter?

Deploy contract error handling

In deploy.ts,
swanky-cli doesn't handle errors from api.deploy() async function which deploys and returns a contract address.
So, even if it fails, following tasks will be executed and undefined value will be written in swanky.config.json contracts section in the end.

Log)

 ❯❯❯ ../bin/dev contract deploy --account alice --contract flipper --gas 1000000000                                                        ✘ 130 master ◼
✔ Initialising OK
✔ Getting WASM OK
✔ Connecting to node OK
✖ Error Deploying
✔ Writing config OK
Contract deployed!
Contract address: undefined
^C

Import Existing Project

Overview (What and Why)

Implement feature to import smart contract from local or remote repo (no need for template).
While importing perform check dir structure, and update configs.

How

  • Read a project (ink! or ask! from local drive)
  • Read a project from remote repo
  • Prompt user to confirm files to be copied and config to be updated
  • Copy and update config
  • Warn the user of probability that some paths and parameters need to be updated manually

Definition of Done

  • Possible to import ink! contract from local drive or remote repo
  • Possible to import ask! contract from local drive or remote repo

Open Issues and Blockers

Using Swanky CLI to manage existing dApp projects

Overview (What and Why)

{Write description of what the feature should be, why}

  • Build on top of #62
  • Open issue: passing the right path to contract folder
  • TODO - describe feature from end user perspective

How

{Describe what needs to be done.}

  • Task 1
  • Task 2

Definition of Done

{Write definition of done, how to verify}

  • Unit test cases (delete if not applicable)
  • Docs updated (delete if not applicable)
  • PR approved and merged to master (delete if not applicable)

Open Issues and Blockers

{Dependencies issue or PR or some other blocker.}

【compile Error】 swanky contract compile mytoken -v

I trying to develop token dapp (psp22) with swanky.

I create template project with swanky init command.

And I tried compile contract but bellow error occured.

why??

swanky contract compile mytoken -v
======== Found contracts ========
        mytoken
======== Compiling mytoken ========
warning: Both `/Users/harukikondo/.cargo/config` and `/Users/harukikondo/.cargo/config.toml` exist. Using `/Users/harukikondo/.cargo/config`
warning: Both `/Users/harukikondo/.cargo/config` and `/Users/harukikondo/.cargo/config.toml` exist. Using `/Users/harukikondo/.cargo/config`
ERROR: Error invoking `cargo metadata`

Caused by:
    `cargo metadata` exited with an error: warning: Both `/Users/harukikondo/.cargo/config` and `/Users/harukikondo/.cargo/config.toml` exist. Using `/Users/harukikondo/.cargo/config`
    warning: Both `/Users/harukikondo/.cargo/config` and `/Users/harukikondo/.cargo/config.toml` exist. Using `/Users/harukikondo/.cargo/config`
        Updating crates.io index
    error: failed to get `ink_engine` as a dependency of package `mytoken v0.1.0 (/Users/harukikondo/git/Astar-FT/mytoken/contracts/mytoken)`
    
    Caused by:
      failed to load source for dependency `ink_engine`
    
    Caused by:
      Unable to update registry `crates-io`
    
    Caused by:
      failed to fetch `https://github.com/rust-lang/crates.io-index`
    
    Caused by:
      process didn't exit successfully: `git fetch --force --update-head-ok 'https://github.com/rust-lang/crates.io-index' '+HEAD:refs/remotes/origin/HEAD'` (exit status: 255)
      --- stderr
      error: cannot open 'FETCH_HEAD': Permission denied
Error: Command failed: cargo +nightly contract build --manifest-path contracts/mytoken/Cargo.toml 
warning: Both `/Users/harukikondo/.cargo/config` and `/Users/harukikondo/.cargo/config.toml` exist. Using `/Users/harukikondo/.cargo/config`
warning: Both `/Users/harukikondo/.cargo/config` and `/Users/harukikondo/.cargo/config.toml` exist. Using `/Users/harukikondo/.cargo/config`
ERROR: Error invoking `cargo metadata`

Caused by:
    `cargo metadata` exited with an error: warning: Both `/Users/harukikondo/.cargo/config` and `/Users/harukikondo/.cargo/config.toml` exist. Using `/Users/harukikondo/.cargo/config`
    warning: Both `/Users/harukikondo/.cargo/config` and `/Users/harukikondo/.cargo/config.toml` exist. Using `/Users/harukikondo/.cargo/config`
        Updating crates.io index
    error: failed to get `ink_engine` as a dependency of package `mytoken v0.1.0 (/Users/harukikondo/git/Astar-FT/mytoken/contracts/mytoken)`
    
    Caused by:
      failed to load source for dependency `ink_engine`
    
    Caused by:
      Unable to update registry `crates-io`
    
    Caused by:
      failed to fetch `https://github.com/rust-lang/crates.io-index`
    
    Caused by:
      process didn't exit successfully: `git fetch --force --update-head-ok 'https://github.com/rust-lang/crates.io-index' '+HEAD:refs/remotes/origin/HEAD'` (exit status: 255)
      --- stderr
      error: cannot open 'FETCH_HEAD': Permission denied

    at checkExecSyncError (node:child_process:871:11)
    at execSync (node:child_process:943:15)
    at main (/Users/harukikondo/git/Astar-FT/mytoken/node_modules/@supercolony/typechain-compiler/index.ts:88:12)
    at Object.<anonymous> (/Users/harukikondo/git/Astar-FT/mytoken/node_modules/@supercolony/typechain-compiler/index.ts:143:1)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module.m._compile (/Users/harukikondo/git/Astar-FT/mytoken/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/harukikondo/git/Astar-FT/mytoken/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1037:32) {
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(156) [Uint8Array] [
       27,  91,  50, 109,  50,  48,  50,  50,  45,  49,  50,  45,
       50,  48,  84,  49,  51,  58,  48,  57,  58,  49,  48,  46,
       52,  53,  51,  48,  57,  56,  90,  27,  91,  48, 109,  32,
       27,  91,  51,  50, 109,  32,  73,  78,  70,  79,  27,  91,
       48, 109,  32,  27,  91,  50, 109,  99,  97, 114, 103, 111,
       95,  99, 111, 110, 116, 114,  97,  99, 116,  58,  58,  99,
      114,  97, 116, 101,  95, 109, 101, 116,  97, 100,  97, 116,
       97,  27,  91,  48, 109,  27,  91,  50, 109,  58,  27,  91,
       48, 109,  32,  70,
      ... 56 more items
    ],
    Buffer(1336) [Uint8Array] [
      119,  97, 114, 110, 105, 110, 103,  58,  32,  66, 111, 116,
      104,  32,  96,  47,  85, 115, 101, 114, 115,  47, 104,  97,
      114, 117, 107, 105, 107, 111, 110, 100, 111,  47,  46,  99,
       97, 114, 103, 111,  47,  99, 111, 110, 102, 105, 103,  96,
       32,  97, 110, 100,  32,  96,  47,  85, 115, 101, 114, 115,
       47, 104,  97, 114, 117, 107, 105, 107, 111, 110, 100, 111,
       47,  46,  99,  97, 114, 103, 111,  47,  99, 111, 110, 102,
      105, 103,  46, 116, 111, 109, 108,  96,  32, 101, 120, 105,
      115, 116,  46,  32,
      ... 1236 more items
    ]
  ],
  pid: 5852,
  stdout: Buffer(156) [Uint8Array] [
     27,  91,  50, 109,  50,  48,  50,  50,  45,  49,  50,  45,
     50,  48,  84,  49,  51,  58,  48,  57,  58,  49,  48,  46,
     52,  53,  51,  48,  57,  56,  90,  27,  91,  48, 109,  32,
     27,  91,  51,  50, 109,  32,  73,  78,  70,  79,  27,  91,
     48, 109,  32,  27,  91,  50, 109,  99,  97, 114, 103, 111,
     95,  99, 111, 110, 116, 114,  97,  99, 116,  58,  58,  99,
    114,  97, 116, 101,  95, 109, 101, 116,  97, 100,  97, 116,
     97,  27,  91,  48, 109,  27,  91,  50, 109,  58,  27,  91,
     48, 109,  32,  70,
    ... 56 more items
  ],
  stderr: Buffer(1336) [Uint8Array] [
    119,  97, 114, 110, 105, 110, 103,  58,  32,  66, 111, 116,
    104,  32,  96,  47,  85, 115, 101, 114, 115,  47, 104,  97,
    114, 117, 107, 105, 107, 111, 110, 100, 111,  47,  46,  99,
     97, 114, 103, 111,  47,  99, 111, 110, 102, 105, 103,  96,
     32,  97, 110, 100,  32,  96,  47,  85, 115, 101, 114, 115,
     47, 104,  97, 114, 117, 107, 105, 107, 111, 110, 100, 111,
     47,  46,  99,  97, 114, 103, 111,  47,  99, 111, 110, 102,
    105, 103,  46, 116, 111, 109, 108,  96,  32, 101, 120, 105,
    115, 116,  46,  32,
    ... 1236 more items
  ]
}
✔ Contract compiled successfully
⠋ Copying artifacts[Error: ENOENT: no such file or directory, copyfile '/Users/harukikondo/git/Astar-FT/mytoken/artifacts/mytoken.contract' -> '/Users/harukikondo/git/Astar-FT/mytoken/artifacts/mytoken/1671541750870/mytoken.wasm'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'copyfile',
  path: '/Users/harukikondo/git/Astar-FT/mytoken/artifacts/mytoken.contract',
  dest: '/Users/harukikondo/git/Astar-FT/mytoken/artifacts/mytoken/1671541750870/mytoken.wasm'
}
✔ Copying artifacts OK
✔ Writing config OK

[Tutorial] Swanky Walkthrough - Your first day with Swanky

Overview (What and Why)

Create a step by step written + video tutorial to cover all the features released so far, together with install/update instructions.

How

Record Polkadot Hackathon Europe presentation, and write accompanying guide on Astar docs page.

Definition of Done

[ ] Presentation is recorded and publicly available
[ ] Tutorial is published within Astar Docs

Open Issues and Blockers

missing video from Sub0

[BUG] swanky contract test not working

Description

After generating new smart contract environment with flipper smart contract swanky contract test command outputs error.

Steps to Reproduce

kziemianek@Kaspers-MBP astar % swanky init foobar
? Which contract language should we use? ink
? Which contract template should we use initially? flipper
? What should we name your initial contract? flipper
? What is your name? Kasper Ziemianek
? What is your email? 
? Do you want to download Swanky node? No
✔ Checking dependencies OK
✔ Copying template files OK
✔ Processing templates OK
✔ Initializing git OK
✔ Installing dependencies OK
✔ Writing config OK
🎉 😎 Swanky project successfully initialised! 😎 🎉
kziemianek@Kaspers-MBP astar % cd foobar 
kziemianek@Kaspers-MBP foobar % swanky contract compile flipper
======== Found contracts ========
	flipper
======== Compiling flipper ========
======== Compiled flipper ========
======== Compiled all contracts ========
======== Compiling Typechain' code ========
======== Compiled Typechain' code ========
✔ Contract compiled successfully
✔ Copying artifacts OK
✔ Writing config OK
kziemianek@Kaspers-MBP foobar % swanky contract test flipper   
    SyntaxError: Cannot use import statement outside a module

Expected vs. Actual Behavior

test command working or more informative error msg if prerequisites not met

Environment

Describe the environment in which you encountered this bug. Use the list below as a starting point and add additional information if you think it's relevant.

  • Project version/tag: (@astar-network/swanky-cli/1.0.10 darwin-x64 node-v18.2.0

Maybe Spinner::runCommand() should abort if the command fails?

When some commands fail, swanky still says the project successfully initialized

$ node bin/run init a
? Which template should we use? blank
? What should we name your contract? blank
? What is your name? a
? What is your email? 
? Do you want to download Swanky node? Yes
✔ Checking dependencies OK
✔ Copying template files OK
✔ Processing templates OK
✔ Initializing git OK
✖ Error Downloading Swanky node
✖ Error Installing dependencies
✔ Writing config OK
🎉 😎 Swanky project successfully initialised! 😎 🎉

In swanky-cli/src/lib/spinner.ts, add one line to let swanky abort on command failure:

@@ -45,6 +45,7 @@ export class Spinner {
     } catch (error) {
       this.fail(failMessage || `Error ${runningMessage}`);
       if (this.verbose) console.error(error);
+      process.exit();
     }
   }

Then the output is more reasonable:

$ node bin/run init a
? Which template should we use? blank
? What should we name your contract? blank
? What is your name? a
? What is your email? 
? Do you want to download Swanky node? Yes
✔ Checking dependencies OK
✔ Copying template files OK
✔ Processing templates OK
✔ Initializing git OK
✖ Error Downloading Swanky node

psp22 template test run gives error

  • my os
13.0.1(22A400)
  • version
@astar-network/swanky-cli/1.0.0-rc.4 darwin-x64 node-v18.0.0
  • The "swanky contract test psp22" command fails, but the "npm test" command succeeds. I think it's a configuration issue, but currently I don't know how to solve it.

image

Deployed contracts management

Right now, deployed contracts are managed in swanky.config.json file like below.

"contracts": [
    {
      "name": "flipper",
      "address": "5GYsjgJnmXdbNACtYMtMYesFbu3rxt7AK1DCoamxMg1b1DpZ"
    },
    {
      "name": "flipper",
      "address": "5Gw6JUoUDMs6sbukc5YxmPrxNrJDGmMPGKJVP7zJaHAa76oc"
    }
  ]

However, as the number of supported networks grows, it gets hard to know which contract is deployed to which network.

Several solutions can be considered.

  • Having another file/folder for contract management purpose, and preparing each network's section (deployments for e.g. in truffle cli).
  • Adding network name in contracts item in swanky.config.json.
    I think former one is more extendability.

[BUG] generated js test file with template name instead of custom smart contract name

Description

After generating new smart contract environment with smart contract based on flipper template but with different name , the generated js test file is still named flipper.test.ts instead of <my-contract-name>.test.js

Expected vs. Actual Behavior

To have js test filed named as generated smart contract, ex: <my-contract-name>.test.js

Environment

  • Operating system: macos
  • Project version/tag: @astar-network/swanky-cli/1.0.10 darwin-x64 node-v18.2.0

Logs, Errors or Screenshots

kziemianek@Kaspers-MBP foobar % pwd
/Users/kziemianek/projects/astar/foobar/test/foobar
kziemianek@Kaspers-MBP foobar % ls -ltr
total 8
-rw-r--r--  1 kziemianek  staff  1525 Feb  2 09:57 flipper.test.ts

ModuleLoadError: [MODULE_NOT_FOUND] require failed to load

I got following error on Linux machine:

ModuleLoadError: [MODULE_NOT_FOUND] require failed to load

swanky.webm
tomek@rhei-box:~/workspaces/ink$ node --version
v14.17.6
tomek@rhei-box:~/workspaces/ink$ npm --version
8.19.2

On Windows machine works, although many developers use another OS than Windows.

Relative paths in `swanky.config.json`

Overview

If swanky.config.json file should be shared across developers (i assume it should since it's not present in .gitignore) and commited to VCS then it would be desirable to have relative instead of absolute paths. For example right now path to swanky-node bin is:
"localPath": "/Users/kziemianek/projects/foobar/bin/swanky-node"
same rule should be applied for artifactsPath in contracts's build section
"artifactsPath": "/Users/kziemianek/projects/foobar/artifacts/foobar/1675334490871"

Pass options object to `Spinner.runCommand`

This fix:
#24
has caused some undesired behaviour (init command exits if yarn install fails, and doesn't create config file), so an additional param shouldExitOnError was added.

Since there are a lot of optional params, it makes sense to put those together into a single options param.

NFT full stack project template

Overview (What and Why)

Implement full NFT template with that allows end-user to easily deploy their own NFT project (with placeholder images, generator script, basic UI, etc.)

How - TBD

Definition of Done - TBD

{Write definition of done, how to verify}

  • Unit test cases (delete if not applicable)
  • Docs updated (delete if not applicable)
  • PR approved and merged to master (delete if not applicable)

Open Issues and Blockers

Needs further discussion and grooming

[BUG] The contract which did not specify with parameter are compiled

Description
The contract which did not specify with parameter are compiled

Steps to Reproduce

  • I created two contracts with "swanky contract new ". I call contracts in this issue like that, One is A contract, another is B contract.
  • A contract have compile errors.
  • B contract can be compiled.
  • When I execute command "swanky contract compile , I got errors about

Expected vs. Actual Behavior
When I execute command "swanky contract compile , I got errors about

Environment

  • Operating system: mac os 13.1(22C65)
  • Project version/tag: swanky 1.0.7
  • Rust version :
Default host: x86_64-apple-darwin
rustup home:  /Users/shin.takahashi/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin (default)
nightly-2020-04-06-x86_64-apple-darwin
nightly-2022-03-14-x86_64-apple-darwin
nightly-2022-06-30-x86_64-apple-darwin
nightly-2022-08-15-x86_64-apple-darwin
nightly-2022-10-10-x86_64-apple-darwin
nightly-2022-10-25-x86_64-apple-darwin
nightly-x86_64-apple-darwin
1.51.0-x86_64-apple-darwin
1.61.0-x86_64-apple-darwin

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-apple-darwin

active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.66.0 (69f9c33d7 2022-12-12)
  • Node version : v18.2.0

Configure node rpc-cors whitelist

Right now, the whitelisted hosts are hardcoded in the node start command.
Those should be either passable by flag or added to config. (or both)

Ask project scaffolding: more templates

Overview (What and Why)

  • Why: make dev reach bigger, position Astar as de facto Ask Network
  • What: all templates translated to Ask. Showcases translated to Ask.
  • Missing feature
    • typechain integration
    • unified flow with Ink! and Ask

How

{Describe what needs to be done.}

  • Task 1
  • Task 2

Definition of Done

{Write definition of done, how to verify}

  • Unit test cases (delete if not applicable)
  • Docs updated (delete if not applicable)
  • PR approved and merged to master (delete if not applicable)

Open Issues and Blockers

{Dependencies issue or PR or some other blocker.}

Psp22 template cannot be compiled.

I have the following problem:

  1. The struct definition does not have the correct name.
  2. Your openbrush definition doesn't match Cargo.toml.

swanky version:

% swanky --version
@astar-network/swanky-cli/1.0.0-beta.4 darwin-x64 node-v16.4.0

Add Faucet for Swanky Node

Overview (What and Why)

Newly created accounts do not have any funding. There should be a feature/command to add some funds to new accounts from the Faucet.

How?

  • For swanky node, automatically transfer an amount of tokens from Alice account
  • Add address of a faucet contract to the network config
  • add swanky account subcommand to call the faucet contract (in case of swanky node, just transfer more from Alice)

Acceptance Criteria

  • Network config supports faucet contract address
  • swanky accounts has a faucet subcommand
  • changes merged

Open Issues and Blockers

deploy command cannot handle 0 args execution

Smart contracts whose constructor doesn't take any args can be considered.
However, deploy command will fail when no args are provided.

✔ Initialising
✔ Getting WASM
✔ Connecting to node
✖ args is not iterable (cannot read property undefined)
◼ Writing config
TypeError: args is not iterable (cannot read property undefined)
    at DeployApi.deploy (/Users/shunsuke/Astar/swanky-cli/src/commands/deploy/index.ts:157:27)
    at Task.task (/Users/shunsuke/Astar/swanky-cli/src/commands/deploy/index.ts:101:49)
    at Task.run (/Users/shunsuke/Astar/swanky-cli/node_modules/listr2/dist/index.cjs:978:35)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Facing error here using spread syntax against undefined.

PSP22 reference implementation in Ask

Overview (What and Why)

At the moment, ask! option in Swanky only offers ERC20 template.
To be consistent with ink!, and compliant with standards, this should be PSP22, possibly other standards too.

Since those standards are a collection of contracts, a builder page would be a good idea.
(see https://openbrush.io/)

How

[ ] Create Openbrush equivalent contracts in ask!
[ ] Create a webapp to combine the contracts (same as openbrush.io)
[ ] Write an ask! tutorial on Astar docs page

[optional: check with Brushfam would they be willing to host it together with ink!]

Definition of Done

  • ask! contracts available on github
  • builder page deployed
  • Tutorial page published on Astar docs

Open Issues and Blockers

  • check is there a way to enforce the function selector as in psp22 (check the compiled blob)

Improved Config Feature

Overview (What and Why)

Currently no swanky commands can be invoked outside of a swanky project folder.
For some commands that doesn't make sense and they should be available globally.
Since the check consist only of looking for the swanky.config.json in current folder, the config should be moved to the OS level config folder, and if needed combined with the local one. (also check the ancestor folders)
Additionally, keys and addresses can be stored in the .env file so that too should be checked
Lastly, a default account should be set, so it doesn't need to be passed every time.

Plus:

  • limit dev accounts to interaction only with local/test networks #22

How

  • Implement a base class to handle config checks and logic
  • Store part of the config to the OS level config dir
  • Read the global, local (including ancestor dirs), and .env file and merge them
  • Add a default account feature
  • Limit dev account interaction

Definition of Done

{Write definition of done, how to verify}

  • Above features are implemented and merged

Open Issues and Blockers

Integrate Zombienet for XCM development and testing

Overview (What and Why)

To develop and test XCM enabled contracts, zombienet looks like the best tool.

How

  • Keep an updated list of network and binaries' urls in the cloud
  • create a swanky zombienet command that accepts a list of nodes to spawn (or reads from config)
  • download nodes and create the zombienet config
  • spin up all the required nodes

Definition of Done

  • above steps implemented
  • readme and astar docs updated

Open Issues and Blockers

Possible difficulty: enabling "docker in docker" for the dev container use

[BUG] swanky contract compile leaves mess if compilation fails

Description

Hi, as it is another issue from me I want to say that you've created great tool and i'm using it extensively recently, thank you for all your incredible work.

In case of smart contract compilation error swanky contract compile command leaves empty directory in artifacts/<smart_contract> and changes in swanky.config.json.

Command's output also says that contract was compiled successfully: Contract compiled successfully

Steps to Reproduce

kziemianek@Kaspers-MBP foobar % git status
On branch master
nothing to commit, working tree clean
kziemianek@Kaspers-MBP foobar % ls -ltr artifacts/flipper 
total 0
kziemianek@Kaspers-MBP foobar % swanky contract compile flipper -v
======== Found contracts ========
	flipper
======== Compiling flipper ========
warning: nothing to print.

To find dependencies that require specific target platforms, try to use option `--target all` first, and then narrow your search scope accordingly.
Checking with toolchain `nightly-2022-06-30-x86_64-apple-darwin`
    Checking flipper v0.1.0 (/Users/kziemianek/projects/astar/foobar/contracts/flipper)
error[E0425]: cannot find value `init_value` in this scope
  --> src/lib.rs:21:27
   |
21 |             Self { value: init_value }
   |                           ^^^^^^^^^^ help: a local variable with a similar name exists: `init_valu2`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `flipper` due to previous error
Error: Compilation failed with toolchain `nightly-2022-06-30-x86_64-apple-darwin`
<lines skipped>
✔ Contract compiled successfully
⠋ Copying artifacts[Error: ENOENT: no such file or directory, copyfile '/Users/kziemianek/projects/astar/foobar/artifacts/flipper.contract' -> '/Users/kziemianek/projects/astar/foobar/artifacts/flipper/1675423435711/flipper.wasm'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'copyfile',
  path: '/Users/kziemianek/projects/astar/foobar/artifacts/flipper.contract',
  dest: '/Users/kziemianek/projects/astar/foobar/artifacts/flipper/1675423435711/flipper.wasm'
}
✔ Copying artifacts OK
✔ Writing config OK
kziemianek@Kaspers-MBP foobar % ls -ltr artifacts/flipper 
total 0
drwxr-xr-x  2 kziemianek  staff  64 Feb  3 12:23 1675423435711
kziemianek@Kaspers-MBP foobar % git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   swanky.config.json

no changes added to commit (use "git add" and/or "git commit -a")

Expected vs. Actual Behavior
No changes if command fails, output says that contract was not compiled successfully.

Environment

  • Project version/tag: @astar-network/swanky-cli/1.0.10 darwin-x64 node-v18.2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.