@secondlayer/stacks 5.1.3 → 6.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.
Files changed (166) hide show
  1. package/README.md +1 -8
  2. package/dist/shared/{stacks-qt8ehebn.js → stacks-esm-0rdxcta7.js} +2 -2
  3. package/dist/shared/{stacks-qt8ehebn.js.map → stacks-esm-0rdxcta7.js.map} +1 -1
  4. package/dist/shared/{stacks-4hs8r4q2.js → stacks-esm-1jae0a3r.js} +2 -2
  5. package/dist/shared/{stacks-xjkn3en1.cjs.map → stacks-esm-1jae0a3r.js.map} +1 -1
  6. package/dist/shared/{stacks-4d7c3x27.js → stacks-esm-2mc7ebrm.js} +3 -3
  7. package/dist/shared/{stacks-4d7c3x27.js.map → stacks-esm-2mc7ebrm.js.map} +1 -1
  8. package/dist/shared/{stacks-8brgfvqx.js → stacks-esm-3g33bqsm.js} +4 -4
  9. package/dist/shared/{stacks-8brgfvqx.js.map → stacks-esm-3g33bqsm.js.map} +1 -1
  10. package/dist/shared/{stacks-gjz26k6b.js → stacks-esm-3pv5avgr.js} +59 -15
  11. package/dist/shared/stacks-esm-3pv5avgr.js.map +12 -0
  12. package/dist/shared/{stacks-qex691bh.js → stacks-esm-743jfh10.js} +6 -6
  13. package/dist/shared/{stacks-qex691bh.js.map → stacks-esm-743jfh10.js.map} +1 -1
  14. package/dist/shared/{stacks-wxfd6r4b.js → stacks-esm-7fpqgtyx.js} +3 -3
  15. package/dist/shared/{stacks-wxfd6r4b.js.map → stacks-esm-7fpqgtyx.js.map} +1 -1
  16. package/dist/shared/{stacks-71k0vmct.js → stacks-esm-9rnx0zxr.js} +5 -5
  17. package/dist/shared/{stacks-71k0vmct.js.map → stacks-esm-9rnx0zxr.js.map} +1 -1
  18. package/dist/shared/{stacks-fd4rx56e.js → stacks-esm-aw2mj3sj.js} +7 -7
  19. package/dist/shared/{stacks-fd4rx56e.js.map → stacks-esm-aw2mj3sj.js.map} +1 -1
  20. package/dist/shared/{stacks-qs5fzts5.js → stacks-esm-cvhazvhd.js} +2 -2
  21. package/dist/shared/{stacks-qs5fzts5.js.map → stacks-esm-cvhazvhd.js.map} +1 -1
  22. package/dist/shared/{stacks-69nq48jp.js → stacks-esm-fcfdn2zx.js} +5 -5
  23. package/dist/shared/{stacks-69nq48jp.js.map → stacks-esm-fcfdn2zx.js.map} +1 -1
  24. package/dist/shared/{stacks-x0qqwrev.js → stacks-esm-hr7fpxtj.js} +4 -4
  25. package/dist/shared/{stacks-x0qqwrev.js.map → stacks-esm-hr7fpxtj.js.map} +1 -1
  26. package/dist/shared/{stacks-mbt36bzt.js → stacks-esm-kds4n82p.js} +11 -11
  27. package/dist/shared/{stacks-mbt36bzt.js.map → stacks-esm-kds4n82p.js.map} +1 -1
  28. package/dist/shared/{stacks-kg1npstf.js → stacks-esm-n53kvwmt.js} +2 -2
  29. package/dist/shared/{stacks-kg1npstf.js.map → stacks-esm-n53kvwmt.js.map} +1 -1
  30. package/dist/shared/{stacks-v2rfr46a.js → stacks-esm-pxhfqfff.js} +4 -4
  31. package/dist/shared/{stacks-v2rfr46a.js.map → stacks-esm-pxhfqfff.js.map} +1 -1
  32. package/dist/shared/{stacks-yajyej2y.js → stacks-esm-q19a17fd.js} +3 -3
  33. package/dist/shared/{stacks-yajyej2y.js.map → stacks-esm-q19a17fd.js.map} +1 -1
  34. package/dist/shared/{stacks-v03zef3g.js → stacks-esm-qk0p9fr6.js} +9 -9
  35. package/dist/shared/{stacks-v03zef3g.js.map → stacks-esm-qk0p9fr6.js.map} +1 -1
  36. package/dist/shared/{stacks-qcae5852.js → stacks-esm-qkj67g80.js} +2 -2
  37. package/dist/shared/{stacks-qcae5852.js.map → stacks-esm-qkj67g80.js.map} +1 -1
  38. package/dist/shared/{stacks-mftyrc60.js → stacks-esm-r6dejrgr.js} +4 -4
  39. package/dist/shared/{stacks-mftyrc60.js.map → stacks-esm-r6dejrgr.js.map} +1 -1
  40. package/dist/shared/{stacks-9c1yam8b.js → stacks-esm-r9q4wnyw.js} +5 -5
  41. package/dist/shared/{stacks-9c1yam8b.js.map → stacks-esm-r9q4wnyw.js.map} +1 -1
  42. package/dist/shared/{stacks-51ybf135.js → stacks-esm-skmcf5n2.js} +5 -5
  43. package/dist/shared/{stacks-51ybf135.js.map → stacks-esm-skmcf5n2.js.map} +1 -1
  44. package/dist/shared/{stacks-yvb7rvwk.js → stacks-esm-v45990hx.js} +2 -2
  45. package/dist/shared/{stacks-8vzxax5e.cjs.map → stacks-esm-v45990hx.js.map} +1 -1
  46. package/dist/shared/{stacks-z90xdr1x.js → stacks-esm-wv67m4g6.js} +3 -3
  47. package/dist/shared/{stacks-z90xdr1x.js.map → stacks-esm-wv67m4g6.js.map} +1 -1
  48. package/dist/shared/{stacks-1m3m1agc.js → stacks-esm-x1r01353.js} +5 -5
  49. package/dist/shared/{stacks-1m3m1agc.js.map → stacks-esm-x1r01353.js.map} +1 -1
  50. package/dist/src/accounts/index.cjs +558 -4
  51. package/dist/src/accounts/index.cjs.map +10 -4
  52. package/dist/src/accounts/index.js +3 -3
  53. package/dist/src/actions/index.cjs +3815 -1
  54. package/dist/src/actions/index.cjs.map +65 -3
  55. package/dist/src/actions/index.js +14 -14
  56. package/dist/src/bitcoin/index.cjs +2477 -1
  57. package/dist/src/bitcoin/index.cjs.map +31 -3
  58. package/dist/src/bitcoin/index.js +11 -11
  59. package/dist/src/bns/index.cjs +4439 -17
  60. package/dist/src/bns/index.cjs.map +50 -3
  61. package/dist/src/bns/index.js +14 -14
  62. package/dist/src/chains/index.cjs +135 -1
  63. package/dist/src/chains/index.cjs.map +5 -3
  64. package/dist/src/chains/index.js +1 -1
  65. package/dist/src/clarity/index.cjs +2019 -1
  66. package/dist/src/clarity/index.cjs.map +24 -3
  67. package/dist/src/clarity/index.js +8 -8
  68. package/dist/src/filters/index.cjs +725 -1
  69. package/dist/src/filters/index.cjs.map +11 -3
  70. package/dist/src/filters/index.d.cts +76 -13
  71. package/dist/src/filters/index.d.ts +76 -13
  72. package/dist/src/filters/index.js +8 -4
  73. package/dist/src/filters/index.js.map +1 -1
  74. package/dist/src/index.cjs +3935 -62
  75. package/dist/src/index.cjs.map +69 -4
  76. package/dist/src/index.d.cts +62 -11
  77. package/dist/src/index.d.ts +62 -11
  78. package/dist/src/index.js +16 -16
  79. package/dist/src/postconditions/index.cjs +1726 -1
  80. package/dist/src/postconditions/index.cjs.map +20 -3
  81. package/dist/src/postconditions/index.js +6 -6
  82. package/dist/src/pox/index.cjs +3855 -1
  83. package/dist/src/pox/index.cjs.map +48 -3
  84. package/dist/src/pox/index.js +13 -13
  85. package/dist/src/pox5/index.cjs +4054 -29
  86. package/dist/src/pox5/index.cjs.map +54 -3
  87. package/dist/src/pox5/index.js +15 -15
  88. package/dist/src/sbtc/index.cjs +3705 -4
  89. package/dist/src/sbtc/index.cjs.map +47 -3
  90. package/dist/src/sbtc/index.js +12 -12
  91. package/dist/src/stackingdao/index.cjs +3751 -8
  92. package/dist/src/stackingdao/index.cjs.map +45 -3
  93. package/dist/src/stackingdao/index.js +12 -12
  94. package/dist/src/subscriptions/index.cjs +153 -1
  95. package/dist/src/subscriptions/index.cjs.map +6 -3
  96. package/dist/src/subscriptions/index.js +2 -2
  97. package/dist/src/transactions/index.cjs +2139 -1
  98. package/dist/src/transactions/index.cjs.map +23 -3
  99. package/dist/src/transactions/index.js +6 -6
  100. package/dist/src/utils/index.cjs +435 -3
  101. package/dist/src/utils/index.cjs.map +9 -3
  102. package/dist/src/utils/index.js +3 -3
  103. package/package.json +3 -23
  104. package/dist/shared/stacks-02actsrx.cjs +0 -17
  105. package/dist/shared/stacks-02actsrx.cjs.map +0 -10
  106. package/dist/shared/stacks-03vfm21t.cjs +0 -222
  107. package/dist/shared/stacks-03vfm21t.cjs.map +0 -12
  108. package/dist/shared/stacks-24h5k94q.cjs +0 -74
  109. package/dist/shared/stacks-24h5k94q.cjs.map +0 -11
  110. package/dist/shared/stacks-37kz5t9f.cjs +0 -764
  111. package/dist/shared/stacks-37kz5t9f.cjs.map +0 -23
  112. package/dist/shared/stacks-3mt2q2na.cjs +0 -65
  113. package/dist/shared/stacks-3mt2q2na.cjs.map +0 -9
  114. package/dist/shared/stacks-4hs8r4q2.js.map +0 -10
  115. package/dist/shared/stacks-8vzxax5e.cjs +0 -45
  116. package/dist/shared/stacks-agk106zs.cjs +0 -267
  117. package/dist/shared/stacks-agk106zs.cjs.map +0 -12
  118. package/dist/shared/stacks-bdgh9n83.cjs +0 -212
  119. package/dist/shared/stacks-bdgh9n83.cjs.map +0 -11
  120. package/dist/shared/stacks-dpxnxhqb.cjs +0 -51
  121. package/dist/shared/stacks-dpxnxhqb.cjs.map +0 -11
  122. package/dist/shared/stacks-ee53k9j2.cjs +0 -651
  123. package/dist/shared/stacks-ee53k9j2.cjs.map +0 -13
  124. package/dist/shared/stacks-enpj9krt.cjs +0 -38
  125. package/dist/shared/stacks-enpj9krt.cjs.map +0 -10
  126. package/dist/shared/stacks-f35mnrmg.cjs +0 -164
  127. package/dist/shared/stacks-f35mnrmg.cjs.map +0 -10
  128. package/dist/shared/stacks-fhzwsn5d.cjs +0 -261
  129. package/dist/shared/stacks-fhzwsn5d.cjs.map +0 -12
  130. package/dist/shared/stacks-gjz26k6b.js.map +0 -12
  131. package/dist/shared/stacks-gza2n1zs.cjs +0 -73
  132. package/dist/shared/stacks-gza2n1zs.cjs.map +0 -11
  133. package/dist/shared/stacks-kem68d80.cjs +0 -156
  134. package/dist/shared/stacks-kem68d80.cjs.map +0 -10
  135. package/dist/shared/stacks-n98w7g57.cjs +0 -234
  136. package/dist/shared/stacks-n98w7g57.cjs.map +0 -10
  137. package/dist/shared/stacks-p337hp6m.cjs +0 -336
  138. package/dist/shared/stacks-p337hp6m.cjs.map +0 -25
  139. package/dist/shared/stacks-q34k4vnc.cjs +0 -286
  140. package/dist/shared/stacks-q34k4vnc.cjs.map +0 -12
  141. package/dist/shared/stacks-rryme9bv.cjs +0 -569
  142. package/dist/shared/stacks-rryme9bv.cjs.map +0 -13
  143. package/dist/shared/stacks-s5vej5z6.cjs +0 -410
  144. package/dist/shared/stacks-s5vej5z6.cjs.map +0 -15
  145. package/dist/shared/stacks-sdqkapct.cjs +0 -67
  146. package/dist/shared/stacks-sdqkapct.cjs.map +0 -12
  147. package/dist/shared/stacks-vea7nde7.cjs +0 -731
  148. package/dist/shared/stacks-vea7nde7.cjs.map +0 -13
  149. package/dist/shared/stacks-wk8yp13j.cjs +0 -33
  150. package/dist/shared/stacks-wk8yp13j.cjs.map +0 -11
  151. package/dist/shared/stacks-xjkn3en1.cjs +0 -42
  152. package/dist/shared/stacks-xnrywjf1.cjs +0 -131
  153. package/dist/shared/stacks-xnrywjf1.cjs.map +0 -11
  154. package/dist/shared/stacks-yvb7rvwk.js.map +0 -10
  155. package/dist/src/tools/btc/index.cjs +0 -131
  156. package/dist/src/tools/btc/index.cjs.map +0 -10
  157. package/dist/src/tools/btc/index.d.cts +0 -10
  158. package/dist/src/tools/btc/index.d.ts +0 -10
  159. package/dist/src/tools/btc/index.js +0 -90
  160. package/dist/src/tools/btc/index.js.map +0 -10
  161. package/dist/src/tools/index.cjs +0 -3865
  162. package/dist/src/tools/index.cjs.map +0 -80
  163. package/dist/src/tools/index.d.cts +0 -206
  164. package/dist/src/tools/index.d.ts +0 -206
  165. package/dist/src/tools/index.js +0 -3827
  166. package/dist/src/tools/index.js.map +0 -80
