Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
/ gear-program Public archive

Setup and deployment tool for developing gear program

Notifications You must be signed in to change notification settings

gear-tech/gear-program

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

This repository was deprecated and migrated to gear-tech/gear/program.


gear-program

CI crates.io docs downloads License

Getting Started

To install gear-program via cargo

$ cargo install gear-program

Usages:

$ gear
gear-program 0.1.5
Commands of cli `gear`

USAGE:
    gear [FLAGS] [OPTIONS] <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information
    -v, --verbose    Enable verbose logs

OPTIONS:
    -e, --endpoint <endpoint>    Gear node rpc endpoint
    -p, --passwd <passwd>        Password of the signer account

SUBCOMMANDS:
    claim             Claim value from mailbox
    create            Deploy program to gear node
    help              Prints this message or the help of the given subcommand(s)
    info              Get account info from ss58address
    key               Keypair utils
    login             Log in to account
    meta              Show metadata structure, read types from registry, etc
    new               Create a new gear program
    program           Read program state, etc
    reply             Sends a reply message
    send              Sends a message to a program or to another account
    transfer          Transfer value
    update            Update self from crates.io or github
    upload            Saves program `code` in storage
    upload-program    Deploy program to gear node

Now, let's create a new gear program and upload it to the staging testnet!

$ gear new hello-world
Cloning into '/home/clearloop/.gear/apps'...
remote: Enumerating objects: 156, done.
remote: Counting objects: 100% (156/156), done.
remote: Compressing objects: 100% (121/121), done.
remote: Total 156 (delta 41), reused 83 (delta 15), pack-reused 0
Receiving objects: 100% (156/156), 89.78 KiB | 723.00 KiB/s, done.
Resolving deltas: 100% (41/41), done.
Successfully created registry at /home/clearloop/.gear/apps!
Successfully created hello-world!

Compile you gear program via cargo

$ cargo build --manifest-path hello-world/Cargo.toml --release

login to your gear account

$ gear login //Alice
Successfully logged in as 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY!

upload your gear program

