@secondlayer/stacks 5.0.1 → 5.1.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/README.md +22 -2
- package/dist/shared/{stacks-6gavarmy.js → stacks-1m3m1agc.js} +2 -2
- package/dist/shared/{stacks-db3kwavg.cjs → stacks-37kz5t9f.cjs} +4 -6
- package/dist/shared/{stacks-db3kwavg.cjs.map → stacks-37kz5t9f.cjs.map} +3 -3
- package/dist/shared/{stacks-e3nwm1dz.js → stacks-gyp5ax89.js} +3 -3
- package/dist/shared/{stacks-7bqkf3b0.js → stacks-mbt36bzt.js} +3 -3
- package/dist/shared/{stacks-ga026yxz.js → stacks-qex691bh.js} +11 -4
- package/dist/shared/stacks-qex691bh.js.map +11 -0
- package/dist/shared/{stacks-n4d8j8q3.js → stacks-v03zef3g.js} +5 -7
- package/dist/shared/{stacks-n4d8j8q3.js.map → stacks-v03zef3g.js.map} +3 -3
- package/dist/shared/{stacks-ggdz96r1.cjs → stacks-wk8yp13j.cjs} +10 -3
- package/dist/shared/stacks-wk8yp13j.cjs.map +11 -0
- package/dist/src/actions/index.js +5 -5
- package/dist/src/bitcoin/index.cjs +7 -1
- package/dist/src/bitcoin/index.cjs.map +3 -3
- package/dist/src/bitcoin/index.d.cts +18 -0
- package/dist/src/bitcoin/index.d.ts +18 -0
- package/dist/src/bitcoin/index.js +8 -2
- package/dist/src/bitcoin/index.js.map +3 -3
- package/dist/src/bns/index.js +3 -3
- package/dist/src/index.cjs +2 -1
- package/dist/src/index.cjs.map +2 -2
- package/dist/src/index.d.cts +5 -1
- package/dist/src/index.d.ts +5 -1
- package/dist/src/index.js +7 -5
- package/dist/src/index.js.map +2 -2
- package/dist/src/pox/index.js +3 -3
- package/dist/src/pox5/index.js +4 -4
- package/dist/src/sbtc/index.js +3 -3
- package/dist/src/simnet/index.cjs +1675 -0
- package/dist/src/simnet/index.cjs.map +38 -0
- package/dist/src/simnet/index.d.cts +133 -0
- package/dist/src/simnet/index.d.ts +133 -0
- package/dist/src/simnet/index.js +1637 -0
- package/dist/src/simnet/index.js.map +38 -0
- package/dist/src/stackingdao/index.js +3 -3
- package/dist/src/tools/index.cjs +11 -6
- package/dist/src/tools/index.cjs.map +5 -5
- package/dist/src/tools/index.js +11 -6
- package/dist/src/tools/index.js.map +5 -5
- package/package.json +14 -1
- package/dist/shared/stacks-ga026yxz.js.map +0 -11
- package/dist/shared/stacks-ggdz96r1.cjs.map +0 -11
- /package/dist/shared/{stacks-6gavarmy.js.map → stacks-1m3m1agc.js.map} +0 -0
- /package/dist/shared/{stacks-e3nwm1dz.js.map → stacks-gyp5ax89.js.map} +0 -0
- /package/dist/shared/{stacks-7bqkf3b0.js.map → stacks-mbt36bzt.js.map} +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Simnet } from "@stacks/clarinet-sdk";
|
|
2
|
+
/** Full chain descriptor used by clients and transports for network-aware operations. */
|
|
3
|
+
type StacksChain = {
|
|
4
|
+
/** Chain ID (e.g. 0x00000001 for mainnet) */
|
|
5
|
+
id: number
|
|
6
|
+
/** Human-readable name */
|
|
7
|
+
name: string
|
|
8
|
+
/** Network type */
|
|
9
|
+
network: "mainnet" | "testnet"
|
|
10
|
+
/** Transaction version byte for serialization */
|
|
11
|
+
transactionVersion: number
|
|
12
|
+
/** Peer network ID for P2P broadcasting */
|
|
13
|
+
peerNetworkId: number
|
|
14
|
+
/** Address version bytes */
|
|
15
|
+
addressVersion: {
|
|
16
|
+
singleSig: number
|
|
17
|
+
multiSig: number
|
|
18
|
+
}
|
|
19
|
+
/** Magic bytes for network identification */
|
|
20
|
+
magicBytes: string
|
|
21
|
+
/** Boot address (system contracts deployer) */
|
|
22
|
+
bootAddress: string
|
|
23
|
+
/** Native currency info */
|
|
24
|
+
nativeCurrency: {
|
|
25
|
+
name: string
|
|
26
|
+
symbol: string
|
|
27
|
+
decimals: number
|
|
28
|
+
}
|
|
29
|
+
/** Default RPC URLs */
|
|
30
|
+
rpcUrls: {
|
|
31
|
+
default: {
|
|
32
|
+
http: string[]
|
|
33
|
+
ws?: string[]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** Block explorer URLs */
|
|
37
|
+
blockExplorers?: {
|
|
38
|
+
default: {
|
|
39
|
+
name: string
|
|
40
|
+
url: string
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/** Function that sends an HTTP request to a Stacks node API path. */
|
|
45
|
+
type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
|
|
46
|
+
/** Options for a transport-level HTTP request. */
|
|
47
|
+
type RequestOptions = {
|
|
48
|
+
method?: "GET" | "POST" | "PUT" | "DELETE"
|
|
49
|
+
body?: unknown
|
|
50
|
+
headers?: Record<string, string>
|
|
51
|
+
/**
|
|
52
|
+
* Cancel the request from the caller's side. An aborted signal rejects
|
|
53
|
+
* with the signal's reason immediately and never retries; it is combined
|
|
54
|
+
* with the transport's own per-attempt timeout.
|
|
55
|
+
*/
|
|
56
|
+
signal?: AbortSignal
|
|
57
|
+
/**
|
|
58
|
+
* Override the transport's retry budget for this one request. Broadcasts
|
|
59
|
+
* pass `0`: re-sending a transaction the node may already hold trades a
|
|
60
|
+
* transient failure for a confusing nonce conflict.
|
|
61
|
+
*/
|
|
62
|
+
retryCount?: number
|
|
63
|
+
};
|
|
64
|
+
/** Shared configuration for all transport types. */
|
|
65
|
+
type TransportConfig = {
|
|
66
|
+
url?: string
|
|
67
|
+
/**
|
|
68
|
+
* Per-attempt deadline in ms covering headers AND body. A stalled body
|
|
69
|
+
* rejects with `TimeoutError` instead of hanging. Default 30_000.
|
|
70
|
+
*/
|
|
71
|
+
timeout?: number
|
|
72
|
+
retryCount?: number
|
|
73
|
+
retryDelay?: number
|
|
74
|
+
fetchOptions?: RequestInit
|
|
75
|
+
/** Sent as `x-api-key`. Held in the request closure and stripped from
|
|
76
|
+
* `Transport.config` so it never prints with the client. */
|
|
77
|
+
apiKey?: string
|
|
78
|
+
};
|
|
79
|
+
/** A resolved transport instance with a bound request function. */
|
|
80
|
+
type Transport = {
|
|
81
|
+
type: string
|
|
82
|
+
request: RequestFn
|
|
83
|
+
config: TransportConfig
|
|
84
|
+
destroy?: () => void
|
|
85
|
+
};
|
|
86
|
+
/** Factory that creates a {@link Transport} given an optional chain context. */
|
|
87
|
+
type TransportFactory = (params?: {
|
|
88
|
+
chain?: StacksChain
|
|
89
|
+
}) => Transport;
|
|
90
|
+
/**
|
|
91
|
+
* Map Hiro/stacks-node REST paths onto an in-process Clarinet `Simnet`.
|
|
92
|
+
* `getContract` / public+wallet actions then work unchanged against simnet.
|
|
93
|
+
*/
|
|
94
|
+
declare function simnet(session: Simnet): TransportFactory;
|
|
95
|
+
/**
|
|
96
|
+
* Chain descriptor for a Clarinet simnet session. Address versions match
|
|
97
|
+
* Clarinet's testnet-style accounts (`ST…`). Boot contracts (pox-5, …) still
|
|
98
|
+
* live at their mainnet principals inside the VM.
|
|
99
|
+
*/
|
|
100
|
+
declare const simnetChain: StacksChain;
|
|
101
|
+
declare class BaseError extends Error {
|
|
102
|
+
private;
|
|
103
|
+
name: string;
|
|
104
|
+
shortMessage: string;
|
|
105
|
+
details?: string;
|
|
106
|
+
constructor(shortMessage: string, options?: {
|
|
107
|
+
cause?: Error
|
|
108
|
+
details?: string
|
|
109
|
+
code?: string
|
|
110
|
+
});
|
|
111
|
+
/**
|
|
112
|
+
* Stable identifier for programmatic handling; survives message
|
|
113
|
+
* rewording and minification. An explicit `code` option wins, else it
|
|
114
|
+
* is derived from `name` (`TimeoutError` gives `TIMEOUT_ERROR`).
|
|
115
|
+
*/
|
|
116
|
+
get code(): string;
|
|
117
|
+
set code(value: string);
|
|
118
|
+
toJSON(): {
|
|
119
|
+
name: string
|
|
120
|
+
code: string
|
|
121
|
+
message: string
|
|
122
|
+
shortMessage: string
|
|
123
|
+
details: string | undefined
|
|
124
|
+
cause: string | undefined
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/** The simnet transport does not implement this node/API route. */
|
|
128
|
+
declare class SimnetUnsupportedError extends BaseError {
|
|
129
|
+
name: string;
|
|
130
|
+
path: string;
|
|
131
|
+
constructor(path: string);
|
|
132
|
+
}
|
|
133
|
+
export { simnetChain, simnet, SimnetUnsupportedError };
|