Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
fixed message on near delete
Browse files Browse the repository at this point in the history
  • Loading branch information
gagdiez authored Feb 11, 2024
2 parents f4dcb74 + 0f9e514 commit 457f560
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions commands/account/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ module.exports = {
handler: deleteAccount
};

const confirmDelete = function () {
const confirmDelete = function (accountId, beneficiaryId) {
return askYesNoQuestion(
chalk`This will {bold.white delete your account}. The beneficiary account must {bold.white already exists}. This deleting action will {bold.red NOT} transfer {bold.white FTs, NFTs} or other assets the account holds. You need to {bold.white manually transfer all assets} prior to deleting the account since this action will {bold.white only transfer the available NEAR tokens}. Do you want to proceed? {bold.green (y/n)} `,
chalk`This will {bold.red delete ${accountId}}, transferring {bold.white the remaining NEAR tokens} to the {bold.green beneficiary ${beneficiaryId}}. This action will {bold.red NOT transfer} {bold.white FTs, NFTs} or other assets the account holds, make sure you to {bold.white manually transfer} them before deleting or they will be {bold.red lost}. Do you want to proceed? {bold.green (y/n)}`,
false);
};

Expand All @@ -39,14 +39,14 @@ async function deleteAccount(options) {
} catch (e) {
// beneficiary account does not exist if there is no state
if (e.type === 'AccountDoesNotExist') {
console.error(`Beneficiary account ${options.beneficiaryId} does not exist. Please create the account to transfer Near tokens.`);
console.error(`Beneficiary account ${options.beneficiaryId} does not exist. Please create it before proceeding.`);
return;
} else {
throw e;
}
}

if (options.force || await confirmDelete()) {
if (options.force || await confirmDelete(options.accountId, options.beneficiaryId)) {
const account = await near.account(options.accountId);
console.log(`Deleting account ${options.accountId}, beneficiary: ${options.beneficiaryId}`);
const result = await account.deleteAccount(options.beneficiaryId);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "near-cli",
"version": "4.0.1",
"version": "4.0.2",
"description": "Simple CLI for interacting with NEAR Protocol",
"engines": {
"node": ">= 16"
Expand Down

0 comments on commit 457f560

Please sign in to comment.