Skip to content

Commit

Permalink
Remove comment
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-pousette committed Jan 28, 2022
1 parent edce3bd commit 5e17218
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,7 @@ export function serializeStruct(schema: Schema, obj: any, writer: BinaryWriter)
structSchema.fields.map((field) => {
serializeField(schema, field.key, obj[field.key], field.type, writer);
});
} /* else if (structSchema.kind === "enum") {
const name = obj[structSchema.field];
for (let idx = 0; idx < structSchema.values.length; ++idx) {
const [fieldName, fieldType]: [any, any] = structSchema.values[idx];
if (fieldName === name) {
writer.writeU8(idx);
serializeField(schema, fieldName, obj[fieldName], fieldType, writer);
break;
}
}
}
*/
}
else {
throw new BorshError(
`Unexpected schema for ${obj.constructor.name}`
Expand Down Expand Up @@ -214,19 +203,6 @@ function deserializeStruct(
}
return Object.assign(new clazz(), result);
}

/* if (structSchema.kind === "enum") {
if (idx === undefined)
idx = reader.readU8();
if (idx >= structSchema.values.length) {
throw new BorshError(`Enum index: ${idx} is out of range`);
}
const [fieldName, fieldType] = structSchema.values[idx];
const fieldValue = deserializeField(schema, fieldName, fieldType, reader);
return new clazz({ [fieldName]: fieldValue });
} */

throw new BorshError(
`Unexpected schema ${clazz.constructor.name}`
);
Expand Down

0 comments on commit 5e17218

Please sign in to comment.