-
Notifications
You must be signed in to change notification settings - Fork 3
/
tiered-claim.ts
61 lines (53 loc) · 1.68 KB
/
tiered-claim.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { ThirdwebSDK, NFTMetadataInput } from "@thirdweb-dev/sdk";
import dotenv from "dotenv";
import { readFileSync } from "fs";
import { readdir } from "fs/promises";
import { glob } from "glob";
import path from "path";
dotenv.config();
const run = async () => {
// Instantiate thirdweb SDK for read/write
// PRIVATE_KEY should be put into environment variable
// PRIVATE_KEY should be put into environment variable
const PRIVATE_KEY = process.env.M_WALLET_KEY as string;
const delayedRevealPassword = process.env.DELAYED_REVEAL_PASSWORD as string;
const sdk = ThirdwebSDK.fromPrivateKey(
PRIVATE_KEY, // Your wallet private key
"forketh",
{
supportedChains: [{
chainId: 1,
rpc: ["https://rpc-1.eth.bio/"],
nativeCurrency: {
name: "ETH",
symbol: "ETH",
decimals: 18,
},
slug: "forketh",
}],
secretKey: process.env.THIRDWEB_SECRET_KEY as string,
}
);
const contract = await sdk.getContract(
"0x6FF54EF8d9860552950FF3843044E36E41e9D2eF"
);
// test claim one of the NFTs
const tribePriority = ["angel","builder","connector"]; // mint 178, 178, 177
const payload = await contract.erc721.tieredDrop.generate({
to: "0x8e357f619040d1B98b700792b38a4BAD1ca61fd1",
quantity: 10,
currencyAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
price: 0,
tierPriority: tribePriority,
});
// console.log(payload);
console.log("claiming NFT");
const claimTx = await contract.erc721.tieredDrop.claimWithSignature(payload);
console.log(claimTx);
};
run()
.then(() => process.exit(0))
.catch((err) => {
console.error(err);
process.exit(1);
});