import cobo_waas2
from cobo_waas2.models.address_info import AddressInfo
from cobo_waas2.models.create_address_request import CreateAddressRequest
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.WalletsApi(api_client)
wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
create_address_request = cobo_waas2.CreateAddressRequest(chain_id="ETH", count=1)
try:
# Create addresses in wallet
api_response = api_instance.create_address(
wallet_id, create_address_request=create_address_request
)
print("The response of WalletsApi->create_address:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling WalletsApi->create_address: %s\n" % e)
// 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.api.WalletsApi;
import com.cobo.waas2.model.*;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
WalletsApi apiInstance = new WalletsApi();
UUID walletId = UUID.fromString("f47ac10b-58cc-4372-a567-0e02b2c3d479");
CreateAddressRequest createAddressRequest = new CreateAddressRequest().chainId("ETH").count(1);
try {
List<AddressInfo> result = apiInstance.createAddress(walletId, createAddressRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletsApi#createAddress");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
walletId := "f47ac10b-58cc-4372-a567-0e02b2c3d479"
createAddressRequest := *coboWaas2.NewCreateAddressRequest("ETH", int32(1))
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.WalletsAPI.CreateAddress(ctx, walletId).
CreateAddressRequest(createAddressRequest).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WalletsAPI.CreateAddress``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateAddress`: []AddressInfo
fmt.Fprintf(os.Stdout, "Response from `WalletsAPI.CreateAddress`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.WalletsApi();
const wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
const opts = {
CreateAddressRequest: CoboWaas2.CreateAddressRequest.constructFromObject({
chain_id: "ETH",
count: 1,
}),
};
apiInstance.createAddress(wallet_id, opts).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
[
{
"address": "0x0000000000000000000000000000000000000000",
"chain_id": "ETH",
"memo": "82840924",
"path": "m/44/0/2/0/0",
"encoding": "ENCODING_P2PKH",
"pubkey": "xpub6HFaEKt4XdwgEQrQmWr8AEAZ7XBSGh7QYFspwdE86sJn6PjkqsPwVQc2poriBdizqXnTB3UWurJJAZpFnD2DAp9vFTmM2gQ264AArYtFWLH",
"x_only_pubkey": "0x165ed2f04462ec0d3d44dc8690fa9000903b5a96f14ad7f233c21ff748a17b54",
"root_pubkey": "xpub661MyMwAqRbcG4vPNi58VQJrXW8D9VzmauuRq2rTY3oUVnKGuLTxQxvvoEXgLvZ7N9GQXQkWVgKn1rzEUUEm4NdvrBKUqjpNJEnn2UL4rYq",
"taproot_script_tree_hash": "0x138fdd0f6c3803d45553e730c25924baf7be741b8a72a4e6fdbd9d44cb19f85b",
"taproot_internal_address": "3HYV6ta67197syD1ZVFganpmL2wLz4RyoC",
"stellar_trusted_token_ids": [
"XLM_USDC"
]
}
]{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}Create addresses in wallet
This operation generates one or more addresses within a specified wallet.
import cobo_waas2
from cobo_waas2.models.address_info import AddressInfo
from cobo_waas2.models.create_address_request import CreateAddressRequest
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.WalletsApi(api_client)
wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
create_address_request = cobo_waas2.CreateAddressRequest(chain_id="ETH", count=1)
try:
# Create addresses in wallet
api_response = api_instance.create_address(
wallet_id, create_address_request=create_address_request
)
print("The response of WalletsApi->create_address:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling WalletsApi->create_address: %s\n" % e)
// 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.api.WalletsApi;
import com.cobo.waas2.model.*;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
WalletsApi apiInstance = new WalletsApi();
UUID walletId = UUID.fromString("f47ac10b-58cc-4372-a567-0e02b2c3d479");
CreateAddressRequest createAddressRequest = new CreateAddressRequest().chainId("ETH").count(1);
try {
List<AddressInfo> result = apiInstance.createAddress(walletId, createAddressRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletsApi#createAddress");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
walletId := "f47ac10b-58cc-4372-a567-0e02b2c3d479"
createAddressRequest := *coboWaas2.NewCreateAddressRequest("ETH", int32(1))
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.WalletsAPI.CreateAddress(ctx, walletId).
CreateAddressRequest(createAddressRequest).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WalletsAPI.CreateAddress``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateAddress`: []AddressInfo
fmt.Fprintf(os.Stdout, "Response from `WalletsAPI.CreateAddress`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.WalletsApi();
const wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
const opts = {
CreateAddressRequest: CoboWaas2.CreateAddressRequest.constructFromObject({
chain_id: "ETH",
count: 1,
}),
};
apiInstance.createAddress(wallet_id, opts).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
[
{
"address": "0x0000000000000000000000000000000000000000",
"chain_id": "ETH",
"memo": "82840924",
"path": "m/44/0/2/0/0",
"encoding": "ENCODING_P2PKH",
"pubkey": "xpub6HFaEKt4XdwgEQrQmWr8AEAZ7XBSGh7QYFspwdE86sJn6PjkqsPwVQc2poriBdizqXnTB3UWurJJAZpFnD2DAp9vFTmM2gQ264AArYtFWLH",
"x_only_pubkey": "0x165ed2f04462ec0d3d44dc8690fa9000903b5a96f14ad7f233c21ff748a17b54",
"root_pubkey": "xpub661MyMwAqRbcG4vPNi58VQJrXW8D9VzmauuRq2rTY3oUVnKGuLTxQxvvoEXgLvZ7N9GQXQkWVgKn1rzEUUEm4NdvrBKUqjpNJEnn2UL4rYq",
"taproot_script_tree_hash": "0x138fdd0f6c3803d45553e730c25924baf7be741b8a72a4e6fdbd9d44cb19f85b",
"taproot_internal_address": "3HYV6ta67197syD1ZVFganpmL2wLz4RyoC",
"stellar_trusted_token_ids": [
"XLM_USDC"
]
}
]{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}import cobo_waas2
from cobo_waas2.models.address_info import AddressInfo
from cobo_waas2.models.create_address_request import CreateAddressRequest
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.WalletsApi(api_client)
wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
create_address_request = cobo_waas2.CreateAddressRequest(chain_id="ETH", count=1)
try:
# Create addresses in wallet
api_response = api_instance.create_address(
wallet_id, create_address_request=create_address_request
)
print("The response of WalletsApi->create_address:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling WalletsApi->create_address: %s\n" % e)
// 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.api.WalletsApi;
import com.cobo.waas2.model.*;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
WalletsApi apiInstance = new WalletsApi();
UUID walletId = UUID.fromString("f47ac10b-58cc-4372-a567-0e02b2c3d479");
CreateAddressRequest createAddressRequest = new CreateAddressRequest().chainId("ETH").count(1);
try {
List<AddressInfo> result = apiInstance.createAddress(walletId, createAddressRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WalletsApi#createAddress");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
walletId := "f47ac10b-58cc-4372-a567-0e02b2c3d479"
createAddressRequest := *coboWaas2.NewCreateAddressRequest("ETH", int32(1))
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.WalletsAPI.CreateAddress(ctx, walletId).
CreateAddressRequest(createAddressRequest).
Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WalletsAPI.CreateAddress``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateAddress`: []AddressInfo
fmt.Fprintf(os.Stdout, "Response from `WalletsAPI.CreateAddress`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.WalletsApi();
const wallet_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
const opts = {
CreateAddressRequest: CoboWaas2.CreateAddressRequest.constructFromObject({
chain_id: "ETH",
count: 1,
}),
};
apiInstance.createAddress(wallet_id, opts).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
Authorizations
The API key. For more details, refer to API key.
In the API playground, enter your API secret, and your API key will be accordingly calculated.
Path Parameters
The wallet ID.
Body
The request body to generates addresses within a specified wallet.
The chain ID, which is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling List enabled chains.
"ETH"
The number of addresses to create. This property will be ignored if you are generating tweaked Taproot addresses.
1 <= x <= 501
A list of script tree hashes used to generate a tweaked Taproot address. This property is required only if you want to generate tweaked Taproot addresses.
The original Taproot address to be tweaked. This property is required only if you want to generate tweaked Taproot addresses.
"3HYV6ta67197syD1ZVFganpmL2wLz4RyoC"
The address encoding formats. This property only applies to blockchains that have a similar architecture to Bitcoin.
ENCODING_P2PKH, ENCODING_P2SH_P2WPKH, ENCODING_BECH32, ENCODING_P2PKH_UNCOMPRESSED, ENCODING_P2SH_P2MS, ENCODING_P2SH_P2WSH_P2MS, ENCODING_P2TR, ENCODING_ADA_BYRON, ENCODING_ADA_SHELLEY, ENCODING_DEFAULT "ENCODING_P2PKH"
Response
The request was successful.
The wallet address.
"0x0000000000000000000000000000000000000000"
The chain ID, which is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling List enabled chains.
"ETH"
The memo code.
"82840924"
The derivation path of the address. This property applies to MPC Wallets only. To learn the meaning of each level in the path, see Path levels.
"m/44/0/2/0/0"
The address encoding formats. This property only applies to blockchains that have a similar architecture to Bitcoin.
ENCODING_P2PKH, ENCODING_P2SH_P2WPKH, ENCODING_BECH32, ENCODING_P2PKH_UNCOMPRESSED, ENCODING_P2SH_P2MS, ENCODING_P2SH_P2WSH_P2MS, ENCODING_P2TR, ENCODING_ADA_BYRON, ENCODING_ADA_SHELLEY, ENCODING_DEFAULT "ENCODING_P2PKH"
The public key of the address. This property applies to MPC Wallets only.
"xpub6HFaEKt4XdwgEQrQmWr8AEAZ7XBSGh7QYFspwdE86sJn6PjkqsPwVQc2poriBdizqXnTB3UWurJJAZpFnD2DAp9vFTmM2gQ264AArYtFWLH"
The 32-byte x-only public key in hexadecimal format after tweaking.
"0x165ed2f04462ec0d3d44dc8690fa9000903b5a96f14ad7f233c21ff748a17b54"
The root public key of the address. This property applies to MPC Wallets only.
"xpub661MyMwAqRbcG4vPNi58VQJrXW8D9VzmauuRq2rTY3oUVnKGuLTxQxvvoEXgLvZ7N9GQXQkWVgKn1rzEUUEm4NdvrBKUqjpNJEnn2UL4rYq"
The information about the new address.
"0x138fdd0f6c3803d45553e730c25924baf7be741b8a72a4e6fdbd9d44cb19f85b"
The Taproot address before tweaking.
"3HYV6ta67197syD1ZVFganpmL2wLz4RyoC"
The list of token IDs for which this address has already established trustlines on the Stellar network.
Was this page helpful?
