stxer 0.4.5 → 0.6.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # stxer SDK
2
2
 
3
- A powerful SDK for Stacks blockchain that provides batch operations and transaction simulation capabilities.
3
+ A powerful SDK for Stacks blockchain that provides transaction simulation, batch operations, contract AST parsing, and chain tip information.
4
4
 
5
5
  ## Installation
6
6
 
@@ -12,36 +12,252 @@ yarn add stxer
12
12
 
13
13
  ## Features
14
14
 
15
- ### 1. Transaction Simulation
15
+ ### 1. Transaction Simulation (V2 API)
16
16
 
17
- Simulate complex transaction sequences before executing them on-chain:
17
+ Simulate complex transaction sequences before executing them on-chain. The SDK supports all V2 step types:
18
+
19
+ #### Basic Simulation
18
20
 
19
21
  ```typescript
20
22
  import { SimulationBuilder } from 'stxer';
21
23
 
22
24
  const simulationId = await SimulationBuilder.new({
23
25
  network: 'mainnet', // or 'testnet'
26
+ skipTracing: false, // Set to true for faster simulations without debug info
24
27
  })
25
- .withSender('ST...') // Set default sender
28
+ .useBlockHeight(130818) // Optional: use specific block height
29
+ .withSender('SP...') // Set default sender
26
30
  .addContractCall({
27
- contract_id: 'ST...contract-name',
31
+ contract_id: 'SP...contract-name',
28
32
  function_name: 'my-function',
29
- function_args: [/* clarity values */]
33
+ function_args: [/* clarity values */],
34
+ sender: 'SP...', // Optional: overrides default sender
35
+ fee: 100, // Optional: fee in microSTX
30
36
  })
31
37
  .addSTXTransfer({
32
- recipient: 'ST...',
33
- amount: 1000000 // in microSTX
38
+ recipient: 'SP...',
39
+ amount: 1000000, // in microSTX
40
+ })
41
+ .addContractDeploy({
42
+ contract_name: 'my-contract',
43
+ source_code: '(define-public (hello) (ok "world"))',
44
+ deployer: 'SP...', // Optional: overrides default sender
45
+ clarity_version: 4, // Optional: Clarity1, Clarity2, Clarity3, or Clarity4
46
+ })
47
+ .run();
48
+
49
+ // View simulation results at: https://stxer.xyz/simulations/mainnet/{simulationId}
50
+ ```
51
+
52
+ #### Advanced V2 Step Types
53
+
54
+ The SDK supports all V2 simulation step types:
55
+
56
+ ```typescript
57
+ import { SimulationBuilder, ClarityVersion } from 'stxer';
58
+
59
+ const simulationId = await SimulationBuilder.new()
60
+ .withSender('SP...')
61
+
62
+ // === Transaction Steps ===
63
+ // STX Transfer
64
+ .addSTXTransfer({ recipient: 'SP...', amount: 1000 })
65
+
66
+ // Contract Call
67
+ .addContractCall({
68
+ contract_id: 'SP...contract',
69
+ function_name: 'my-function',
70
+ function_args: [boolCV(true), uintCV(123)],
34
71
  })
72
+
73
+ // Contract Deploy
35
74
  .addContractDeploy({
36
75
  contract_name: 'my-contract',
37
- source_code: '(define-public (hello) (ok "world"))'
76
+ source_code: '(define-data-var counter uint u0)',
77
+ clarity_version: ClarityVersion.Clarity4,
78
+ })
79
+
80
+ // === Eval Steps ===
81
+ // Read state
82
+ .addEvalCode('SP...contract', '(var-get counter)')
83
+
84
+ // Modify state
85
+ .addEvalCode('SP...contract', '(var-set counter u100)')
86
+
87
+ // === SetContractCode Step ===
88
+ // Directly set contract code without a transaction
89
+ .addSetContractCode({
90
+ contract_id: 'SP...contract',
91
+ source_code: '(define-data-var enabled bool false)',
92
+ clarity_version: ClarityVersion.Clarity4,
38
93
  })
94
+
95
+ // === Reads Batch Step ===
96
+ // Batch multiple read operations in a single step
97
+ .addReads([
98
+ { DataVar: ['SP...contract', 'counter'] },
99
+ { DataVar: ['SP...contract', 'enabled'] },
100
+ { StxBalance: 'SP...' },
101
+ { Nonce: 'SP...' },
102
+ { EvalReadonly: ['SP...', '', 'SP...contract', '(get-counter)'] },
103
+ ])
104
+
105
+ // === TenureExtend Step ===
106
+ // Extend tenure (resets execution cost)
107
+ .addTenureExtend()
108
+
39
109
  .run();
110
+ ```
111
+
112
+ #### Reads Batch Sub-Types
113
+
114
+ The `Reads` step supports multiple read operation types:
115
+
116
+ ```typescript
117
+ .addReads([
118
+ // Read a data variable
119
+ { DataVar: ['SP...contract', 'my-var'] },
120
+
121
+ // Read a map entry (key must be hex-encoded Clarity value)
122
+ { MapEntry: ['SP...contract', 'my-map', '0x0...'] },
123
+
124
+ // Call a read-only function
125
+ { EvalReadonly: ['SP...', '', 'SP...contract', '(my-function)'] },
126
+
127
+ // Read STX balance
128
+ { StxBalance: 'SP...' },
129
+
130
+ // Read fungible token balance
131
+ { FtBalance: ['SP...token-contract', 'token-name', 'SP...principal'] },
132
+
133
+ // Read fungible token supply
134
+ { FtSupply: ['SP...token-contract', 'token-name'] },
135
+
136
+ // Read account nonce
137
+ { Nonce: 'SP...' },
138
+ ])
139
+ ```
140
+
141
+ ### 2. Programmatic Simulation APIs
142
+
143
+ For advanced use cases where you need more control than `SimulationBuilder` provides, the SDK exposes low-level programmatic APIs that directly map to the stxer V2 simulation endpoints.
144
+
145
+ #### Instant Simulation
146
+
147
+ Simulate a single transaction without creating a session. Useful for apps/wallets to preview transaction results before sending:
148
+
149
+ ```typescript
150
+ import { instantSimulation } from 'stxer';
151
+
152
+ const result = await instantSimulation({
153
+ transaction: '0x...', // Hex-encoded transaction
154
+ reads: [
155
+ { DataVar: ['SP...contract', 'my-var'] },
156
+ { StxBalance: 'SP...' }
157
+ ]
158
+ });
159
+
160
+ console.log(result.receipt.result); // Transaction result
161
+ console.log(result.reads); // Optional read results
162
+ ```
163
+
164
+ #### Session-Based Simulation
165
+
166
+ For more complex scenarios with multiple steps:
167
+
168
+ ```typescript
169
+ import {
170
+ createSimulationSession,
171
+ submitSimulationSteps,
172
+ getSimulationResult,
173
+ simulationBatchReads
174
+ } from 'stxer';
175
+
176
+ // 1. Create a simulation session
177
+ const sessionId = await createSimulationSession({
178
+ skip_tracing: false // Set to true for faster simulations
179
+ });
180
+
181
+ // 2. Submit steps to the session
182
+ const stepResults = await submitSimulationSteps(sessionId, {
183
+ steps: [
184
+ { Transaction: '0x...' },
185
+ { Eval: ['SP...', '', 'SP...contract', '(var-get my-var)'] },
186
+ { SetContractCode: ['SP...contract', '(define-data-var x uint u0)', 4] },
187
+ { Reads: [
188
+ { DataVar: ['SP...contract', 'my-var'] },
189
+ { StxBalance: 'SP...' }
190
+ ]},
191
+ { TenureExtend: [] }
192
+ ]
193
+ });
194
+
195
+ console.log(`Executed ${stepResults.steps.length} steps`);
196
+
197
+ // 3. Get full simulation results
198
+ const result = await getSimulationResult(sessionId);
199
+ console.log(result.metadata);
200
+ console.log(result.steps);
40
201
 
41
- // View simulation results at: https://stxer.xyz/simulations/{network}/{simulationId}
202
+ // 4. Batch reads from simulation state
203
+ const reads = await simulationBatchReads(sessionId, {
204
+ vars: [['SP...contract', 'my-var']],
205
+ maps: [['SP...contract', 'my-map', '0x...']],
206
+ stx: ['SP...']
207
+ });
208
+ console.log(reads.vars);
209
+ console.log(reads.stx);
210
+ ```
211
+
212
+ #### API Options
213
+
214
+ All programmatic APIs accept an optional `stxerApi` parameter to customize the endpoint:
215
+
216
+ ```typescript
217
+ const sessionId = await createSimulationSession(
218
+ { skip_tracing: true },
219
+ { stxerApi: 'https://testnet-api.stxer.xyz' }
220
+ );
221
+ ```
222
+
223
+ ### 3. Get Chain Tip
224
+
225
+ Fetch the current chain tip information:
226
+
227
+ ```typescript
228
+ import { getTip, type SidecarTip } from 'stxer';
229
+
230
+ const tip: SidecarTip = await getTip();
231
+ console.log(`Current block: ${tip.block_height}`);
232
+ console.log(`Block hash: ${tip.block_hash}`);
233
+ console.log(`Bitcoin height: ${tip.bitcoin_height}`);
234
+ console.log(`Tenure cost: ${tip.tenure_cost}`);
235
+ ```
236
+
237
+ ### 4. Contract AST Operations
238
+
239
+ Fetch or parse contract Abstract Syntax Trees:
240
+
241
+ ```typescript
242
+ import { getContractAST, parseContract } from 'stxer';
243
+
244
+ // Fetch on-chain contract AST
245
+ const ast = await getContractAST({
246
+ contractId: 'SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-pool-v2-01'
247
+ });
248
+ console.log(ast.source_code);
249
+ console.log(ast.abi);
250
+
251
+ // Parse local source code
252
+ const parsed = await parseContract({
253
+ contractId: 'SP...contract-name',
254
+ sourceCode: '(define-public (hello) (ok "world"))',
255
+ clarityVersion: '4', // Optional: '1' | '2' | '3' | '4'
256
+ epoch: 'Epoch33' // Optional
257
+ });
42
258
  ```
