Skip to content

Commit

Permalink
Merge branch 'add-readme'
Browse files Browse the repository at this point in the history
  • Loading branch information
quixote911 committed Feb 7, 2020
2 parents 1053fba + e2003a8 commit d039a4a
Showing 1 changed file with 114 additions and 3 deletions.
117 changes: 114 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Cruxprotocol Android SDK

## Adding to your project
CRUX Protocol Documentation & Guides - https://docs.cruxpay.com


# Quickstart

Official SDK Quickstart docs - https://docs.cruxpay.com/docs/quickstart

## 1. Install

```
repositories {
maven { url 'https://jitpack.io' }
Expand All @@ -9,4 +16,108 @@
dependencies {
implementation 'com.github.cruxprotocol:android-sdk:Tag'
}
```
```

## 2. Initialize

To initialise the SDK you need a **walletClientName**.

You can get create and manage your `walletClientName` at [CRUX Wallet Dashboard](https://cruxpay.com/wallet/dashboard). Please feel free to contact us at *[email protected]* for any registration related queries.

```
import com.crux.sdk.CruxClient;
import com.crux.sdk.model.*;
CruxClientInitConfig.Builder configBuilder = new CruxClientInitConfig.Builder()
.setWalletClientName("testwallet")
.setPrivateKey("6bd397dc89272e71165a0e7d197b288ed5b1e44e1928c25455506f1968f");
CruxClient cruxClient = new CruxClient(configBuilder, androidContextObject);
```


## 3. Start Using!

```
// Resolve any existing CRUX ID for a currency
cruxClient.resolveCurrencyAddressForCruxID(
"[email protected]", "xrp",
new CruxClientResponseHandler<CruxAddress>() {
@Override
public void onResponse(CruxAddress successResponse) {
System.out.println(successResponse);
}
@Override
public void onErrorResponse(CruxClientError failureResponse) {
System.out.println(failureResponse);
}
}
);
// Create a new CRUX ID - [email protected]
cruxClient.registerCruxID("mynewid",
new CruxClientResponseHandler<Void>() {
@Override
public void onResponse(Void successResponse) {
System.out.println(successResponse);
// ID Will be owned by the injected private key
// New IDs take 6-8 confirmations in the Bitcoin network to confirm.
}
@Override
public void onErrorResponse(CruxClientError failureResponse) {
}
}
);
// You can check the status of the ID by asking the SDK for the CruxID State
cruxClient.getCruxIDState(
new CruxClientResponseHandler<CruxIDState>() {
@Override
public void onResponse(CruxIDState successResponse) {
System.out.println(successResponse);
}
@Override
public void onErrorResponse(CruxClientError failureResponse) {
}
}
);
// A registered ID allows you to associate cryptocurrency addresses
HashMap<String, CruxAddress> newAddressMap = getNewCurrencyMap();
cruxClient.putAddressMap(newAddressMap,
new CruxClientResponseHandler<CruxPutAddressMapSuccess>() {
@Override
public void onResponse(CruxPutAddressMapSuccess successResponse) {
System.out.println(successResponse);
}
@Override
public void onErrorResponse(CruxClientError failureResponse) {
}
}
);
```


# SDK Integration Steps and User Interface:

[LINK](https://docs.cruxpay.com/docs/integration-dev-plan)

# Sample Integration Code

[LINK](https://github.com/cruxprotocol/android-sdk/blob/add-readme/app/src/main/java/com/example/liquid_test_2/MainActivity.java#L45)

# SDK Reference

[LINK](#)

0 comments on commit d039a4a

Please sign in to comment.