@hashspan/core 0.6.0 → 0.8.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 +35 -13
- package/dist/index.cjs +394 -47
- package/dist/index.d.cts +186 -25
- package/dist/index.d.mts +186 -25
- package/dist/index.mjs +382 -49
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Attributes, Context, TimeInput, TracerProvider } from "@opentelemetry/api";
|
|
1
|
+
import { Attributes, Context, MeterProvider, TimeInput, TracerProvider } from "@opentelemetry/api";
|
|
2
2
|
//#region src/types.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* How wallet addresses are recorded. See
|
|
5
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
5
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0004-privacy-defaults.md.
|
|
6
6
|
*/
|
|
7
7
|
type AddressMode = "raw" | "hashed" | "off";
|
|
8
8
|
/**
|
|
9
9
|
* How error messages are recorded on exception events and span status. See
|
|
10
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
10
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0006-error-privacy.md.
|
|
11
11
|
* - `off`: error type only
|
|
12
12
|
* - `sanitized`: first line, addresses per address mode, other long hex data removed
|
|
13
13
|
* - `raw`: full message and stack trace, as thrown
|
|
@@ -43,6 +43,11 @@ interface AgentIdentity {
|
|
|
43
43
|
interface TxTrackerOptions {
|
|
44
44
|
/** Defaults to the globally registered tracer provider. */
|
|
45
45
|
tracerProvider?: TracerProvider | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Meter provider for the send, confirmation and fee histograms. Defaults to the globally registered one, which
|
|
48
|
+
* records nothing until an OpenTelemetry metrics SDK is set up.
|
|
49
|
+
*/
|
|
50
|
+
meterProvider?: MeterProvider | undefined;
|
|
46
51
|
/** Address recording mode. Default: `raw`. */
|
|
47
52
|
address?: AddressMode | AddressOptions | undefined;
|
|
48
53
|
/**
|
|
@@ -61,7 +66,7 @@ interface TxTrackerOptions {
|
|
|
61
66
|
/**
|
|
62
67
|
* Agent identity. A field set here always wins; fields left unset are taken from the Baggage entries
|
|
63
68
|
* `gen_ai.agent.id` / `gen_ai.agent.name` unless `agentFromBaggage` is false
|
|
64
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
69
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0011-agent-identity-precedence.md).
|
|
65
70
|
*/
|
|
66
71
|
agent?: AgentIdentity | undefined;
|
|
67
72
|
/**
|
|
@@ -75,13 +80,17 @@ interface TxTrackerOptions {
|
|
|
75
80
|
* If it throws or returns something other than an attributes object, the tracker fails closed and records only
|
|
76
81
|
* `blockchain.system`, `blockchain.chain.id`, `blockchain.operation.name`, `blockchain.tx.hash`,
|
|
77
82
|
* `blockchain.tx.status`, `blockchain.tx.replacement.hash`, `blockchain.tx.replacement.reason`,
|
|
78
|
-
* `blockchain.payment.protocol`, `blockchain.payment.status`, `blockchain.payment.verified`,
|
|
79
|
-
* `exception.type`, and logs
|
|
83
|
+
* `blockchain.payment.protocol`, `blockchain.payment.status`, `blockchain.payment.verified`,
|
|
84
|
+
* `blockchain.user_operation.hash`, `blockchain.user_operation.success`, `error.type` and `exception.type`, and logs
|
|
85
|
+
* the failure via `diag`.
|
|
80
86
|
*/
|
|
81
87
|
redact?: ((attributes: Attributes) => Attributes) | undefined;
|
|
82
|
-
/** How long a sent transaction can be linked from its confirmation. Default: 10 minutes. */
|
|
88
|
+
/** How long a sent transaction or user operation can be linked from its confirmation. Default: 10 minutes. */
|
|
83
89
|
linkTtlMs?: number | undefined;
|
|
84
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Maximum number of sent transactions kept for linking. Default: 10 000. User operations are kept separately, up to
|
|
92
|
+
* the same number.
|
|
93
|
+
*/
|
|
85
94
|
maxTrackedTransactions?: number | undefined;
|
|
86
95
|
}
|
|
87
96
|
interface SendInput {
|
|
@@ -103,7 +112,7 @@ interface SendInput {
|
|
|
103
112
|
functionArguments?: readonly unknown[] | undefined;
|
|
104
113
|
/**
|
|
105
114
|
* When the send started, for adapters that record it after the fact
|
|
106
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
115
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0009-telemetry-off-the-call-path.md).
|
|
107
116
|
* Omit it otherwise: with an explicit start time, the SDK measures the span by the wall clock, so pass the end time
|
|
108
117
|
* to the handle too.
|
|
109
118
|
*/
|
|
@@ -112,14 +121,14 @@ interface SendInput {
|
|
|
112
121
|
/**
|
|
113
122
|
* Ends a send span. Only the first call counts; methods never throw.
|
|
114
123
|
* Produced by the tracker only; methods may be added in minor releases
|
|
115
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
124
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0014-core-api-boundary.md).
|
|
116
125
|
*/
|
|
117
126
|
interface SendHandle {
|
|
118
127
|
/**
|
|
119
128
|
* The parent context with the send span set. Run the call that sends the transaction in it, e.g.
|
|
120
129
|
* `await context.with(send.context, () => sendSomehow())`, so that spans of wallet, RPC or HTTP instrumentation
|
|
121
130
|
* nest under the send span
|
|
122
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
131
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0015-send-span-as-active-context.md).
|
|
123
132
|
* Run only that call in it: a confirm span started in it becomes a child of the send span.
|
|
124
133
|
*/
|
|
125
134
|
readonly context: Context;
|
|
@@ -182,7 +191,7 @@ interface ReceiptLike {
|
|
|
182
191
|
/**
|
|
183
192
|
* Hash of the mined transaction. When it differs from the awaited hash, the awaited transaction was replaced: its
|
|
184
193
|
* confirm span ends as `replaced` and the receipt is recorded for this hash
|
|
185
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
194
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0008-replaced-transactions.md).
|
|
186
195
|
*/
|
|
187
196
|
transactionHash?: string | undefined;
|
|
188
197
|
/** Replacement reason reported by the library, when {@link transactionHash} differs from the awaited hash. */
|
|
@@ -192,7 +201,7 @@ interface ReceiptLike {
|
|
|
192
201
|
* One wait for a transaction's receipt, joined to the transaction's shared confirm span. Only the first call counts;
|
|
193
202
|
* methods never throw.
|
|
194
203
|
* Produced by the tracker only; methods may be added in minor releases
|
|
195
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
204
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0014-core-api-boundary.md).
|
|
196
205
|
*/
|
|
197
206
|
interface ConfirmHandle {
|
|
198
207
|
/** Ends the shared confirm span with the receipt, for every handle of the transaction. */
|
|
@@ -216,7 +225,7 @@ interface ConfirmHandle {
|
|
|
216
225
|
}
|
|
217
226
|
/**
|
|
218
227
|
* A payment the agent authorizes and another party settles on chain, e.g. an x402 facilitator
|
|
219
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
228
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0013-x402-payments.md).
|
|
220
229
|
* Values often come from a remote server: addresses, amounts and identifiers that are malformed are not recorded.
|
|
221
230
|
*/
|
|
222
231
|
interface PaymentInput {
|
|
@@ -268,7 +277,7 @@ interface PaymentSettlement {
|
|
|
268
277
|
/**
|
|
269
278
|
* Ends a payment span. Only the first call counts; methods never throw.
|
|
270
279
|
* Produced by the tracker only; methods may be added in minor releases
|
|
271
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
280
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0014-core-api-boundary.md).
|
|
272
281
|
*/
|
|
273
282
|
interface PaymentHandle {
|
|
274
283
|
/** Ends the payment span with its settlement. */
|
|
@@ -291,6 +300,107 @@ interface PaymentHandle {
|
|
|
291
300
|
*/
|
|
292
301
|
link(hash: string): void;
|
|
293
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* A user operation of an ERC-4337 smart account, handed to a bundler
|
|
305
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0021-user-operations.md). It has no
|
|
306
|
+
* transaction of its own: the bundler includes it in a bundle transaction that the bundler sends.
|
|
307
|
+
*/
|
|
308
|
+
interface UserOperationInput {
|
|
309
|
+
/** EIP-155 chain id. */
|
|
310
|
+
chainId: number;
|
|
311
|
+
/** Address of the smart account, recorded as `blockchain.user_operation.sender` per the address mode. */
|
|
312
|
+
sender?: string | undefined;
|
|
313
|
+
/** Address of the EntryPoint contract, recorded as `blockchain.user_operation.entry_point` per the address mode. */
|
|
314
|
+
entryPoint?: string | undefined;
|
|
315
|
+
/** Number of calls the operation makes, recorded as `blockchain.user_operation.call_count`. */
|
|
316
|
+
callCount?: number | undefined;
|
|
317
|
+
/** When the send started, for adapters that record it after the fact; see {@link SendInput.startTime}. */
|
|
318
|
+
startTime?: TimeInput | undefined;
|
|
319
|
+
}
|
|
320
|
+
/** What handing a user operation to a bundler produced. */
|
|
321
|
+
interface UserOperationResult {
|
|
322
|
+
/** Hash of the user operation, `0x`-prefixed 32 bytes, as the bundler returned it. */
|
|
323
|
+
userOpHash: string;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Ends the send span of a user operation. Only the first call counts; methods never throw.
|
|
327
|
+
* Produced by the tracker only; methods may be added in minor releases
|
|
328
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0014-core-api-boundary.md).
|
|
329
|
+
*/
|
|
330
|
+
interface UserOperationSendHandle {
|
|
331
|
+
/**
|
|
332
|
+
* The parent context with the send span set. Run the call that hands the operation to the bundler in it, as for
|
|
333
|
+
* {@link SendHandle.context}.
|
|
334
|
+
*/
|
|
335
|
+
readonly context: Context;
|
|
336
|
+
/** Ends the send span successfully once the user operation hash is known. */
|
|
337
|
+
end(result: UserOperationResult, options?: EndOptions): void;
|
|
338
|
+
/** Ends the send span with an error (preparing, signing or handing the operation to the bundler failed). */
|
|
339
|
+
fail(error: unknown, options?: FailOptions): void;
|
|
340
|
+
}
|
|
341
|
+
interface UserOperationConfirmInput {
|
|
342
|
+
/** EIP-155 chain id; with `userOpHash`, it identifies the user operation and its confirm span. */
|
|
343
|
+
chainId: number;
|
|
344
|
+
/** Hash of the user operation awaited, `0x`-prefixed. */
|
|
345
|
+
userOpHash: string;
|
|
346
|
+
/** When the wait started, for adapters that record it after the fact; see {@link SendInput.startTime}. */
|
|
347
|
+
startTime?: TimeInput | undefined;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Library-agnostic view of a user operation receipt (ERC-4337 `eth_getUserOperationReceipt`, or the EntryPoint's
|
|
351
|
+
* `UserOperationEvent`). Every field is optional, since some SDKs report less; values usually come from a bundler,
|
|
352
|
+
* and malformed ones are not recorded.
|
|
353
|
+
*/
|
|
354
|
+
interface UserOperationReceiptLike {
|
|
355
|
+
/**
|
|
356
|
+
* Whether the operation's calls succeeded. `false` ends the confirm span with an error status and `error.type`
|
|
357
|
+
* `reverted`; the bundle transaction itself can still have succeeded.
|
|
358
|
+
*/
|
|
359
|
+
success?: boolean | undefined;
|
|
360
|
+
/** What the operation paid, in wei (`actualGasCost`), recorded as `blockchain.user_operation.gas.cost`. */
|
|
361
|
+
actualGasCost?: bigint | string | undefined;
|
|
362
|
+
/** Gas the operation used (`actualGasUsed`), recorded as `blockchain.user_operation.gas.used`. */
|
|
363
|
+
actualGasUsed?: bigint | number | string | undefined;
|
|
364
|
+
/** Address of the smart account. */
|
|
365
|
+
sender?: string | undefined;
|
|
366
|
+
/**
|
|
367
|
+
* The operation's nonce, recorded as a decimal string: it holds a 192-bit key and a 64-bit sequence number. Bundlers
|
|
368
|
+
* return it as a hex string, which some libraries pass on unchanged.
|
|
369
|
+
*/
|
|
370
|
+
nonce?: bigint | string | undefined;
|
|
371
|
+
/** Address of the paymaster that paid for the operation; the zero address means none. */
|
|
372
|
+
paymaster?: string | undefined;
|
|
373
|
+
/** Address of the EntryPoint contract. */
|
|
374
|
+
entryPoint?: string | undefined;
|
|
375
|
+
/** Decoded revert reason, recorded as `blockchain.tx.revert.reason` with addresses per the address mode. */
|
|
376
|
+
revertReason?: string | undefined;
|
|
377
|
+
/** Hash of the bundle transaction that included the operation, recorded as `blockchain.tx.hash`. */
|
|
378
|
+
transactionHash?: string | undefined;
|
|
379
|
+
/** Block of the bundle transaction. */
|
|
380
|
+
blockNumber?: bigint | number | undefined;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* One wait for a user operation's receipt, joined to the operation's shared confirm span, as for transactions
|
|
384
|
+
* ({@link ConfirmHandle}). Only the first call counts; methods never throw.
|
|
385
|
+
* Produced by the tracker only; methods may be added in minor releases
|
|
386
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0014-core-api-boundary.md).
|
|
387
|
+
*/
|
|
388
|
+
interface UserOperationConfirmHandle {
|
|
389
|
+
/** Ends the shared confirm span with the receipt, for every handle of the user operation. */
|
|
390
|
+
end(receipt: UserOperationReceiptLike, options?: EndOptions): void;
|
|
391
|
+
/**
|
|
392
|
+
* Withdraws this handle because waiting for the receipt timed out. The confirm span ends as `timeout` only if no
|
|
393
|
+
* other handle of the user operation is still waiting.
|
|
394
|
+
*/
|
|
395
|
+
timeout(options?: EndOptions): void;
|
|
396
|
+
/**
|
|
397
|
+
* Withdraws this handle because the operation failed or its receipt could not be retrieved. The confirm span ends
|
|
398
|
+
* as a failure only if no other handle is still waiting. Called without an error, as
|
|
399
|
+
* `fail(undefined, { errorType })`, it records no exception event: for an SDK that reports a failed operation
|
|
400
|
+
* without an error.
|
|
401
|
+
*/
|
|
402
|
+
fail(error: unknown, options?: FailOptions): void;
|
|
403
|
+
}
|
|
294
404
|
//#endregion
|
|
295
405
|
//#region src/agent.d.ts
|
|
296
406
|
export declare const ATTR_GEN_AI_AGENT_ID: "gen_ai.agent.id";
|
|
@@ -300,7 +410,7 @@ export declare const ATTR_GEN_AI_AGENT_NAME: "gen_ai.agent.name";
|
|
|
300
410
|
/**
|
|
301
411
|
* Attribute keys emitted by hashspan.
|
|
302
412
|
*
|
|
303
|
-
* Stability: development. See https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
413
|
+
* Stability: development. See https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/semconv.md for
|
|
304
414
|
* definitions and value types. These names are a public contract: changes follow the deprecation policy in AGENTS.md.
|
|
305
415
|
*/
|
|
306
416
|
export declare const ATTR_BLOCKCHAIN_SYSTEM: "blockchain.system";
|
|
@@ -324,12 +434,12 @@ export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_NAME: "blockchain.contrac
|
|
|
324
434
|
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_SELECTOR: "blockchain.contract.function.selector";
|
|
325
435
|
/**
|
|
326
436
|
* Opt-in: decoded call arguments as a JSON array. See
|
|
327
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
437
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0004-privacy-defaults.md.
|
|
328
438
|
*/
|
|
329
439
|
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_ARGUMENTS: "blockchain.contract.function.arguments";
|
|
330
440
|
/**
|
|
331
441
|
* Payments settled on chain by a party other than the agent, e.g. an x402 facilitator. See
|
|
332
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
442
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0013-x402-payments.md.
|
|
333
443
|
*/
|
|
334
444
|
export declare const ATTR_BLOCKCHAIN_PAYMENT_PROTOCOL: "blockchain.payment.protocol";
|
|
335
445
|
export declare const ATTR_BLOCKCHAIN_PAYMENT_PAYER: "blockchain.payment.payer";
|
|
@@ -342,12 +452,33 @@ export declare const ATTR_BLOCKCHAIN_PAYMENT_SETTLED_AMOUNT: "blockchain.payment
|
|
|
342
452
|
/**
|
|
343
453
|
* Whether the settlement transaction's receipt carries the payment, as checked by the adapter; absent when no check
|
|
344
454
|
* was possible. See
|
|
345
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
455
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0017-x402-payment-verification.md.
|
|
346
456
|
*/
|
|
347
457
|
export declare const ATTR_BLOCKCHAIN_PAYMENT_VERIFIED: "blockchain.payment.verified";
|
|
348
458
|
/** x402's own payment fields. */
|
|
349
459
|
export declare const ATTR_X402_SCHEME: "x402.scheme";
|
|
350
460
|
export declare const ATTR_X402_RESOURCE: "x402.resource";
|
|
461
|
+
/**
|
|
462
|
+
* User operations of ERC-4337 smart accounts. See
|
|
463
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0021-user-operations.md.
|
|
464
|
+
*/
|
|
465
|
+
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_HASH: "blockchain.user_operation.hash";
|
|
466
|
+
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_SENDER: "blockchain.user_operation.sender";
|
|
467
|
+
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_ENTRY_POINT: "blockchain.user_operation.entry_point";
|
|
468
|
+
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_CALL_COUNT: "blockchain.user_operation.call_count";
|
|
469
|
+
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_NONCE: "blockchain.user_operation.nonce";
|
|
470
|
+
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_SUCCESS: "blockchain.user_operation.success";
|
|
471
|
+
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_GAS_USED: "blockchain.user_operation.gas.used";
|
|
472
|
+
/** What the operation itself paid, in wei; the bundle transaction's fee covers every operation in the bundle. */
|
|
473
|
+
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_GAS_COST: "blockchain.user_operation.gas.cost";
|
|
474
|
+
export declare const ATTR_BLOCKCHAIN_USER_OPERATION_PAYMASTER: "blockchain.user_operation.paymaster";
|
|
475
|
+
/**
|
|
476
|
+
* 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.
|
|
478
|
+
*/
|
|
479
|
+
export declare const ATTR_BLOCKCHAIN_OPERATION_SUBJECT: "blockchain.operation.subject";
|
|
480
|
+
/** Values for {@link ATTR_BLOCKCHAIN_OPERATION_SUBJECT}. */
|
|
481
|
+
export declare const BLOCKCHAIN_OPERATION_SUBJECT_VALUE_USER_OPERATION: "user_operation";
|
|
351
482
|
/** Values for {@link ATTR_BLOCKCHAIN_SYSTEM}. */
|
|
352
483
|
export declare const BLOCKCHAIN_SYSTEM_VALUE_EVM: "evm";
|
|
353
484
|
/** Values for {@link ATTR_BLOCKCHAIN_OPERATION_NAME}. */
|
|
@@ -366,7 +497,7 @@ export declare const BLOCKCHAIN_TX_STATUS_VALUE_REVERTED: "reverted";
|
|
|
366
497
|
/**
|
|
367
498
|
* @deprecated No longer recorded: a confirm span that gave up waiting records `error.type` `timeout` and no
|
|
368
499
|
* `blockchain.tx.status`. The constant is removed in 1.0. See
|
|
369
|
-
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
500
|
+
* https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0016-timeout-is-an-observer-outcome.md.
|
|
370
501
|
*/
|
|
371
502
|
export declare const BLOCKCHAIN_TX_STATUS_VALUE_TIMEOUT: "timeout";
|
|
372
503
|
export declare const BLOCKCHAIN_TX_STATUS_VALUE_REPLACED: "replaced";
|
|
@@ -379,11 +510,28 @@ export declare const ATTR_ERROR_TYPE: "error.type";
|
|
|
379
510
|
/** Fallback {@link ATTR_ERROR_TYPE} value when the error has no name. */
|
|
380
511
|
export declare const ERROR_TYPE_VALUE_OTHER: "_OTHER";
|
|
381
512
|
//#endregion
|
|
513
|
+
//#region src/metrics.d.ts
|
|
514
|
+
/**
|
|
515
|
+
* Duration of a send of a transaction or user operation: from the start of the sending call until the hash is known or
|
|
516
|
+
* the call failed.
|
|
517
|
+
*/
|
|
518
|
+
export declare const METRIC_BLOCKCHAIN_CLIENT_SEND_DURATION: "blockchain.client.send.duration";
|
|
519
|
+
/**
|
|
520
|
+
* Duration of a confirmation of a transaction or user operation: from the start of the wait until the receipt, a
|
|
521
|
+
* timeout or a failure.
|
|
522
|
+
*/
|
|
523
|
+
export declare const METRIC_BLOCKCHAIN_CLIENT_CONFIRMATION_DURATION: "blockchain.client.confirmation.duration";
|
|
524
|
+
/**
|
|
525
|
+
* Total fee of a mined transaction (execution fee plus L1 data fee), or the cost of a user operation, in the chain's
|
|
526
|
+
* smallest unit (wei).
|
|
527
|
+
*/
|
|
528
|
+
export declare const METRIC_BLOCKCHAIN_CLIENT_FEE: "blockchain.client.fee";
|
|
529
|
+
//#endregion
|
|
382
530
|
//#region src/tracker.d.ts
|
|
383
531
|
/**
|
|
384
|
-
* Records transactions and
|
|
532
|
+
* Records transactions, payments and user operations as spans. Obtain one from {@link createTxTracker}: it is not meant to be
|
|
385
533
|
* implemented, and members may be added to it and to its handles in minor releases
|
|
386
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
534
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0014-core-api-boundary.md).
|
|
387
535
|
*/
|
|
388
536
|
interface TxTracker {
|
|
389
537
|
/**
|
|
@@ -401,15 +549,28 @@ interface TxTracker {
|
|
|
401
549
|
/**
|
|
402
550
|
* Starts a `payment` span as a child of `parent` (default: the active context), for a payment that another party
|
|
403
551
|
* settles on chain
|
|
404
|
-
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
552
|
+
* (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/adr/0013-x402-payments.md). Call
|
|
405
553
|
* `end(settlement)` with the settlement, or `fail(error)`. A settlement with a hash links the transaction's confirm
|
|
406
554
|
* span to this span, as a send span would.
|
|
407
555
|
*/
|
|
408
556
|
startPayment(input: PaymentInput, parent?: Context): PaymentHandle;
|
|
557
|
+
/**
|
|
558
|
+
* 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.8.0/docs/adr/0021-user-operations.md). Call
|
|
560
|
+
* `end({ userOpHash })` once the bundler returned the operation's hash, or `fail(error)`.
|
|
561
|
+
*/
|
|
562
|
+
startUserOperationSend(input: UserOperationInput, parent?: Context): UserOperationSendHandle;
|
|
563
|
+
/**
|
|
564
|
+
* Joins the `confirm` span of a user operation, starting it for the first caller; linked to its `send` span when
|
|
565
|
+
* known. As for {@link TxTracker.startConfirm}, calls for the same chain id and user operation hash share one span,
|
|
566
|
+
* apart from those of transactions. Returns a no-op handle for an operation that recently got a receipt. Every
|
|
567
|
+
* returned handle must be ended.
|
|
568
|
+
*/
|
|
569
|
+
startUserOperationConfirm(input: UserOperationConfirmInput, parent?: Context): UserOperationConfirmHandle;
|
|
409
570
|
}
|
|
410
571
|
/**
|
|
411
572
|
* Creates a tracker that records transactions as `send` and `confirm` spans, and payments as `payment` spans, with
|
|
412
|
-
* `@opentelemetry/api` (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.
|
|
573
|
+
* `@opentelemetry/api` (https://github.com/selimaytac/hashspan/blob/@hashspan/core@0.8.0/docs/semconv.md). It makes
|
|
413
574
|
* no network calls; the caller passes hashes and receipts. Its methods and handles never throw: failures are logged
|
|
414
575
|
* via `diag`, and a method that fails returns a handle that records nothing.
|
|
415
576
|
*/
|
|
@@ -418,4 +579,4 @@ export declare function createTxTracker(options?: TxTrackerOptions): TxTracker;
|
|
|
418
579
|
//#region src/version.d.ts
|
|
419
580
|
export declare const VERSION: string;
|
|
420
581
|
//#endregion
|
|
421
|
-
export type { AddressMode, AddressOptions, AgentIdentity, ConfirmHandle, ConfirmInput, EndOptions, ErrorMessageMode, FailOptions, PaymentHandle, PaymentInput, PaymentResourceMode, PaymentSettlement, PaymentStatus, ReceiptLike, ReplacementReason, SendHandle, SendInput, SendResult, TxTracker, TxTrackerOptions, X402PaymentDetails };
|
|
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 };
|