@hashspan/core 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +100 -0
- package/dist/index.cjs +657 -0
- package/dist/index.d.cts +190 -0
- package/dist/index.d.mts +190 -0
- package/dist/index.mjs +621 -0
- package/package.json +63 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Attributes, Context, TimeInput, TracerProvider } from "@opentelemetry/api";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
/** How wallet addresses are recorded. See docs/adr/0004-privacy-defaults.md. */
|
|
4
|
+
type AddressMode = "raw" | "hashed" | "off";
|
|
5
|
+
/**
|
|
6
|
+
* How error messages are recorded on exception events and span status. See docs/adr/0006-error-privacy.md.
|
|
7
|
+
* - `off`: error type only
|
|
8
|
+
* - `sanitized`: first line, addresses per address mode, other long hex data removed
|
|
9
|
+
* - `raw`: full message and stack trace, as thrown
|
|
10
|
+
*/
|
|
11
|
+
type ErrorMessageMode = "off" | "sanitized" | "raw";
|
|
12
|
+
interface AddressOptions {
|
|
13
|
+
mode: AddressMode;
|
|
14
|
+
/**
|
|
15
|
+
* Custom hash for `hashed` mode; receives the lower-cased address.
|
|
16
|
+
* Defaults to `sha256:` + the first 32 hex characters of SHA-256 (Node.js only).
|
|
17
|
+
*/
|
|
18
|
+
hash?: ((address: string) => string) | undefined;
|
|
19
|
+
}
|
|
20
|
+
/** Static agent identity, used when the active context carries none in its baggage. */
|
|
21
|
+
interface AgentIdentity {
|
|
22
|
+
id?: string | undefined;
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
interface TxTrackerOptions {
|
|
26
|
+
/** Defaults to the globally registered tracer provider. */
|
|
27
|
+
tracerProvider?: TracerProvider | undefined;
|
|
28
|
+
/** Address recording mode. Default: `raw`. */
|
|
29
|
+
address?: AddressMode | AddressOptions | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Error message recording mode. Default: `off` (error type only). The redaction hook also runs on exception
|
|
32
|
+
* attributes.
|
|
33
|
+
*/
|
|
34
|
+
errorMessages?: ErrorMessageMode | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Record decoded contract call arguments ({@link SendInput.functionArguments}) as
|
|
37
|
+
* `blockchain.contract.function.arguments`. Default: false. Arguments can carry amounts, counterparties and free
|
|
38
|
+
* text; addresses in them follow the address mode and the redaction hook runs on them.
|
|
39
|
+
*/
|
|
40
|
+
recordFunctionArguments?: boolean | undefined;
|
|
41
|
+
/** Fallback agent identity. Baggage entries `gen_ai.agent.id` / `gen_ai.agent.name` take precedence. */
|
|
42
|
+
agent?: AgentIdentity | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Runs last on every attribute set and returns the attributes to record.
|
|
45
|
+
* If it throws, only non-sensitive identifiers (system, chain id, operation, hash) are recorded.
|
|
46
|
+
*/
|
|
47
|
+
redact?: ((attributes: Attributes) => Attributes) | undefined;
|
|
48
|
+
/** How long a sent transaction can be linked from its confirmation. Default: 10 minutes. */
|
|
49
|
+
linkTtlMs?: number | undefined;
|
|
50
|
+
/** Maximum number of sent transactions kept for linking. Default: 10 000. */
|
|
51
|
+
maxTrackedTransactions?: number | undefined;
|
|
52
|
+
}
|
|
53
|
+
interface SendInput {
|
|
54
|
+
/** EIP-155 chain id. */
|
|
55
|
+
chainId: number;
|
|
56
|
+
from?: string | undefined;
|
|
57
|
+
to?: string | undefined;
|
|
58
|
+
/** Value in wei. */
|
|
59
|
+
value?: bigint | undefined;
|
|
60
|
+
nonce?: number | undefined;
|
|
61
|
+
functionName?: string | undefined;
|
|
62
|
+
/** 4-byte function selector, e.g. `0xa9059cbb`. */
|
|
63
|
+
functionSelector?: string | undefined;
|
|
64
|
+
/** Decoded call arguments; recorded only with the `recordFunctionArguments` tracker option. */
|
|
65
|
+
functionArguments?: readonly unknown[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* When the send started, for adapters that record it after the fact (docs/adr/0009). Omit it otherwise: with an
|
|
68
|
+
* explicit start time, the SDK measures the span by the wall clock, so pass the end time to the handle too.
|
|
69
|
+
*/
|
|
70
|
+
startTime?: TimeInput | undefined;
|
|
71
|
+
}
|
|
72
|
+
interface SendHandle {
|
|
73
|
+
/** Ends the send span successfully once the transaction hash is known; `endTime` defaults to now. */
|
|
74
|
+
end(hash: string, endTime?: TimeInput): void;
|
|
75
|
+
/** Ends the send span with an error (signing, simulation or broadcast failure); `endTime` defaults to now. */
|
|
76
|
+
fail(error: unknown, endTime?: TimeInput): void;
|
|
77
|
+
}
|
|
78
|
+
interface ConfirmInput {
|
|
79
|
+
chainId: number;
|
|
80
|
+
hash: string;
|
|
81
|
+
/** When the wait started, for adapters that record it after the fact; see {@link SendInput.startTime}. */
|
|
82
|
+
startTime?: TimeInput | undefined;
|
|
83
|
+
}
|
|
84
|
+
/** Why a transaction was replaced by another one with the same sender and nonce, as its library reported it. */
|
|
85
|
+
type ReplacementReason = "repriced" | "cancelled" | "replaced";
|
|
86
|
+
/** Library-agnostic view of a transaction receipt. Adapters normalise their client's receipt into this. */
|
|
87
|
+
interface ReceiptLike {
|
|
88
|
+
status: "success" | "reverted";
|
|
89
|
+
blockNumber: bigint | number;
|
|
90
|
+
gasUsed: bigint | number;
|
|
91
|
+
/** Wei per gas actually paid. */
|
|
92
|
+
effectiveGasPrice?: bigint | undefined;
|
|
93
|
+
/** L1 data fee in wei on OP-stack chains. */
|
|
94
|
+
l1Fee?: bigint | null | undefined;
|
|
95
|
+
revertReason?: string | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Hash of the mined transaction. When it differs from the awaited hash, the awaited transaction was replaced:
|
|
98
|
+
* its confirm span ends as `replaced` and the receipt is recorded for this hash (docs/adr/0008).
|
|
99
|
+
*/
|
|
100
|
+
transactionHash?: string | undefined;
|
|
101
|
+
/** Replacement reason reported by the library, when {@link transactionHash} differs from the awaited hash. */
|
|
102
|
+
replacementReason?: ReplacementReason | undefined;
|
|
103
|
+
}
|
|
104
|
+
interface ConfirmHandle {
|
|
105
|
+
/** Ends the shared confirm span with the receipt, for every handle of the transaction. */
|
|
106
|
+
end(receipt: ReceiptLike, endTime?: TimeInput): void;
|
|
107
|
+
/**
|
|
108
|
+
* Withdraws this handle because waiting for the receipt timed out. The confirm span ends as `timeout` only if
|
|
109
|
+
* no other handle of the transaction is still waiting.
|
|
110
|
+
*/
|
|
111
|
+
timeout(endTime?: TimeInput): void;
|
|
112
|
+
/**
|
|
113
|
+
* Withdraws this handle because retrieving the receipt failed. The confirm span ends as a failure only if no
|
|
114
|
+
* other handle of the transaction is still waiting.
|
|
115
|
+
*/
|
|
116
|
+
fail(error: unknown, endTime?: TimeInput): void;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/agent.d.ts
|
|
120
|
+
export declare const ATTR_GEN_AI_AGENT_ID: "gen_ai.agent.id";
|
|
121
|
+
export declare const ATTR_GEN_AI_AGENT_NAME: "gen_ai.agent.name";
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/attributes.d.ts
|
|
124
|
+
/**
|
|
125
|
+
* Attribute keys emitted by hashspan.
|
|
126
|
+
*
|
|
127
|
+
* Stability: development. See docs/semconv.md for definitions and value types.
|
|
128
|
+
* These names are a public contract: changes follow the deprecation policy in AGENTS.md.
|
|
129
|
+
*/
|
|
130
|
+
export declare const ATTR_BLOCKCHAIN_SYSTEM: "blockchain.system";
|
|
131
|
+
export declare const ATTR_BLOCKCHAIN_CHAIN_ID: "blockchain.chain.id";
|
|
132
|
+
export declare const ATTR_BLOCKCHAIN_OPERATION_NAME: "blockchain.operation.name";
|
|
133
|
+
export declare const ATTR_BLOCKCHAIN_TX_HASH: "blockchain.tx.hash";
|
|
134
|
+
export declare const ATTR_BLOCKCHAIN_TX_FROM: "blockchain.tx.from";
|
|
135
|
+
export declare const ATTR_BLOCKCHAIN_TX_TO: "blockchain.tx.to";
|
|
136
|
+
export declare const ATTR_BLOCKCHAIN_TX_VALUE: "blockchain.tx.value";
|
|
137
|
+
export declare const ATTR_BLOCKCHAIN_TX_NONCE: "blockchain.tx.nonce";
|
|
138
|
+
export declare const ATTR_BLOCKCHAIN_TX_STATUS: "blockchain.tx.status";
|
|
139
|
+
export declare const ATTR_BLOCKCHAIN_TX_GAS_USED: "blockchain.tx.gas.used";
|
|
140
|
+
export declare const ATTR_BLOCKCHAIN_TX_EFFECTIVE_GAS_PRICE: "blockchain.tx.effective_gas_price";
|
|
141
|
+
export declare const ATTR_BLOCKCHAIN_TX_L1_FEE: "blockchain.tx.l1_fee";
|
|
142
|
+
export declare const ATTR_BLOCKCHAIN_TX_FEE: "blockchain.tx.fee";
|
|
143
|
+
export declare const ATTR_BLOCKCHAIN_TX_REVERT_REASON: "blockchain.tx.revert.reason";
|
|
144
|
+
export declare const ATTR_BLOCKCHAIN_TX_REPLACEMENT_HASH: "blockchain.tx.replacement.hash";
|
|
145
|
+
export declare const ATTR_BLOCKCHAIN_TX_REPLACEMENT_REASON: "blockchain.tx.replacement.reason";
|
|
146
|
+
export declare const ATTR_BLOCKCHAIN_BLOCK_NUMBER: "blockchain.block.number";
|
|
147
|
+
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_NAME: "blockchain.contract.function.name";
|
|
148
|
+
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_SELECTOR: "blockchain.contract.function.selector";
|
|
149
|
+
/** Opt-in: decoded call arguments as a JSON array. See docs/adr/0004-privacy-defaults.md. */
|
|
150
|
+
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_ARGUMENTS: "blockchain.contract.function.arguments";
|
|
151
|
+
/** Values for {@link ATTR_BLOCKCHAIN_SYSTEM}. */
|
|
152
|
+
export declare const BLOCKCHAIN_SYSTEM_VALUE_EVM: "evm";
|
|
153
|
+
/** Values for {@link ATTR_BLOCKCHAIN_OPERATION_NAME}. */
|
|
154
|
+
export declare const BLOCKCHAIN_OPERATION_NAME_VALUE_SEND: "send";
|
|
155
|
+
export declare const BLOCKCHAIN_OPERATION_NAME_VALUE_CONFIRM: "confirm";
|
|
156
|
+
/** Values for {@link ATTR_BLOCKCHAIN_TX_STATUS}. */
|
|
157
|
+
export declare const BLOCKCHAIN_TX_STATUS_VALUE_SUCCESS: "success";
|
|
158
|
+
export declare const BLOCKCHAIN_TX_STATUS_VALUE_REVERTED: "reverted";
|
|
159
|
+
export declare const BLOCKCHAIN_TX_STATUS_VALUE_TIMEOUT: "timeout";
|
|
160
|
+
export declare const BLOCKCHAIN_TX_STATUS_VALUE_REPLACED: "replaced";
|
|
161
|
+
/** Values for {@link ATTR_BLOCKCHAIN_TX_REPLACEMENT_REASON}, as reported by the instrumented library. */
|
|
162
|
+
export declare const BLOCKCHAIN_TX_REPLACEMENT_REASON_VALUE_REPRICED: "repriced";
|
|
163
|
+
export declare const BLOCKCHAIN_TX_REPLACEMENT_REASON_VALUE_CANCELLED: "cancelled";
|
|
164
|
+
export declare const BLOCKCHAIN_TX_REPLACEMENT_REASON_VALUE_REPLACED: "replaced";
|
|
165
|
+
/** Reused from OpenTelemetry general conventions. */
|
|
166
|
+
export declare const ATTR_ERROR_TYPE: "error.type";
|
|
167
|
+
/** Fallback {@link ATTR_ERROR_TYPE} value when the error has no name. */
|
|
168
|
+
export declare const ERROR_TYPE_VALUE_OTHER: "_OTHER";
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/tracker.d.ts
|
|
171
|
+
interface TxTracker {
|
|
172
|
+
/**
|
|
173
|
+
* Starts a `send` span as a child of `parent` (default: the active context).
|
|
174
|
+
* Call `end(hash)` once the transaction hash is known, or `fail(error)`.
|
|
175
|
+
*/
|
|
176
|
+
startSend(input: SendInput, parent?: Context): SendHandle;
|
|
177
|
+
/**
|
|
178
|
+
* Joins the `confirm` span of a transaction, starting it for the first caller; linked to its `send` span when
|
|
179
|
+
* known. Calls for the same chain id and hash share one span, whose parent is chosen by the first call:
|
|
180
|
+
* `parent` if given, else the active span, else the `send` span's parent. Returns a no-op handle for a
|
|
181
|
+
* transaction that recently got a receipt. Every returned handle must be ended.
|
|
182
|
+
*/
|
|
183
|
+
startConfirm(input: ConfirmInput, parent?: Context): ConfirmHandle;
|
|
184
|
+
}
|
|
185
|
+
export declare function createTxTracker(options?: TxTrackerOptions): TxTracker;
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/version.d.ts
|
|
188
|
+
export declare const VERSION: string;
|
|
189
|
+
//#endregion
|
|
190
|
+
export type { AddressMode, AddressOptions, AgentIdentity, ConfirmHandle, ConfirmInput, ErrorMessageMode, ReceiptLike, ReplacementReason, SendHandle, SendInput, TxTracker, TxTrackerOptions };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Attributes, Context, TimeInput, TracerProvider } from "@opentelemetry/api";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
/** How wallet addresses are recorded. See docs/adr/0004-privacy-defaults.md. */
|
|
4
|
+
type AddressMode = "raw" | "hashed" | "off";
|
|
5
|
+
/**
|
|
6
|
+
* How error messages are recorded on exception events and span status. See docs/adr/0006-error-privacy.md.
|
|
7
|
+
* - `off`: error type only
|
|
8
|
+
* - `sanitized`: first line, addresses per address mode, other long hex data removed
|
|
9
|
+
* - `raw`: full message and stack trace, as thrown
|
|
10
|
+
*/
|
|
11
|
+
type ErrorMessageMode = "off" | "sanitized" | "raw";
|
|
12
|
+
interface AddressOptions {
|
|
13
|
+
mode: AddressMode;
|
|
14
|
+
/**
|
|
15
|
+
* Custom hash for `hashed` mode; receives the lower-cased address.
|
|
16
|
+
* Defaults to `sha256:` + the first 32 hex characters of SHA-256 (Node.js only).
|
|
17
|
+
*/
|
|
18
|
+
hash?: ((address: string) => string) | undefined;
|
|
19
|
+
}
|
|
20
|
+
/** Static agent identity, used when the active context carries none in its baggage. */
|
|
21
|
+
interface AgentIdentity {
|
|
22
|
+
id?: string | undefined;
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
interface TxTrackerOptions {
|
|
26
|
+
/** Defaults to the globally registered tracer provider. */
|
|
27
|
+
tracerProvider?: TracerProvider | undefined;
|
|
28
|
+
/** Address recording mode. Default: `raw`. */
|
|
29
|
+
address?: AddressMode | AddressOptions | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Error message recording mode. Default: `off` (error type only). The redaction hook also runs on exception
|
|
32
|
+
* attributes.
|
|
33
|
+
*/
|
|
34
|
+
errorMessages?: ErrorMessageMode | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Record decoded contract call arguments ({@link SendInput.functionArguments}) as
|
|
37
|
+
* `blockchain.contract.function.arguments`. Default: false. Arguments can carry amounts, counterparties and free
|
|
38
|
+
* text; addresses in them follow the address mode and the redaction hook runs on them.
|
|
39
|
+
*/
|
|
40
|
+
recordFunctionArguments?: boolean | undefined;
|
|
41
|
+
/** Fallback agent identity. Baggage entries `gen_ai.agent.id` / `gen_ai.agent.name` take precedence. */
|
|
42
|
+
agent?: AgentIdentity | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Runs last on every attribute set and returns the attributes to record.
|
|
45
|
+
* If it throws, only non-sensitive identifiers (system, chain id, operation, hash) are recorded.
|
|
46
|
+
*/
|
|
47
|
+
redact?: ((attributes: Attributes) => Attributes) | undefined;
|
|
48
|
+
/** How long a sent transaction can be linked from its confirmation. Default: 10 minutes. */
|
|
49
|
+
linkTtlMs?: number | undefined;
|
|
50
|
+
/** Maximum number of sent transactions kept for linking. Default: 10 000. */
|
|
51
|
+
maxTrackedTransactions?: number | undefined;
|
|
52
|
+
}
|
|
53
|
+
interface SendInput {
|
|
54
|
+
/** EIP-155 chain id. */
|
|
55
|
+
chainId: number;
|
|
56
|
+
from?: string | undefined;
|
|
57
|
+
to?: string | undefined;
|
|
58
|
+
/** Value in wei. */
|
|
59
|
+
value?: bigint | undefined;
|
|
60
|
+
nonce?: number | undefined;
|
|
61
|
+
functionName?: string | undefined;
|
|
62
|
+
/** 4-byte function selector, e.g. `0xa9059cbb`. */
|
|
63
|
+
functionSelector?: string | undefined;
|
|
64
|
+
/** Decoded call arguments; recorded only with the `recordFunctionArguments` tracker option. */
|
|
65
|
+
functionArguments?: readonly unknown[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* When the send started, for adapters that record it after the fact (docs/adr/0009). Omit it otherwise: with an
|
|
68
|
+
* explicit start time, the SDK measures the span by the wall clock, so pass the end time to the handle too.
|
|
69
|
+
*/
|
|
70
|
+
startTime?: TimeInput | undefined;
|
|
71
|
+
}
|
|
72
|
+
interface SendHandle {
|
|
73
|
+
/** Ends the send span successfully once the transaction hash is known; `endTime` defaults to now. */
|
|
74
|
+
end(hash: string, endTime?: TimeInput): void;
|
|
75
|
+
/** Ends the send span with an error (signing, simulation or broadcast failure); `endTime` defaults to now. */
|
|
76
|
+
fail(error: unknown, endTime?: TimeInput): void;
|
|
77
|
+
}
|
|
78
|
+
interface ConfirmInput {
|
|
79
|
+
chainId: number;
|
|
80
|
+
hash: string;
|
|
81
|
+
/** When the wait started, for adapters that record it after the fact; see {@link SendInput.startTime}. */
|
|
82
|
+
startTime?: TimeInput | undefined;
|
|
83
|
+
}
|
|
84
|
+
/** Why a transaction was replaced by another one with the same sender and nonce, as its library reported it. */
|
|
85
|
+
type ReplacementReason = "repriced" | "cancelled" | "replaced";
|
|
86
|
+
/** Library-agnostic view of a transaction receipt. Adapters normalise their client's receipt into this. */
|
|
87
|
+
interface ReceiptLike {
|
|
88
|
+
status: "success" | "reverted";
|
|
89
|
+
blockNumber: bigint | number;
|
|
90
|
+
gasUsed: bigint | number;
|
|
91
|
+
/** Wei per gas actually paid. */
|
|
92
|
+
effectiveGasPrice?: bigint | undefined;
|
|
93
|
+
/** L1 data fee in wei on OP-stack chains. */
|
|
94
|
+
l1Fee?: bigint | null | undefined;
|
|
95
|
+
revertReason?: string | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Hash of the mined transaction. When it differs from the awaited hash, the awaited transaction was replaced:
|
|
98
|
+
* its confirm span ends as `replaced` and the receipt is recorded for this hash (docs/adr/0008).
|
|
99
|
+
*/
|
|
100
|
+
transactionHash?: string | undefined;
|
|
101
|
+
/** Replacement reason reported by the library, when {@link transactionHash} differs from the awaited hash. */
|
|
102
|
+
replacementReason?: ReplacementReason | undefined;
|
|
103
|
+
}
|
|
104
|
+
interface ConfirmHandle {
|
|
105
|
+
/** Ends the shared confirm span with the receipt, for every handle of the transaction. */
|
|
106
|
+
end(receipt: ReceiptLike, endTime?: TimeInput): void;
|
|
107
|
+
/**
|
|
108
|
+
* Withdraws this handle because waiting for the receipt timed out. The confirm span ends as `timeout` only if
|
|
109
|
+
* no other handle of the transaction is still waiting.
|
|
110
|
+
*/
|
|
111
|
+
timeout(endTime?: TimeInput): void;
|
|
112
|
+
/**
|
|
113
|
+
* Withdraws this handle because retrieving the receipt failed. The confirm span ends as a failure only if no
|
|
114
|
+
* other handle of the transaction is still waiting.
|
|
115
|
+
*/
|
|
116
|
+
fail(error: unknown, endTime?: TimeInput): void;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/agent.d.ts
|
|
120
|
+
export declare const ATTR_GEN_AI_AGENT_ID: "gen_ai.agent.id";
|
|
121
|
+
export declare const ATTR_GEN_AI_AGENT_NAME: "gen_ai.agent.name";
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/attributes.d.ts
|
|
124
|
+
/**
|
|
125
|
+
* Attribute keys emitted by hashspan.
|
|
126
|
+
*
|
|
127
|
+
* Stability: development. See docs/semconv.md for definitions and value types.
|
|
128
|
+
* These names are a public contract: changes follow the deprecation policy in AGENTS.md.
|
|
129
|
+
*/
|
|
130
|
+
export declare const ATTR_BLOCKCHAIN_SYSTEM: "blockchain.system";
|
|
131
|
+
export declare const ATTR_BLOCKCHAIN_CHAIN_ID: "blockchain.chain.id";
|
|
132
|
+
export declare const ATTR_BLOCKCHAIN_OPERATION_NAME: "blockchain.operation.name";
|
|
133
|
+
export declare const ATTR_BLOCKCHAIN_TX_HASH: "blockchain.tx.hash";
|
|
134
|
+
export declare const ATTR_BLOCKCHAIN_TX_FROM: "blockchain.tx.from";
|
|
135
|
+
export declare const ATTR_BLOCKCHAIN_TX_TO: "blockchain.tx.to";
|
|
136
|
+
export declare const ATTR_BLOCKCHAIN_TX_VALUE: "blockchain.tx.value";
|
|
137
|
+
export declare const ATTR_BLOCKCHAIN_TX_NONCE: "blockchain.tx.nonce";
|
|
138
|
+
export declare const ATTR_BLOCKCHAIN_TX_STATUS: "blockchain.tx.status";
|
|
139
|
+
export declare const ATTR_BLOCKCHAIN_TX_GAS_USED: "blockchain.tx.gas.used";
|
|
140
|
+
export declare const ATTR_BLOCKCHAIN_TX_EFFECTIVE_GAS_PRICE: "blockchain.tx.effective_gas_price";
|
|
141
|
+
export declare const ATTR_BLOCKCHAIN_TX_L1_FEE: "blockchain.tx.l1_fee";
|
|
142
|
+
export declare const ATTR_BLOCKCHAIN_TX_FEE: "blockchain.tx.fee";
|
|
143
|
+
export declare const ATTR_BLOCKCHAIN_TX_REVERT_REASON: "blockchain.tx.revert.reason";
|
|
144
|
+
export declare const ATTR_BLOCKCHAIN_TX_REPLACEMENT_HASH: "blockchain.tx.replacement.hash";
|
|
145
|
+
export declare const ATTR_BLOCKCHAIN_TX_REPLACEMENT_REASON: "blockchain.tx.replacement.reason";
|
|
146
|
+
export declare const ATTR_BLOCKCHAIN_BLOCK_NUMBER: "blockchain.block.number";
|
|
147
|
+
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_NAME: "blockchain.contract.function.name";
|
|
148
|
+
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_SELECTOR: "blockchain.contract.function.selector";
|
|
149
|
+
/** Opt-in: decoded call arguments as a JSON array. See docs/adr/0004-privacy-defaults.md. */
|
|
150
|
+
export declare const ATTR_BLOCKCHAIN_CONTRACT_FUNCTION_ARGUMENTS: "blockchain.contract.function.arguments";
|
|
151
|
+
/** Values for {@link ATTR_BLOCKCHAIN_SYSTEM}. */
|
|
152
|
+
export declare const BLOCKCHAIN_SYSTEM_VALUE_EVM: "evm";
|
|
153
|
+
/** Values for {@link ATTR_BLOCKCHAIN_OPERATION_NAME}. */
|
|
154
|
+
export declare const BLOCKCHAIN_OPERATION_NAME_VALUE_SEND: "send";
|
|
155
|
+
export declare const BLOCKCHAIN_OPERATION_NAME_VALUE_CONFIRM: "confirm";
|
|
156
|
+
/** Values for {@link ATTR_BLOCKCHAIN_TX_STATUS}. */
|
|
157
|
+
export declare const BLOCKCHAIN_TX_STATUS_VALUE_SUCCESS: "success";
|
|
158
|
+
export declare const BLOCKCHAIN_TX_STATUS_VALUE_REVERTED: "reverted";
|
|
159
|
+
export declare const BLOCKCHAIN_TX_STATUS_VALUE_TIMEOUT: "timeout";
|
|
160
|
+
export declare const BLOCKCHAIN_TX_STATUS_VALUE_REPLACED: "replaced";
|
|
161
|
+
/** Values for {@link ATTR_BLOCKCHAIN_TX_REPLACEMENT_REASON}, as reported by the instrumented library. */
|
|
162
|
+
export declare const BLOCKCHAIN_TX_REPLACEMENT_REASON_VALUE_REPRICED: "repriced";
|
|
163
|
+
export declare const BLOCKCHAIN_TX_REPLACEMENT_REASON_VALUE_CANCELLED: "cancelled";
|
|
164
|
+
export declare const BLOCKCHAIN_TX_REPLACEMENT_REASON_VALUE_REPLACED: "replaced";
|
|
165
|
+
/** Reused from OpenTelemetry general conventions. */
|
|
166
|
+
export declare const ATTR_ERROR_TYPE: "error.type";
|
|
167
|
+
/** Fallback {@link ATTR_ERROR_TYPE} value when the error has no name. */
|
|
168
|
+
export declare const ERROR_TYPE_VALUE_OTHER: "_OTHER";
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/tracker.d.ts
|
|
171
|
+
interface TxTracker {
|
|
172
|
+
/**
|
|
173
|
+
* Starts a `send` span as a child of `parent` (default: the active context).
|
|
174
|
+
* Call `end(hash)` once the transaction hash is known, or `fail(error)`.
|
|
175
|
+
*/
|
|
176
|
+
startSend(input: SendInput, parent?: Context): SendHandle;
|
|
177
|
+
/**
|
|
178
|
+
* Joins the `confirm` span of a transaction, starting it for the first caller; linked to its `send` span when
|
|
179
|
+
* known. Calls for the same chain id and hash share one span, whose parent is chosen by the first call:
|
|
180
|
+
* `parent` if given, else the active span, else the `send` span's parent. Returns a no-op handle for a
|
|
181
|
+
* transaction that recently got a receipt. Every returned handle must be ended.
|
|
182
|
+
*/
|
|
183
|
+
startConfirm(input: ConfirmInput, parent?: Context): ConfirmHandle;
|
|
184
|
+
}
|
|
185
|
+
export declare function createTxTracker(options?: TxTrackerOptions): TxTracker;
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/version.d.ts
|
|
188
|
+
export declare const VERSION: string;
|
|
189
|
+
//#endregion
|
|
190
|
+
export type { AddressMode, AddressOptions, AgentIdentity, ConfirmHandle, ConfirmInput, ErrorMessageMode, ReceiptLike, ReplacementReason, SendHandle, SendInput, TxTracker, TxTrackerOptions };
|