z_0_filetest.gno

7.39 Kb ยท 249 lines
  1// PKGPATH: gno.land/r/demo/nft_test
  2package nft_test
  3
  4import (
  5	"gno.land/p/demo/testutils"
  6	"gno.land/r/demo/nft"
  7)
  8
  9func main() {
 10	addr1 := testutils.TestAddress("addr1")
 11	// addr2 := testutils.TestAddress("addr2")
 12	grc721 := nft.GetToken()
 13	tid := grc721.Mint(addr1, "NFT#1")
 14	println(grc721.OwnerOf(tid))
 15	println(addr1)
 16}
 17
 18// Output:
 19// g1v9jxgu33ta047h6lta047h6lta047h6l43dqc5
 20// g1v9jxgu33ta047h6lta047h6lta047h6l43dqc5
 21
 22// Realm:
 23// switchrealm["gno.land/r/demo/nft"]
 24// switchrealm["gno.land/r/demo/nft"]
 25// c[67c479d3d51d4056b2f4111d5352912a00be311e:11]={
 26//     "Fields": [
 27//         {
 28//             "T": {
 29//                 "@type": "/gno.RefType",
 30//                 "ID": "std.Address"
 31//             },
 32//             "V": {
 33//                 "@type": "/gno.StringValue",
 34//                 "value": "g1v9jxgu33ta047h6lta047h6lta047h6l43dqc5"
 35//             }
 36//         },
 37//         {
 38//             "T": {
 39//                 "@type": "/gno.RefType",
 40//                 "ID": "std.Address"
 41//             }
 42//         },
 43//         {
 44//             "T": {
 45//                 "@type": "/gno.RefType",
 46//                 "ID": "gno.land/p/demo/grc/grc721.TokenID"
 47//             },
 48//             "V": {
 49//                 "@type": "/gno.StringValue",
 50//                 "value": "1"
 51//             }
 52//         },
 53//         {
 54//             "T": {
 55//                 "@type": "/gno.PrimitiveType",
 56//                 "value": "16"
 57//             },
 58//             "V": {
 59//                 "@type": "/gno.StringValue",
 60//                 "value": "NFT#1"
 61//             }
 62//         }
 63//     ],
 64//     "ObjectInfo": {
 65//         "ID": "67c479d3d51d4056b2f4111d5352912a00be311e:11",
 66//         "ModTime": "0",
 67//         "OwnerID": "67c479d3d51d4056b2f4111d5352912a00be311e:10",
 68//         "RefCount": "1"
 69//     }
 70// }
 71// c[67c479d3d51d4056b2f4111d5352912a00be311e:10]={
 72//     "ObjectInfo": {
 73//         "ID": "67c479d3d51d4056b2f4111d5352912a00be311e:10",
 74//         "ModTime": "0",
 75//         "OwnerID": "67c479d3d51d4056b2f4111d5352912a00be311e:9",
 76//         "RefCount": "1"
 77//     },
 78//     "Value": {
 79//         "T": {
 80//             "@type": "/gno.RefType",
 81//             "ID": "gno.land/r/demo/nft.NFToken"
 82//         },
 83//         "V": {
 84//             "@type": "/gno.RefValue",
 85//             "Hash": "564a9e78be869bd258fc3c9ad56f5a75ed68818f",
 86//             "ObjectID": "67c479d3d51d4056b2f4111d5352912a00be311e:11"
 87//         }
 88//     }
 89// }
 90// c[67c479d3d51d4056b2f4111d5352912a00be311e:9]={
 91//     "Fields": [
 92//         {
 93//             "T": {
 94//                 "@type": "/gno.PrimitiveType",
 95//                 "value": "16"
 96//             },
 97//             "V": {
 98//                 "@type": "/gno.StringValue",
 99//                 "value": "1"
