Git Product home page Git Product logo

fiosdk_kotlin's Introduction

FIO Kotlin SDK

The Foundation for Interwallet Operability (FIO) is a consortium of leading blockchain wallets, exchanges and payments providers that seeks to accelerate blockchain adoption by reducing the risk, complexity, and inconvenience of sending and receiving cryptoassets.

For information on FIO, visit the FIO website.

For information on the FIO Chain, API, and SDKs visit the FIO Protocol Developer Hub.

Version

Visit the FIO Protocol Developer Hub to get information on FIO SDK versions. Only use an SDK that has a major version number that matches the current FIO Protocol blockchain major version number (e.g. 1.x.x). Make sure your project is synced. This should happen automatically, but if it didn't, go to Files->Sync Project with Gradle Files

To build the Kotlin SDK project, select "Build" from the Android Studio menu and select "Rebuild Project"

Documentation

Documentation is located in the "documentation" folder in the root of the project.

Generating Documentation

To create the documentation, open a terminal in the root of the project and run ./gradlew dokka

The documentation files will be located in the "documentation" folder in the root of the project.

Running Unit Tests

The unit tests are located in the "app" project under the "androidTest" folder. For running unit tests on testnet, the TestNetSdkTests file, will need to run in an emulator or on a device.

To run a test, proceed as follows:

Be sure your project is synchronized with Gradle by clicking Sync Project in the toolbar.
Run your test in one of the following ways:
    In the Project window, right-click a test and click Run .

    In the Code Editor, right-click a class or method in the test file and click Run to
    test all methods in the class.

    To run all tests, right-click on the test directory and click Run tests .

By default, your test runs using Android Studio's default run configuration. If you'd like to change some run settings such as the instrumentation runner and deployment options, you can edit the run configuration in the Run/Debug Configurations dialog (click Run > Edit Configurations).

Using the SDK

The SDK uses a singleton model. Requiring initialization in the constructor, as these parameters are referenced in subsequent SDK Calls.

The provider model is also used and the appropriate abi provider, needs to be passed into the SDK. An androidfioserializationprovider is provided.

Base URL for TestNet

http://testnet.fioprotocol.io/v1/

TestNet Monitor Tool

https://monitor.testnet.fioprotocol.io/

Workflow for using the SDK with TestNet

Most Signed API calls charge fees and require a FIO address that is associated with the user making the call.

Creating a test account with FIO tokens

When running a test you will want to register addresses and transfer funds. But, registering a new address for the first time requires FIO tokens. Therefore, some manual setup is required to associate FIO tokens with a FIO public key. To set up a FIO public key with FIO tokents in a test environment:

  1. Manually create two private/public FIO key pairs
    1. Navigate to the website: https://monitor.testnet.fioprotocol.io
    2. Select the 'Create Keypair' button (top left of the website)
    3. Copy the keypairs and FIO Internal Account
  2. Manually register a FIO address for both of these FIO key pairs.
    1. Navigate to the website: https://monitor.testnet.fioprotocol.io
    2. Select the 'Register Address' button
    3. Type in a FIO address
    4. Paste in one of the public keys (created above)
    5. Select the 'Create' button
    6. Do this for each public key pair (twice). The created FIO address will be in this format, "mytest:fiotestnet"
  3. Manually transfer funds into these FIO addresses.
    1. Navigate to the website: https://monitor.testnet.fioprotocol.io
    2. Select the 'Faucet' button
    3. Paste in one of the public keys (created above)
    4. Select the 'Send Coins' button
    5. Do this for each public key pair (twice)
  4. These FIO public addresses now have funds available for making Signed API calls.
  5. Edit the TestNetSdkTests.kt file for unit tests, to add these FIO addresses and the private/public FIO key pairs
    1. Edit the alicePrivateKey, alicePublicKey, bobPrivateKey, bobPublicKey, aliceFioAddress, bobFioAddress variables in the TestNetSdkTests.kt file (/app/src/java/fiofoundation/io/fiokotlinsdktestapp/TestNetSdkTests.kt)
  6. Run the tests: -> see running unit tests (above)

When calling a Signed API call that charges FEES,

Use the following steps to determine the fee and pass it to the signed call.

1. Call getFee to get the fee for the Signed API call
2. Call the API Signed call with the fee

Creating your own FIO Private/Public Keys?

The SDK provides FIO Key generation. Here are the key details, if the SDK is not used for Key Generation.

FIO Keys use SLIP-235 for BIP-0044. https://github.com/satoshilabs/slips/blob/master/slip-0044.md

Following the EOS example of private and public key generation. We replace EOS slip '194' with '235'. And 'EOS' public key prefix with 'FIO'. https://eosio.stackexchange.com/questions/397/generate-eos-keys-from-mnemonic-seed

FIO Key Derivation Path:

"44'/235'/0'/0/0"

FIO Key Generation Testing

Using this mnemonic phrase: "valley alien library bread worry brother bundle hammer loyal barely dune brave"

This is the expected Private Key: "5Kbb37EAqQgZ9vWUHoPiC2uXYhyGSFNbL6oiDp24Ea1ADxV1qnu"

This is the expected Public Key: "FIO5kJKNHwctcfUM5XZyiWSqSTM5HTzznJP9F3ZdbhaQAHEVq575o"

Release Notes

Version 1.1.0

Cleaned up Unit Tests. Removed Unit Test configuration properties from unit tests. Properties should now be added to local.properties file in "app/src/androidTest/assets" folder. Removed Android Studio project files (*.iml). Various minor bug fixes.

Version 1.0.0

Added additional Unit Tests for Encryption. Comparing and Validating results across the kotlin, iOS and typescript SDKs. No changes to the SDK code base. Documentation folder added to the project

Version 0.9.2

Updated and cleaned up SDK code base. Finalization of method names and parameter names and order

fiosdk_kotlin's People

Contributors

0xcasey avatar adsorptionenthalpy avatar edrotthoff avatar ericbutz avatar giszmo avatar shawnarney avatar shawnarneygit avatar shawnemullen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.