From 4ef3a9af00ce3363e27021ce89fc7319cb8a6c6d Mon Sep 17 00:00:00 2001 From: Bartosz Rybarski Date: Thu, 29 Jun 2023 18:40:11 +0200 Subject: [PATCH] Added additional method to StarknetProvider --- .../Providers/StarknetProviderProtocol.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Sources/Starknet/Providers/StarknetProviderProtocol.swift b/Sources/Starknet/Providers/StarknetProviderProtocol.swift index 690e970e3..1c832e3c0 100644 --- a/Sources/Starknet/Providers/StarknetProviderProtocol.swift +++ b/Sources/Starknet/Providers/StarknetProviderProtocol.swift @@ -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) async throws -> [StarknetSimulatedTransaction] } @@ -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) async throws -> [StarknetSimulatedTransaction] { + try await simulateTransactions(transactions, at: defaultBlockId, simulationFlags: simulationFlags) + } }