uvd-x402-sdk 2.48.0 → 2.51.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/dist/backend/index.d.mts +87 -4
- package/dist/backend/index.d.ts +87 -4
- package/dist/backend/index.js +28 -1
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/index.mjs +28 -2
- package/dist/backend/index.mjs.map +1 -1
- package/dist/erc8128/index.d.mts +876 -0
- package/dist/erc8128/index.d.ts +876 -0
- package/dist/erc8128/index.js +1213 -0
- package/dist/erc8128/index.js.map +1 -0
- package/dist/erc8128/index.mjs +1169 -0
- package/dist/erc8128/index.mjs.map +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -1
- package/src/backend/index.ts +114 -5
- package/src/erc8128/conformance.ts +391 -0
- package/src/erc8128/core.ts +603 -0
- package/src/erc8128/erc8128.f3-1.json +147 -0
- package/src/erc8128/erc8128.f3-3.json +914 -0
- package/src/erc8128/errors.ts +144 -0
- package/src/erc8128/index.ts +161 -0
- package/src/erc8128/nonce.ts +79 -0
- package/src/erc8128/presets.ts +159 -0
- package/src/erc8128/signer.ts +365 -0
- package/src/erc8128/vectors.generated.ts +33 -0
- package/src/erc8128/vectors.ts +92 -0
- package/src/erc8128/verifier.ts +573 -0
- package/src/erc8128.vectors.json +147 -0
- package/src/escrow-preauth.vectors.json +127 -0
package/dist/backend/index.d.mts
CHANGED
|
@@ -1490,6 +1490,16 @@ interface FeedbackParams {
|
|
|
1490
1490
|
feedbackUri?: string;
|
|
1491
1491
|
/** Keccak256 hash of feedback content (for integrity) */
|
|
1492
1492
|
feedbackHash?: string;
|
|
1493
|
+
/**
|
|
1494
|
+
* Quality score 0-100.
|
|
1495
|
+
*
|
|
1496
|
+
* Solana only, and effectively required there: the ATOM Engine ignores an
|
|
1497
|
+
* unscored feedback. It is written to the agent but contributes nothing to
|
|
1498
|
+
* reputation, and the program reports `had_impact=false`. This is not
|
|
1499
|
+
* retroactive — reputation stays at zero however much unscored feedback
|
|
1500
|
+
* accumulates.
|
|
1501
|
+
*/
|
|
1502
|
+
score?: number;
|
|
1493
1503
|
/** Proof of payment (required for authorized feedback) */
|
|
1494
1504
|
proof?: ProofOfPayment;
|
|
1495
1505
|
}
|
|
@@ -1522,10 +1532,69 @@ interface FeedbackResponse {
|
|
|
1522
1532
|
/**
|
|
1523
1533
|
* Reputation query response
|
|
1524
1534
|
*/
|
|
1535
|
+
/**
|
|
1536
|
+
* Error from an ERC-8004 lookup, carrying the HTTP status as a field.
|
|
1537
|
+
*
|
|
1538
|
+
* `notFound` and `retryable` are mutually exclusive and must stay that way in
|
|
1539
|
+
* calling code: the facilitator answers 404 for "this address owns no agent"
|
|
1540
|
+
* and 503 for "I could not find out", usually an RPC failure behind it.
|
|
1541
|
+
* Treating a 503 as absence is how a transient failure becomes a permanent
|
|
1542
|
+
* wrong answer — on a registration path it mints a second agent for an owner
|
|
1543
|
+
* who already has one, burning gas and leaving an orphan.
|
|
1544
|
+
*/
|
|
1545
|
+
declare class Erc8004LookupError extends Error {
|
|
1546
|
+
/** HTTP status returned by the facilitator */
|
|
1547
|
+
readonly status: number;
|
|
1548
|
+
/** Raw response body, for debugging */
|
|
1549
|
+
readonly body: string;
|
|
1550
|
+
constructor(message: string, status: number, body: string);
|
|
1551
|
+
/** The address genuinely owns no agent on this network. */
|
|
1552
|
+
get notFound(): boolean;
|
|
1553
|
+
/** The lookup reached no verdict. Retry; never read as "owns nothing". */
|
|
1554
|
+
get retryable(): boolean;
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* ATOM Engine reputation analytics (Solana only).
|
|
1558
|
+
*
|
|
1559
|
+
* Present only when the agent's `atom_stats` account has been initialized. The
|
|
1560
|
+
* facilitator does that during `registerAgent`; agents registered elsewhere may
|
|
1561
|
+
* never have it, in which case their feedback is never scored.
|
|
1562
|
+
*
|
|
1563
|
+
* The engine measures quality through EMA scores, so there are no
|
|
1564
|
+
* positive/negative tallies.
|
|
1565
|
+
*/
|
|
1566
|
+
interface AtomStats {
|
|
1567
|
+
/** Trust tier 0-4 */
|
|
1568
|
+
trustTier: number;
|
|
1569
|
+
/** Human-readable trust tier */
|
|
1570
|
+
trustTierName: string;
|
|
1571
|
+
/** Cached quality score */
|
|
1572
|
+
qualityScore: number;
|
|
1573
|
+
/** Cached loyalty score */
|
|
1574
|
+
loyaltyScore: number;
|
|
1575
|
+
/** Statistical confidence */
|
|
1576
|
+
confidence: number;
|
|
1577
|
+
/** Risk assessment (lower is better) */
|
|
1578
|
+
riskScore: number;
|
|
1579
|
+
/** Client diversity from HyperLogLog */
|
|
1580
|
+
diversityRatio: number;
|
|
1581
|
+
/** Lowest score ever recorded */
|
|
1582
|
+
minScore: number;
|
|
1583
|
+
/** Highest score ever recorded */
|
|
1584
|
+
maxScore: number;
|
|
1585
|
+
/** Most recent score recorded */
|
|
1586
|
+
lastScore: number;
|
|
1587
|
+
/** Total feedback counted by the engine */
|
|
1588
|
+
feedbackCount: number;
|
|
1589
|
+
/** Slot of the most recent feedback */
|
|
1590
|
+
lastFeedbackSlot: number;
|
|
1591
|
+
}
|
|
1525
1592
|
interface ReputationResponse {
|
|
1526
1593
|
agentId: AgentId;
|
|
1527
1594
|
summary: ReputationSummary;
|
|
1528
1595
|
feedback?: FeedbackEntry[];
|
|
1596
|
+
/** ATOM Engine analytics; absent when the agent has no initialized stats */
|
|
1597
|
+
atomStats?: AtomStats | null;
|
|
1529
1598
|
network: Erc8004Network;
|
|
1530
1599
|
}
|
|
1531
1600
|
/**
|
|
@@ -1594,19 +1663,32 @@ interface IdentityMetadataResponse {
|
|
|
1594
1663
|
agentId: AgentId;
|
|
1595
1664
|
/** Metadata key */
|
|
1596
1665
|
key: string;
|
|
1597
|
-
/**
|
|
1598
|
-
|
|
1666
|
+
/**
|
|
1667
|
+
* Raw hex-encoded value. The facilitator sends this as `value`; this field
|
|
1668
|
+
* used to be declared as `valueHex`, which no response ever carried, so it
|
|
1669
|
+
* was always undefined at runtime.
|
|
1670
|
+
*/
|
|
1671
|
+
value: string;
|
|
1599
1672
|
/** UTF-8 decoded value (if decodable) */
|
|
1600
1673
|
valueUtf8?: string;
|
|
1674
|
+
/** Whether the entry can still be changed */
|
|
1675
|
+
immutable?: boolean;
|
|
1601
1676
|
/** Network */
|
|
1602
1677
|
network: string;
|
|
1603
1678
|
}
|
|
1604
1679
|
/**
|
|
1605
1680
|
* Response from GET /identity/{network}/total-supply
|
|
1681
|
+
*
|
|
1682
|
+
* On Solana the counts come from the Metaplex Core collection, not the registry,
|
|
1683
|
+
* which keeps no counter of its own.
|
|
1606
1684
|
*/
|
|
1607
1685
|
interface IdentityTotalSupplyResponse {
|
|
1608
|
-
/**
|
|
1686
|
+
/** Registered agents, net of burns */
|
|
1609
1687
|
totalSupply: number;
|
|
1688
|
+
/** All-time mint count (Solana) */
|
|
1689
|
+
numMinted?: number;
|
|
1690
|
+
/** Metaplex Core collection backing the count (Solana) */
|
|
1691
|
+
collection?: string;
|
|
1610
1692
|
/** Network */
|
|
1611
1693
|
network: string;
|
|
1612
1694
|
}
|
|
@@ -1751,6 +1833,7 @@ declare class Erc8004Client {
|
|
|
1751
1833
|
*/
|
|
1752
1834
|
revokeFeedback(network: Erc8004Network, agentId: AgentId, feedbackIndex: number, options?: {
|
|
1753
1835
|
sealHash?: string;
|
|
1836
|
+
originalFeedback?: Omit<FeedbackParams, 'agentId' | 'proof'>;
|
|
1754
1837
|
}): Promise<FeedbackResponse>;
|
|
1755
1838
|
/**
|
|
1756
1839
|
* Get ERC-8004 contract addresses for a network
|
|
@@ -2328,4 +2411,4 @@ declare class AdvancedEscrowClient {
|
|
|
2328
2411
|
private sendViaAdapter;
|
|
2329
2412
|
}
|
|
2330
2413
|
|
|
2331
|
-
export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, 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, 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 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, parsePaymentHeader };
|
|
2414
|
+
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 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, parsePaymentHeader };
|
package/dist/backend/index.d.ts
CHANGED
|
@@ -1490,6 +1490,16 @@ interface FeedbackParams {
|
|
|
1490
1490
|
feedbackUri?: string;
|
|
1491
1491
|
/** Keccak256 hash of feedback content (for integrity) */
|
|
1492
1492
|
feedbackHash?: string;
|
|
1493
|
+
/**
|
|
1494
|
+
* Quality score 0-100.
|
|
1495
|
+
*
|
|
1496
|
+
* Solana only, and effectively required there: the ATOM Engine ignores an
|
|
1497
|
+
* unscored feedback. It is written to the agent but contributes nothing to
|
|
1498
|
+
* reputation, and the program reports `had_impact=false`. This is not
|
|
1499
|
+
* retroactive — reputation stays at zero however much unscored feedback
|
|
1500
|
+
* accumulates.
|
|
1501
|
+
*/
|
|
1502
|
+
score?: number;
|
|
1493
1503
|
/** Proof of payment (required for authorized feedback) */
|
|
1494
1504
|
proof?: ProofOfPayment;
|
|
1495
1505
|
}
|
|
@@ -1522,10 +1532,69 @@ interface FeedbackResponse {
|
|
|
1522
1532
|
/**
|
|
1523
1533
|
* Reputation query response
|
|
1524
1534
|
*/
|
|
1535
|
+
/**
|
|
1536
|
+
* Error from an ERC-8004 lookup, carrying the HTTP status as a field.
|
|
1537
|
+
*
|
|
1538
|
+
* `notFound` and `retryable` are mutually exclusive and must stay that way in
|
|
1539
|
+
* calling code: the facilitator answers 404 for "this address owns no agent"
|
|
1540
|
+
* and 503 for "I could not find out", usually an RPC failure behind it.
|
|
1541
|
+
* Treating a 503 as absence is how a transient failure becomes a permanent
|
|
1542
|
+
* wrong answer — on a registration path it mints a second agent for an owner
|
|
1543
|
+
* who already has one, burning gas and leaving an orphan.
|
|
1544
|
+
*/
|
|
1545
|
+
declare class Erc8004LookupError extends Error {
|
|
1546
|
+
/** HTTP status returned by the facilitator */
|
|
1547
|
+
readonly status: number;
|
|
1548
|
+
/** Raw response body, for debugging */
|
|
1549
|
+
readonly body: string;
|
|
1550
|
+
constructor(message: string, status: number, body: string);
|
|
1551
|
+
/** The address genuinely owns no agent on this network. */
|
|
1552
|
+
get notFound(): boolean;
|
|
1553
|
+
/** The lookup reached no verdict. Retry; never read as "owns nothing". */
|
|
1554
|
+
get retryable(): boolean;
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* ATOM Engine reputation analytics (Solana only).
|
|
1558
|
+
*
|
|
1559
|
+
* Present only when the agent's `atom_stats` account has been initialized. The
|
|
1560
|
+
* facilitator does that during `registerAgent`; agents registered elsewhere may
|
|
1561
|
+
* never have it, in which case their feedback is never scored.
|
|
1562
|
+
*
|
|
1563
|
+
* The engine measures quality through EMA scores, so there are no
|
|
1564
|
+
* positive/negative tallies.
|
|
1565
|
+
*/
|
|
1566
|
+
interface AtomStats {
|
|
1567
|
+
/** Trust tier 0-4 */
|
|
1568
|
+
trustTier: number;
|
|
1569
|
+
/** Human-readable trust tier */
|
|
1570
|
+
trustTierName: string;
|
|
1571
|
+
/** Cached quality score */
|
|
1572
|
+
qualityScore: number;
|
|
1573
|
+
/** Cached loyalty score */
|
|
1574
|
+
loyaltyScore: number;
|
|
1575
|
+
/** Statistical confidence */
|
|
1576
|
+
confidence: number;
|
|
1577
|
+
/** Risk assessment (lower is better) */
|
|
1578
|
+
riskScore: number;
|
|
1579
|
+
/** Client diversity from HyperLogLog */
|
|
1580
|
+
diversityRatio: number;
|
|
1581
|
+
/** Lowest score ever recorded */
|
|
1582
|
+
minScore: number;
|
|
1583
|
+
/** Highest score ever recorded */
|
|
1584
|
+
maxScore: number;
|
|
1585
|
+
/** Most recent score recorded */
|
|
1586
|
+
lastScore: number;
|
|
1587
|
+
/** Total feedback counted by the engine */
|
|
1588
|
+
feedbackCount: number;
|
|
1589
|
+
/** Slot of the most recent feedback */
|
|
1590
|
+
lastFeedbackSlot: number;
|
|
1591
|
+
}
|
|
1525
1592
|
interface ReputationResponse {
|
|
1526
1593
|
agentId: AgentId;
|
|
1527
1594
|
summary: ReputationSummary;
|
|
1528
1595
|
feedback?: FeedbackEntry[];
|
|
1596
|
+
/** ATOM Engine analytics; absent when the agent has no initialized stats */
|
|
1597
|
+
atomStats?: AtomStats | null;
|
|
1529
1598
|
network: Erc8004Network;
|
|
1530
1599
|
}
|
|
1531
1600
|
/**
|
|
@@ -1594,19 +1663,32 @@ interface IdentityMetadataResponse {
|
|
|
1594
1663
|
agentId: AgentId;
|
|
1595
1664
|
/** Metadata key */
|
|
1596
1665
|
key: string;
|
|
1597
|
-
/**
|
|
1598
|
-
|
|
1666
|
+
/**
|
|
1667
|
+
* Raw hex-encoded value. The facilitator sends this as `value`; this field
|
|
1668
|
+
* used to be declared as `valueHex`, which no response ever carried, so it
|
|
1669
|
+
* was always undefined at runtime.
|
|
1670
|
+
*/
|
|
1671
|
+
value: string;
|
|
1599
1672
|
/** UTF-8 decoded value (if decodable) */
|
|
1600
1673
|
valueUtf8?: string;
|
|
1674
|
+
/** Whether the entry can still be changed */
|
|
1675
|
+
immutable?: boolean;
|
|
1601
1676
|
/** Network */
|
|
1602
1677
|
network: string;
|
|
1603
1678
|
}
|
|
1604
1679
|
/**
|
|
1605
1680
|
* Response from GET /identity/{network}/total-supply
|
|
1681
|
+
*
|
|
1682
|
+
* On Solana the counts come from the Metaplex Core collection, not the registry,
|
|
1683
|
+
* which keeps no counter of its own.
|
|
1606
1684
|
*/
|
|
1607
1685
|
interface IdentityTotalSupplyResponse {
|
|
1608
|
-
/**
|
|
1686
|
+
/** Registered agents, net of burns */
|
|
1609
1687
|
totalSupply: number;
|
|
1688
|
+
/** All-time mint count (Solana) */
|
|
1689
|
+
numMinted?: number;
|
|
1690
|
+
/** Metaplex Core collection backing the count (Solana) */
|
|
1691
|
+
collection?: string;
|
|
1610
1692
|
/** Network */
|
|
1611
1693
|
network: string;
|
|
1612
1694
|
}
|
|
@@ -1751,6 +1833,7 @@ declare class Erc8004Client {
|
|
|
1751
1833
|
*/
|
|
1752
1834
|
revokeFeedback(network: Erc8004Network, agentId: AgentId, feedbackIndex: number, options?: {
|
|
1753
1835
|
sealHash?: string;
|
|
1836
|
+
originalFeedback?: Omit<FeedbackParams, 'agentId' | 'proof'>;
|
|
1754
1837
|
}): Promise<FeedbackResponse>;
|
|
1755
1838
|
/**
|
|
1756
1839
|
* Get ERC-8004 contract addresses for a network
|
|
@@ -2328,4 +2411,4 @@ declare class AdvancedEscrowClient {
|
|
|
2328
2411
|
private sendViaAdapter;
|
|
2329
2412
|
}
|
|
2330
2413
|
|
|
2331
|
-
export { type AdvancedAuthorizationResult, AdvancedEscrowClient, type AdvancedEscrowClientOptions, type AdvancedEscrowContracts, type AdvancedEscrowTaskTier, type AdvancedPaymentInfo, type AdvancedTransactionResult, type AgentId, type AgentIdentity, type AgentRegistration, type AgentRegistrationFile, type AgentService, 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, 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 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, parsePaymentHeader };
|
|
2414
|
+
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 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, parsePaymentHeader };
|
package/dist/backend/index.js
CHANGED
|
@@ -2553,6 +2553,26 @@ var ERC8004_CONTRACTS = {
|
|
|
2553
2553
|
atomEngineProgram: SOLANA_ATOM_ENGINE
|
|
2554
2554
|
}
|
|
2555
2555
|
};
|
|
2556
|
+
var Erc8004LookupError = class extends Error {
|
|
2557
|
+
/** HTTP status returned by the facilitator */
|
|
2558
|
+
status;
|
|
2559
|
+
/** Raw response body, for debugging */
|
|
2560
|
+
body;
|
|
2561
|
+
constructor(message, status, body) {
|
|
2562
|
+
super(message);
|
|
2563
|
+
this.name = "Erc8004LookupError";
|
|
2564
|
+
this.status = status;
|
|
2565
|
+
this.body = body;
|
|
2566
|
+
}
|
|
2567
|
+
/** The address genuinely owns no agent on this network. */
|
|
2568
|
+
get notFound() {
|
|
2569
|
+
return this.status === 404;
|
|
2570
|
+
}
|
|
2571
|
+
/** The lookup reached no verdict. Retry; never read as "owns nothing". */
|
|
2572
|
+
get retryable() {
|
|
2573
|
+
return this.status === 503;
|
|
2574
|
+
}
|
|
2575
|
+
};
|
|
2556
2576
|
var Erc8004Client = class {
|
|
2557
2577
|
baseUrl;
|
|
2558
2578
|
timeout;
|
|
@@ -2616,7 +2636,11 @@ var Erc8004Client = class {
|
|
|
2616
2636
|
clearTimeout(timeoutId);
|
|
2617
2637
|
if (!response.ok) {
|
|
2618
2638
|
const errorText = await response.text();
|
|
2619
|
-
throw new
|
|
2639
|
+
throw new Erc8004LookupError(
|
|
2640
|
+
`ERC-8004 API error: ${response.status} - ${errorText}`,
|
|
2641
|
+
response.status,
|
|
2642
|
+
errorText
|
|
2643
|
+
);
|
|
2620
2644
|
}
|
|
2621
2645
|
return await response.json();
|
|
2622
2646
|
} catch (error) {
|
|
@@ -2776,6 +2800,8 @@ var Erc8004Client = class {
|
|
|
2776
2800
|
};
|
|
2777
2801
|
if (options?.sealHash) {
|
|
2778
2802
|
payload.sealHash = options.sealHash;
|
|
2803
|
+
} else if (options?.originalFeedback) {
|
|
2804
|
+
payload.originalFeedback = options.originalFeedback;
|
|
2779
2805
|
}
|
|
2780
2806
|
try {
|
|
2781
2807
|
const response = await fetch(url, {
|
|
@@ -4005,6 +4031,7 @@ exports.ERC8004_EXTENSION_ID = ERC8004_EXTENSION_ID;
|
|
|
4005
4031
|
exports.ESCROW_CONTRACTS = ESCROW_CONTRACTS;
|
|
4006
4032
|
exports.ESCROW_TIMEOUT_MS = ESCROW_TIMEOUT_MS;
|
|
4007
4033
|
exports.Erc8004Client = Erc8004Client;
|
|
4034
|
+
exports.Erc8004LookupError = Erc8004LookupError;
|
|
4008
4035
|
exports.EscrowClient = EscrowClient;
|
|
4009
4036
|
exports.FacilitatorClient = FacilitatorClient;
|
|
4010
4037
|
exports.HEALTH_FILTERS = HEALTH_FILTERS;
|