@wopr-network/platform-ui-core 1.24.0 → 1.24.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/package.json
CHANGED
|
@@ -145,7 +145,7 @@ describe("BuyCryptoCreditPanel", () => {
|
|
|
145
145
|
await user.click(screen.getByText("$50"));
|
|
146
146
|
await user.click(screen.getByRole("button", { name: "Pay with USDC" }));
|
|
147
147
|
|
|
148
|
-
expect(mockCreateCheckout).toHaveBeenCalledWith("base", 50);
|
|
148
|
+
expect(mockCreateCheckout).toHaveBeenCalledWith("usdc:base", 50);
|
|
149
149
|
expect(await screen.findByText("0xabc123def456")).toBeInTheDocument();
|
|
150
150
|
expect(screen.getByText("50.000000 USDC")).toBeInTheDocument();
|
|
151
151
|
});
|
|
@@ -370,7 +370,7 @@ describe("BuyCryptoCreditPanel", () => {
|
|
|
370
370
|
vi.useRealTimers();
|
|
371
371
|
});
|
|
372
372
|
|
|
373
|
-
it("calls createCheckout with
|
|
373
|
+
it("calls createCheckout with methodId", async () => {
|
|
374
374
|
mockGetSupportedPaymentMethods.mockResolvedValue([MOCK_ETH_METHOD]);
|
|
375
375
|
mockCreateCheckout.mockResolvedValue({
|
|
376
376
|
depositAddress: "0xdef456",
|
|
@@ -391,6 +391,6 @@ describe("BuyCryptoCreditPanel", () => {
|
|
|
391
391
|
await user.click(screen.getByText("$100"));
|
|
392
392
|
await user.click(screen.getByRole("button", { name: "Pay with ETH" }));
|
|
393
393
|
|
|
394
|
-
expect(mockCreateCheckout).toHaveBeenCalledWith("base", 100);
|
|
394
|
+
expect(mockCreateCheckout).toHaveBeenCalledWith("eth:base", 100);
|
|
395
395
|
});
|
|
396
396
|
});
|
|
@@ -119,7 +119,7 @@ export function BuyCryptoCreditPanel() {
|
|
|
119
119
|
setLoading(true);
|
|
120
120
|
setError(null);
|
|
121
121
|
try {
|
|
122
|
-
const result = await createCheckout(selectedMethod.
|
|
122
|
+
const result = await createCheckout(selectedMethod.id, selectedAmount);
|
|
123
123
|
setCheckout(result);
|
|
124
124
|
} catch {
|
|
125
125
|
setError("Checkout failed. Please try again.");
|
package/src/lib/api.ts
CHANGED
|
@@ -1364,8 +1364,8 @@ export interface CheckoutResult {
|
|
|
1364
1364
|
priceCents?: number;
|
|
1365
1365
|
}
|
|
1366
1366
|
|
|
1367
|
-
export async function createCheckout(
|
|
1368
|
-
return trpcVanilla.billing.checkout.mutate({
|
|
1367
|
+
export async function createCheckout(methodId: string, amountUsd: number): Promise<CheckoutResult> {
|
|
1368
|
+
return trpcVanilla.billing.checkout.mutate({ methodId, amountUsd });
|
|
1369
1369
|
}
|
|
1370
1370
|
|
|
1371
1371
|
// --- Charge status polling ---
|