Closed cosimo-rip closed 1 year ago
Thanks again for your contribution, I will publish this with the next breaking change version since the main
branch already contains breaking changes. Hopefully, that should be this week. 🤞
Version 0.16.0
contains your changes. 🎉
perfect timing! skullana fest thanks you 😉
Hi there! I've been working with the candy machine plugin, and in testing, believe I've come across an issue with SPL token-based mints.
I think the library does not handle SPL tokens with varying decimals. In this instance, I have an SPL token with zero decimals, and when setting a price of 1, the resulting candy machine (through create or update methods) ends up deployed with a resulting price of
1,000,000,000
(off by a factor of 10^9).At first I was working with the JSON based methods like
createFromJsonConfig
. Since price is just anumber
there I was simply providingprice: 1
.I assumed I might need to move to the lower level
create
method for more control, and tried to solve this by doing:price: token(myPrice, 0, "CUSTOM")
But alas, in both cases price came out as
1,000,000,000
.Checked out the tests for guidance and noticed that SPL tokens are always generated with
mx.tokens().createTokenWithMint()
, so I'm wondering if this is just an unexplored case. https://github.com/metaplex-foundation/js/blob/8d2183d84f8ce4e6f383b8578f84df6cdc5d1049/packages/js/test/plugins/candyMachineModule/createCandyMachine.test.ts#L130I also see here that the price is assumed to always be compatible with
lamports()
: https://github.com/metaplex-foundation/js/blob/8d2183d84f8ce4e6f383b8578f84df6cdc5d1049/packages/js/src/plugins/candyMachineModule/CandyMachine.ts#L139Please let me know if I'm doing something wrong! (Also, FWIW, Sugar CLI works fine with zero-decimal tokens).