Coder Social home page Coder Social logo

jmire / lens Goto Github PK

View Code? Open in Web Editor NEW

This project forked from strangelove-ventures/lens

0.0 0.0 0.0 18.53 MB

โš›๏ธโค๏ธ๐Ÿ‘ Brought to you by the LensCrafters

License: Apache License 2.0

Go 99.69% Makefile 0.31%

lens's Introduction

lens

lens is your lens to view the Cosmos :atom:. lens packs all the best practices in golang cosmos client development into one place and provides a simple and easy to use APIs provided by standard Cosmos chains. The cmd package implements the lens command line tool while the client package contains all the building blocks to build your own, complex, feature rich, Cosmos client in go.

Intended use cases:

  • Trading Bots
  • Server side query integrations for alerting or other automation
  • Indexers and search engines
  • Transaction automation (x/authz for security) for farming applications
  • ...:atom::rocket::moon:

This is the start of ideas around how to implement the cosmos client libraries in a seperate repo.

Tutorial

CMD Line

Lens provides a cmd line tool to interact with any cosmos chain supporting the core Cosmos-SDK modules.

Install

git clone https://github.com/strangelove-ventures/lens.git

cd lens

make install

After running the above commands, when running lens you should see

โฏ lens            
This is my lens, there are many like it, but this one is mine.

Usage:
  lens [command]

Available Commands:
  chains      manage local chain configurations
  keys        manage keys held by the relayer for each chain
  query       query things about a chain
  tendermint  all tendermint query commands
  tx          query things about a chain
  help        Help about any command

Flags:
      --chain string   override default chain
  -d, --debug          debug output
  -h, --help           help for lens
      --home string    set home directory (default "/Users/lenscrafters/.lens")

Use "lens [command] --help" for more information about a command.

Chains

Lens comes with two defaulted chains, Cosmos Hub and Osmosis. Located at ~/.lens/config.toml

default_chain: osmosis
 chains:
   cosmoshub:
     key: default
     chain-id: cosmoshub-4
     rpc-addr: https://cosmoshub-4.technofractal.com:443
     grpc-addr: https://gprc.cosmoshub-4.technofractal.com:443
     account-prefix: cosmos
     keyring-backend: test
     gas-adjustment: 1.2
     gas-prices: 0.01uatom
     key-directory: /Users/lenscrafters/.lens/keys
     debug: false
     timeout: 20s
     output-format: json
     sign-mode: direct
   osmosis:
     key: default
     chain-id: osmosis-1
     rpc-addr: https://osmosis-1.technofractal.com:443
     grpc-addr: https://gprc.osmosis-1.technofractal.com:443
     account-prefix: osmo
     keyring-backend: test
     gas-adjustment: 1.2
     gas-prices: 0.01uosmo
     key-directory: /Users/lenscrafters/.lens/keys
     debug: false
     timeout: 20s
     output-format: json
     sign-mode: direct

To add more chains to your config, run:

lens chains add <chain_name>

This command checks the chain registry located here, for the requested chain. The chain name references the directory name in the chain registry. After running lens chains add juno your config.toml should look like

default_chain: osmosis
 chains:
   cosmoshub:
     key: default
     chain-id: cosmoshub-4
     rpc-addr: https://cosmoshub-4.technofractal.com:443
     grpc-addr: https://gprc.cosmoshub-4.technofractal.com:443
     account-prefix: cosmos
     keyring-backend: test
     gas-adjustment: 1.2
     gas-prices: 0.01uatom
     key-directory: /Users/lenscrafters/.lens/keys
     debug: false
     timeout: 20s
     output-format: json
     sign-mode: direct
   juno:
     key: default
     chain-id: juno-1
     rpc-addr: https://rpc-juno.itastakers.com:443
     grpc-addr: ""
     account-prefix: juno
     keyring-backend: test
     gas-adjustment: 1.2
     gas-prices: 0.01ujuno
     key-directory: /Users/lenscrafters/.lens/keys
     debug: false
     timeout: 20s
     output-format: json
     sign-mode: direct
   osmosis:
     key: default
     chain-id: osmosis-1
     rpc-addr: https://osmosis-1.technofractal.com:443
     grpc-addr: https://gprc.osmosis-1.technofractal.com:443
     account-prefix: osmo
     keyring-backend: test
     gas-adjustment: 1.2
     gas-prices: 0.01uosmo
     key-directory: /Users/lenscrafters/.lens/keys
     debug: false
     timeout: 20s
     output-format: json
     sign-mode: direct

When running a command, it will run the command for the defaulted chain. The defaulted chain can be found at the top of ~/.lens/config.toml or by running lens.

To change your default, run:

lens chains set-default <chain_name>

Keys

Lens uses the keyring from the Cosmos-sdk. There is more information about it keyring here. To add a key to lens run:

lens keys restore <key_name>

After restoring a key, it should appear in your list by running: lens keys list, by default it will show the Cosmos Hub address. To see the key encoded for use on other chains run lens keys enumerate <key_name>.

lens's People

Contributors

jackzampolin avatar joeabbey avatar agouin avatar jtieri avatar tac0turtle avatar dependabot[bot] avatar loganhenderson avatar boojamya avatar ryanhendricks 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.