minara 0.2.5 → 0.2.6
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/README.md +5 -3
- package/dist/api/payment.d.ts +4 -0
- package/dist/api/payment.js +5 -1
- package/dist/commands/deposit.js +63 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
21
21
|
- **AI Chat** — Crypto-native AI for on-chain analysis, market research, and DeFi due diligence. Interactive REPL & single-shot queries with `fast` / `quality` / `thinking` modes
|
|
22
|
-
- **Wallet & Balance** — Unified balance view, spot holdings with PnL, perps account overview, deposits and
|
|
22
|
+
- **Wallet & Balance** — Unified balance view, spot holdings with PnL, perps account overview, deposits, withdrawals, and credit card on-ramp via MoonPay
|
|
23
23
|
- **Chain-Abstracted Trading** — Cross-chain swaps with automatic chain detection, perpetual futures, and limit orders. Accepts `$TICKER`, token name, or contract address
|
|
24
24
|
- **AI Autopilot & Analysis** — Fully managed AI trading strategies for perps, plus on-demand long/short analysis with one-click quick order
|
|
25
25
|
- **Market Discovery** — Trending tokens & stocks, Fear & Greed Index, on-chain metrics, and search
|
|
@@ -87,7 +87,8 @@ minara login -e user@mail.com # Email verification code
|
|
|
87
87
|
| `minara assets` | Full overview: spot holdings + perps account |
|
|
88
88
|
| `minara assets spot` | Spot wallet: portfolio value, cost, PnL, holdings |
|
|
89
89
|
| `minara assets perps` | Perps account: equity, margin, positions |
|
|
90
|
-
| `minara deposit` | Deposit to spot
|
|
90
|
+
| `minara deposit` | Deposit to spot, perps, or buy crypto with credit card |
|
|
91
|
+
| `minara deposit buy` | Buy crypto with credit card via MoonPay |
|
|
91
92
|
| `minara withdraw` | Withdraw tokens to an external wallet |
|
|
92
93
|
|
|
93
94
|
```bash
|
|
@@ -95,9 +96,10 @@ minara balance # Quick total: Spot + Perps available balance
|
|
|
95
96
|
minara assets # Full overview (spot + perps)
|
|
96
97
|
minara assets spot # Spot wallet with PnL breakdown
|
|
97
98
|
minara assets perps # Perps equity, margin, positions
|
|
98
|
-
minara deposit # Interactive: Spot
|
|
99
|
+
minara deposit # Interactive: Spot / Perps / Buy with credit card
|
|
99
100
|
minara deposit spot # Show spot wallet deposit addresses (EVM + Solana)
|
|
100
101
|
minara deposit perps # Perps: show Arbitrum deposit address, or transfer from Spot → Perps
|
|
102
|
+
minara deposit buy # Buy crypto with credit card via MoonPay (opens browser)
|
|
101
103
|
minara withdraw -c solana -t '$SOL' -a 10 --to <address>
|
|
102
104
|
minara withdraw # Interactive mode (accepts ticker or address)
|
|
103
105
|
```
|
package/dist/api/payment.d.ts
CHANGED
|
@@ -15,3 +15,7 @@ export declare function checkoutPackage(token: string, packageId: string, succes
|
|
|
15
15
|
export declare function cryptoCheckoutPackage(token: string, packageId: string): Promise<import("../types.js").ApiResponse<CryptoCheckout>>;
|
|
16
16
|
/** Cancel current subscription */
|
|
17
17
|
export declare function cancelSubscription(token: string): Promise<import("../types.js").ApiResponse<Record<string, unknown>>>;
|
|
18
|
+
/** Sign a MoonPay widget URL (backend appends HMAC signature). */
|
|
19
|
+
export declare function getMoonPaySignature(token: string, url: string): Promise<import("../types.js").ApiResponse<{
|
|
20
|
+
signature: string;
|
|
21
|
+
}>>;
|
package/dist/api/payment.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { get, del } from './client.js';
|
|
1
|
+
import { get, post, del } from './client.js';
|
|
2
2
|
/** Get all subscription plans and credit packages */
|
|
3
3
|
export function getPlans() {
|
|
4
4
|
return get('/payment/plans');
|
|
@@ -37,3 +37,7 @@ export function cryptoCheckoutPackage(token, packageId) {
|
|
|
37
37
|
export function cancelSubscription(token) {
|
|
38
38
|
return del('/payment/subscription', { token });
|
|
39
39
|
}
|
|
40
|
+
/** Sign a MoonPay widget URL (backend appends HMAC signature). */
|
|
41
|
+
export function getMoonPaySignature(token, url) {
|
|
42
|
+
return post('/payment/moonpay/signature', { token, body: { url } });
|
|
43
|
+
}
|
package/dist/commands/deposit.js
CHANGED
|
@@ -5,7 +5,7 @@ import { getAccount } from '../api/crosschain.js';
|
|
|
5
5
|
import { getCurrentUser } from '../api/auth.js';
|
|
6
6
|
import * as perpsApi from '../api/perps.js';
|
|
7
7
|
import { requireAuth } from '../config.js';
|
|
8
|
-
import { info, success, spinner, assertApiOk, wrapAction, requireTransactionConfirmation } from '../utils.js';
|
|
8
|
+
import { info, success, warn, spinner, assertApiOk, wrapAction, requireTransactionConfirmation, openBrowser } from '../utils.js';
|
|
9
9
|
import { requireTouchId } from '../touchid.js';
|
|
10
10
|
import { printTxResult } from '../formatters.js';
|
|
11
11
|
const EVM_CHAINS = 'Ethereum, Base, Arbitrum, Optimism, Polygon, Avalanche, BSC, Berachain, Blast';
|
|
@@ -52,6 +52,55 @@ async function showSpotDeposit(token) {
|
|
|
52
52
|
console.log(chalk.red(' • Sending tokens on the wrong network may result in permanent loss.'));
|
|
53
53
|
console.log('');
|
|
54
54
|
}
|
|
55
|
+
// ─── moonpay (credit card on-ramp) ───────────────────────────────────────
|
|
56
|
+
const MOONPAY_PK = 'pk_live_yIf64w79W6ufwip4j51PWbymdwGtI';
|
|
57
|
+
const MOONPAY_CURRENCIES = [
|
|
58
|
+
{ name: 'USDC (Base)', code: 'usdc_base', network: 'base' },
|
|
59
|
+
{ name: 'USDC (Ethereum)', code: 'usdc', network: 'ethereum' },
|
|
60
|
+
{ name: 'USDC (Arbitrum)', code: 'usdc_arbitrum', network: 'arbitrum' },
|
|
61
|
+
{ name: 'USDC (Polygon)', code: 'usdc_polygon', network: 'polygon' },
|
|
62
|
+
{ name: 'ETH', code: 'eth', network: 'ethereum' },
|
|
63
|
+
{ name: 'ETH (Base)', code: 'eth_base', network: 'base' },
|
|
64
|
+
{ name: 'SOL', code: 'sol', network: 'solana' },
|
|
65
|
+
];
|
|
66
|
+
async function moonPayOnRamp(token) {
|
|
67
|
+
const addrSpin = spinner('Fetching wallet address…');
|
|
68
|
+
const accountRes = await getAccount(token);
|
|
69
|
+
addrSpin.stop();
|
|
70
|
+
const account = accountRes.data;
|
|
71
|
+
const evmAddr = account?.evmAddress;
|
|
72
|
+
const solAddr = account?.solanaAddress;
|
|
73
|
+
if (!evmAddr && !solAddr) {
|
|
74
|
+
warn('No wallet address found. Your account may not be fully initialized.');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const currency = await select({
|
|
78
|
+
message: 'Currency to buy:',
|
|
79
|
+
choices: MOONPAY_CURRENCIES
|
|
80
|
+
.filter((c) => c.network === 'solana' ? !!solAddr : !!evmAddr)
|
|
81
|
+
.map((c) => ({ name: c.name, value: c })),
|
|
82
|
+
});
|
|
83
|
+
const walletAddress = currency.network === 'solana' ? solAddr : evmAddr;
|
|
84
|
+
// Build MoonPay buy URL (no walletAddress in URL — requires server-side signing
|
|
85
|
+
// which depends on backend MoonPay secret key config).
|
|
86
|
+
// User pastes their address in MoonPay's form instead.
|
|
87
|
+
const params = new URLSearchParams();
|
|
88
|
+
params.set('apiKey', MOONPAY_PK);
|
|
89
|
+
params.set('currencyCode', currency.code);
|
|
90
|
+
params.set('defaultCurrencyCode', currency.code);
|
|
91
|
+
const buyUrl = `https://buy.moonpay.com?${params.toString()}`;
|
|
92
|
+
console.log('');
|
|
93
|
+
console.log(chalk.bold('Buy Crypto with Credit Card (MoonPay)'));
|
|
94
|
+
console.log('');
|
|
95
|
+
console.log(` Currency : ${chalk.cyan(currency.name)}`);
|
|
96
|
+
console.log(` Wallet : ${chalk.yellow(walletAddress)}`);
|
|
97
|
+
console.log(chalk.dim(' ↑ Copy this address and paste it in MoonPay when prompted.'));
|
|
98
|
+
console.log('');
|
|
99
|
+
info('Opening MoonPay in your browser…');
|
|
100
|
+
openBrowser(buyUrl);
|
|
101
|
+
console.log(chalk.dim(' Complete the purchase in your browser. Funds will arrive in your Minara wallet.'));
|
|
102
|
+
console.log('');
|
|
103
|
+
}
|
|
55
104
|
// ─── perps ───────────────────────────────────────────────────────────────
|
|
56
105
|
const perpsCmd = new Command('perps')
|
|
57
106
|
.description('Deposit USDC to perps account')
|
|
@@ -128,23 +177,34 @@ async function transferSpotToPerps(token, opts) {
|
|
|
128
177
|
printTxResult(res.data);
|
|
129
178
|
}
|
|
130
179
|
// ─── parent ──────────────────────────────────────────────────────────────
|
|
180
|
+
const buyCmd = new Command('buy')
|
|
181
|
+
.description('Buy crypto with credit card via MoonPay')
|
|
182
|
+
.action(wrapAction(async () => {
|
|
183
|
+
const creds = requireAuth();
|
|
184
|
+
await moonPayOnRamp(creds.accessToken);
|
|
185
|
+
}));
|
|
131
186
|
export const depositCommand = new Command('deposit')
|
|
132
|
-
.description('Deposit to spot wallet or perps account')
|
|
187
|
+
.description('Deposit to spot wallet or perps account, or buy with credit card')
|
|
133
188
|
.addCommand(spotCmd)
|
|
134
189
|
.addCommand(perpsCmd)
|
|
190
|
+
.addCommand(buyCmd)
|
|
135
191
|
.action(wrapAction(async () => {
|
|
136
192
|
const action = await select({
|
|
137
193
|
message: 'Deposit to:',
|
|
138
194
|
choices: [
|
|
139
195
|
{ name: 'Spot wallet — view deposit addresses', value: 'spot' },
|
|
140
196
|
{ name: 'Perps wallet — view deposit address or transfer from Spot', value: 'perps' },
|
|
197
|
+
{ name: `Buy crypto with credit card ${chalk.dim('(MoonPay)')}`, value: 'buy' },
|
|
141
198
|
],
|
|
142
199
|
});
|
|
143
200
|
const creds = requireAuth();
|
|
144
201
|
if (action === 'spot') {
|
|
145
202
|
await showSpotDeposit(creds.accessToken);
|
|
146
203
|
}
|
|
147
|
-
else {
|
|
204
|
+
else if (action === 'perps') {
|
|
148
205
|
await perpsDepositFlow(creds.accessToken);
|
|
149
206
|
}
|
|
207
|
+
else {
|
|
208
|
+
await moonPayOnRamp(creds.accessToken);
|
|
209
|
+
}
|
|
150
210
|
}));
|