43
259
 
44
- ### 2. Batch Operations
260
+ ### 5. Batch Operations
45
261
 
46
262
  The SDK provides two approaches for efficient batch reading from the Stacks blockchain:
47
263
 
@@ -123,7 +339,7 @@ The BatchProcessor automatically:
123
339
 
124
340
  This is particularly useful when you need to make multiple blockchain reads and want to optimize network calls.
125
341
 
126
- ### 3. Clarity API Utilities
342
+ ### 6. Clarity API Utilities
127
343
 
128
344
  The SDK provides convenient utilities for reading data from Clarity contracts:
129
345
 
@@ -159,16 +375,106 @@ These utilities provide type-safe ways to interact with Clarity contracts, with
159
375
 
160
376
  ## Configuration
161
377
 
162
- You can customize the API endpoints:
378
+ ### API Endpoint Constants
379
+
380
+ The SDK exports constants for stxer API endpoints:
163
381
 
164
382
  ```typescript
383
+ import { STXER_API_MAINNET, STXER_API_TESTNET } from 'stxer';
384
+
385
+ console.log(STXER_API_MAINNET); // https://api.stxer.xyz
386
+ console.log(STXER_API_TESTNET); // https://testnet-api.stxer.xyz
387
+ ```
388
+
389
+ ### Customizing API Endpoints
390
+
391
+ You can customize the API endpoints for all operations:
392
+
393
+ ```typescript
394
+ import { SimulationBuilder, STXER_API_TESTNET } from 'stxer';
395
+
165
396
  const builder = SimulationBuilder.new({
166
- apiEndpoint: 'https://api.stxer.xyz', // Default stxer API endpoint
167
- stacksNodeAPI: 'https://api.hiro.so', // Default Stacks API endpoint
168
- network: 'mainnet' // or 'testnet'
397
+ apiEndpoint: STXER_API_TESTNET, // Use testnet
398
+ stacksNodeAPI: 'https://api.testnet.hiro.so', // Testnet Stacks API
399
+ network: 'testnet',
400
+ skipTracing: false, // Set to true for faster simulations (no debug UI support)
169
401
  });
170
402
  ```
