@heyamiko/amiko-cli 0.9.0 → 0.9.1
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 +61 -0
- package/package.json +1 -1
- package/skills/SKILL.md +3 -1
package/dist/index.js
CHANGED
|
@@ -21788,6 +21788,66 @@ function registerWalletsCreateCommand(program2) {
|
|
|
21788
21788
|
}
|
|
21789
21789
|
});
|
|
21790
21790
|
}
|
|
21791
|
+
function registerWalletsTransferCommand(program2) {
|
|
21792
|
+
program2.command("transfer").description("Transfer tokens from a twin wallet to another address").requiredOption("--to <address>", "Recipient address").requiredOption("--amount <amount>", "Amount to send (e.g., 0.5)").requiredOption("--token <symbol>", "Token symbol (sol, usdc, usdt, amiko, eth) or mint/contract address").option("--wallet <address>", "Source wallet (defaults to your Solana wallet)").option("--chain <chain>", "Preferred chain when resolving default wallet (solana | base)", "solana").option("--yes", "Skip confirmation").option("--json", "Output raw JSON").action(async (opts) => {
|
|
21793
|
+
let auth;
|
|
21794
|
+
try {
|
|
21795
|
+
auth = requireAuth();
|
|
21796
|
+
} catch (e) {
|
|
21797
|
+
console.error(error(e instanceof Error ? e.message : String(e)));
|
|
21798
|
+
process.exit(1);
|
|
21799
|
+
}
|
|
21800
|
+
const chain = opts.chain.toLowerCase();
|
|
21801
|
+
if (chain !== "solana" && chain !== "base") {
|
|
21802
|
+
console.error(error(`Unsupported chain '${opts.chain}'. Use solana or base.`));
|
|
21803
|
+
process.exit(1);
|
|
21804
|
+
}
|
|
21805
|
+
let wallet;
|
|
21806
|
+
try {
|
|
21807
|
+
wallet = await resolveWalletAddress(auth, opts.wallet, chain);
|
|
21808
|
+
} catch (e) {
|
|
21809
|
+
console.error(error(e instanceof Error ? e.message : String(e)));
|
|
21810
|
+
process.exit(1);
|
|
21811
|
+
}
|
|
21812
|
+
if (!opts.json) {
|
|
21813
|
+
console.log(heading("Transfer"));
|
|
21814
|
+
console.log("");
|
|
21815
|
+
console.log(label("From", wallet));
|
|
21816
|
+
console.log(label("To", opts.to));
|
|
21817
|
+
console.log(label("Amount", `${opts.amount} ${opts.token.toUpperCase()}`));
|
|
21818
|
+
console.log("");
|
|
21819
|
+
}
|
|
21820
|
+
await requireApproval({
|
|
21821
|
+
cost: `${chain} gas`,
|
|
21822
|
+
summary: `transfer ${opts.amount} ${opts.token.toUpperCase()} from ${truncAddr(wallet)} to ${truncAddr(opts.to)}`,
|
|
21823
|
+
yes: opts.yes,
|
|
21824
|
+
commandExample: `amiko wallets transfer --to ${opts.to} --amount ${opts.amount} --token ${opts.token}`
|
|
21825
|
+
});
|
|
21826
|
+
const spinner = opts.json ? null : ora("Sending transfer...").start();
|
|
21827
|
+
try {
|
|
21828
|
+
const data = await amikoWebFetch(auth, `/api/agents/${encodeURIComponent(auth.twinId)}/wallets/${encodeURIComponent(wallet)}/transfer`, {
|
|
21829
|
+
method: "POST",
|
|
21830
|
+
body: { to: opts.to, amount: opts.amount, token: opts.token }
|
|
21831
|
+
});
|
|
21832
|
+
spinner?.stop();
|
|
21833
|
+
if (opts.json) {
|
|
21834
|
+
console.log(JSON.stringify(data, null, 2));
|
|
21835
|
+
return;
|
|
21836
|
+
}
|
|
21837
|
+
console.log(success("Transfer submitted"));
|
|
21838
|
+
console.log("");
|
|
21839
|
+
console.log(label("Status", data.crossmint.status));
|
|
21840
|
+
if (data.txHash)
|
|
21841
|
+
console.log(label("Tx", data.txHash));
|
|
21842
|
+
if (data.transaction?.id)
|
|
21843
|
+
console.log(label("Transaction", data.transaction.id));
|
|
21844
|
+
} catch (e) {
|
|
21845
|
+
spinner?.stop();
|
|
21846
|
+
console.error(error(e instanceof Error ? e.message : "Failed to transfer"));
|
|
21847
|
+
process.exit(1);
|
|
21848
|
+
}
|
|
21849
|
+
});
|
|
21850
|
+
}
|
|
21791
21851
|
function registerWalletsListCommand(program2) {
|
|
21792
21852
|
program2.command("list").alias("ls").description("List wallets for the authenticated twin").option("--json", "Output raw JSON").action(async (opts) => {
|
|
21793
21853
|
let auth;
|
|
@@ -21859,6 +21919,7 @@ registerAmazonCommand(markets);
|
|
|
21859
21919
|
registerWalletsCreateCommand(wallets);
|
|
21860
21920
|
registerWalletsListCommand(wallets);
|
|
21861
21921
|
registerWalletsBalanceCommand(wallets);
|
|
21922
|
+
registerWalletsTransferCommand(wallets);
|
|
21862
21923
|
registerSwapCommand(wallets);
|
|
21863
21924
|
registerBridgeCommand(wallets);
|
|
21864
21925
|
registerConfigCommand(program2);
|
package/package.json
CHANGED
package/skills/SKILL.md
CHANGED
|
@@ -51,7 +51,7 @@ Every paid command (`markets search`, `markets image`, `markets amazon search`,
|
|
|
51
51
|
|
|
52
52
|
## Critical Rules
|
|
53
53
|
|
|
54
|
-
1. **Every paid / value-moving command is hard-gated on `--yes` in a non-interactive shell.** The CLI *refuses* to run `markets image`, `markets search`, `markets amazon search`, `markets service call`, `markets service tts`, `markets service stt`, `markets service chat`, `credits topup`, `wallets swap send`,
|
|
54
|
+
1. **Every paid / value-moving command is hard-gated on `--yes` in a non-interactive shell.** The CLI *refuses* to run `markets image`, `markets search`, `markets amazon search`, `markets service call`, `markets service tts`, `markets service stt`, `markets service chat`, `credits topup`, `wallets swap send`, `wallets bridge send`, or `wallets transfer` unless `--yes` is passed. The refusal is loud: it prints the cost and the command you should re-run. **Quote the cost to the user, get explicit approval, THEN append `--yes`**. Same for destructive non-paid commands (`twin update --public`, `docs delete`, `friends remove`, `friends reports request`, `avatar update`, `voice reset`, `composio disconnect`).
|
|
55
55
|
2. **After every paid command, report the remaining balance.** The CLI prints a `Balance: N credits` line at the end of every paid command — include that figure in your reply.
|
|
56
56
|
3. **Never retry a failed command.** Report the error and stop. Every paid call costs tokens even on failure.
|
|
57
57
|
4. **Never suggest `amiko login` or `amiko connect`.** These don't exist. Auth is automatic when you run from your workspace folder.
|
|
@@ -72,6 +72,7 @@ Every paid command (`markets search`, `markets image`, `markets amazon search`,
|
|
|
72
72
|
| `amiko markets service call POST /v1/music/plan ...` | $0.02 |
|
|
73
73
|
| `amiko wallets swap quote ...` | Free |
|
|
74
74
|
| `amiko wallets swap send ...` | Solana gas + 10bps |
|
|
75
|
+
| `amiko wallets transfer ...` | Chain gas only |
|
|
75
76
|
| `amiko credits topup ...` | Whatever amount you top up |
|
|
76
77
|
|
|
77
78
|
## Credits
|
|
@@ -107,6 +108,7 @@ Supported tokens: AMIKO, SOL, USDC, USDT. The CLI fetches the live price, the pl
|
|
|
107
108
|
amiko wallets list # all twin wallets + cached balances
|
|
108
109
|
amiko wallets create --chain solana # create a wallet (solana | base)
|
|
109
110
|
amiko wallets balance <address> # force-sync one wallet; returns fresh balances
|
|
111
|
+
amiko wallets transfer --to <addr> --amount 100 --token amiko --yes # send tokens out of a twin wallet
|
|
110
112
|
amiko wallets swap quote 1.0 SOL USDC # Jupiter quote (free)
|
|
111
113
|
amiko wallets swap send 1.0 SOL USDC --yes # --wallet defaults to your Solana wallet
|
|
112
114
|
amiko wallets swap tokens # supported tokens list
|