@agirails/sdk 4.4.8 → 4.5.2
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/builders/DeliveryProofBuilder.d.ts +224 -13
- package/dist/builders/DeliveryProofBuilder.d.ts.map +1 -1
- package/dist/builders/DeliveryProofBuilder.js +247 -13
- package/dist/builders/DeliveryProofBuilder.js.map +1 -1
- package/dist/cli/agirails.d.ts +85 -1
- package/dist/cli/agirails.d.ts.map +1 -1
- package/dist/cli/agirails.js +429 -154
- package/dist/cli/agirails.js.map +1 -1
- package/dist/cli/commands/init.d.ts +54 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +193 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/receipt.d.ts +70 -2
- package/dist/cli/commands/receipt.d.ts.map +1 -1
- package/dist/cli/commands/receipt.js +218 -3
- package/dist/cli/commands/receipt.js.map +1 -1
- package/dist/cli/commands/test.d.ts +77 -1
- package/dist/cli/commands/test.d.ts.map +1 -1
- package/dist/cli/commands/test.js +264 -2
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/lib/runRequest.d.ts +90 -0
- package/dist/cli/lib/runRequest.d.ts.map +1 -1
- package/dist/cli/lib/runRequest.js +300 -9
- package/dist/cli/lib/runRequest.js.map +1 -1
- package/dist/cli/lib/sentinelReflections.d.ts +111 -0
- package/dist/cli/lib/sentinelReflections.d.ts.map +1 -0
- package/dist/cli/lib/sentinelReflections.js +193 -0
- package/dist/cli/lib/sentinelReflections.js.map +1 -0
- package/dist/delivery/MockDeliveryChannel.d.ts +208 -0
- package/dist/delivery/MockDeliveryChannel.d.ts.map +1 -0
- package/dist/delivery/MockDeliveryChannel.js +445 -0
- package/dist/delivery/MockDeliveryChannel.js.map +1 -0
- package/dist/delivery/RelayDeliveryChannel.d.ts +176 -0
- package/dist/delivery/RelayDeliveryChannel.d.ts.map +1 -0
- package/dist/delivery/RelayDeliveryChannel.js +377 -0
- package/dist/delivery/RelayDeliveryChannel.js.map +1 -0
- package/dist/delivery/channel.d.ts +282 -0
- package/dist/delivery/channel.d.ts.map +1 -0
- package/dist/delivery/channel.js +76 -0
- package/dist/delivery/channel.js.map +1 -0
- package/dist/delivery/channelLog.d.ts +115 -0
- package/dist/delivery/channelLog.d.ts.map +1 -0
- package/dist/delivery/channelLog.js +94 -0
- package/dist/delivery/channelLog.js.map +1 -0
- package/dist/delivery/crypto.d.ts +312 -0
- package/dist/delivery/crypto.d.ts.map +1 -0
- package/dist/delivery/crypto.js +495 -0
- package/dist/delivery/crypto.js.map +1 -0
- package/dist/delivery/eip712.d.ts +248 -0
- package/dist/delivery/eip712.d.ts.map +1 -0
- package/dist/delivery/eip712.js +397 -0
- package/dist/delivery/eip712.js.map +1 -0
- package/dist/delivery/envelopeBuilder.d.ts +531 -0
- package/dist/delivery/envelopeBuilder.d.ts.map +1 -0
- package/dist/delivery/envelopeBuilder.js +832 -0
- package/dist/delivery/envelopeBuilder.js.map +1 -0
- package/dist/delivery/index.d.ts +53 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +143 -0
- package/dist/delivery/index.js.map +1 -0
- package/dist/delivery/keys.d.ts +344 -0
- package/dist/delivery/keys.d.ts.map +1 -0
- package/dist/delivery/keys.js +513 -0
- package/dist/delivery/keys.js.map +1 -0
- package/dist/delivery/nonce-keys.d.ts +93 -0
- package/dist/delivery/nonce-keys.d.ts.map +1 -0
- package/dist/delivery/nonce-keys.js +88 -0
- package/dist/delivery/nonce-keys.js.map +1 -0
- package/dist/delivery/setupBuilder.d.ts +403 -0
- package/dist/delivery/setupBuilder.d.ts.map +1 -0
- package/dist/delivery/setupBuilder.js +554 -0
- package/dist/delivery/setupBuilder.js.map +1 -0
- package/dist/delivery/types.d.ts +722 -0
- package/dist/delivery/types.d.ts.map +1 -0
- package/dist/delivery/types.js +150 -0
- package/dist/delivery/types.js.map +1 -0
- package/dist/delivery/validate.d.ts +288 -0
- package/dist/delivery/validate.d.ts.map +1 -0
- package/dist/delivery/validate.js +648 -0
- package/dist/delivery/validate.js.map +1 -0
- package/dist/level1/Agent.d.ts +130 -0
- package/dist/level1/Agent.d.ts.map +1 -1
- package/dist/level1/Agent.js +248 -0
- package/dist/level1/Agent.js.map +1 -1
- package/dist/level1/types/Options.d.ts +62 -0
- package/dist/level1/types/Options.d.ts.map +1 -1
- package/dist/level1/types/Options.js +22 -0
- package/dist/level1/types/Options.js.map +1 -1
- package/dist/runtime/MockRuntime.d.ts +32 -0
- package/dist/runtime/MockRuntime.d.ts.map +1 -1
- package/dist/runtime/MockRuntime.js +44 -0
- package/dist/runtime/MockRuntime.js.map +1 -1
- package/dist/wallet/aa/BundlerClient.d.ts.map +1 -1
- package/dist/wallet/aa/BundlerClient.js +18 -3
- package/dist/wallet/aa/BundlerClient.js.map +1 -1
- package/dist/wallet/aa/PaymasterClient.d.ts.map +1 -1
- package/dist/wallet/aa/PaymasterClient.js +4 -1
- package/dist/wallet/aa/PaymasterClient.js.map +1 -1
- package/package.json +6 -1
|
@@ -18,13 +18,39 @@
|
|
|
18
18
|
*
|
|
19
19
|
* @module cli/commands/test
|
|
20
20
|
*/
|
|
21
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
24
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
25
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26
|
+
}
|
|
27
|
+
Object.defineProperty(o, k2, desc);
|
|
28
|
+
}) : (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
o[k2] = m[k];
|
|
31
|
+
}));
|
|
32
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
33
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
34
|
+
}) : function(o, v) {
|
|
35
|
+
o["default"] = v;
|
|
36
|
+
});
|
|
37
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
21
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.runTest = exports.createTestCommand = void 0;
|
|
45
|
+
exports.offerShareOnX = exports.safeLocalReflection = exports.isSentinelProvider = exports.runTest = exports.createTestCommand = void 0;
|
|
23
46
|
const commander_1 = require("commander");
|
|
24
47
|
const output_1 = require("../utils/output");
|
|
25
48
|
const client_1 = require("../utils/client");
|
|
26
49
|
const resolveAgent_1 = require("../lib/resolveAgent");
|
|
27
50
|
const runRequest_1 = require("../lib/runRequest");
|
|
51
|
+
const sentinelReflections_1 = require("../lib/sentinelReflections");
|
|
52
|
+
const receipt_1 = require("./receipt");
|
|
53
|
+
const share_1 = require("../utils/share");
|
|
28
54
|
// ============================================================================
|
|
29
55
|
// Command Definition
|
|
30
56
|
// ============================================================================
|
|
@@ -138,7 +164,24 @@ async function runTest(output) {
|
|
|
138
164
|
// Sentinel returns { reflection, service, timestamp }; if it's wrapped
|
|
139
165
|
// in a delivery-proof envelope (`{ type: 'delivery.proof', result: {...} }`),
|
|
140
166
|
// unwrap once. Fall back to printing the raw payload otherwise.
|
|
141
|
-
const
|
|
167
|
+
const channelReflection = extractReflection(result.payload);
|
|
168
|
+
// 4b. Local fallback path. If the channel produced nothing (envelope
|
|
169
|
+
// missing, decrypt failed, wrong shape) AND we know this is the
|
|
170
|
+
// Sentinel provider, render the day's reflection from the vendored
|
|
171
|
+
// local table. The determinism contract means buyers who later
|
|
172
|
+
// retry will see the same quote Sentinel would have streamed.
|
|
173
|
+
//
|
|
174
|
+
// Strictly additive: when `channelReflection` is set, we use it
|
|
175
|
+
// verbatim and never look at the local table. The local path only
|
|
176
|
+
// activates when the channel is dormant — there is no race here.
|
|
177
|
+
const isSentinel = isSentinelProvider(sentinel.address);
|
|
178
|
+
const fallback = channelReflection === undefined && isSentinel ? safeLocalReflection() : undefined;
|
|
179
|
+
const reflection = channelReflection ?? fallback?.text;
|
|
180
|
+
const reflectionSource = channelReflection
|
|
181
|
+
? 'channel'
|
|
182
|
+
: fallback
|
|
183
|
+
? 'local-fallback'
|
|
184
|
+
: 'none';
|
|
142
185
|
output.print('');
|
|
143
186
|
output.result({
|
|
144
187
|
txId: result.txId,
|
|
@@ -146,9 +189,17 @@ async function runTest(output) {
|
|
|
146
189
|
elapsedMs: result.elapsedMs,
|
|
147
190
|
settled: result.settled,
|
|
148
191
|
reflection,
|
|
192
|
+
reflectionSource,
|
|
149
193
|
payload: result.payload,
|
|
150
194
|
receiptUrl: result.receiptUrl,
|
|
151
195
|
}, { quietKey: 'reflection' });
|
|
196
|
+
// Caveat indicator — shown only in human mode and only when we filled
|
|
197
|
+
// in the reflection from the local table. JSON consumers learn the same
|
|
198
|
+
// thing via the `reflectionSource` field above, so we don't need to
|
|
199
|
+
// duplicate it through `output.warning` for them.
|
|
200
|
+
if (reflectionSource === 'local-fallback') {
|
|
201
|
+
output.info('Reflection rendered from local cache while channel delivery activates.');
|
|
202
|
+
}
|
|
152
203
|
// Footer wording is conditional on what actually happened. The
|
|
153
204
|
// structured JSON output above always reports `settled`, but human-mode
|
|
154
205
|
// consumers see only the line emitted here — so a settle failure that
|
|
@@ -168,13 +219,46 @@ async function runTest(output) {
|
|
|
168
219
|
output.blank();
|
|
169
220
|
output.success(`Settled in ${result.elapsedMs} ms`);
|
|
170
221
|
}
|
|
222
|
+
// FIX-5: Ceremonial framed receipt (renderReceiptV3) — the wow-path
|
|
223
|
+
// visual artifact for the buyer. Human mode only: JSON / quiet consumers
|
|
224
|
+
// already received their structured payload from `output.result(...)`
|
|
225
|
+
// above. Calling V3 in those modes would emit a duplicate JSON line or
|
|
226
|
+
// a duplicate "$9.90 USDC" line.
|
|
227
|
+
if (output.mode === 'human') {
|
|
228
|
+
output.blank();
|
|
229
|
+
(0, receipt_1.renderReceiptV3)({
|
|
230
|
+
agent: 'your-agent',
|
|
231
|
+
counterparty: 'Sentinel',
|
|
232
|
+
service: 'onboarding',
|
|
233
|
+
amountWei: 10000000n,
|
|
234
|
+
network: 'base-sepolia',
|
|
235
|
+
txId: result.txId,
|
|
236
|
+
timing: { totalMs: result.elapsedMs, escrowLockMs: 0, settlementMs: 0 },
|
|
237
|
+
reflection: reflection ?? undefined,
|
|
238
|
+
receiptUrl: result.receiptUrl,
|
|
239
|
+
requester: sentinel.address,
|
|
240
|
+
}, output);
|
|
241
|
+
}
|
|
171
242
|
// Receipt URL — the wow artifact. Only present when the buyer-side V2
|
|
172
243
|
// push succeeded (real on-chain network + signer). Silent when null:
|
|
173
244
|
// either mock, or the push failed (indexer cron is the backstop).
|
|
245
|
+
//
|
|
246
|
+
// We keep the standalone "Receipt: <url>" line even though the V3 frame
|
|
247
|
+
// above already renders the URL inside its own block: the single-line
|
|
248
|
+
// form is the copy-paste-friendly anchor that downstream tests / scripts
|
|
249
|
+
// grep for (`captured.log.find(l => l.startsWith('Receipt: '))`).
|
|
174
250
|
if (result.receiptUrl) {
|
|
175
251
|
output.blank();
|
|
176
252
|
output.print(`Receipt: ${result.receiptUrl}`);
|
|
177
253
|
}
|
|
254
|
+
// 5. Tweet offer — the Purple Cow moment. Non-TTY skips silently so
|
|
255
|
+
// CI / piped consumers never block. Failures (browser open, clipboard)
|
|
256
|
+
// degrade gracefully to printing the raw URL.
|
|
257
|
+
await offerShareOnX({
|
|
258
|
+
txId: result.txId,
|
|
259
|
+
receiptUrl: result.receiptUrl,
|
|
260
|
+
settled: result.settled,
|
|
261
|
+
}, output);
|
|
178
262
|
}
|
|
179
263
|
exports.runTest = runTest;
|
|
180
264
|
function extractReflection(payload) {
|
|
@@ -192,4 +276,182 @@ function extractReflection(payload) {
|
|
|
192
276
|
}
|
|
193
277
|
return undefined;
|
|
194
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Return the day's local-fallback reflection text + id. Defensively wrapped
|
|
281
|
+
* so any future failure inside `todaysReflection` (corrupted table import,
|
|
282
|
+
* invalid Date) can never abort the `actp test` flow — the buyer still
|
|
283
|
+
* gets their receipt, just without a quote.
|
|
284
|
+
*/
|
|
285
|
+
function safeLocalReflection() {
|
|
286
|
+
try {
|
|
287
|
+
const r = (0, sentinelReflections_1.todaysReflection)();
|
|
288
|
+
if (!r || typeof r.text !== 'string' || r.text.length === 0)
|
|
289
|
+
return undefined;
|
|
290
|
+
return { id: r.id, text: r.text };
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
exports.safeLocalReflection = safeLocalReflection;
|
|
297
|
+
/**
|
|
298
|
+
* Does `providerAddress` match a known Sentinel deployment? We compare
|
|
299
|
+
* against the resolved Sentinel address for Base Sepolia (env override or
|
|
300
|
+
* constant table), case-insensitively because EIP-55 checksum casing is
|
|
301
|
+
* not stable across components in the pipeline.
|
|
302
|
+
*
|
|
303
|
+
* Defensive: any failure to resolve Sentinel (missing table entry,
|
|
304
|
+
* invalid env var) returns false — the local-fallback path is opt-in
|
|
305
|
+
* only when we are confident the provider is Sentinel. Mis-rendering a
|
|
306
|
+
* Sentinel reflection on someone else's transaction would be worse than
|
|
307
|
+
* silently omitting it.
|
|
308
|
+
*/
|
|
309
|
+
function isSentinelProvider(providerAddress) {
|
|
310
|
+
try {
|
|
311
|
+
const sentinel = (0, resolveAgent_1.resolveAgent)('sentinel', 'base-sepolia');
|
|
312
|
+
return sentinel.address.toLowerCase() === providerAddress.toLowerCase();
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
exports.isSentinelProvider = isSentinelProvider;
|
|
319
|
+
/**
|
|
320
|
+
* Default dependency bundle that wires to the real readline / share.ts
|
|
321
|
+
* implementations. Tests override these via the second arg.
|
|
322
|
+
*/
|
|
323
|
+
function defaultShareDeps() {
|
|
324
|
+
return {
|
|
325
|
+
prompt: async (question) => {
|
|
326
|
+
const readline = await Promise.resolve().then(() => __importStar(require('readline')));
|
|
327
|
+
const rl = readline.createInterface({
|
|
328
|
+
input: process.stdin,
|
|
329
|
+
output: process.stdout,
|
|
330
|
+
});
|
|
331
|
+
try {
|
|
332
|
+
return await new Promise((resolve) => {
|
|
333
|
+
rl.question(question, resolve);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
finally {
|
|
337
|
+
rl.close();
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
openUrl: share_1.openUrl,
|
|
341
|
+
copyToClipboard: share_1.copyToClipboardOSC52,
|
|
342
|
+
isTty: () => Boolean(process.stdout.isTTY),
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* After a successful test transaction, ask the user whether they want to
|
|
347
|
+
* share it on X (formerly Twitter). The whole flow is fail-soft:
|
|
348
|
+
*
|
|
349
|
+
* - human mode only — json / quiet never see this UX
|
|
350
|
+
* - non-TTY → skip entirely (no blocking prompt in CI)
|
|
351
|
+
* - declined → no browser open, no clipboard touch
|
|
352
|
+
* - accepted → openUrl; if openUrl returns false, fall back to printing
|
|
353
|
+
* the URL and copying it to the clipboard so the user can paste it
|
|
354
|
+
* - 'c' option → copy URL to clipboard only (no browser)
|
|
355
|
+
*
|
|
356
|
+
* The function returns the chosen action so the caller / tests can assert
|
|
357
|
+
* which path was taken without having to scrape console output.
|
|
358
|
+
*
|
|
359
|
+
* Visible only in `human` mode; returns `'skipped'` for json / quiet.
|
|
360
|
+
*
|
|
361
|
+
* @param result - Subset of the runRequest result needed to build the tweet.
|
|
362
|
+
* @param output - Output instance (controls human / json / quiet mode).
|
|
363
|
+
* @param deps - Injected dependencies (defaults to readline + share.ts).
|
|
364
|
+
* @returns The action taken: 'tweet', 'copy', 'declined', 'skipped', or 'failed'.
|
|
365
|
+
*/
|
|
366
|
+
async function offerShareOnX(result, output, deps = defaultShareDeps()) {
|
|
367
|
+
// Never prompt in json / quiet — those modes are for scripts.
|
|
368
|
+
if (output.mode !== 'human')
|
|
369
|
+
return 'skipped';
|
|
370
|
+
// Non-TTY skips silently. CI / piped consumers must never block.
|
|
371
|
+
if (!deps.isTty())
|
|
372
|
+
return 'skipped';
|
|
373
|
+
// Build tweet variants. We don't have a settle eth-tx-hash in the
|
|
374
|
+
// RunRequestResult, but the ACTP txId is the canonical reference and
|
|
375
|
+
// round-trips back to the receipt page. When the receipt URL is
|
|
376
|
+
// present, we splice it in — that's the strongest single artifact.
|
|
377
|
+
// Net amount: the runTest amount is fixed at $10, and the fee floor is
|
|
378
|
+
// max($10 * 1%, $0.05) = $0.10, so net = $9.90. We don't recompute it
|
|
379
|
+
// from the result because (a) the result currently doesn't expose the
|
|
380
|
+
// fee breakdown and (b) keeping it stable keeps the tweet template
|
|
381
|
+
// testable.
|
|
382
|
+
const NET_AMOUNT_USD = '9.90';
|
|
383
|
+
let tweetText;
|
|
384
|
+
if (result.receiptUrl) {
|
|
385
|
+
// Testnet template + receipt URL takes precedence over the txId
|
|
386
|
+
// fragment — the receipt URL is the prettier, click-throughable
|
|
387
|
+
// artifact.
|
|
388
|
+
const base = (0, share_1.buildTestnetTweet)(NET_AMOUNT_USD, result.txId);
|
|
389
|
+
tweetText = `${base}\n\nReceipt: ${result.receiptUrl}`;
|
|
390
|
+
}
|
|
391
|
+
else if (result.settled) {
|
|
392
|
+
// Settled but no receipt URL (push failed / not pushed). Use the
|
|
393
|
+
// testnet template with just the txId — basescan link still works.
|
|
394
|
+
tweetText = (0, share_1.buildTestnetTweet)(NET_AMOUNT_USD, result.txId);
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
// Mock or unsettled: use the generic earn template.
|
|
398
|
+
tweetText = (0, share_1.buildMockTweet)(NET_AMOUNT_USD);
|
|
399
|
+
}
|
|
400
|
+
// Twitter's hard limit is 280; URL-encoding can balloon the actual
|
|
401
|
+
// request URL but the displayed tweet text is what counts. If we're
|
|
402
|
+
// over budget, fall back to the mock template which is short.
|
|
403
|
+
if (tweetText.length > 280) {
|
|
404
|
+
tweetText = (0, share_1.buildMockTweet)(NET_AMOUNT_USD);
|
|
405
|
+
}
|
|
406
|
+
const intentUrl = (0, share_1.buildTwitterIntentUrl)(tweetText);
|
|
407
|
+
// Prompt. Y = open browser, c = copy URL, anything else = decline.
|
|
408
|
+
output.blank();
|
|
409
|
+
output.print('Share your first AGIRAILS transaction on X?');
|
|
410
|
+
output.print(' [Y] open in browser [c] copy link only [n] skip');
|
|
411
|
+
let answer;
|
|
412
|
+
try {
|
|
413
|
+
answer = await deps.prompt('Choice (Y/c/n): ');
|
|
414
|
+
}
|
|
415
|
+
catch {
|
|
416
|
+
// Prompt failed (stdin closed mid-flight). Treat as decline.
|
|
417
|
+
return 'declined';
|
|
418
|
+
}
|
|
419
|
+
const trimmed = answer.trim().toLowerCase();
|
|
420
|
+
// Copy-only branch.
|
|
421
|
+
if (trimmed === 'c' || trimmed === 'copy') {
|
|
422
|
+
const copied = deps.copyToClipboard(intentUrl);
|
|
423
|
+
if (copied) {
|
|
424
|
+
output.info('Tweet URL copied to clipboard — paste it anywhere to share.');
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
// OSC 52 unsupported. Print the URL so the user can copy manually.
|
|
428
|
+
output.print('Tweet URL (copy manually):');
|
|
429
|
+
output.print(` ${intentUrl}`);
|
|
430
|
+
}
|
|
431
|
+
return 'copy';
|
|
432
|
+
}
|
|
433
|
+
// Decline branch: any explicit "no" answer.
|
|
434
|
+
if (trimmed === 'n' || trimmed === 'no') {
|
|
435
|
+
return 'declined';
|
|
436
|
+
}
|
|
437
|
+
// Accept branch: empty (Enter), y, yes. Open browser.
|
|
438
|
+
const opened = deps.openUrl(intentUrl);
|
|
439
|
+
if (opened) {
|
|
440
|
+
output.info('Opening X in your browser…');
|
|
441
|
+
return 'tweet';
|
|
442
|
+
}
|
|
443
|
+
// Browser open failed (unsupported platform, spawn error). Fall back
|
|
444
|
+
// to clipboard + visible URL so the user still has a path forward.
|
|
445
|
+
output.warning('Could not open browser automatically.');
|
|
446
|
+
const copied = deps.copyToClipboard(intentUrl);
|
|
447
|
+
if (copied) {
|
|
448
|
+
output.info('Tweet URL copied to clipboard instead — paste it in your browser.');
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
output.print('Open this URL to tweet:');
|
|
452
|
+
output.print(` ${intentUrl}`);
|
|
453
|
+
}
|
|
454
|
+
return 'failed';
|
|
455
|
+
}
|
|
456
|
+
exports.offerShareOnX = offerShareOnX;
|
|
195
457
|
//# sourceMappingURL=test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../src/cli/commands/test.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../src/cli/commands/test.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,4CAAmD;AACnD,4CAA2C;AAC3C,sDAI6B;AAC7B,kDAI2B;AAC3B,oEAA8D;AAC9D,uCAA4C;AAC5C,0CAMwB;AAExB,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,SAAgB,iBAAiB;IAC/B,OAAO,IAAI,mBAAO,CAAC,MAAM,CAAC;SACvB,WAAW,CAAC,6EAA6E,CAAC;SAC1F,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,aAAa,EAAE,4BAA4B,CAAC;SACnD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE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;YACX,MAAM,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;QAC7E,CAAC;aAAM,CAAC;YACN,mEAAmE;YACnE,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,4CAA4C;IAC5C,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,sDAAsD;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC1C,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,qEAAqE;IACrE,mEAAmE;IACnE,MAAM,CAAC,OAAO,CAAC,uCAAuC,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAC/C,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;IACnF,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAhGD,sCAgGC"}
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
* @module cli/lib/runRequest
|
|
41
41
|
*/
|
|
42
42
|
import { TransactionState } from '../../runtime/types/MockState';
|
|
43
|
+
import { type DeliveryChannel, type DeliveryError, type DeliveryPrivacy } from '../../delivery';
|
|
43
44
|
export type RequestNetwork = 'mock' | 'testnet' | 'mainnet';
|
|
44
45
|
export interface RunRequestOptions {
|
|
45
46
|
/** Provider — checksummed or lowercase Ethereum address. */
|
|
@@ -70,6 +71,81 @@ export interface RunRequestOptions {
|
|
|
70
71
|
stateDirectory?: string;
|
|
71
72
|
/** Called for every state transition the requester observes. */
|
|
72
73
|
onTransition?: (state: TransactionState, txId: string, ts: Date) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Delivery channel for AIP-16 setup POST + envelope subscription.
|
|
76
|
+
*
|
|
77
|
+
* When omitted, runRequest behaves exactly as before — no setup is posted,
|
|
78
|
+
* no envelope subscription runs, and `payload` falls back to the legacy
|
|
79
|
+
* `tx.deliveryProof` parsing path. Tests and pre-AIP-16 deployments are
|
|
80
|
+
* unaffected.
|
|
81
|
+
*
|
|
82
|
+
* When provided AND `expectedKernelAddress` + `expectedChainId` are also
|
|
83
|
+
* supplied, runRequest:
|
|
84
|
+
* 1. signs and POSTs a `DeliverySetupWireV1` between createTransaction
|
|
85
|
+
* and linkEscrow,
|
|
86
|
+
* 2. subscribes to envelopes in parallel with state polling,
|
|
87
|
+
* 3. populates `RunRequestResult.payload` from the decrypted (or parsed)
|
|
88
|
+
* envelope body once one arrives.
|
|
89
|
+
*/
|
|
90
|
+
deliveryChannel?: DeliveryChannel;
|
|
91
|
+
/**
|
|
92
|
+
* Trusted ACTP kernel address for EIP-712 setup/envelope binding.
|
|
93
|
+
*
|
|
94
|
+
* Required (alongside `deliveryChannel` + `expectedChainId`) to enable
|
|
95
|
+
* the AIP-16 delivery flow. Used as the EIP-712 `verifyingContract`
|
|
96
|
+
* domain anchor and as the envelope-verifier allowlist anchor.
|
|
97
|
+
*/
|
|
98
|
+
expectedKernelAddress?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Trusted EVM chain id for the AIP-16 delivery binding (e.g. 84532 for
|
|
101
|
+
* Base Sepolia, 8453 for Base mainnet).
|
|
102
|
+
*
|
|
103
|
+
* Required (alongside `deliveryChannel` + `expectedKernelAddress`) to
|
|
104
|
+
* enable the AIP-16 delivery flow.
|
|
105
|
+
*/
|
|
106
|
+
expectedChainId?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Grace period (in milliseconds) to keep the envelope subscription open
|
|
109
|
+
* AFTER the transaction reaches DELIVERED. Default 30_000 (30s).
|
|
110
|
+
*
|
|
111
|
+
* Settlement is NEVER blocked by the wait — if the envelope arrives
|
|
112
|
+
* before DELIVERED, `payload` is populated and the subscription closes
|
|
113
|
+
* early. If the grace period elapses with no envelope, runRequest
|
|
114
|
+
* proceeds with `payload = undefined` and `deliveryError.code =
|
|
115
|
+
* 'envelope_missing'` set (informational; not fatal).
|
|
116
|
+
*/
|
|
117
|
+
envelopeWaitMs?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Privacy posture requested in the buyer setup. Default `"public"`.
|
|
120
|
+
*
|
|
121
|
+
* `"public"`: setup carries `buyerEphemeralPubkey = CANONICAL_EMPTY_BYTES32`;
|
|
122
|
+
* envelope body is plaintext UTF-8 JSON (`public-v1` scheme); no
|
|
123
|
+
* ephemeral keypair is generated.
|
|
124
|
+
*
|
|
125
|
+
* `"encrypted"`: an ephemeral X25519 keypair is generated for this
|
|
126
|
+
* call; the public key is embedded in the signed setup; the private
|
|
127
|
+
* key is held in this closure ONLY (never persisted, never returned)
|
|
128
|
+
* and used to decrypt the envelope body once it arrives.
|
|
129
|
+
*/
|
|
130
|
+
deliveryPrivacy?: DeliveryPrivacy;
|
|
131
|
+
/**
|
|
132
|
+
* CoinbaseSmartWallet factory nonce used to derive the buyer's
|
|
133
|
+
* `requesterAddress` from the EOA `signerAddress`. Default `0` (the
|
|
134
|
+
* first wallet per owner).
|
|
135
|
+
*
|
|
136
|
+
* H4 fix (AIP-16 Phase 3 HIGH) — high-level surface. Buyers whose
|
|
137
|
+
* Smart Wallet was deployed at a non-zero factory nonce MUST pass that
|
|
138
|
+
* nonce here so the AIP-16 server-side derivation lands on the correct
|
|
139
|
+
* address. Omitting it (or passing `0`) reproduces the legacy behavior
|
|
140
|
+
* and yields byte-identical signing for the vast majority of callers
|
|
141
|
+
* (auto-wallet deploys at nonce=0).
|
|
142
|
+
*
|
|
143
|
+
* Threaded into {@link DeliverySetupBuilder.build}. Negative or
|
|
144
|
+
* non-integer values are rejected by the builder with
|
|
145
|
+
* `BUILDER_INVALID_SMART_WALLET_NONCE` (surfaces as `setup_post_failed`
|
|
146
|
+
* `deliveryError` here — settlement still proceeds).
|
|
147
|
+
*/
|
|
148
|
+
smartWalletNonce?: number;
|
|
73
149
|
}
|
|
74
150
|
export declare class QuoteTimeoutError extends Error {
|
|
75
151
|
readonly txId: string;
|
|
@@ -105,6 +181,20 @@ export interface RunRequestResult {
|
|
|
105
181
|
* - network is 'mock' (no real chain ⇒ no real receipt to publish)
|
|
106
182
|
*/
|
|
107
183
|
receiptUrl: string | null;
|
|
184
|
+
/**
|
|
185
|
+
* Structured non-fatal delivery error if any AIP-16 step failed.
|
|
186
|
+
*
|
|
187
|
+
* Set when:
|
|
188
|
+
* - the setup POST timed out or failed (`setup_post_failed`),
|
|
189
|
+
* - the envelope grace period elapsed with no envelope (`envelope_missing`),
|
|
190
|
+
* - envelope decryption / parsing failed (`envelope_decrypt_failed`).
|
|
191
|
+
*
|
|
192
|
+
* NEVER set when the delivery channel was not provided (AIP-16 was off).
|
|
193
|
+
* Settlement is never blocked by these failures — the channel is a
|
|
194
|
+
* convenience layer, not a fund-flow gate. Callers MAY surface this
|
|
195
|
+
* error in CLI output to help users diagnose channel/relay issues.
|
|
196
|
+
*/
|
|
197
|
+
deliveryError?: DeliveryError;
|
|
108
198
|
}
|
|
109
199
|
/**
|
|
110
200
|
* Execute a Level 1 negotiated request end-to-end.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runRequest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/runRequest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAKH,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
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