/get_wallets
Gets a paginated list of wallets attached to a user handle.
Requests
The search_filters
object is not required in the request. Just sending a header object in the request will result in a response that returns the 20 most-recently registered wallets for the user_handle.
- Setting
sort_ascending
to true returns wallets in the order they were registered to the user. per_page
sets the number of wallets returned in a response; the upper limit is 100, after which the page size defaults to 20. Leaving this key out of the response also defaults the page size to 20.nickname
, if specified, looks up a case-insensitive partial match on wallet nicknames. For example, if a user has wallets with nicknames like "captaincrunch" and "SeaCaptain" and /get_wallets queries for "nickname": "captain", both of those wallets should be returned in the responsewallet_id
Looks up an exact match of a wallet registered to the user.
The page
and per_page
keys can instead be specified in query parameters (e.g. by appending ?page=2&per_page=2
or ?per_page=100
to the end of the URL). If these keys are already specified in the request body, the request body keys take precedence. This allows a requester to fetch several pages using the same signatures, if desired.
Authorization / Authentication
Apps using Access Token Authorization
Use a valid access token in an Authorization: Bearer request header.
See Authenticating with an Access Token for more details.
Apps using ECDSA Authentication
Both authsignature
and usersignature
headers are required for this request. The usersignature header should be generated with a keypair registered to the user (either registered from the /register endpoint or the /register_wallet endpoint).
See the section on ECDSA Authentication for more detail about ECDSA signature generation.
Note - We recently renamed the field auth_handle
to app_handle
. For backward compatibility, auth_handle
is still valid but has been removed from our documentation.
POST /0.2/get_wallets HTTP/1.1
Host: sandbox.silamoney.com
Content-Type: application/json
// if using OAuth2
Authorization: Bearer [GENERATED JWT TOKEN HERE]
// if using ECDSA
authsignature: [GENERATED AUTHSIGNATURE HEX STRING HERE]
usersignature: [GENERATED USERSIGNATURE HEX STRING HERE]
//ECDSA
{
"header": {
"created": 1234567890,
"app_handle": "app_handle",
"user_handle":"user_handle",
"version": "0.2",
"reference": "<your unique id>"
},
"search_filters": {
"page": 1,
"per_page": 20,
"sort_ascending": false,
"nickname": "",
"wallet_id": "37d7d51f-2f3a-4f16-9003-41366218a74c",
"wallet_address": "wallet_address", // legacy, backwards compatibility only
"network": "network" // legacy, backwards compatibility only
}
}
//Authentication Tokens
{
"header": {
"created": 1234567890,
"app_handle": "app_handle",
"user_handle":"user_handle",
"version": "0.2",
"reference": "<your unique id>"
},
"search_filters": {
"page": 1,
"per_page": 20,
"sort_ascending": false,
"nickname": "",
"wallet_id": "37d7d51f-2f3a-4f16-9003-41366218a74c"
}
}
***
HTTP/1.1 200 OK
//ECDSA
{
"success": true,
"status": "SUCCESS",
"response_time_ms": "171",
"reference": "<your unique id>",
"sila_reference_id": "sila_assigned_id",
"wallets": [
{
"wallet_id": "d6f312b6-fa41-4992-9fd6-70eadadad1af",
"default": false,
"frozen": false,
"nickname": "",
"migrated_at": "<datetime in UTC>"
},
{
"wallet_id": "e8ea2d24-02d8-43e3-a216-6ac1d36f2016",
"nickname": "",
"frozen": False,
"default": False,
"wallet_address": "wallet_address", // legacy, backwards compatibility only
"network": "network" // legacy, backwards compatibility only
}
],
"page": 1,
"returned_count": 1,
"total_count": 1,
"total_page_count": 1
}
//Authentication Tokens
{
"success": true,
"status": "SUCCESS",
"response_time_ms": "171",
"reference": "<your unique id>",
"sila_reference_id": "sila_assigned_id",
"wallets": [
{
"wallet_id": "d6f312b6-fa41-4992-9fd6-70eadadad1af",
"default": false,
"frozen": false,
"nickname": "",
"migrated_at": "<datetime in UTC>"
},
{
"wallet_id": "e8ea2d24-02d8-43e3-a216-6ac1d36f2016",
"nickname": "",
"frozen": False,
"default": False
}
],
"page": 1,
"returned_count": 1,
"total_count": 1,
"total_page_count": 1
}
const res = await Sila.getWallets(userHandle, walletPrivateKey, filters);
// Success Response Object
console.log(res.statusCode); // 200
console.log(res.data.status);
console.log(res.data.success); // TRUE
console.log(res.data.page); // The # of page
console.log(res.data.total_page_count); // Total # of pages
console.log(res.data.returned_count); // # of wallets returned
console.log(res.data.total_count); // Total # of wallets
console.log(res.data.wallets); // Wallets array
console.log(res.data.wallets); // Wallets array
console.log(res.data.wallets[0].blockchain_address);
console.log(res.data.wallets[0].blockchain_network);
console.log(res.data.wallets[0].default);
console.log(res.data.wallets[0].frozen);
console.log(res.data.wallets[0].statements_enabled);
console.log(res.data.wallets[0].nickname);
payload = {
"user_handle": "user_handle",
"search_filters": {
"page": 1,
"per_page": 20,
"sort_ascending": False,
"blockchain_network": "ETH",
"blockchain_address": '0x123...890',
"nickname": "wallet_python",
"wallet_id": "43a1d70c-08a0-4d27-910a-818d63babee4"
}
}
response = Wallet.getWallets(app, payload, user_private_key)
### Success Response Object
{
"status": 'SUCCESS',
"status_code": 200,
"success": True,
"wallets": [
{
"blockchain_address": "",
"blockchain_network": "ETH",
"default": false,
"frozen": false,
"nickname": "",
"statements_enabled": True
},
"page": 1,
"returned_count": 1,
"total_count": 1,
"total_page_count": 1
]
}
### Failure Response Object
{
"success": True,
"wallets": []
}
SearchFilters filters = new SearchFilters();
filters.setPage(1);
filters.setPerPage(20);
filters.sortAscending(); // For true condition or ignore line for false
filters.setBlockChainNetwork("ETH");
filters.setBlockChainAddress("");
filters.setNickname("Some nickname");
filters.setUuid("37d7d51f-2f3a-4f16-9003-41366218a74c"); // Optional
ApiResponse response = api.getWallets(userHandle, filters, userPrivateKey);
GetWalletsResponse parsedResponse = (GetWalletsResponse) response.getData();
// Success Response Object
System.out.println(response.getStatusCode()); // 200
System.out.println(parsedResponse.isSuccess());
System.out.println(parsedResponse.getWallets()); // Wallet list
System.out.println(parsedResponse.page); // Actual page requested
System.out.println(parsedResponse.returnedCount); // Total wallets returned
System.out.println(parsedResponse.totalCount); // Total wallets exists
System.out.println(parsedResponse.totalPageCount);
System.out.println(parsedResponse.getWallets().get(0).isStatementsEnabled()); // Boolean
$userHandle = 'user_handle';
$userPrivateKey = 'some private key'; // Hex format
$filters = new SearchFilters();
// Call the api
$response = $client->getWallets($userHandle, $userPrivateKey, $filters);
// Success 200
echo $response->getStatusCode(); // 200
echo $response->getData()->status;
echo $response->getData()->success; // TRUE
echo $response->getData()->wallets; // The list of wallets
echo $response->getData()->page; // The current page of results
echo $response->getData()->returned_count; // The amount of wallets returned
echo $response->getData()->total_count; // The total amount of wallets
echo $response->getData()->total_page_count; // The total amount of pages
echo $response->getData()->wallets[0]->statements_enabled;
var searchFilters = new WalletSearchFilters(blockchainAddress, blockChainNetwork, nickname, pageNumber, resultsPerPage, sortAscending, uuId); // The only BlockChain Network currently supported is ETH.
ApiResponse<object> response = api.GetWallets(userHandle, walletPrivateKey, searchFilters); // Search Filters are not required.
// Success Object Response
Console.WriteLine(response.StatusCode); // 200
var parsedData = (GetWalletsResponse)response.Data;
Console.WriteLine(parsedData.Success); // TRUE
Console.WriteLine(parsedData.Page); // Page number
Console.WriteLine(parsedData.ReturnedCount); // # of wallets retrieve in page
Console.WriteLine(parsedData.TotalCount); // Total # of wallets available
Console.WriteLine(parsedData.TotalPageCount); // Total # of pages available
Console.WriteLine(parsedData.Wallets); // List of wallets
Console.WriteLine(parsedData.Wallets[0].WalletId); // wallet_id: "37d7d51f-2f3a-4f16-9003-41366218a74c"
Key | Type | Description |
---|---|---|
header | JSON object | Required. Requires these keys in JSON format: created, app_handle, user_handle. See the /check_handle endpoint for the complete list of fields in this object. |
search_filters | JSON object | Optional. Allows filtering of results. |
search_filters.page | Integer | Optional. Min 1, Default 1 |
search_filters. per_page | Integer | Optional. Min 1, Max 100, Default 20 |
search_filters. sort_ascending | Boolean | Optional. Default false |
search_filters. nickname | String | Optional. Case-insensitive. Max Length 40 |
search_filters.uuid | String | Optional. The UUID is wallet_id. Must be a UUID in the canonical form: five groups separated by hyphens, in the form 8-4-4-4-12. |
search_filters.wallet_address | String | Optional. Backwards compatibility only. Disregard if not already utilizing. |
search_filters.network | String | Optional. Backwards compatibility only. Disregard if not already utilizing. |
Responses
The success
attribute is a JSON key sent in the response body.
Status Code | success Attribute | Description |
---|---|---|
200 | true | Successfully added new wallet. |
400 | false | Bad request format or wallet already registered to someone. |
403 | false | Auth signature is absent or derived address does not belong to app_handle. |
Updated 7 days ago