@ledgerhq/coin-tezos
Version:
16 lines • 645 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBalance = getBalance;
const tzkt_1 = __importDefault(require("../network/tzkt"));
/**
* Retunrs the balance of the given address.
* If the address is an empty account, returns -1.
*/
async function getBalance(address) {
const apiAccount = await tzkt_1.default.getAccountByAddress(address);
return apiAccount.type === "user" ? BigInt(apiAccount.balance) : BigInt(-1);
}
//# sourceMappingURL=getBalance.js.map