@valve-tech/chain-source 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 +46 -0
- package/dist/index.d.ts +15 -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 +48 -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,46 @@
|
|
|
1
|
+
# @valve-tech/chain-source
|
|
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
|
+
> §3 for the design contract.
|
|
7
|
+
|
|
8
|
+
Canonical EVM chain-observation primitive. Provides a unified push-or-poll
|
|
9
|
+
source for new blocks, mempool snapshots, on-demand receipt and tx
|
|
10
|
+
lookups, and explicit capability disclosure (HTTP / WS / per-method
|
|
11
|
+
gating). Designed to be consumed by multiple downstream views of chain
|
|
12
|
+
state — `@valve-tech/gas-oracle` and `@valve-tech/tx-tracker` are the
|
|
13
|
+
first two.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// v0.1.0+ shape (not yet implemented):
|
|
17
|
+
import { createChainSource } from '@valve-tech/chain-source'
|
|
18
|
+
import { createPublicClient, http } from 'viem'
|
|
19
|
+
import { mainnet } from 'viem/chains'
|
|
20
|
+
|
|
21
|
+
const client = createPublicClient({ chain: mainnet, transport: http() })
|
|
22
|
+
const source = createChainSource({ client })
|
|
23
|
+
source.start()
|
|
24
|
+
|
|
25
|
+
source.subscribeBlocks((block) => { /* ... */ })
|
|
26
|
+
source.subscribeMempool((snapshot) => { /* ... */ })
|
|
27
|
+
const receipt = await source.getReceipt('0xabc...')
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Why this exists
|
|
31
|
+
|
|
32
|
+
Both gas-oracle and tx-tracker need the same upstream signals — new
|
|
33
|
+
blocks, mempool snapshots, capability probing. Re-implementing the
|
|
34
|
+
poll loop in each would mean double-polling for consumers who use
|
|
35
|
+
both. Sharing a `ChainSource` instance between them gives one upstream
|
|
36
|
+
RPC stream feeding multiple derived views.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
yarn add @valve-tech/chain-source viem
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @valve-tech/chain-source — 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` §3 in the
|
|
9
|
+
* `valve-tech/evm-toolkit` repo, which defines the `ChainSource`
|
|
10
|
+
* interface this package will export.
|
|
11
|
+
*
|
|
12
|
+
* Until v0.1.0 is published, no symbols are exported.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;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,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@valve-tech/chain-source",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Canonical EVM chain-observation primitive: a unified push-or-poll source for new blocks, mempool snapshots, on-demand receipt + tx lookups, and capability disclosure (HTTP / WS / per-method gating). Used as the shared foundation by @valve-tech/gas-oracle and @valve-tech/tx-tracker; consumable directly by anyone building their own derived view on chain state. viem-native. 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/chain-source#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/valve-tech/evm-toolkit.git",
|
|
10
|
+
"directory": "packages/chain-source"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/valve-tech/evm-toolkit/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"ethereum",
|
|
17
|
+
"evm",
|
|
18
|
+
"viem",
|
|
19
|
+
"rpc",
|
|
20
|
+
"mempool",
|
|
21
|
+
"subscription",
|
|
22
|
+
"chain-observer"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "dist/index.js",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc -p .",
|
|
40
|
+
"typecheck": "tsc -p . --noEmit",
|
|
41
|
+
"lint": "eslint src",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"prepare": "yarn build"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"viem": "^2.0.0"
|
|
47
|
+
}
|
|
48
|
+
}
|