@fractional-company/common
Version:
Tessera constants
217 lines (216 loc) • 8.43 kB
JavaScript
"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 = {
[]: {
[]: {
[]: "0x2f949f7cD46F4D79d4FD6b234DB302cAeEe552e2",
[]: "0x1C9F82bcf150331B4E97A5Bd034a6d7F1b607ce6",
},
[]: {
[]: "0xcA9486e54FbBD6aCe6eB6AA0102ee97dd90A8a86",
[]: "0xE657164Ed47BD1Bdb9025cfB60Ed1CfB8E89fd63",
},
[]: {
[]: "0x954440A0826c764312e58d52d5c396274079bfA4",
[]: "0x048F9F292d6666AADf4DC8fa9dbd9a7Fb3339d04",
},
},
};
exports.MINT_FACTORY_ABI = {
[]: {
[]: {
[]: [
{
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",
},
],
[]: [
{
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",
},
],
},
[]: {
[]: [
{
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",
},
],
[]: [
{
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",
},
],
},
[]: {
[]: [
{
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",
},
],
[]: [
{
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 = {
[]: {
[]: mintableERC721_json_1.default,
[]: mintableERC1155_json_1.default,
},
};
exports.NFT_ABI = {
[]: {
[]: erc721_json_1.default,
[]: 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;