Closed mluisbrown closed 1 month ago
Hey @mluisbrownhave, have you tried implementing your solution with a similar protocol for batch requests (StarknetBatchRequestProtocol
) and using MockProvider
with MockBatchRequest
?
It seems that using a parameterized protocol in the batchRequests method causes a segfault on build without any useful logs that allow to debug this.
Hi @franciszekjob, I didn't actually implement it, although the code I wrote above did compile.
Closing this as it's no longer relevant due to https://github.com/software-mansion/starknet.swift/issues/215 (which has been resolved).
What happened
With the changes in
v0.11.0
,StarknetProviderProtocol
now returnsStarknetRequest<U>
, on which in turn you have to call the async methodsend()
onStarknetRequest
to get the result.However, since
StarknetRequest
has no public initialiser it's impossible for any type outside of this library to conform toStarknetProviderProtocol
since in order to conform to it you need to return instances ofStarknetRequest
, which cannot be constructed since it has no public initialisers.However, even adding a
public init
would not be terribly helpful, although IMO it should be made available as a matter of correctness.If we want to create a mock implementation of
StarknetProviderProtocol
for testing, we currently cannot do so, due to the above limitation. What would solve this is if we had aStarknetRequestProtocol
as generic a protocol with a single method:This approach would allow creating a mock implementation of
StarknetProviderProtocol
:Until this is resolved we cannot migrate to
v0.11.1
as we won't be able to adapt our tests to the newStarknetProviderProtocol
methods.Stack trace
N/A
Steps to reproduce
N/A
SDK Version
0.11.1
Language version
5.10
Is there an existing issue for this?