uvd-x402-sdk 2.66.0 → 2.69.0
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/README.md +5 -2
- package/dist/backend/index.d.mts +36 -4
- package/dist/backend/index.d.ts +36 -4
- package/dist/backend/index.js +79 -24
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs +79 -25
- package/dist/backend/index.mjs.map +1 -1
- package/dist/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/backend/index.ts +116 -17
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Users sign a message or transaction, and the Ultravioleta facilitator handles on
|
|
|
14
14
|
- **React & Wagmi**: First-class integrations
|
|
15
15
|
- **Signing Wallet Adapters**: EnvKeyAdapter (server/CLI), OWSWalletAdapter (Open Wallet Standard), or bring your own
|
|
16
16
|
- **ERC-8128 Signed Requests**: Authenticate HTTP requests with a wallet (RFC 9421 + EIP-191) — no API keys
|
|
17
|
-
- **ERC-8004 Trustless Agents**: On-chain reputation and identity across
|
|
17
|
+
- **ERC-8004 Trustless Agents**: On-chain reputation and identity across 21 networks (19 EVM + 2 Solana)
|
|
18
18
|
- **Escrow & Refunds**: Hold payments with dispute resolution
|
|
19
19
|
- **Advanced Escrow**: Full escrow lifecycle (authorize, release, refund, charge) with SigningWalletAdapter support
|
|
20
20
|
- **Escrow Pre-Auth**: Sign-on-assignment `X-Payment-Auth` builder (`buildEscrowPreAuth`) — vector-pinned parity with the Python SDK and Execution Market
|
|
@@ -871,7 +871,10 @@ try {
|
|
|
871
871
|
|
|
872
872
|
## ERC-8004 Trustless Agents
|
|
873
873
|
|
|
874
|
-
Build verifiable on-chain reputation for AI agents and services. Supports **
|
|
874
|
+
Build verifiable on-chain reputation for AI agents and services. Supports **21 networks** (19 EVM + 2 Solana).
|
|
875
|
+
|
|
876
|
+
> Name Base as `'base'`. The old `'base-mainnet'` spelling is rejected by the facilitator
|
|
877
|
+
> (`400 Invalid network`); the SDK now rewrites it for you, but new code should use `'base'`.
|
|
875
878
|
|
|
876
879
|
On EVM networks, agent IDs are sequential numbers. On Solana, agent IDs are base58 pubkey strings. The `AgentId` type (`number | string`) handles both.
|
|
877
880
|
|
package/dist/backend/index.d.mts
CHANGED
|
@@ -60,7 +60,24 @@ interface SettleResponse {
|
|
|
60
60
|
success: boolean;
|
|
61
61
|
transactionHash?: string;
|
|
62
62
|
network?: string;
|
|
63
|
+
/** Transport-level failure (unreachable facilitator, non-2xx, timeout). */
|
|
63
64
|
error?: string;
|
|
65
|
+
/**
|
|
66
|
+
* The facilitator's own reason when it settled nothing — e.g. a transfer that
|
|
67
|
+
* mined and reverted. Distinct from `error` above, which is this client
|
|
68
|
+
* failing to ask; this one is the facilitator answering "no".
|
|
69
|
+
*/
|
|
70
|
+
errorReason?: string;
|
|
71
|
+
/** The address the facilitator confirmed as the payer. */
|
|
72
|
+
payer?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Settlement proof, present when the ERC-8004 extension asked for it.
|
|
75
|
+
*
|
|
76
|
+
* Typed here rather than only on {@link SettleResponseWithProof} because
|
|
77
|
+
* `settle()` returns it whenever the facilitator sends it, and it is what
|
|
78
|
+
* DX402's `anchorEvidence` needs to reach `verified: true`.
|
|
79
|
+
*/
|
|
80
|
+
proofOfPayment?: ProofOfPayment;
|
|
64
81
|
}
|
|
65
82
|
/**
|
|
66
83
|
* Options for building payment requirements
|
|
@@ -1340,7 +1357,7 @@ declare const ERC8004_EXTENSION_ID = "8004-reputation";
|
|
|
1340
1357
|
*/
|
|
1341
1358
|
type AgentId = number | string;
|
|
1342
1359
|
/**
|
|
1343
|
-
* ERC-8004 contract addresses per network (
|
|
1360
|
+
* ERC-8004 contract addresses per network (21 networks: 19 EVM + 2 Solana)
|
|
1344
1361
|
*/
|
|
1345
1362
|
declare const ERC8004_CONTRACTS: Record<string, {
|
|
1346
1363
|
identityRegistry?: string;
|
|
@@ -1350,9 +1367,24 @@ declare const ERC8004_CONTRACTS: Record<string, {
|
|
|
1350
1367
|
atomEngineProgram?: string;
|
|
1351
1368
|
}>;
|
|
1352
1369
|
/**
|
|
1353
|
-
*
|
|
1370
|
+
* Return the network name the facilitator actually accepts.
|
|
1371
|
+
*
|
|
1372
|
+
* `base-mainnet` reads like the canonical spelling and is not: the facilitator
|
|
1373
|
+
* answers `400 {"error": "Invalid network: base-mainnet"}`. Every name is passed
|
|
1374
|
+
* through here before it reaches a URL or a request body, so callers holding the
|
|
1375
|
+
* old spelling keep working instead of being rejected at the edge.
|
|
1376
|
+
*/
|
|
1377
|
+
declare function wireNetwork(network: string): string;
|
|
1378
|
+
/**
|
|
1379
|
+
* Network type for ERC-8004 operations (21 networks: 19 EVM + 2 Solana)
|
|
1380
|
+
*
|
|
1381
|
+
* These are the names the FACILITATOR accepts, verified against
|
|
1382
|
+
* GET /feedback -> supportedNetworks. 'base-mainnet' is kept only as a
|
|
1383
|
+
* deprecated alias: the facilitator rejects it outright (400 "Invalid network"),
|
|
1384
|
+
* so anything passed through this module is normalised to 'base' before it
|
|
1385
|
+
* reaches the wire. Use 'base'.
|
|
1354
1386
|
*/
|
|
1355
|
-
type Erc8004Network = 'ethereum' | 'base
|
|
1387
|
+
type Erc8004Network = 'ethereum' | 'base' | 'polygon' | 'arbitrum' | 'optimism' | 'celo' | 'bsc' | 'monad' | 'avalanche' | 'scroll' | 'skale-base' | 'base-mainnet' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy' | 'arbitrum-sepolia' | 'optimism-sepolia' | 'celo-sepolia' | 'avalanche-fuji' | 'skale-base-sepolia' | 'solana' | 'solana-devnet';
|
|
1356
1388
|
/**
|
|
1357
1389
|
* Proof of payment returned when settling with ERC-8004 extension
|
|
1358
1390
|
*/
|
|
@@ -2496,4 +2528,4 @@ declare class AdvancedEscrowClient {
|
|
|
2496
2528
|
private sendViaAdapter;
|
|
2497
2529
|
}
|
|
2498
2530
|
|
|
2499
|
-
export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, type AtomStats, BASE_MAINNET_CONTRACTS, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarRegisterOptions, type BazaarResource, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type DiscoveryAccepts, type DiscoveryCuration, type DiscoveryHealth, type DiscoveryHealthStatus, type DiscoveryListOptions, type DiscoveryPagination, type DiscoveryRegisterOptions, type DiscoveryResource, type DiscoveryResponse, type DiscoverySource, type DiscoveryStats, type DiscoveryTier, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, Erc8004LookupError, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, HEALTH_FILTERS, type HonoMiddlewareOptions, type IdentityByOwnerResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, MAX_SEARCH_LEN, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentPayloadV2, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type PaymentRequirementsV2, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterJobResponse, type RegisterJobStatus, RegistrationPendingError, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type ResourceInfoV2, type SettleRequest, type SettleRequestV2, type SettleResponse, type SettleResponseWithProof, TIER_FILTERS, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyRequestV2, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildSettleRequestV2, buildVerifyRequest, buildVerifyRequestV2, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, epochToDate, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isAlive, isEscrowExpired, isEscrowSupportedOnChain, isRegisterJobTerminal, parsePaymentHeader };
|
|
2531
|
+
export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, type AtomStats, BASE_MAINNET_CONTRACTS, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarRegisterOptions, type BazaarResource, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type DiscoveryAccepts, type DiscoveryCuration, type DiscoveryHealth, type DiscoveryHealthStatus, type DiscoveryListOptions, type DiscoveryPagination, type DiscoveryRegisterOptions, type DiscoveryResource, type DiscoveryResponse, type DiscoverySource, type DiscoveryStats, type DiscoveryTier, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, Erc8004LookupError, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, HEALTH_FILTERS, type HonoMiddlewareOptions, type IdentityByOwnerResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, MAX_SEARCH_LEN, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentPayloadV2, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type PaymentRequirementsV2, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterJobResponse, type RegisterJobStatus, RegistrationPendingError, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type ResourceInfoV2, type SettleRequest, type SettleRequestV2, type SettleResponse, type SettleResponseWithProof, TIER_FILTERS, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyRequestV2, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildSettleRequestV2, buildVerifyRequest, buildVerifyRequestV2, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, epochToDate, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isAlive, isEscrowExpired, isEscrowSupportedOnChain, isRegisterJobTerminal, parsePaymentHeader, wireNetwork };
|
package/dist/backend/index.d.ts
CHANGED
|
@@ -60,7 +60,24 @@ interface SettleResponse {
|
|
|
60
60
|
success: boolean;
|
|
61
61
|
transactionHash?: string;
|
|
62
62
|
network?: string;
|
|
63
|
+
/** Transport-level failure (unreachable facilitator, non-2xx, timeout). */
|
|
63
64
|
error?: string;
|
|
65
|
+
/**
|
|
66
|
+
* The facilitator's own reason when it settled nothing — e.g. a transfer that
|
|
67
|
+
* mined and reverted. Distinct from `error` above, which is this client
|
|
68
|
+
* failing to ask; this one is the facilitator answering "no".
|
|
69
|
+
*/
|
|
70
|
+
errorReason?: string;
|
|
71
|
+
/** The address the facilitator confirmed as the payer. */
|
|
72
|
+
payer?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Settlement proof, present when the ERC-8004 extension asked for it.
|
|
75
|
+
*
|
|
76
|
+
* Typed here rather than only on {@link SettleResponseWithProof} because
|
|
77
|
+
* `settle()` returns it whenever the facilitator sends it, and it is what
|
|
78
|
+
* DX402's `anchorEvidence` needs to reach `verified: true`.
|
|
79
|
+
*/
|
|
80
|
+
proofOfPayment?: ProofOfPayment;
|
|
64
81
|
}
|
|
65
82
|
/**
|
|
66
83
|
* Options for building payment requirements
|
|
@@ -1340,7 +1357,7 @@ declare const ERC8004_EXTENSION_ID = "8004-reputation";
|
|
|
1340
1357
|
*/
|
|
1341
1358
|
type AgentId = number | string;
|
|
1342
1359
|
/**
|
|
1343
|
-
* ERC-8004 contract addresses per network (
|
|
1360
|
+
* ERC-8004 contract addresses per network (21 networks: 19 EVM + 2 Solana)
|
|
1344
1361
|
*/
|
|
1345
1362
|
declare const ERC8004_CONTRACTS: Record<string, {
|
|
1346
1363
|
identityRegistry?: string;
|
|
@@ -1350,9 +1367,24 @@ declare const ERC8004_CONTRACTS: Record<string, {
|
|
|
1350
1367
|
atomEngineProgram?: string;
|
|
1351
1368
|
}>;
|
|
1352
1369
|
/**
|
|
1353
|
-
*
|
|
1370
|
+
* Return the network name the facilitator actually accepts.
|
|
1371
|
+
*
|
|
1372
|
+
* `base-mainnet` reads like the canonical spelling and is not: the facilitator
|
|
1373
|
+
* answers `400 {"error": "Invalid network: base-mainnet"}`. Every name is passed
|
|
1374
|
+
* through here before it reaches a URL or a request body, so callers holding the
|
|
1375
|
+
* old spelling keep working instead of being rejected at the edge.
|
|
1376
|
+
*/
|
|
1377
|
+
declare function wireNetwork(network: string): string;
|
|
1378
|
+
/**
|
|
1379
|
+
* Network type for ERC-8004 operations (21 networks: 19 EVM + 2 Solana)
|
|
1380
|
+
*
|
|
1381
|
+
* These are the names the FACILITATOR accepts, verified against
|
|
1382
|
+
* GET /feedback -> supportedNetworks. 'base-mainnet' is kept only as a
|
|
1383
|
+
* deprecated alias: the facilitator rejects it outright (400 "Invalid network"),
|
|
1384
|
+
* so anything passed through this module is normalised to 'base' before it
|
|
1385
|
+
* reaches the wire. Use 'base'.
|
|
1354
1386
|
*/
|
|
1355
|
-
type Erc8004Network = 'ethereum' | 'base
|
|
1387
|
+
type Erc8004Network = 'ethereum' | 'base' | 'polygon' | 'arbitrum' | 'optimism' | 'celo' | 'bsc' | 'monad' | 'avalanche' | 'scroll' | 'skale-base' | 'base-mainnet' | 'ethereum-sepolia' | 'base-sepolia' | 'polygon-amoy' | 'arbitrum-sepolia' | 'optimism-sepolia' | 'celo-sepolia' | 'avalanche-fuji' | 'skale-base-sepolia' | 'solana' | 'solana-devnet';
|
|
1356
1388
|
/**
|
|
1357
1389
|
* Proof of payment returned when settling with ERC-8004 extension
|
|
1358
1390
|
*/
|
|
@@ -2496,4 +2528,4 @@ declare class AdvancedEscrowClient {
|
|
|
2496
2528
|
private sendViaAdapter;
|
|
2497
2529
|
}
|
|
2498
2530
|
|
|
2499
|
-
export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, type AtomStats, BASE_MAINNET_CONTRACTS, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarRegisterOptions, type BazaarResource, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type DiscoveryAccepts, type DiscoveryCuration, type DiscoveryHealth, type DiscoveryHealthStatus, type DiscoveryListOptions, type DiscoveryPagination, type DiscoveryRegisterOptions, type DiscoveryResource, type DiscoveryResponse, type DiscoverySource, type DiscoveryStats, type DiscoveryTier, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, Erc8004LookupError, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, HEALTH_FILTERS, type HonoMiddlewareOptions, type IdentityByOwnerResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, MAX_SEARCH_LEN, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentPayloadV2, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type PaymentRequirementsV2, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterJobResponse, type RegisterJobStatus, RegistrationPendingError, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type ResourceInfoV2, type SettleRequest, type SettleRequestV2, type SettleResponse, type SettleResponseWithProof, TIER_FILTERS, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyRequestV2, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildSettleRequestV2, buildVerifyRequest, buildVerifyRequestV2, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, epochToDate, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isAlive, isEscrowExpired, isEscrowSupportedOnChain, isRegisterJobTerminal, parsePaymentHeader };
|
|
2531
|
+
export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, type AtomStats, BASE_MAINNET_CONTRACTS, BazaarClient, type BazaarClientOptions, type BazaarDiscoverOptions, type BazaarDiscoverResponse, type BazaarRegisterOptions, type BazaarResource, type CreateEscrowOptions, DEPOSIT_LIMIT_USDC, type DiscoveryAccepts, type DiscoveryCuration, type DiscoveryHealth, type DiscoveryHealthStatus, type DiscoveryListOptions, type DiscoveryPagination, type DiscoveryRegisterOptions, type DiscoveryResource, type DiscoveryResponse, type DiscoverySource, type DiscoveryStats, type DiscoveryTier, type Dispute, type DisputeOutcome, ERC8004_CONTRACTS, ERC8004_EXTENSION_ID, ESCROW_CONTRACTS, ESCROW_TIMEOUT_MS, Erc8004Client, type Erc8004ClientOptions, Erc8004LookupError, type Erc8004Network, EscrowClient, type EscrowClientOptions, type EscrowPayment, type EscrowStateResponse, type EscrowStatus, FacilitatorClient, type FacilitatorClientOptions, type FeedbackEntry, type FeedbackParams, type FeedbackRequest, type FeedbackResponse, HEALTH_FILTERS, type HonoMiddlewareOptions, type IdentityByOwnerResponse, type IdentityMetadataResponse, type IdentityTotalSupplyResponse, MAX_SEARCH_LEN, type MetadataEntryParam, OPERATOR_ABI, OPERATOR_ABI_CREATE3, PAYMENT_INFO_TYPEHASH, type PaymentAcceptance, type PaymentMiddlewareOptions, type PaymentPayloadV2, type PaymentRequirementResolver, type PaymentRequirements, type PaymentRequirementsOptions, type PaymentRequirementsV2, type ProofOfPayment, type RefundRequest, type RefundStatus, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterJobResponse, type RegisterJobStatus, RegistrationPendingError, type ReputationResponse, type ReputationSummary, type RequestRefundOptions, type ResourceInfoV2, type SettleRequest, type SettleRequestV2, type SettleResponse, type SettleResponseWithProof, TIER_FILTERS, TIER_TIMINGS, USDC_DOMAIN_NAME, type VerifiedPaymentState, type VerifyRequest, type VerifyRequestV2, type VerifyResponse, X402_CORS_HEADERS, X402_HEADER_NAMES, ZERO_ADDRESS, buildErc8004PaymentRequirements, buildPaymentRequirements, buildSettleRequest, buildSettleRequestV2, buildVerifyRequest, buildVerifyRequestV2, canRefundEscrow, canReleaseEscrow, create402Response, createHonoMiddleware, createPaymentMiddleware, epochToDate, escrowTimeRemaining, extractPaymentFromHeaders, getCorsHeaders, getEscrowContractsByChainId, getEscrowSupportedChainIds, isAlive, isEscrowExpired, isEscrowSupportedOnChain, isRegisterJobTerminal, parsePaymentHeader, wireNetwork };
|
package/dist/backend/index.js
CHANGED
|
@@ -1292,9 +1292,34 @@ var FacilitatorClient = class {
|
|
|
1292
1292
|
);
|
|
1293
1293
|
}
|
|
1294
1294
|
return {
|
|
1295
|
-
|
|
1295
|
+
// Read the facilitator's verdict instead of asserting one.
|
|
1296
|
+
//
|
|
1297
|
+
// This was the literal `true`, so a settle was reported successful
|
|
1298
|
+
// whenever the HTTP call was — and "the request arrived" is not "the
|
|
1299
|
+
// money moved". A payment that MINES AND THEN REVERTS is answered with
|
|
1300
|
+
// 200 and `success: false` (x402-rs src/chain/evm.rs:1343, serialised
|
|
1301
|
+
// through StatusCode::OK), which is precisely the case a caller most
|
|
1302
|
+
// needs to hear about. Every consumer doing `result.success === true`
|
|
1303
|
+
// was reading a constant, so a reverted payment was booked as settled
|
|
1304
|
+
// and no reconciliation path could ever fire.
|
|
1305
|
+
//
|
|
1306
|
+
// Absent `success` is treated as NOT successful: a facilitator that
|
|
1307
|
+
// does not say it worked has not said it worked.
|
|
1308
|
+
success: result.success === true,
|
|
1296
1309
|
transactionHash,
|
|
1297
|
-
network: result.network
|
|
1310
|
+
network: result.network,
|
|
1311
|
+
// Why it failed, when it did. Without this the caller gets `success:
|
|
1312
|
+
// false` and no way to tell a reverted transfer from a rejected
|
|
1313
|
+
// authorization except by parsing prose.
|
|
1314
|
+
errorReason: result.errorReason ?? result.error_reason,
|
|
1315
|
+
// The settlement proof, when the facilitator attached one (it does for
|
|
1316
|
+
// the ERC-8004 extension). Dropping it here made `verified: true`
|
|
1317
|
+
// unreachable for DX402 anchoring through this client: `anchorEvidence`
|
|
1318
|
+
// documents proofOfPayment as the only thing that gets there, the
|
|
1319
|
+
// facilitator returns it, and this method threw it away — so a seller
|
|
1320
|
+
// using the SDK end to end could only ever produce provisional anchors.
|
|
1321
|
+
proofOfPayment: result.proofOfPayment ?? result.proof_of_payment,
|
|
1322
|
+
payer: result.payer
|
|
1298
1323
|
};
|
|
1299
1324
|
} catch (error) {
|
|
1300
1325
|
clearTimeout(timeoutId);
|
|
@@ -2459,53 +2484,76 @@ function escrowTimeRemaining(escrow) {
|
|
|
2459
2484
|
var ERC8004_EXTENSION_ID = "8004-reputation";
|
|
2460
2485
|
var MAINNET_IDENTITY = "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
|
|
2461
2486
|
var MAINNET_REPUTATION = "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
|
|
2487
|
+
var MAINNET_VALIDATION = "0x8004Cc8439f36fd5F9F049D9fF86523Df6dAAB58";
|
|
2462
2488
|
var TESTNET_IDENTITY = "0x8004A818BFB912233c491871b3d84c89A494BD9e";
|
|
2463
2489
|
var TESTNET_REPUTATION = "0x8004B663056A597Dffe9eCcC1965A193B7388713";
|
|
2464
2490
|
var TESTNET_VALIDATION = "0x8004Cb1BF31DAf7788923b405b754f57acEB4272";
|
|
2465
2491
|
var SOLANA_AGENT_REGISTRY = "8oo4dC4JvBLwy5tGgiH3WwK4B9PWxL9Z4XjA2jzkQMbQ";
|
|
2466
2492
|
var SOLANA_ATOM_ENGINE = "AToMw53aiPQ8j7iHVb4fGt6nzUNxUhcPc3tbPBZuzVVb";
|
|
2467
2493
|
var ERC8004_CONTRACTS = {
|
|
2468
|
-
// Mainnets (
|
|
2494
|
+
// Mainnets (11)
|
|
2469
2495
|
ethereum: {
|
|
2470
2496
|
identityRegistry: MAINNET_IDENTITY,
|
|
2471
|
-
reputationRegistry: MAINNET_REPUTATION
|
|
2497
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2498
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2472
2499
|
},
|
|
2473
|
-
|
|
2500
|
+
base: {
|
|
2474
2501
|
identityRegistry: MAINNET_IDENTITY,
|
|
2475
|
-
reputationRegistry: MAINNET_REPUTATION
|
|
2502
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2503
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2476
2504
|
},
|
|
2477
2505
|
polygon: {
|
|
2478
2506
|
identityRegistry: MAINNET_IDENTITY,
|
|
2479
|
-
reputationRegistry: MAINNET_REPUTATION
|
|
2507
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2508
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2480
2509
|
},
|
|
2481
2510
|
arbitrum: {
|
|
2482
2511
|
identityRegistry: MAINNET_IDENTITY,
|
|
2483
|
-
reputationRegistry: MAINNET_REPUTATION
|
|
2512
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2513
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2484
2514
|
},
|
|
2485
2515
|
optimism: {
|
|
2486
2516
|
identityRegistry: MAINNET_IDENTITY,
|
|
2487
|
-
reputationRegistry: MAINNET_REPUTATION
|
|
2517
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2518
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2488
2519
|
},
|
|
2489
2520
|
celo: {
|
|
2490
2521
|
identityRegistry: MAINNET_IDENTITY,
|
|
2491
|
-
reputationRegistry: MAINNET_REPUTATION
|
|
2522
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2523
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2492
2524
|
},
|
|
2493
2525
|
bsc: {
|
|
2494
2526
|
identityRegistry: MAINNET_IDENTITY,
|
|
2495
|
-
reputationRegistry: MAINNET_REPUTATION
|
|
2527
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2528
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2496
2529
|
},
|
|
2497
2530
|
monad: {
|
|
2498
2531
|
identityRegistry: MAINNET_IDENTITY,
|
|
2499
|
-
reputationRegistry: MAINNET_REPUTATION
|
|
2532
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2533
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2500
2534
|
},
|
|
2501
2535
|
avalanche: {
|
|
2502
2536
|
identityRegistry: MAINNET_IDENTITY,
|
|
2503
|
-
reputationRegistry: MAINNET_REPUTATION
|
|
2537
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2538
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2504
2539
|
},
|
|
2540
|
+
scroll: {
|
|
2541
|
+
identityRegistry: MAINNET_IDENTITY,
|
|
2542
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2543
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2544
|
+
},
|
|
2545
|
+
// SKALE Base is the one mainnet without a validation registry (no code at
|
|
2546
|
+
// the canonical address), so leaving it out is correct, not an omission.
|
|
2505
2547
|
"skale-base": {
|
|
2506
2548
|
identityRegistry: MAINNET_IDENTITY,
|
|
2507
2549
|
reputationRegistry: MAINNET_REPUTATION
|
|
2508
2550
|
},
|
|
2551
|
+
// Deprecated alias for 'base' -- kept so existing lookups keep resolving.
|
|
2552
|
+
"base-mainnet": {
|
|
2553
|
+
identityRegistry: MAINNET_IDENTITY,
|
|
2554
|
+
reputationRegistry: MAINNET_REPUTATION,
|
|
2555
|
+
validationRegistry: MAINNET_VALIDATION
|
|
2556
|
+
},
|
|
2509
2557
|
// Testnets (8)
|
|
2510
2558
|
"ethereum-sepolia": {
|
|
2511
2559
|
identityRegistry: TESTNET_IDENTITY,
|
|
@@ -2557,6 +2605,9 @@ var ERC8004_CONTRACTS = {
|
|
|
2557
2605
|
atomEngineProgram: SOLANA_ATOM_ENGINE
|
|
2558
2606
|
}
|
|
2559
2607
|
};
|
|
2608
|
+
function wireNetwork(network) {
|
|
2609
|
+
return network === "base-mainnet" ? "base" : network;
|
|
2610
|
+
}
|
|
2560
2611
|
var Erc8004LookupError = class extends Error {
|
|
2561
2612
|
/** HTTP status returned by the facilitator */
|
|
2562
2613
|
status;
|
|
@@ -2623,7 +2674,7 @@ var Erc8004Client = class {
|
|
|
2623
2674
|
* @returns Agent identity information
|
|
2624
2675
|
*/
|
|
2625
2676
|
async getIdentity(network, agentId) {
|
|
2626
|
-
const url = `${this.baseUrl}/identity/${network}/${agentId}`;
|
|
2677
|
+
const url = `${this.baseUrl}/identity/${wireNetwork(network)}/${agentId}`;
|
|
2627
2678
|
const controller = new AbortController();
|
|
2628
2679
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
2629
2680
|
try {
|
|
@@ -2659,7 +2710,7 @@ var Erc8004Client = class {
|
|
|
2659
2710
|
* ```
|
|
2660
2711
|
*/
|
|
2661
2712
|
async getIdentityByOwner(network, address) {
|
|
2662
|
-
const url = `${this.baseUrl}/identity/${network}/owner/${address}`;
|
|
2713
|
+
const url = `${this.baseUrl}/identity/${wireNetwork(network)}/owner/${address}`;
|
|
2663
2714
|
const controller = new AbortController();
|
|
2664
2715
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
2665
2716
|
try {
|
|
@@ -2729,7 +2780,7 @@ var Erc8004Client = class {
|
|
|
2729
2780
|
if (options.tag2) params.set("tag2", options.tag2);
|
|
2730
2781
|
if (options.includeFeedback) params.set("includeFeedback", "true");
|
|
2731
2782
|
if (options.clientAddresses) params.set("clientAddresses", options.clientAddresses);
|
|
2732
|
-
const url = `${this.baseUrl}/reputation/${network}/${agentId}${params.toString() ? `?${params}` : ""}`;
|
|
2783
|
+
const url = `${this.baseUrl}/reputation/${wireNetwork(network)}/${agentId}${params.toString() ? `?${params}` : ""}`;
|
|
2733
2784
|
const controller = new AbortController();
|
|
2734
2785
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
2735
2786
|
try {
|
|
@@ -2791,7 +2842,7 @@ var Erc8004Client = class {
|
|
|
2791
2842
|
"Content-Type": "application/json",
|
|
2792
2843
|
"Accept": "application/json"
|
|
2793
2844
|
},
|
|
2794
|
-
body: JSON.stringify(request),
|
|
2845
|
+
body: JSON.stringify({ ...request, network: wireNetwork(request.network) }),
|
|
2795
2846
|
signal: controller.signal
|
|
2796
2847
|
});
|
|
2797
2848
|
clearTimeout(timeoutId);
|
|
@@ -2829,7 +2880,7 @@ var Erc8004Client = class {
|
|
|
2829
2880
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
2830
2881
|
const payload = {
|
|
2831
2882
|
x402Version: 1,
|
|
2832
|
-
network,
|
|
2883
|
+
network: wireNetwork(network),
|
|
2833
2884
|
agentId,
|
|
2834
2885
|
feedbackIndex
|
|
2835
2886
|
};
|
|
@@ -2940,7 +2991,7 @@ var Erc8004Client = class {
|
|
|
2940
2991
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
2941
2992
|
const payload = {
|
|
2942
2993
|
x402Version: 1,
|
|
2943
|
-
network,
|
|
2994
|
+
network: wireNetwork(network),
|
|
2944
2995
|
agentId,
|
|
2945
2996
|
feedbackIndex,
|
|
2946
2997
|
response
|
|
@@ -3029,7 +3080,7 @@ var Erc8004Client = class {
|
|
|
3029
3080
|
"Content-Type": "application/json",
|
|
3030
3081
|
"Accept": "application/json"
|
|
3031
3082
|
},
|
|
3032
|
-
body: JSON.stringify(request),
|
|
3083
|
+
body: JSON.stringify({ ...request, network: wireNetwork(request.network) }),
|
|
3033
3084
|
signal: controller.signal
|
|
3034
3085
|
});
|
|
3035
3086
|
clearTimeout(timeoutId);
|
|
@@ -3088,7 +3139,7 @@ var Erc8004Client = class {
|
|
|
3088
3139
|
"Accept": "application/json",
|
|
3089
3140
|
"Prefer": "respond-async"
|
|
3090
3141
|
},
|
|
3091
|
-
body: JSON.stringify(request),
|
|
3142
|
+
body: JSON.stringify({ ...request, network: wireNetwork(request.network) }),
|
|
3092
3143
|
signal: controller.signal
|
|
3093
3144
|
});
|
|
3094
3145
|
clearTimeout(timeoutId);
|
|
@@ -3196,7 +3247,7 @@ var Erc8004Client = class {
|
|
|
3196
3247
|
* @returns Metadata value (hex-encoded and UTF-8 decoded if possible)
|
|
3197
3248
|
*/
|
|
3198
3249
|
async getIdentityMetadata(network, agentId, key) {
|
|
3199
|
-
const url = `${this.baseUrl}/identity/${network}/${agentId}/metadata/${encodeURIComponent(key)}`;
|
|
3250
|
+
const url = `${this.baseUrl}/identity/${wireNetwork(network)}/${agentId}/metadata/${encodeURIComponent(key)}`;
|
|
3200
3251
|
const controller = new AbortController();
|
|
3201
3252
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
3202
3253
|
try {
|
|
@@ -3223,7 +3274,7 @@ var Erc8004Client = class {
|
|
|
3223
3274
|
* @returns Total supply count
|
|
3224
3275
|
*/
|
|
3225
3276
|
async getIdentityTotalSupply(network) {
|
|
3226
|
-
const url = `${this.baseUrl}/identity/${network}/total-supply`;
|
|
3277
|
+
const url = `${this.baseUrl}/identity/${wireNetwork(network)}/total-supply`;
|
|
3227
3278
|
const controller = new AbortController();
|
|
3228
3279
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
3229
3280
|
try {
|
|
@@ -3861,7 +3912,10 @@ var AdvancedEscrowClient = class {
|
|
|
3861
3912
|
transactionHash: result.transaction || result.transactionHash || result.transaction_hash
|
|
3862
3913
|
};
|
|
3863
3914
|
}
|
|
3864
|
-
return {
|
|
3915
|
+
return {
|
|
3916
|
+
success: false,
|
|
3917
|
+
error: result.errorReason || result.error || `Release refused with no reason (HTTP ${response.status}, body keys: ${Object.keys(result ?? {}).sort().join(", ") || "none"})`
|
|
3918
|
+
};
|
|
3865
3919
|
} catch (fetchErr) {
|
|
3866
3920
|
clearTimeout(timeoutId);
|
|
3867
3921
|
if (fetchErr.name === "AbortError") {
|
|
@@ -4225,5 +4279,6 @@ exports.isEscrowExpired = isEscrowExpired;
|
|
|
4225
4279
|
exports.isEscrowSupportedOnChain = isEscrowSupportedOnChain;
|
|
4226
4280
|
exports.isRegisterJobTerminal = isRegisterJobTerminal;
|
|
4227
4281
|
exports.parsePaymentHeader = parsePaymentHeader;
|
|
4282
|
+
exports.wireNetwork = wireNetwork;
|
|
4228
4283
|
//# sourceMappingURL=index.js.map
|
|
4229
4284
|
//# sourceMappingURL=index.js.map
|