How to use the @waves/marshall.serializePrimitives.BASE64_STRING function in @waves/marshall

To help you get started, we’ve selected a few @waves/marshall examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wavesplatform / waves-transactions / src / requests / custom-data.ts View on Github external
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}`)
  }
}