I used the type-state pattern on the CallHandler where the states(calls) are ContractCall, ScriptCall and Vec<ContractCall for the multi-call case.
SubmitResponse got much simpler as we only have one CallHandler now.
Refactored the fuels-programs crate and added folders to split the code up.
As allays naming ideas are welcome. For example, CallHandler's call should be renamed to something else as it could be one call or multiple calls. call_or_calls sounded weird. Also the Parsable trait could be renamed.
BREAKING CHANGE:
FuelCallResponse renamed to CallResponse
ContractCallHandler removed in favor of CallHandler
ScriptCallHandler removed in favor of CallHandler
method_hash removed in favor of CallHandler::new_contract_call
Checklist
[x] I have updated the documentation.
[x] I have added tests that prove my fix is effective or that my feature works.
One
CallHandler
to rule them all.What was done:
I used the
type-state pattern
on theCallHandler
where thestates(calls)
areContractCall
,ScriptCall
andVec<ContractCall
for the multi-call case.SubmitResponse
got much simpler as we only have oneCallHandler
now.fuels-programs
crate and added folders to split the code up.As allays naming ideas are welcome. For example,
CallHandler
'scall
should be renamed to something else as it could be one call or multiple calls.call_or_calls
sounded weird. Also theParsable
trait could be renamed.BREAKING CHANGE:
FuelCallResponse
renamed toCallResponse
ContractCallHandler
removed in favor ofCallHandler
ScriptCallHandler
removed in favor ofCallHandler
method_hash
removed in favor ofCallHandler::new_contract_call
Checklist