@secondlayer/stacks 2.5.2 → 2.7.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 +65 -0
- package/dist/shared/{stacks-jevhg39n.cjs → stacks-7nf5h3qe.cjs} +16 -12
- package/dist/shared/{stacks-jevhg39n.cjs.map → stacks-7nf5h3qe.cjs.map} +4 -4
- package/dist/shared/{stacks-5th5dffx.js → stacks-a48qj7ss.js} +20 -16
- package/dist/shared/{stacks-5th5dffx.js.map → stacks-a48qj7ss.js.map} +4 -4
- package/dist/shared/{stacks-7wfdkhj6.cjs → stacks-e7pmsrbs.cjs} +9 -7
- package/dist/shared/{stacks-7wfdkhj6.cjs.map → stacks-e7pmsrbs.cjs.map} +3 -3
- package/dist/shared/{stacks-7wqprfrm.cjs → stacks-hxm7r5ay.cjs} +3 -3
- package/dist/shared/{stacks-7wqprfrm.cjs.map → stacks-hxm7r5ay.cjs.map} +3 -3
- package/dist/shared/{stacks-hyz7zgdk.js → stacks-k96f5g1a.js} +2 -2
- package/dist/shared/stacks-r3mqgw2d.js +204 -0
- package/dist/shared/stacks-r3mqgw2d.js.map +15 -0
- package/dist/shared/{stacks-4z1jhw6y.js → stacks-s6v8k4j5.js} +6 -6
- package/dist/shared/{stacks-4z1jhw6y.js.map → stacks-s6v8k4j5.js.map} +3 -3
- package/dist/shared/{stacks-yq5a5cda.js → stacks-txh6dadn.js} +12 -10
- package/dist/shared/{stacks-yq5a5cda.js.map → stacks-txh6dadn.js.map} +3 -3
- package/dist/shared/stacks-wb06pevp.cjs +190 -0
- package/dist/shared/stacks-wb06pevp.cjs.map +15 -0
- package/dist/src/actions/index.d.cts +138 -120
- package/dist/src/actions/index.d.ts +138 -120
- package/dist/src/actions/index.js +5 -5
- package/dist/src/bns/index.d.cts +18 -0
- package/dist/src/bns/index.d.ts +18 -0
- package/dist/src/bns/index.js +3 -3
- package/dist/src/index.cjs +180 -5
- package/dist/src/index.cjs.map +7 -5
- package/dist/src/index.d.cts +377 -101
- package/dist/src/index.d.ts +377 -101
- package/dist/src/index.js +193 -10
- package/dist/src/index.js.map +7 -5
- package/dist/src/pox/index.d.cts +18 -0
- package/dist/src/pox/index.d.ts +18 -0
- package/dist/src/pox/index.js +3 -3
- package/dist/src/sbtc/index.d.cts +18 -0
- package/dist/src/sbtc/index.d.ts +18 -0
- package/dist/src/sbtc/index.js +3 -3
- package/dist/src/stackingdao/index.d.cts +18 -0
- package/dist/src/stackingdao/index.d.ts +18 -0
- package/dist/src/stackingdao/index.js +3 -3
- package/dist/src/subscriptions/index.d.cts +18 -0
- package/dist/src/subscriptions/index.d.ts +18 -0
- package/dist/src/tools/index.cjs +44 -14
- package/dist/src/tools/index.cjs.map +7 -6
- package/dist/src/tools/index.d.cts +18 -0
- package/dist/src/tools/index.d.ts +18 -0
- package/dist/src/tools/index.js +44 -14
- package/dist/src/tools/index.js.map +7 -6
- package/dist/src/x402/index.d.cts +18 -0
- package/dist/src/x402/index.d.ts +18 -0
- package/dist/src/x402/index.js +2 -2
- package/package.json +1 -1
- package/dist/shared/stacks-qk8pdyjy.cjs +0 -76
- package/dist/shared/stacks-qk8pdyjy.cjs.map +0 -14
- package/dist/shared/stacks-y8e3gx6w.js +0 -90
- package/dist/shared/stacks-y8e3gx6w.js.map +0 -14
- /package/dist/shared/{stacks-hyz7zgdk.js.map → stacks-k96f5g1a.js.map} +0 -0
|
@@ -27,109 +27,6 @@ type ProviderAccount = {
|
|
|
27
27
|
publicKey: string
|
|
28
28
|
provider: StacksProvider
|
|
29
29
|
};
|
|
30
|
-
/** Full chain descriptor used by clients and transports for network-aware operations. */
|
|
31
|
-
type StacksChain = {
|
|
32
|
-
/** Chain ID (e.g. 0x00000001 for mainnet) */
|
|
33
|
-
id: number
|
|
34
|
-
/** Human-readable name */
|
|
35
|
-
name: string
|
|
36
|
-
/** Network type */
|
|
37
|
-
network: "mainnet" | "testnet"
|
|
38
|
-
/** Transaction version byte for serialization */
|
|
39
|
-
transactionVersion: number
|
|
40
|
-
/** Peer network ID for P2P broadcasting */
|
|
41
|
-
peerNetworkId: number
|
|
42
|
-
/** Address version bytes */
|
|
43
|
-
addressVersion: {
|
|
44
|
-
singleSig: number
|
|
45
|
-
multiSig: number
|
|
46
|
-
}
|
|
47
|
-
/** Magic bytes for network identification */
|
|
48
|
-
magicBytes: string
|
|
49
|
-
/** Boot address (system contracts deployer) */
|
|
50
|
-
bootAddress: string
|
|
51
|
-
/** Native currency info */
|
|
52
|
-
nativeCurrency: {
|
|
53
|
-
name: string
|
|
54
|
-
symbol: string
|
|
55
|
-
decimals: number
|
|
56
|
-
}
|
|
57
|
-
/** Default RPC URLs */
|
|
58
|
-
rpcUrls: {
|
|
59
|
-
default: {
|
|
60
|
-
http: string[]
|
|
61
|
-
ws?: string[]
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/** Block explorer URLs */
|
|
65
|
-
blockExplorers?: {
|
|
66
|
-
default: {
|
|
67
|
-
name: string
|
|
68
|
-
url: string
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
/** Function that sends an HTTP request to a Stacks node API path. */
|
|
73
|
-
type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
|
|
74
|
-
/** Options for a transport-level HTTP request. */
|
|
75
|
-
type RequestOptions = {
|
|
76
|
-
method?: "GET" | "POST" | "PUT" | "DELETE"
|
|
77
|
-
body?: unknown
|
|
78
|
-
headers?: Record<string, string>
|
|
79
|
-
};
|
|
80
|
-
/** Shared configuration for all transport types. */
|
|
81
|
-
type TransportConfig = {
|
|
82
|
-
url?: string
|
|
83
|
-
timeout?: number
|
|
84
|
-
retryCount?: number
|
|
85
|
-
retryDelay?: number
|
|
86
|
-
fetchOptions?: RequestInit
|
|
87
|
-
apiKey?: string
|
|
88
|
-
};
|
|
89
|
-
/** A resolved transport instance with a bound request function. */
|
|
90
|
-
type Transport = {
|
|
91
|
-
type: string
|
|
92
|
-
request: RequestFn
|
|
93
|
-
config: TransportConfig
|
|
94
|
-
destroy?: () => void
|
|
95
|
-
};
|
|
96
|
-
/** Union of all supported account types (local key, custom signer, or browser provider). */
|
|
97
|
-
type Account = LocalAccount | CustomAccount | ProviderAccount;
|
|
98
|
-
/**
|
|
99
|
-
* Core client instance that holds chain context, transport, and extensible actions.
|
|
100
|
-
* Created via {@link createClient}, {@link createPublicClient}, or {@link createWalletClient}.
|
|
101
|
-
*/
|
|
102
|
-
type Client<TExtended extends Record<string, unknown> = Record<string, unknown>> = {
|
|
103
|
-
chain?: StacksChain
|
|
104
|
-
account?: Account
|
|
105
|
-
transport: Transport
|
|
106
|
-
request: RequestFn
|
|
107
|
-
extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
|
|
108
|
-
} & TExtended;
|
|
109
|
-
type GetNonceParams = {
|
|
110
|
-
address: string
|
|
111
|
-
};
|
|
112
|
-
declare function getNonce(client: Client, params: GetNonceParams): Promise<bigint>;
|
|
113
|
-
type GetBalanceParams = {
|
|
114
|
-
address: string
|
|
115
|
-
};
|
|
116
|
-
declare function getBalance(client: Client, params: GetBalanceParams): Promise<bigint>;
|
|
117
|
-
type GetAccountInfoParams = {
|
|
118
|
-
address: string
|
|
119
|
-
};
|
|
120
|
-
type AccountInfo = {
|
|
121
|
-
balance: bigint
|
|
122
|
-
nonce: bigint
|
|
123
|
-
balanceProof: string
|
|
124
|
-
nonceProof: string
|
|
125
|
-
};
|
|
126
|
-
declare function getAccountInfo(client: Client, params: GetAccountInfoParams): Promise<AccountInfo>;
|
|
127
|
-
type GetBlockParams = {
|
|
128
|
-
height?: number
|
|
129
|
-
hash?: string
|
|
130
|
-
};
|
|
131
|
-
declare function getBlock(client: Client, params?: GetBlockParams): Promise<any>;
|
|
132
|
-
declare function getBlockHeight(client: Client): Promise<number>;
|
|
133
30
|
type IntCV = {
|
|
134
31
|
readonly type: "int"
|
|
135
32
|
readonly value: bigint
|
|
@@ -192,23 +89,6 @@ type StringUtf8CV = {
|
|
|
192
89
|
readonly value: string
|
|
193
90
|
};
|
|
194
91
|
type ClarityValue = IntCV | UIntCV | BooleanCV | BufferCV | NoneCV | SomeCV | ResponseOkCV | ResponseErrorCV | StandardPrincipalCV | ContractPrincipalCV | ListCV | TupleCV | StringAsciiCV | StringUtf8CV;
|
|
195
|
-
type ReadContractParams = {
|
|
196
|
-
contract: string
|
|
197
|
-
functionName: string
|
|
198
|
-
args?: ClarityValue[]
|
|
199
|
-
sender?: string
|
|
200
|
-
};
|
|
201
|
-
declare function readContract<T extends ClarityValue = ClarityValue>(client: Client, params: ReadContractParams): Promise<T>;
|
|
202
|
-
type GetContractAbiParams = {
|
|
203
|
-
contract: string
|
|
204
|
-
};
|
|
205
|
-
declare function getContractAbi(client: Client, params: GetContractAbiParams): Promise<any>;
|
|
206
|
-
type GetMapEntryParams = {
|
|
207
|
-
contract: string
|
|
208
|
-
mapName: string
|
|
209
|
-
key: ClarityValue
|
|
210
|
-
};
|
|
211
|
-
declare function getMapEntry<T extends ClarityValue = ClarityValue>(client: Client, params: GetMapEntryParams): Promise<T>;
|
|
212
92
|
declare const AuthType: {
|
|
213
93
|
readonly Standard: 0x04
|
|
214
94
|
readonly Sponsored: 0x05
|
|
@@ -397,6 +277,144 @@ type AssetInfoWire = {
|
|
|
397
277
|
contractName: string
|
|
398
278
|
assetName: string
|
|
399
279
|
};
|
|
280
|
+
/** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */
|
|
281
|
+
type NonceManager = {
|
|
282
|
+
consume(params: {
|
|
283
|
+
client: Client
|
|
284
|
+
address: string
|
|
285
|
+
}): Promise<bigint>
|
|
286
|
+
reset(params: {
|
|
287
|
+
client: Client
|
|
288
|
+
address: string
|
|
289
|
+
}): void | Promise<void>
|
|
290
|
+
/** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
|
|
291
|
+
peek(params: {
|
|
292
|
+
client: Client
|
|
293
|
+
address: string
|
|
294
|
+
}): Promise<bigint | undefined>
|
|
295
|
+
};
|
|
296
|
+
/** Full chain descriptor used by clients and transports for network-aware operations. */
|
|
297
|
+
type StacksChain = {
|
|
298
|
+
/** Chain ID (e.g. 0x00000001 for mainnet) */
|
|
299
|
+
id: number
|
|
300
|
+
/** Human-readable name */
|
|
301
|
+
name: string
|
|
302
|
+
/** Network type */
|
|
303
|
+
network: "mainnet" | "testnet"
|
|
304
|
+
/** Transaction version byte for serialization */
|
|
305
|
+
transactionVersion: number
|
|
306
|
+
/** Peer network ID for P2P broadcasting */
|
|
307
|
+
peerNetworkId: number
|
|
308
|
+
/** Address version bytes */
|
|
309
|
+
addressVersion: {
|
|
310
|
+
singleSig: number
|
|
311
|
+
multiSig: number
|
|
312
|
+
}
|
|
313
|
+
/** Magic bytes for network identification */
|
|
314
|
+
magicBytes: string
|
|
315
|
+
/** Boot address (system contracts deployer) */
|
|
316
|
+
bootAddress: string
|
|
317
|
+
/** Native currency info */
|
|
318
|
+
nativeCurrency: {
|
|
319
|
+
name: string
|
|
320
|
+
symbol: string
|
|
321
|
+
decimals: number
|
|
322
|
+
}
|
|
323
|
+
/** Default RPC URLs */
|
|
324
|
+
rpcUrls: {
|
|
325
|
+
default: {
|
|
326
|
+
http: string[]
|
|
327
|
+
ws?: string[]
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/** Block explorer URLs */
|
|
331
|
+
blockExplorers?: {
|
|
332
|
+
default: {
|
|
333
|
+
name: string
|
|
334
|
+
url: string
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
/** Function that sends an HTTP request to a Stacks node API path. */
|
|
339
|
+
type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
|
|
340
|
+
/** Options for a transport-level HTTP request. */
|
|
341
|
+
type RequestOptions = {
|
|
342
|
+
method?: "GET" | "POST" | "PUT" | "DELETE"
|
|
343
|
+
body?: unknown
|
|
344
|
+
headers?: Record<string, string>
|
|
345
|
+
};
|
|
346
|
+
/** Shared configuration for all transport types. */
|
|
347
|
+
type TransportConfig = {
|
|
348
|
+
url?: string
|
|
349
|
+
timeout?: number
|
|
350
|
+
retryCount?: number
|
|
351
|
+
retryDelay?: number
|
|
352
|
+
fetchOptions?: RequestInit
|
|
353
|
+
apiKey?: string
|
|
354
|
+
};
|
|
355
|
+
/** A resolved transport instance with a bound request function. */
|
|
356
|
+
type Transport = {
|
|
357
|
+
type: string
|
|
358
|
+
request: RequestFn
|
|
359
|
+
config: TransportConfig
|
|
360
|
+
destroy?: () => void
|
|
361
|
+
};
|
|
362
|
+
/** Union of all supported account types (local key, custom signer, or browser provider). */
|
|
363
|
+
type Account = LocalAccount | CustomAccount | ProviderAccount;
|
|
364
|
+
/**
|
|
365
|
+
* Core client instance that holds chain context, transport, and extensible actions.
|
|
366
|
+
* Created via {@link createClient}, {@link createPublicClient}, or {@link createWalletClient}.
|
|
367
|
+
*/
|
|
368
|
+
type Client<TExtended extends Record<string, unknown> = Record<string, unknown>> = {
|
|
369
|
+
chain?: StacksChain
|
|
370
|
+
account?: Account
|
|
371
|
+
transport: Transport
|
|
372
|
+
request: RequestFn
|
|
373
|
+
/** Optional nonce manager for mempool-safe sequential nonces across rapid broadcasts. */
|
|
374
|
+
nonceManager?: NonceManager
|
|
375
|
+
extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
|
|
376
|
+
} & TExtended;
|
|
377
|
+
type GetNonceParams = {
|
|
378
|
+
address: string
|
|
379
|
+
};
|
|
380
|
+
declare function getNonce(client: Client, params: GetNonceParams): Promise<bigint>;
|
|
381
|
+
type GetBalanceParams = {
|
|
382
|
+
address: string
|
|
383
|
+
};
|
|
384
|
+
declare function getBalance(client: Client, params: GetBalanceParams): Promise<bigint>;
|
|
385
|
+
type GetAccountInfoParams = {
|
|
386
|
+
address: string
|
|
387
|
+
};
|
|
388
|
+
type AccountInfo = {
|
|
389
|
+
balance: bigint
|
|
390
|
+
nonce: bigint
|
|
391
|
+
balanceProof: string
|
|
392
|
+
nonceProof: string
|
|
393
|
+
};
|
|
394
|
+
declare function getAccountInfo(client: Client, params: GetAccountInfoParams): Promise<AccountInfo>;
|
|
395
|
+
type GetBlockParams = {
|
|
396
|
+
height?: number
|
|
397
|
+
hash?: string
|
|
398
|
+
};
|
|
399
|
+
declare function getBlock(client: Client, params?: GetBlockParams): Promise<any>;
|
|
400
|
+
declare function getBlockHeight(client: Client): Promise<number>;
|
|
401
|
+
type ReadContractParams = {
|
|
402
|
+
contract: string
|
|
403
|
+
functionName: string
|
|
404
|
+
args?: ClarityValue[]
|
|
405
|
+
sender?: string
|
|
406
|
+
};
|
|
407
|
+
declare function readContract<T extends ClarityValue = ClarityValue>(client: Client, params: ReadContractParams): Promise<T>;
|
|
408
|
+
type GetContractAbiParams = {
|
|
409
|
+
contract: string
|
|
410
|
+
};
|
|
411
|
+
declare function getContractAbi(client: Client, params: GetContractAbiParams): Promise<any>;
|
|
412
|
+
type GetMapEntryParams = {
|
|
413
|
+
contract: string
|
|
414
|
+
mapName: string
|
|
415
|
+
key: ClarityValue
|
|
416
|
+
};
|
|
417
|
+
declare function getMapEntry<T extends ClarityValue = ClarityValue>(client: Client, params: GetMapEntryParams): Promise<T>;
|
|
400
418
|
type EstimateFeeParams = {
|
|
401
419
|
transaction: StacksTransaction
|
|
402
420
|
};
|
|
@@ -27,109 +27,6 @@ type ProviderAccount = {
|
|
|
27
27
|
publicKey: string
|
|
28
28
|
provider: StacksProvider
|
|
29
29
|
};
|
|
30
|
-
/** Full chain descriptor used by clients and transports for network-aware operations. */
|
|
31
|
-
type StacksChain = {
|
|
32
|
-
/** Chain ID (e.g. 0x00000001 for mainnet) */
|
|
33
|
-
id: number
|
|
34
|
-
/** Human-readable name */
|
|
35
|
-
name: string
|
|
36
|
-
/** Network type */
|
|
37
|
-
network: "mainnet" | "testnet"
|
|
38
|
-
/** Transaction version byte for serialization */
|
|
39
|
-
transactionVersion: number
|
|
40
|
-
/** Peer network ID for P2P broadcasting */
|
|
41
|
-
peerNetworkId: number
|
|
42
|
-
/** Address version bytes */
|
|
43
|
-
addressVersion: {
|
|
44
|
-
singleSig: number
|
|
45
|
-
multiSig: number
|
|
46
|
-
}
|
|
47
|
-
/** Magic bytes for network identification */
|
|
48
|
-
magicBytes: string
|
|
49
|
-
/** Boot address (system contracts deployer) */
|
|
50
|
-
bootAddress: string
|
|
51
|
-
/** Native currency info */
|
|
52
|
-
nativeCurrency: {
|
|
53
|
-
name: string
|
|
54
|
-
symbol: string
|
|
55
|
-
decimals: number
|
|
56
|
-
}
|
|
57
|
-
/** Default RPC URLs */
|
|
58
|
-
rpcUrls: {
|
|
59
|
-
default: {
|
|
60
|
-
http: string[]
|
|
61
|
-
ws?: string[]
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/** Block explorer URLs */
|
|
65
|
-
blockExplorers?: {
|
|
66
|
-
default: {
|
|
67
|
-
name: string
|
|
68
|
-
url: string
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
/** Function that sends an HTTP request to a Stacks node API path. */
|
|
73
|
-
type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
|
|
74
|
-
/** Options for a transport-level HTTP request. */
|
|
75
|
-
type RequestOptions = {
|
|
76
|
-
method?: "GET" | "POST" | "PUT" | "DELETE"
|
|
77
|
-
body?: unknown
|
|
78
|
-
headers?: Record<string, string>
|
|
79
|
-
};
|
|
80
|
-
/** Shared configuration for all transport types. */
|
|
81
|
-
type TransportConfig = {
|
|
82
|
-
url?: string
|
|
83
|
-
timeout?: number
|
|
84
|
-
retryCount?: number
|
|
85
|
-
retryDelay?: number
|
|
86
|
-
fetchOptions?: RequestInit
|
|
87
|
-
apiKey?: string
|
|
88
|
-
};
|
|
89
|
-
/** A resolved transport instance with a bound request function. */
|
|
90
|
-
type Transport = {
|
|
91
|
-
type: string
|
|
92
|
-
request: RequestFn
|
|
93
|
-
config: TransportConfig
|
|
94
|
-
destroy?: () => void
|
|
95
|
-
};
|
|
96
|
-
/** Union of all supported account types (local key, custom signer, or browser provider). */
|
|
97
|
-
type Account = LocalAccount | CustomAccount | ProviderAccount;
|
|
98
|
-
/**
|
|
99
|
-
* Core client instance that holds chain context, transport, and extensible actions.
|
|
100
|
-
* Created via {@link createClient}, {@link createPublicClient}, or {@link createWalletClient}.
|
|
101
|
-
*/
|
|
102
|
-
type Client<TExtended extends Record<string, unknown> = Record<string, unknown>> = {
|
|
103
|
-
chain?: StacksChain
|
|
104
|
-
account?: Account
|
|
105
|
-
transport: Transport
|
|
106
|
-
request: RequestFn
|
|
107
|
-
extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
|
|
108
|
-
} & TExtended;
|
|
109
|
-
type GetNonceParams = {
|
|
110
|
-
address: string
|
|
111
|
-
};
|
|
112
|
-
declare function getNonce(client: Client, params: GetNonceParams): Promise<bigint>;
|
|
113
|
-
type GetBalanceParams = {
|
|
114
|
-
address: string
|
|
115
|
-
};
|
|
116
|
-
declare function getBalance(client: Client, params: GetBalanceParams): Promise<bigint>;
|
|
117
|
-
type GetAccountInfoParams = {
|
|
118
|
-
address: string
|
|
119
|
-
};
|
|
120
|
-
type AccountInfo = {
|
|
121
|
-
balance: bigint
|
|
122
|
-
nonce: bigint
|
|
123
|
-
balanceProof: string
|
|
124
|
-
nonceProof: string
|
|
125
|
-
};
|
|
126
|
-
declare function getAccountInfo(client: Client, params: GetAccountInfoParams): Promise<AccountInfo>;
|
|
127
|
-
type GetBlockParams = {
|
|
128
|
-
height?: number
|
|
129
|
-
hash?: string
|
|
130
|
-
};
|
|
131
|
-
declare function getBlock(client: Client, params?: GetBlockParams): Promise<any>;
|
|
132
|
-
declare function getBlockHeight(client: Client): Promise<number>;
|
|
133
30
|
type IntCV = {
|
|
134
31
|
readonly type: "int"
|
|
135
32
|
readonly value: bigint
|
|
@@ -192,23 +89,6 @@ type StringUtf8CV = {
|
|
|
192
89
|
readonly value: string
|
|
193
90
|
};
|
|
194
91
|
type ClarityValue = IntCV | UIntCV | BooleanCV | BufferCV | NoneCV | SomeCV | ResponseOkCV | ResponseErrorCV | StandardPrincipalCV | ContractPrincipalCV | ListCV | TupleCV | StringAsciiCV | StringUtf8CV;
|
|
195
|
-
type ReadContractParams = {
|
|
196
|
-
contract: string
|
|
197
|
-
functionName: string
|
|
198
|
-
args?: ClarityValue[]
|
|
199
|
-
sender?: string
|
|
200
|
-
};
|
|
201
|
-
declare function readContract<T extends ClarityValue = ClarityValue>(client: Client, params: ReadContractParams): Promise<T>;
|
|
202
|
-
type GetContractAbiParams = {
|
|
203
|
-
contract: string
|
|
204
|
-
};
|
|
205
|
-
declare function getContractAbi(client: Client, params: GetContractAbiParams): Promise<any>;
|
|
206
|
-
type GetMapEntryParams = {
|
|
207
|
-
contract: string
|
|
208
|
-
mapName: string
|
|
209
|
-
key: ClarityValue
|
|
210
|
-
};
|
|
211
|
-
declare function getMapEntry<T extends ClarityValue = ClarityValue>(client: Client, params: GetMapEntryParams): Promise<T>;
|
|
212
92
|
declare const AuthType: {
|
|
213
93
|
readonly Standard: 0x04
|
|
214
94
|
readonly Sponsored: 0x05
|
|
@@ -397,6 +277,144 @@ type AssetInfoWire = {
|
|
|
397
277
|
contractName: string
|
|
398
278
|
assetName: string
|
|
399
279
|
};
|
|
280
|
+
/** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */
|
|
281
|
+
type NonceManager = {
|
|
282
|
+
consume(params: {
|
|
283
|
+
client: Client
|
|
284
|
+
address: string
|
|
285
|
+
}): Promise<bigint>
|
|
286
|
+
reset(params: {
|
|
287
|
+
client: Client
|
|
288
|
+
address: string
|
|
289
|
+
}): void | Promise<void>
|
|
290
|
+
/** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
|
|
291
|
+
peek(params: {
|
|
292
|
+
client: Client
|
|
293
|
+
address: string
|
|
294
|
+
}): Promise<bigint | undefined>
|
|
295
|
+
};
|
|
296
|
+
/** Full chain descriptor used by clients and transports for network-aware operations. */
|
|
297
|
+
type StacksChain = {
|
|
298
|
+
/** Chain ID (e.g. 0x00000001 for mainnet) */
|
|
299
|
+
id: number
|
|
300
|
+
/** Human-readable name */
|
|
301
|
+
name: string
|
|
302
|
+
/** Network type */
|
|
303
|
+
network: "mainnet" | "testnet"
|
|
304
|
+
/** Transaction version byte for serialization */
|
|
305
|
+
transactionVersion: number
|
|
306
|
+
/** Peer network ID for P2P broadcasting */
|
|
307
|
+
peerNetworkId: number
|
|
308
|
+
/** Address version bytes */
|
|
309
|
+
addressVersion: {
|
|
310
|
+
singleSig: number
|
|
311
|
+
multiSig: number
|
|
312
|
+
}
|
|
313
|
+
/** Magic bytes for network identification */
|
|
314
|
+
magicBytes: string
|
|
315
|
+
/** Boot address (system contracts deployer) */
|
|
316
|
+
bootAddress: string
|
|
317
|
+
/** Native currency info */
|
|
318
|
+
nativeCurrency: {
|
|
319
|
+
name: string
|
|
320
|
+
symbol: string
|
|
321
|
+
decimals: number
|
|
322
|
+
}
|
|
323
|
+
/** Default RPC URLs */
|
|
324
|
+
rpcUrls: {
|
|
325
|
+
default: {
|
|
326
|
+
http: string[]
|
|
327
|
+
ws?: string[]
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/** Block explorer URLs */
|
|
331
|
+
blockExplorers?: {
|
|
332
|
+
default: {
|
|
333
|
+
name: string
|
|
334
|
+
url: string
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
/** Function that sends an HTTP request to a Stacks node API path. */
|
|
339
|
+
type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
|
|
340
|
+
/** Options for a transport-level HTTP request. */
|
|
341
|
+
type RequestOptions = {
|
|
342
|
+
method?: "GET" | "POST" | "PUT" | "DELETE"
|
|
343
|
+
body?: unknown
|
|
344
|
+
headers?: Record<string, string>
|
|
345
|
+
};
|
|
346
|
+
/** Shared configuration for all transport types. */
|
|
347
|
+
type TransportConfig = {
|
|
348
|
+
url?: string
|
|
349
|
+
timeout?: number
|
|
350
|
+
retryCount?: number
|
|
351
|
+
retryDelay?: number
|
|
352
|
+
fetchOptions?: RequestInit
|
|
353
|
+
apiKey?: string
|
|
354
|
+
};
|
|
355
|
+
/** A resolved transport instance with a bound request function. */
|
|
356
|
+
type Transport = {
|
|
357
|
+
type: string
|
|
358
|
+
request: RequestFn
|
|
359
|
+
config: TransportConfig
|
|
360
|
+
destroy?: () => void
|
|
361
|
+
};
|
|
362
|
+
/** Union of all supported account types (local key, custom signer, or browser provider). */
|
|
363
|
+
type Account = LocalAccount | CustomAccount | ProviderAccount;
|
|
364
|
+
/**
|
|
365
|
+
* Core client instance that holds chain context, transport, and extensible actions.
|
|
366
|
+
* Created via {@link createClient}, {@link createPublicClient}, or {@link createWalletClient}.
|
|
367
|
+
*/
|
|
368
|
+
type Client<TExtended extends Record<string, unknown> = Record<string, unknown>> = {
|
|
369
|
+
chain?: StacksChain
|
|
370
|
+
account?: Account
|
|
371
|
+
transport: Transport
|
|
372
|
+
request: RequestFn
|
|
373
|
+
/** Optional nonce manager for mempool-safe sequential nonces across rapid broadcasts. */
|
|
374
|
+
nonceManager?: NonceManager
|
|
375
|
+
extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
|
|
376
|
+
} & TExtended;
|
|
377
|
+
type GetNonceParams = {
|
|
378
|
+
address: string
|
|
379
|
+
};
|
|
380
|
+
declare function getNonce(client: Client, params: GetNonceParams): Promise<bigint>;
|
|
381
|
+
type GetBalanceParams = {
|
|
382
|
+
address: string
|
|
383
|
+
};
|
|
384
|
+
declare function getBalance(client: Client, params: GetBalanceParams): Promise<bigint>;
|
|
385
|
+
type GetAccountInfoParams = {
|
|
386
|
+
address: string
|
|
387
|
+
};
|
|
388
|
+
type AccountInfo = {
|
|
389
|
+
balance: bigint
|
|
390
|
+
nonce: bigint
|
|
391
|
+
balanceProof: string
|
|
392
|
+
nonceProof: string
|
|
393
|
+
};
|
|
394
|
+
declare function getAccountInfo(client: Client, params: GetAccountInfoParams): Promise<AccountInfo>;
|
|
395
|
+
type GetBlockParams = {
|
|
396
|
+
height?: number
|
|
397
|
+
hash?: string
|
|
398
|
+
};
|
|
399
|
+
declare function getBlock(client: Client, params?: GetBlockParams): Promise<any>;
|
|
400
|
+
declare function getBlockHeight(client: Client): Promise<number>;
|
|
401
|
+
type ReadContractParams = {
|
|
402
|
+
contract: string
|
|
403
|
+
functionName: string
|
|
404
|
+
args?: ClarityValue[]
|
|
405
|
+
sender?: string
|
|
406
|
+
};
|
|
407
|
+
declare function readContract<T extends ClarityValue = ClarityValue>(client: Client, params: ReadContractParams): Promise<T>;
|
|
408
|
+
type GetContractAbiParams = {
|
|
409
|
+
contract: string
|
|
410
|
+
};
|
|
411
|
+
declare function getContractAbi(client: Client, params: GetContractAbiParams): Promise<any>;
|
|
412
|
+
type GetMapEntryParams = {
|
|
413
|
+
contract: string
|
|
414
|
+
mapName: string
|
|
415
|
+
key: ClarityValue
|
|
416
|
+
};
|
|
417
|
+
declare function getMapEntry<T extends ClarityValue = ClarityValue>(client: Client, params: GetMapEntryParams): Promise<T>;
|
|
400
418
|
type EstimateFeeParams = {
|
|
401
419
|
transaction: StacksTransaction
|
|
402
420
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ContractResponseError,
|
|
3
3
|
getContract
|
|
4
|
-
} from "../../shared/stacks-
|
|
4
|
+
} from "../../shared/stacks-k96f5g1a.js";
|
|
5
5
|
import {
|
|
6
6
|
deployContract,
|
|
7
7
|
getAccountInfo,
|
|
@@ -15,12 +15,12 @@ import {
|
|
|
15
15
|
simulateCall,
|
|
16
16
|
simulateTransaction,
|
|
17
17
|
transferStx
|
|
18
|
-
} from "../../shared/stacks-
|
|
18
|
+
} from "../../shared/stacks-a48qj7ss.js";
|
|
19
19
|
import {
|
|
20
20
|
callContract,
|
|
21
21
|
getMapEntry,
|
|
22
22
|
readContract
|
|
23
|
-
} from "../../shared/stacks-
|
|
23
|
+
} from "../../shared/stacks-txh6dadn.js";
|
|
24
24
|
import {
|
|
25
25
|
watchAddress,
|
|
26
26
|
watchAddressBalance,
|
|
@@ -31,13 +31,13 @@ import {
|
|
|
31
31
|
} from "../../shared/stacks-tjjnkt3r.js";
|
|
32
32
|
import {
|
|
33
33
|
sponsorTransaction
|
|
34
|
-
} from "../../shared/stacks-
|
|
34
|
+
} from "../../shared/stacks-s6v8k4j5.js";
|
|
35
35
|
import {
|
|
36
36
|
estimateFee,
|
|
37
37
|
getNonce,
|
|
38
38
|
isProviderAccount,
|
|
39
39
|
sendTransaction
|
|
40
|
-
} from "../../shared/stacks-
|
|
40
|
+
} from "../../shared/stacks-r3mqgw2d.js";
|
|
41
41
|
import"../../shared/stacks-709tra19.js";
|
|
42
42
|
import"../../shared/stacks-g7ffp8aj.js";
|
|
43
43
|
import"../../shared/stacks-wqgepfab.js";
|
package/dist/src/bns/index.d.cts
CHANGED
|
@@ -27,6 +27,22 @@ type ProviderAccount = {
|
|
|
27
27
|
publicKey: string
|
|
28
28
|
provider: StacksProvider
|
|
29
29
|
};
|
|
30
|
+
/** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */
|
|
31
|
+
type NonceManager = {
|
|
32
|
+
consume(params: {
|
|
33
|
+
client: Client
|
|
34
|
+
address: string
|
|
35
|
+
}): Promise<bigint>
|
|
36
|
+
reset(params: {
|
|
37
|
+
client: Client
|
|
38
|
+
address: string
|
|
39
|
+
}): void | Promise<void>
|
|
40
|
+
/** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
|
|
41
|
+
peek(params: {
|
|
42
|
+
client: Client
|
|
43
|
+
address: string
|
|
44
|
+
}): Promise<bigint | undefined>
|
|
45
|
+
};
|
|
30
46
|
/** Full chain descriptor used by clients and transports for network-aware operations. */
|
|
31
47
|
type StacksChain = {
|
|
32
48
|
/** Chain ID (e.g. 0x00000001 for mainnet) */
|
|
@@ -104,6 +120,8 @@ type Client<TExtended extends Record<string, unknown> = Record<string, unknown>>
|
|
|
104
120
|
account?: Account
|
|
105
121
|
transport: Transport
|
|
106
122
|
request: RequestFn
|
|
123
|
+
/** Optional nonce manager for mempool-safe sequential nonces across rapid broadcasts. */
|
|
124
|
+
nonceManager?: NonceManager
|
|
107
125
|
extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
|
|
108
126
|
} & TExtended;
|
|
109
127
|
interface FullyQualifiedName {
|
package/dist/src/bns/index.d.ts
CHANGED
|
@@ -27,6 +27,22 @@ type ProviderAccount = {
|
|
|
27
27
|
publicKey: string
|
|
28
28
|
provider: StacksProvider
|
|
29
29
|
};
|
|
30
|
+
/** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */
|
|
31
|
+
type NonceManager = {
|
|
32
|
+
consume(params: {
|
|
33
|
+
client: Client
|
|
34
|
+
address: string
|
|
35
|
+
}): Promise<bigint>
|
|
36
|
+
reset(params: {
|
|
37
|
+
client: Client
|
|
38
|
+
address: string
|
|
39
|
+
}): void | Promise<void>
|
|
40
|
+
/** Next nonce that {@link NonceManager.consume} would return without consuming it, or `undefined` if untracked. */
|
|
41
|
+
peek(params: {
|
|
42
|
+
client: Client
|
|
43
|
+
address: string
|
|
44
|
+
}): Promise<bigint | undefined>
|
|
45
|
+
};
|
|
30
46
|
/** Full chain descriptor used by clients and transports for network-aware operations. */
|
|
31
47
|
type StacksChain = {
|
|
32
48
|
/** Chain ID (e.g. 0x00000001 for mainnet) */
|
|
@@ -104,6 +120,8 @@ type Client<TExtended extends Record<string, unknown> = Record<string, unknown>>
|
|
|
104
120
|
account?: Account
|
|
105
121
|
transport: Transport
|
|
106
122
|
request: RequestFn
|
|
123
|
+
/** Optional nonce manager for mempool-safe sequential nonces across rapid broadcasts. */
|
|
124
|
+
nonceManager?: NonceManager
|
|
107
125
|
extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
|
|
108
126
|
} & TExtended;
|
|
109
127
|
interface FullyQualifiedName {
|
package/dist/src/bns/index.js
CHANGED
|
@@ -3,9 +3,9 @@ import"../../shared/stacks-kg1npstf.js";
|
|
|
3
3
|
import {
|
|
4
4
|
ContractResponseError,
|
|
5
5
|
getContract
|
|
6
|
-
} from "../../shared/stacks-
|
|
7
|
-
import"../../shared/stacks-
|
|
8
|
-
import"../../shared/stacks-
|
|
6
|
+
} from "../../shared/stacks-k96f5g1a.js";
|
|
7
|
+
import"../../shared/stacks-txh6dadn.js";
|
|
8
|
+
import"../../shared/stacks-r3mqgw2d.js";
|
|
9
9
|
import"../../shared/stacks-709tra19.js";
|
|
10
10
|
import"../../shared/stacks-g7ffp8aj.js";
|
|
11
11
|
import"../../shared/stacks-z53fwfcm.js";
|