@agirails/sdk 3.3.0 → 3.4.1
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/api/agirailsApp.d.ts +21 -1
- package/dist/api/agirailsApp.d.ts.map +1 -1
- package/dist/api/agirailsApp.js.map +1 -1
- package/dist/builders/CounterAcceptBuilder.d.ts +96 -0
- package/dist/builders/CounterAcceptBuilder.d.ts.map +1 -0
- package/dist/builders/CounterAcceptBuilder.js +226 -0
- package/dist/builders/CounterAcceptBuilder.js.map +1 -0
- package/dist/builders/CounterOfferBuilder.d.ts +143 -0
- package/dist/builders/CounterOfferBuilder.d.ts.map +1 -0
- package/dist/builders/CounterOfferBuilder.js +329 -0
- package/dist/builders/CounterOfferBuilder.js.map +1 -0
- package/dist/builders/QuoteBuilder.d.ts.map +1 -1
- package/dist/builders/QuoteBuilder.js +8 -3
- package/dist/builders/QuoteBuilder.js.map +1 -1
- package/dist/builders/index.d.ts +2 -0
- package/dist/builders/index.d.ts.map +1 -1
- package/dist/builders/index.js +7 -1
- package/dist/builders/index.js.map +1 -1
- package/dist/cli/agirails.js +22 -2
- package/dist/cli/agirails.js.map +1 -1
- package/dist/cli/commands/health.js +21 -5
- package/dist/cli/commands/health.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +25 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/publish.d.ts +34 -0
- package/dist/cli/commands/publish.d.ts.map +1 -1
- package/dist/cli/commands/publish.js +256 -80
- package/dist/cli/commands/publish.js.map +1 -1
- package/dist/cli/commands/repair.d.ts +23 -0
- package/dist/cli/commands/repair.d.ts.map +1 -0
- package/dist/cli/commands/repair.js +210 -0
- package/dist/cli/commands/repair.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +38 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +308 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/test.js +2 -2
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/index.js +6 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/config/agirailsmdV4.d.ts +46 -1
- package/dist/config/agirailsmdV4.d.ts.map +1 -1
- package/dist/config/agirailsmdV4.js +65 -8
- package/dist/config/agirailsmdV4.js.map +1 -1
- package/dist/config/defaults.d.ts +10 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +10 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/publishPipeline.d.ts +23 -1
- package/dist/config/publishPipeline.d.ts.map +1 -1
- package/dist/config/publishPipeline.js +70 -15
- package/dist/config/publishPipeline.js.map +1 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -3
- package/dist/index.js.map +1 -1
- package/dist/level1/Agent.d.ts +27 -0
- package/dist/level1/Agent.d.ts.map +1 -1
- package/dist/level1/Agent.js +77 -6
- package/dist/level1/Agent.js.map +1 -1
- package/dist/negotiation/BuyerOrchestrator.d.ts +103 -1
- package/dist/negotiation/BuyerOrchestrator.d.ts.map +1 -1
- package/dist/negotiation/BuyerOrchestrator.js +499 -4
- package/dist/negotiation/BuyerOrchestrator.js.map +1 -1
- package/dist/negotiation/DecisionEngine.d.ts +69 -1
- package/dist/negotiation/DecisionEngine.d.ts.map +1 -1
- package/dist/negotiation/DecisionEngine.js +140 -1
- package/dist/negotiation/DecisionEngine.js.map +1 -1
- package/dist/negotiation/PolicyEngine.d.ts +32 -0
- package/dist/negotiation/PolicyEngine.d.ts.map +1 -1
- package/dist/negotiation/PolicyEngine.js.map +1 -1
- package/dist/negotiation/ProviderOrchestrator.d.ts +108 -0
- package/dist/negotiation/ProviderOrchestrator.d.ts.map +1 -0
- package/dist/negotiation/ProviderOrchestrator.js +136 -0
- package/dist/negotiation/ProviderOrchestrator.js.map +1 -0
- package/dist/negotiation/ProviderPolicy.d.ts +143 -0
- package/dist/negotiation/ProviderPolicy.d.ts.map +1 -0
- package/dist/negotiation/ProviderPolicy.js +207 -0
- package/dist/negotiation/ProviderPolicy.js.map +1 -0
- package/dist/negotiation/index.d.ts +8 -1
- package/dist/negotiation/index.d.ts.map +1 -1
- package/dist/negotiation/index.js +8 -1
- package/dist/negotiation/index.js.map +1 -1
- package/dist/negotiation/verifyQuoteOnChain.d.ts +58 -0
- package/dist/negotiation/verifyQuoteOnChain.d.ts.map +1 -0
- package/dist/negotiation/verifyQuoteOnChain.js +83 -0
- package/dist/negotiation/verifyQuoteOnChain.js.map +1 -0
- package/dist/runtime/BlockchainRuntime.d.ts +13 -0
- package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
- package/dist/runtime/BlockchainRuntime.js +23 -0
- package/dist/runtime/BlockchainRuntime.js.map +1 -1
- package/dist/runtime/IACTPRuntime.d.ts +35 -0
- package/dist/runtime/IACTPRuntime.d.ts.map +1 -1
- package/dist/runtime/MockRuntime.d.ts +11 -0
- package/dist/runtime/MockRuntime.d.ts.map +1 -1
- package/dist/runtime/MockRuntime.js +39 -0
- package/dist/runtime/MockRuntime.js.map +1 -1
- package/dist/runtime/types/MockState.d.ts +10 -0
- package/dist/runtime/types/MockState.d.ts.map +1 -1
- package/dist/runtime/types/MockState.js.map +1 -1
- package/dist/transport/QuoteChannel.d.ts +201 -0
- package/dist/transport/QuoteChannel.d.ts.map +1 -0
- package/dist/transport/QuoteChannel.js +358 -0
- package/dist/transport/QuoteChannel.js.map +1 -0
- package/dist/types/adapter.d.ts +24 -24
- package/package.json +16 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProviderPolicy — hard guardrails for autonomous provider quoting.
|
|
3
|
+
*
|
|
4
|
+
* Symmetric to BuyerPolicy. Provider configures what they'll deliver,
|
|
5
|
+
* their price floor, and their lifecycle preferences; ProviderPolicyEngine
|
|
6
|
+
* enforces those invariants on every incoming request so the provider
|
|
7
|
+
* never quotes below floor, outside their service menu, or for a
|
|
8
|
+
* transaction they can't realistically complete before the deadline.
|
|
9
|
+
*
|
|
10
|
+
* @module negotiation/ProviderPolicy
|
|
11
|
+
* @see Protocol/aips/AIP-2.1-DRAFT.md §5.2 (ProviderPolicy.ts creation)
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* What this agent provides + at what terms.
|
|
15
|
+
*
|
|
16
|
+
* Pricing invariant (enforced at construction):
|
|
17
|
+
* ideal_price.amount ≥ min_acceptable.amount ≥ PLATFORM_MIN_USDC
|
|
18
|
+
*
|
|
19
|
+
* `currency`/`unit` must be identical across min_acceptable and
|
|
20
|
+
* ideal_price — we compare amounts directly, there's no FX in v1.
|
|
21
|
+
*/
|
|
22
|
+
export interface ProviderPolicy {
|
|
23
|
+
/**
|
|
24
|
+
* Services this provider offers. Incoming requests for service types
|
|
25
|
+
* NOT in this list get a 'skip' decision (let the tx timeout to
|
|
26
|
+
* CANCELLED; we don't quote for work we don't do).
|
|
27
|
+
*/
|
|
28
|
+
services: string[];
|
|
29
|
+
pricing: {
|
|
30
|
+
/** Absolute floor. Any buyer maxPrice below this → skip. */
|
|
31
|
+
min_acceptable: {
|
|
32
|
+
amount: number;
|
|
33
|
+
currency: string;
|
|
34
|
+
unit: string;
|
|
35
|
+
};
|
|
36
|
+
/** Preferred quote amount when buyer's maxPrice ≥ ideal. */
|
|
37
|
+
ideal_price: {
|
|
38
|
+
amount: number;
|
|
39
|
+
currency: string;
|
|
40
|
+
unit: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/** Quote validity window (e.g. "15m"). Governs our QuoteMessage expiresAt. */
|
|
44
|
+
quote_ttl: string;
|
|
45
|
+
/**
|
|
46
|
+
* Minimum time (seconds) we need between now and tx.deadline to
|
|
47
|
+
* realistically deliver. Requests with a tighter deadline get 'skip'.
|
|
48
|
+
* Defaults to 60s if omitted.
|
|
49
|
+
*/
|
|
50
|
+
min_deadline_seconds?: number;
|
|
51
|
+
}
|
|
52
|
+
export type ProviderPolicyViolation = {
|
|
53
|
+
rule: 'service_not_offered';
|
|
54
|
+
detail: string;
|
|
55
|
+
} | {
|
|
56
|
+
rule: 'max_price_below_floor';
|
|
57
|
+
detail: string;
|
|
58
|
+
} | {
|
|
59
|
+
rule: 'deadline_too_tight';
|
|
60
|
+
detail: string;
|
|
61
|
+
} | {
|
|
62
|
+
rule: 'currency_mismatch';
|
|
63
|
+
detail: string;
|
|
64
|
+
} | {
|
|
65
|
+
rule: 'unit_mismatch';
|
|
66
|
+
detail: string;
|
|
67
|
+
};
|
|
68
|
+
export interface ProviderPolicyResult {
|
|
69
|
+
allowed: boolean;
|
|
70
|
+
violations: ProviderPolicyViolation[];
|
|
71
|
+
/**
|
|
72
|
+
* When `allowed`, the amount we SHOULD quote per this policy,
|
|
73
|
+
* expressed in USDC base units (1e6 per $1) as a decimal string.
|
|
74
|
+
* Using string-of-base-units throughout avoids Number/float drift
|
|
75
|
+
* on very large amounts and matches what the QuoteMessage carries.
|
|
76
|
+
*
|
|
77
|
+
* Rule: quote our ideal if buyer maxPrice ≥ ideal; otherwise quote
|
|
78
|
+
* at buyer maxPrice (still ≥ floor, validated above). Never below
|
|
79
|
+
* min_acceptable.
|
|
80
|
+
*/
|
|
81
|
+
recommended_quote_amount_base_units?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Incoming request surface — the minimum the orchestrator needs to
|
|
85
|
+
* decide whether + at what price to quote. Extracted from the
|
|
86
|
+
* on-chain transaction plus any off-chain context the caller has
|
|
87
|
+
* (service type, consumer DID).
|
|
88
|
+
*/
|
|
89
|
+
export interface IncomingRequest {
|
|
90
|
+
txId: string;
|
|
91
|
+
consumer: string;
|
|
92
|
+
/** Buyer's offered amount in USDC base units (smallest unit, string). */
|
|
93
|
+
offeredAmount: string;
|
|
94
|
+
/** Buyer's ceiling in USDC base units. */
|
|
95
|
+
maxPrice: string;
|
|
96
|
+
/** Unix seconds — tx.deadline from on-chain. */
|
|
97
|
+
deadline: number;
|
|
98
|
+
/** Service identifier (e.g. "code-review"). */
|
|
99
|
+
serviceType: string;
|
|
100
|
+
currency: string;
|
|
101
|
+
unit: string;
|
|
102
|
+
}
|
|
103
|
+
export declare class ProviderPolicyEngine {
|
|
104
|
+
private readonly policy;
|
|
105
|
+
private readonly floorBaseUnits;
|
|
106
|
+
private readonly idealBaseUnits;
|
|
107
|
+
private readonly currency;
|
|
108
|
+
constructor(policy: ProviderPolicy);
|
|
109
|
+
/**
|
|
110
|
+
* Evaluate an incoming request against policy. Returns `allowed: true`
|
|
111
|
+
* with `recommended_quote_amount_base_units` (bigint-as-string) when
|
|
112
|
+
* we should quote, or `allowed: false` with the specific rule(s)
|
|
113
|
+
* violated.
|
|
114
|
+
*
|
|
115
|
+
* All numeric comparisons use BigInt on base units — no float drift,
|
|
116
|
+
* no precision loss for large amounts.
|
|
117
|
+
*/
|
|
118
|
+
evaluate(req: IncomingRequest): ProviderPolicyResult;
|
|
119
|
+
/**
|
|
120
|
+
* Decide whether to accept a buyer's counter-offer.
|
|
121
|
+
*
|
|
122
|
+
* Simple rule: accept if counter ≥ min_acceptable; reject otherwise.
|
|
123
|
+
* All arithmetic is BigInt on base units — no float drift.
|
|
124
|
+
* Phase 3 will extend this with `counter-counter` strategies.
|
|
125
|
+
*/
|
|
126
|
+
evaluateCounter(counterAmountBaseUnits: string): {
|
|
127
|
+
decision: 'accept' | 'reject';
|
|
128
|
+
reason: string;
|
|
129
|
+
};
|
|
130
|
+
/** Expose ttl as seconds for callers building QuoteMessage.expiresAt. */
|
|
131
|
+
get quoteTtlSeconds(): number;
|
|
132
|
+
/** Expose the policy's currency for orchestrator wiring. */
|
|
133
|
+
get policyCurrency(): string;
|
|
134
|
+
/** Expose the policy's unit for orchestrator wiring + UI. */
|
|
135
|
+
get policyUnit(): string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Parse a short duration string like "15m", "1h", "30s" into seconds.
|
|
139
|
+
* Mirror of PolicyEngine.parseTtl (buyer side) so both sides use the
|
|
140
|
+
* same format in their JSON policies.
|
|
141
|
+
*/
|
|
142
|
+
export declare function parseTtl(ttl: string): number;
|
|
143
|
+
//# sourceMappingURL=ProviderPolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProviderPolicy.d.ts","sourceRoot":"","sources":["../../src/negotiation/ProviderPolicy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IAEnB,OAAO,EAAE;QACP,4DAA4D;QAC5D,cAAc,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QACnE,4DAA4D;QAC5D,WAAW,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;KACjE,CAAC;IAEF,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAA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— hard guardrails for autonomous provider quoting.
|
|
4
|
+
*
|
|
5
|
+
* Symmetric to BuyerPolicy. Provider configures what they'll deliver,
|
|
6
|
+
* their price floor, and their lifecycle preferences; ProviderPolicyEngine
|
|
7
|
+
* enforces those invariants on every incoming request so the provider
|
|
8
|
+
* never quotes below floor, outside their service menu, or for a
|
|
9
|
+
* transaction they can't realistically complete before the deadline.
|
|
10
|
+
*
|
|
11
|
+
* @module negotiation/ProviderPolicy
|
|
12
|
+
* @see Protocol/aips/AIP-2.1-DRAFT.md §5.2 (ProviderPolicy.ts creation)
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.parseTtl = exports.ProviderPolicyEngine = void 0;
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Engine
|
|
18
|
+
// ============================================================================
|
|
19
|
+
/** Base units per $1 for supported currencies. USDC = 1e6 (6 decimals). */
|
|
20
|
+
const BASE_UNITS_PER_USD = {
|
|
21
|
+
USDC: 1000000n,
|
|
22
|
+
};
|
|
23
|
+
/** Platform minimum in base units — $0.05 × 1e6 for USDC. */
|
|
24
|
+
const PLATFORM_MIN_BASE_UNITS = {
|
|
25
|
+
USDC: 50000n,
|
|
26
|
+
};
|
|
27
|
+
const DEFAULT_MIN_DEADLINE_SECONDS = 60;
|
|
28
|
+
/** Convert a human amount (e.g. 5, 10.5) to base units (bigint). */
|
|
29
|
+
function toBaseUnits(amount, currency) {
|
|
30
|
+
const perUsd = BASE_UNITS_PER_USD[currency.toUpperCase()];
|
|
31
|
+
if (!perUsd)
|
|
32
|
+
throw new Error(`Unsupported currency: ${currency}`);
|
|
33
|
+
// Do the scaling as string→BigInt to avoid float drift on amounts
|
|
34
|
+
// that don't fit cleanly in double precision (e.g. 0.1).
|
|
35
|
+
const [whole, frac = ''] = String(amount).split('.');
|
|
36
|
+
const fracPadded = (frac + '000000').slice(0, String(perUsd).length - 1);
|
|
37
|
+
return BigInt(whole) * perUsd + BigInt(fracPadded || '0');
|
|
38
|
+
}
|
|
39
|
+
/** Format base units back to a human string for error messages. */
|
|
40
|
+
function formatFromBaseUnits(baseUnits, currency) {
|
|
41
|
+
const perUsd = BASE_UNITS_PER_USD[currency.toUpperCase()];
|
|
42
|
+
if (!perUsd)
|
|
43
|
+
return `${baseUnits} base units`;
|
|
44
|
+
const whole = baseUnits / perUsd;
|
|
45
|
+
const frac = baseUnits % perUsd;
|
|
46
|
+
const fracStr = frac.toString().padStart(String(perUsd).length - 1, '0').replace(/0+$/, '');
|
|
47
|
+
return fracStr ? `$${whole}.${fracStr}` : `$${whole}`;
|
|
48
|
+
}
|
|
49
|
+
class ProviderPolicyEngine {
|
|
50
|
+
constructor(policy) {
|
|
51
|
+
const currency = policy.pricing.min_acceptable.currency;
|
|
52
|
+
const platformMin = PLATFORM_MIN_BASE_UNITS[currency.toUpperCase()];
|
|
53
|
+
if (!platformMin) {
|
|
54
|
+
throw new Error(`Unsupported currency in policy: ${currency}`);
|
|
55
|
+
}
|
|
56
|
+
// Enforce pricing invariants at construction — fail fast so mis-
|
|
57
|
+
// configured providers don't quote garbage.
|
|
58
|
+
const floorBu = toBaseUnits(policy.pricing.min_acceptable.amount, currency);
|
|
59
|
+
const idealBu = toBaseUnits(policy.pricing.ideal_price.amount, currency);
|
|
60
|
+
if (floorBu < platformMin) {
|
|
61
|
+
throw new Error(`min_acceptable.amount (${formatFromBaseUnits(floorBu, currency)}) below platform minimum (${formatFromBaseUnits(platformMin, currency)})`);
|
|
62
|
+
}
|
|
63
|
+
if (idealBu < floorBu) {
|
|
64
|
+
throw new Error(`ideal_price.amount (${formatFromBaseUnits(idealBu, currency)}) must be ≥ min_acceptable.amount (${formatFromBaseUnits(floorBu, currency)})`);
|
|
65
|
+
}
|
|
66
|
+
if (policy.pricing.min_acceptable.currency !== policy.pricing.ideal_price.currency) {
|
|
67
|
+
throw new Error('min_acceptable.currency must equal ideal_price.currency');
|
|
68
|
+
}
|
|
69
|
+
if (policy.pricing.min_acceptable.unit !== policy.pricing.ideal_price.unit) {
|
|
70
|
+
throw new Error('min_acceptable.unit must equal ideal_price.unit');
|
|
71
|
+
}
|
|
72
|
+
this.policy = policy;
|
|
73
|
+
this.floorBaseUnits = floorBu;
|
|
74
|
+
this.idealBaseUnits = idealBu;
|
|
75
|
+
this.currency = currency;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Evaluate an incoming request against policy. Returns `allowed: true`
|
|
79
|
+
* with `recommended_quote_amount_base_units` (bigint-as-string) when
|
|
80
|
+
* we should quote, or `allowed: false` with the specific rule(s)
|
|
81
|
+
* violated.
|
|
82
|
+
*
|
|
83
|
+
* All numeric comparisons use BigInt on base units — no float drift,
|
|
84
|
+
* no precision loss for large amounts.
|
|
85
|
+
*/
|
|
86
|
+
evaluate(req) {
|
|
87
|
+
const violations = [];
|
|
88
|
+
if (!this.policy.services.includes(req.serviceType)) {
|
|
89
|
+
violations.push({
|
|
90
|
+
rule: 'service_not_offered',
|
|
91
|
+
detail: `We don't offer service "${req.serviceType}". Configured: ${this.policy.services.join(', ')}`,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (req.currency.toUpperCase() !== this.currency.toUpperCase()) {
|
|
95
|
+
violations.push({
|
|
96
|
+
rule: 'currency_mismatch',
|
|
97
|
+
detail: `Request in ${req.currency}, we quote in ${this.currency}`,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// `unit` is the pricing unit (job, hour, page, request, …).
|
|
101
|
+
// Buyer quoting $5/hour vs provider priced-per-job is a genuine
|
|
102
|
+
// mismatch and must not silently be quoted.
|
|
103
|
+
if (req.unit !== this.policy.pricing.min_acceptable.unit) {
|
|
104
|
+
violations.push({
|
|
105
|
+
rule: 'unit_mismatch',
|
|
106
|
+
detail: `Request unit "${req.unit}" does not match policy unit "${this.policy.pricing.min_acceptable.unit}"`,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
let maxPriceBu;
|
|
110
|
+
try {
|
|
111
|
+
maxPriceBu = BigInt(req.maxPrice);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
violations.push({
|
|
115
|
+
rule: 'max_price_below_floor',
|
|
116
|
+
detail: `Invalid maxPrice: ${req.maxPrice}`,
|
|
117
|
+
});
|
|
118
|
+
maxPriceBu = 0n;
|
|
119
|
+
}
|
|
120
|
+
if (maxPriceBu < this.floorBaseUnits) {
|
|
121
|
+
violations.push({
|
|
122
|
+
rule: 'max_price_below_floor',
|
|
123
|
+
detail: `Buyer maxPrice ${formatFromBaseUnits(maxPriceBu, this.currency)} below our floor ${formatFromBaseUnits(this.floorBaseUnits, this.currency)}`,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const now = Math.floor(Date.now() / 1000);
|
|
127
|
+
const minDeadlineSeconds = this.policy.min_deadline_seconds ?? DEFAULT_MIN_DEADLINE_SECONDS;
|
|
128
|
+
if (req.deadline - now < minDeadlineSeconds) {
|
|
129
|
+
violations.push({
|
|
130
|
+
rule: 'deadline_too_tight',
|
|
131
|
+
detail: `tx.deadline - now = ${req.deadline - now}s, need ≥ ${minDeadlineSeconds}s`,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
if (violations.length > 0) {
|
|
135
|
+
return { allowed: false, violations };
|
|
136
|
+
}
|
|
137
|
+
// Recommended quote: ideal unless buyer can't afford it, in which
|
|
138
|
+
// case we quote at maxPrice (still above floor — validated above).
|
|
139
|
+
// BigInt min/max via ternary since there's no Math.min for BigInt.
|
|
140
|
+
const ceilingBu = maxPriceBu < this.idealBaseUnits ? maxPriceBu : this.idealBaseUnits;
|
|
141
|
+
const recommendedBu = ceilingBu > this.floorBaseUnits ? ceilingBu : this.floorBaseUnits;
|
|
142
|
+
return {
|
|
143
|
+
allowed: true,
|
|
144
|
+
violations: [],
|
|
145
|
+
recommended_quote_amount_base_units: recommendedBu.toString(),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Decide whether to accept a buyer's counter-offer.
|
|
150
|
+
*
|
|
151
|
+
* Simple rule: accept if counter ≥ min_acceptable; reject otherwise.
|
|
152
|
+
* All arithmetic is BigInt on base units — no float drift.
|
|
153
|
+
* Phase 3 will extend this with `counter-counter` strategies.
|
|
154
|
+
*/
|
|
155
|
+
evaluateCounter(counterAmountBaseUnits) {
|
|
156
|
+
let counter;
|
|
157
|
+
try {
|
|
158
|
+
counter = BigInt(counterAmountBaseUnits);
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return { decision: 'reject', reason: `Invalid counter amount: ${counterAmountBaseUnits}` };
|
|
162
|
+
}
|
|
163
|
+
if (counter < this.floorBaseUnits) {
|
|
164
|
+
return {
|
|
165
|
+
decision: 'reject',
|
|
166
|
+
reason: `Counter ${formatFromBaseUnits(counter, this.currency)} below our floor ${formatFromBaseUnits(this.floorBaseUnits, this.currency)}`,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
decision: 'accept',
|
|
171
|
+
reason: `Counter ${formatFromBaseUnits(counter, this.currency)} meets our floor`,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/** Expose ttl as seconds for callers building QuoteMessage.expiresAt. */
|
|
175
|
+
get quoteTtlSeconds() {
|
|
176
|
+
return parseTtl(this.policy.quote_ttl);
|
|
177
|
+
}
|
|
178
|
+
/** Expose the policy's currency for orchestrator wiring. */
|
|
179
|
+
get policyCurrency() {
|
|
180
|
+
return this.currency;
|
|
181
|
+
}
|
|
182
|
+
/** Expose the policy's unit for orchestrator wiring + UI. */
|
|
183
|
+
get policyUnit() {
|
|
184
|
+
return this.policy.pricing.min_acceptable.unit;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.ProviderPolicyEngine = ProviderPolicyEngine;
|
|
188
|
+
/**
|
|
189
|
+
* Parse a short duration string like "15m", "1h", "30s" into seconds.
|
|
190
|
+
* Mirror of PolicyEngine.parseTtl (buyer side) so both sides use the
|
|
191
|
+
* same format in their JSON policies.
|
|
192
|
+
*/
|
|
193
|
+
function parseTtl(ttl) {
|
|
194
|
+
const match = ttl.trim().match(/^(\d+)\s*([smh])$/i);
|
|
195
|
+
if (!match) {
|
|
196
|
+
throw new Error(`Invalid TTL format: "${ttl}" (expected e.g. "15m", "1h", "30s")`);
|
|
197
|
+
}
|
|
198
|
+
const n = Number(match[1]);
|
|
199
|
+
const unit = match[2].toLowerCase();
|
|
200
|
+
if (unit === 's')
|
|
201
|
+
return n;
|
|
202
|
+
if (unit === 'm')
|
|
203
|
+
return n * 60;
|
|
204
|
+
return n * 3600;
|
|
205
|
+
}
|
|
206
|
+
exports.parseTtl = parseTtl;
|
|
207
|
+
//# sourceMappingURL=ProviderPolicy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProviderPolicy.js","sourceRoot":"","sources":["../../src/negotiation/ProviderPolicy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAqFH,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,2EAA2E;AAC3E,MAAM,kBAAkB,GAA2B;IACjD,IAAI,EAAE,QAAU;CACjB,CAAC;AACF,6DAA6D;AAC7D,MAAM,uBAAuB,GAA2B;IACtD,IAAI,EAAE,MAAO;CACd,CAAC;AACF,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAExC,oEAAoE;AACpE,SAAS,WAAW,CAAC,MAAc,EAAE,QAAgB;IACnD,MAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IAC1D,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAC;IAClE,kEAAkE;IAClE,yDAAyD;IACzD,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrD,MAAM,UAAU,GA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AM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACpC,IAAI,IAAI,KAAK,GAAG;QAAE,OAAO,CAAC,CAAC;IAC3B,IAAI,IAAI,KAAK,GAAG;QAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IAChC,OAAO,CAAC,GAAG,IAAI,CAAC;AAClB,CAAC;AAVD,4BAUC"}
|
|
@@ -5,5 +5,12 @@ export type { ScoringWeights, CandidateStats, ScoredCandidate } from './Decision
|
|
|
5
5
|
export { SessionStore } from './SessionStore';
|
|
6
6
|
export type { SessionMapping } from './SessionStore';
|
|
7
7
|
export { BuyerOrchestrator } from './BuyerOrchestrator';
|
|
8
|
-
export type { NegotiationResult, RoundResult, OrchestratorConfig, ProgressEvent } from './BuyerOrchestrator';
|
|
8
|
+
export type { NegotiationResult, RoundResult, OrchestratorConfig, ProgressEvent, BuyerNegotiationContext, } from './BuyerOrchestrator';
|
|
9
|
+
export { verifyQuoteHashOnChain } from './verifyQuoteOnChain';
|
|
10
|
+
export type { VerifySource, VerifyOnChainResult } from './verifyQuoteOnChain';
|
|
11
|
+
export type { QuoteForEvaluation, QuoteEvaluation } from './DecisionEngine';
|
|
12
|
+
export { ProviderPolicyEngine, parseTtl as parseProviderTtl } from './ProviderPolicy';
|
|
13
|
+
export type { ProviderPolicy, ProviderPolicyViolation, ProviderPolicyResult, IncomingRequest } from './ProviderPolicy';
|
|
14
|
+
export { ProviderOrchestrator } from './ProviderOrchestrator';
|
|
15
|
+
export type { ProviderOrchestratorConfig, QuoteDecision, QuoteResult, CounterDecision } from './ProviderOrchestrator';
|
|
9
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/negotiation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,g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oB,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtF,YAAY,EAAE,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,0BAA0B,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuyerOrchestrator = exports.SessionStore = exports.DecisionEngine = exports.PolicyEngine = void 0;
|
|
3
|
+
exports.ProviderOrchestrator = exports.parseProviderTtl = exports.ProviderPolicyEngine = exports.verifyQuoteHashOnChain = exports.BuyerOrchestrator = exports.SessionStore = exports.DecisionEngine = exports.PolicyEngine = void 0;
|
|
4
4
|
var PolicyEngine_1 = require("./PolicyEngine");
|
|
5
5
|
Object.defineProperty(exports, "PolicyEngine", { enumerable: true, get: function () { return PolicyEngine_1.PolicyEngine; } });
|
|
6
6
|
var DecisionEngine_1 = require("./DecisionEngine");
|
|
@@ -9,4 +9,11 @@ var SessionStore_1 = require("./SessionStore");
|
|
|
9
9
|
Object.defineProperty(exports, "SessionStore", { enumerable: true, get: function () { return SessionStore_1.SessionStore; } });
|
|
10
10
|
var BuyerOrchestrator_1 = require("./BuyerOrchestrator");
|
|
11
11
|
Object.defineProperty(exports, "BuyerOrchestrator", { enumerable: true, get: function () { return BuyerOrchestrator_1.BuyerOrchestrator; } });
|
|
12
|
+
var verifyQuoteOnChain_1 = require("./verifyQuoteOnChain");
|
|
13
|
+
Object.defineProperty(exports, "verifyQuoteHashOnChain", { enumerable: true, get: function () { return verifyQuoteOnChain_1.verifyQuoteHashOnChain; } });
|
|
14
|
+
var ProviderPolicy_1 = require("./ProviderPolicy");
|
|
15
|
+
Object.defineProperty(exports, "ProviderPolicyEngine", { enumerable: true, get: function () { return ProviderPolicy_1.ProviderPolicyEngine; } });
|
|
16
|
+
Object.defineProperty(exports, "parseProviderTtl", { enumerable: true, get: function () { return ProviderPolicy_1.parseTtl; } });
|
|
17
|
+
var ProviderOrchestrator_1 = require("./ProviderOrchestrator");
|
|
18
|
+
Object.defineProperty(exports, "ProviderOrchestrator", { enumerable: true, get: function () { return ProviderOrchestrator_1.ProviderOrchestrator; } });
|
|
12
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/negotiation/index.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAGvB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/negotiation/index.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAGvB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAS1B,2DAA8D;AAArD,4HAAA,sBAAsB,OAAA;AAK/B,mDAAsF;AAA7E,sHAAA,oBAAoB,OAAA;AAAE,kHAAA,QAAQ,OAAoB;AAG3D,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* verifyQuoteOnChain — cross-reference a received QuoteMessage against
|
|
3
|
+
* the hash a provider committed on-chain via `transitionState(QUOTED, …)`.
|
|
4
|
+
*
|
|
5
|
+
* AIP-2.1 §3.6 (legacy compatibility). Two matchers, tried in order:
|
|
6
|
+
*
|
|
7
|
+
* 1. `'aip2'` — canonical EIP-712 hash: keccak256(canonicalJson(
|
|
8
|
+
* QuoteMessage minus signature)). This is what
|
|
9
|
+
* AIP-2.1-compliant providers emit.
|
|
10
|
+
* 2. `'legacy'` — ad-hoc hash from Agent.ts:1035-1038 (the
|
|
11
|
+
* counter-offer pricing path that shipped before the
|
|
12
|
+
* formal AIP-2.1 submitQuote runtime method). Hash is:
|
|
13
|
+
* keccak256(JSON.stringify({
|
|
14
|
+
* txId, providerIdealPrice, actualEscrow, provider
|
|
15
|
+
* }))
|
|
16
|
+
* where `providerIdealPrice` is the provider's intended
|
|
17
|
+
* sell price in USDC base units (string), `actualEscrow`
|
|
18
|
+
* is tx.amount (the buyer-offered amount), and `provider`
|
|
19
|
+
* is the provider's EOA address. This path is used
|
|
20
|
+
* only when the SDK-authored hash can't be reconstructed
|
|
21
|
+
* (e.g. pre-AIP-2.1 agents still running).
|
|
22
|
+
*
|
|
23
|
+
* Both paths return a `{ source, match: true }` tagged result so the
|
|
24
|
+
* orchestrator + telemetry can see how many transactions are still
|
|
25
|
+
* coming through the legacy path. The legacy matcher is
|
|
26
|
+
* observability-tagged technical debt — planned removal in 2 SDK
|
|
27
|
+
* minor releases per the AIP-2.1 migration schedule.
|
|
28
|
+
*
|
|
29
|
+
* @module negotiation/verifyQuoteOnChain
|
|
30
|
+
*/
|
|
31
|
+
import { QuoteMessage } from '../builders/QuoteBuilder';
|
|
32
|
+
export type VerifySource = 'aip2' | 'legacy';
|
|
33
|
+
export interface VerifyOnChainResult {
|
|
34
|
+
match: boolean;
|
|
35
|
+
/** Which matcher accepted the hash. Only set when `match === true`. */
|
|
36
|
+
source?: VerifySource;
|
|
37
|
+
/** Expected hash per the canonical matcher, for debugging mismatches. */
|
|
38
|
+
canonicalHash?: string;
|
|
39
|
+
/** Expected legacy hash (same purpose). */
|
|
40
|
+
legacyHash?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Cross-reference an off-chain QuoteMessage against the hash stored on
|
|
44
|
+
* chain in `tx.metadata` (or equivalent — MockTransaction.quoteHash).
|
|
45
|
+
*
|
|
46
|
+
* Passing `providerAddress` and `actualEscrow` enables the legacy
|
|
47
|
+
* fallback. Omit them on fresh deployments where legacy is impossible.
|
|
48
|
+
*
|
|
49
|
+
* @param quote - signed QuoteMessage received off-chain
|
|
50
|
+
* @param onChainHash - hash committed on-chain at QUOTED
|
|
51
|
+
* @param providerAddress - provider's EOA address (needed for legacy)
|
|
52
|
+
* @param actualEscrow - tx.amount at QUOTED time (needed for legacy)
|
|
53
|
+
*/
|
|
54
|
+
export declare function verifyQuoteHashOnChain(quote: QuoteMessage, onChainHash: string, opts?: {
|
|
55
|
+
providerAddress?: string;
|
|
56
|
+
actualEscrow?: string;
|
|
57
|
+
}): VerifyOnChainResult;
|
|
58
|
+
//# sourceMappingURL=verifyQuoteOnChain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyQuoteOnChain.d.ts","sourceRoot":"","sources":["../../src/negotiation/verifyQuoteOnChain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAgB,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAItE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE7C,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE;IACJ,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CAClB,GACL,mBAAmB,CAiCrB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* verifyQuoteOnChain — cross-reference a received QuoteMessage against
|
|
4
|
+
* the hash a provider committed on-chain via `transitionState(QUOTED, …)`.
|
|
5
|
+
*
|
|
6
|
+
* AIP-2.1 §3.6 (legacy compatibility). Two matchers, tried in order:
|
|
7
|
+
*
|
|
8
|
+
* 1. `'aip2'` — canonical EIP-712 hash: keccak256(canonicalJson(
|
|
9
|
+
* QuoteMessage minus signature)). This is what
|
|
10
|
+
* AIP-2.1-compliant providers emit.
|
|
11
|
+
* 2. `'legacy'` — ad-hoc hash from Agent.ts:1035-1038 (the
|
|
12
|
+
* counter-offer pricing path that shipped before the
|
|
13
|
+
* formal AIP-2.1 submitQuote runtime method). Hash is:
|
|
14
|
+
* keccak256(JSON.stringify({
|
|
15
|
+
* txId, providerIdealPrice, actualEscrow, provider
|
|
16
|
+
* }))
|
|
17
|
+
* where `providerIdealPrice` is the provider's intended
|
|
18
|
+
* sell price in USDC base units (string), `actualEscrow`
|
|
19
|
+
* is tx.amount (the buyer-offered amount), and `provider`
|
|
20
|
+
* is the provider's EOA address. This path is used
|
|
21
|
+
* only when the SDK-authored hash can't be reconstructed
|
|
22
|
+
* (e.g. pre-AIP-2.1 agents still running).
|
|
23
|
+
*
|
|
24
|
+
* Both paths return a `{ source, match: true }` tagged result so the
|
|
25
|
+
* orchestrator + telemetry can see how many transactions are still
|
|
26
|
+
* coming through the legacy path. The legacy matcher is
|
|
27
|
+
* observability-tagged technical debt — planned removal in 2 SDK
|
|
28
|
+
* minor releases per the AIP-2.1 migration schedule.
|
|
29
|
+
*
|
|
30
|
+
* @module negotiation/verifyQuoteOnChain
|
|
31
|
+
*/
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.verifyQuoteHashOnChain = void 0;
|
|
34
|
+
const ethers_1 = require("ethers");
|
|
35
|
+
const QuoteBuilder_1 = require("../builders/QuoteBuilder");
|
|
36
|
+
const ethers_2 = require("ethers");
|
|
37
|
+
const NonceManager_1 = require("../utils/NonceManager");
|
|
38
|
+
/**
|
|
39
|
+
* Cross-reference an off-chain QuoteMessage against the hash stored on
|
|
40
|
+
* chain in `tx.metadata` (or equivalent — MockTransaction.quoteHash).
|
|
41
|
+
*
|
|
42
|
+
* Passing `providerAddress` and `actualEscrow` enables the legacy
|
|
43
|
+
* fallback. Omit them on fresh deployments where legacy is impossible.
|
|
44
|
+
*
|
|
45
|
+
* @param quote - signed QuoteMessage received off-chain
|
|
46
|
+
* @param onChainHash - hash committed on-chain at QUOTED
|
|
47
|
+
* @param providerAddress - provider's EOA address (needed for legacy)
|
|
48
|
+
* @param actualEscrow - tx.amount at QUOTED time (needed for legacy)
|
|
49
|
+
*/
|
|
50
|
+
function verifyQuoteHashOnChain(quote, onChainHash, opts = {}) {
|
|
51
|
+
// 1. Canonical AIP-2 match. Hasher is signer-independent so a
|
|
52
|
+
// throwaway wallet is fine.
|
|
53
|
+
const hasher = new QuoteBuilder_1.QuoteBuilder(ethers_2.Wallet.createRandom(), new NonceManager_1.InMemoryNonceManager());
|
|
54
|
+
const canonicalHash = hasher.computeHash(quote);
|
|
55
|
+
if (canonicalHash.toLowerCase() === onChainHash.toLowerCase()) {
|
|
56
|
+
return { match: true, source: 'aip2', canonicalHash };
|
|
57
|
+
}
|
|
58
|
+
// 2. Legacy Agent.ts:1033-1038 match. Only attempted when we have
|
|
59
|
+
// the legacy inputs — without them the fallback is impossible
|
|
60
|
+
// by construction (which is fine — old providers will simply
|
|
61
|
+
// fail verification and the orchestrator will cancel the tx).
|
|
62
|
+
let legacyHash;
|
|
63
|
+
if (opts.providerAddress && opts.actualEscrow) {
|
|
64
|
+
// The legacy hash uses `providerIdealPrice` (what provider WANTED
|
|
65
|
+
// to charge) rather than the `quotedAmount` from the off-chain
|
|
66
|
+
// message — at the counter-offer pricing path, those are the same
|
|
67
|
+
// value (see Agent.ts:1034). We reconstruct the legacy shape with
|
|
68
|
+
// the off-chain quote's `quotedAmount` as the ideal price.
|
|
69
|
+
const legacyShape = {
|
|
70
|
+
txId: quote.txId,
|
|
71
|
+
providerIdealPrice: quote.quotedAmount,
|
|
72
|
+
actualEscrow: opts.actualEscrow,
|
|
73
|
+
provider: opts.providerAddress,
|
|
74
|
+
};
|
|
75
|
+
legacyHash = (0, ethers_1.keccak256)((0, ethers_1.toUtf8Bytes)(JSON.stringify(legacyShape)));
|
|
76
|
+
if (legacyHash.toLowerCase() === onChainHash.toLowerCase()) {
|
|
77
|
+
return { match: true, source: 'legacy', canonicalHash, legacyHash };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { match: false, canonicalHash, legacyHash };
|
|
81
|
+
}
|
|
82
|
+
exports.verifyQuoteHashOnChain = verifyQuoteHashOnChain;
|
|
83
|
+
//# sourceMappingURL=verifyQuoteOnChain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyQuoteOnChain.js","sourceRoot":"","sources":["../../src/negotiation/verifyQuoteOnChain.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAEH,mCAAgD;AAChD,2DAAsE;AACtE,mCAAgD;AAChD,wDAA6D;AAc7D;;;;;;;;;;;GAWG;AACH,SAAgB,sBAAsB,CACpC,KAAmB,EACnB,WAAmB,EACnB,OAGI,EAAE;IAEN,8DAA8D;IAC9D,+BAA+B;IAC/B,MAAM,MAAM,GAAG,IAAI,2BAAY,CAAC,eAAY,CAAC,YAAY,EAAE,EAAE,IAAI,mCAAoB,EAAE,CAAC,CAAC;IACzF,MAAM,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,aAAa,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC;QAC9D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACxD,CAAC;IAED,kEAAkE;IAClE,iEAAiE;IACjE,gEAAgE;IAChE,iEAAiE;IACjE,IAAI,UAA8B,CAAC;IACnC,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QAC9C,kEAAkE;QAClE,+DAA+D;QAC/D,kEAAkE;QAClE,kEAAkE;QAClE,2DAA2D;QAC3D,MAAM,WAAW,GAAG;YAClB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,kBAAkB,EAAE,KAAK,CAAC,YAAY;YACtC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,QAAQ,EAAE,IAAI,CAAC,eAAe;SAC/B,CAAC;QACF,UAAU,GAAG,IAAA,kBAAS,EAAC,IAAA,oBAAW,EAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACjE,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC;YAC3D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC;QACtE,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC;AACrD,CAAC;AAxCD,wDAwCC"}
|
|
@@ -23,6 +23,7 @@ import { EASHelper, EASConfig } from '../protocol/EASHelper';
|
|
|
23
23
|
import { NetworkConfig } from '../config/networks';
|
|
24
24
|
import { IACTPRuntime, CreateTransactionParams } from './IACTPRuntime';
|
|
25
25
|
import { MockTransaction, TransactionState } from './types/MockState';
|
|
26
|
+
import { QuoteMessage } from '../builders/QuoteBuilder';
|
|
26
27
|
import { IUsedAttestationTracker } from '../utils/UsedAttestationTracker';
|
|
27
28
|
import { IReceivedNonceTracker } from '../utils/ReceivedNonceTracker';
|
|
28
29
|
/**
|
|
@@ -209,6 +210,18 @@ export declare class BlockchainRuntime implements IACTPRuntime {
|
|
|
209
210
|
* @param newAmount - New amount in USDC wei
|
|
210
211
|
*/
|
|
211
212
|
acceptQuote(txId: string, newAmount: string): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Submit an AIP-2 price quote on-chain.
|
|
215
|
+
*
|
|
216
|
+
* Delegates to the SDK's `ACTPKernel.submitQuote(txId, quoteHash)`
|
|
217
|
+
* wrapper, which itself calls the kernel's `transitionState(QUOTED,
|
|
218
|
+
* encodedHash)`. The canonical hash is recomputed here (signer-
|
|
219
|
+
* independent) to guarantee the wire format matches what any
|
|
220
|
+
* receiver's verifier will reconstruct from the QuoteMessage.
|
|
221
|
+
*
|
|
222
|
+
* See AIP-2.1-DRAFT §3.5 Option D1.
|
|
223
|
+
*/
|
|
224
|
+
submitQuote(txId: string, quote: QuoteMessage): Promise<void>;
|
|
212
225
|
/**
|
|
213
226
|
* Gets a transaction by ID
|
|
214
227
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockchainRuntime.d.ts","sourceRoot":"","sources":["../../src/runtime/BlockchainRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAU,MAAM,EAAE,eAAe,EAA0B,MAAM,QAAQ,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAc,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,M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