From a79c63380ef0cbd0a7bf671755cfe237b4e9548a Mon Sep 17 00:00:00 2001 From: Ilyar Date: Thu, 15 Apr 2021 18:27:02 +0300 Subject: [PATCH] Check if recipient account exists --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index b8dacd29..fa7af918 100644 --- a/index.js +++ b/index.js @@ -118,7 +118,7 @@ exports.login = async function (options) { // Browser not opened, as will open automatically for opened port } else { newUrl.searchParams.set('success_url', `http://${tempUrl.hostname}:${tempUrl.port}`); - openUrl(newUrl); + openUrl(newUrl); } } else if (isWin) { // redirect automatically on windows, but do not use the browser callback @@ -211,6 +211,8 @@ exports.sendMoney = async function (options) { console.log(`Sending ${options.amount} NEAR to ${options.receiver} from ${options.sender}`); const near = await connect(options); const account = await near.account(options.sender); + const receiver = await near.account(options.receiver); + await receiver.state(); const result = await account.sendMoney(options.receiver, utils.format.parseNearAmount(options.amount)); inspectResponse.prettyPrintResponse(result, options); };