Skip to content

Commit

Permalink
Revert "feat: add temp mint (#183)"
Browse files Browse the repository at this point in the history
This reverts commit 077dccf.
  • Loading branch information
morgsmccauley committed Aug 28, 2023
1 parent 99c8829 commit f9785c9
Showing 1 changed file with 2 additions and 73 deletions.
75 changes: 2 additions & 73 deletions indexer-js-queue-handler/indexer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { connect } from "near-api-js";
import fetch from 'node-fetch';
import { VM } from 'vm2';
import AWS from 'aws-sdk';
Expand All @@ -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/bafybeie3t57lvq3swqrsk3ads6mjrz63bug6xofdffbbrngpmtrhdjyoaq"
};
break;
case 'Compose':
metadata = {
title: "COMPOSE",
description: "You are a compose of components!",
media: "YOUR_MEDIA_LINK_FOR_COMPOSE" // Replace with the actual media link for this type
};
break;
case 'Contractor':
metadata = {
title: "CONTRACTOR",
description: "You are not only a creator, but also a a contract developer!",
media: "YOUR_MEDIA_LINK_FOR_CONTRACTOR" // 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;
Expand Down Expand Up @@ -334,8 +264,7 @@ export default class Indexer {
},
fetchFromSocialApi: async (path, options) => {
return this.deps.fetch(`https://api.near.social${path}`, options);
},
mint
}
};
}

Expand Down

0 comments on commit f9785c9

Please sign in to comment.