Skip to content

Commit

Permalink
main functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
cterech committed Jan 23, 2024
1 parent 77a5d39 commit b797d8a
Show file tree
Hide file tree
Showing 269 changed files with 40,493 additions and 2 deletions.
29 changes: 29 additions & 0 deletions dist/createListing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"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 });
// src/buy.ts
const constants_1 = require("./utils/constants");
const createListing = () => __awaiter(void 0, void 0, void 0, function* () {
// TODO: Fill in the token address and token ID of the NFT you want to make an offer on
let tokenAddress = "";
let tokenId = "";
let listingAmount = "";
const offer = {
accountAddress: constants_1.WALLET_ADDRESS,
startAmount: listingAmount,
asset: {
tokenAddress: tokenAddress,
tokenId: tokenId,
},
};
const order = yield constants_1.sdk.createOffer(offer);
});
exports.default = createListing;
39 changes: 39 additions & 0 deletions dist/createOffer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"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 });
// createOffer.ts
const constants_1 = require("./utils/constants");
const createOffer = () => __awaiter(void 0, void 0, void 0, function* () {
console.log("STARTED");
// TODO: Fill in the token address and token ID of the NFT you want to make an offer on
let tokenAddress = "0x26acca8836164119fb4dd0d31917627c68558ec9";
let tokenId = "6546";
let offerAmount = "0.004";
const offer = {
accountAddress: constants_1.WALLET_ADDRESS,
startAmount: offerAmount,
asset: {
tokenAddress: tokenAddress,
tokenId: tokenId,
},
};
console.log("Offer: ", offer);
const result = yield constants_1.sdk.createOffer(offer);
console.log("Result: ", result);
});
// Check if the module is the main entry point
if (require.main === module) {
// If yes, run the createOffer function
createOffer().catch((error) => {
console.error("Error in createOffer:", error);
});
}
exports.default = createOffer;
35 changes: 35 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"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());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// src/index.ts
const createListing_1 = __importDefault(require("./createListing"));
const createOffer_1 = __importDefault(require("./createOffer"));
const main = () => __awaiter(void 0, void 0, void 0, function* () {
console.log("STARTED");
console.log("STARTED");
console.log("STARTED");
// Run the specific method based on command line arguments or any other logic
const command = process.argv[2];
switch (command) {
case 'createListing':
yield (0, createListing_1.default)();
break;
case 'createOffer':
yield (0, createOffer_1.default)(); // Corrected: Invoke the function
break;
default:
console.log('Invalid command. Use "createListing", "createOffer"');
}
});
main();
15 changes: 15 additions & 0 deletions dist/utils/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sdk = exports.WALLET_ADDRESS = exports.RPC_PROVIDER_MAINNET = exports.ALCHEMY_API_KEY_MAINNET = exports.WALLET_PRIV_KEY = exports.OPENSEA_API_KEY = void 0;
const opensea_js_1 = require("opensea-js");
const ethers_1 = require("ethers");
exports.OPENSEA_API_KEY = process.env.OPENSEA_API_KEY;
exports.WALLET_PRIV_KEY = process.env.WALLET_PRIV_KEY;
exports.ALCHEMY_API_KEY_MAINNET = process.env.ALCHEMY_API_KEY;
exports.RPC_PROVIDER_MAINNET = new ethers_1.ethers.JsonRpcProvider(`https://eth-mainnet.g.alchemy.com/v2/${exports.ALCHEMY_API_KEY_MAINNET}`);
const walletMainnet = new ethers_1.Wallet(exports.WALLET_PRIV_KEY, exports.RPC_PROVIDER_MAINNET);
exports.WALLET_ADDRESS = walletMainnet.address;
exports.sdk = new opensea_js_1.OpenSeaSDK(walletMainnet, {
chain: opensea_js_1.Chain.Mainnet,
apiKey: exports.OPENSEA_API_KEY,
}, (line) => console.info(`MAINNET: ${line}`));
1 change: 1 addition & 0 deletions node_modules/.bin/acorn

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-node

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-node-cwd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-node-esm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-node-script

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-node-transpile-only

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-script

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

150 changes: 150 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/@cspotcode/source-map-support/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b797d8a

Please sign in to comment.