$ gear upload hello-world/target/wasm32-unknown-unknown/release/hello_world.wasm
[INFO ] Submited extrinsic Gear::upload_code
[INFO ]         Status: Ready
[INFO ]         Status: Broadcast( ["12D3KooWQbJXFeRDJqmLT6jqahsJpwKGL5xEJJ6F3tevR1R85Upz", "12D3KooWFwZEE7cVz7fPTUrekv2Xfv2sR5HMetpadw4W9fZnEBr5", "12D3KooWNmeoxqMTSc3CzeA5SLTQ6xYQo4yz3Az1zjnAqrhpmBSH", "12D3KooWLFN7AceaViuVDakKghwLVo9i91Bi8DLyf1BGg6ftVGnG", "12D3KooWJ9EASqU3T89z1EBYMnvfTh5WK4Rgw3RMensrx5STRvXR", "12D3KooWDuzvhmTAebZXGJG8SCurHkn9x6mmpiTSQygGoCvXmYmU", "12D3KooWH7QBPHh5Byc2ZBjGSiqBbGzBAr5E8mqLWueyPXQJrxWB", "12D3KooWRw1Yfdo86zpgN9TTLJ6J53iAM1y1PW9ogKHsTHvBPDg9", "12D3KooWJ15sMWcCgmSLBAfRD5TZgKoCCZ1xDzPRGzbR2YC5zKqS", "12D3KooWEMDPU47VnnZPLEMXeFJkphaG8kRdn9SuTqoJJEhrwC2w", "12D3KooWSfMsGDWG6hvTgfLoFETZrnxNC649bQwSa9FxTAPw4Cmy", "12D3KooWK7fw8MdENES5jAb8kjLw4b3eGMxuWBPR52v15FRkmYF3", "12D3KooWLP3AxJf1VfVJzbzcrHAkipXXa9bSvPcE1TowuRQZE8bz", "12D3KooWSf2d69w7RYKtj9mgYpLDs3rqLAz9GHNSHHoCQDLUjeiP", "12D3KooWSKMmTordwL3t6SkQaKXuXt1aYC2QZAXNyt8DxjpgFXYq", "12D3KooWEsvboSEFhf5utCZJ4gfUjb7S5i9Qec1TXB2DuYPJZVzB", "12D3KooWRf7vAr79yAyDxGvYAdSqhh2EoeWe35Lx4QH4N6XMv2gH", "12D3KooWPuaSwvwq2EGdasjJruUzR1wwTk1tDdVBZauKwG8ZPFi1", "12D3KooWHSepUMWdNVgKPhdquR12AzSZrkHwUsfXvVfFMPGXpyH5", "12D3KooWDC3qNpRz5LdSfPWi3XWfc7kG5GHyEDNR2NcgJMedfu5v", "12D3KooWRQ8oUwhrW84UuVpQNZ2QxS2kg3SyhLwVkwHHk9vJgf5q", "12D3KooWHZaCXaMgavJYoH925jiLrLhsbPpU14tt6M7ypenDyfPc", "12D3KooWAd4GWfAqNTqoqTNnjsKqJHWNRezgcHi742eGYKDdYsfC", "12D3KooWFWc6NFCiuTxd9iKq9mi1n3G7nBEZ5yDkzzHjkGBSceje", "12D3KooWQ8yjECbzLThEwzcTQ3gtVgZbb1XPBrPyHnRkmLJRGfEW", "12D3KooWFsZdJERxRrc5afrFDxvts4bDxSHHDgQxh8bTm4Kq9PV7", "12D3KooWGpxgFFTXij8gXzx6YgExaVczUN2fuohccrkA11tGFzDu", "12D3KooWND9qfwCVtfB17y9fcThBKoWvCSpXrCQCs6XsWvHE5om2", "12D3KooWLoCosNXv1HESuU76r7xmp5UU4pdCncnZXB1hYvcbCYgX", "12D3KooWEga7tssCYmywnRU492ANXV4vGYqX5AVJrrAAKQ1zhhGN", "12D3KooWDP1pb16iGikYc8fkkL8ZYmzPqsrVRzQHHBDKxjRpUMNA", "12D3KooWG26t3Z1NfeAPNWdwrdWYntSUj69LzHcnBdV4PcQMEuHA", "12D3KooWS5DUgYPSQVrexXbPksR4cVsexFhLXzXFgsY47ZPeFHd9", "12D3KooWBWFtZqigVTC8W2GRMwLeuTK2o4hDC4XHVPyNV6hW1T1D", "12D3KooWDCboxcE7VAB3v3UJf1hrNZiswyk5Eg1u2kaiSs4v6Sbi", "12D3KooWNx1mbmwKXSPS8vuHkyVrQrZnwp4HGjLczPxFCpAyRhNS", "12D3KooWJ3KhEHCm4roQw2LAUGu28fXJf5QqQHhG6EaACw6RCUjr", "12D3KooWFnr5yyEcNAfdjJjfuBAMaZ2iz3GLyFrJAs5AiRJ74vWS", "12D3KooWMNeo7UgreqFxQ6BstVgZrNAZMVyKt9EWnC6AD9J2M1rT", "12D3KooWEVvqVD2mrLfmgeX1EXZ2caFXXEWWEs4Taa4mWzFUoF34", "12D3KooWMadAihMmvZmGt1HpxGAqqjb7Q2q96VVev6rGA1GLuqjv", "12D3KooWARM6duzRRd64fMJZJY3VqWekeG1rmJqxxjNLRYaQVPRt", "12D3KooWSqCyNpmVwaAxS1mMms2GQvUcPzPdoWB2XjiWpXvGW3Jf", "12D3KooWH22kTRSvhRnMUtu7Eg8d96Ma68jzRKV7vtxVMwB96kvS", "12D3KooWN1LBk84vnJEsQ33WsPRvpSzfrNMUZ2iLhTkUYjsSfwR5", "12D3KooWMxtE2fWGZZsZjfjoRN5aH6ecSKj8YfTkufi2vtywoKLS", "12D3KooWGMpAqtwpGR4tcQ3tc2ZThkTUN2YYcgxQsuSbfdQ4h3E4", "12D3KooWSyBLw12Z8rHRx2NSAfmb3cpAP6nJ2qK5FkdEC38zNVKk", "12D3KooWH7sqE4cp9wyLt5Z7xzuqA2imNGMeUHnu2gPJ4hGnJqJv", "12D3KooWK896roWsGutzksP9cZc3oypVPjRB1o83uHzjxM72V7zb"] )
[INFO ]         Status: InBlock( block_hash: 0x4409…fa04, extrinsic_hash: 0x2c54…e9d9 )
[INFO ]         Status: Finalized( block_hash: 0x4409…fa04, extrinsic_hash: 0x2c54…e9d9 )
[INFO ] Successfully submited call Gear::upload_code 0x2c54…e9d9 at 0x4409…fa04!
[INFO ]         Balance spent: 3724868714

Development

This repo provides CI checking if the spec-version of gear-program and gear are matched per day, since gear is also in development, the spec-version may change frequently.

If only spec-version checking failed in the CI, it's okay to use the current version of gear-program since the api hasn't been changed, otherwise, please open an issue to remind the developers to update the api.

For updating the api in local environment, run scripts/generate-api.sh to do it, which will

  1. Install the latest version of gear binary to directory res
  2. Install subxt-cli if need
  3. Generate api to src/generated/metadata.rs

If the program can be compiled and all of the tests passed, the api of gear-program is up-to-date, and everything works.

LICENSE

GPL v3.0

About

Setup and deployment tool for developing gear program

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages