-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
114 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' } | ||
|
@@ -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](#) |