@heyamiko/amiko-cli 0.3.1 → 0.3.3
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/index.js +18 -8
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -26703,18 +26703,22 @@ function registerCreditsCommand(program2) {
|
|
|
26703
26703
|
{
|
|
26704
26704
|
const spinner2 = ora("Fetching credit balance...").start();
|
|
26705
26705
|
try {
|
|
26706
|
-
let
|
|
26706
|
+
let balance = null;
|
|
26707
26707
|
const billingToken = auth.platformKey || auth.privyToken;
|
|
26708
26708
|
if (auth.billingBase && billingToken) {
|
|
26709
|
-
|
|
26710
|
-
|
|
26711
|
-
|
|
26712
|
-
|
|
26713
|
-
|
|
26709
|
+
try {
|
|
26710
|
+
const res = await fetch(`${auth.billingBase}/api/credits`, {
|
|
26711
|
+
headers: { Authorization: `Bearer ${billingToken}` }
|
|
26712
|
+
});
|
|
26713
|
+
if (res.ok) {
|
|
26714
|
+
const data = await res.json();
|
|
26715
|
+
balance = data.displayBalance ?? Math.round(Number(data.credits?.balance || 0));
|
|
26716
|
+
}
|
|
26717
|
+
} catch {}
|
|
26714
26718
|
}
|
|
26715
26719
|
spinner2.stop();
|
|
26716
|
-
if (
|
|
26717
|
-
console.log(label("Balance", source_default.bold(
|
|
26720
|
+
if (balance !== null) {
|
|
26721
|
+
console.log(label("Balance", source_default.bold(balance.toLocaleString()) + " credits"));
|
|
26718
26722
|
console.log("");
|
|
26719
26723
|
} else {
|
|
26720
26724
|
console.log(dim(" Could not fetch credit balance"));
|
|
@@ -26870,6 +26874,10 @@ function registerCreditsCommand(program2) {
|
|
|
26870
26874
|
process.exit(1);
|
|
26871
26875
|
}
|
|
26872
26876
|
}
|
|
26877
|
+
if (["base", "ethereum", "tempo"].includes(walletChain)) {
|
|
26878
|
+
console.error(error("EVM topup not supported yet. Use a Solana wallet with --token AMIKO, USDC, USDT, or SOL."));
|
|
26879
|
+
process.exit(1);
|
|
26880
|
+
}
|
|
26873
26881
|
const TREASURY = "FPiZAf3jEnNfCwfvbv46jdPfHbmSepD4Q6iHiLJDQXvb";
|
|
26874
26882
|
const spinner3 = ora("Transferring tokens to treasury...").start();
|
|
26875
26883
|
const transferRes = await fetch(`${auth.billingBase}/api/crossmint/wallets/${encodeURIComponent(walletAddr)}/transfer`, {
|
|
@@ -26886,6 +26894,8 @@ function registerCreditsCommand(program2) {
|
|
|
26886
26894
|
spinner3.stop();
|
|
26887
26895
|
const err = await transferRes.json().catch(() => ({ error: "Transfer failed" }));
|
|
26888
26896
|
console.error(error(err.error || `Transfer failed: ${transferRes.status}`));
|
|
26897
|
+
if (err.details)
|
|
26898
|
+
console.error(dim(typeof err.details === "string" ? err.details : JSON.stringify(err.details)));
|
|
26889
26899
|
process.exit(1);
|
|
26890
26900
|
}
|
|
26891
26901
|
const transferData = await transferRes.json();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyamiko/amiko-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Amiko CLI — manage agents, wallets, credits, and marketplace on the MPP payment rail",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"test": "bun test"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"keywords": [
|
|
19
20
|
"amiko",
|