@pyrimid/sdk 0.1.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 +205 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +18 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +200 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/middleware.d.ts +68 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +204 -0
- package/dist/middleware.js.map +1 -0
- package/dist/resolver.d.ts +49 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +169 -0
- package/dist/resolver.js.map +1 -0
- package/dist/types.d.ts +127 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +50 -0
- package/dist/types.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pyrimid Vendor Middleware — 10-line x402 integration
|
|
3
|
+
*
|
|
4
|
+
* Drop this into any Express/Hono/Next.js server to activate
|
|
5
|
+
* affiliate-attributed commission splitting on your products.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { pyrimidMiddleware } from '@pyrimid/sdk';
|
|
9
|
+
* app.use(pyrimidMiddleware({
|
|
10
|
+
* vendorId: 'vn_your_id',
|
|
11
|
+
* products: {
|
|
12
|
+
* '/api/signals/latest': { productId: 'signals_latest', price: 250000, affiliateBps: 2000 }
|
|
13
|
+
* }
|
|
14
|
+
* }));
|
|
15
|
+
*
|
|
16
|
+
* PROPRIETARY — @pyrimid/sdk
|
|
17
|
+
*/
|
|
18
|
+
import { PYRIMID_ADDRESSES, } from './types.js';
|
|
19
|
+
// ═══════════════════════════════════════════════════════════
|
|
20
|
+
// PAYMENT SPLIT CALCULATOR
|
|
21
|
+
// ═══════════════════════════════════════════════════════════
|
|
22
|
+
export function calculateSplit(priceUsdc, affiliateBps) {
|
|
23
|
+
const protocolFee = Math.floor(priceUsdc / 100); // 1%
|
|
24
|
+
const remaining = priceUsdc - protocolFee;
|
|
25
|
+
const affiliateCommission = Math.floor((remaining * affiliateBps) / 10_000);
|
|
26
|
+
const vendorShare = remaining - affiliateCommission;
|
|
27
|
+
return {
|
|
28
|
+
total_usdc: priceUsdc,
|
|
29
|
+
protocol_fee: protocolFee,
|
|
30
|
+
affiliate_commission: affiliateCommission,
|
|
31
|
+
vendor_share: vendorShare,
|
|
32
|
+
affiliate_bps: affiliateBps,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Express/Connect-compatible middleware.
|
|
37
|
+
*
|
|
38
|
+
* Intercepts requests to configured product endpoints, checks for x402
|
|
39
|
+
* payment, verifies via the CommissionRouter, and either returns a 402
|
|
40
|
+
* with payment requirements or passes through to the next handler.
|
|
41
|
+
*/
|
|
42
|
+
export function pyrimidMiddleware(config) {
|
|
43
|
+
const { vendorId, network = 'base', products, } = config;
|
|
44
|
+
const addresses = PYRIMID_ADDRESSES[network];
|
|
45
|
+
const productPaths = new Map(Object.entries(products).map(([path, p]) => [path, p]));
|
|
46
|
+
return async function middleware(req, res, next) {
|
|
47
|
+
const pathname = req.path || new URL(req.url || '/', 'http://localhost').pathname;
|
|
48
|
+
const productConfig = productPaths.get(pathname);
|
|
49
|
+
// Not a Pyrimid product endpoint — pass through
|
|
50
|
+
if (!productConfig)
|
|
51
|
+
return next();
|
|
52
|
+
// Extract affiliate ID from header
|
|
53
|
+
const headers = req.headers instanceof Headers ? req.headers : new Headers(req.headers);
|
|
54
|
+
const affiliateId = headers.get('x-affiliate-id') || '';
|
|
55
|
+
// Check for x402 payment proof
|
|
56
|
+
const paymentProof = headers.get('x-payment-response');
|
|
57
|
+
if (!paymentProof) {
|
|
58
|
+
// No payment — return 402 with payment requirements
|
|
59
|
+
const split = calculateSplit(productConfig.price, productConfig.affiliateBps);
|
|
60
|
+
res.status(402);
|
|
61
|
+
res.setHeader('X-PAYMENT-REQUIRED', JSON.stringify({
|
|
62
|
+
protocol: 'x402',
|
|
63
|
+
network: 'base',
|
|
64
|
+
asset: addresses.USDC,
|
|
65
|
+
amount: productConfig.price.toString(),
|
|
66
|
+
recipient: addresses.ROUTER,
|
|
67
|
+
router: addresses.ROUTER,
|
|
68
|
+
vendor_id: vendorId,
|
|
69
|
+
product_id: productConfig.productId,
|
|
70
|
+
affiliate_id: affiliateId || 'af_treasury',
|
|
71
|
+
split: {
|
|
72
|
+
protocol: split.protocol_fee,
|
|
73
|
+
affiliate: split.affiliate_commission,
|
|
74
|
+
vendor: split.vendor_share,
|
|
75
|
+
},
|
|
76
|
+
expires: new Date(Date.now() + 5 * 60_000).toISOString(),
|
|
77
|
+
}));
|
|
78
|
+
res.json({
|
|
79
|
+
error: 'payment_required',
|
|
80
|
+
price: `$${(productConfig.price / 1_000_000).toFixed(2)}`,
|
|
81
|
+
message: 'x402 payment required. Sign an EIP-712 payment and retry with X-PAYMENT-RESPONSE header.',
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
// Payment proof present — verify it was routed through CommissionRouter
|
|
86
|
+
// In production, this calls the router contract to verify the tx
|
|
87
|
+
try {
|
|
88
|
+
const verified = await verifyPayment(paymentProof, {
|
|
89
|
+
vendorId,
|
|
90
|
+
productId: productConfig.productId,
|
|
91
|
+
price: productConfig.price,
|
|
92
|
+
routerAddress: addresses.ROUTER,
|
|
93
|
+
});
|
|
94
|
+
if (!verified.valid) {
|
|
95
|
+
res.status(403);
|
|
96
|
+
res.json({ error: 'payment_invalid', message: verified.reason });
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// Payment verified — attach receipt metadata and pass to product handler
|
|
100
|
+
req._pyrimid = {
|
|
101
|
+
verified: true,
|
|
102
|
+
tx_hash: verified.txHash,
|
|
103
|
+
affiliate_id: affiliateId,
|
|
104
|
+
paid_usdc: productConfig.price,
|
|
105
|
+
split: calculateSplit(productConfig.price, productConfig.affiliateBps),
|
|
106
|
+
};
|
|
107
|
+
return next();
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
res.status(500);
|
|
111
|
+
res.json({
|
|
112
|
+
error: 'payment_verification_failed',
|
|
113
|
+
message: err instanceof Error ? err.message : 'Unknown error',
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// ═══════════════════════════════════════════════════════════
|
|
119
|
+
// NEXT.JS / EDGE HANDLER WRAPPER
|
|
120
|
+
// ═══════════════════════════════════════════════════════════
|
|
121
|
+
/**
|
|
122
|
+
* Wraps a Next.js API route handler with Pyrimid payment verification.
|
|
123
|
+
*
|
|
124
|
+
* Usage (app router):
|
|
125
|
+
* import { withPyrimid } from '@pyrimid/sdk';
|
|
126
|
+
* export const GET = withPyrimid({
|
|
127
|
+
* vendorId: 'vn_your_id',
|
|
128
|
+
* productId: 'signals_latest',
|
|
129
|
+
* price: 250000,
|
|
130
|
+
* affiliateBps: 2000,
|
|
131
|
+
* }, async (req, paymentReceipt) => {
|
|
132
|
+
* return Response.json({ signal: '...' });
|
|
133
|
+
* });
|
|
134
|
+
*/
|
|
135
|
+
export function withPyrimid(product, handler) {
|
|
136
|
+
const addresses = PYRIMID_ADDRESSES[product.network || 'base'];
|
|
137
|
+
return async function pyrimidHandler(req) {
|
|
138
|
+
const affiliateId = req.headers.get('x-affiliate-id') || 'af_treasury';
|
|
139
|
+
const paymentProof = req.headers.get('x-payment-response');
|
|
140
|
+
if (!paymentProof) {
|
|
141
|
+
const split = calculateSplit(product.price, product.affiliateBps);
|
|
142
|
+
return new Response(JSON.stringify({
|
|
143
|
+
error: 'payment_required',
|
|
144
|
+
price: `$${(product.price / 1_000_000).toFixed(2)}`,
|
|
145
|
+
message: 'x402 payment required.',
|
|
146
|
+
}), {
|
|
147
|
+
status: 402,
|
|
148
|
+
headers: {
|
|
149
|
+
'Content-Type': 'application/json',
|
|
150
|
+
'X-PAYMENT-REQUIRED': JSON.stringify({
|
|
151
|
+
protocol: 'x402',
|
|
152
|
+
network: 'base',
|
|
153
|
+
asset: addresses.USDC,
|
|
154
|
+
amount: product.price.toString(),
|
|
155
|
+
recipient: addresses.ROUTER,
|
|
156
|
+
vendor_id: product.vendorId,
|
|
157
|
+
product_id: product.productId,
|
|
158
|
+
affiliate_id: affiliateId,
|
|
159
|
+
split: {
|
|
160
|
+
protocol: split.protocol_fee,
|
|
161
|
+
affiliate: split.affiliate_commission,
|
|
162
|
+
vendor: split.vendor_share,
|
|
163
|
+
},
|
|
164
|
+
}),
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const verified = await verifyPayment(paymentProof, {
|
|
169
|
+
vendorId: product.vendorId,
|
|
170
|
+
productId: product.productId,
|
|
171
|
+
price: product.price,
|
|
172
|
+
routerAddress: addresses.ROUTER,
|
|
173
|
+
});
|
|
174
|
+
if (!verified.valid) {
|
|
175
|
+
return new Response(JSON.stringify({
|
|
176
|
+
error: 'payment_invalid',
|
|
177
|
+
message: verified.reason,
|
|
178
|
+
}), { status: 403, headers: { 'Content-Type': 'application/json' } });
|
|
179
|
+
}
|
|
180
|
+
return handler(req, {
|
|
181
|
+
verified: true,
|
|
182
|
+
tx_hash: verified.txHash || '',
|
|
183
|
+
affiliate_id: affiliateId,
|
|
184
|
+
paid_usdc: product.price,
|
|
185
|
+
split: calculateSplit(product.price, product.affiliateBps),
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Verify an x402 payment was routed through the CommissionRouter.
|
|
191
|
+
* In production, this decodes the EIP-712 signature and checks the
|
|
192
|
+
* onchain receipt via the PaymentRouted event.
|
|
193
|
+
*/
|
|
194
|
+
async function verifyPayment(proof, input) {
|
|
195
|
+
// TODO: Implement onchain verification
|
|
196
|
+
// 1. Decode x402 payment proof (EIP-712 signed receipt)
|
|
197
|
+
// 2. Verify signature against buyer wallet
|
|
198
|
+
// 3. Check PaymentRouted event on CommissionRouter
|
|
199
|
+
// 4. Validate amounts match product price
|
|
200
|
+
//
|
|
201
|
+
// For testnet/development, accept all proofs:
|
|
202
|
+
return { valid: true, txHash: proof };
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,iBAAiB,GAIlB,MAAM,YAAY,CAAC;AAEpB,8DAA8D;AAC9D,6CAA6C;AAC7C,8DAA8D;AAE9D,MAAM,UAAU,cAAc,CAAC,SAAiB,EAAE,YAAoB;IACpE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK;IACtD,MAAM,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IAC1C,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,YAAY,CAAC,GAAG,MAAM,CAAC,CAAC;IAC5E,MAAM,WAAW,GAAG,SAAS,GAAG,mBAAmB,CAAC;IAEpD,OAAO;QACL,UAAU,EAAE,SAAS;QACrB,YAAY,EAAE,WAAW;QACzB,oBAAoB,EAAE,mBAAmB;QACzC,YAAY,EAAE,WAAW;QACzB,aAAa,EAAE,YAAY;KAC5B,CAAC;AACJ,CAAC;AAmBD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAA8B;IAC9D,MAAM,EACJ,QAAQ,EACR,OAAO,GAAG,MAAM,EAChB,QAAQ,GACT,GAAG,MAAM,CAAC;IAEX,MAAM,SAAS,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAG,IAAI,GAAG,CAC1B,MAAM,CAAC,OAAO,CAAC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AO,EAAE,QAAQ,CAAC,MAAM,IAAI,EAAE;YAC9B,YAAY,EAAE,WAAW;YACzB,SAAS,EAAE,OAAO,CAAC,KAAK;YACxB,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC;SAC3D,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AA2BD;;;;GAIG;AACH,KAAK,UAAU,aAAa,CAC1B,KAAa,EACb,KAAyB;IAEzB,uCAAuC;IACvC,wDAAwD;IACxD,2CAA2C;IAC3C,mDAAmD;IACnD,0CAA0C;IAC1C,EAAE;IACF,8CAA8C;IAC9C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PyrimidResolver — Embedded service discovery for agent frameworks
|
|
3
|
+
*
|
|
4
|
+
* Highest-leverage affiliate path. Embed this in your agent framework
|
|
5
|
+
* and every agent built on your stack routes purchases through Pyrimid
|
|
6
|
+
* with your affiliate ID. One integration → thousands of passive sales.
|
|
7
|
+
*
|
|
8
|
+
* PROPRIETARY — @pyrimid/sdk
|
|
9
|
+
*/
|
|
10
|
+
import type { PyrimidProduct, ResolverConfig, PurchaseResult } from './types.js';
|
|
11
|
+
export declare class PyrimidResolver {
|
|
12
|
+
private affiliateId;
|
|
13
|
+
private catalogUrl;
|
|
14
|
+
private cacheTtlMs;
|
|
15
|
+
private preferVerified;
|
|
16
|
+
private maxPrice;
|
|
17
|
+
private cache;
|
|
18
|
+
constructor(config: ResolverConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Find a single product matching a natural language need.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const signal = await resolver.findProduct("btc trading signal");
|
|
24
|
+
* if (signal) await resolver.purchase(signal, wallet);
|
|
25
|
+
*/
|
|
26
|
+
findProduct(need: string): Promise<PyrimidProduct | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Find multiple products matching a need, sorted by relevance + trust.
|
|
29
|
+
*/
|
|
30
|
+
findProducts(need: string, limit?: number): Promise<PyrimidProduct[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Find products by category. Verified vendors first, then by volume.
|
|
33
|
+
*/
|
|
34
|
+
findByCategory(category: string): Promise<PyrimidProduct[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Purchase a product through Pyrimid with affiliate attribution.
|
|
37
|
+
* Handles the full x402 payment flow automatically.
|
|
38
|
+
*/
|
|
39
|
+
purchase(product: PyrimidProduct, buyerWallet: any): Promise<PurchaseResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Get the full catalog (cached with configurable TTL).
|
|
42
|
+
*/
|
|
43
|
+
getCatalog(): Promise<PyrimidProduct[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Get affiliate performance stats.
|
|
46
|
+
*/
|
|
47
|
+
getStats(): Promise<any>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjF,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,CAAkE;gBAEnE,MAAM,EAAE,cAAc;IAQlC;;;;;;OAMG;IACG,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAsB/D;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAsBtE;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAWjE;;;OAGG;IACG,QAAQ,CACZ,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,GAAG,GACf,OAAO,CAAC,cAAc,CAAC;IAwD1B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAa7C;;OAEG;IACG,QAAQ;CAOf"}
|
package/dist/resolver.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PyrimidResolver — Embedded service discovery for agent frameworks
|
|
3
|
+
*
|
|
4
|
+
* Highest-leverage affiliate path. Embed this in your agent framework
|
|
5
|
+
* and every agent built on your stack routes purchases through Pyrimid
|
|
6
|
+
* with your affiliate ID. One integration → thousands of passive sales.
|
|
7
|
+
*
|
|
8
|
+
* PROPRIETARY — @pyrimid/sdk
|
|
9
|
+
*/
|
|
10
|
+
export class PyrimidResolver {
|
|
11
|
+
affiliateId;
|
|
12
|
+
catalogUrl;
|
|
13
|
+
cacheTtlMs;
|
|
14
|
+
preferVerified;
|
|
15
|
+
maxPrice;
|
|
16
|
+
cache = null;
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.affiliateId = config.affiliateId;
|
|
19
|
+
this.catalogUrl = config.catalogUrl || 'https://api.pyrimid.ai/v1/catalog';
|
|
20
|
+
this.cacheTtlMs = config.cacheTtlMs || 5 * 60 * 1000;
|
|
21
|
+
this.preferVerified = config.preferVerifiedVendors ?? true;
|
|
22
|
+
this.maxPrice = config.maxPriceUsdc || 10_000_000; // $10 default
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Find a single product matching a natural language need.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const signal = await resolver.findProduct("btc trading signal");
|
|
29
|
+
* if (signal) await resolver.purchase(signal, wallet);
|
|
30
|
+
*/
|
|
31
|
+
async findProduct(need) {
|
|
32
|
+
const catalog = await this.getCatalog();
|
|
33
|
+
const keywords = need.toLowerCase().split(/\s+/);
|
|
34
|
+
const scored = catalog
|
|
35
|
+
.filter(p => p.price_usdc <= this.maxPrice)
|
|
36
|
+
.map(p => {
|
|
37
|
+
const searchable = `${p.description} ${p.tags.join(' ')} ${p.category}`.toLowerCase();
|
|
38
|
+
let score = 0;
|
|
39
|
+
for (const kw of keywords) {
|
|
40
|
+
if (searchable.includes(kw))
|
|
41
|
+
score += 10;
|
|
42
|
+
}
|
|
43
|
+
if (this.preferVerified && p.vendor_erc8004)
|
|
44
|
+
score += 5;
|
|
45
|
+
score += Math.min(p.monthly_volume / 1000, 5);
|
|
46
|
+
return { product: p, score };
|
|
47
|
+
})
|
|
48
|
+
.filter(s => s.score > 0)
|
|
49
|
+
.sort((a, b) => b.score - a.score);
|
|
50
|
+
return scored.length > 0 ? scored[0].product : null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Find multiple products matching a need, sorted by relevance + trust.
|
|
54
|
+
*/
|
|
55
|
+
async findProducts(need, limit = 5) {
|
|
56
|
+
const catalog = await this.getCatalog();
|
|
57
|
+
const keywords = need.toLowerCase().split(/\s+/);
|
|
58
|
+
return catalog
|
|
59
|
+
.filter(p => p.price_usdc <= this.maxPrice)
|
|
60
|
+
.map(p => {
|
|
61
|
+
const searchable = `${p.description} ${p.tags.join(' ')} ${p.category}`.toLowerCase();
|
|
62
|
+
let score = 0;
|
|
63
|
+
for (const kw of keywords) {
|
|
64
|
+
if (searchable.includes(kw))
|
|
65
|
+
score += 10;
|
|
66
|
+
}
|
|
67
|
+
if (this.preferVerified && p.vendor_erc8004)
|
|
68
|
+
score += 5;
|
|
69
|
+
score += Math.min(p.monthly_volume / 1000, 5);
|
|
70
|
+
return { product: p, score };
|
|
71
|
+
})
|
|
72
|
+
.filter(s => s.score > 0)
|
|
73
|
+
.sort((a, b) => b.score - a.score)
|
|
74
|
+
.slice(0, limit)
|
|
75
|
+
.map(s => s.product);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Find products by category. Verified vendors first, then by volume.
|
|
79
|
+
*/
|
|
80
|
+
async findByCategory(category) {
|
|
81
|
+
const catalog = await this.getCatalog();
|
|
82
|
+
return catalog
|
|
83
|
+
.filter(p => p.category === category)
|
|
84
|
+
.sort((a, b) => {
|
|
85
|
+
if (a.vendor_erc8004 && !b.vendor_erc8004)
|
|
86
|
+
return -1;
|
|
87
|
+
if (!a.vendor_erc8004 && b.vendor_erc8004)
|
|
88
|
+
return 1;
|
|
89
|
+
return b.monthly_volume - a.monthly_volume;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Purchase a product through Pyrimid with affiliate attribution.
|
|
94
|
+
* Handles the full x402 payment flow automatically.
|
|
95
|
+
*/
|
|
96
|
+
async purchase(product, buyerWallet) {
|
|
97
|
+
// Step 1: Hit vendor endpoint → get 402 with payment requirements
|
|
98
|
+
const initialResponse = await fetch(product.endpoint, {
|
|
99
|
+
method: product.method,
|
|
100
|
+
headers: { 'X-Affiliate-ID': this.affiliateId },
|
|
101
|
+
});
|
|
102
|
+
if (initialResponse.status !== 402) {
|
|
103
|
+
if (initialResponse.ok) {
|
|
104
|
+
return {
|
|
105
|
+
success: true,
|
|
106
|
+
data: await initialResponse.json(),
|
|
107
|
+
tx_hash: '',
|
|
108
|
+
paid_usdc: 0,
|
|
109
|
+
affiliate_earned: 0,
|
|
110
|
+
vendor_earned: 0,
|
|
111
|
+
protocol_fee: 0,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
throw new Error(`Unexpected status: ${initialResponse.status}`);
|
|
115
|
+
}
|
|
116
|
+
// Step 2: Parse x402 payment requirements
|
|
117
|
+
const paymentRequired = initialResponse.headers.get('X-PAYMENT-REQUIRED');
|
|
118
|
+
if (!paymentRequired)
|
|
119
|
+
throw new Error('No payment requirements in 402 response');
|
|
120
|
+
// Step 3: Sign EIP-712 payment via x402 client
|
|
121
|
+
const { wrapFetchWithPayment } = await import('@x402/fetch');
|
|
122
|
+
const paidFetch = wrapFetchWithPayment(fetch, buyerWallet);
|
|
123
|
+
const paidResponse = await paidFetch(product.endpoint, {
|
|
124
|
+
method: product.method,
|
|
125
|
+
headers: { 'X-Affiliate-ID': this.affiliateId },
|
|
126
|
+
});
|
|
127
|
+
if (!paidResponse.ok) {
|
|
128
|
+
throw new Error(`Payment failed: ${paidResponse.status}`);
|
|
129
|
+
}
|
|
130
|
+
// Step 4: Build receipt
|
|
131
|
+
const txHash = paidResponse.headers.get('X-PAYMENT-RESPONSE') || '';
|
|
132
|
+
const protocolFee = Math.floor(product.price_usdc / 100);
|
|
133
|
+
const remaining = product.price_usdc - protocolFee;
|
|
134
|
+
const affiliateEarned = Math.floor((remaining * product.affiliate_bps) / 10_000);
|
|
135
|
+
return {
|
|
136
|
+
success: true,
|
|
137
|
+
data: await paidResponse.json(),
|
|
138
|
+
tx_hash: txHash,
|
|
139
|
+
paid_usdc: product.price_usdc,
|
|
140
|
+
affiliate_earned: affiliateEarned,
|
|
141
|
+
vendor_earned: remaining - affiliateEarned,
|
|
142
|
+
protocol_fee: protocolFee,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Get the full catalog (cached with configurable TTL).
|
|
147
|
+
*/
|
|
148
|
+
async getCatalog() {
|
|
149
|
+
if (this.cache && Date.now() - this.cache.fetchedAt < this.cacheTtlMs) {
|
|
150
|
+
return this.cache.products;
|
|
151
|
+
}
|
|
152
|
+
const response = await fetch(this.catalogUrl);
|
|
153
|
+
if (!response.ok)
|
|
154
|
+
throw new Error(`Catalog fetch failed: ${response.status}`);
|
|
155
|
+
const data = await response.json();
|
|
156
|
+
this.cache = { products: data.products, fetchedAt: Date.now() };
|
|
157
|
+
return data.products;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get affiliate performance stats.
|
|
161
|
+
*/
|
|
162
|
+
async getStats() {
|
|
163
|
+
const response = await fetch(`${this.catalogUrl.replace('/catalog', '/stats')}/affiliate/${this.affiliateId}`);
|
|
164
|
+
if (!response.ok)
|
|
165
|
+
throw new Error(`Stats fetch failed: ${response.status}`);
|
|
166
|
+
return response.json();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,OAAO,eAAe;IAClB,WAAW,CAAS;IACpB,UAAU,CAAS;IACnB,UAAU,CAAS;IACnB,cAAc,CAAU;IACxB,QAAQ,CAAS;IACjB,KAAK,GAA6D,IAAI,CAAC;IAE/E,YAAY,MAAsB;QAChC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,mCAAmC,CAAC;QAC3E,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,qBAAqB,IAAI,IAAI,CAAC;QAC3D,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,YAAY,IAAI,UAAU,CAAC,CAAC,cAAc;IACnE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CAAC,IAAY;QAC5B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,OAAO;aACnB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAA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AK,CAAC,QAAQ,CAAC;QAC7B,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAE9E,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAChE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,cAAc,IAAI,CAAC,WAAW,EAAE,CACjF,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5E,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @pyrimid/sdk — Core type definitions
|
|
3
|
+
*
|
|
4
|
+
* PROPRIETARY — All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PYRIMID_ADDRESSES: {
|
|
7
|
+
/** Base Mainnet */
|
|
8
|
+
readonly base: {
|
|
9
|
+
readonly REGISTRY: "0x2263852363Bce16791A059c6F6fBb590f0b98c89";
|
|
10
|
+
readonly CATALOG: "0x1ae8EbbFf7c5A15a155c9bcF9fF7984e7C8e0E74";
|
|
11
|
+
readonly ROUTER: "0x6594A6B2785b1f8505b291bDc50E017b5599aFC8";
|
|
12
|
+
readonly TREASURY: "0xdF29F94EA8053cC0cb1567D0A8Ac8dd3d1E00908";
|
|
13
|
+
readonly USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
14
|
+
readonly ERC_8004: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type Network = keyof typeof PYRIMID_ADDRESSES;
|
|
18
|
+
export interface PyrimidProduct {
|
|
19
|
+
vendor_id: string;
|
|
20
|
+
vendor_name: string;
|
|
21
|
+
vendor_erc8004: boolean;
|
|
22
|
+
product_id: string;
|
|
23
|
+
description: string;
|
|
24
|
+
category: string;
|
|
25
|
+
tags: string[];
|
|
26
|
+
price_usdc: number;
|
|
27
|
+
price_display: string;
|
|
28
|
+
affiliate_bps: number;
|
|
29
|
+
endpoint: string;
|
|
30
|
+
method: string;
|
|
31
|
+
output_schema: object;
|
|
32
|
+
monthly_volume: number;
|
|
33
|
+
monthly_buyers: number;
|
|
34
|
+
network: string;
|
|
35
|
+
asset: string;
|
|
36
|
+
}
|
|
37
|
+
export interface CatalogResponse {
|
|
38
|
+
products: PyrimidProduct[];
|
|
39
|
+
total: number;
|
|
40
|
+
updated_at: string;
|
|
41
|
+
sources: string[];
|
|
42
|
+
}
|
|
43
|
+
export interface CatalogQueryParams {
|
|
44
|
+
query?: string;
|
|
45
|
+
category?: string;
|
|
46
|
+
max_price_usd?: number;
|
|
47
|
+
verified_only?: boolean;
|
|
48
|
+
limit?: number;
|
|
49
|
+
offset?: number;
|
|
50
|
+
sort_by?: 'relevance' | 'price_asc' | 'price_desc' | 'volume' | 'newest';
|
|
51
|
+
}
|
|
52
|
+
export interface PurchaseResult {
|
|
53
|
+
success: boolean;
|
|
54
|
+
data: unknown;
|
|
55
|
+
tx_hash: string;
|
|
56
|
+
paid_usdc: number;
|
|
57
|
+
affiliate_earned: number;
|
|
58
|
+
vendor_earned: number;
|
|
59
|
+
protocol_fee: number;
|
|
60
|
+
}
|
|
61
|
+
export interface PaymentSplit {
|
|
62
|
+
total_usdc: number;
|
|
63
|
+
protocol_fee: number;
|
|
64
|
+
affiliate_commission: number;
|
|
65
|
+
vendor_share: number;
|
|
66
|
+
affiliate_bps: number;
|
|
67
|
+
}
|
|
68
|
+
export interface AffiliateStats {
|
|
69
|
+
affiliate_id: string;
|
|
70
|
+
total_earnings_usdc: number;
|
|
71
|
+
sales_count: number;
|
|
72
|
+
unique_buyers: number;
|
|
73
|
+
vendors_served: number;
|
|
74
|
+
reputation_score: number;
|
|
75
|
+
erc8004_linked: boolean;
|
|
76
|
+
registered_at: string;
|
|
77
|
+
}
|
|
78
|
+
export interface VendorStats {
|
|
79
|
+
vendor_id: string;
|
|
80
|
+
total_volume_usdc: number;
|
|
81
|
+
total_sales: number;
|
|
82
|
+
products_listed: number;
|
|
83
|
+
products_active: number;
|
|
84
|
+
affiliate_payouts_usdc: number;
|
|
85
|
+
unique_affiliates: number;
|
|
86
|
+
registered_at: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ProtocolStats {
|
|
89
|
+
total_volume_usdc: number;
|
|
90
|
+
total_transactions: number;
|
|
91
|
+
total_vendors: number;
|
|
92
|
+
total_affiliates: number;
|
|
93
|
+
total_products: number;
|
|
94
|
+
treasury_balance_usdc: number;
|
|
95
|
+
categories: Record<string, number>;
|
|
96
|
+
sources: Record<string, number>;
|
|
97
|
+
updated_at: string;
|
|
98
|
+
}
|
|
99
|
+
export interface ResolverConfig {
|
|
100
|
+
affiliateId: string;
|
|
101
|
+
catalogUrl?: string;
|
|
102
|
+
cacheTtlMs?: number;
|
|
103
|
+
preferVerifiedVendors?: boolean;
|
|
104
|
+
maxPriceUsdc?: number;
|
|
105
|
+
}
|
|
106
|
+
export interface McpServerConfig {
|
|
107
|
+
affiliateId?: string;
|
|
108
|
+
catalogUrl?: string;
|
|
109
|
+
serverName?: string;
|
|
110
|
+
refreshIntervalMs?: number;
|
|
111
|
+
}
|
|
112
|
+
export interface VendorMiddlewareConfig {
|
|
113
|
+
vendorId: string;
|
|
114
|
+
routerAddress?: string;
|
|
115
|
+
usdcAddress?: string;
|
|
116
|
+
network?: Network;
|
|
117
|
+
products: Record<string, {
|
|
118
|
+
productId: string;
|
|
119
|
+
price: number;
|
|
120
|
+
affiliateBps: number;
|
|
121
|
+
}>;
|
|
122
|
+
}
|
|
123
|
+
export declare const ROUTER_ABI: readonly ["function routePayment(uint256 vendorId, bytes32 productId, uint256 affiliateId, address buyer) external", "event PaymentRouted(uint256 indexed vendorId, bytes32 indexed productId, uint256 indexed affiliateId, address buyer, uint256 total, uint256 platformFee, uint256 affiliateCommission, uint256 vendorShare)"];
|
|
124
|
+
export declare const REGISTRY_ABI: readonly ["function registerAffiliate() external returns (uint256)", "function registerAffiliateWithReferral(uint256 referrerId) external returns (uint256)", "function registerVendor(string name, string baseUrl, address payoutAddress) external returns (uint256)", "function linkERC8004Identity(uint256 agentId) external", "function getAffiliate(uint256 id) external view returns (address wallet, uint256 reputation, bool erc8004Linked, uint256 salesCount, uint256 totalVolume)", "function getVendor(uint256 id) external view returns (string name, string baseUrl, address payoutAddress, bool active)", "event AffiliateRegistered(uint256 indexed affiliateId, address indexed wallet)", "event VendorRegistered(uint256 indexed vendorId, address indexed wallet)"];
|
|
125
|
+
export declare const CATALOG_ABI: readonly ["function listProduct(bytes32 productId, string endpoint, string description, uint256 priceUsdc, uint256 affiliateBps) external", "function updateProduct(bytes32 productId, string endpoint, string description, uint256 priceUsdc, uint256 affiliateBps) external", "function deactivateProduct(bytes32 productId) external", "function getProduct(uint256 vendorId, bytes32 productId) external view returns (string endpoint, string description, uint256 priceUsdc, uint256 affiliateBps, bool active)", "function listVendorProducts(uint256 vendorId) external view returns (bytes32[])", "event ProductListed(uint256 indexed vendorId, bytes32 indexed productId, uint256 priceUsdc, uint256 affiliateBps)"];
|
|
126
|
+
export declare const TREASURY_ABI: readonly ["function allocate(address to, uint256 amount, string purpose) external", "function balance() external view returns (uint256)", "event Allocation(address indexed to, uint256 amount, string purpose)"];
|
|
127
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,iBAAiB;IAC5B,mBAAmB;;;;;;;;;CASX,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAMrD,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAA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4
|
+
* PROPRIETARY — All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
// ═══════════════════════════════════════════════════════════
|
|
7
|
+
// CONTRACT ADDRESSES
|
|
8
|
+
// ═══════════════════════════════════════════════════════════
|
|
9
|
+
export const PYRIMID_ADDRESSES = {
|
|
10
|
+
/** Base Mainnet */
|
|
11
|
+
base: {
|
|
12
|
+
REGISTRY: '0x2263852363Bce16791A059c6F6fBb590f0b98c89',
|
|
13
|
+
CATALOG: '0x1ae8EbbFf7c5A15a155c9bcF9fF7984e7C8e0E74',
|
|
14
|
+
ROUTER: '0x6594A6B2785b1f8505b291bDc50E017b5599aFC8',
|
|
15
|
+
TREASURY: '0xdF29F94EA8053cC0cb1567D0A8Ac8dd3d1E00908',
|
|
16
|
+
USDC: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
17
|
+
ERC_8004: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
// ═══════════════════════════════════════════════════════════
|
|
21
|
+
// ABI FRAGMENTS
|
|
22
|
+
// ═══════════════════════════════════════════════════════════
|
|
23
|
+
export const ROUTER_ABI = [
|
|
24
|
+
'function routePayment(uint256 vendorId, bytes32 productId, uint256 affiliateId, address buyer) external',
|
|
25
|
+
'event PaymentRouted(uint256 indexed vendorId, bytes32 indexed productId, uint256 indexed affiliateId, address buyer, uint256 total, uint256 platformFee, uint256 affiliateCommission, uint256 vendorShare)',
|
|
26
|
+
];
|
|
27
|
+
export const REGISTRY_ABI = [
|
|
28
|
+
'function registerAffiliate() external returns (uint256)',
|
|
29
|
+
'function registerAffiliateWithReferral(uint256 referrerId) external returns (uint256)',
|
|
30
|
+
'function registerVendor(string name, string baseUrl, address payoutAddress) external returns (uint256)',
|
|
31
|
+
'function linkERC8004Identity(uint256 agentId) external',
|
|
32
|
+
'function getAffiliate(uint256 id) external view returns (address wallet, uint256 reputation, bool erc8004Linked, uint256 salesCount, uint256 totalVolume)',
|
|
33
|
+
'function getVendor(uint256 id) external view returns (string name, string baseUrl, address payoutAddress, bool active)',
|
|
34
|
+
'event AffiliateRegistered(uint256 indexed affiliateId, address indexed wallet)',
|
|
35
|
+
'event VendorRegistered(uint256 indexed vendorId, address indexed wallet)',
|
|
36
|
+
];
|
|
37
|
+
export const CATALOG_ABI = [
|
|
38
|
+
'function listProduct(bytes32 productId, string endpoint, string description, uint256 priceUsdc, uint256 affiliateBps) external',
|
|
39
|
+
'function updateProduct(bytes32 productId, string endpoint, string description, uint256 priceUsdc, uint256 affiliateBps) external',
|
|
40
|
+
'function deactivateProduct(bytes32 productId) external',
|
|
41
|
+
'function getProduct(uint256 vendorId, bytes32 productId) external view returns (string endpoint, string description, uint256 priceUsdc, uint256 affiliateBps, bool active)',
|
|
42
|
+
'function listVendorProducts(uint256 vendorId) external view returns (bytes32[])',
|
|
43
|
+
'event ProductListed(uint256 indexed vendorId, bytes32 indexed productId, uint256 priceUsdc, uint256 affiliateBps)',
|
|
44
|
+
];
|
|
45
|
+
export const TREASURY_ABI = [
|
|
46
|
+
'function allocate(address to, uint256 amount, string purpose) external',
|
|
47
|
+
'function balance() external view returns (uint256)',
|
|
48
|
+
'event Allocation(address indexed to, uint256 amount, string purpose)',
|
|
49
|
+
];
|
|
50
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,8DAA8D;AAC9D,0CAA0C;AAC1C,8DAA8D;AAE9D,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,mBAAmB;IACnB,IAAI,EAAE;QACJ,QAAQ,EAAE,4CAA4C;QACtD,OAAO,EAAG,4CAA4C;QACtD,MAAM,EAAI,4CAA4C;QACtD,QAAQ,EAAE,4CAA4C;QACtD,IAAI,EAAM,4CAA4C;QACtD,QAAQ,EAAE,4CAA4C;KACvD;CACO,CAAC;AAwIX,8DAA8D;AAC9D,sCAAsC;AACtC,8DAA8D;AAE9D,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,yGAAyG;IACzG,4MAA4M;CACpM,CAAC;AAEX,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,yDAAyD;IACzD,uFAAuF;IACvF,wGAAwG;IACxG,wDAAwD;IACxD,2JAA2J;IAC3J,wHAAwH;IACxH,gFAAgF;IAChF,0EAA0E;CAClE,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,gIAAgI;IAChI,kIAAkI;IAClI,wDAAwD;IACxD,4KAA4K;IAC5K,iFAAiF;IACjF,mHAAmH;CAC3G,CAAC;AAEX,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,wEAAwE;IACxE,oDAAoD;IACpD,sEAAsE;CAC9D,CAAC"}
|