builder method Null safety
override
Implementation
static InvokeHostFuncOpBuilder builder(XdrInvokeHostFunctionOp op) {
XdrHostFunction xdrHostFunction = op.function;
if (xdrHostFunction.discriminant !=
XdrHostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT ||
xdrHostFunction.createContractArgs == null ||
xdrHostFunction.createContractArgs!.contractID.discriminant !=
XdrContractIDType.CONTRACT_ID_FROM_SOURCE_ACCOUNT ||
xdrHostFunction.createContractArgs!.source.discriminant !=
XdrSCContractCodeType.SCCONTRACT_CODE_WASM_REF ||
xdrHostFunction.createContractArgs!.source.wasmId == null) {
throw new Exception("invalid argument");
}
XdrLedgerFootprint? footprint;
if (op.footprint.readOnly.isNotEmpty && op.footprint.readWrite.isNotEmpty) {
footprint = op.footprint;
}
String wasmId = Util.bytesToHex(
xdrHostFunction.createContractArgs!.source.wasmId!.hash);
return InvokeHostFuncOpBuilder.forCreatingContract(wasmId,
salt: xdrHostFunction.createContractArgs!.contractID.salt,
footprint: footprint);
}