Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/self-check-server/src/x402-keuring-18-okt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,9 @@ describe("de mainnet-route, standaard uit", () => {
const routes = buildPaidRoutes(config) as any;
const accepts = routes["POST /api/paid/verify-ownership"].accepts;
expect(accepts).toHaveLength(2);
expect(accepts.map((a: { network: string }) => a.network)).toEqual([SELLER_NETWORK, MAINNET_NETWORK]);
// MAINNET VOOROP, want de officiele client kiest accepts[0]. Gemeten: onze eerste
// mainnet-poging betaalde op testnet omdat die regel vooraan stond.
expect(accepts.map((a: { network: string }) => a.network)).toEqual([MAINNET_NETWORK, SELLER_NETWORK]);
// Dezelfde prijs en hetzelfde ontvangstadres op beide, anders adverteren we twee
// verschillende aanbiedingen zonder dat iemand dat besloot.
expect(new Set(accepts.map((a: { price: string }) => a.price)).size).toBe(1);
Expand Down
19 changes: 13 additions & 6 deletions packages/self-check-server/src/x402-seller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,12 +553,13 @@ export function buildPaidRoutes(config: SellerConfig): Record<string, unknown> {
// buildOfferReceiptExtension leest context.requirements.network, dus die volgt
// automatisch de regel die de koper koos.
accepts: [
{
scheme: "exact",
price: config.price,
network: SELLER_NETWORK,
payTo: config.payTo,
},
// MAINNET VOOROP ZODRA HIJ AAN STAAT, en dat is gemeten en geen voorkeur. De
// officiele client kiest accepts[0] (zie @x402/core, getDisplayAmount en de
// selectie eromheen), dus de ORDE bepaalt waar een gewone koper betaalt. Onze
// eerste mainnet-poging ging daardoor over testnet, met mainnet op plek twee.
// Wie echt geld aanzet, wil dat een koper echt geld betaalt; een tester kiest
// de andere regel expliciet. Staat mainnet uit, dan is er maar een regel en
// verandert hier niets.
...(config.mainnet
? [
{
Expand All @@ -569,6 +570,12 @@ export function buildPaidRoutes(config: SellerConfig): Record<string, unknown> {
},
]
: []),
{
scheme: "exact",
price: config.price,
network: SELLER_NETWORK,
payTo: config.payTo,
},
],
description:
"Ownership verification with a signed receipt. The receipt is the product: the same answer is available for free at /api/verify-ownership.",
Expand Down
Loading