@secondlayer/sdk 6.22.0 → 6.23.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 +15 -9
- package/dist/index.d.ts +1068 -978
- package/dist/index.js +308 -218
- package/dist/index.js.map +7 -6
- package/dist/subgraphs/index.d.ts +1038 -977
- package/dist/subgraphs/index.js +307 -218
- package/dist/subgraphs/index.js.map +7 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @secondlayer/sdk
|
|
2
2
|
|
|
3
|
-
TypeScript SDK for the
|
|
3
|
+
TypeScript SDK for the Secondlayer API.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -36,12 +36,18 @@ plan's tier.
|
|
|
36
36
|
|
|
37
37
|
## Mental model
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
- `sl.index` reads the decoded layer from Stacks Index — FT/NFT transfers, all event types (`events`), and `contractCalls`.
|
|
41
|
-
- `sl.contracts` finds deployed contracts by trait (SIP-009/010/013).
|
|
42
|
-
- `sl.subgraphs` reads app-specific tables from Stacks Subgraphs.
|
|
39
|
+
Everything is indexing — the question is how much of the indexer you run:
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
- `sl.index` — decoded rows we keep indexed: query FT/NFT transfers, all event
|
|
42
|
+
types (`events`), and `contractCalls` — or build your own app index on them
|
|
43
|
+
with `walk()`, resumable cursors, and `reorgs[]` on every page.
|
|
44
|
+
- `sl.subgraphs` — deploy your own indexer (one `defineSubgraph()` file via the
|
|
45
|
+
CLI), then read your hosted tables here. We run the loop.
|
|
46
|
+
- `sl.streams` — the raw ordered event firehose Index itself is built on, with
|
|
47
|
+
a checkpointed `consume()` and dumps `replay()` for building from zero.
|
|
48
|
+
- `sl.contracts` — find deployed contracts by trait (SIP-009/010/013).
|
|
49
|
+
|
|
50
|
+
## Streams
|
|
45
51
|
|
|
46
52
|
Typed HTTP client for the raw event firehose. Reads require a bearer token (`apiKey`).
|
|
47
53
|
|
|
@@ -217,7 +223,7 @@ the decoder. Decoders throw when the event type or payload is malformed. Add new
|
|
|
217
223
|
helpers beside `src/streams/ft-transfer.ts` and export them through
|
|
218
224
|
`src/streams/index.ts`.
|
|
219
225
|
|
|
220
|
-
##
|
|
226
|
+
## Index
|
|
221
227
|
|
|
222
228
|
Decoded transfer events.
|
|
223
229
|
|
|
@@ -247,7 +253,7 @@ for await (const transfer of sl.index.ftTransfers.walk({
|
|
|
247
253
|
|
|
248
254
|
## Transaction-inclusion proofs
|
|
249
255
|
|
|
250
|
-
Verify — **without trusting
|
|
256
|
+
Verify — **without trusting Secondlayer** — that a transaction is included in a
|
|
251
257
|
Stacks (Nakamoto) block, and that ≥70% of the reward cycle's signer weight
|
|
252
258
|
attested to that block. `verifyTransactionProof` recomputes everything
|
|
253
259
|
client-side and trusts nothing the API returned.
|
|
@@ -314,7 +320,7 @@ fetchRewardSet(opts: {
|
|
|
314
320
|
|
|
315
321
|
Exported types: `TransactionProof`, `TransactionProofVerifyResult`, `RewardSet`.
|
|
316
322
|
|
|
317
|
-
##
|
|
323
|
+
## Subgraphs
|
|
318
324
|
|
|
319
325
|
Deploy and query app-specific tables.
|
|
320
326
|
|