React Native SDK

The SDK source code can be found on Github

Install SDK

npm install @qiibee/react-native-qb-wallet-sdk --save

Import qbWalletSDK

import QbWalletSdk from 'react-native-qb-wallet-sdk';

Get Wallet Address

/**
* @address { "address" : "some_address" }
* @error { "error" : "error_description" } 
*/
QbWalletSdk.walletAddress((address, err) => {
    if (err) {
        console.log(err)
    } else {
        console.log(address)
    }
})

Get Private Key

/**
* @privateKey { "privateKey" : "some_private_key" }
* @error { "error" : "error_description" } 
*/
QbWalletSdk.privateKey((privateKey, err) => {
    if (err) {
        console.log(err)
    } else {
        console.log(privateKey)
    }
})

Get Mnemonic Phrase

/**
* @phrase { "phrase" : "some_phrase" }
* @error { "error" : "error_description" } 
*/
QbWalletSdk.mnemonicPhrase((phrase, err) => {
    if (err) {
        console.log(err)
    } else {
        console.log(phrase)
    }
})

Create new Wallet

/**
* @wallet { "wallet" : { 
    "phrase": "...", 
    "address":"...", 
    "privateKey":"..." }
}
* @error { "error" : "error_description" } 
*/
QbWalletSdk.createWallet((wallet, err) => {
    if (err) {
        console.log(err)
    } else {
        console.log(wallet)
    }
})

Remove existing Wallet

/**
* @phrase { "success" : true }
* @error { "error" : "error_description" } 
*/
QbWalletSdk.removeWallet((success, err) => {
    if (err) {
        console.log(err)
    } else {
        console.log(success)
    }
})

Restore Wallet

/**
* @wallet { "wallet" : { 
    "phrase": "...", 
    "address":"...", 
    "privateKey":"..." }
}
* @error { "error" : "error_description" } 
*/
QbWalletSdk.restoreWallet((wallet, err) => {
    if (err) {
        console.log(err)
    } else {
        console.log(wallet)
    }
})

Get Balances

/**
* @balances { 
    "aggValue": { "USD": "agg_value_in_USD" }
    "balances" : { 
        "ethBalance": "value",
        "privateTokens": [
            "balance": "...",
            "address": "...",
            "symbol": "..."
        ],
        "publicTokens": [
            "balance": "...",
            "address": "...",
            "symbol": "..."
        ]
    }
}
* @error { "error" : "error_description" } 
*/
QbWalletSdk.getBalances((balancess, err) => {
      if (err) {
        console.log(err)
      } else {
        console.log(balances)
      }
    })

Get Tokens

/**
* @tokens {     
    "privateTokens": [
        "balance": "...",
        "address": "...",
        "symbol": "..."
    ],
    "publicTokens": [
        "balance": "...",
        "address": "...",
        "symbol": "..."
    ]
}
* @error { "error" : "error_description" } 
*/
QbWalletSdk.getTokens((tokens, err) => {
      if (err) {
        console.log(err)
      } else {
        console.log(tokens)
      }
    })

Get Transactions

/**
* @transactions {     
    "transactions": [
        {
            "address": "..",
            "from": "...",
            "to": "...",
            "timestamp": "...",
            "token": {
                "balance": "...",
                "cotnractAddress": "...",
                "symbol": "..."
            }
        }
    ]
}
* @error { "error" : "error_description" } 
*/
QbWalletSdk.getTransactions((transactions, err) => {
      if (err) {
        console.log(err)
      } else {
        console.log(transactions)
      }
    })

Send Transaction

/**
* @param {String} toAddress
* @param {String} contractAddress
* @param {String} sendValue

* @hash { "hash" : "some_hash" }
* @error { "error" : "error_description" } 
*/
QbWalletSdk.sendTransaction(
      "toAddress", 
      "contractAddress",
      "2.1",
      (hash, err) => {
        if (err) {
          console.log(err)
        } else {
          console.log(hash)
        }
      }
    )