build method Null safety
Builds an operation
Implementation
InvokeHostFunctionOperation build() {
InvokeHostFunctionOperation? operation;
if (this._hostFunctionType ==
XdrHostFunctionType.HOST_FUNCTION_TYPE_INVOKE_CONTRACT) {
// build invoke contract op
operation = InvokeContractOp(_contractID!, _functionName!,
arguments: _arguments,
footprint: _footprint,
contractAuth: ContractAuth.toXdrList(contractAuth));
} else if (this._hostFunctionType ==
XdrHostFunctionType.HOST_FUNCTION_TYPE_INSTALL_CONTRACT_CODE) {
// build install contract code op
operation = InstallContractCodeOp(_contractCode!, footprint: _footprint);
} else if (this._hostFunctionType ==
XdrHostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT &&
_wasmId != null) {
// build create contract op
operation =
CreateContractOp(_wasmId!, salt: _salt, footprint: _footprint);
} else if (this._hostFunctionType ==
XdrHostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT &&
this._asset != null) {
// build deploy create token contract with asset op
operation = DeploySACWithAssetOp(this._asset!, footprint: _footprint);
} else if (this._hostFunctionType ==
XdrHostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT) {
// build deploy create token contract with account op
operation =
DeploySACWithSourceAccountOp(salt: _salt, footprint: _footprint);
}
if (operation != null) {
operation.sourceAccount = _mSourceAccount;
return operation;
} else {
throw UnimplementedError();
}
}