-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_index.js
More file actions
64 lines (52 loc) · 1.68 KB
/
_index.js
File metadata and controls
64 lines (52 loc) · 1.68 KB
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
64
import { create, mplCore } from "@metaplex-foundation/mpl-core";
import {
createGenericFile,
generateSigner,
keypairIdentity,
signerIdentity,
sol,
publicKey
} from "@metaplex-foundation/umi";
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
import { base58 } from "@metaplex-foundation/umi/serializers";
import { irysUploader } from "@metaplex-foundation/umi-uploader-irys";
import fs from "fs";
import path from "path";
import {
mintNFT,
mintCollection,
mintCoreNFT
} from "./_createNFT.js";
// import {
// createCollectionMint
// } from "./src/collectionMint.js";
// 実行例 (各関数を呼び出す)
(async () => {
//
// ** Setting Up Umi **
//
const umi = createUmi("https://api.devnet.solana.com")
.use(mplCore())
.use(
irysUploader({
// mainnet address: "https://node1.irys.xyz"
// devnet address: "https://devnet.irys.xyz"
address: "https://devnet.irys.xyz",
})
);
// こちらを自身のウォレットの格納場所に設定してください。
const walletFile = JSON.parse(
fs.readFileSync("./id.json")
);
let keypair = umi.eddsa.createKeypairFromSecretKey(
new Uint8Array(walletFile)
);
umi.use(keypairIdentity(keypair));
const imagePath = path.join("./image.png");
// 1. Core NFTのMint
const { irysImageUri, imageUri } = await mintNFT(umi, imagePath);
// 2. CollectionのMint
const collectionAddress = await mintCollection();
// 3. Collectionに紐付けたNFTのMint
await mintCoreNFT(umi, irysImageUri, imageUri, collectionAddress);
})();