Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function serializeCustomData(d: TCustomData){
if (d.version === 1) {
return concat([255, 255, 255, 1], serializePrimitives.BASE64_STRING(d.binary))
} else if (d.version === 2) {
const ser = binary.serializerFromSchema(schemas.txFields.data[1])
return concat([255, 255, 255, 2], ser(d.data))
} else {
throw new Error(`Invalid CustomData version: ${d!.version}`)
}
}