Node.js
import { createHmac } from "node:crypto";
// Node.js 18+. Set credentials and resource values on your server.
function required(name) {
const value = process.env[name];
if (!value) throw new Error(`Set ${name} before running this example.`);
return value;
}
const baseUrl = process.env.LEDIG_API_BASE_URL ?? "https://api-sandbox.ledig.io";
const method = "GET";
const requestId = required("LEDIG_REQUEST_ID");
const path = `/v1/wallets/network/${encodeURIComponent(requestId)}`;
const pathWithQuery = path;
const rawBody = "";
const headers = { "Accept": "application/json" };
const timestamp = Math.floor(Date.now() / 1000).toString();
const payload = `${timestamp}.${method}.${pathWithQuery}.${rawBody}`;
headers["x-ledig-key"] = required("LEDIG_API_KEY");
headers["x-ledig-timestamp"] = timestamp;
headers["x-ledig-signature"] = "v1=" + createHmac("sha256", required("LEDIG_API_SECRET"))
.update(payload).digest("base64");
const response = await fetch(`${baseUrl}${pathWithQuery}`, {
method,
headers,
});
const result = await response.json();
// Use result in your application; do not log credentials or upload links.
console.log(response.status);{
"status": "success",
"data": {
"requestId": "wallet_request_example_001",
"status": "ready",
"network": "ETHEREUM_SEPOLIA",
"address": "0x1111111111111111111111111111111111111111",
"supportedAssets": [
{
"code": "USDC",
"name": "USD Coin",
"testToken": true
}
],
"wallets": [
{
"id": "wallet_example_001",
"nickname": "Customer deposits",
"coin": "USDC",
"network": "ETHEREUM_SEPOLIA",
"address": "0x1111111111111111111111111111111111111111",
"memo": "",
"createdAt": "2026-01-15T10:00:00.000Z",
"updatedAt": "2026-01-15T10:00:00.000Z"
}
]
}
}{
"status": "error",
"code": "BAD_REQUEST",
"message": "Check the request fields and try again."
}{
"status": "error",
"code": "UNAUTHORIZED",
"message": "Authentication is required."
}{
"status": "error",
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action."
}{
"status": "error",
"code": "NOT_FOUND",
"message": "The requested resource was not found."
}{
"status": "error",
"code": "RATE_LIMITED",
"message": "Too many requests. Wait before trying again."
}{
"status": "error",
"code": "PROVIDER_UNAVAILABLE",
"message": "This service is temporarily unavailable. Please try again later."
}Deposit wallets
Check deposit address setup
Check whether a network deposit address is ready.
GET
/
v1
/
wallets
/
network
/
{requestId}
Node.js
import { createHmac } from "node:crypto";
// Node.js 18+. Set credentials and resource values on your server.
function required(name) {
const value = process.env[name];
if (!value) throw new Error(`Set ${name} before running this example.`);
return value;
}
const baseUrl = process.env.LEDIG_API_BASE_URL ?? "https://api-sandbox.ledig.io";
const method = "GET";
const requestId = required("LEDIG_REQUEST_ID");
const path = `/v1/wallets/network/${encodeURIComponent(requestId)}`;
const pathWithQuery = path;
const rawBody = "";
const headers = { "Accept": "application/json" };
const timestamp = Math.floor(Date.now() / 1000).toString();
const payload = `${timestamp}.${method}.${pathWithQuery}.${rawBody}`;
headers["x-ledig-key"] = required("LEDIG_API_KEY");
headers["x-ledig-timestamp"] = timestamp;
headers["x-ledig-signature"] = "v1=" + createHmac("sha256", required("LEDIG_API_SECRET"))
.update(payload).digest("base64");
const response = await fetch(`${baseUrl}${pathWithQuery}`, {
method,
headers,
});
const result = await response.json();
// Use result in your application; do not log credentials or upload links.
console.log(response.status);{
"status": "success",
"data": {
"requestId": "wallet_request_example_001",
"status": "ready",
"network": "ETHEREUM_SEPOLIA",
"address": "0x1111111111111111111111111111111111111111",
"supportedAssets": [
{
"code": "USDC",
"name": "USD Coin",
"testToken": true
}
],
"wallets": [
{
"id": "wallet_example_001",
"nickname": "Customer deposits",
"coin": "USDC",
"network": "ETHEREUM_SEPOLIA",
"address": "0x1111111111111111111111111111111111111111",
"memo": "",
"createdAt": "2026-01-15T10:00:00.000Z",
"updatedAt": "2026-01-15T10:00:00.000Z"
}
]
}
}{
"status": "error",
"code": "BAD_REQUEST",
"message": "Check the request fields and try again."
}{
"status": "error",
"code": "UNAUTHORIZED",
"message": "Authentication is required."
}{
"status": "error",
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action."
}{
"status": "error",
"code": "NOT_FOUND",
"message": "The requested resource was not found."
}{
"status": "error",
"code": "RATE_LIMITED",
"message": "Too many requests. Wait before trying again."
}{
"status": "error",
"code": "PROVIDER_UNAVAILABLE",
"message": "This service is temporarily unavailable. Please try again later."
}Required scope:
wallets:read
Returns ready or pending in data.status with HTTP 200. A missing request ID or one belonging to another business returns 404. Pending responses may include setupState. Continue polling the same request while processing; review_required needs Ledig review, so contact support@ledig.io with the requestId. Retain the requestId and do not create a replacement. Some pending responses may omit setupState. Checking the request does not create another address.