"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.name = name;
exports.symbol = symbol;
exports.uri = uri;
exports.balanceOf = balanceOf;
const interface_1 = require("./interface");
function name(args) {
    return __awaiter(this, void 0, void 0, function* () {
        const data = interface_1.erc1155Iface.encodeFunctionData("name");
        const result = yield args.web3Lib.call({
            to: args.contractAddress,
            data: data
        });
        const [name] = interface_1.erc1155Iface.decodeFunctionResult("name", result);
        return String(name);
    });
}
function symbol(args) {
    return __awaiter(this, void 0, void 0, function* () {
        const data = interface_1.erc1155Iface.encodeFunctionData("symbol");
        const result = yield args.web3Lib.call({
            to: args.contractAddress,
            data: data
        });
        const [symbol] = interface_1.erc1155Iface.decodeFunctionResult("symbol", result);
        return String(symbol);
    });
}
function uri(args) {
    return __awaiter(this, void 0, void 0, function* () {
        const data = interface_1.erc1155Iface.encodeFunctionData("uri", [args.tokenId]);
        const result = yield args.web3Lib.call({
            to: args.contractAddress,
            data: data
        });
        const [uri] = interface_1.erc1155Iface.decodeFunctionResult("uri", result);
        return String(uri);
    });
}
function balanceOf(args) {
    return __awaiter(this, void 0, void 0, function* () {
        const result = yield args.web3Lib.call({
            to: args.contractAddress,
            data: interface_1.erc1155Iface.encodeFunctionData("balanceOf", [
                args.owner,
                args.tokenId
            ])
        });
        const [balance] = interface_1.erc1155Iface.decodeFunctionResult("balanceOf", result);
        return String(balance);
    });
}
//# sourceMappingURL=handler.js.map