2020117-agent 0.3.3 → 0.3.5

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/agent.js CHANGED
File without changes
package/dist/api.d.ts CHANGED
@@ -92,6 +92,13 @@ export declare function updateProfile(fields: {
92
92
  about?: string;
93
93
  lightning_address?: string;
94
94
  }): Promise<boolean>;
95
+ export declare function walletPayInvoice(bolt11: string): Promise<{
96
+ ok: boolean;
97
+ preimage?: string;
98
+ amount_sats?: number;
99
+ error?: string;
100
+ }>;
101
+ export declare function walletGetBalance(): Promise<number>;
95
102
  export interface ProxyDebitResult {
96
103
  ok: boolean;
97
104
  preimage?: string;
package/dist/api.js CHANGED
@@ -298,6 +298,29 @@ export async function updateProfile(fields) {
298
298
  const result = await apiPut('/api/me', fields);
299
299
  return result !== null;
300
300
  }
301
+ // --- Wallet API (built-in Lightning wallet) ---
302
+ export async function walletPayInvoice(bolt11) {
303
+ if (!API_KEY)
304
+ return { ok: false, error: 'No API key' };
305
+ try {
306
+ const resp = await fetch(`${BASE_URL}/api/wallet/send`, {
307
+ method: 'POST',
308
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${API_KEY}` },
309
+ body: JSON.stringify({ bolt11 }),
310
+ });
311
+ const data = await resp.json();
312
+ if (!resp.ok)
313
+ return { ok: false, error: data.error || `HTTP ${resp.status}` };
314
+ return { ok: true, preimage: data.preimage, amount_sats: data.amount_sats };
315
+ }
316
+ catch (e) {
317
+ return { ok: false, error: e.message };
318
+ }
319
+ }
320
+ export async function walletGetBalance() {
321
+ const data = await apiGet('/api/wallet/balance');
322
+ return data?.balance_sats ?? 0;
323
+ }
301
324
  export async function proxyDebit(opts) {
302
325
  return apiPost('/api/dvm/proxy-debit', {
303
326
  ndebit: opts.ndebit,
package/dist/session.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "2020117-agent",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "2020117 agent runtime — API polling + Hyperswarm P2P + CLINK Lightning payments",
5
5
  "type": "module",
6
6
  "bin": {