Skip to content

Commit 8ff1fc2

Browse files
authored
331 nftgo minting token (#362)
1 parent 45c3b56 commit 8ff1fc2

File tree

27 files changed

+2205
-67
lines changed

27 files changed

+2205
-67
lines changed

cmd/plex/cli.go

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@ package plex
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"os"
76
"path"
87

98
"github.com/google/uuid"
10-
"github.com/labdao/plex/internal/ipfs"
119
"github.com/labdao/plex/internal/ipwl"
12-
"github.com/labdao/plex/internal/web3"
10+
web3pkg "github.com/labdao/plex/internal/web3"
1311
)
1412

1513
func Run(toolPath, inputDir, ioJsonPath, workDir string, verbose, retry, local, showAnimation bool, concurrency, layers int, web3 bool) {
1614
// mint an NFT if web3 flag is set
17-
// ./plex -tool equibind -input-io /some/path/to/io.json -web3=true
1815
if web3 {
1916
fmt.Println("Minting NFT...")
20-
mintNFT(toolPath, ioJsonPath)
17+
web3pkg.MintNFT(toolPath, ioJsonPath)
2118
return
2219
}
2320

@@ -90,48 +87,4 @@ func Run(toolPath, inputDir, ioJsonPath, workDir string, verbose, retry, local,
9087
fmt.Println(ioJsonPath)
9188
ipwl.ProcessIOList(workDirPath, ioJsonPath, retry, verbose, local, showAnimation, concurrency)
9289
fmt.Printf("Finished processing, results written to %s\n", ioJsonPath)
93-
// if web3 {
94-
// mintNFT(toolPath, ioJsonPath)
95-
// }
96-
}
97-
98-
func mintNFT(toolPath, ioJsonPath string) {
99-
// Build NFT metadata
100-
fmt.Println("Preparing NFT metadata...")
101-
metadata, err := web3.BuildTokenMetadata(toolPath, ioJsonPath)
102-
if err != nil {
103-
fmt.Println("Error:", err)
104-
os.Exit(1)
105-
}
106-
107-
// Create a temporary file
108-
tempFile, err := ioutil.TempFile("", "metadata-*.json")
109-
if err != nil {
110-
fmt.Println("Error:", err)
111-
os.Exit(1)
112-
}
113-
defer os.Remove(tempFile.Name()) // clean up
114-
115-
// Write the metadata to the temporary file
116-
_, err = tempFile.WriteString(metadata)
117-
if err != nil {
118-
fmt.Println("Error:", err)
119-
os.Exit(1)
120-
}
121-
122-
// Close the file
123-
err = tempFile.Close()
124-
if err != nil {
125-
fmt.Println("Error:", err)
126-
os.Exit(1)
127-
}
128-
129-
// Upload the metadata to IPFS and return the CID
130-
fmt.Println("Uploading NFT metadata to IPFS...")
131-
cid, err := ipfs.GetFileCid(tempFile.Name())
132-
if err != nil {
133-
fmt.Println("Error:", err)
134-
os.Exit(1)
135-
}
136-
fmt.Printf("NFT metadata uploaded to IPFS: ipfs://%s\n", cid)
13790
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"_format": "hh-sol-dbg-1",
3+
"buildInfo": "../../../../build-info/a7fa49d6da0732841f00ec7c540205a6.json"
4+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"_format": "hh-sol-artifact-1",
3+
"contractName": "Ownable",
4+
"sourceName": "@openzeppelin/contracts/access/Ownable.sol",
5+
"abi": [
6+
{
7+
"anonymous": false,
8+
"inputs": [
9+
{
10+
"indexed": true,
11+
"internalType": "address",
12+
"name": "previousOwner",
13+
"type": "address"
14+
},
15+
{
16+
"indexed": true,
17+
"internalType": "address",
18+
"name": "newOwner",
19+
"type": "address"
20+
}
21+
],
22+
"name": "OwnershipTransferred",
23+
"type": "event"
24+
},
25+
{
26+
"inputs": [],
27+
"name": "owner",
28+
"outputs": [
29+
{
30+
"internalType": "address",
31+
"name": "",
32+
"type": "address"
33+
}
34+
],
35+
"stateMutability": "view",
36+
"type": "function"
37+
},
38+
{
39+
"inputs": [],
40+
"name": "renounceOwnership",
41+
"outputs": [],
42+
"stateMutability": "nonpayable",
43+
"type": "function"
44+
},
45+
{
46+
"inputs": [
47+
{
48+
"internalType": "address",
49+
"name": "newOwner",
50+
"type": "address"
51+
}
52+
],
53+
"name": "transferOwnership",
54+
"outputs": [],
55+
"stateMutability": "nonpayable",
56+
"type": "function"
57+
}
58+
],
59+
"bytecode": "0x",
60+
"deployedBytecode": "0x",
61+
"linkReferences": {},
62+
"deployedLinkReferences": {}
63+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"_format": "hh-sol-dbg-1",
3+
"buildInfo": "../../../../../build-info/a7fa49d6da0732841f00ec7c540205a6.json"
4+
}

0 commit comments

Comments
 (0)