/get_wallets

Gets a paginated list of "wallets"/blockchain addresses attached to a user handle.

Requests

Both authsignature and usersignature headers are required for this request.

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.
  • blockchain_address looks up an exact match of a blockchain address registered to the user.
  • 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 response
  • wallet_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.

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
authsignature: [GENERATED AUTHSIGNATURE HEX STRING HERE]
usersignature: [GENERATED USERSIGNATURE HEX STRING HERE]
Content-Type: application/json

{
  "header": {
    "created": 1234567890, 
    "app_handle": "handle.silamoney.eth", 
    "user_handle":"user.silamoney.eth", 
    "version": "0.2", 
    "crypto": "ETH", 
    "reference": "<your unique id>"
  },
  "search_filters": {
    "page": 1,
    "per_page": 20,
    "sort_ascending": false,
    "blockchain_network": "ETH",
    "blockchain_address": "",
    "nickname": "",
    "wallet_id": "37d7d51f-2f3a-4f16-9003-41366218a74c"
  }
}

***

HTTP/1.1 200 OK

{
  "success": true,
  "status": "SUCCESS",
  "response_time_ms": "171",  
  "reference": "<your unique id>",
  "wallets": [
    {
      "wallet_id": "d6f312b6-fa41-4992-9fd6-70eadadad1af",
      "blockchain_address": "",
      "blockchain_network": "ETH",
      "default": false,
      "frozen": false,
      "nickname": "",
      "migrated_at": "<datetime in UTC>"
    },
    {
      "wallet_id": "e8ea2d24-02d8-43e3-a216-6ac1d36f2016",
      "blockchain_address": null, 
      "blockchain_network": null, 
      "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].nickname);
payload = {
    "user_handle": "user.silamoney.eth",
    "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": ""
    },
    "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);
$userHandle = 'user.silamoney.eth';
$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
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.
blockchain_network

String

Optional. Example: ETH

search_filters.
blockchain_address

String

Optional. Hex-encoded blockchain address (prefixed with "0x")
Must be globally unique, Min length 42, Max length 42
This value should be match the required address regex pattern: ^0x[a-fA-F0-9] {40}$
Example: 0x1234567890abcdef1234567890abcdef12345678

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.

  

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.


Did this page help you?