Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/NodleCode/substrate-client-kotlin
Substrate RPC-client implementation made in pure Kotlin.
https://github.com/NodleCode/substrate-client-kotlin
android kotlin parity-substrate substrate
Last synced: about 1 month ago
JSON representation
Substrate RPC-client implementation made in pure Kotlin.
- Host: GitHub
- URL: https://github.com/NodleCode/substrate-client-kotlin
- Owner: NodleCode
- License: apache-2.0
- Created: 2020-10-23T07:41:00.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-10T12:03:58.000Z (over 3 years ago)
- Last Synced: 2024-01-25T03:42:55.390Z (11 months ago)
- Topics: android, kotlin, parity-substrate, substrate
- Language: Kotlin
- Homepage:
- Size: 140 KB
- Stars: 17
- Watchers: 7
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-substrate - Kotlin Client - Maintained by [Nodle.io](https://github.com/NodleCode). (Client Libraries)
- awesome-substrate - Kotlin Client - Maintained by [Nodle.io](https://github.com/NodleCode). (Client Libraries)
README
# Kotlin Substrate Client
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)substrate-client-kotlin is client library to interact with a substrate-based chain.
It uses the API available from the RPC endpoint only (no sidecar).
As of today it provides the following functionality:* compatible with substrate 2.0
* ed25519 wallet creation
* get account info (balance)
* sign extrinsic and send (immortal era)
* estimate feewhat is currently **not** supported
* sr25519 wallet
* mortal era extrinsic## Using the library
1. Add the JitPack repository.
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```2. Add the substrate-client dependency
```
dependencies {
implementation 'com.github.NodleCode:substrate-client-kotlin:1.0'
}
```## Running the tests over custom rpc endpoints
The library comes with a set of JUnit Test to ensure that the api
provided by this library works properlyIn order to test that this library works over your own substrate rpc
endpoints, you need to provide the chains configuration that will be
used by the tests.Simply create a file in
```
substrate-client/src/test/resources/rpc-test.config
```This file must be a CSV (without header) and must contain 3 columns per lines:
* rpc endpoint (e.g. wss://rpc.polkadot.io)
* alice wallet mnemonic
* bob wallet mnemonicAlice and Bob wallet must be provisioned with enough token to be able
to perform the test and pay the fees. When testing sending transaction,
the test will always send token from the wallet with the most token.Here is an example of such file (wallets and rpc doesn't exists):
```
wss://mainnet.substrate-chain.io,smoke key grief belt gather absurd open attend keep flip hollow popular,total arch interest inmate book cigar primary long mixture party practice old
wss://testnet.substrate-chain.io,pumpkin poem tuition scatter elder moral hockey valley health head joke stem,pupil opinion unhappy nerve adult lunch dolphin famous angry draw soap like
```You can then run the tests with gradle:
```
./gradlew test
```The test report will be generated in `substrate-client/build/reports/test/index.html`
## Additional Notes
This is a work in progress and comes with no warranty.
contribution are welcome. If you have any question, ideas or if you found a bug, please open an issue!