naracli 1.0.55 → 1.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130580,7 +130580,12 @@ async function handleTokenBalance(tokenAddress, options) {
130580
130580
  }
130581
130581
  printInfo(`Owner: ${owner.toBase58()}`);
130582
130582
  printInfo(`Token: ${tokenAddress}`);
130583
- const tokenAccount = await getAssociatedTokenAddress(tokenMint, owner);
130583
+ const mintAccountInfo = await connection.getAccountInfo(tokenMint);
130584
+ if (!mintAccountInfo) {
130585
+ throw new Error(`Token mint ${tokenAddress} not found on chain`);
130586
+ }
130587
+ const tokenProgramId = mintAccountInfo.owner.equals(TOKEN_2022_PROGRAM_ID) ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID;
130588
+ const tokenAccount = await getAssociatedTokenAddress(tokenMint, owner, true, tokenProgramId);
130584
130589
  try {
130585
130590
  const accountInfo = await connection.getTokenAccountBalance(tokenAccount);
130586
130591
  const balance = accountInfo.value;
@@ -134169,7 +134174,7 @@ function registerCommands(program3) {
134169
134174
  }
134170
134175
 
134171
134176
  // bin/nara-cli.ts
134172
- var version2 = true ? "1.0.55" : "dev";
134177
+ var version2 = true ? "1.0.56" : "dev";
134173
134178
  var program2 = new Command();
134174
134179
  program2.name("naracli").description("CLI for the Nara chain (Solana-compatible)").version(version2);
134175
134180
  program2.option("-r, --rpc-url <url>", "RPC endpoint URL").option("-w, --wallet <path>", "Path to wallet keypair JSON file").option("-j, --json", "Output in JSON format");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naracli",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "description": "CLI for the Nara chain (Solana-compatible)",
5
5
  "homepage": "https://nara.build",
6
6
  "repository": {
@@ -14,6 +14,7 @@ import {
14
14
  getAssociatedTokenAddress,
15
15
  createTransferInstruction,
16
16
  TOKEN_PROGRAM_ID,
17
+ TOKEN_2022_PROGRAM_ID,
17
18
  } from "@solana/spl-token";
18
19
  import * as bip39 from "bip39";
19
20
  import { derivePath } from "ed25519-hd-key";
@@ -176,8 +177,17 @@ export async function handleTokenBalance(
176
177
  printInfo(`Owner: ${owner.toBase58()}`);
177
178
  printInfo(`Token: ${tokenAddress}`);
178
179
 
180
+ // Detect token program (SPL Token vs Token-2022) by checking mint account owner
181
+ const mintAccountInfo = await connection.getAccountInfo(tokenMint);
182
+ if (!mintAccountInfo) {
183
+ throw new Error(`Token mint ${tokenAddress} not found on chain`);
184
+ }
185
+ const tokenProgramId = mintAccountInfo.owner.equals(TOKEN_2022_PROGRAM_ID)
186
+ ? TOKEN_2022_PROGRAM_ID
187
+ : TOKEN_PROGRAM_ID;
188
+
179
189
  // Get associated token account
180
- const tokenAccount = await getAssociatedTokenAddress(tokenMint, owner);
190
+ const tokenAccount = await getAssociatedTokenAddress(tokenMint, owner, true, tokenProgramId);
181
191
 
182
192
  // Get token account balance
183
193
  try {