@valve-tech/tx-tracker 0.0.1
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 +21 -0
- package/README.md +56 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Valve Tech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @valve-tech/tx-tracker
|
|
2
|
+
|
|
3
|
+
> **Status: stub (v0.0.1).** This package is a name reservation. The
|
|
4
|
+
> implementation lands in v0.1.0. See
|
|
5
|
+
> [`docs/tx-tracker-spec.md`](https://github.com/valve-tech/evm-toolkit/blob/main/docs/tx-tracker-spec.md)
|
|
6
|
+
> for the full design contract.
|
|
7
|
+
|
|
8
|
+
Per-tx state machine for EVM chains. Emits **neutral observations** —
|
|
9
|
+
`seen-in-mempool`, `seen-in-block`, `replaced-by`, `vanished-from-block`,
|
|
10
|
+
`unseen-for-N-blocks`, `signal-degraded`, `signal-recovered`, `stopped` —
|
|
11
|
+
so wallet UIs, indexers, and relays can write their own interpretations
|
|
12
|
+
on top. The package itself never says "confirmed" or "stuck"; it gives
|
|
13
|
+
you the data to decide.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// v0.1.0+ shape (not yet implemented):
|
|
17
|
+
import { createChainSource } from '@valve-tech/chain-source'
|
|
18
|
+
import { createTxTracker } from '@valve-tech/tx-tracker'
|
|
19
|
+
|
|
20
|
+
const source = createChainSource({ client })
|
|
21
|
+
const tracker = createTxTracker({ source, chainId: 1 })
|
|
22
|
+
source.start(); tracker.start()
|
|
23
|
+
|
|
24
|
+
for await (const event of tracker.track('0xabc...')) {
|
|
25
|
+
if (event.kind === 'seen-in-block' && event.confirmations >= 6) break
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Why this exists
|
|
30
|
+
|
|
31
|
+
Tx-tracking on EVM is unforgiving:
|
|
32
|
+
- **Three different consumer shapes** (wallet UI, indexer, relay) want
|
|
33
|
+
the same underlying observations but very different consumption
|
|
34
|
+
ergonomics.
|
|
35
|
+
- **Five state transitions** (pending, mined, replaced, dropped,
|
|
36
|
+
reorged) plus their authoritative-vs-degraded sources.
|
|
37
|
+
- **Per-method capability variance** — some upstreams gate
|
|
38
|
+
`txpool_content`, some allow `eth_subscribe('newHeads')` but not
|
|
39
|
+
`newPendingTransactions`, some only offer HTTP.
|
|
40
|
+
- **No silent downgrade** — a tracker that says "your tx is mined"
|
|
41
|
+
when the WS dropped and the receipt poll happens to still see the
|
|
42
|
+
old block is lying. Every event in this package carries a `source`
|
|
43
|
+
discriminator so consumers know how authoritative it is.
|
|
44
|
+
|
|
45
|
+
This package handles all of it as one push-based core with three thin
|
|
46
|
+
adapters (callback / async iterator / snapshot).
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
yarn add @valve-tech/tx-tracker @valve-tech/chain-source viem
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @valve-tech/tx-tracker — placeholder for v0.0.1.
|
|
3
|
+
*
|
|
4
|
+
* The implementation lands in v0.1.0. This stub claims the npm name
|
|
5
|
+
* and documents the planned shape so consumers reading the package
|
|
6
|
+
* via `npm view` know what it is.
|
|
7
|
+
*
|
|
8
|
+
* Design contract: see `docs/tx-tracker-spec.md` in the
|
|
9
|
+
* `valve-tech/evm-toolkit` repo, which defines the `TxTracker`,
|
|
10
|
+
* `TxEvent`, `TxTrackerStore`, and bulk-subscription surfaces this
|
|
11
|
+
* package will export.
|
|
12
|
+
*
|
|
13
|
+
* Until v0.1.0 is published, no symbols are exported.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@valve-tech/tx-tracker",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Per-tx state machine for EVM chains: emits neutral observations (`seen-in-mempool`, `seen-in-block`, `replaced-by`, `vanished-from-block`, `unseen-for-N-blocks`, etc.) so wallet UIs, indexers, and relays can write their own interpretations on top. Three consumption shapes (callback, async iterator, snapshot) over one push-based core. Per-method capability detection — works on HTTP, WS, both, or neither. Implementation lands in v0.1.0 — this 0.0.1 stub claims the npm name.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/valve-tech/evm-toolkit/tree/main/packages/tx-tracker#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/valve-tech/evm-toolkit.git",
|
|
10
|
+
"directory": "packages/tx-tracker"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/valve-tech/evm-toolkit/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"ethereum",
|
|
17
|
+
"evm",
|
|
18
|
+
"viem",
|
|
19
|
+
"transaction",
|
|
20
|
+
"tx",
|
|
21
|
+
"tracker",
|
|
22
|
+
"mempool",
|
|
23
|
+
"reorg",
|
|
24
|
+
"indexer"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "dist/index.js",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"README.md",
|
|
38
|
+
"LICENSE"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc -p .",
|
|
42
|
+
"typecheck": "tsc -p . --noEmit",
|
|
43
|
+
"lint": "eslint src",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"prepare": "yarn build"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"viem": "^2.0.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@valve-tech/chain-source": "workspace:^"
|
|
52
|
+
}
|
|
53
|
+
}
|