Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

everstake/staking-sdk-android

Repository files navigation

Staking SDK Andoid

A simple library to add Everstake support to your wallet.

Features

Simple API and integration for an android wallet

Installation

In your root build.gradle add

allprojects {
    repositories {
       ....
        maven {
            url = uri("https://maven.pkg.github.com/everstake/staking-sdk-android")
            credentials {
                username = GITHUB_USER_NAME
                password = GITHUB_PERSONAL_ACCESS_TOKEN
            }
        }
    }
}

Add dependency to your app build.gradle

dependencies {
    ...
    implementation 'com.everstake:staking-sdk:1.0.2'
}

Usage

In Application class

// Init SDK. Syncs coinList, if required
override fun onCreate() {
        super.onCreate()
        ....
        EverstakeStaking.init(this)
}

Open Everstake

 val stakeListener: EverstakeListener = object : EverstakeListener {
        override fun onAction(
            actionType: EverstakeAction,
            coinSymbol: String,
            amount: String,
            validatorsInfo: List<ValidatorInfo>
        ) {
            // ... Transaction creation
            EverstakeStaking.refreshStaked(refreshMap)
        }
}
// Provide all available balances or use EverstakeStaking.getAvailableCoins() method
// Note: without this method staking options will be empty
EverstakeStaking.updateBalances(balances)
EverstakeStaking.launchStaking(this, stakeListener)

Aditional methods

  • Sync staked info
EverstakeStaking.refreshStaked(coinSymbolToAddressMap) // updates staked amount in Everstake UI
  • Get available coins
EverstakeStaking.getAvailableCoins() // returns list of coin symbols
  • Update address balance
EverstakeStaking.updateBalances(balances) // list of models with coin symbol, address and balance

Example

See sample usage in sample module.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages