Git Product home page Git Product logo

razrbit-sdk-android's Introduction

Official SDKs: Android | iOS | Javascript | PHP | Ruby

LUXSTACK Bitcoin Platform and SDKs โ€” build, test and scale bitcoin apps faster. Plug in our powerful SDKs to supercharge your bitcoin toolbox.

Razrbit SDK for Android (Beta)

Installation

Eclipse

  1. Setup a library package named com.luxstack.razrbit
  2. Copy all the sources in git repository src folder to src/com/luxstack/razrbit folder in the project folder
  3. Configure the package to depend on the library package org.java_websocket

(github path: https://github.com/TooTallNate/Java-WebSocket)

3.1 Mark the project of library package org.java_websocket as Library reference project in Android tab of Properties window, OR;

3.2 Add the following line in project.properties file of project to refer to project folder of library package org.java_websocket

android.library.reference.1=../java_websocket

Usage

The following code use MainActivity class as example.

import com.luxstack.razrbit.Razrbit;

public class MainActivity extends Activity implements RazrbitCallParams.FnRazrbitCallback, RazrbitWebSocketClient.FnRazrbitWebSocketClientCallback {

	// initialize a Razrbit object by appId and appSecret
	private Razrbit m_razrbit = new Razrbit("MyAppId", "MyAppSecret");

	@Override
	public void onDownloadFinished(List<NameValuePair> listNVPairResult) {
		// This interface is compulsory for class using Razrbit object
		// implements code to handle information returned upon Razrbit call in name value pair listNVPairResult
	}

	@Override
	public void onDownloadFinishedString(String strResult) {
		// This interface is compulsory for class using Razrbit object
		// implements code to handle information returned upon Razrbit call in raw JSON format string strResult
	}
	
	@Override
	public void onRazrbitPostError(String strResult) {
		// This interface is compulsory for class using Razrbit object
		// implements code to handle information returned in strResult upon Razrbit call results in error
	}	
	
	@Override
	public void onWebSocketClientMessage(String strMessage) {
		// This interface is compulsory for class using Razrbit object
		// implements code to handle information received from websocket opened in strMessage
	}
	
	...
	
	// To get wallet balance
	m_razrbit.walletGetBalanceFromAddress("MyAddress", this);
	
	// To open a transaction stream Razrbit websocket
	m_razrbit.openTransactionStream(this);
	
	// To close the transaction stream Razrbit websocket
	m_razrbit.closeTransactionStream(this);

	...
}

API

Public constructor

Razrbit(String strAppId, String strAppSecret)

Public methods

Wallet

void walletSendAmount(String strFromAddress, String strToAddress, String strAmount, RazrbitCallParams.FnRazrbitCallback callback)

Sends bitcoin from one of your addresses to the destination addresses. amount is in bits.

void walletGetBalanceFromAddress(String strAddress, RazrbitCallParams.FnRazrbitCallback callback)

Returns the balance of the given address in bits.

Explorer

void explorerBlock(String strBlockHash, RazrbitCallParams.FnRazrbitCallback callback)

Retrieve details about a given block

void explorerTransaction(String strTransactionHash, RazrbitCallParams.FnRazrbitCallback callback)

Retrieve details about a given transaction

void explorerAddress(String strAddress, RazrbitCallParams.FnRazrbitCallback callback)

Retrieve details about a given address

void explorerAddressUnspentOutputs(String strAddress, RazrbitCallParams.FnRazrbitCallback callback)

Returns the list of unspent outputs for a given address

Network

void networkGetDifficulty(RazrbitCallParams.FnRazrbitCallback callback)

Retrieve the current network difficulty

void networkPushTransaction(String strTransaction, RazrbitCallParams.FnRazrbitCallback callback)

Push a transaction on to the network

Market

void marketsPrice(String strCurrencyCode, RazrbitCallParams.FnRazrbitCallback callback)

currencyCode is a valid ISO 4217 code such as USD or EUR. Returns the current bitcoin price

void marketsDayPrice(String strCurrencyCode, RazrbitCallParams.FnRazrbitCallback callback)

Returns the day price in the specified currency

void marketsHistoricalPrice(String strCurrencyCode, String strDate, RazrbitCallParams.FnRazrbitCallback callback)

Returns the historical bitcoin price for the given date. date must be a date in the yyyy-mm-dd format.

Notifications

void notificationsAddress(String strAddress, String strEmail, RazrbitCallParams.FnRazrbitCallback callback)

Setup a notification email for a given address

void notificationsBlock(String strBlockHash, String strEmail, RazrbitCallParams.FnRazrbitCallback callback)

Setup a notification email for a given block

void notificationsTransaction(String strTransactionHash, String strEmail, RazrbitCallParams.FnRazrbitCallback callback)

Setup a notification email for a given transaction

Support

Feel free to request a feature and make suggestions for our product team.

License

Code released under the MIT license.

Copyright 2012-2014 LUXSTACK Inc. Razrbit is a trademark maintained by LUXSTACK Inc.

LUXSTACK Bitcoin SDKs for other platforms

razrbit-sdk-android's People

Contributors

kevinaleman avatar jonwaller avatar thunderrabbit avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.