@volare.finance/utils.js
Version:
The Blockchain Utils
35 lines • 1.24 kB
JavaScript
;
/**
* @file erc1155Tradable.ts
* @author astra <astra@volare.finance>
* @date 2022
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ERC1155Tradable = void 0;
const tslib_1 = require("tslib");
const ethers_1 = require("ethers");
const ERC1155Tradable_json_1 = require("../artifacts/opensea/ERC1155Tradable.json");
const token_1 = require("../token");
const type_1 = require("../type");
class ERC1155Tradable extends token_1.ERC1155 {
constructor(contract, endpoint) {
super(contract, endpoint);
this.contract = new ethers_1.Contract(contract, ERC1155Tradable.ABI(), this.provider);
}
static ABI() {
return ERC1155Tradable_json_1.abi;
}
/**
* @dev Returns the total quantity for a token ID
* @param id uint256 ID of the token to query
* @return amount of token in existence
*/
totalSupply(id) {
var _a;
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return new type_1.BigNumber((yield ((_a = this.contract) === null || _a === void 0 ? void 0 : _a.totalSupply(id))).toString());
});
}
}
exports.ERC1155Tradable = ERC1155Tradable;
//# sourceMappingURL=erc1155Tradable.js.map