171
403
 
404
+ For `getTip` and AST operations:
405
+
406
+ ```typescript
407
+ import { getTip, getContractAST, parseContract, STXER_API_MAINNET } from 'stxer';
408
+
409
+ const tip = await getTip({
410
+ stxerApi: STXER_API_MAINNET // Optional, defaults to mainnet
411
+ });
412
+
413
+ const ast = await getContractAST({
414
+ contractId: 'SP...contract',
415
+ stxerApi: STXER_API_MAINNET // Optional
416
+ });
417
+ ```
418
+
419
+ ## API Reference
420
+
421
+ ### Constants
422
+
423
+ - `STXER_API_MAINNET` - Mainnet API endpoint (https://api.stxer.xyz)
424
+ - `STXER_API_TESTNET` - Testnet API endpoint (https://testnet-api.stxer.xyz)
425
+ - `DEFAULT_STXER_API` - Default API endpoint (same as STXER_API_MAINNET)
426
+
427
+ ### Simulation Builder (High-Level)
428
+
429
+ - `SimulationBuilder.new(options)` - Create a new simulation builder
430
+ - `builder.useBlockHeight(height)` - Set block height for simulation
431
+ - `builder.withSender(address)` - Set default sender address
432
+
433
+ **Transaction Steps:**
434
+ - `builder.addContractCall(params)` - Add a contract call step
435
+ - `builder.addSTXTransfer(params)` - Add an STX transfer step
436
+ - `builder.addContractDeploy(params)` - Add a contract deployment step
437
+
438
+ **V2 Step Types:**
439
+ - `builder.addEvalCode(contractId, code)` - Add arbitrary code evaluation (with state modification)
440
+ - `builder.addSetContractCode(params)` - Directly set contract code without transaction
441
+ - `builder.addReads(reads[])` - Batch read operations in a single step
442
+ - `builder.addTenureExtend()` - Extend tenure (resets execution cost)
443
+
444
+ **Execution:**
445
+ - `builder.run()` - Execute the simulation and return simulation ID
446
+
447
+ ### Programmatic Simulation APIs (Low-Level)
448
+
449
+ **Instant Simulation:**
450
+ - `instantSimulation(request, options?)` - Simulate a single transaction without session
451
+
452
+ **Session Management:**
453
+ - `createSimulationSession(options?, apiOptions?)` - Create a new simulation session
454
+ - `submitSimulationSteps(sessionId, request, options?)` - Submit steps to a session
455
+ - `getSimulationResult(sessionId, options?)` - Get full simulation results
456
+ - `simulationBatchReads(sessionId, request, options?)` - Batch reads from simulation state
457
+
458
+ ### Chain Tip
459
+
460
+ - `getTip(options?)` - Fetch current chain tip information
461
+
462
+ ### Contract AST
463
+
464
+ - `getContractAST({ contractId, stxerApi? })` - Fetch on-chain contract AST
465
+ - `parseContract({ sourceCode, contractId, clarityVersion?, epoch?, stxerApi? })` - Parse source code to AST
466
+
467
+ ### Batch Operations
468
+
469
+ - `batchRead(reads, options?)` - Execute batch read operations
470
+ - `new BatchProcessor({ stxerAPIEndpoint?, batchDelayMs })` - Create a batch processor
471
+
472
+ ### Clarity API
473
+
474
+ - `callReadonly(params)` - Call a read-only contract function
475
+ - `readVariable(params)` - Read a contract variable
476
+ - `readMap(params)` - Read from a contract map
477
+
172
478
  ## Support
173
479
 
174
480
  This product is made possible through community support. Consider supporting the development:
package/dist/ast.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * WARNING:
3
+ *
4
+ * this file will be used in cross-runtime environments (browser, cloudflare workers, XLinkSDK, etc.),
5
+ * so please be careful when adding `import`s to it.
6
+ */
7
+ import type { ClarityEpoch, ContractAST } from './types';
8
+ export interface AstOptions {
9
+ stxerApi?: string;
10
+ }
11
+ export interface GetContractAstOptions extends AstOptions {
12
+ contractId: string;
13
+ }
14
+ /**
15
+ * Fetch the AST for an on-chain contract.
16
+ * @param options - Contract ID and optional API endpoint
17
+ * @returns The contract AST with metadata
18
+ */
19
+ export declare function getContractAST(options: GetContractAstOptions): Promise<ContractAST>;
20
+ export interface ParseContractOptions extends AstOptions {
21
+ sourceCode: string;
22
+ contractId: string;
23
+ clarityVersion?: '1' | '2' | '3' | '4';
24
+ epoch?: ClarityEpoch;
25
+ }
26
+ /**
27
+ * Parse contract source code into an AST.
28
+ * @param options - Source code, contract ID, and optional configuration
29
+ * @returns The parsed contract AST
30
+ */
31
+ export declare function parseContract(options: ParseContractOptions): Promise<ContractAST>;
32
+ export type { ClarityAbi, ClarityAbiFunction, ClarityAbiFungibleToken, ClarityAbiMap, ClarityAbiNonFungibleToken, ClarityAbiType, ClarityAbiVariable, ClarityEpoch, ClarityVersion, ContractAST, SymbolicExpression, } from './types';
@@ -1,6 +1,6 @@
1
1
  import type { ClarityAbiFunction, ClarityAbiMap, ClarityAbiVariable, TContractPrincipal, TPrincipal } from 'clarity-abi';
2
2
  import type { InferMapValueType, InferReadMapParameterType, InferReadonlyCallParameterType, InferReadonlyCallResultType, InferReadVariableParameterType, InferVariableType } from 'ts-clarity';
3
- import { BatchProcessor } from './BatchProcessor';
3
+ import { BatchProcessor } from './batch-processor';
4
4
  export type ReadonlyCallRuntimeOptions = {
5
5
  sender?: TPrincipal;
6
6
  contract: TContractPrincipal;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * API endpoint constants
3
+ */
4
+ /** Default stxer API endpoint for mainnet */
5
+ export declare const STXER_API_MAINNET = "https://api.stxer.xyz";
6
+ /** stxer API endpoint for testnet */
7
+ export declare const STXER_API_TESTNET = "https://testnet-api.stxer.xyz";
8
+ /** Default stxer API endpoint (mainnet) */
9
+ export declare const DEFAULT_STXER_API = "https://api.stxer.xyz";
package/dist/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
- export * from './BatchAPI';
1
+ export * from './ast';
2
+ export * from './batch-api';
2
3
  export * from './clarity-api';
4
+ export * from './constants';
3
5
  export * from './simulation';
6
+ export { type CreateSessionOptions, createSimulationSession, getSimulationResult, instantSimulation, type SimulationApiOptions, simulationBatchReads, submitSimulationSteps, } from './simulation-api';
7
+ export * from './tip';
8
+ export * from './types';
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Low-level programmatic simulation APIs
3
+ *
4
+ * These functions provide direct access to the stxer V2 simulation endpoints
5
+ * for programmatic use cases where you need more control than SimulationBuilder provides.
6
+ */
7
+ import type { InstantSimulationRequest, InstantSimulationResponse, SimulationBatchReadsRequest, SimulationBatchReadsResponse, SimulationResult, SubmitSimulationStepsRequest, SubmitSimulationStepsResponse } from './types';
8
+ /**
9
+ * Options for API calls
10
+ */
11
+ export interface SimulationApiOptions {
12
+ /** stxer API endpoint (default: https://api.stxer.xyz) */
13
+ stxerApi?: string;
14
+ }
15
+ /**
16
+ * Create simulation session options
17
+ */
18
+ export interface CreateSessionOptions {
19
+ /** Block height for simulation (optional, uses tip if not provided) */
20
+ block_height?: number;
21
+ /** Block hash corresponding to block_height */
22
+ block_hash?: string;
23
+ /** Skip debug tracing for faster simulations */
24
+ skip_tracing?: boolean;
25
+ }
26
+ /**
27
+ * Instantly simulate a transaction
28
+ *
29
+ * This is useful for apps/wallets to get the result of a transaction before sending it.
30
+ * Lightweight - no debug tracing information.
31
+ *
32
+ * @param request - Instant simulation request
33
+ * @param options - API options
34
+ * @returns Instant simulation response with receipt and optional reads
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * import { instantSimulation } from 'stxer';
39
+ *
40
+ * const result = await instantSimulation({
41
+ * transaction: '0x...',
42
+ * block_height: 130818,
43
+ * block_hash: '0x...',
44
+ * reads: [
45
+ * { DataVar: ['SP...contract', 'my-var'] },
46
+ * { StxBalance: 'SP...' }
47
+ * ]
48
+ * });
49
+ * console.log(result.receipt.result);
50
+ * ```
51
+ */
52
+ export declare function instantSimulation(request: InstantSimulationRequest, options?: SimulationApiOptions): Promise<InstantSimulationResponse>;
53
+ /**
54
+ * Create a new simulation session
55
+ *
56
+ * A session allows you to run multiple steps in a forked chain state.
57
+ *
58
+ * @param options - Create session options
59
+ * @param apiOptions - API options
60
+ * @returns Session ID
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * import { createSimulationSession } from 'stxer';
65
+ *
66
+ * const sessionId = await createSimulationSession({
67
+ * block_height: 130818,
68
+ * skip_tracing: false
69
+ * });
70
+ * ```
71
+ */
72
+ export declare function createSimulationSession(options?: CreateSessionOptions, apiOptions?: SimulationApiOptions): Promise<string>;
73
+ /**
74
+ * Submit steps to a simulation session
75
+ *
76
+ * Steps are executed sequentially in the session's forked chain state.
77
+ *
78
+ * @param sessionId - Simulation session ID
79
+ * @param request - Steps to submit
80
+ * @param options - API options
81
+ * @returns Array of step results
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * import { submitSimulationSteps } from 'stxer';
86
+ *
87
+ * const results = await submitSimulationSteps(sessionId, {
88
+ * steps: [
89
+ * { Transaction: '0x...' },
90
+ * { Eval: ['SP...', '', 'SP...contract', '(var-get my-var)'] },
91
+ * { Reads: [{ DataVar: ['SP...contract', 'my-var'] }] }
92
+ * ]
93
+ * });
94
+ * ```
95
+ */
96
+ export declare function submitSimulationSteps(sessionId: string, request: SubmitSimulationStepsRequest, options?: SimulationApiOptions): Promise<SubmitSimulationStepsResponse>;
97
+ /**
98
+ * Get simulation session results
99
+ *
100
+ * Returns the full simulation result including metadata and all step results.
101
+ *
102
+ * @param sessionId - Simulation session ID
103
+ * @param options - API options
104
+ * @returns Complete simulation result
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * import { getSimulationResult } from 'stxer';
109
+ *
110
+ * const result = await getSimulationResult(sessionId);
111
+ * console.log(result.metadata);
112
+ * console.log(result.steps);
113
+ * ```
114
+ */
115
+ export declare function getSimulationResult(sessionId: string, options?: SimulationApiOptions): Promise<SimulationResult>;
116
+ /**
117
+ * Batch reads from a simulation session
118
+ *
119
+ * Similar to sidecar batch reads, but reads from the simulation's forked state.
120
+ *
121
+ * @param sessionId - Simulation session ID
122
+ * @param request - Batch reads request
123
+ * @param options - API options
124
+ * @returns Batch read results
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * import { simulationBatchReads } from 'stxer';
129
+ *
130
+ * const results = await simulationBatchReads(sessionId, {
131
+ * vars: [['SP...contract', 'my-var']],
132
+ * maps: [['SP...contract', 'my-map', '0x...']],
133
+ * stx: ['SP...']
134
+ * });
135
+ * console.log(results.vars);
136
+ * ```
137
+ */
138
+ export declare function simulationBatchReads(sessionId: string, request: SimulationBatchReadsRequest, options?: SimulationApiOptions): Promise<SimulationBatchReadsResponse>;
@@ -1,20 +1,21 @@
1
1
  import { type StacksNetworkName } from '@stacks/network';
2
- import { type ClarityValue, ClarityVersion, type StacksTransactionWire } from '@stacks/transactions';
2
+ import { type ClarityValue, ClarityVersion } from '@stacks/transactions';
3
+ import type { ReadStep } from './types';
3
4
  export interface SimulationEval {
4
5
  contract_id: string;
5
6
  code: string;
6
7
  }
7
- export declare function runEval({ contract_id, code }: SimulationEval): import("@stacks/transactions").TupleCV<import("@stacks/transactions").TupleData<import("@stacks/transactions").BufferCV | import("@stacks/transactions").UIntCV>>;
8
- export declare function runSimulation(apiEndpoint: string, block_hash: string, block_height: number, txs: (StacksTransactionWire | SimulationEval)[]): Promise<string>;
9
8
  interface SimulationBuilderOptions {
10
9
  apiEndpoint?: string;
11
10
  stacksNodeAPI?: string;
12
11
  network?: StacksNetworkName | string;
12
+ skipTracing?: boolean;
13
13
  }
14
14
  export declare class SimulationBuilder {
15
15
  private apiEndpoint;
16
16
  private stacksNodeAPI;
17
17
  private network;
18
+ private skipTracing;
18
19
  private constructor();
19
20
  static new(options?: SimulationBuilderOptions): SimulationBuilder;
20
21
  private block;
@@ -46,8 +47,15 @@ export declare class SimulationBuilder {
46
47
  addEvalCode(inside_contract_id: string, code: string): this;
47
48
  addMapRead(contract_id: string, map: string, key: string): this;
48
49
  addVarRead(contract_id: string, variable: string): this;
50
+ addSetContractCode(params: {
51
+ contract_id: string;
52
+ source_code: string;
53
+ clarity_version?: ClarityVersion;
54
+ }): this;
55
+ addReads(reads: ReadStep[]): this;
56
+ addTenureExtend(): this;
49
57
  private getBlockInfo;
50
58
  run(): Promise<string>;
51
59
  pipe(transform: (builder: SimulationBuilder) => SimulationBuilder): SimulationBuilder;
52
60
  }
53
- export {};
61
+ export type { CreateSimulationRequest, ExecutionCost, InstantSimulationRequest, InstantSimulationResponse, ReadResult, ReadStep, SimulationMetadata, SimulationResult, SimulationStepInput, TransactionReceipt, } from './types';