naracli 1.0.65 → 1.0.66
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.
- package/dist/nara-cli-bundle.cjs +33 -1
- package/package.json +1 -1
- package/src/cli/index.ts +40 -0
package/dist/nara-cli-bundle.cjs
CHANGED
|
@@ -172913,6 +172913,38 @@ function registerCommands(program3) {
|
|
|
172913
172913
|
process.exit(1);
|
|
172914
172914
|
}
|
|
172915
172915
|
});
|
|
172916
|
+
program3.command("airdrop").description("Claim a free NARA airdrop (0.1 NARA, once per 24 hours per address/IP)").action(async () => {
|
|
172917
|
+
const opts = program3.opts();
|
|
172918
|
+
try {
|
|
172919
|
+
const wallet = await loadWallet(opts.wallet);
|
|
172920
|
+
const address = wallet.publicKey.toBase58();
|
|
172921
|
+
if (!opts.json) printInfo(`Requesting airdrop for ${address}...`);
|
|
172922
|
+
const res = await fetch("https://quest-api.nara.build/airdrop", {
|
|
172923
|
+
method: "POST",
|
|
172924
|
+
headers: { "Content-Type": "application/json" },
|
|
172925
|
+
body: JSON.stringify({ wallet: address })
|
|
172926
|
+
});
|
|
172927
|
+
const data = await res.json();
|
|
172928
|
+
if (data.error) {
|
|
172929
|
+
if (data.retryAfterSeconds) {
|
|
172930
|
+
const hours = Math.ceil(data.retryAfterSeconds / 3600);
|
|
172931
|
+
printError(`${data.error}. Try again in ~${hours}h.`);
|
|
172932
|
+
} else {
|
|
172933
|
+
printError(data.error);
|
|
172934
|
+
}
|
|
172935
|
+
process.exit(1);
|
|
172936
|
+
}
|
|
172937
|
+
if (opts.json) {
|
|
172938
|
+
console.log(JSON.stringify(data, null, 2));
|
|
172939
|
+
} else {
|
|
172940
|
+
printSuccess(`Airdrop received: ${data.amount} NARA`);
|
|
172941
|
+
console.log(` Transaction: ${data.txHash}`);
|
|
172942
|
+
}
|
|
172943
|
+
} catch (error) {
|
|
172944
|
+
printError(error.message);
|
|
172945
|
+
process.exit(1);
|
|
172946
|
+
}
|
|
172947
|
+
});
|
|
172916
172948
|
program3.command("token-balance <token-address>").description("Check token balance (supports SPL Token and Token-2022)").option("--owner <address>", "Owner address (optional, defaults to current wallet)").action(async (tokenAddress, options) => {
|
|
172917
172949
|
const opts = program3.opts();
|
|
172918
172950
|
try {
|
|
@@ -173021,7 +173053,7 @@ function registerCommands(program3) {
|
|
|
173021
173053
|
}
|
|
173022
173054
|
|
|
173023
173055
|
// bin/nara-cli.ts
|
|
173024
|
-
var version2 = true ? "1.0.
|
|
173056
|
+
var version2 = true ? "1.0.66" : "dev";
|
|
173025
173057
|
var program2 = new Command();
|
|
173026
173058
|
program2.name("naracli").description("CLI for the Nara chain. Native coin is NARA (not SOL). Mine NARA for free via PoMI quests, manage wallets, register agents, and more. Run 'naracli <command> --help' for details on any command.").version(version2);
|
|
173027
173059
|
program2.option("-r, --rpc-url <url>", "RPC endpoint (default: https://mainnet-api.nara.build/)").option("-w, --wallet <path>", "Path to wallet keypair JSON file (default: ~/.config/nara/id.json)").option("-j, --json", "Output in JSON format");
|
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -111,6 +111,46 @@ export function registerCommands(program: Command): void {
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
+
// Top-level: airdrop
|
|
115
|
+
program
|
|
116
|
+
.command("airdrop")
|
|
117
|
+
.description("Claim a free NARA airdrop (0.1 NARA, once per 24 hours per address/IP)")
|
|
118
|
+
.action(async () => {
|
|
119
|
+
const opts = program.opts() as GlobalOptions;
|
|
120
|
+
try {
|
|
121
|
+
const wallet = await loadWallet(opts.wallet);
|
|
122
|
+
const address = wallet.publicKey.toBase58();
|
|
123
|
+
if (!opts.json) printInfo(`Requesting airdrop for ${address}...`);
|
|
124
|
+
|
|
125
|
+
const res = await fetch("https://quest-api.nara.build/airdrop", {
|
|
126
|
+
method: "POST",
|
|
127
|
+
headers: { "Content-Type": "application/json" },
|
|
128
|
+
body: JSON.stringify({ wallet: address }),
|
|
129
|
+
});
|
|
130
|
+
const data = await res.json() as any;
|
|
131
|
+
|
|
132
|
+
if (data.error) {
|
|
133
|
+
if (data.retryAfterSeconds) {
|
|
134
|
+
const hours = Math.ceil(data.retryAfterSeconds / 3600);
|
|
135
|
+
printError(`${data.error}. Try again in ~${hours}h.`);
|
|
136
|
+
} else {
|
|
137
|
+
printError(data.error);
|
|
138
|
+
}
|
|
139
|
+
process.exit(1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (opts.json) {
|
|
143
|
+
console.log(JSON.stringify(data, null, 2));
|
|
144
|
+
} else {
|
|
145
|
+
printSuccess(`Airdrop received: ${data.amount} NARA`);
|
|
146
|
+
console.log(` Transaction: ${data.txHash}`);
|
|
147
|
+
}
|
|
148
|
+
} catch (error: any) {
|
|
149
|
+
printError(error.message);
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
114
154
|
// Top-level: token-balance
|
|
115
155
|
program
|
|
116
156
|
.command("token-balance <token-address>")
|