/get_wallet

Gets details about the user wallet used to generate the usersignature header.

This endpoint returns details about a wallet registered to a user, including:

  • Wallet ID
  • blockchain address
  • blockchain network code
  • nickname
  • whether it is a default destination
  • whether it is whitelisted
  • current token balance
  • current token pending balance

🚧

sila_available_balance replaces sila_balance

We recently renamed the field sila_balance to sila_available_balance. For backward compatibility, sila_balance is still returned but has been removed from our documentation.

📘

sila_available_balance and sila_pending_balanceis Detail

sila_available_balance is the current balance in the wallet. sila_pending_balance is the current balance in the wallet minus any pending transfers or redeems.

The wallet/address to be examined is the one derived from the usersignature header.

  

Requests

Both authsignature and usersignature headers are required for this request. The usersignature header should be generated with a keypair associated with the user; see Authentication section for more details.

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_wallet 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>"
  }
}

***

HTTP/1.1 200 OK

{
    "success": true,
    "status": "SUCCESS",
    "response_time_ms": "171",  
    "reference": "ref",
    "wallet": {
        "wallet_id": "37d7d51f-2f3a-4f16-9003-41366218a74c"
        "nickname": "my_wallet_nickname",
        "default": false,
        "blockchain_address": "0x...",
        "blockchain_network": "ETH"
    },
    "is_whitelisted": true,
    "sila_available_balance": 300,
    "sila_pending_balance": 0,
}
const res = await Sila.getWallet(userHandle, walletPrivateKey);

// Success Response Object
console.log(res.statusCode); // 200
console.log(res.data.reference);
console.log(res.data.success); // TRUE
console.log(res.data.status);
console.log(res.data.is_whitelisted); // Indicates if the wallet is able to perform transactions
console.log(res.data.sila_available_balance); // new field for sila_balance
console.log(res.data.sila_pending_balance); // new field for sila_balance
console.log(res.data.wallet);
console.log(res.data.wallet.nickname);
console.log(res.data.wallet.default);
console.log(res.data.wallet.blockchain_address);
console.log(res.data.wallet.blockchain_network);
payload = {
    "user_handle": "user.silamoney.eth"
}

response = Wallet.getWallet(app, payload, user_private_key)

### Success Response Object
{
    "status": 'SUCCESS',
    "status_code": 200,
    "success": True,
    "reference": "ref",
    "wallet": {
        "nickname": "my_wallet_nickname",
        "default": False,
        "blockchain_address": "0x...",
        "blockchain_network": "ETH"
    },
    "is_whitelisted": True,
    "sila_balance": 300.0,
    "sila_available_balance": 300,
    "sila_pending_balance": 0
}

### Failure Response Object
{
    "success": False,
    "reference": "ref",
    "message": "Error message"
}
ApiResponse response = api.getWallet(userHandle, userPrivateKey);
GetWalletResponse parsedResponse = (GetWalletResponse) response.getData();

// Success Response Object
System.out.println(response.getStatusCode()); // 200        
System.out.println(parsedResponse.getSuccess());        
System.out.println(parsedResponse.getStatus());     
System.out.println(parsedResponse.getReference());      
System.out.println(parsedResponse.getWallet()); // Wallet object        
System.out.println(parsedResponse.getWallet().getBlockChainAddress());      
System.out.println(parsedResponse.getWallet().getBlockChainNetwork());      
System.out.println(parsedResponse.getWallet().getWalletId());       
System.out.println(parsedResponse.getWallet().getPrivateKey());     
System.out.println(parsedResponse.getWallet().getNickname());       
System.out.println(parsedResponse.getWallet().isDefaultWallet());       
System.out.println(parsedResponse.getWallet().isFrozen());      
System.out.println(parsedResponse.getWallet().getWalletId());       
System.out.println(parsedResponse.isWhitelisted()); // Boolean      
System.out.println(parsedResponse.getSilaBalance()); // Sila balance
System.out.println(parsedResponse.getSilaAvailableBalance()); // Sila available balance
System.out.println(parsedResponse.getSilaPendingBalance()); // Sila pending balance
$userHandle = 'user.silamoney.eth';
$userPrivateKey = 'some private key'; // Hex format

// Call the api
$response = $client->getWallet($userHandle, $userPrivateKey);

// Success 200
echo $response->getStatusCode(); // 200
echo $response->getData()->status;
echo $response->getData()->success; // TRUE
echo $response->getData()->reference; // Random reference number
echo $response->getData()->wallet; // The wallet requested
echo $response->getData()->is_whitelisted; // Indicates if the wallet is whitelisted
echo $response->getData()->sila_balance; // The current sila balance of the wallet.
echo $response->getData()->sila_balance; // The current sila balance of the wallet.
echo $response->getData()->sila_available_balance;
echo $response->getData()->sila_pending_balance;
ApiResponse<object> response = api.GetWallet(userHandle, walletPrivateKey);

// Success Object Response

Console.WriteLine(response.StatusCode); // 200
var parsedData = (SingleWalletResponse)response.Data;
Console.WriteLine(parsedData.Success); // TRUE
Console.WriteLine(parsedData.Reference); // Reference
Console.WriteLine(parsedData.IsWhitelisted); // Is Whitelisted?
Console.WriteLine(parsedData.SilaBalance); // # of Sila tokens
Console.WriteLine(parsedData.Wallet); // Wallet details (nickname, default...)
Console.WriteLine(parsedData.Wallet.WalletId); // wallet_id "37d7d51f-2f3a-4f16-9003-41366218a74c"
Console.WriteLine(parsedData.SilaAvailableBalance); // 300
Console.WriteLine(parsedData.SilaPendingBalance); // 0
KeyTypeDescription
headerJSON objectRequired. 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.
  

Responses

The success attribute is a JSON key sent in the response body.

Status Codesuccess AttributeDescription
200trueSuccessfully fetched and returned wallet.
400falseBad request format.
403falseAuth signature is absent or derived address does not belong to app_handle.
500falseTemporarily unable to check contract for whitelisting and balance details (see response message for details).