100//             }
101//         },
102//         {
103//             "T": {
104//                 "@type": "/gno.PointerType",
105//                 "Elt": {
106//                     "@type": "/gno.RefType",
107//                     "ID": "gno.land/r/demo/nft.NFToken"
108//                 }
109//             },
110//             "V": {
111//                 "@type": "/gno.PointerValue",
112//                 "Base": {
113//                     "@type": "/gno.RefValue",
114//                     "Hash": "b53ffc464e1b5655d19b9d5277f3491717c24aca",
115//                     "ObjectID": "67c479d3d51d4056b2f4111d5352912a00be311e:10"
116//                 },
117//                 "Index": "0",
118//                 "TV": null
119//             }
120//         },
121//         {
122//             "T": {
123//                 "@type": "/gno.PrimitiveType",
124//                 "value": "64"
125//             }
126//         },
127//         {
128//             "N": "AQAAAAAAAAA=",
129//             "T": {
130//                 "@type": "/gno.PrimitiveType",
131//                 "value": "32"
132//             }
133//         },
134//         {
135//             "T": {
136//                 "@type": "/gno.PointerType",
137//                 "Elt": {
138//                     "@type": "/gno.RefType",
139//                     "ID": "gno.land/p/demo/avl.Node"
140//                 }
141//             }
142//         },
143//         {
144//             "T": {
145//                 "@type": "/gno.PointerType",
146//                 "Elt": {
147//                     "@type": "/gno.RefType",
148//                     "ID": "gno.land/p/demo/avl.Node"
149//                 }
150//             }
151//         }
152//     ],
153//     "ObjectInfo": {
154//         "ID": "67c479d3d51d4056b2f4111d5352912a00be311e:9",
155//         "ModTime": "0",
156//         "OwnerID": "67c479d3d51d4056b2f4111d5352912a00be311e:8",
157//         "RefCount": "1"
158//     }
159// }
160// c[67c479d3d51d4056b2f4111d5352912a00be311e:8]={
161//     "ObjectInfo": {
162//         "ID": "67c479d3d51d4056b2f4111d5352912a00be311e:8",
163//         "ModTime": "0",
164//         "OwnerID": "67c479d3d51d4056b2f4111d5352912a00be311e:5",
165//         "RefCount": "1"
166//     },
167//     "Value": {
168//         "T": {
169//             "@type": "/gno.RefType",
170//             "ID": "gno.land/p/demo/avl.Node"
171//         },
172//         "V": {
173//             "@type": "/gno.RefValue",
174//             "Hash": "b1d928b3716b147c92730e8d234162bec2f0f2fc",
175//             "ObjectID": "67c479d3d51d4056b2f4111d5352912a00be311e:9"
176//         }
177//     }
178// }
179// u[67c479d3d51d4056b2f4111d5352912a00be311e:5]={
180//     "Fields": [
181//         {
182//             "T": {
183//                 "@type": "/gno.PointerType",
184//                 "Elt": {
185//                     "@type": "/gno.RefType",
186//                     "ID": "gno.land/p/demo/avl.Node"
187//                 }
188//             },
189//             "V": {
190//                 "@type": "/gno.PointerValue",
191//                 "Base": {
192//                     "@type": "/gno.RefValue",
193//                     "Hash": "b229b824842ec3e7f2341e33d0fa0ca77af2f480",
194//                     "ObjectID": "67c479d3d51d4056b2f4111d5352912a00be311e:8"
195//                 },
196//                 "Index": "0",
197//                 "TV": null
198//             }
199//         }
200//     ],
201//     "ObjectInfo": {
202//         "ID": "67c479d3d51d4056b2f4111d5352912a00be311e:5",
203//         "ModTime": "7",
204//         "OwnerID": "67c479d3d51d4056b2f4111d5352912a00be311e:4",
205//         "RefCount": "1"
206//     }
207// }
208// u[67c479d3d51d4056b2f4111d5352912a00be311e:4]={
209//     "Fields": [
210//         {},
211//         {
212//             "N": "AQAAAAAAAAA=",
213//             "T": {
214//                 "@type": "/gno.PrimitiveType",
215//                 "value": "32"
216//             }
217//         },
218//         {
219//             "T": {
220//                 "@type": "/gno.RefType",
221//                 "ID": "gno.land/p/demo/avl.Tree"
222//             },
223//             "V": {
224//                 "@type": "/gno.RefValue",
225//                 "Hash": "1e0b9dddb406b4f50500a022266a4cb8a4ea38c6",
226//                 "ObjectID": "67c479d3d51d4056b2f4111d5352912a00be311e:5"
227//             }
228//         },
229//         {
230//             "T": {
231//                 "@type": "/gno.RefType",
232//                 "ID": "gno.land/p/demo/avl.Tree"
233//             },
234//             "V": {
235//                 "@type": "/gno.RefValue",
236//                 "Hash": "05ab6746ea84b55ca133806af215d99a1c4b045e",
237//                 "ObjectID": "67c479d3d51d4056b2f4111d5352912a00be311e:6"
238//             }
239//         }
240//     ],
241//     "ObjectInfo": {
242//         "ID": "67c479d3d51d4056b2f4111d5352912a00be311e:4",
243//         "ModTime": "7",
244//         "OwnerID": "67c479d3d51d4056b2f4111d5352912a00be311e:3",
245//         "RefCount": "1"
246//     }
247// }
248// switchrealm["gno.land/r/demo/nft"]
249// switchrealm["gno.land/r/demo/nft_test"]