Skip to content

Commit

Permalink
Added additional method to StarknetProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekryba committed Jun 29, 2023
1 parent 5d3e1ec commit 4ef3a9a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Sources/Starknet/Providers/StarknetProviderProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,12 @@ public protocol StarknetProviderProtocol {
/// - Returns: receipt of a transaction identified by given hash
func getTransactionReceiptBy(hash: Felt) async throws -> StarknetTransactionReceipt

/// Simulate a given transaction on the requested state, and generate the execution trace
/// Simulate running a given list of transactions, and generate the execution trace
///
/// - Parameters:
/// - transactions: list of transactions to simulate
/// - blockId: at which block to run the simulation
/// - skipValidatte: a flag whether signature validation should be bypassed
/// - skipValidatte: a flag whether signature validation should be bypassed
/// - blockId: block used to run the simulation
/// - simulationFlags: a set of simulation flags
func simulateTransactions(_ transactions: [any StarknetSequencerTransaction], at blockId: StarknetBlockId, simulationFlags: Set<StarknetSimulationFlag>) async throws -> [StarknetSimulatedTransaction]
}

Expand Down Expand Up @@ -166,4 +165,13 @@ public extension StarknetProviderProtocol {
func getClassHashAt(_ address: Felt) async throws -> Felt {
try await getClassHashAt(address, at: defaultBlockId)
}

/// Simulate running a given list of transactions in the latest block, and generate the execution trace
///
/// - Parameters:
/// - transactions: list of transactions to simulate
/// - simulationFlags: a set of simulation flags
func simulateTransactions(_ transactions: [any StarknetSequencerTransaction], simulationFlags: Set<StarknetSimulationFlag>) async throws -> [StarknetSimulatedTransaction] {
try await simulateTransactions(transactions, at: defaultBlockId, simulationFlags: simulationFlags)
}
}

0 comments on commit 4ef3a9a

Please sign in to comment.