-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-collection-mint.ts
63 lines (55 loc) · 1.25 KB
/
create-collection-mint.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
62
63
import {
Metaplex,
keypairIdentity,
bundlrStorage,
} from "@metaplex-foundation/js";
import { exit } from "process";
import dotenv from "dotenv";
import { connection, RPC_HOST, wallet } from "./constants";
import { mintCollection, uploadImage, uploadMetadata } from "./utils";
dotenv.config();
const CONFIG = {
uploadPath: `${__dirname}/assets/`,
imgFileName: "pineapple.gif",
imgType: "image/jpg",
imgName: "Groovy Pineapple",
description: "",
attributes: [],
sellerFeeBasisPoints: 0,
symbol: "PINEC",
creators: [{ address: wallet.publicKey, share: 0 }],
};
const run = async () => {
const metaplex = Metaplex.make(connection)
.use(keypairIdentity(wallet))
.use(
bundlrStorage({
address: "https://devnet.bundlr.network",
providerUrl: RPC_HOST,
timeout: 60000,
})
);
const imgUri = await uploadImage(
metaplex,
CONFIG.uploadPath,
CONFIG.imgFileName
);
const metadataUri = await uploadMetadata(
metaplex,
imgUri,
CONFIG.imgType,
CONFIG.imgName,
CONFIG.description,
CONFIG.attributes
);
await mintCollection(
metaplex,
metadataUri,
CONFIG.imgName,
CONFIG.sellerFeeBasisPoints,
CONFIG.symbol,
CONFIG.creators
);
exit();
};
run();