@@ -1,206 +0,0 @@
1
- import { Tool } from "ai";
2
- /** Account derived from a local private key (mnemonic or raw key). */
3
- type LocalAccount = {
4
- type: "local"
5
- address: string
6
- /** Compressed public key (hex) */
7
- publicKey: string
8
- /** Raw ECDSA sign over a hash */
9
- sign(hash: Uint8Array): Uint8Array
10
- /** Sign a raw UTF-8 / byte message (`sha256(bytes)`). Not SIP-018. */
11
- signMessage(message: string | Uint8Array): string
12
- };
13
- /** Account with a user-provided signing function (sync or async). */
14
- type CustomAccount = {
15
- type: "custom"
16
- address: string
17
- publicKey: string
18
- sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
19
- };
20
- /** Browser wallet provider interface (e.g. Leather, Xverse). */
21
- type StacksProvider = {
22
- request(method: string, params?: any): Promise<any>
23
- };
24
- /** Account backed by a browser wallet {@link StacksProvider}. */
25
- type ProviderAccount = {
26
- type: "provider"
27
- address: string
28
- publicKey: string
29
- provider: StacksProvider
30
- };
31
- /** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */
32
- type NonceManager = {
33
- consume(params: {
34
- client: Client
35
- address: string
36
- }): Promise<bigint>
37
- reset(params: {
38
- client: Client
39
- address: string
40
- }): void | Promise<void>
41
- /**
42
- * Give back a nonce from {@link NonceManager.consume} whose transaction
43
- * was never accepted by the node. No-op unless it is the latest issued.
44
- */
45
- release(params: {
46
- client: Client
47
- address: string
48
- nonce: bigint
49
- }): void | Promise<void>
50
- /** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
51
- peek(params: {
52
- client: Client
53
- address: string
54
- }): Promise<bigint | undefined>
55
- };
56
- /** Full chain descriptor used by clients and transports for network-aware operations. */
57
- type StacksChain = {
58
- /** Chain ID (e.g. 0x00000001 for mainnet) */
59
- id: number
60
- /** Human-readable name */
61
- name: string
62
- /** Network type */
63
- network: "mainnet" | "testnet"
64
- /** Transaction version byte for serialization */
65
- transactionVersion: number
66
- /** Peer network ID for P2P broadcasting */
67
- peerNetworkId: number
68
- /** Address version bytes */
69
- addressVersion: {
70
- singleSig: number
71
- multiSig: number
72
- }
73
- /** Magic bytes for network identification */
74
- magicBytes: string
75
- /** Boot address (system contracts deployer) */
76
- bootAddress: string
77
- /** Native currency info */
78
- nativeCurrency: {
79
- name: string
80
- symbol: string
81
- decimals: number
82
- }
83
- /** Default RPC URLs */
84
- rpcUrls: {
85
- default: {
86
- http: string[]
87
- ws?: string[]
88
- }
89
- }
90
- /** Block explorer URLs */
91
- blockExplorers?: {
92
- default: {
93
- name: string
94
- url: string
95
- }
96
- }
97
- };
98
- /** Function that sends an HTTP request to a Stacks node API path. */
99
- type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
100
- /** Options for a transport-level HTTP request. */
101
- type RequestOptions = {
102
- method?: "GET" | "POST" | "PUT" | "DELETE"
103
- body?: unknown
104
- headers?: Record<string, string>
105
- /**
106
- * Cancel the request from the caller's side. An aborted signal rejects
107
- * with the signal's reason immediately and never retries; it is combined
108
- * with the transport's own per-attempt timeout.
109
- */
110
- signal?: AbortSignal
111
- /**
112
- * Override the transport's retry budget for this one request. Broadcasts
113
- * pass `0`: re-sending a transaction the node may already hold trades a
114
- * transient failure for a confusing nonce conflict.
115
- */
116
- retryCount?: number
117
- };
118
- /** Shared configuration for all transport types. */
119
- type TransportConfig = {
120
- url?: string
121
- /**
122
- * Per-attempt deadline in ms covering headers AND body. A stalled body
123
- * rejects with `TimeoutError` instead of hanging. Default 30_000.
124
- */
125
- timeout?: number
126
- retryCount?: number
127
- retryDelay?: number
128
- fetchOptions?: RequestInit
129
- /** Sent as `x-api-key`. Held in the request closure and stripped from
130
- * `Transport.config` so it never prints with the client. */
131
- apiKey?: string
132
- };
133
- /** A resolved transport instance with a bound request function. */
134
- type Transport = {
135
- type: string
136
- request: RequestFn
137
- config: TransportConfig
138
- destroy?: () => void
139
- };
140
- /** Union of all supported account types (local key, custom signer, or browser provider). */
141
- type Account = LocalAccount | CustomAccount | ProviderAccount;
142
- /**
143
- * Core client instance that holds chain context, transport, and extensible actions.
144
- * Created via {@link createClient}, {@link createPublicClient}, or {@link createWalletClient}.
145
- */
146
- type Client<TExtended extends Record<string, unknown> = Record<string, unknown>> = {
147
- chain?: StacksChain
148
- account?: Account
149
- transport: Transport
150
- request: RequestFn
151
- /** Optional nonce manager for mempool-safe sequential nonces across rapid broadcasts. */
152
- nonceManager?: NonceManager
153
- extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
154
- } & TExtended;
155
- /**
156
- * Any Stacks client that can perform read-only RPC requests. We only need
157
- * the base `Client.request` contract; public actions are invoked as
158
- * free functions in `tools/index.ts`, so we keep this loose.
159
- */
160
- type StacksReadClient = Client<Record<string, unknown>>;
161
- type LooseTool = Tool<any, any>;
162
- interface StacksTools {
163
- getStxBalance: LooseTool;
164
- getAccountInfo: LooseTool;
165
- getBlock: LooseTool;
166
- getBlockHeight: LooseTool;
167
- readContract: LooseTool;
168
- estimateFee: LooseTool;
169
- bnsResolve: LooseTool;
170
- bnsReverse: LooseTool;
171
- getTransaction: LooseTool;
172
- getAccountHistory: LooseTool;
173
- getMempoolStats: LooseTool;
174
- getNftHoldings: LooseTool;
175
- }
176
- /**
177
- * Bind the tool set to an explicit client.
178
- *
179
- * @deprecated Use `@secondlayer/mcp` for agent access to Stacks reads.
180
- */
181
- declare function createStacksTools(client: StacksReadClient): StacksTools;
182
- /** @deprecated Use `@secondlayer/mcp`. */
183
- declare const getStxBalance: LooseTool;
184
- /** @deprecated Use `@secondlayer/mcp`. */
185
- declare const getAccountInfo: LooseTool;
186
- /** @deprecated Use `@secondlayer/mcp`. */
187
- declare const getBlock: LooseTool;
188
- /** @deprecated Use `@secondlayer/mcp`. */
189
- declare const getBlockHeight: LooseTool;
190
- /** @deprecated Use `@secondlayer/mcp`. */
191
- declare const readContract: LooseTool;
192
- /** @deprecated Use `@secondlayer/mcp`. */
193
- declare const estimateFee: LooseTool;
194
- /** @deprecated Use `@secondlayer/mcp`. */
195
- declare const bnsResolve: LooseTool;
196
- /** @deprecated Use `@secondlayer/mcp`. */
197
- declare const bnsReverse: LooseTool;
198
- /** @deprecated Use `@secondlayer/mcp`. */
199
- declare const getTransaction: LooseTool;
200
- /** @deprecated Use `@secondlayer/mcp`. */
201
- declare const getAccountHistory: LooseTool;
202
- /** @deprecated Use `@secondlayer/mcp`. */
203
- declare const getMempoolStats: LooseTool;
204
- /** @deprecated Use `@secondlayer/mcp`. */
205
- declare const getNftHoldings: LooseTool;
206
- export { readContract, getTransaction, getStxBalance, getNftHoldings, getMempoolStats, getBlockHeight, getBlock, getAccountInfo, getAccountHistory, estimateFee, createStacksTools, bnsReverse, bnsResolve, StacksTools };
@@ -1,206 +0,0 @@
1
- import { Tool } from "ai";
2
- /** Account derived from a local private key (mnemonic or raw key). */
3
- type LocalAccount = {
4
- type: "local"
5
- address: string
6
- /** Compressed public key (hex) */
7
- publicKey: string
8
- /** Raw ECDSA sign over a hash */
9
- sign(hash: Uint8Array): Uint8Array
10
- /** Sign a raw UTF-8 / byte message (`sha256(bytes)`). Not SIP-018. */
11
- signMessage(message: string | Uint8Array): string
12
- };
13
- /** Account with a user-provided signing function (sync or async). */
14
- type CustomAccount = {
15
- type: "custom"
16
- address: string
17
- publicKey: string
18
- sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
19
- };
20
- /** Browser wallet provider interface (e.g. Leather, Xverse). */
21
- type StacksProvider = {
22
- request(method: string, params?: any): Promise<any>
23
- };
24
- /** Account backed by a browser wallet {@link StacksProvider}. */
25
- type ProviderAccount = {
26
- type: "provider"
27
- address: string
28
- publicKey: string
29
- provider: StacksProvider
30
- };
31
- /** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */
32
- type NonceManager = {
33
- consume(params: {
34
- client: Client
35
- address: string
36
- }): Promise<bigint>
37
- reset(params: {
38
- client: Client
39
- address: string
40
- }): void | Promise<void>
41
- /**
42
- * Give back a nonce from {@link NonceManager.consume} whose transaction
43
- * was never accepted by the node. No-op unless it is the latest issued.
44
- */
45
- release(params: {
46
- client: Client
47
- address: string
48
- nonce: bigint
49
- }): void | Promise<void>
50
- /** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
51
- peek(params: {
52
- client: Client
53
- address: string
54
- }): Promise<bigint | undefined>
55
- };
56
- /** Full chain descriptor used by clients and transports for network-aware operations. */
57
- type StacksChain = {
58
- /** Chain ID (e.g. 0x00000001 for mainnet) */
59
- id: number
60
- /** Human-readable name */
61
- name: string
62
- /** Network type */
63
- network: "mainnet" | "testnet"
64
- /** Transaction version byte for serialization */
65
- transactionVersion: number
66
- /** Peer network ID for P2P broadcasting */
67
- peerNetworkId: number
68
- /** Address version bytes */
69
- addressVersion: {
70
- singleSig: number
71
- multiSig: number
72
- }
73
- /** Magic bytes for network identification */
74
- magicBytes: string
75
- /** Boot address (system contracts deployer) */
76
- bootAddress: string
77
- /** Native currency info */
78
- nativeCurrency: {
79
- name: string
80
- symbol: string
81
- decimals: number
82
- }
83
- /** Default RPC URLs */
84
- rpcUrls: {
85
- default: {
86
- http: string[]
87
- ws?: string[]
88
- }
89
- }
90
- /** Block explorer URLs */
91
- blockExplorers?: {
92
- default: {
93
- name: string
94
- url: string
95
- }
96
- }
97
- };
98
- /** Function that sends an HTTP request to a Stacks node API path. */
99
- type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
100
- /** Options for a transport-level HTTP request. */
101
- type RequestOptions = {
102
- method?: "GET" | "POST" | "PUT" | "DELETE"
103
- body?: unknown
104
- headers?: Record<string, string>
105
- /**
106
- * Cancel the request from the caller's side. An aborted signal rejects
107
- * with the signal's reason immediately and never retries; it is combined
108
- * with the transport's own per-attempt timeout.
109
- */
110
- signal?: AbortSignal
111
- /**
112
- * Override the transport's retry budget for this one request. Broadcasts
113
- * pass `0`: re-sending a transaction the node may already hold trades a
114
- * transient failure for a confusing nonce conflict.
115
- */
116
- retryCount?: number
117
- };
118
- /** Shared configuration for all transport types. */
119
- type TransportConfig = {
120
- url?: string
121
- /**
122
- * Per-attempt deadline in ms covering headers AND body. A stalled body
123
- * rejects with `TimeoutError` instead of hanging. Default 30_000.
124
- */
125
- timeout?: number
126
- retryCount?: number
127
- retryDelay?: number
128
- fetchOptions?: RequestInit
129
- /** Sent as `x-api-key`. Held in the request closure and stripped from
130
- * `Transport.config` so it never prints with the client. */
131
- apiKey?: string
132
- };
133
- /** A resolved transport instance with a bound request function. */
134
- type Transport = {
135
- type: string
136
- request: RequestFn
137
- config: TransportConfig
138
- destroy?: () => void
139
- };
140
- /** Union of all supported account types (local key, custom signer, or browser provider). */
141
- type Account = LocalAccount | CustomAccount | ProviderAccount;
142
- /**
143
- * Core client instance that holds chain context, transport, and extensible actions.
144
- * Created via {@link createClient}, {@link createPublicClient}, or {@link createWalletClient}.
145
- */
146
- type Client<TExtended extends Record<string, unknown> = Record<string, unknown>> = {
147
- chain?: StacksChain
148
- account?: Account
149
- transport: Transport
150
- request: RequestFn
151
- /** Optional nonce manager for mempool-safe sequential nonces across rapid broadcasts. */
152
- nonceManager?: NonceManager
153
- extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
154
- } & TExtended;
155
- /**
156
- * Any Stacks client that can perform read-only RPC requests. We only need
157
- * the base `Client.request` contract; public actions are invoked as
158
- * free functions in `tools/index.ts`, so we keep this loose.
159
- */
160
- type StacksReadClient = Client<Record<string, unknown>>;
161
- type LooseTool = Tool<any, any>;
162
- interface StacksTools {
163
- getStxBalance: LooseTool;
164
- getAccountInfo: LooseTool;
165
- getBlock: LooseTool;
166
- getBlockHeight: LooseTool;
167
- readContract: LooseTool;
168
- estimateFee: LooseTool;
169
- bnsResolve: LooseTool;
170
- bnsReverse: LooseTool;
171
- getTransaction: LooseTool;
172
- getAccountHistory: LooseTool;
173
- getMempoolStats: LooseTool;
174
- getNftHoldings: LooseTool;
175
- }
176
- /**
177
- * Bind the tool set to an explicit client.
178
- *
179
- * @deprecated Use `@secondlayer/mcp` for agent access to Stacks reads.
180
- */
181
- declare function createStacksTools(client: StacksReadClient): StacksTools;
182
- /** @deprecated Use `@secondlayer/mcp`. */
183
- declare const getStxBalance: LooseTool;
184
- /** @deprecated Use `@secondlayer/mcp`. */
185
- declare const getAccountInfo: LooseTool;
186
- /** @deprecated Use `@secondlayer/mcp`. */
187
- declare const getBlock: LooseTool;
188
- /** @deprecated Use `@secondlayer/mcp`. */
189
- declare const getBlockHeight: LooseTool;
190
- /** @deprecated Use `@secondlayer/mcp`. */
191
- declare const readContract: LooseTool;
192
- /** @deprecated Use `@secondlayer/mcp`. */
193
- declare const estimateFee: LooseTool;
194
- /** @deprecated Use `@secondlayer/mcp`. */
195
- declare const bnsResolve: LooseTool;
196
- /** @deprecated Use `@secondlayer/mcp`. */
197
- declare const bnsReverse: LooseTool;
198
- /** @deprecated Use `@secondlayer/mcp`. */
199
- declare const getTransaction: LooseTool;
200
- /** @deprecated Use `@secondlayer/mcp`. */
201
- declare const getAccountHistory: LooseTool;
202
- /** @deprecated Use `@secondlayer/mcp`. */
203
- declare const getMempoolStats: LooseTool;
204
- /** @deprecated Use `@secondlayer/mcp`. */
205
- declare const getNftHoldings: LooseTool;
206
- export { readContract, getTransaction, getStxBalance, getNftHoldings, getMempoolStats, getBlockHeight, getBlock, getAccountInfo, getAccountHistory, estimateFee, createStacksTools, bnsReverse, bnsResolve, StacksTools };