Fetch Wallets
This API endpoint allows you to fetch all wallets associated with your organization, with optional filtering and sorting capabilities.
HTTP Method
GET
/wallets
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tag | String | No | Filter wallets by a specific tag. Must be at least 3 characters. |
transactions | Boolean | No | Whether to include transactions associated with the wallet. |
tokens | Boolean | No | Whether to include tokens associated with the wallet. |
search | String | No | Search for wallets by address or tag. |
sort | Enum | No | The field to sort by. Options: createdAt, updatedAt. |
order | Enum | No | Sort order. Options: asc, desc. Defaults to asc. |
page | Integer | No | Page number for pagination. Defaults to 1. |
limit | Integer | No | Number of wallets to fetch per page. Defaults to 10. |
Request Sample
- Node.js (Fetch)
- Node.js (Axios)
const fetch = require("node-fetch");
const fetchWallets = async (query) => {
// Construct the query string
const queryString = new URLSearchParams(query).toString();
const response = await fetch(`https://api-staging.samudera.blox.my/v1/wallets?${queryString}`, {
method: "GET",
headers: {
"client_id": process.env.SAMUDERA_CLIENT_ID,
"client_secret": process.env.SAMUDERA_CLIENT_SECRET,
"Content-Type": "application/json",
},
});
if (!response.ok) {
const error = await response.json();
console.error("Error:", error);
return;
}
const result = await response.json();
return result;
};
// Example Usage
fetchWallets({
sort: "createdAt",
transactions: true,
tokens: true,
tag: "organization",
page: 1,
limit: 10,
order: "asc",
})
.then((data) => console.log("Wallets:", data))
.catch((error) => console.error("Error:", error));
const axios = require("axios");
const fetchWallets = async (query) => {
try {
const response = await axios.get(
`https://api-staging.samudera.blox.my/v1/wallets`,
{
headers: {
"client_id": process.env.SAMUDERA_CLIENT_ID,
"client_secret": process.env.SAMUDERA_CLIENT_SECRET,
"Content-Type": "application/json",
},
params: query,
}
);
console.log("Wallets:", response.data);
} catch (error) {
console.error("Error:", error.response.data);
}
};
// Example Usage
fetchWallets({
sort: "createdAt",
tag: "organization",
transactions: true,
tokens: true,
page: 1,
limit: 10,
order: "asc",
})
.then((data) => console.log("Wallets:", data))
.catch((error) => console.error("Error:", error));
Response
Success Response
Status Code:
200
| Field | Type | Description |
|---|---|---|
data | Array | List of wallets matching the query parameters. |
count | Integer | Total number of wallets matching the query. |
Example Response:
{
"data": [
{
"id": "clzvkpvql0001o2t5hpqg9a7y",
"tag": "organization",
"metadata": {},
"active": true,
"organizationId": "org_12345",
"address": "0x1234567890abcdef1234567890abcdef12345678",
"transactions": [
{
"id": "txn_01",
"amount": 1000,
"status": "completed",
"timestamp": "2024-12-10T12:00:00.000Z"
}
],
"tokens": [
{
"walletAddress": "0x1234567890abcdef1234567890abcdef12345678",
"chainId": "1",
"tokenAddress": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"balance": "500000000000000000",
"token": {
"name": "token1",
"displayName": "Token 1",
"symbol": "TK1",
"type": "ERC20",
"decimals": 18,
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"ownerAddress": "0x0000000000000000000000000000000000000000",
"active": true,
"public": false,
"maxSupply": "0",
"version": "1",
"logoUrl": "https://example.com/token1-logo.png",
"organizationId": "org_12345",
"chainId": "1",
"chain": {
"id": "1",
"chainId": "1",
"name": "Ethereum",
"testnet": true,
"confirmationsRequired": 12,
"active": true,
"logoUrl": "https://example.com/ethereum-logo.png"
},
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-12-10T12:00:00.000Z"
}
}
],
"createdAt": "2024-12-10T12:00:00.000Z"
},
{
"id": "clzvkpvql0001o2t5hpqg9a7z",
"tag": "personal",
"metadata": {},
"active": true,
"organizationId": "org_12345",
"address": "0xabcdef1234567890abcdef1234567890abcdef12",
"transactions": [
{
"id": "txn_01",
"amount": 1000,
"status": "completed",
"timestamp": "2024-12-10T12:00:00.000Z"
}
],
"tokens": [
{
"walletAddress": "0x1234567890abcdef1234567890abcdef12345678",
"chainId": "1",
"tokenAddress": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"balance": "500000000000000000",
"token": {
"name": "token1",
"displayName": "Token 1",
"symbol": "TK1",
"type": "ERC20",
"decimals": 18,
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"ownerAddress": "0x0000000000000000000000000000000000000000",
"active": true,
"public": false,
"maxSupply": "0",
"version": "1",
"logoUrl": "https://example.com/logo.png",
"organizationId": null,
"chainId": "1",
"chain": {
"id": "1",
"chainId": "1",
"name": "Ethereum",
"testnet": true,
"confirmationsRequired": 12,
"active": true,
"logoUrl": "https://example.com/token1-logo.png"
},
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-12-10T12:00:00.000Z"
}
}
],
"createdAt": "2024-12-09T10:00:00.000Z"
}
],
"count": 2
}