js
js copied to clipboard
Cannot mint SPL tokens with large initial supply
in this line: https://github.com/metaplex-foundation/js/blob/main/packages/js/src/plugins/tokenModule/operations/mintTokens.ts#L257
it's converting a BN to JS Number which can only store 53 bits, not nearly enough for large amount of tokens with 9 decimals.
Result is that you cannot mint tokens with an initial supply of say 10M tokens.
Same issue happens when calling the utility function token("10000000", 9).
Hi there 👋
Thanks for raising this.
In the code snippet shared, it seems like createMintToInstruction from @solana/spl-token only expects the type number which is why I'm converting it from a BN.
I'm working on a solution that involves more interfaces and would fix this in the long term but I'm afraid for now the solution would be to create this instruction manually.