-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
- Loading branch information
There are no files selected for viewing
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; |
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; |
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(); |
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}`)); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.