@secondlayer/sdk 0.6.2 → 0.6.4

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.
Files changed (2) hide show
  1. package/README.md +8 -27
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -19,23 +19,6 @@ const sl = new SecondLayer({
19
19
  });
20
20
  ```
21
21
 
22
- ## Contracts
23
-
24
- Search, inspect, and fetch ABIs for on-chain contracts.
25
-
26
- ```typescript
27
- // Search by name
28
- const { contracts, total } = await sl.contracts.search("bns", { limit: 10, offset: 0 });
29
-
30
- // Get contract detail
31
- const contract = await sl.contracts.get("SP000000000000000000002Q6VF78.bns");
32
- // { contractId, name, deployer, deployBlock, deployTxId, callCount, lastCalledAt, abi, ... }
33
-
34
- // Fetch ABI (lazy-cached from Stacks node)
35
- const abi = await sl.contracts.getAbi("SP000000000000000000002Q6VF78.bns");
36
- // { functions: [...], maps: [...], variables: [...], ... }
37
- ```
38
-
39
22
  ## Streams
40
23
 
41
24
  Manage real-time event streams with endpoint delivery.
@@ -57,28 +40,26 @@ await sl.streams.update("stream-id", { name: "renamed" });
57
40
  await sl.streams.delete("stream-id");
58
41
  ```
59
42
 
60
- ## Views
43
+ ## Subgraphs
61
44
 
62
- Deploy and query materialized views.
45
+ Deploy and query subgraphs (custom indexers).
63
46
 
64
47
  ```typescript
65
48
  // List
66
- const { data } = await sl.views.list();
49
+ const { data } = await sl.subgraphs.list();
67
50
 
68
51
  // Get
69
- const view = await sl.views.get("my-view");
52
+ const subgraph = await sl.subgraphs.get("my-subgraph");
70
53
 
71
54
  // Query table
72
- const rows = await sl.views.queryTable("my-view", "transfers", {
55
+ const rows = await sl.subgraphs.queryTable("my-subgraph", "transfers", {
73
56
  sort: "block_height",
74
57
  order: "desc",
75
58
  limit: 50,
76
59
  });
77
60
 
78
- // Typed client (with defineView schema)
79
- import myView from "./views/my-view";
80
- const client = sl.views.typed(myView);
81
- const rows = await client.transfers.findMany({ where: { sender: "SP..." } });
61
+ // Deploy
62
+ const result = await sl.subgraphs.deploy({ name, sources, schema, handlerCode });
82
63
  ```
83
64
 
84
65
  ## Error Handling
@@ -87,7 +68,7 @@ const rows = await client.transfers.findMany({ where: { sender: "SP..." } });
87
68
  import { ApiError } from "@secondlayer/sdk";
88
69
 
89
70
  try {
90
- await sl.contracts.get("nonexistent");
71
+ await sl.streams.get("nonexistent");
91
72
  } catch (err) {
92
73
  if (err instanceof ApiError) {
93
74
  console.log(err.status); // 404
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secondlayer/sdk",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -29,8 +29,8 @@
29
29
  "prepublishOnly": "bun run build"
30
30
  },
31
31
  "dependencies": {
32
- "@secondlayer/shared": "^0.5.0",
33
- "@secondlayer/subgraphs": "^0.5.3"
32
+ "@secondlayer/shared": "^0.7.0",
33
+ "@secondlayer/subgraphs": "^0.5.7"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/bun": "latest",