@t2000/engine 0.36.2 → 0.36.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 +14 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2453,22 +2453,23 @@ var listPaymentLinksTool = buildTool({
|
|
|
2453
2453
|
async call(_input, context) {
|
|
2454
2454
|
const apiUrl = context.env?.ALLOWANCE_API_URL;
|
|
2455
2455
|
if (!apiUrl || !context.walletAddress) {
|
|
2456
|
-
return { data: {
|
|
2456
|
+
return { data: { links: [] }, displayText: "No payment links found." };
|
|
2457
2457
|
}
|
|
2458
2458
|
try {
|
|
2459
2459
|
const res = await fetch(`${apiUrl}/api/internal/payments?type=link`, {
|
|
2460
2460
|
signal: context.signal,
|
|
2461
2461
|
headers: internalHeaders(context)
|
|
2462
2462
|
});
|
|
2463
|
-
if (!res.ok) return { data: {
|
|
2464
|
-
const
|
|
2465
|
-
const
|
|
2463
|
+
if (!res.ok) return { data: { links: [] }, displayText: "Could not fetch payment links." };
|
|
2464
|
+
const raw = await res.json();
|
|
2465
|
+
const links = raw.payments;
|
|
2466
|
+
const count = links.length;
|
|
2466
2467
|
return {
|
|
2467
|
-
data,
|
|
2468
|
+
data: { links },
|
|
2468
2469
|
displayText: count === 0 ? "No payment links yet." : `${count} payment link${count !== 1 ? "s" : ""} found.`
|
|
2469
2470
|
};
|
|
2470
2471
|
} catch {
|
|
2471
|
-
return { data: {
|
|
2472
|
+
return { data: { links: [] }, displayText: "Could not fetch payment links." };
|
|
2472
2473
|
}
|
|
2473
2474
|
}
|
|
2474
2475
|
});
|
|
@@ -2617,22 +2618,23 @@ var listInvoicesTool = buildTool({
|
|
|
2617
2618
|
async call(_input, context) {
|
|
2618
2619
|
const apiUrl = context.env?.ALLOWANCE_API_URL;
|
|
2619
2620
|
if (!apiUrl || !context.walletAddress) {
|
|
2620
|
-
return { data: {
|
|
2621
|
+
return { data: { invoices: [] }, displayText: "No invoices found." };
|
|
2621
2622
|
}
|
|
2622
2623
|
try {
|
|
2623
2624
|
const res = await fetch(`${apiUrl}/api/internal/payments?type=invoice`, {
|
|
2624
2625
|
signal: context.signal,
|
|
2625
2626
|
headers: internalHeaders(context)
|
|
2626
2627
|
});
|
|
2627
|
-
if (!res.ok) return { data: {
|
|
2628
|
-
const
|
|
2629
|
-
const
|
|
2628
|
+
if (!res.ok) return { data: { invoices: [] }, displayText: "Could not fetch invoices." };
|
|
2629
|
+
const raw = await res.json();
|
|
2630
|
+
const invoices = raw.payments;
|
|
2631
|
+
const count = invoices.length;
|
|
2630
2632
|
return {
|
|
2631
|
-
data,
|
|
2633
|
+
data: { invoices },
|
|
2632
2634
|
displayText: count === 0 ? "No invoices yet." : `${count} invoice${count !== 1 ? "s" : ""} found.`
|
|
2633
2635
|
};
|
|
2634
2636
|
} catch {
|
|
2635
|
-
return { data: {
|
|
2637
|
+
return { data: { invoices: [] }, displayText: "Could not fetch invoices." };
|
|
2636
2638
|
}
|
|
2637
2639
|
}
|
|
2638
2640
|
});
|