OfficialEllaris's avatar

Creating and Minting a Solana token with Solana Kite framework

I'm developing a Solana token creation platform with Phantom Wallet integration for wallet management. I'm using the solana-kite framework by helius-labs to handle token creation and minting, but I'm hitting a roadblock with an error in the browser console when attempting to create a token:

Console errors 🐛🐛🐛

token-manager.js:44 Creating token with data: {data: {…}}
token-manager.js:65 Error creating token: RangeError: The number NaN cannot be converted to a BigInt because it is not an integer
    at BigInt (<anonymous>)
    at sendTransactionFromInstructions (transactions.ts:58:24)
    at async Object.createTokenMint (tokens.ts:274:5)
    at async Object.createAndMintToken (token-manager.js:47:33)

The error suggests an issue with a NaN value being passed where a BigInt is expected, likely in the token creation parameters. How can I properly set up token creation and minting with Solana Kite, ensuring the input data is correctly formatted to avoid this error? Any guidance on debugging or structuring the integration would be appreciated.

--- vite.config.js

{
    "private": true,
    "type": "module",
    "scripts": {
        "build": "vite build",
        "dev": "vite"
    },
    "devDependencies": {
        "@tailwindcss/vite": "^4.0.0",
        "axios": "^1.8.2",
        "concurrently": "^9.0.1",
        "laravel-vite-plugin": "^1.2.0",
        "tailwindcss": "^4.0.0",
        "vite": "^6.2.4"
    },
    "dependencies": {
        "@solana/webcrypto-ed25519-polyfill": "^2.1.0",
        "solana-kite": "^1.1.1"
    }
}

--- resources\js\app.js

import "./bootstrap";
import "./wallet-manager.js";
import "./token-manager.js";

--- resources\js\wallet-manager.js

--- resources\js\token-manager.js

0 likes
4 replies
Tray2's avatar

Somewhere in your code you are reading the length of a value, and that object is null, that means whatever is expected to be there isn't.

 Error creating and minting token: TypeError: Cannot read properties of undefined (reading 'length')

Whatever object you are reading the length of, does not contain anything. Basically this is what you are doing.

let myVar;

myVar.length;

The variable is unassigned aka undefined.

1 like
OfficialEllaris's avatar

@Tray2 Thank you, I'm currently experiencing a new error. Please check the updated console errors.

Tray2's avatar

@OfficialEllaris First off, never ever update the replies if the error message changes, it makes it harder for people to help you and for others to be helped if they have similar errors.

Since the error message changed you should either put the new error in a follow up reply, or create a new thread.

Thet being said, the error NaN = Not A Number, the content of the variable is a number where your code expects it to be.

token-manager.js:65 Error creating token: RangeError: The number NaN cannot be converted to a BigInt because it is not an integer

If you do something like

let value = 'Tray2';

let numeric = parseInt(value);

You will get a similar error message.

1 like
OfficialEllaris's avatar

@Tray2 Got it, thanks for the heads-up! I’ll make sure to post new errors in follow-ups or separate threads moving forward. Appreciate the clarification on the NaN too. 🙏

Please or to participate in this conversation.