/delete_wallet

Deletes a user wallet.

This endpoint allows deletion of a user's wallet. This action cannot be performed on a user's only wallet, a user's default destination wallet, or an a wallet with a non-zero balance.

When using legacy ECDSA authentication
The wallet/address to be deleted is the one derived from the usersignature header.

When using Authentication Tokens
The wallet to be deleted is specified by wallet_id.

Requests

When using legacy ECDSA authentication
Both authsignature and usersignature headers are required for this request. The usersignature header should be generated with the user's wallet to be deleted.

See the section on ECDSA Authentication for more detail about ECDSA signature generation.

When using Authentication Tokens
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).

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/delete_wallet HTTP/1.1
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": "handle.silamoney.eth", 
    "user_handle":"user.silamoney.eth", 
    "version": "0.2", 
    "crypto": "ETH", 
    "reference": "<your unique id>"
  }
}

// Authentication Tokens
{
  "header": {
    "created": 1234567890, 
    "app_handle": "handle.silamoney.eth", 
    "user_handle":"user.silamoney.eth", 
    "version": "0.2", 
    "crypto": "ETH", 
    "reference": "<your unique id>"
  },
  "wallet_id": "a4f1fafe-73f0-449c-ab74-1d4cf119ff16"
}
***

HTTP/1.1 200 OK

// ECDSA
{
  "message": "Address [address] deleted; can no longer be used to sign user requests through the API.",
  "success": true,
  "status": "SUCCESS",
  "response_time_ms": "171",
  "reference": "<your unique id>"
}

// Authentication Tokens
{
  "message": "Wallet a4f1fafe-73f0-449c-ab74-1d4cf119ff16 deleted.",
  "success": true,
  "status": "SUCCESS",
  "response_time_ms": "87",
  "reference": "<your unique id>"
}
const res = await Sila.deleteWallet(userHandle, walletPrivateKey);

// Success Response Object
console.log(res.statusCode); // 200
console.log(res.data.reference); // Random reference number
console.log(res.data.status);
console.log(res.data.success); // TRUE
console.log(res.data.message); // Wallet deleted
payload = {
    "user_handle": "user.silamoney.eth"
}

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

### Success Response Object
{
  "status": 'SUCCESS',
  "status_code": 200,
  "message": "Address [address] deleted; can no longer be used to sign user requests through the API.",
  "success": True,
  "reference": "ref"
}

### Failure Response Object
{
  "message": "Error message",
  "success": False,
  "reference": "ref"
}
ApiResponse response = api.deleteWallet(userHandle, userPrivateKey);
BaseResponse parsedResponse = (BaseResponse) 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.getMessage()); 
System.out.println(parsedResponse.getReference());
$userHandle = 'user.silamoney.eth';
$userPrivateKey = 'some private key'; // Hex format

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

// Success 200
echo $response->getStatusCode(); // 200
echo $response->getData()->status;
echo $response->getData()->success; // TRUE
echo $response->getData()->message; // Message
echo $response->getData()->reference; // your unique reference id
ApiResponse<object> response = api.DeleteWallet(userHandle, walletPrivateKey);

// Success Object Response

Console.WriteLine(response.StatusCode); // 200
var parsedData = (UpdateWalletResponse)response.Data;
Console.WriteLine(parsedData.Success); // TRUE
Console.WriteLine(parsedData.Message); // Message
Console.WriteLine(parsedData.Reference); // your unique reference id
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.
wallet_idstringRequired for AuthToken apps. ID of wallet to delete.

Responses

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

Status Codesuccess AttributeDescription
200trueSuccessfully deleted wallet.
400falseBad request format.
400false[AuthTokens] - Multiple wallets match supplied identifier (nickname). Suggest using wallet_id to uniquely identify the wallet to be deleted.
401falseAuth signature is absent or derived address does not belong to app_handle.
403falseWallet cannot be deleted (see response message for details).