Documentation Index
Fetch the complete documentation index at: https://cobo.com/developers/llms.txt
Use this file to discover all available pages before exploring further.
Try Cobo WaaS Skill in your AI coding assistant (Claude Code, Cursor, etc.). Describe your needs in natural language to auto-generate production-ready SDK code and debug faster 🚀
Overview
This guide introduces how to get started with using the Cobo WaaS 2.0 Java SDK, which allows you to integrate the WaaS service into your existing application using the Java programming language.
To learn more about the initial setup steps necessary for utilizing the WaaS API, see Send your first request.
You can go to GitHub to access the source code of the SDK.
Prerequisites
Add dependency
For Maven users, add the dependency to your project’s POM:
<dependency>
<groupId>com.cobo.waas2</groupId>
<artifactId>cobo-waas2</artifactId>
<version>{VERSION}</version>
<scope>compile</scope>
</dependency>
For Gradle users, add the dependency to your project’s build file:
repositories {
mavenCentral() // Fetch the dependency from Maven Central
}
dependencies {
implementation "com.cobo.waas2:cobo-waas2:{VERSION}"
}
Replace {VERSION} with the lastest version number, for example,
1.2.0. Obtain the latest version number from the
GitHub repository.
- Set the API secret.
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setPrivKey("<YOUR_API_SECRET_IN_HEX>");
- Select which environment you want to use. The SDK uses the production environment by default.
// Select the development environment
defaultClient.setEnv(Env.DEV);
// Select the production environment
defaultClient.setEnv(Env.PROD);
Code samples
For operation-specific documentation and sample code, see the docs folder in the WaaS SDK GitHub repository.
List supported chains
// Import classes
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.model.*;
import com.cobo.waas2.api.WalletsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Use the development environment
defaultClient.setEnv(Env.DEV);
// Set the API secret
defaultClient.setPrivKey("<YOUR_API_SECRET_IN_HEX>");
WalletsApi apiInstance = new WalletsApi();
WalletType walletType = WalletType.fromValue("Custodial");
WalletSubtype walletSubtype = WalletSubtype.fromValue("Asset");
String chainIds = "";
Integer limit = 10;
String before = "";
String after = "";
try {
// List supported chains
ListSupportedChains200Response result = apiInstance.listSupportedChains(walletType, walletSubtype, chainIds, limit, before, after);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletsApi#listSupportedChains");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Create a wallet
// Import classes
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.model.*;
import com.cobo.waas2.api.WalletsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Use the development environment
defaultClient.setEnv(Env.DEV);
// Set the API secret
defaultClient.setPrivKey("<YOUR_API_SECRET_IN_HEX>");
WalletsApi apiInstance = new WalletsApi();
CreateWalletParams createWalletParams = new CreateWalletParams(
new CreateCustodialWalletParams()
.name("Example Wallet")
.walletType(WalletType.CUSTODIAL)
.walletSubtype(WalletSubtype.ASSET)
);
try {
// Create a Custodial Wallet
CreatedWalletInfo result = apiInstance.createWallet(createWalletParams);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletsApi#createWallet");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}