Implementation
static XdrHostFunction decode(XdrDataInputStream stream) {
XdrHostFunction decoded =
XdrHostFunction(XdrHostFunctionType.decode(stream));
switch (decoded.discriminant) {
case XdrHostFunctionType.HOST_FUNCTION_TYPE_INVOKE_CONTRACT:
int vecSize = stream.readInt();
decoded.invokeArgs = List<XdrSCVal>.empty(growable: true);
for (int i = 0; i < vecSize; i++) {
decoded.invokeArgs!.add(XdrSCVal.decode(stream));
}
break;
case XdrHostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT:
decoded.createContractArgs = XdrCreateContractArgs.decode(stream);
break;
case XdrHostFunctionType.HOST_FUNCTION_TYPE_INSTALL_CONTRACT_CODE:
decoded.installContractCodeArgs =
XdrInstallContractCodeArgs.decode(stream);
break;
}
return decoded;
}