Full Documentation

This lists the full functionality available in the Java SDK.

Version 0.2 requires JDK 11 or later.

Usage

Add the SDK from the Maven Repository to your project. The SDK is available here.

<dependency>
<groupId>com.silamoney</groupId>
<artifactId>SilamoneySDK</artifactId>
<version>0.1.0-rc</version>
</dependency>

Initialize the application

import com.silamoney.client.api.SilaApi;
SilaApi api = new SilaApi(Environments.SilaEnvironment.SANDBOX,
appHandle,
privateKey);

This sets up the app private key and handle for the SDK to use for signing subsequent requests. The other SDK functionality will not be available until this configuration is completed. The SDK does not store this information outside of the instance that is configured. Private keys are never transmitted over the network or stored outside the scope of this instance.

You can manage your apps in the Developer Console. The APPLICATION_PRIVATE_KEY is the Private Key that matches the Public Key associated with the Application Handle in your Console.

Keep your Application Private Key secure! Never share it with anyone, including us. If you believe that your private key has been compromised, please replace the key for that app with a new one in the Developer Console.

User Methods

Check Handle

Checks the availability of user_handle so that it can be used in user registration.

string userHandle = "user.silamoney.eth";
ApiResponse<object> response = api.CheckHandle(userHandle);

Success Response Object 200 OK

System.out.println(response.getStatusCode()); // 200
System.out.println(((BaseResponse)response.getData()).getReference()); // Random reference number
System.out.println(((BaseResponse)response.getData()).getStatus()); // SUCCESS
System.out.println(((BaseResponse)response.getData()).getMessage()); // user is available!

Failure Response Object 200 OK

System.out.println(response.getStatusCode()); // 200
System.out.println(((BaseResponse)response.getData()).getReference()); // Random reference number
System.out.println(((BaseResponse)response.getData()).getStatus()); // FAILURE
System.out.println(((BaseResponse)response.getData()).getMessage()); // user is already taken.

Register

Attaches KYC data and specified blockchain address to an assigned handle.

User user = new User(String userHandle, String firstName, String lastName, String streetAddress1, @Nullable String streetAddress2,
String city, String state (2 characters), String postalCode (5 or 9 digit format), String phone, String email, String cryptoAddress,
String identityNumber (SSN format "AAA-GG-SSSS"), Date birthdate);
ApiResponse response = api.Register(user);

Success Response Object

System.out.println(response.getStatusCode()); // 200
System.out.println(((BaseResponse)response.getData()).getReference()); // Random reference number
System.out.println(((BaseResponse)response.getData()).getStatus()); // SUCCESS
System.out.println(((BaseResponse)response.getData()).getMessage()); // user was successfully registered.

RequestKYC

Starts KYC verification process on a registered user handle.

ApiResponse response = api.RequestKYC(userHandle, userPrivateKey);

Success Response Object

System.out.println(response.getStatusCode()); // 200
System.out.println(((BaseResponse)response.getData()).getReference()); // Random reference number
System.out.println(((BaseResponse)response.getData()).getStatus()); // SUCCESS
System.out.println(((BaseResponse)response.getData()).getMessage()); // user submitted for KYC review.

CheckKYC

Returns whether the entity attached to the user handle is verified, not valid, or still pending.

ApiResponse response = api.CheckKYC(userHandle, userPrivateKey);

Success Response Object

System.out.println(response.getStatusCode()); // 200
System.out.println(((BaseResponse)response.getData()).getReference()); // Random reference number
System.out.println(((BaseResponse)response.getData()).getStatus()); // SUCCESS
System.out.println(((BaseResponse)response.getData()).getMessage()); // user has passed ID verification!

LinkAccount

Uses a provided Plaid public token to link a bank account to a verified entity. More detail & Plaid public key is available here.

ApiResponse response = api.LinkAccount(userHandle, accountName, publicToken, userPrivateKey);

Success Response Object

System.out.println(response.getStatusCode()); // 200
System.out.println(((LinkAccountResponse) response.getData()).getStatus()); // SUCCESS

GetAccounts

Gets basic bank account names linked to user handle.

ApiResponse response = api.GetAccounts(userHandle, userPrivateKey);

Success Response Object

System.out.println(response.getStatusCode()); // 200
System.out.println(((List<Account>) response.getData()).get(0).accountName); // Account name
System.out.println(((List<Account>) response.getData()).get(0).accountNumber); // Account Number
System.out.println(((List<Account>) response.getData()).get(0).accountStatus); // Account Status
System.out.println(((List<Account>) response.getData()).get(0).accountType); // Account Type

IssueSila

Debits a specified account and issues tokens to the address belonging to the requested handle.

ApiResponse response = api.IssueSila(userHandle, amount, accountName, userPrivateKey);

Success Response Object

System.out.println(response.getStatusCode()); // 200
System.out.println(((BaseResponse) response.getData()).getReference()); // Random reference number
System.out.println(((BaseResponse) response.getData()).getStatus()); // SUCCESS
System.out.println(((BaseResponse) response.getData()).getMessage()); // Transaction submitted to processing queue.

TransferSila

Starts a transfer of the requested amount of SILA to the requested destination handle.

ApiResponse response = api.TransferSila(userHandle, 1000, destination, userPrivateKey);

Success Response Object

System.out.println(response.getStatusCode()); // 200
System.out.println(((BaseResponse) response.getData()).getReference()); // Random reference number
System.out.println(((BaseResponse) response.getData()).getStatus()); // SUCCESS
System.out.println(((BaseResponse) response.getData()).getMessage()); // Transaction submitted to processing queue.

RedeemSila

Burns given the amount of SILA at the handle's blockchain address and credits their named bank account in the equivalent monetary amount.

ApiResponse response = api.RedeemSila(userHandle, 1000, accountName, userPrivateKey);

Success Response Object

System.out.println(response.getStatusCode()); // 200
System.out.println(((BaseResponse) response.getData()).getReference()); // Random reference number
System.out.println(((BaseResponse) response.getData()).getStatus()); // SUCCESS
System.out.println(((BaseResponse) response.getData()).getMessage()); // Transaction submitted to processing queue.

GetTransactions

ApiResponse response = api.GetTransactions(userHandle, filters, userPrivateKey);

Success Response Object

System.out.println(response.getStatusCode()); // 200
((GetTransactionsResponse) response.getData()) // Access response data.

SilaBalance

ApiResponse response = api.SilaBalance(host, address);

Success Response Object

System.out.println(response.getStatusCode()); // 200
System.out.println(response.getData()); // Sila Tokens.