Giter Club home page Giter Club logo

bos-cli-rs's Introduction

BOS CLI

Command line utility helps to develop components for NEAR Blockchain Operating System by allowing developers to use standard developer tools like their best code editor and standard tools for source code version control, and then deploy their components to SocialDB in one command.

Currently, only two groups of commands are implemented:

  • components - Working with components (Download, Deploy, etc.)
  • socialdb - SocialDb management

components - Working with components (Download, Deploy, etc.)

  • deploy allows you to upload/publish components from your local ./src folder to near.social account.
  • download allows you to download the existing components from any near.social account to the local ./src folder.
  • delete allows you to delete the existing components from any near.social account.

socialdb - SocialDb management

data - Data management: viewing, adding, updating, deleting information by a given key

  • view allows you to view information by a given key.
  • set allows you to add or update information by a given key.
  • delete allows you to delete information by the specified key.

prepaid-storage - Storage management: deposit, withdrawal, balance review

  • view-balance allows you to view the storage balance for an account.
  • deposit allows you to make a storage deposit for the account.
  • withdraw allows you to make a withdraw a deposit from storage for an account ID.

permissions - Granting access permissions to a different account

  • grant-write-access allows grant access to the access key to call a function or another account.

More commands are still on the way, see the issues tracker and propose more features there.

Install

From Binaries

The release page includes precompiled binaries for Linux, macOS and Windows.

From Source

With Rust's package manager cargo, you can install bos via:

cargo install --git https://github.com/FroVolod/bos-cli-rs

GitHub Actions

Reusable Workflow

This repo contains a reusable workflow which you can directly leverage from your component repository

  1. Prepare access key that will be used for components deployment.

    It is recommended to use a dedicated function-call-only access key, so you need to:

    1.1. Add a new access key to your account, explicitly adding permissions to call the set method. Here is near CLI command to do that:

    near account add-key "ACCOUNT_ID" grant-function-call-access --allowance '1 NEAR' --receiver-account-id social.near --method-names 'set' autogenerate-new-keypair print-to-terminal network-config mainnet

    1.2. Grant write permission to the key (replace PUBLIC_KEY with the one you added to the account on the previous step, and ACCOUNT_ID with the account id where you want to deploy BOS components):

    near contract call-function as-transaction social.near grant_write_permission json-args '{"public_key": "PUBLIC_KEY", "keys": ["ACCOUNT_ID/widget"]}' prepaid-gas '100.000 TeraGas' attached-deposit '1 NEAR' sign-as "ACCOUNT_ID" network-config mainnet

    Note: The attached deposit is going to be used to cover the storage costs associated with the data you store on BOS, 1 NEAR is enough to store 100kb of data (components code, metadata, etc).

  2. In your repo, go to Settings > Secrets and Variables > Actions and create a new repository secret named SIGNER_PRIVATE_KEY with the private key in ed25519:<private_key> format (if you followed (1.1), it is be printed in your terminal)

  3. Create a file at .github/workflows/deploy-mainnet.yml in your component repo with the following contents. See the workflow definition for explanations of the inputs

    name: Deploy Components to Mainnet
    on:
      push:
        branches: [main]
    jobs:
      deploy-mainnet:
        uses: FroVolod/bos-cli-rs/.github/workflows/deploy-mainnet.yml@master
        with:
          deploy-account-address: <FILL>
          signer-account-address: <FILL>
          signer-public-key: <FILL>
        secrets:
          SIGNER_PRIVATE_KEY: ${{ secrets.SIGNER_PRIVATE_KEY }}
  4. Commit and push the workflow

  5. On changes to the main branch, updated components in src will be deployed!

Custom Workflow

Copy the contents of .github/workflows/deploy-mainnet.yml to your repo as a starting point

bos-cli-rs's People

Contributors

frol avatar frovolod avatar gagdiez avatar petarvujovic98 avatar scholtz avatar think-in-universe avatar

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.