x402-surface-check 0.2.5 → 0.2.6
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.
|
@@ -382,13 +382,14 @@ function hasPaymentChallenge(result) {
|
|
|
382
382
|
function challengeSummary(result) {
|
|
383
383
|
const challenge = result.body.json
|
|
384
384
|
const firstAccept = challenge?.accepts?.[0] ?? {}
|
|
385
|
+
const hasChallenge = hasPaymentChallenge(result)
|
|
385
386
|
const amount = firstAccept.amount ?? firstAccept.maxAmountRequired ?? firstAccept.maxAmount ?? ''
|
|
386
387
|
const resourceUrl = challenge?.resource?.url ?? firstAccept.resource ?? ''
|
|
387
388
|
const extraResource = firstAccept.extra?.resource ?? firstAccept.resource ?? ''
|
|
388
389
|
|
|
389
390
|
return {
|
|
390
391
|
status: result.status,
|
|
391
|
-
protocol: challenge?.protocol ?? (firstAccept.scheme === 'mpp' ? 'mpp' : 'x402'),
|
|
392
|
+
protocol: hasChallenge ? challenge?.protocol ?? (firstAccept.scheme === 'mpp' ? 'mpp' : 'x402') : '',
|
|
392
393
|
resourceUrl,
|
|
393
394
|
network: firstAccept.network ?? '',
|
|
394
395
|
amount,
|