Purge wallet
Erase wallet's public and private keys.
This command deletes all wallet data, including public and private key.
This operation is irreversible.
This command can be disabled if wallet was created during card personalization with special config flag, that protect wallets from purging.

Request

walletPublicKey <Data> The wallet's public key.
cardId <String> CID, Unique Tangem card ID number.
initialMessage <Message> [optional] This message will be shown in the NFC session dialog. Default: "Tap the card to your phone exactly as it shown above".

Response

This command will return the SuccessResponse object in response.

Example

Swift
Kotlin
Java
JS (React Native)
JS (Cordova)
Dart
JSON-RPC
1
let walletPublicKey = card.wallets[0].publicKey //Will purge the first wallet
2
let cardId = card.cardId
3
4
tangemSdk.purgeWallet(walletPublicKey: walletPublicKey, cardId: cardId) { result in
5
switch result {
6
case .success:
7
print("The wallet deleted")
8
case .failure(let error):
9
print(error)
10
}
11
}
Copied!
1
val walletPublicKey = card.wallets.first().publicKey //Will purge the first wallet
2
val cardId = card.cardId
3
4
tangemSdk.purgeWallet(
5
walletPublicKey = walletPublicKey,
6
cardId = cardId
7
) { result ->
8
when (result) {
9
is CompletionResult.Success -> {
10
runOnUiThread {
11
Log.d(TAG, "Wallet #1 has been successfully deleted")
12
}
13
}
14
is CompletionResult.Failure -> {
15
runOnUiThread {
16
Log.d(TAG, result.error)
17
}
18
}
19
}
20
}
Copied!
1
byte[] walletPublicKey = card.getWallets().get(0).getPublicKey();
2
String cardId = card.getCardId();
3
4
tangemSdk.purgeWallet(walletPublicKey, cardId, null, result -> {
5
if (result instanceof CompletionResult.Success) {
6
SuccessResponse response = ((CompletionResult.Success<SuccessResponse>) result).getData();
7
Log.d(TAG, "Wallet #1 was successfully deleted");
8
} else if (result instanceof CompletionResult.Failure) {
9
TangemError error = ((CompletionResult.Failure<SuccessResponse>) result).getError();
10
Log.d(TAG, error.getCustomMessage());
11
}
12
return Unit.INSTANCE;
13
});
Copied!
1
const walletPublicKey = card.wallets[0].publicKey;
2
const cardId = card.id;
3
4
TangemSdk.purgeWallet(walletPublicKey, cardId)
5
.then((result) => console.log(result))
6
.catch((err) => console.log(err));
Copied!
1
var walletPublicKey = card.wallets[0].publicKey;
2
var cardId = card.cardId;
3
var initialMessage = {"body": "body", "header": "header"};
4
var callback = function (response, error) {
5
if (error) {
6
alert({ "error": error });
7
} else {
8
alert({"response": response});
9
}
10
};
11
TangemSdk.purgeWallet(walletPublicKey, cardId, initialMessage, callback);
Copied!
1
Copied!
1
// Request
2
{
3
"jsonrpc":"2.0",
4
"id":1,
5
"method":"purge_wallet",
6
"params":{
7
"walletPublicKey":"5130869115a2ff91959774c99d4dc2873f0c41af3e0bb23d027ab16d39de1348"
8
}
9
}
10
11
// Response
12
{
13
"jsonrpc":"2.0",
14
"result":{
15
"cardId":"c000111122223333"
16
},
17
"id":1
18
}
Copied!
Copy link