https://github.com/ivanceras/polywrap-substrate
https://github.com/ivanceras/polywrap-substrate
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ivanceras/polywrap-substrate
- Owner: ivanceras
- Created: 2022-08-25T10:59:41.000Z (over 3 years ago)
- Default Branch: develop
- Last Pushed: 2023-03-02T20:11:24.000Z (almost 3 years ago)
- Last Synced: 2024-05-23T03:32:03.171Z (over 1 year ago)
- Language: Rust
- Size: 804 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Polywrap substrate
Expose a substrate chain as a graphql endpoint
## Prerequisite
Clone and run `substrate-node-template`
```shell
git clone --depth=1 https://github.com/substrate-developer-hub/substrate-node-template
cd substrate-node-template
cargo run --release -- --dev
```
## Building and running
```shell
git clone -b develop https://github.com/ChainSafe/polywrap-substrate.git
cd polywrap-substrate
cargo run -p server --release
```
Navigate to: http://localhost:8000
Interact with the graphql endpoint with this example query to get the block
```graphql
{
block(url: "http://localhost:9933", number: 0) {
block
}
}
```
# Show the metadata
```graphql
{
metadata(url: "http://localhost:9933") {
metadata
pallets
events
errors
}
}
```
# Show the rpc Methods
```graphql
{
rpcMethods(url: "http://localhost:9933")
}
```
# You can even call multiple methods in the same graphql
```graphql
{
block(url: "http://localhost:9933", number: 0) {
block
}
rpcMethods(url: "http://localhost:9933")
metadata(url: "http://localhost:9933") {
metadata
pallets
events
errors
}
}
```
## Testing
Run all the unit tests
```shell
cargo test --all
```
# Links
- https://github.com/w3f/Grants-Program/blob/master/applications/substrate_core_polywrapper.md
- https://github.com/polywrap/integrations/tree/substrate-integration
- https://github.com/ChainSafe/polywrap-substrate