@heyamiko/amiko-cli 0.9.1 → 0.9.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 +26 -34
- package/package.json +1 -1
- package/skills/SKILL.md +4 -3
package/dist/index.js
CHANGED
|
@@ -19158,6 +19158,22 @@ async function mppCreditsTopup(params) {
|
|
|
19158
19158
|
}
|
|
19159
19159
|
}
|
|
19160
19160
|
|
|
19161
|
+
// src/lib/price.ts
|
|
19162
|
+
var DEFAULT_PLATFORM_URL2 = "https://platform.heyamiko.com";
|
|
19163
|
+
async function getTokenUsdPrice(auth, symbolOrMint) {
|
|
19164
|
+
const base = (auth.platformUrl || DEFAULT_PLATFORM_URL2).replace(/\/$/, "");
|
|
19165
|
+
const param = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(symbolOrMint) ? `mint=${encodeURIComponent(symbolOrMint)}` : `symbol=${encodeURIComponent(symbolOrMint)}`;
|
|
19166
|
+
try {
|
|
19167
|
+
const res = await fetch(`${base}/api/prices/token?${param}`);
|
|
19168
|
+
if (!res.ok)
|
|
19169
|
+
return null;
|
|
19170
|
+
const data = await res.json();
|
|
19171
|
+
return typeof data.price === "number" ? data.price : null;
|
|
19172
|
+
} catch {
|
|
19173
|
+
return null;
|
|
19174
|
+
}
|
|
19175
|
+
}
|
|
19176
|
+
|
|
19161
19177
|
// src/commands/credits.ts
|
|
19162
19178
|
function promptYesNo2(question) {
|
|
19163
19179
|
if (!process.stdin.isTTY)
|
|
@@ -19242,34 +19258,19 @@ function registerCreditsCommand(program2) {
|
|
|
19242
19258
|
pricePerToken = 1;
|
|
19243
19259
|
} else {
|
|
19244
19260
|
const spinner2 = ora(`Fetching ${token} price...`).start();
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
AMIKO: "AY1Ww6MxwC3cCiyrandHqLrp4FXvzgcwQTZpJ2FEpump",
|
|
19248
|
-
SOL: "So11111111111111111111111111111111111111112"
|
|
19249
|
-
};
|
|
19250
|
-
const USDC_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
19251
|
-
const mint = MINTS[token.toUpperCase()];
|
|
19252
|
-
if (!mint) {
|
|
19253
|
-
spinner2.stop();
|
|
19254
|
-
console.error(error(`Unknown token: ${token}`));
|
|
19255
|
-
process.exit(1);
|
|
19256
|
-
}
|
|
19257
|
-
const decimals = token.toUpperCase() === "SOL" ? 9 : 6;
|
|
19258
|
-
const oneToken = Math.pow(10, decimals).toString();
|
|
19259
|
-
const jupRes = await fetch(`https://lite-api.jup.ag/swap/v1/quote?inputMint=${mint}&outputMint=${USDC_MINT}&amount=${oneToken}&slippageBps=100`);
|
|
19260
|
-
if (!jupRes.ok) {
|
|
19261
|
-
spinner2.stop();
|
|
19262
|
-
console.error(error("Failed to fetch token price"));
|
|
19263
|
-
process.exit(1);
|
|
19264
|
-
}
|
|
19265
|
-
const jupData = await jupRes.json();
|
|
19266
|
-
pricePerToken = parseFloat(jupData.outAmount) / 1e6;
|
|
19267
|
-
spinner2.stop();
|
|
19268
|
-
} catch {
|
|
19261
|
+
const supported = ["AMIKO", "SOL"];
|
|
19262
|
+
if (!supported.includes(token.toUpperCase())) {
|
|
19269
19263
|
spinner2.stop();
|
|
19264
|
+
console.error(error(`Unknown token: ${token}`));
|
|
19265
|
+
process.exit(1);
|
|
19266
|
+
}
|
|
19267
|
+
const price = await getTokenUsdPrice(auth, token.toUpperCase());
|
|
19268
|
+
spinner2.stop();
|
|
19269
|
+
if (price == null || price <= 0) {
|
|
19270
19270
|
console.error(error("Failed to fetch token price"));
|
|
19271
19271
|
process.exit(1);
|
|
19272
19272
|
}
|
|
19273
|
+
pricePerToken = price;
|
|
19273
19274
|
}
|
|
19274
19275
|
let creditsAmount;
|
|
19275
19276
|
let usdAmount;
|
|
@@ -20160,15 +20161,6 @@ function registerAmazonCommand(program2) {
|
|
|
20160
20161
|
|
|
20161
20162
|
// src/commands/services.ts
|
|
20162
20163
|
var TREASURY4 = "FPiZAf3jEnNfCwfvbv46jdPfHbmSepD4Q6iHiLJDQXvb";
|
|
20163
|
-
var AMIKO_MINT = "AY1Ww6MxwC3cCiyrandHqLrp4FXvzgcwQTZpJ2FEpump";
|
|
20164
|
-
var USDC_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
20165
|
-
async function getAmikoPrice() {
|
|
20166
|
-
const res = await fetch(`https://lite-api.jup.ag/swap/v1/quote?inputMint=${AMIKO_MINT}&outputMint=${USDC_MINT}&amount=${1e6}&slippageBps=100`);
|
|
20167
|
-
if (!res.ok)
|
|
20168
|
-
return 0;
|
|
20169
|
-
const data = await res.json();
|
|
20170
|
-
return parseFloat(data.outAmount) / 1e6;
|
|
20171
|
-
}
|
|
20172
20164
|
function usdToAmiko(usd2, pricePerAmiko) {
|
|
20173
20165
|
if (pricePerAmiko <= 0)
|
|
20174
20166
|
return "1";
|
|
@@ -20187,7 +20179,7 @@ async function payAndCall(mppBase2, method, path2, auth, wallet, amountOrAuto, b
|
|
|
20187
20179
|
const methodSpec = pathSpec?.[method.toLowerCase()];
|
|
20188
20180
|
const usdPrice = parseFloat(methodSpec?.["x-payment-info"]?.price || "0");
|
|
20189
20181
|
if (usdPrice > 0) {
|
|
20190
|
-
const amikoPrice = await
|
|
20182
|
+
const amikoPrice = await getTokenUsdPrice(auth, "AMIKO") ?? 0;
|
|
20191
20183
|
amount2 = usdToAmiko(usdPrice, amikoPrice);
|
|
20192
20184
|
onProgress?.(`Price: $${usdPrice.toFixed(4)} = ${amount2} AMIKO`);
|
|
20193
20185
|
} else {
|
package/package.json
CHANGED
package/skills/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: amiko-cli
|
|
3
|
-
description: The Amiko CLI lets an agent act on the Amiko platform end-to-end — manage Solana/Base wallets (create, swap via Jupiter, bridge USDC via Across), top up and spend credits, call paid MPP marketplace services (X/Twitter search, image generation, Amazon product search, TTS/STT, AI chat, SFX/music), manage the twin's identity and RAG documents, voice and avatar, social graph (friends, posts, comments, feed), and Composio OAuth connections. Auth is automatic when run from the agent's workspace folder; payments are platform-custodied (no keys on disk). Use this skill whenever the user asks to do anything that would show up in their Amiko account or cost AMIKO/credits.
|
|
3
|
+
description: The Amiko CLI lets an agent act on the Amiko platform end-to-end — manage Solana/Base wallets (create, swap via Jupiter, bridge USDC via Across, transfer tokens to external addresses), top up and spend credits, call paid MPP marketplace services (X/Twitter search, image generation, Amazon product search, TTS/STT, AI chat, SFX/music), manage the twin's identity and RAG documents, voice and avatar, social graph (friends, posts, comments, feed), and Composio OAuth connections. Auth is automatic when run from the agent's workspace folder; payments are platform-custodied (no keys on disk). Use this skill whenever the user asks to do anything that would show up in their Amiko account or cost AMIKO/credits.
|
|
4
4
|
homepage: https://platform.heyamiko.com
|
|
5
5
|
metadata: {"openclaw":{"emoji":"🤖","requires":{"bins":["node"]}}}
|
|
6
6
|
---
|
|
@@ -20,7 +20,7 @@ Each row is a first-level command group or command. Start here when the user ask
|
|
|
20
20
|
| Command | What it does |
|
|
21
21
|
|---------|--------------|
|
|
22
22
|
| `amiko markets <cmd>` | Paid MPP services: X search, image gen, Amazon, TTS/STT/chat, generic service call, discover |
|
|
23
|
-
| `amiko wallets <cmd>` | Wallet ops: create, list, sync balance, swap on Solana (Jupiter), bridge USDC cross-chain (Across) |
|
|
23
|
+
| `amiko wallets <cmd>` | Wallet ops: create, list, sync balance, transfer tokens out, swap on Solana (Jupiter), bridge USDC cross-chain (Across) |
|
|
24
24
|
| `amiko credits <cmd>` | Show credit balance, top up with AMIKO/SOL/USDC/USDT (10,000 credits = $1) |
|
|
25
25
|
| `amiko twin <cmd>` | Update the twin's identity — name, description, public visibility |
|
|
26
26
|
| `amiko docs <cmd>` | Manage twin RAG documents — list, upload (path/URL/stdin), delete, presign |
|
|
@@ -40,7 +40,7 @@ All twin-scoped commands accept `--twin <id>` to target a non-default twin.
|
|
|
40
40
|
|
|
41
41
|
## The `--wallet` default (read this before any paid command)
|
|
42
42
|
|
|
43
|
-
Every paid command (`markets search`, `markets image`, `markets amazon search`, `markets service *`, `wallets swap send`) spends tokens from an on-chain wallet. As of v0.9.0-beta.9 you almost never need to pass `--wallet` explicitly:
|
|
43
|
+
Every paid / value-moving command (`markets search`, `markets image`, `markets amazon search`, `markets service *`, `wallets swap send`, `wallets bridge send`, `wallets transfer`) spends tokens from an on-chain wallet. As of v0.9.0-beta.9 you almost never need to pass `--wallet` explicitly:
|
|
44
44
|
|
|
45
45
|
- **Default**: the CLI auto-selects the twin's first active **Solana** wallet from `GET /api/agents/{id}/wallets`.
|
|
46
46
|
- **Override**: pass `--wallet <address>` only if you want a different wallet than the default.
|
|
@@ -121,6 +121,7 @@ amiko wallets bridge limits
|
|
|
121
121
|
|
|
122
122
|
- `wallets list` returns **cached** balances (platform doesn't auto-sync). If they look stale, run `wallets balance <address>` to force a sync for that wallet.
|
|
123
123
|
- `wallets create` is one-shot per `chain+custodian` pair (409 if one already exists) — run once for the twin and reuse.
|
|
124
|
+
- `wallets transfer` sends tokens from a twin wallet to an external address. Only Crossmint-custodied wallets are supported (agent-signed on the server). `--wallet` defaults to your Solana wallet; pass `--chain base` + `--wallet` to send from a Base wallet. `--token` accepts symbols (`sol`, `usdc`, `usdt`, `amiko` on Solana; `eth` on Base) or a raw mint/contract address. Returns a tx hash once the transaction lands on-chain. Paid/destructive — requires `--yes` in non-interactive shells.
|
|
124
125
|
- Swaps run via Jupiter on Solana. Supported: SOL, USDC, USDT, AMIKO, PYUSD, BONK, JUP, RAY, JitoSOL — or any mint address.
|
|
125
126
|
- Bridging goes through Across Protocol. Solana ↔ EVM requires `--recipient` (different address formats).
|
|
126
127
|
|