@hashspan/core 0.7.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 +23 -12
- package/dist/index.cjs +297 -50
- package/dist/index.d.cts +175 -27
- package/dist/index.d.mts +175 -27
- package/dist/index.mjs +287 -51
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2,12 +2,12 @@ import { Attributes, Context, MeterProvider, TimeInput, TracerProvider } from "@
|
|
|
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
|
|
@@ -66,7 +66,7 @@ interface TxTrackerOptions {
|
|
|
66
66
|
/**
|
|
67
67
|
* Agent identity. A field set here always wins; fields left unset are taken from the Baggage entries
|
|
68
68
|
* `gen_ai.agent.id` / `gen_ai.agent.name` unless `agentFromBaggage` is false
|
|
69
|
-
* (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).
|
|
70
70
|
*/
|
|
71
71
|
agent?: AgentIdentity | undefined;
|
|
72
72
|
/**
|
|
@@ -80,13 +80,17 @@ interface TxTrackerOptions {
|
|
|
80
80
|
* If it throws or returns something other than an attributes object, the tracker fails closed and records only
|
|
81
81
|
* `blockchain.system`, `blockchain.chain.id`, `blockchain.operation.name`, `blockchain.tx.hash`,
|
|
82
82
|
* `blockchain.tx.status`, `blockchain.tx.replacement.hash`, `blockchain.tx.replacement.reason`,
|
|
83
|
-
* `blockchain.payment.protocol`, `blockchain.payment.status`, `blockchain.payment.verified`,
|
|
84
|
-
* `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`.
|
|
85
86
|
*/
|
|
86
87
|
redact?: ((attributes: Attributes) => Attributes) | undefined;
|
|
87
|
-
/** 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. */
|
|
88
89
|
linkTtlMs?: number | undefined;
|
|
89
|
-
/**
|
|
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
|
+
*/
|
|
90
94
|
maxTrackedTransactions?: number | undefined;
|
|
91
95
|
}
|
|
92
96
|
interface SendInput {
|
|
@@ -108,7 +112,7 @@ interface SendInput {
|
|
|
108
112
|
functionArguments?: readonly unknown[] | undefined;
|
|
109
113
|
/**
|
|
110
114
|
* When the send started, for adapters that record it after the fact
|
|
111
|
-
* (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).
|
|
112
116
|
* Omit it otherwise: with an explicit start time, the SDK measures the span by the wall clock, so pass the end time
|
|
113
117
|
* to the handle too.
|
|
114
118
|
*/
|
|
@@ -117,14 +121,14 @@ interface SendInput {
|
|
|
117
121
|
/**
|
|
118
122
|
* Ends a send span. Only the first call counts; methods never throw.
|
|
119
123
|
* Produced by the tracker only; methods may be added in minor releases
|
|
120
|
-
* (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).
|
|
121
125
|
*/
|
|
122
126
|
interface SendHandle {
|
|
123
127
|
/**
|
|
124
128
|
* The parent context with the send span set. Run the call that sends the transaction in it, e.g.
|
|
125
129
|
* `await context.with(send.context, () => sendSomehow())`, so that spans of wallet, RPC or HTTP instrumentation
|
|
126
130
|
* nest under the send span
|
|
127
|
-
* (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).
|
|
128
132
|
* Run only that call in it: a confirm span started in it becomes a child of the send span.
|
|
129
133
|
*/
|
|
130
134
|
readonly context: Context;
|
|
@@ -187,7 +191,7 @@ interface ReceiptLike {
|
|
|
187
191
|
/**
|
|
188
192
|
* Hash of the mined transaction. When it differs from the awaited hash, the awaited transaction was replaced: its
|
|
189
193
|
* confirm span ends as `replaced` and the receipt is recorded for this hash
|
|
190
|
-
* (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).
|
|
191
195
|
*/
|
|
192
196
|
transactionHash?: string | undefined;
|
|
193
197
|
/** Replacement reason reported by the library, when {@link transactionHash} differs from the awaited hash. */
|
|
@@ -197,7 +201,7 @@ interface ReceiptLike {
|
|
|
197
201
|
* One wait for a transaction's receipt, joined to the transaction's shared confirm span. Only the first call counts;
|
|
198
202
|
* methods never throw.
|
|
199
203
|
* Produced by the tracker only; methods may be added in minor releases
|
|
200
|
-
* (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).
|
|
201
205
|
*/
|
|
202
206
|
interface ConfirmHandle {
|
|
203
207
|
/** Ends the shared confirm span with the receipt, for every handle of the transaction. */
|
|
@@ -221,7 +225,7 @@ interface ConfirmHandle {
|
|
|
221
225
|
}
|
|
222
226
|
/**
|
|
223
227
|
* A payment the agent authorizes and another party settles on chain, e.g. an x402 facilitator
|
|
224
|
-
* (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).
|
|
225
229
|
* Values often come from a remote server: addresses, amounts and identifiers that are malformed are not recorded.
|
|
226
230
|
*/
|
|
227
231
|
interface PaymentInput {
|
|
@@ -273,7 +277,7 @@ interface PaymentSettlement {
|
|
|
273
277
|
/**
|
|
274
278
|
* Ends a payment span. Only the first call counts; methods never throw.
|
|
275
279
|
* Produced by the tracker only; methods may be added in minor releases
|
|
276
|
-
* (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).
|
|
277
281
|
*/
|
|
278
282
|
interface PaymentHandle {
|
|
279
283
|
/** Ends the payment span with its settlement. */
|
|
@@ -296,6 +300,107 @@ interface PaymentHandle {
|
|
|
296
300
|
*/
|
|
297
301
|
link(hash: string): void;
|
|
298
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
|
+
}
|
|
299
404
|
//#endregion
|
|
300
405
|
//#region src/agent.d.ts
|
|
301
406
|
export declare const ATTR_GEN_AI_AGENT_ID: "gen_ai.agent.id";
|
|
@@ -305,7 +410,7 @@ export declare const ATTR_GEN_AI_AGENT_NAME: "gen_ai.agent.name";
|
|
|
305
410
|
/**
|
|
306
411
|
* Attribute keys emitted by hashspan.
|
|
307
412
|
*
|
|
308
|
-
* 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
|
|
309
414
|
* definitions and value types. These names are a public contract: changes follow the deprecation policy in AGENTS.md.
|
|
310
415
|
*/
|
|
311
416
|
export declare const ATTR_BLOCKCHAIN_SYSTEM: "blockchain.system";
|
|
@@ -329,12 +434,12 @@ export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_NAME: "blockchain.contrac
|
|
|
329
434
|
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_SELECTOR: "blockchain.contract.function.selector";
|
|
330
435
|
/**
|
|
331
436
|
* Opt-in: decoded call arguments as a JSON array. See
|
|
332
|
-
* 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.
|
|
333
438
|
*/
|
|
334
439
|
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_ARGUMENTS: "blockchain.contract.function.arguments";
|
|
335
440
|
/**
|
|
336
441
|
* Payments settled on chain by a party other than the agent, e.g. an x402 facilitator. See
|
|
337
|
-
* 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.
|
|
338
443
|
*/
|
|
339
444
|
export declare const ATTR_BLOCKCHAIN_PAYMENT_PROTOCOL: "blockchain.payment.protocol";
|
|
340
445
|
export declare const ATTR_BLOCKCHAIN_PAYMENT_PAYER: "blockchain.payment.payer";
|
|
@@ -347,12 +452,33 @@ export declare const ATTR_BLOCKCHAIN_PAYMENT_SETTLED_AMOUNT: "blockchain.payment
|
|
|
347
452
|
/**
|
|
348
453
|
* Whether the settlement transaction's receipt carries the payment, as checked by the adapter; absent when no check
|
|
349
454
|
* was possible. See
|
|
350
|
-
* 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.
|
|
351
456
|
*/
|
|
352
457
|
export declare const ATTR_BLOCKCHAIN_PAYMENT_VERIFIED: "blockchain.payment.verified";
|
|
353
458
|
/** x402's own payment fields. */
|
|
354
459
|
export declare const ATTR_X402_SCHEME: "x402.scheme";
|
|
355
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";
|
|
356
482
|
/** Values for {@link ATTR_BLOCKCHAIN_SYSTEM}. */
|
|
357
483
|
export declare const BLOCKCHAIN_SYSTEM_VALUE_EVM: "evm";
|
|
358
484
|
/** Values for {@link ATTR_BLOCKCHAIN_OPERATION_NAME}. */
|
|
@@ -371,7 +497,7 @@ export declare const BLOCKCHAIN_TX_STATUS_VALUE_REVERTED: "reverted";
|
|
|
371
497
|
/**
|
|
372
498
|
* @deprecated No longer recorded: a confirm span that gave up waiting records `error.type` `timeout` and no
|
|
373
499
|
* `blockchain.tx.status`. The constant is removed in 1.0. See
|
|
374
|
-
* 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.
|
|
375
501
|
*/
|
|
376
502
|
export declare const BLOCKCHAIN_TX_STATUS_VALUE_TIMEOUT: "timeout";
|
|
377
503
|
export declare const BLOCKCHAIN_TX_STATUS_VALUE_REPLACED: "replaced";
|
|
@@ -385,18 +511,27 @@ export declare const ATTR_ERROR_TYPE: "error.type";
|
|
|
385
511
|
export declare const ERROR_TYPE_VALUE_OTHER: "_OTHER";
|
|
386
512
|
//#endregion
|
|
387
513
|
//#region src/metrics.d.ts
|
|
388
|
-
/**
|
|
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
|
+
*/
|
|
389
518
|
export declare const METRIC_BLOCKCHAIN_CLIENT_SEND_DURATION: "blockchain.client.send.duration";
|
|
390
|
-
/**
|
|
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
|
+
*/
|
|
391
523
|
export declare const METRIC_BLOCKCHAIN_CLIENT_CONFIRMATION_DURATION: "blockchain.client.confirmation.duration";
|
|
392
|
-
/**
|
|
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
|
+
*/
|
|
393
528
|
export declare const METRIC_BLOCKCHAIN_CLIENT_FEE: "blockchain.client.fee";
|
|
394
529
|
//#endregion
|
|
395
530
|
//#region src/tracker.d.ts
|
|
396
531
|
/**
|
|
397
|
-
* Records transactions and
|
|
532
|
+
* Records transactions, payments and user operations as spans. Obtain one from {@link createTxTracker}: it is not meant to be
|
|
398
533
|
* implemented, and members may be added to it and to its handles in minor releases
|
|
399
|
-
* (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).
|
|
400
535
|
*/
|
|
401
536
|
interface TxTracker {
|
|
402
537
|
/**
|
|
@@ -414,15 +549,28 @@ interface TxTracker {
|
|
|
414
549
|
/**
|
|
415
550
|
* Starts a `payment` span as a child of `parent` (default: the active context), for a payment that another party
|
|
416
551
|
* settles on chain
|
|
417
|
-
* (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
|
|
418
553
|
* `end(settlement)` with the settlement, or `fail(error)`. A settlement with a hash links the transaction's confirm
|
|
419
554
|
* span to this span, as a send span would.
|
|
420
555
|
*/
|
|
421
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;
|
|
422
570
|
}
|
|
423
571
|
/**
|
|
424
572
|
* Creates a tracker that records transactions as `send` and `confirm` spans, and payments as `payment` spans, with
|
|
425
|
-
* `@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
|
|
426
574
|
* no network calls; the caller passes hashes and receipts. Its methods and handles never throw: failures are logged
|
|
427
575
|
* via `diag`, and a method that fails returns a handle that records nothing.
|
|
428
576
|
*/
|
|
@@ -431,4 +579,4 @@ export declare function createTxTracker(options?: TxTrackerOptions): TxTracker;
|
|
|
431
579
|
//#region src/version.d.ts
|
|
432
580
|
export declare const VERSION: string;
|
|
433
581
|
//#endregion
|
|
434
|
-
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 };
|