-
Notifications
You must be signed in to change notification settings - Fork 11
Fix readme #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix readme #46
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,67 @@ | ||
| This is a modernised version of the py-substrate-interface library, with the ability to use it asynchronously (as well as synchronously). It aims to be almost fully API-compatible with the original library. | ||
| # Async Substrate Interface | ||
| This project provides an asynchronous interface for interacting with [Substrate](https://substrate.io/)-based blockchains. It is based on the [py-substrate-interface](https://github.com/polkascan/py-substrate-interface) project. | ||
|
|
||
| In addition to it's async nature, it is additionally improved with using bt-decode rather than py-scale-codec for significantly faster SCALE decoding. | ||
| Additionally, this project uses [bt-decode](https://github.com/opentensor/bt-decode) instead of [py-scale-codec](https://github.com/polkascan/py-scale-codec) for faster [SCALE](https://docs.substrate.io/reference/scale-codec/) decoding. | ||
|
|
||
| ## Installation | ||
|
|
||
| To install the package, use the following command: | ||
|
|
||
| ```bash | ||
| pip install async-substrate-interface | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| Here are examples of how to use the sync and async inferfaces: | ||
|
|
||
| ```python | ||
| from async_substrate_interface import SubstrateInterface | ||
|
|
||
| def main(): | ||
| substrate = SubstrateInterface( | ||
| url="wss://rpc.polkadot.io" | ||
| ) | ||
| with substrate: | ||
| result = substrate.query( | ||
| module='System', | ||
| storage_function='Account', | ||
| params=['5CZs3T15Ky4jch1sUpSFwkUbYEnsCfe1WCY51fH3SPV6NFnf'] | ||
| ) | ||
|
|
||
| print(result) | ||
|
|
||
| main() | ||
| ``` | ||
|
|
||
| ```python | ||
| import asyncio | ||
| from async_substrate_interface import AsyncSubstrateInterface | ||
|
|
||
| async def main(): | ||
| substrate = AsyncSubstrateInterface( | ||
| url="wss://rpc.polkadot.io" | ||
| ) | ||
| async with substrate: | ||
| result = await substrate.query( | ||
| module='System', | ||
| storage_function='Account', | ||
| params=['5CZs3T15Ky4jch1sUpSFwkUbYEnsCfe1WCY51fH3SPV6NFnf'] | ||
| ) | ||
|
|
||
| print(result) | ||
|
|
||
| asyncio.run(main()) | ||
| ``` | ||
|
|
||
| ## Contributing | ||
|
|
||
| Contributions are welcome! Please open an issue or submit a pull request to the `staging` branch. | ||
|
|
||
| ## License | ||
|
|
||
| This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. | ||
|
|
||
| ## Contact | ||
|
|
||
| For any questions or inquiries, please join the Bittensor Development Discord server: [Church of Rao](https://discord.gg/XC7ucQmq2Q). | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.