diff --git a/commands/create-account.js b/commands/create-account.js index a05bd441..36afa731 100644 --- a/commands/create-account.js +++ b/commands/create-account.js @@ -3,6 +3,7 @@ const exitOnError = require('../utils/exit-on-error'); const connect = require('../utils/connect'); const { KeyPair } = require('near-api-js'); const eventtracking = require('../utils/eventtracking'); +const inspectResponse = require('../utils/inspect-response'); // Top-level account (TLA) is testnet for foo.alice.testnet const TLA_MIN_LENGTH = 32; @@ -127,8 +128,10 @@ async function createAccount(options) { } // Create account try { - await near.createAccount(options.accountId, publicKey); + const response = await near.createAccount(options.accountId, publicKey); + inspectResponse.prettyPrintResponse(response, options); console.log(`Account ${options.accountId} for network "${options.networkId}" was created.`); + } catch(error) { if (error.type === 'RetriesExceeded') { console.warn('Received a timeout when creating account, please run:'); diff --git a/index.js b/index.js index 3b3c11ae..90652ef5 100644 --- a/index.js +++ b/index.js @@ -185,7 +185,8 @@ exports.deleteAccount = async function (options) { `Deleting account. Account id: ${options.accountId}, node: ${options.nodeUrl}, helper: ${options.helperUrl}, beneficiary: ${options.beneficiaryId}`); const near = await connect(options); const account = await near.account(options.accountId); - await account.deleteAccount(options.beneficiaryId); + const result = await account.deleteAccount(options.beneficiaryId); + inspectResponse.prettyPrintResponse(result, options); console.log(`Account ${options.accountId} for network "${options.networkId}" was deleted.`); }; diff --git a/utils/inspect-response.js b/utils/inspect-response.js index 4c95db92..b8e4a841 100644 --- a/utils/inspect-response.js +++ b/utils/inspect-response.js @@ -6,8 +6,10 @@ const prettyPrintResponse = (response, options) => { console.log(formatResponse(response)); } const txnId = getTxnId(response); - console.log(`Transaction Id ${txnId}`); - explorer.printTransactionUrl(txnId, options); + if (txnId) { + console.log(`Transaction Id ${txnId}`); + explorer.printTransactionUrl(txnId, options); + } }; const prettyPrintError = (error, options) => {