Comparing version 0.1.7 to 0.1.8
@@ -62,3 +62,3 @@ "use strict"; | ||
const contractStorage = yield contract.storage(); | ||
const ledger = yield contractStorage.ledger; | ||
let ledger = yield contractStorage.ledger; | ||
if (ledger === undefined) { | ||
@@ -154,2 +154,23 @@ return new bignumber_js_1.BigNumber(0); | ||
} | ||
getBalance(address) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const contract = yield this.tezos.contract.at(this.contractAddress); | ||
const contractStorage = yield contract.storage(); | ||
let ledger = yield contractStorage.balances; | ||
if (ledger === undefined) { | ||
return new bignumber_js_1.BigNumber(0); | ||
} | ||
const bigMapKey = yield ledger.get(address); | ||
if (bigMapKey === undefined) { | ||
return new bignumber_js_1.BigNumber(0); | ||
} | ||
return bigMapKey.balance; | ||
} | ||
catch (err) { | ||
console.log(err); | ||
throw err; | ||
} | ||
}); | ||
} | ||
} | ||
@@ -156,0 +177,0 @@ exports.KUSD = KUSD; |
{ | ||
"name": "dexterlib", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Tezos Dexter Utility Library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
31722
630
0