Spaces:
Sleeping
Sleeping
feat: OpenZeppelin x402 mainnet support — update server.js
Browse files
server.js
CHANGED
|
@@ -6,7 +6,12 @@ import { ExactStellarScheme } from "@x402/stellar/exact/server";
|
|
| 6 |
import { Transaction, Address } from "@stellar/stellar-sdk";
|
| 7 |
import { renderUrl, closeBrowser } from "./renderer.js";
|
| 8 |
import { isFailedRender, sendRefund } from "./refund.js";
|
| 9 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
import { isAllowedUrl } from "./url-policy.js";
|
| 11 |
|
| 12 |
const PORT = process.env.PORT || 3001;
|
|
@@ -93,7 +98,14 @@ app.use(
|
|
| 93 |
description: "Render a JS-heavy webpage and return extracted content",
|
| 94 |
},
|
| 95 |
},
|
| 96 |
-
new HTTPFacilitatorClient({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
[{ network: NETWORK, server: new ExactStellarScheme() }],
|
| 98 |
),
|
| 99 |
);
|
|
|
|
| 6 |
import { Transaction, Address } from "@stellar/stellar-sdk";
|
| 7 |
import { renderUrl, closeBrowser } from "./renderer.js";
|
| 8 |
import { isFailedRender, sendRefund } from "./refund.js";
|
| 9 |
+
import {
|
| 10 |
+
NETWORK,
|
| 11 |
+
NETWORK_PASSPHRASE,
|
| 12 |
+
FACILITATOR_URL,
|
| 13 |
+
FACILITATOR_API_KEY,
|
| 14 |
+
} from "./network-config.js";
|
| 15 |
import { isAllowedUrl } from "./url-policy.js";
|
| 16 |
|
| 17 |
const PORT = process.env.PORT || 3001;
|
|
|
|
| 98 |
description: "Render a JS-heavy webpage and return extracted content",
|
| 99 |
},
|
| 100 |
},
|
| 101 |
+
new HTTPFacilitatorClient({
|
| 102 |
+
url: FACILITATOR_URL,
|
| 103 |
+
...(FACILITATOR_API_KEY && {
|
| 104 |
+
createAuthHeaders: async () => ({
|
| 105 |
+
headers: { Authorization: `Bearer ${FACILITATOR_API_KEY}` },
|
| 106 |
+
}),
|
| 107 |
+
}),
|
| 108 |
+
}),
|
| 109 |
[{ network: NETWORK, server: new ExactStellarScheme() }],
|
| 110 |
),
|
| 111 |
);
|