UNPKG

@fractional-company/common

Version:
217 lines (216 loc) 8.43 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMintableAddress = exports.getNftABI = exports.getMintableABI = exports.NFT_ABI = exports.MINT_CONTRACT_ABI = exports.MINT_FACTORY_ABI = exports.MINT_FACTORY_CONTRACTS = exports.FACTORY_TYPES = exports.MINT_TYPES = void 0; // ======================= // Test NFTs // ======================= const chains_1 = require("./chains"); const mintableERC721_json_1 = __importDefault(require("./abis/mintableERC721.json")); const mintableERC1155_json_1 = __importDefault(require("./abis/mintableERC1155.json")); const erc721_json_1 = __importDefault(require("./abis/erc721.json")); const erc1155_json_1 = __importDefault(require("./abis/erc1155.json")); exports.MINT_TYPES = { ERC721: 0, ERC1155: 1, ERC721RevertApprove: 2, ERC20: 3, }; exports.FACTORY_TYPES = { SOLMATE: 0, OPEN_ZEPPELIN: 1, }; exports.MINT_FACTORY_CONTRACTS = { [chains_1.CHAINS.GÖRLI]: { [exports.MINT_TYPES.ERC20]: { [exports.FACTORY_TYPES.OPEN_ZEPPELIN]: "0x2f949f7cD46F4D79d4FD6b234DB302cAeEe552e2", [exports.FACTORY_TYPES.SOLMATE]: "0x1C9F82bcf150331B4E97A5Bd034a6d7F1b607ce6", }, [exports.MINT_TYPES.ERC721]: { [exports.FACTORY_TYPES.OPEN_ZEPPELIN]: "0xcA9486e54FbBD6aCe6eB6AA0102ee97dd90A8a86", [exports.FACTORY_TYPES.SOLMATE]: "0xE657164Ed47BD1Bdb9025cfB60Ed1CfB8E89fd63", }, [exports.MINT_TYPES.ERC1155]: { [exports.FACTORY_TYPES.OPEN_ZEPPELIN]: "0x954440A0826c764312e58d52d5c396274079bfA4", [exports.FACTORY_TYPES.SOLMATE]: "0x048F9F292d6666AADf4DC8fa9dbd9a7Fb3339d04", }, }, }; exports.MINT_FACTORY_ABI = { [chains_1.CHAINS.GÖRLI]: { [exports.MINT_TYPES.ERC20]: { [exports.FACTORY_TYPES.OPEN_ZEPPELIN]: [ { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "_token", type: "address", }, ], name: "Deployed", type: "event", }, { inputs: [ { internalType: "string", name: "name", type: "string" }, { internalType: "string", name: "symbol", type: "string" }, ], name: "deploy", outputs: [{ internalType: "address", name: "token", type: "address" }], stateMutability: "nonpayable", type: "function", }, ], [exports.FACTORY_TYPES.SOLMATE]: [ { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "_token", type: "address", }, ], name: "Deployed", type: "event", }, { inputs: [ { internalType: "string", name: "name", type: "string" }, { internalType: "string", name: "symbol", type: "string" }, ], name: "deploy", outputs: [{ internalType: "address", name: "token", type: "address" }], stateMutability: "nonpayable", type: "function", }, ], }, [exports.MINT_TYPES.ERC721]: { [exports.FACTORY_TYPES.OPEN_ZEPPELIN]: [ { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "_token", type: "address", }, ], name: "Deployed", type: "event", }, { inputs: [], name: "deploy", outputs: [{ internalType: "address", name: "token", type: "address" }], stateMutability: "nonpayable", type: "function", }, ], [exports.FACTORY_TYPES.SOLMATE]: [ { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "_token", type: "address", }, ], name: "Deployed", type: "event", }, { inputs: [], name: "deploy", outputs: [{ internalType: "address", name: "token", type: "address" }], stateMutability: "nonpayable", type: "function", }, ], }, [exports.MINT_TYPES.ERC1155]: { [exports.FACTORY_TYPES.OPEN_ZEPPELIN]: [ { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "_token", type: "address", }, ], name: "Deployed", type: "event", }, { inputs: [], name: "deploy", outputs: [{ internalType: "address", name: "token", type: "address" }], stateMutability: "nonpayable", type: "function", }, ], [exports.FACTORY_TYPES.SOLMATE]: [ { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "_token", type: "address", }, ], name: "Deployed", type: "event", }, { inputs: [], name: "deploy", outputs: [{ internalType: "address", name: "token", type: "address" }], stateMutability: "nonpayable", type: "function", }, ], }, }, }; exports.MINT_CONTRACT_ABI = { [chains_1.CHAINS.GÖRLI]: { [exports.MINT_TYPES.ERC721]: mintableERC721_json_1.default, [exports.MINT_TYPES.ERC1155]: mintableERC1155_json_1.default, }, }; exports.NFT_ABI = { [chains_1.CHAINS.GÖRLI]: { [exports.MINT_TYPES.ERC721]: erc721_json_1.default, [exports.MINT_TYPES.ERC1155]: erc1155_json_1.default, }, }; function getMintableABI(mintType, chainId = null) { return exports.MINT_CONTRACT_ABI[chainId || chains_1.CHAINS.GÖRLI][mintType]; } exports.getMintableABI = getMintableABI; function getNftABI(mintType, chainId = null) { return exports.NFT_ABI[chainId || chains_1.CHAINS.GÖRLI][mintType]; } exports.getNftABI = getNftABI; function getMintableAddress(mintType, chainId = null) { console.log(mintType, chainId); // @TODO // const contracts = MINT_CONTRACT_ADDRESSES[chainId || Chains.GÖRLI][mintType] // const random = Math.floor(Math.random() * contracts.length); return true; } exports.getMintableAddress = getMintableAddress;