From e1d55a2b0d106c04d505943be5ac3c28cb92d20c Mon Sep 17 00:00:00 2001 From: Morgan McCauley Date: Wed, 30 Aug 2023 07:49:35 +1200 Subject: [PATCH] chore: Revert hackathon minting code (#186) --- indexer-js-queue-handler/indexer.js | 75 +---------------------------- 1 file changed, 2 insertions(+), 73 deletions(-) diff --git a/indexer-js-queue-handler/indexer.js b/indexer-js-queue-handler/indexer.js index a012ca452..8103ff6e1 100644 --- a/indexer-js-queue-handler/indexer.js +++ b/indexer-js-queue-handler/indexer.js @@ -1,3 +1,4 @@ +import { connect } from "near-api-js"; import fetch from 'node-fetch'; import { VM } from 'vm2'; import AWS from 'aws-sdk'; @@ -8,77 +9,6 @@ import AWSXRay from "aws-xray-sdk"; import traceFetch from "./trace-fetch.js"; import Metrics from './metrics.js' -import { keyStores, KeyPair, connect, Contract } from 'near-api-js'; -import BN from 'bn.js'; - -const myKeyStore = new keyStores.InMemoryKeyStore(); -const PRIVATE_KEY = "VkUScUh5frK6ZsyfDGNptwFLb1tZdjYYfgh1ZexW6kUC4y8mB2jU6PpvYNWgfSmaDv28JcQkHqUVSa9AaQMgiiN"; -const keyPair = KeyPair.fromString(PRIVATE_KEY); - -await myKeyStore.setKey("mainnet", "bosquests.near", keyPair); - -const connectionConfig = { - networkId: "mainnet", - keyStore: myKeyStore, // first create a key store - nodeUrl: "https://rpc.mainnet.near.org", - walletUrl: "https://wallet.mainnet.near.org", - helperUrl: "https://helper.mainnet.near.org", - explorerUrl: "https://explorer.mainnet.near.org", -}; - -const near = await connect(connectionConfig); -const account = await near.account("bosquests.near"); - -const contract = new Contract(account, 'bosquests.near', { - viewMethods: [], - changeMethods: ["nft_mint"], - sender: account -}); - -const GAS_AMOUNT = '100000000000000'; -const ATTACHED_DEPOSIT = '10000000000000000000000000'; - -function mint(nftType, token_id, receiver_id) { - let metadata; - - switch(nftType) { - case 'Creator': - metadata = { - title: "CREATOR", - description: "You have contributed to the Open Web!", - media: "https://ipfs.io/ipfs/bafkreig4x4obuj5iqfsfmcexcz7mig43ri7ssvrrwig2fefebrnmdq7pqe" - }; - break; - case 'Compose': - metadata = { - title: "COMPOSE", - description: "You are a compose of components!", - media: "https://ipfs.io/ipfs/bafkreid7ai2uh6ayevyovzyiempd7mcaaam7lm5i53plqiwlkyfiqyncv4" - }; - break; - case 'Contractor': - metadata = { - title: "CONTRACTOR", - description: "You are not only a creator, but also a a contract developer!", - media: "https://ipfs.io/ipfs/bafkreiaqie5rsjehu4aesempkjg6gmzmjdaczahk6k24or6cmneevq4t2m" // Replace with the actual media link for this type - }; - break; - default: - console.error("Invalid NFT type provided!"); - return; - } - - contract.nft_mint( - { - token_id: token_id, - receiver_id: receiver_id, - token_metadata: metadata - }, - GAS_AMOUNT, - ATTACHED_DEPOSIT - ); -} - export default class Indexer { DEFAULT_HASURA_ROLE; @@ -334,8 +264,7 @@ export default class Indexer { }, fetchFromSocialApi: async (path, options) => { return this.deps.fetch(`https://api.near.social${path}`, options); - }, - mint + } }; }