我最终按照这里的指南创建了一个糖果机实例https://hackmd.io/@levicook/HJcDneEWF
我现在遇到了一个问题,当我mintOneToken
从 GUI 代码调用
await mintOneToken(candyMachineAccount, wallet.publicKey)
在这里找到,我得到一个错误,因为 CandyMachineAccount 对象的state.tokenMint
字段为空,但我们在这里看到它不需要为空。
const userPayingAccountAddress = (
await getAtaForMint(candyMachine.state.tokenMint, payer)
)[0];
有趣的是,当我加载不属于我自己的其他糖果机实例时,我看到它们的tokenMint
字段是非空的,所以我假设我需要运行一些命令或我需要进行合同调用才能将此字段设置为我的链上糖果机实例的非空值。如何正确设置tokenMint
字段?
作为参考,这是 Mainnet-Beta 上的糖果机 ID,它具有非空值tokenMint
EodXoBBFMMWMXe3KKpwAFRa3BHDDWF3y7S8DcGRUTdG9U
{
"authority": {
"_bn": "c474397eca84550ae504367dd7dbac1a292322eadc7cae7b67e7d60d7c9b99ce"
},
"wallet": {
"_bn": "bfcac40c32edd90f5616a3b1b4e8e15312ba42a1d10966b1045d404c2e071996"
},
"tokenMint": {
"_bn": "3af36dc3408953a0cf7c68de1fe61539f3d2144f4e229efa98cb3d1bc1235791"
},
"config": {
"_bn": "7525d86480fd7940b0e76fdbdd7fc7ce60216b94e1c1909ad81166f75c422e5d"
},
"data": {
"uuid": "8tJAvu",
"price": "01",
"itemsAvailable": "1d",
"goLiveDate": "6148b5dc"
},
"itemsRedeemed": "00",
"bump": 253
}
然后这是我在 DevNet 上的
3K7iVL5tE2D7F8gu6hXZMp9p2WJUPqQMZnxQn2aQ622p
{
"authority": {
"_bn": "7297dc02b1a174a34d635d952df3621a44eba1c747a7fe79965eb00cab3cfa83"
},
"wallet": {
"_bn": "7297dc02b1a174a34d635d952df3621a44eba1c747a7fe79965eb00cab3cfa83"
},
"tokenMint": null,
"config": {
"_bn": "506ae5975d15bad548e7976891ca30621e155cb3b95a8671736bea6715e2887e"
},
"data": {
"uuid": "6QvA3Y",
"price": "3b9aca00",
"itemsAvailable": "0b",
"goLiveDate": "614e2030"
},
"itemsRedeemed": "01",
"bump": 255
}