From f936798188a70c204587b86cfc26557b5bb3bc20 Mon Sep 17 00:00:00 2001 From: S Ali Hosseini <38721653+5A11@users.noreply.github.com> Date: Wed, 11 May 2022 10:59:50 +0100 Subject: [PATCH 1/4] update dependencies; update mkdocs; repove manual page titles (#145) --- docs/assets/images/favicon.ico | Bin 0 -> 1150 bytes docs/assets/images/logo.png | Bin 0 -> 14201 bytes docs/connect-to-network.md | 2 - docs/css/my-styles.css | 86 ++++++++++++++++++++++++--------- docs/deploy-a-contract.md | 2 - docs/governance.md | 1 - docs/overrides/main.html | 5 ++ docs/query-balance.md | 2 - docs/send-tokens.md | 2 - docs/staking.md | 2 - docs/wallets-and-keys.md | 2 - mkdocs.yml | 82 ++++++++++++++++++++++++++----- setup.py | 3 +- 13 files changed, 139 insertions(+), 50 deletions(-) create mode 100644 docs/assets/images/favicon.ico create mode 100644 docs/assets/images/logo.png delete mode 100644 docs/governance.md create mode 100644 docs/overrides/main.html diff --git a/docs/assets/images/favicon.ico b/docs/assets/images/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8c5a4d5b3ec784024720f4a537eb5f099ce3b2ad GIT binary patch literal 1150 zcmb`H+b)Aq5QVqIog0ZnP-j&|ix4V~Jl+ALyz<%IM>NJy{oGUhVAu}>1mPw8tLv( z8SC3R(kvN<)=KNl_*ruy-X+EKgv>=-Wv;hPikS(?_IGGpv+N}kvNY7Ac_ArG4$DR& z{tF{N5SHV7%JSzmzqFW^T&&aLj&d`yGSVw4tiulh;&_#bAc<^AQ^FyMg}{J>M*g}1Hj54?c;!Thx3R0q8P20Y+K zPk5d1pg;WH&x?Z*tDWs@Hw=743$d*6ojTTE6?o*s|GKmN;4KoLPeM2Zxt z2Bk;`5d`Vd38CB_-uHXY_n-Tn|DNaO0o<8AYi7-?X=~Op#!z3AhVn8c001-yEj42R zIQtTO{&b!U{JZS*s0jRr!c)r%0|25t#9xwt=SqG6Kz7&3)Y8XNPgl;~!%Ys(^Qh+DY-Ua2uX@_!ja#!G9uW#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(5myPM9ie(*oZt5y7PFczHoEtoSZZSZJ>(hOKz1>a)W7c~bbo z<%J1N8YP*PL0_<4i32a$72d^=dpft=d!7#o=?`G(%&gKkSPjg8Gj9*>C2fD`a4XC6 zb+kWbd-1b5yKhyw(F|mz?)zg^d)Ad9=lsHiyGQdViq^68CcdmH_=Sl?-k*tn@x1#L zuQwikR=Jp>O{OsW4r0eX=P#ARGod&#MdTH+rd#yp$k4CewRdYa7j%<5$r4=TRdU1P4HsM^ zcaL;KeKFba9Q&m?!hH_7|Gwn5p5bcXM9rd=zx30Te)fQ^I;p7ow%Y7iVh5q?*=%ZL z8l8@=sc)dRu61RuSboRDL#e{`qvzmdO6K&J&O51@V-5-DET1Vc3=cb5h2%X1%_L|w zC{441|u%#J_p zos6pxj*W_k8*916eftl}3$R604Y~2FbFi8!dYsSbN3Rt9#*_het{jJ!rHZ{fiG7$` zOIOKMS=J|9Rihbo7;28Kqi!tle-SG=#_B6>Y=B3q$$dMLk$Y2-ht8$e^PXQ-M=oz7 zLV4#S=W~C!???vVC2NmqJX=Il(eeQdpWS4et9C)?gJ z;fVZ`*qV^HVA2Mrs%3;W_j&L|Djd1N#j2a^N%~ZoMlCbDQ;uoD4`v+|c;zS?6tnAt zcEL*=CqcV1Q!bj!WYYa6SVEZ3eq3;I@$NGkrH@g~6jU*#)xjsvzM71`P4OUYM2z** z&M}Scsu--|w~lR}uk#CB4rvOhNXxhVef2~`f-;d-|L^|~0CZf$Fe#n(2LVpv+0W_c d->!QeoMfD*4dDNNBa!$9p{}o1u44P({{hR1pCteQ literal 0 HcmV?d00001 diff --git a/docs/connect-to-network.md b/docs/connect-to-network.md index 0d3435df..f2b73cc0 100644 --- a/docs/connect-to-network.md +++ b/docs/connect-to-network.md @@ -1,5 +1,3 @@ -# Connect to a network - To start interacting with a blockchain, you first need to establish a connection to a network node. You can use `LedgerClient` as a client object which takes a `NetworkConfig` as an argument. ```python diff --git a/docs/css/my-styles.css b/docs/css/my-styles.css index 0799b02f..70d19781 100644 --- a/docs/css/my-styles.css +++ b/docs/css/my-styles.css @@ -1,37 +1,77 @@ -pre { - background-color: #f8f8f7; +/*overriding the header*/ +.md-header-nav__button.md-logo img { + width: auto!important; } -code { - background-color: #0083fb; +.md-nav__button .md-logo{ + width: auto!important; } -/* this doesn't work now -.md-nav__link { - text-transform: uppercase; - color: #0083fb; +@media screen and (max-width: 76.1875em){ + .md-nav--primary .md-nav__title[for=__drawer] { + background-color:#202943!important; + + } + + .md-nav--primary .md-nav__title[for=__drawer] img{ + width: 180px; + height: auto; + } +} + +.md-header{ + background-color:#202943!important; + padding: 10px; + height: auto; +} + + +/*home page styling*/ +.parent { +display: grid; +grid-template-columns: repeat(3, 1fr); +grid-template-rows: auto auto auto auto; +grid-column-gap: 6px; +grid-row-gap: 6px; +color: white; } -*/ -/* Katharine's css additions */ -.md-header, -.md-tabs, -.md-footer-meta, -.md-footer-nav, -.md-footer-nav__inner { - background-color: #172b6e; +.grid_item { + padding: 15px; + border-radius: 5px; } -.md-nav__title { - color: #172b6e; +.div1 { + grid-area: 1 / 1 / 3 / 4; + background-color: #121A30; + padding-top: 160px; + text-align: right; + padding-right: 30px; } +/* .div2 { grid-area: 3 / 1 / 4 / 4; background-color: #80D2C6} */ +/* .div3 { grid-area: 4 / 1 / 5 / 2; background-color: #F0F0F0; height: 260px;} */ +.div4 { grid-area: 3 / 1 / 3 / 2; background-color: #F0F0F0; height: 260px; color: #222;} +.div5 { grid-area: 3 / 2 / 3 / 3; background-color: #F0F0F0; height: 260px; color: #222;} +.div6 { grid-area: 4 / 1 / 6 / 4; margin: 1px solid black; color: #222;} +.div7 { grid-area: 6 / 1 / 7 / 4; margin: 1px solid black; color: #222;} +.div8 { grid-area: 7 / 1 / 8 / 4; margin: 1px solid black; color: #222;} +.div9 { grid-area: 8 / 1 / 9 / 4; margin: 1px solid black; color: #222;} -.md-icon { - ./assets/images/favicon.ico; +.black-link{ + color: black!important; } -/* Needed so that Mermaid UML diagrams don't end up being massively tall */ -svg{ - height: auto; +/*overriding the announcement style*/ +.md-banner { + color: white; + background-color: #3B82F6; + text-align: center; +} + +.md-banner .announcement-link { + color: white; +} +.md-banner .announcement-link:hover { + color: hsla(0, 100%, 100%, 0.7); } \ No newline at end of file diff --git a/docs/deploy-a-contract.md b/docs/deploy-a-contract.md index a7c3413f..d71597b0 100644 --- a/docs/deploy-a-contract.md +++ b/docs/deploy-a-contract.md @@ -1,5 +1,3 @@ -# Contract Deployment - You can deploy smart contracts in CosmPy using `LedgerContract`. For this, you will need the path to where the contract is stored (in this case `simple.wasm`), a [`LedgerClient`](connect-to-network.md) and a [`Wallet`](wallets-and-keys.md): ```python diff --git a/docs/governance.md b/docs/governance.md deleted file mode 100644 index 2eea8a01..00000000 --- a/docs/governance.md +++ /dev/null @@ -1 +0,0 @@ -# Governance (coming soon!) \ No newline at end of file diff --git a/docs/overrides/main.html b/docs/overrides/main.html new file mode 100644 index 00000000..dabd7f46 --- /dev/null +++ b/docs/overrides/main.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} + +{% block announce %} + +{% endblock %} \ No newline at end of file diff --git a/docs/query-balance.md b/docs/query-balance.md index 92bd65dd..e78a669d 100644 --- a/docs/query-balance.md +++ b/docs/query-balance.md @@ -1,5 +1,3 @@ -# ️Querying balance - To query the balance of an account using a [`LedgerClient`](connect-to-network.md) object `ledger_client`: ```python diff --git a/docs/send-tokens.md b/docs/send-tokens.md index 52ade31a..d021417b 100644 --- a/docs/send-tokens.md +++ b/docs/send-tokens.md @@ -1,5 +1,3 @@ -# Sending Tokens - Once you have your [`wallet`](wallets-and-keys.md) configured, you can send transactions to the network. The `LedgerClient` object provides useful utilities to do common operations. The following example shows how to send `10` `atestfet` to another address: ```python diff --git a/docs/staking.md b/docs/staking.md index 9e502553..a01ec5b1 100644 --- a/docs/staking.md +++ b/docs/staking.md @@ -1,5 +1,3 @@ -# Staking - A big part of the cosmos networks is staking. Staking is the process where you delegate your tokens to the network's validators in order to secure the network. There are three main actions you can take when staking: * **Delegating**: This is the process where you send your tokens to a chosen validator. They are applied immediately and you start earning rewards as soon as this transaction completes. The more tokens you stake, the more rewards you will earn. diff --git a/docs/wallets-and-keys.md b/docs/wallets-and-keys.md index ee2f642a..23b676fa 100644 --- a/docs/wallets-and-keys.md +++ b/docs/wallets-and-keys.md @@ -1,5 +1,3 @@ -# Wallets and Keys - To make changes on a network, you will need to start sending transactions to it. This in tern involves managing private keys and addresses. Luckily, CosmPy makes this relatively straightforward. The following code outlines how to both generate a completely new private key and how to recover a previously generated one: diff --git a/mkdocs.yml b/mkdocs.yml index 44420eda..9da978a5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -2,6 +2,7 @@ site_name: CosmPy site_url: https://docs.fetch.ai/cosmpy site_description: Everything you need to know about CosmPy. repo_url: https://github.com/fetchai/cosmpy +edit_uri: "" site_author: developer@fetch.ai nav: @@ -14,22 +15,79 @@ nav: - Staking: 'staking.md' - Smart Contracts: - Deploy a contract: 'deploy-a-contract.md' - - Advanced (coming soon!): - - Governance: 'governance.md' theme: - name: 'material' - icon: - logo: material/alpha-c-circle - feature: - tabs: true + name: material + language: en + palette: # Set light/dark theme button next to the search bar + - media: "(prefers-color-scheme: light)" + scheme: default + toggle: + icon: material/weather-night + name: Switch to dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + toggle: + icon: material/weather-sunny + name: Switch to light mode + logo: assets/images/logo.png # Set Fetch Logo top left + favicon: assets/images/favicon.ico # Set Fetch favicon + features: + - navigation.instant # Fast page loading + - navigation.tracking # URL automatically updated with the currently active anchor +# - navigation.sections # Top level sections will be visible and grouped in sidebar + - navigation.top # Back-to-top button + - search.suggest # Completion for the searched word (can be accepted with ->). + - search.highlight # Highlight all occurrences after following a search result link + - search.share # Show share button for copying deep link to the current search query and result +# custom_dir: docs/overrides # Uncomment to enable announcements bar at the top + +extra_css: + - css/my-styles.css + +copyright: Copyright © 2018 - 2022 Fetch.ai # Copyright notice in footer strict: true markdown_extensions: - - pymdownx.superfences - - pymdownx.highlight - - admonition + - admonition # Required by admonitions + - pymdownx.superfences # Required by admonitions, annotations, tabs. Enables arbitrary nesting of code and content blocks + - pymdownx.highlight: # Required by code blocks + anchor_linenums: true + - pymdownx.inlinehilite # Required by code blocks + - pymdownx.snippets # Required by code blocks + - pymdownx.superfences # Required by admonitions, code blocks + - pymdownx.details # Required by admonitions, code blocks + - attr_list # Required by annotations + - md_in_html # Required by annotations + - pymdownx.tabbed: # Required by tabs + alternate_style: true + - tables # # Required by tables -extra_css: - - css/my-styles.css +plugins: + - search # Enables search + +extra: + generator: false + social: + - icon: fontawesome/brands/twitter + link: https://bit.ly/3oDuI3f + name: fetch.ai on twitter + - icon: fontawesome/brands/telegram + link: https://t.me/fetch_ai + name: fetch.ai on telegram + - icon: fontawesome/brands/discord + link: https://bit.ly/3ra5uMI + name: fetch.ai on discord + - icon: fontawesome/brands/github + link: https://bit.ly/3AFCWxl + name: fetch.ai on githubs + - icon: fontawesome/brands/reddit + link: https://bit.ly/30zS1Tg + name: fetch.ai on reddit + - icon: fontawesome/brands/youtube + link: https://bit.ly/3DxFazs + name: fetch.ai on youtube + - icon: fontawesome/brands/linkedin + link: https://bit.ly/3kNO70p + name: fetch.ai on linkedin diff --git a/setup.py b/setup.py index 40f7b2e8..15a40ffe 100644 --- a/setup.py +++ b/setup.py @@ -71,7 +71,7 @@ "black==22.3", "mypy==0.910", "mkdocs==1.3", - "mkdocs-material==8.2.8", + "mkdocs-material==8.2.11", "bandit==1.7.0", "safety==1.10.3", "isort==5.9.3", @@ -80,7 +80,6 @@ "pylint==2.9.6", "liccheck==0.6.2", "flake8-copyright==0.2.2", - "sphinx==4.1.2", # Using Tensorflow v2.4.0 was causing conflicts because it requires grpcio==1.32.0 "grpcio-tools<=1.32.0", ], From f64b902e22bae7f513f15f9445288df3056f4157 Mon Sep 17 00:00:00 2001 From: Ian Harris <8903321+Teasel-Ian@users.noreply.github.com> Date: Wed, 11 May 2022 13:07:53 +0100 Subject: [PATCH 2/4] docs: Add documentation for low level functionality (#143) * docs: add example of low level API usage * docs: add examples for using pre-existing keys * docs: add example of low level API usage Co-authored-by: Ian Harris --- docs/low-level-api.md | 178 +++++++++++++++++++++++++++++++++++++++ docs/wallets-and-keys.md | 28 +++++- 2 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 docs/low-level-api.md diff --git a/docs/low-level-api.md b/docs/low-level-api.md new file mode 100644 index 00000000..1e45447c --- /dev/null +++ b/docs/low-level-api.md @@ -0,0 +1,178 @@ +# Cosmpy - Low level API examples + +The Cosmpy library provides a high level API which greatly simplifies the +most common use cases when interacting with Cosmos based chains (sending +tokens, staking, deploying and interacting with contracts etc). This repo contains +[documentation](https://github.com/fetchai/cosmpy/blob/master/docs/) and +[example code](https://github.com/fetchai/cosmpy/tree/master/examples) covering +the use of Cosmpy for such use cases. + +However it also provides low-level access to the entire Cosmos SDK, enabling the +full gamut of functionality to be accessed, albeit with a little more boiler-plate. + +This document is intended to help developers navigate the low-level, protobuf based API functionality, provided by Cosmpy. + +## Recap: High Level API - Aerial + +As a reminder, here is a quick example of using the high level functionality +provided by Cosmpy. In this case, we connect to a testnet, create a wallet, +stake some tokens with a validator, then claim our rewards... + +```python +from cosmpy.aerial.client import LedgerClient, NetworkConfig +from cosmpy.aerial.wallet import LocalWallet +from cosmpy.crypto.keypairs import PrivateKey + +client = LedgerClient(NetworkConfig.fetchai_dorado_testnet()) +wallet = LocalWallet(PrivateKey("rBDA3Q0vK5T+JVQmXSoooqUY/mSO4mmhMHQJI31+h1o=")) +tx = client.delegate_tokens("fetchvaloper1rsane988vksrgp2mlqzclmt8wucxv0ej4hrn2k", 20, wallet) +tx.wait_to_complete() +tx = client.claim_rewards("fetchvaloper1rsane988vksrgp2mlqzclmt8wucxv0ej4hrn2k", wallet) +tx.wait_to_complete() +``` + +The available high-level helper functions provided by Cosmpy can be found by browsing eg +[the aerial client package]("https://github.com/fetchai/cosmpy/blob/master/cosmpy/aerial/client/__init__.py"). + +## Low Level API - simple messages + +However, not all cosmos-sdk functionality is encapsulated in the high level aerial packages. +In which case it is necessary to locate, and use, the definition of the relevant protobuf message. + +For example, analagous to the reward claim example given above, what if a validator operator +wished to claim their commission? Now, at the time of writing, there is no +`client.claim_commission()` high level API method available, so the low level API +must be used. + +Drilling down into the [protos](cosmpy/cosmpy/protos/) directory, we come across the definition +of a [MsgWithdrawValidatorCommission](https://github.com/fetchai/cosmpy/blob/6d7b5f49722b67c803145d55aa291fe426c19994/cosmpy/protos/cosmos/distribution/v1beta1/tx_pb2.py#L160) +message, which looks like just what we need. It takes a single field, `validator_address`, +which is a utf-8 string. + +The code to send a transaction containing such a message might look something like... + +```python +from cosmpy.aerial.client import LedgerClient, NetworkConfig +from cosmpy.aerial.wallet import LocalWallet +from cosmpy.aerial.tx import Transaction +from cosmpy.aerial.client.utils import prepare_and_broadcast_basic_transaction +from cosmpy.protos.cosmos.distribution.v1beta1.tx_pb2 import MsgWithdrawValidatorCommission +from cosmpy.crypto.keypairs import PrivateKey + +client = LedgerClient(NetworkConfig.fetchai_dorado_testnet()) +wallet = LocalWallet(PrivateKey("private key of dorado validator0")) + +tx = Transaction() +tx.add_message( + MsgWithdrawValidatorCommission( + validator_address="fetchvaloper1rsane988vksrgp2mlqzclmt8wucxv0ej4hrn2k" + ) +) +tx = prepare_and_broadcast_basic_transaction(client, tx, wallet) +tx.wait_to_complete() +``` + +## Low Level API - nested messages using protobuf.Any + +The above example created and broadcast a simple `MsgWithdrawValidatorCommission` message. +However sometimes it is necessary to include one message in another. For example what if +we wanted to use the above message, but execute it from a different account using authz? +(ie use an account which holds minimal funds, whose keys need not be treated with the +same level of care as those of the validator itself). + +In this case, we'll need to send an authz +[MsgExec](https://github.com/fetchai/cosmpy/blob/4abb976753edcab402fcc23d4dce3ab67b73b608/cosmpy/protos/cosmos/authz/v1beta1/tx_pb2.py#L114) +message, which we found by browsing the +[tx_pb2.py](https://github.com/fetchai/cosmpy/blob/4abb976753edcab402fcc23d4dce3ab67b73b608/cosmpy/protos/cosmos/authz/v1beta1/tx_pb2.py) file in the cosmos/authz area of the cosmpy/protos. +This message consists of two fields. The "grantee" is a simple string address, as above. +But the msgs field needs to support multiple types of message, not just +MsgWithdrawValidatorCommission. +Protobuf is strongly typed, so to facilitate this flexibility, it is necesssary to first pack the +nested message into a protobuf.Any message. + +Therefore we arrive at code looking something like... + +```python +from cosmpy.aerial.client import LedgerClient, NetworkConfig +from cosmpy.aerial.wallet import LocalWallet +from cosmpy.aerial.tx import Transaction +from cosmpy.aerial.client.utils import prepare_and_broadcast_basic_transaction +from cosmpy.crypto.keypairs import PrivateKey +from cosmpy.protos.cosmos.distribution.v1beta1.tx_pb2 import MsgWithdrawValidatorCommission +from cosmpy.protos.cosmos.authz.v1beta1.tx_pb2 import MsgExec +from google.protobuf import any_pb2 + +client = LedgerClient(NetworkConfig.fetchai_dorado_testnet()) +wallet = LocalWallet(PrivateKey("rBDA3Q0vK5T+JVQmXSoooqUY/mSO4mmhMHQJI31+h1o=")) + +msg = any_pb2.Any() +msg.Pack( + MsgWithdrawValidatorCommission( + validator_address="fetchvaloper1rsane988vksrgp2mlqzclmt8wucxv0ej4hrn2k" + ), + "", +) + +tx = Transaction() +tx.add_message(MsgExec(grantee=str(wallet.address()), msgs=[msg])) + +tx = prepare_and_broadcast_basic_transaction(client, tx, wallet) +tx.wait_to_complete() +``` + +## Low Level API - more protobuf examples + +However, before running the above, the necessary authz grant must first be put in place. +For Ledger Nano users (other hardware wallets are available), that might mean an excursion +to the command line, such as... + +```bash +fetchd tx authz grant $(fetchd keys show grantee --output json | jq -r .address) generic --msg-type "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission" --from=$(fetchd keys show grantor --output json | jq -r .address) --gas auto --gas-adjustment 1.5 --gas-prices 5000000000atestfet +``` + +...which, by default, will provide one year's worth of authorization to withdraw validator +commission, using accounts already present in the keyring. + +But for those with access to their keys in python, and with a bit more handling of protobuf messages... + +```python +from cosmpy.aerial.client import LedgerClient, NetworkConfig +from cosmpy.aerial.wallet import LocalWallet +from cosmpy.aerial.tx import Transaction +from cosmpy.aerial.client.utils import prepare_and_broadcast_basic_transaction +from cosmpy.crypto.keypairs import PrivateKey +from cosmpy.protos.cosmos.distribution.v1beta1.tx_pb2 import MsgWithdrawValidatorCommission +from cosmpy.protos.cosmos.authz.v1beta1.tx_pb2 import MsgGrant +from cosmpy.protos.cosmos.authz.v1beta1.authz_pb2 import GenericAuthorization, Grant + +from google.protobuf import any_pb2, timestamp_pb2 +from datetime import datetime, timedelta + +client = LedgerClient(NetworkConfig.fetchai_dorado_testnet()) +wallet = LocalWallet(PrivateKey("rBDA3Q0vK5T+JVQmXSoooqUY/mSO4mmhMHQJI31+h1o=")) +validator = LocalWallet(PrivateKey("private key of dorado validator0")) + +authz_any = any_pb2.Any() +authz_any.Pack( + GenericAuthorization( + msg="/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission" + ), + "", +) + +expiry = timestamp_pb2.Timestamp() +expiry.FromDatetime(datetime.now() + timedelta(seconds=60)) +grant = Grant(authorization=authz_any, expiration=expiry) + +msg = MsgGrant( + granter=str(validator.address()), + grantee=str(wallet.address()), + grant=grant, +) + +tx = Transaction() +tx.add_message(msg) + +tx = prepare_and_broadcast_basic_transaction(client, tx, validator) +tx.wait_to_complete() +``` diff --git a/docs/wallets-and-keys.md b/docs/wallets-and-keys.md index 23b676fa..35c11b03 100644 --- a/docs/wallets-and-keys.md +++ b/docs/wallets-and-keys.md @@ -23,4 +23,30 @@ Creating the wallet allows users to query useful information such as the address ```python print(wallet.address()) # will print the address for the wallet -``` \ No newline at end of file +``` + +## Exporting private keys from your CLI keyring + +If you wish to use cosmpy with an account already present in your CLI keyring, extract the private key and convert it into a base64 encoded string as follows (using the fetchd CLI +as an example)... + +```bash +fetchd keys export mykeyname --unsafe --unarmored-hex | xxd -r -p | base64 +``` + +## Recovering keys from a mnemonic, using python + +If you wish to use cosmpy with an account for which you have the mnemonic phrase, although you +could always add it to your fetchd keyring then export it as above, it is also possible to +achieve this in python as follows... + +```python +from bip_utils import Bip39SeedGenerator, Bip44, Bip44Coins + +mnemonic = "person knife december tail tortoise jewel warm when worry limit reward memory piece cool sphere kitchen knee embody soft own victory sauce silly page" +seed_bytes = Bip39SeedGenerator(mnemonic).Generate() +bip44_def_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.COSMOS).DeriveDefaultPath() +wallet = LocalWallet(PrivateKey(bip44_def_ctx.PrivateKey().Raw().ToBytes())) +``` + +(Obviously, in real life, you would _never_ include a mnemonic in code that is checked in to git!) From f493e3a29087454f1b5ec1bd347261e69f11ce0d Mon Sep 17 00:00:00 2001 From: S Ali Hosseini <38721653+5A11@users.noreply.github.com> Date: Thu, 12 May 2022 10:37:01 +0100 Subject: [PATCH 3/4] fix new new wallet and low-level docs (#151) --- docs/low-level-api.md | 76 +++++++++++++++------------------------- docs/wallets-and-keys.md | 17 ++++----- mkdocs.yml | 2 ++ 3 files changed, 39 insertions(+), 56 deletions(-) diff --git a/docs/low-level-api.md b/docs/low-level-api.md index 1e45447c..26cace61 100644 --- a/docs/low-level-api.md +++ b/docs/low-level-api.md @@ -1,22 +1,16 @@ -# Cosmpy - Low level API examples +The Cosmpy library provides a high-level API which greatly simplifies the +most common use cases when interacting with Cosmos-based chains (e.g. [sending +tokens](send-tokens.md), [staking](staking.md), [deploying and interacting with contracts](deploy-a-contract.md)). There are [documentation](connect-to-network.md) and +[example code](https://github.com/fetchai/cosmpy/tree/master/examples) covering such use cases. -The Cosmpy library provides a high level API which greatly simplifies the -most common use cases when interacting with Cosmos based chains (sending -tokens, staking, deploying and interacting with contracts etc). This repo contains -[documentation](https://github.com/fetchai/cosmpy/blob/master/docs/) and -[example code](https://github.com/fetchai/cosmpy/tree/master/examples) covering -the use of Cosmpy for such use cases. - -However it also provides low-level access to the entire Cosmos SDK, enabling the +However, cosmpy also provides low-level access to the entire Cosmos-SDK, enabling the full gamut of functionality to be accessed, albeit with a little more boiler-plate. -This document is intended to help developers navigate the low-level, protobuf based API functionality, provided by Cosmpy. +Here, we aim to help developers navigate the low-level, protobuf-based API functionality, provided by Cosmpy. ## Recap: High Level API - Aerial -As a reminder, here is a quick example of using the high level functionality -provided by Cosmpy. In this case, we connect to a testnet, create a wallet, -stake some tokens with a validator, then claim our rewards... +As a reminder, here is a quick example of using the high level functionality provided by Cosmpy. In this case, we connect to a testnet, create a wallet, stake some tokens with a validator, then claim our rewards: ```python from cosmpy.aerial.client import LedgerClient, NetworkConfig @@ -31,25 +25,21 @@ tx = client.claim_rewards("fetchvaloper1rsane988vksrgp2mlqzclmt8wucxv0ej4hrn2k", tx.wait_to_complete() ``` -The available high-level helper functions provided by Cosmpy can be found by browsing eg +The available high-level helper functions provided by cosmpy can be found by browsing for instance [the aerial client package]("https://github.com/fetchai/cosmpy/blob/master/cosmpy/aerial/client/__init__.py"). -## Low Level API - simple messages +## Low Level API + +### Simple Messages -However, not all cosmos-sdk functionality is encapsulated in the high level aerial packages. -In which case it is necessary to locate, and use, the definition of the relevant protobuf message. +Not all Cosmos-SDK functionality is encapsulated in the high level aerial packages. In which case, it is necessary to locate and use the definition of the relevant protobuf message. -For example, analagous to the reward claim example given above, what if a validator operator -wished to claim their commission? Now, at the time of writing, there is no -`client.claim_commission()` high level API method available, so the low level API -must be used. +Analogous to the rewards claim example above, what if a validator operator wanted to claim their commission? At the time of writing, there is no high-level API to achieve this, so the low level API must be used. -Drilling down into the [protos](cosmpy/cosmpy/protos/) directory, we come across the definition -of a [MsgWithdrawValidatorCommission](https://github.com/fetchai/cosmpy/blob/6d7b5f49722b67c803145d55aa291fe426c19994/cosmpy/protos/cosmos/distribution/v1beta1/tx_pb2.py#L160) -message, which looks like just what we need. It takes a single field, `validator_address`, -which is a utf-8 string. +In the [protos](https://github.com/fetchai/cosmpy/tree/master/cosmpy/protos) directory, there is a [MsgWithdrawValidatorCommission](https://github.com/fetchai/cosmpy/blob/6d7b5f49722b67c803145d55aa291fe426c19994/cosmpy/protos/cosmos/distribution/v1beta1/tx_pb2.py#L160) +message, which is what we need. It takes a single `validator_address` parameter which is a `utf-8` string. -The code to send a transaction containing such a message might look something like... +To send a transaction containing such a message: ```python from cosmpy.aerial.client import LedgerClient, NetworkConfig @@ -72,25 +62,18 @@ tx = prepare_and_broadcast_basic_transaction(client, tx, wallet) tx.wait_to_complete() ``` -## Low Level API - nested messages using protobuf.Any +### Nested messages -The above example created and broadcast a simple `MsgWithdrawValidatorCommission` message. -However sometimes it is necessary to include one message in another. For example what if -we wanted to use the above message, but execute it from a different account using authz? -(ie use an account which holds minimal funds, whose keys need not be treated with the -same level of care as those of the validator itself). +The above example creates and broadcasts a simple `MsgWithdrawValidatorCommission` message. However, sometimes it is necessary to include one message in another. For example, what if we wanted to use the above message but execute it from a different account using `authz` (i.e. use an account which holds minimal funds, whose keys need not be treated with the same level of care as those of the validator itself)? -In this case, we'll need to send an authz +In this case, we'll need to send an `authz` [MsgExec](https://github.com/fetchai/cosmpy/blob/4abb976753edcab402fcc23d4dce3ab67b73b608/cosmpy/protos/cosmos/authz/v1beta1/tx_pb2.py#L114) -message, which we found by browsing the -[tx_pb2.py](https://github.com/fetchai/cosmpy/blob/4abb976753edcab402fcc23d4dce3ab67b73b608/cosmpy/protos/cosmos/authz/v1beta1/tx_pb2.py) file in the cosmos/authz area of the cosmpy/protos. -This message consists of two fields. The "grantee" is a simple string address, as above. -But the msgs field needs to support multiple types of message, not just -MsgWithdrawValidatorCommission. -Protobuf is strongly typed, so to facilitate this flexibility, it is necesssary to first pack the -nested message into a protobuf.Any message. +message, which can be found in [tx_pb2.py](https://github.com/fetchai/cosmpy/blob/4abb976753edcab402fcc23d4dce3ab67b73b608/cosmpy/protos/cosmos/authz/v1beta1/tx_pb2.py) under `cosmos/authz` area of `cosmpy/protos`. +This message takes two parameters. The `grantee` is a simple string address similar to the above. But the `msgs` field needs to support multiple types of messages and not just `MsgWithdrawValidatorCommission`. + +Protobuf is strongly typed, so to facilitate this flexibility, it is necessary to first pack the nested message into a `protobuf.Any` message. -Therefore we arrive at code looking something like... +Therefore, we arrive at the code looking like: ```python from cosmpy.aerial.client import LedgerClient, NetworkConfig @@ -120,20 +103,17 @@ tx = prepare_and_broadcast_basic_transaction(client, tx, wallet) tx.wait_to_complete() ``` -## Low Level API - more protobuf examples +### More protobuf examples -However, before running the above, the necessary authz grant must first be put in place. -For Ledger Nano users (other hardware wallets are available), that might mean an excursion -to the command line, such as... +Before running the above, the necessary `authz` grant must first be put in place. For Ledger Nano users (other hardware wallets are also available) that might mean an excursion to the command line. For the Fetchai network using [FetchD](https://docs.fetch.ai/ledger_v2/): ```bash fetchd tx authz grant $(fetchd keys show grantee --output json | jq -r .address) generic --msg-type "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission" --from=$(fetchd keys show grantor --output json | jq -r .address) --gas auto --gas-adjustment 1.5 --gas-prices 5000000000atestfet ``` -...which, by default, will provide one year's worth of authorization to withdraw validator -commission, using accounts already present in the keyring. +By default, the above provides one year's worth of authorization to withdraw validator commission using accounts already present in the keyring. -But for those with access to their keys in python, and with a bit more handling of protobuf messages... +For those with access to their keys in python: ```python from cosmpy.aerial.client import LedgerClient, NetworkConfig diff --git a/docs/wallets-and-keys.md b/docs/wallets-and-keys.md index 35c11b03..b7a5cbf4 100644 --- a/docs/wallets-and-keys.md +++ b/docs/wallets-and-keys.md @@ -25,20 +25,19 @@ Creating the wallet allows users to query useful information such as the address print(wallet.address()) # will print the address for the wallet ``` -## Exporting private keys from your CLI keyring +## Existing account -If you wish to use cosmpy with an account already present in your CLI keyring, extract the private key and convert it into a base64 encoded string as follows (using the fetchd CLI -as an example)... +To use cosmpy with an existing account, extract the private key and convert it into a base64 encoded string. + +For example, to do this on MacOS or Linux for the Fetch.ai network using its [FetchD](https://docs.fetch.ai/ledger_v2/) CLI: ```bash fetchd keys export mykeyname --unsafe --unarmored-hex | xxd -r -p | base64 ``` -## Recovering keys from a mnemonic, using python +### From mnemonic -If you wish to use cosmpy with an account for which you have the mnemonic phrase, although you -could always add it to your fetchd keyring then export it as above, it is also possible to -achieve this in python as follows... +If you have the mnemonic phrase to an account, you can get the associated private key as follows: ```python from bip_utils import Bip39SeedGenerator, Bip44, Bip44Coins @@ -46,7 +45,9 @@ from bip_utils import Bip39SeedGenerator, Bip44, Bip44Coins mnemonic = "person knife december tail tortoise jewel warm when worry limit reward memory piece cool sphere kitchen knee embody soft own victory sauce silly page" seed_bytes = Bip39SeedGenerator(mnemonic).Generate() bip44_def_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.COSMOS).DeriveDefaultPath() + wallet = LocalWallet(PrivateKey(bip44_def_ctx.PrivateKey().Raw().ToBytes())) ``` -(Obviously, in real life, you would _never_ include a mnemonic in code that is checked in to git!) +!!! danger + Of course in real applications, you should **never** include a mnemonic in public code. diff --git a/mkdocs.yml b/mkdocs.yml index 3fdfe25c..761b5a42 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -15,6 +15,8 @@ nav: - Staking: 'staking.md' - Smart Contracts: - Deploy a contract: 'deploy-a-contract.md' + - Advanced: + - Low-level API: 'low-level-api.md' theme: name: material From d555e29dc3a6dc5d3dd094cab02cc636f49fb56f Mon Sep 17 00:00:00 2001 From: ali Date: Fri, 13 May 2022 10:39:07 +0100 Subject: [PATCH 4/4] update md files --- AUTHORS.md | 7 ++++--- DEVELOPING.md | 47 ++++++++++++++++------------------------------- README.md | 4 ++++ 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 7a4638eb..99c63115 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -3,9 +3,10 @@ This is the official list of Fetch.ai authors for copyright purposes. * Ali Hosseini [5A11](https://github.com/5A11) -* Peter Bukva [pbukva](https://github.com/pbukva) -* Jiri Vestfal [MissingNO57](https://github.com/MissingNO57) * Ed Fitzgerald [ejfitzgerald](https://github.com/ejfitzgerald) -* Oleg Panasevych [Panasevychol](https://github.com/panasevychol) +* Jiri Vestfal [MissingNO57](https://github.com/MissingNO57) * Lokman Rahmani [lrahmani](https://github.com/lrahmani) +* Oleg Panasevych [Panasevychol](https://github.com/panasevychol) +* Peter Bukva [pbukva](https://github.com/pbukva) +* Yuri Turchenkov [solarw](https://github.com/solarw) diff --git a/DEVELOPING.md b/DEVELOPING.md index bfe14dc8..b90b40a0 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -9,7 +9,7 @@ The easiest way to get set up for development is to install Python `>=3.7` and ` ## Development commands -There are various makefile commands which are helpful during development. Some of the more prominent ones are listed below: +There are various makefile commands that help the development. Some of them are: - For linting: ```bash @@ -20,25 +20,22 @@ There are various makefile commands which are helpful during development. Some o make mypy make pylint ``` -- For code security analysis: - ```bash - make security - ``` - - To run tests: ```bash make test ``` + +Before committing and opening a PR, use the above commands to run the checks locally. This saves CI hours and ensures you only commit clean code. ## Generating python types from Cosmos SDK protobuf schemas This library uses python types which are generated (using [Google's Protocol Buffers](https://developers.google.com/protocol-buffers/) compiler) from protocol buffer schemas in the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) and [WasmD](https://github.com/CosmWasm/wasmd). -When updating the Cosmos SDK version supported by this library (see the version currently used under `COSMOS_SDK_VERSION` in [Makefile](#Makefile])), you will need to fetch its corresponding protobuf schemas and generate their associated python types, replacing the existing ones. +When updating the Cosmos-SDK version that is supported by this library (see the version currently used under `COSMOS_SDK_VERSION` in [Makefile](#Makefile])), you will need to fetch its corresponding protobuf schemas and generate their associated python types, replacing the existing ones. ->Note: This process has to be done only once when the Cosmos SDK version supported by this library is changed. +>Note: This process has to be done only once when the Cosmos-SDK version supported by this library is changed. ->Note: To generate python types from Cosmos SDK protobuf schemas, you will need [Google Protocol Buffers](https://developers.google.com/protocol-buffers/) compiler. A guide on how to install it can be found [here](https://fetchai.github.io/oef-sdk-python/user/install.html#protobuf-compiler). +>Note: To generate python types from Cosmos-SDK protobuf schemas, you will need [Google Protocol Buffers](https://developers.google.com/protocol-buffers/) compiler. A guide on how to install it can be found [here](https://fetchai.github.io/oef-sdk-python/user/install.html#protobuf-compiler). * To regenerate the protobuf schema files, run the following: ```bash @@ -74,29 +71,14 @@ The Makefile in this repo provides various useful commands that ease development * `make liccheck`: checks dependencies and reports any license issues * `make copyright-check`: checks that files have the correct copyright headers * documentation: - * `make generate-docs`: generates documentation from the source code - * `make open-docs`: opens `index.html` page of the documentation (if on Linux or MacOS). - -## To setup a local Stargate node - -### Preliminaries + * `make docs`: generates documentation from the source code + * `make docs-live`: creates a live-reloading docs server on localhost. -You require Go version 16.0 or higher for your platform (see here) +## To set up a local Fetchai node -### Setup a node - -- Setup FetchD - ```bash - bash scripts/setup_fetchd.sh - ``` - The script will ask for root permissions while setting up a node. - -- Start the node - ```bash - fetchd start - ``` +To set up a local Fetchai node refer to [this guide](https://docs.fetch.ai/ledger_v2/single-node-network/). -## To run a local Stargate node in docker +## To run a local Fetchai node in docker ### Preliminaries @@ -139,7 +121,10 @@ You require [Docker](https://docs.docker.com/get-docker/) for your platform. * Execute: ```bash - docker run -it --rm --entrypoint /scripts/ -p 9090:9090 -p 1317:1317 -v :/scripts/ fetchai/fetchd:0.9.0-rc4 + docker run -it --rm --entrypoint /scripts/ -p 9090:9090 -p 1317:1317 -v :/scripts/ ``` -where `` is the name of the entrypoint script (e.g.`fetchd_initialise.sh`) and `` is the path to the directory you placed the script (e.g.`~/fetchd_docker/`). \ No newline at end of file +where +* `` is the name of the entrypoint script (e.g.`fetchd_initialise.sh`) +* `` is the path to the directory you placed the script (e.g.`~/fetchd_docker/`), +* `` is the tag of the FetchD docker image you want to run (e.g. `fetchai/fetchd:0.10.0` for Dorado) \ No newline at end of file diff --git a/README.md b/README.md index 2c515813..ffa0b4ad 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,10 @@ Then navigate to the following URL in your browser: Under the `examples` directory, you can find examples of basic ledger interactions using `cosmpy` e.g. transferring tokens, staking, deployinig and interacting with a smart contract, and performing atomic swaps. +## To contribute + +Please see [CONTRIBUTING](CONTRIBUTING.md) and [DEVELOPING](DEVELOPING.md) guides. + ## Extra Resources * [Github Repo](https://github.com/fetchai/cosmpy)