SDK
Truy cập Xona Wallet bằng lập trình có kiểu dữ liệu, gồm khám phá, thanh toán x402, chuyển tiền và báo cáo.
CLI là một lớp vỏ mỏng bên trên SDK, mọi lệnh đều có phiên bản tương đương bằng lập trình. Một điểm vào duy nhất, có kiểu đầy đủ.
import { createXPay, loadProfile } from "@xona-labs/xpay";
const xpay = createXPay({
profile: await loadProfile({ passphrase }),
});
// pay any x402 endpoint, get the result
const video = await xpay.useByUrl(
"https://api.xona-agent.com/video/short-generation",
{ body: { prompt: "a cat astronaut" } }
);Những API khác bạn sẽ thường dùng:
await xpay.discover({ query: "weather" });
await xpay.do("translate this PDF to Japanese");
await xpay.transfer({ amount: 1, to, token: "USDC" });
await xpay.report({ period: "weekly" }); // daily | weekly | monthly
await xpay.wallet.balance("solana");Các agent runtime có sẵn định nghĩa tool hạng nhất: forClaude(xpay), forOpenAI(xpay) và forGemini(xpay), cùng handler, schema theo định dạng của từng nhà cung cấp.