@heyamiko/amiko-cli 0.5.8 → 0.5.10

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.
Files changed (2) hide show
  1. package/dist/index.js +19 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -75295,7 +75295,7 @@ function registerCreditsCommand(program2) {
75295
75295
  }
75296
75296
  }
75297
75297
  const agentWallets = (auth.agentWallets || []).filter((w5) => w5.source === "agent");
75298
- if (agentWallets.length > 0 && auth.billingBase) {
75298
+ if (agentWallets.length > 0 && (auth.billingBase || "https://billing.heyamiko.com")) {
75299
75299
  const spinner3 = ora("Fetching wallet balances...").start();
75300
75300
  const billingAuth = auth.platformKey || auth.twinToken || auth.privyToken;
75301
75301
  try {
@@ -75317,7 +75317,7 @@ function registerCreditsCommand(program2) {
75317
75317
  continue;
75318
75318
  }
75319
75319
  try {
75320
- const balRes = await fetch(`${auth.billingBase}/api/crossmint/wallets/${encodeURIComponent(addr)}/balance?chain=${chain}`, {
75320
+ const balRes = await fetch(`${auth.billingBase || "https://billing.heyamiko.com"}/api/crossmint/wallets/${encodeURIComponent(addr)}/balance?chain=${chain}`, {
75321
75321
  headers: {
75322
75322
  Authorization: `Bearer ${billingAuth}`
75323
75323
  }
@@ -75362,7 +75362,8 @@ function registerCreditsCommand(program2) {
75362
75362
  console.error(error("Not connected"));
75363
75363
  process.exit(1);
75364
75364
  }
75365
- if (!auth.billingBase) {
75365
+ const billingBase2 = auth.billingBase || "https://billing.heyamiko.com";
75366
+ if (!billingBase2) {
75366
75367
  spinner.stop();
75367
75368
  console.error(error("Billing service not configured. Run: amiko connect"));
75368
75369
  process.exit(1);
@@ -75456,7 +75457,7 @@ function registerCreditsCommand(program2) {
75456
75457
  }
75457
75458
  const TREASURY = "FPiZAf3jEnNfCwfvbv46jdPfHbmSepD4Q6iHiLJDQXvb";
75458
75459
  const spinner3 = ora("Transferring tokens to treasury...").start();
75459
- const transferRes = await fetch(`${auth.billingBase}/api/crossmint/wallets/${encodeURIComponent(walletAddr)}/transfer`, {
75460
+ const transferRes = await fetch(`${auth.billingBase || "https://billing.heyamiko.com"}/api/crossmint/wallets/${encodeURIComponent(walletAddr)}/transfer`, {
75460
75461
  method: "POST",
75461
75462
  headers: authHeaders2,
75462
75463
  body: JSON.stringify({
@@ -75483,14 +75484,25 @@ function registerCreditsCommand(program2) {
75483
75484
  process.exit(1);
75484
75485
  }
75485
75486
  console.log(label("Tx Hash", dim(txHash.slice(0, 16) + "...")));
75486
- const keyId = auth.connectedKeyId;
75487
+ let keyId = auth.connectedKeyId;
75488
+ if (!keyId && authToken) {
75489
+ try {
75490
+ const keysRes = await fetch(`${auth.billingBase || "https://billing.heyamiko.com"}/api/user/keys`, { headers: { Authorization: `Bearer ${authToken}` } });
75491
+ if (keysRes.ok) {
75492
+ const keysData = await keysRes.json();
75493
+ const active = keysData.keys?.find((k6) => k6.isActive !== false);
75494
+ if (active)
75495
+ keyId = active.id;
75496
+ }
75497
+ } catch {}
75498
+ }
75487
75499
  if (!keyId) {
75488
- console.log(warn("No connected API key — transfer sent but credits not verified."));
75500
+ console.log(warn("No API key found — transfer sent but credits not verified."));
75489
75501
  console.log(dim(`Tx: ${txHash}`));
75490
75502
  process.exit(0);
75491
75503
  }
75492
75504
  const spinner4 = ora("Verifying and crediting...").start();
75493
- const verifyRes = await fetch(`${auth.billingBase}/api/user/keys/${keyId}/topup/wallet`, {
75505
+ const verifyRes = await fetch(`${auth.billingBase || "https://billing.heyamiko.com"}/api/user/keys/${keyId}/topup/wallet`, {
75494
75506
  method: "POST",
75495
75507
  headers: authHeaders2,
75496
75508
  body: JSON.stringify({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyamiko/amiko-cli",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call marketplace agents",
5
5
  "type": "module",
6
6
  "bin": {