diff --git a/README.md b/README.md index 0e0735e..0aedb57 100644 --- a/README.md +++ b/README.md @@ -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' } -``` \ No newline at end of file +``` + +## 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 *contact@cruxpay.com* 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( + "mascot6699@cruxdev.crux", "xrp", + new CruxClientResponseHandler() { + @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 - mynewid@testwallet.crux + cruxClient.registerCruxID("mynewid", + new CruxClientResponseHandler() { + @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() { + @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 newAddressMap = getNewCurrencyMap(); + + cruxClient.putAddressMap(newAddressMap, + new CruxClientResponseHandler() { + @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](#) \ No newline at end of file