pontem-network / dove

🛠️ Diem/Pontem Move package manager
MIT License
35 stars 15 forks source link
move-language

Dove

Move language package manager for Diem and Pontem networks.

See documentation at https://docs.pontem.network/.

Installation

Using pre-compiled binaries:

Just visit releases page and download binaries you are going to use.

Using source code:

Clone this repository and follow documentation:

git clone git@github.com:pontem-network/dove.git
cd dove
cargo install --path ./dove
See help:
dove -h

Create new project:

dove new first_project 

This command will create first_project/ directory with special Move.toml manifest file and sources/ directory for Move source code.

Build project:

dove build

See ./build/ folder to get scripts/modules binaries.

Clean build directory:
dove clean

The contents of the directories will be deleted:

Clear build directory and global cache:
dove clean --global

The contents of the directories will be deleted:

Pallet Transactions

Command call allows you to create and publish transactions for Polkadot chain with Move Pallete on board.

call takes script identifier, type parameters, and arguments and creates a transaction file as an artifact of work.

dove call [CALL] [OPTIONS]

Input parameters

Example:

dove call 'store_u64(60)'

This command searches for the script by name 'store_u64' in the script directory. Then it compiles it and creates a transaction file.

This command will fail if:

You can use type parameters like in the Move language.

Example:

dove call 'create_account<0x01::PONT::PONT>()'

You allow can use SS58 address format:

dove call 'create_account<0x1::MyToken::Token>()'
dove call 'create_account<ADDRESS_ALIAS::MyToken::Token>()'
dove call 'create_account(ADDRESS_ALIAS, 10, true, [10, 20, 30, 40], 0x1, SS58_ADDRESS)'

Supported types:

For more commands and parameters look at help:

dove call --help

More

If you look for examples, guidelines how to write modules/scripts or tests, visit Pontem Documentation.

Resource Viewer

Resource viewer is currently out of date and pending migration inside dove in future versions.

See documentation.

Executor

Migrated inside Dove, see help:

dove run --help

Manage wallet keys

Command key allows you to save the secret keys to the wallet on your computer and access them under an alias. Saved key can be used when publishing a module or bundle $ dove deploy <FILE_NAME> --account <NAME_KEY> ..., as well as when execute a transaction $ dove call <CALL> --account <NAME_KEY> .... Keys are stored on your computer in the ~/.move/ directory. Before saving, they are encrypted with the aes + password.

Adding a key:

dove key add --alias <NAME_KEY>

After executing this command, you will be prompted to enter a password and a secret phrase from your wallet.

If you don't want to protect the key with a password, use the --nopassword flag(Not recommended):

dove key add --alias <NAME_KEY> --nopassword

View list of saved keys

dove key list

Deleting a key

Deleting a key by name:

dove key delete --alias <NAME_KEY>

Deleting all saved keys:

dove key delete --all

Publishing a module or package

$ dove deploy [FILE_NAME|PATH_TO_FILE] [OPTIONS]

Input parameters

Examples:

dove deploy
dove deploy PACKAGE_NAME --account WALLET_KEY --gas 300
dove deploy PACKAGE_NAME --secret --url ws://127.0.0.1:9944 --gas 400 --modules_exclude MODULE_NAME_1 MODULE_NAME_2 ..
dove deploy MODULE_NAME --secret --url https://127.0.0.1:9933 --gas 400
dove deploy PATH/TO/FILE --account //Alice --gas 300

Resource Viewer

Move Resource Viewer is a tool to query BCS resources data from blockchain nodes storage and represent them in JSON or human readable format.

  1. The viewer makes a request to the blockchain node by a sending specific query (address + resource type).
  2. The viewer send another request to node and query resource type layout.
  3. The viewer restores resources using response data and type layout.

Usage example

Query the user's store contract balance:

dove view "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY::Store::Store<u64>" --api "ws://127.0.0.1:9946"

Input parameters

For more info check out --help.

Output

Two output formats supported:

The structure of the output in JSON is described in the scheme, which can be obtained by calling with the --json-schema parameter.

Move-like example:

resource 00000000::Account::Balance<00000000::Coins::BTC> {
    coin: resource 00000000::Dfinance::T<00000000::Coins::BTC> {
        value: 1000000000u128
    }
}

JSON example:

{
  "is_resource": true,
  "type": {
    "address": "0000000000000000000000000000000000000001",
    "module": "Account",
    "name": "Balance",
    "type_params": [
      {
        "Struct": {
          "address": "0000000000000000000000000000000000000001",
          "module": "Coins",
          "name": "BTC",
          "type_params": []
        }
      }
    ]
  },
  "value": [
    {
      "id": "coin",
      "value": {
        "Struct": {
          "is_resource": true,
          "type": {
            "address": "0000000000000000000000000000000000000001",
            "module": "Dfinance",
            "name": "T",
            "type_params": [
              {
                "Struct": {
                  "address": "0000000000000000000000000000000000000001",
                  "module": "Coins",
                  "name": "BTC",
                  "type_params": []
                }
              }
            ]
          },
          "value": [
            {
              "id": "value",
              "value": {
                "U128": 1000000000
              }
            }
          ]
        }
      }
    }
  ]
}

LICENSE

LICENSE