@hashspan/core 0.8.0 → 0.9.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 +32 -17
- package/dist/index.cjs +305 -19
- package/dist/index.d.cts +174 -28
- package/dist/index.d.mts +174 -28
- package/dist/index.mjs +292 -20
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Attributes, Context, MeterProvider, TimeInput, TracerProvider } from "@opentelemetry/api";
|
|
2
2
|
//#region src/types.d.ts
|
|
3
3
|
/**
|
|
4
|
-
* How wallet addresses are recorded
|
|
5
|
-
*
|
|
4
|
+
* How wallet addresses are recorded: `raw` in lower case, `hashed` as a hash of the lower-cased address, `off` not at
|
|
5
|
+
* all. See
|
|
6
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0004-privacy-defaults.md.
|
|
6
7
|
*/
|
|
7
8
|
type AddressMode = "raw" | "hashed" | "off";
|
|
8
9
|
/**
|
|
9
10
|
* How error messages are recorded on exception events and span status. See
|
|
10
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
11
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0006-error-privacy.md.
|
|
11
12
|
* - `off`: error type only
|
|
12
13
|
* - `sanitized`: first line, addresses per address mode, other long hex data removed
|
|
13
14
|
* - `raw`: full message and stack trace, as thrown
|
|
@@ -66,7 +67,7 @@ interface TxTrackerOptions {
|
|
|
66
67
|
/**
|
|
67
68
|
* Agent identity. A field set here always wins; fields left unset are taken from the Baggage entries
|
|
68
69
|
* `gen_ai.agent.id` / `gen_ai.agent.name` unless `agentFromBaggage` is false
|
|
69
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
70
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0011-agent-identity-precedence.md).
|
|
70
71
|
*/
|
|
71
72
|
agent?: AgentIdentity | undefined;
|
|
72
73
|
/**
|
|
@@ -110,25 +111,37 @@ interface SendInput {
|
|
|
110
111
|
functionSelector?: string | undefined;
|
|
111
112
|
/** Decoded call arguments; recorded only with the `recordFunctionArguments` tracker option. */
|
|
112
113
|
functionArguments?: readonly unknown[] | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* The EIP-7702 authorization list of a type 4 transaction. Its length is recorded as
|
|
116
|
+
* `blockchain.tx.authorization.count`; for each well-formed entry (at most 64), its delegated address per the
|
|
117
|
+
* address mode and its chain id. Signatures and nonces are never recorded.
|
|
118
|
+
*/
|
|
119
|
+
authorizations?: readonly AuthorizationInput[] | undefined;
|
|
113
120
|
/**
|
|
114
121
|
* When the send started, for adapters that record it after the fact
|
|
115
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
122
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0009-telemetry-off-the-call-path.md).
|
|
116
123
|
* Omit it otherwise: with an explicit start time, the SDK measures the span by the wall clock, so pass the end time
|
|
117
124
|
* to the handle too.
|
|
118
125
|
*/
|
|
119
126
|
startTime?: TimeInput | undefined;
|
|
120
127
|
}
|
|
128
|
+
/** One EIP-7702 authorization: the contract the account delegates to, and the chain it is valid on (0: every chain). */
|
|
129
|
+
interface AuthorizationInput {
|
|
130
|
+
/** The delegated contract address; `0x000...0` clears a delegation. */
|
|
131
|
+
address: string;
|
|
132
|
+
chainId: number;
|
|
133
|
+
}
|
|
121
134
|
/**
|
|
122
135
|
* Ends a send span. Only the first call counts; methods never throw.
|
|
123
136
|
* Produced by the tracker only; methods may be added in minor releases
|
|
124
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
137
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0014-core-api-boundary.md).
|
|
125
138
|
*/
|
|
126
139
|
interface SendHandle {
|
|
127
140
|
/**
|
|
128
141
|
* The parent context with the send span set. Run the call that sends the transaction in it, e.g.
|
|
129
142
|
* `await context.with(send.context, () => sendSomehow())`, so that spans of wallet, RPC or HTTP instrumentation
|
|
130
143
|
* nest under the send span
|
|
131
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
144
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0015-send-span-as-active-context.md).
|
|
132
145
|
* Run only that call in it: a confirm span started in it becomes a child of the send span.
|
|
133
146
|
*/
|
|
134
147
|
readonly context: Context;
|
|
@@ -191,7 +204,7 @@ interface ReceiptLike {
|
|
|
191
204
|
/**
|
|
192
205
|
* Hash of the mined transaction. When it differs from the awaited hash, the awaited transaction was replaced: its
|
|
193
206
|
* confirm span ends as `replaced` and the receipt is recorded for this hash
|
|
194
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
207
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0008-replaced-transactions.md).
|
|
195
208
|
*/
|
|
196
209
|
transactionHash?: string | undefined;
|
|
197
210
|
/** Replacement reason reported by the library, when {@link transactionHash} differs from the awaited hash. */
|
|
@@ -201,7 +214,7 @@ interface ReceiptLike {
|
|
|
201
214
|
* One wait for a transaction's receipt, joined to the transaction's shared confirm span. Only the first call counts;
|
|
202
215
|
* methods never throw.
|
|
203
216
|
* Produced by the tracker only; methods may be added in minor releases
|
|
204
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
217
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0014-core-api-boundary.md).
|
|
205
218
|
*/
|
|
206
219
|
interface ConfirmHandle {
|
|
207
220
|
/** Ends the shared confirm span with the receipt, for every handle of the transaction. */
|
|
@@ -225,7 +238,7 @@ interface ConfirmHandle {
|
|
|
225
238
|
}
|
|
226
239
|
/**
|
|
227
240
|
* A payment the agent authorizes and another party settles on chain, e.g. an x402 facilitator
|
|
228
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
241
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0013-x402-payments.md).
|
|
229
242
|
* Values often come from a remote server: addresses, amounts and identifiers that are malformed are not recorded.
|
|
230
243
|
*/
|
|
231
244
|
interface PaymentInput {
|
|
@@ -259,7 +272,7 @@ interface PaymentSettlement {
|
|
|
259
272
|
status: PaymentStatus;
|
|
260
273
|
/** Hash of the settling transaction; with it, a confirm span for this hash links to the payment span. */
|
|
261
274
|
hash?: string | undefined;
|
|
262
|
-
/** Address that paid, when the settlement reports it; recorded
|
|
275
|
+
/** Address that paid, when the settlement reports it; recorded only when the payment's input had no payer. */
|
|
263
276
|
payer?: string | undefined;
|
|
264
277
|
/**
|
|
265
278
|
* Amount settled, when the settlement reports it, recorded as `blockchain.payment.settled_amount`; also as
|
|
@@ -277,7 +290,7 @@ interface PaymentSettlement {
|
|
|
277
290
|
/**
|
|
278
291
|
* Ends a payment span. Only the first call counts; methods never throw.
|
|
279
292
|
* Produced by the tracker only; methods may be added in minor releases
|
|
280
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
293
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0014-core-api-boundary.md).
|
|
281
294
|
*/
|
|
282
295
|
interface PaymentHandle {
|
|
283
296
|
/** Ends the payment span with its settlement. */
|
|
@@ -302,7 +315,7 @@ interface PaymentHandle {
|
|
|
302
315
|
}
|
|
303
316
|
/**
|
|
304
317
|
* A user operation of an ERC-4337 smart account, handed to a bundler
|
|
305
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
318
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0021-user-operations.md). It has no
|
|
306
319
|
* transaction of its own: the bundler includes it in a bundle transaction that the bundler sends.
|
|
307
320
|
*/
|
|
308
321
|
interface UserOperationInput {
|
|
@@ -325,7 +338,7 @@ interface UserOperationResult {
|
|
|
325
338
|
/**
|
|
326
339
|
* Ends the send span of a user operation. Only the first call counts; methods never throw.
|
|
327
340
|
* Produced by the tracker only; methods may be added in minor releases
|
|
328
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
341
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0014-core-api-boundary.md).
|
|
329
342
|
*/
|
|
330
343
|
interface UserOperationSendHandle {
|
|
331
344
|
/**
|
|
@@ -383,7 +396,7 @@ interface UserOperationReceiptLike {
|
|
|
383
396
|
* One wait for a user operation's receipt, joined to the operation's shared confirm span, as for transactions
|
|
384
397
|
* ({@link ConfirmHandle}). Only the first call counts; methods never throw.
|
|
385
398
|
* Produced by the tracker only; methods may be added in minor releases
|
|
386
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
399
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0014-core-api-boundary.md).
|
|
387
400
|
*/
|
|
388
401
|
interface UserOperationConfirmHandle {
|
|
389
402
|
/** Ends the shared confirm span with the receipt, for every handle of the user operation. */
|
|
@@ -401,6 +414,101 @@ interface UserOperationConfirmHandle {
|
|
|
401
414
|
*/
|
|
402
415
|
fail(error: unknown, options?: FailOptions): void;
|
|
403
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* A batch of calls handed to a wallet with EIP-5792 `wallet_sendCalls`
|
|
419
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0022-call-batches.md). The wallet decides
|
|
420
|
+
* how the calls reach the chain: in one transaction, several, or a user operation.
|
|
421
|
+
*/
|
|
422
|
+
interface CallBatchInput {
|
|
423
|
+
/** EIP-155 chain id. */
|
|
424
|
+
chainId: number;
|
|
425
|
+
/** Address of the account the calls are sent from, recorded as `blockchain.call_batch.sender` per the address mode. */
|
|
426
|
+
sender?: string | undefined;
|
|
427
|
+
/** Number of calls in the batch, recorded as `blockchain.call_batch.call_count`. */
|
|
428
|
+
callCount?: number | undefined;
|
|
429
|
+
/** When the send started, for adapters that record it after the fact; see {@link SendInput.startTime}. */
|
|
430
|
+
startTime?: TimeInput | undefined;
|
|
431
|
+
}
|
|
432
|
+
/** What handing a call batch to a wallet produced. */
|
|
433
|
+
interface CallBatchResult {
|
|
434
|
+
/**
|
|
435
|
+
* The batch id the wallet returned, which identifies the batch with the chain id: `0x`-prefixed hex of at most 8194
|
|
436
|
+
* characters. Any other id is not recorded.
|
|
437
|
+
*/
|
|
438
|
+
id: string;
|
|
439
|
+
/**
|
|
440
|
+
* Hashes of transactions the account itself sent for the batch, when the adapter knows them (viem's fallback to
|
|
441
|
+
* `eth_sendTransaction`). Each is recorded as sent by the batch's send span, so its confirm span links to it.
|
|
442
|
+
*/
|
|
443
|
+
transactionHashes?: readonly string[] | undefined;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Ends the send span of a call batch. Only the first call counts; methods never throw.
|
|
447
|
+
* Produced by the tracker only; methods may be added in minor releases
|
|
448
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0014-core-api-boundary.md).
|
|
449
|
+
*/
|
|
450
|
+
interface CallBatchSendHandle {
|
|
451
|
+
/**
|
|
452
|
+
* The parent context with the send span set. Run the call that hands the batch to the wallet in it, as for
|
|
453
|
+
* {@link SendHandle.context}.
|
|
454
|
+
*/
|
|
455
|
+
readonly context: Context;
|
|
456
|
+
/** Ends the send span successfully once the batch id is known. */
|
|
457
|
+
end(result: CallBatchResult, options?: EndOptions): void;
|
|
458
|
+
/** Ends the send span with an error (the wallet rejected the batch, or sending it failed). */
|
|
459
|
+
fail(error: unknown, options?: FailOptions): void;
|
|
460
|
+
}
|
|
461
|
+
interface CallBatchConfirmInput {
|
|
462
|
+
/** EIP-155 chain id; with `id`, it identifies the batch and its confirm span. */
|
|
463
|
+
chainId: number;
|
|
464
|
+
/** The batch id awaited, as the wallet returned it. */
|
|
465
|
+
id: string;
|
|
466
|
+
/** When the wait started, for adapters that record it after the fact; see {@link SendInput.startTime}. */
|
|
467
|
+
startTime?: TimeInput | undefined;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Library-agnostic view of an EIP-5792 call batch status (`wallet_getCallsStatus`). Every field is optional; values
|
|
471
|
+
* come from a wallet, and malformed ones are not recorded.
|
|
472
|
+
*/
|
|
473
|
+
interface CallBatchStatusLike {
|
|
474
|
+
/**
|
|
475
|
+
* The EIP-5792 status code, recorded as `blockchain.call_batch.status_code`. 200 ends the confirm span as
|
|
476
|
+
* `success`, 500 as `reverted` and 600 as `partially_reverted` (`blockchain.call_batch.status`); 400 (failed without
|
|
477
|
+
* inclusion) with `error.type` `failed`; 100 (still pending) without an outcome; any other code, or none, with
|
|
478
|
+
* `error.type` `_OTHER`.
|
|
479
|
+
*/
|
|
480
|
+
statusCode?: number | undefined;
|
|
481
|
+
/** Whether the wallet ran the calls atomically. */
|
|
482
|
+
atomic?: boolean | undefined;
|
|
483
|
+
/**
|
|
484
|
+
* Receipts of the transactions that carried the batch; only their hashes (validated, de-duplicated, at most 64) and
|
|
485
|
+
* the highest block number are recorded.
|
|
486
|
+
*/
|
|
487
|
+
receipts?: readonly {
|
|
488
|
+
transactionHash?: string | undefined;
|
|
489
|
+
blockNumber?: bigint | number | undefined;
|
|
490
|
+
}[] | undefined;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* One wait for a call batch's status, joined to the batch's shared confirm span, as for transactions
|
|
494
|
+
* ({@link ConfirmHandle}). Only the first call counts; methods never throw.
|
|
495
|
+
* Produced by the tracker only; methods may be added in minor releases
|
|
496
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0014-core-api-boundary.md).
|
|
497
|
+
*/
|
|
498
|
+
interface CallBatchConfirmHandle {
|
|
499
|
+
/** Ends the shared confirm span with the status, for every handle of the batch. */
|
|
500
|
+
end(status: CallBatchStatusLike, options?: EndOptions): void;
|
|
501
|
+
/**
|
|
502
|
+
* Withdraws this handle because waiting for the status timed out. The confirm span ends as `timeout` only if no
|
|
503
|
+
* other handle of the batch is still waiting.
|
|
504
|
+
*/
|
|
505
|
+
timeout(options?: EndOptions): void;
|
|
506
|
+
/**
|
|
507
|
+
* Withdraws this handle because the status could not be retrieved. The confirm span ends as a failure only if no
|
|
508
|
+
* other handle is still waiting.
|
|
509
|
+
*/
|
|
510
|
+
fail(error: unknown, options?: FailOptions): void;
|
|
511
|
+
}
|
|
404
512
|
//#endregion
|
|
405
513
|
//#region src/agent.d.ts
|
|
406
514
|
export declare const ATTR_GEN_AI_AGENT_ID: "gen_ai.agent.id";
|
|
@@ -410,7 +518,7 @@ export declare const ATTR_GEN_AI_AGENT_NAME: "gen_ai.agent.name";
|
|
|
410
518
|
/**
|
|
411
519
|
* Attribute keys emitted by hashspan.
|
|
412
520
|
*
|
|
413
|
-
* Stability: development. See https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
521
|
+
* Stability: development. See https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/semconv.md for
|
|
414
522
|
* definitions and value types. These names are a public contract: changes follow the deprecation policy in AGENTS.md.
|
|
415
523
|
*/
|
|
416
524
|
export declare const ATTR_BLOCKCHAIN_SYSTEM: "blockchain.system";
|
|
@@ -421,6 +529,12 @@ export declare const ATTR_BLOCKCHAIN_TX_FROM: "blockchain.tx.from";
|
|
|
421
529
|
export declare const ATTR_BLOCKCHAIN_TX_TO: "blockchain.tx.to";
|
|
422
530
|
export declare const ATTR_BLOCKCHAIN_TX_VALUE: "blockchain.tx.value";
|
|
423
531
|
export declare const ATTR_BLOCKCHAIN_TX_NONCE: "blockchain.tx.nonce";
|
|
532
|
+
/** Number of EIP-7702 authorizations a type 4 transaction carries. */
|
|
533
|
+
export declare const ATTR_BLOCKCHAIN_TX_AUTHORIZATION_COUNT: "blockchain.tx.authorization.count";
|
|
534
|
+
/** Delegated contract address of each well-formed EIP-7702 authorization, per the address mode; at most 64. */
|
|
535
|
+
export declare const ATTR_BLOCKCHAIN_TX_AUTHORIZATION_ADDRESSES: "blockchain.tx.authorization.addresses";
|
|
536
|
+
/** Chain id of each well-formed EIP-7702 authorization, aligned with the addresses; 0 means every chain. */
|
|
537
|
+
export declare const ATTR_BLOCKCHAIN_TX_AUTHORIZATION_CHAIN_IDS: "blockchain.tx.authorization.chain_ids";
|
|
424
538
|
export declare const ATTR_BLOCKCHAIN_TX_STATUS: "blockchain.tx.status";
|
|
425
539
|
export declare const ATTR_BLOCKCHAIN_TX_GAS_USED: "blockchain.tx.gas.used";
|
|
426
540
|
export declare const ATTR_BLOCKCHAIN_TX_EFFECTIVE_GAS_PRICE: "blockchain.tx.effective_gas_price";
|
|
@@ -434,12 +548,12 @@ export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_NAME: "blockchain.contrac
|
|
|
434
548
|
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_SELECTOR: "blockchain.contract.function.selector";
|
|
435
549
|
/**
|
|
436
550
|
* Opt-in: decoded call arguments as a JSON array. See
|
|
437
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
551
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0004-privacy-defaults.md.
|
|
438
552
|
*/
|
|
439
553
|
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_ARGUMENTS: "blockchain.contract.function.arguments";
|
|
440
554
|
/**
|
|
441
555
|
* Payments settled on chain by a party other than the agent, e.g. an x402 facilitator. See
|
|
442
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
556
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0013-x402-payments.md.
|
|
443
557
|
*/
|
|
444
558
|
export declare const ATTR_BLOCKCHAIN_PAYMENT_PROTOCOL: "blockchain.payment.protocol";
|
|
445
559
|
export declare const ATTR_BLOCKCHAIN_PAYMENT_PAYER: "blockchain.payment.payer";
|
|
@@ -452,7 +566,7 @@ export declare const ATTR_BLOCKCHAIN_PAYMENT_SETTLED_AMOUNT: "blockchain.payment
|
|
|
452
566
|
/**
|
|
453
567
|
* Whether the settlement transaction's receipt carries the payment, as checked by the adapter; absent when no check
|
|
454
568
|
* was possible. See
|
|
455
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
569
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0017-x402-payment-verification.md.
|
|
456
570
|
*/
|
|
457
571
|
export declare const ATTR_BLOCKCHAIN_PAYMENT_VERIFIED: "blockchain.payment.verified";
|
|
458
572
|
/** x402's own payment fields. */
|
|
@@ -460,7 +574,7 @@ export declare const ATTR_X402_SCHEME: "x402.scheme";
|
|
|
460
574
|
export declare const ATTR_X402_RESOURCE: "x402.resource";
|
|
461
575
|
/**
|
|
462
576
|
* User operations of ERC-4337 smart accounts. See
|
|
463
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
577
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0021-user-operations.md.
|
|
464
578
|
*/
|
|
465
579
|
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_HASH: "blockchain.user_operation.hash";
|
|
466
580
|
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_SENDER: "blockchain.user_operation.sender";
|
|
@@ -472,13 +586,32 @@ export declare const ATTR_BLOCKCHAIN_USER_OPERATION_GAS_USED: "blockchain.user_o
|
|
|
472
586
|
/** What the operation itself paid, in wei; the bundle transaction's fee covers every operation in the bundle. */
|
|
473
587
|
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_GAS_COST: "blockchain.user_operation.gas.cost";
|
|
474
588
|
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_PAYMASTER: "blockchain.user_operation.paymaster";
|
|
589
|
+
/**
|
|
590
|
+
* The batch id the wallet returned, truncated after 256 characters. See
|
|
591
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0022-call-batches.md.
|
|
592
|
+
*/
|
|
593
|
+
export declare const ATTR_BLOCKCHAIN_CALL_BATCH_ID: "blockchain.call_batch.id";
|
|
594
|
+
export declare const ATTR_BLOCKCHAIN_CALL_BATCH_SENDER: "blockchain.call_batch.sender";
|
|
595
|
+
export declare const ATTR_BLOCKCHAIN_CALL_BATCH_CALL_COUNT: "blockchain.call_batch.call_count";
|
|
596
|
+
/** The outcome of a batch from chain data: `success`, `reverted` or `partially_reverted`. */
|
|
597
|
+
export declare const ATTR_BLOCKCHAIN_CALL_BATCH_STATUS: "blockchain.call_batch.status";
|
|
598
|
+
/** The EIP-5792 status code of the batch as the wallet reported it, e.g. 200 confirmed or 500 reverted; spans only. */
|
|
599
|
+
export declare const ATTR_BLOCKCHAIN_CALL_BATCH_STATUS_CODE: "blockchain.call_batch.status_code";
|
|
600
|
+
export declare const ATTR_BLOCKCHAIN_CALL_BATCH_ATOMIC: "blockchain.call_batch.atomic";
|
|
601
|
+
/** Hashes of the transactions whose receipts the wallet reported for the batch. */
|
|
602
|
+
export declare const ATTR_BLOCKCHAIN_CALL_BATCH_TRANSACTION_HASHES: "blockchain.call_batch.transaction_hashes";
|
|
475
603
|
/**
|
|
476
604
|
* Metrics only: what a send, confirmation or fee sample is about. Recorded as `user_operation` on samples of user
|
|
477
|
-
* operations, and absent on those of transactions.
|
|
605
|
+
* operations and `call_batch` on those of call batches, and absent on those of transactions.
|
|
478
606
|
*/
|
|
479
607
|
export declare const ATTR_BLOCKCHAIN_OPERATION_SUBJECT: "blockchain.operation.subject";
|
|
480
608
|
/** Values for {@link ATTR_BLOCKCHAIN_OPERATION_SUBJECT}. */
|
|
481
609
|
export declare const BLOCKCHAIN_OPERATION_SUBJECT_VALUE_USER_OPERATION: "user_operation";
|
|
610
|
+
export declare const BLOCKCHAIN_OPERATION_SUBJECT_VALUE_CALL_BATCH: "call_batch";
|
|
611
|
+
/** Values for {@link ATTR_BLOCKCHAIN_CALL_BATCH_STATUS}. */
|
|
612
|
+
export declare const BLOCKCHAIN_CALL_BATCH_STATUS_VALUE_SUCCESS: "success";
|
|
613
|
+
export declare const BLOCKCHAIN_CALL_BATCH_STATUS_VALUE_REVERTED: "reverted";
|
|
614
|
+
export declare const BLOCKCHAIN_CALL_BATCH_STATUS_VALUE_PARTIALLY_REVERTED: "partially_reverted";
|
|
482
615
|
/** Values for {@link ATTR_BLOCKCHAIN_SYSTEM}. */
|
|
483
616
|
export declare const BLOCKCHAIN_SYSTEM_VALUE_EVM: "evm";
|
|
484
617
|
/** Values for {@link ATTR_BLOCKCHAIN_OPERATION_NAME}. */
|
|
@@ -497,7 +630,7 @@ export declare const BLOCKCHAIN_TX_STATUS_VALUE_REVERTED: "reverted";
|
|
|
497
630
|
/**
|
|
498
631
|
* @deprecated No longer recorded: a confirm span that gave up waiting records `error.type` `timeout` and no
|
|
499
632
|
* `blockchain.tx.status`. The constant is removed in 1.0. See
|
|
500
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
633
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0016-timeout-is-an-observer-outcome.md.
|
|
501
634
|
*/
|
|
502
635
|
export declare const BLOCKCHAIN_TX_STATUS_VALUE_TIMEOUT: "timeout";
|
|
503
636
|
export declare const BLOCKCHAIN_TX_STATUS_VALUE_REPLACED: "replaced";
|
|
@@ -531,12 +664,12 @@ export declare const METRIC_BLOCKCHAIN_CLIENT_FEE: "blockchain.client.fee";
|
|
|
531
664
|
/**
|
|
532
665
|
* Records transactions, payments and user operations as spans. Obtain one from {@link createTxTracker}: it is not meant to be
|
|
533
666
|
* implemented, and members may be added to it and to its handles in minor releases
|
|
534
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
667
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0014-core-api-boundary.md).
|
|
535
668
|
*/
|
|
536
669
|
interface TxTracker {
|
|
537
670
|
/**
|
|
538
671
|
* Starts a `send` span as a child of `parent` (default: the active context).
|
|
539
|
-
* Call `end(hash)` once the transaction hash is known, or `fail(error)`.
|
|
672
|
+
* Call `end({ hash })` once the transaction hash is known, or `fail(error)`.
|
|
540
673
|
*/
|
|
541
674
|
startSend(input: SendInput, parent?: Context): SendHandle;
|
|
542
675
|
/**
|
|
@@ -549,14 +682,14 @@ interface TxTracker {
|
|
|
549
682
|
/**
|
|
550
683
|
* Starts a `payment` span as a child of `parent` (default: the active context), for a payment that another party
|
|
551
684
|
* settles on chain
|
|
552
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
685
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0013-x402-payments.md). Call
|
|
553
686
|
* `end(settlement)` with the settlement, or `fail(error)`. A settlement with a hash links the transaction's confirm
|
|
554
687
|
* span to this span, as a send span would.
|
|
555
688
|
*/
|
|
556
689
|
startPayment(input: PaymentInput, parent?: Context): PaymentHandle;
|
|
557
690
|
/**
|
|
558
691
|
* Starts a `send` span for a user operation of a smart account as a child of `parent` (default: the active context)
|
|
559
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
692
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0021-user-operations.md). Call
|
|
560
693
|
* `end({ userOpHash })` once the bundler returned the operation's hash, or `fail(error)`.
|
|
561
694
|
*/
|
|
562
695
|
startUserOperationSend(input: UserOperationInput, parent?: Context): UserOperationSendHandle;
|
|
@@ -567,10 +700,23 @@ interface TxTracker {
|
|
|
567
700
|
* returned handle must be ended.
|
|
568
701
|
*/
|
|
569
702
|
startUserOperationConfirm(input: UserOperationConfirmInput, parent?: Context): UserOperationConfirmHandle;
|
|
703
|
+
/**
|
|
704
|
+
* Starts a `send` span for an EIP-5792 call batch as a child of `parent` (default: the active context)
|
|
705
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/adr/0022-call-batches.md). Call
|
|
706
|
+
* `end({ id })` once the wallet returned the batch id, or `fail(error)`.
|
|
707
|
+
*/
|
|
708
|
+
startCallBatchSend(input: CallBatchInput, parent?: Context): CallBatchSendHandle;
|
|
709
|
+
/**
|
|
710
|
+
* Joins the `confirm` span of a call batch, starting it for the first caller; linked to its `send` span when
|
|
711
|
+
* known. As for {@link TxTracker.startConfirm}, calls for the same chain id and batch id share one span, apart from
|
|
712
|
+
* those of transactions and user operations. Returns a no-op handle for a batch that recently got its status. Every
|
|
713
|
+
* returned handle must be ended.
|
|
714
|
+
*/
|
|
715
|
+
startCallBatchConfirm(input: CallBatchConfirmInput, parent?: Context): CallBatchConfirmHandle;
|
|
570
716
|
}
|
|
571
717
|
/**
|
|
572
718
|
* Creates a tracker that records transactions as `send` and `confirm` spans, and payments as `payment` spans, with
|
|
573
|
-
* `@opentelemetry/api` (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
719
|
+
* `@opentelemetry/api` (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.9.0/docs/semconv.md). It makes
|
|
574
720
|
* no network calls; the caller passes hashes and receipts. Its methods and handles never throw: failures are logged
|
|
575
721
|
* via `diag`, and a method that fails returns a handle that records nothing.
|
|
576
722
|
*/
|
|
@@ -579,4 +725,4 @@ export declare function createTxTracker(options?: TxTrackerOptions): TxTracker;
|
|
|
579
725
|
//#region src/version.d.ts
|
|
580
726
|
export declare const VERSION: string;
|
|
581
727
|
//#endregion
|
|
582
|
-
export type { AddressMode, AddressOptions, AgentIdentity, ConfirmHandle, ConfirmInput, EndOptions, ErrorMessageMode, FailOptions, PaymentHandle, PaymentInput, PaymentResourceMode, PaymentSettlement, PaymentStatus, ReceiptLike, ReplacementReason, SendHandle, SendInput, SendResult, TxTracker, TxTrackerOptions, UserOperationConfirmHandle, UserOperationConfirmInput, UserOperationInput, UserOperationReceiptLike, UserOperationResult, UserOperationSendHandle, X402PaymentDetails };
|
|
728
|
+
export type { AddressMode, AddressOptions, AgentIdentity, AuthorizationInput, CallBatchConfirmHandle, CallBatchConfirmInput, CallBatchInput, CallBatchResult, CallBatchSendHandle, CallBatchStatusLike, ConfirmHandle, ConfirmInput, EndOptions, ErrorMessageMode, FailOptions, PaymentHandle, PaymentInput, PaymentResourceMode, PaymentSettlement, PaymentStatus, ReceiptLike, ReplacementReason, SendHandle, SendInput, SendResult, TxTracker, TxTrackerOptions, UserOperationConfirmHandle, UserOperationConfirmInput, UserOperationInput, UserOperationReceiptLike, UserOperationResult, UserOperationSendHandle, X402PaymentDetails };
|