How to use the @waves/marshall.serializePrimitives.SHORT 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 / proto-serialize.ts View on Github external
IMassTransferTransaction,
  IOrder,
  IReissueTransaction, ISetAssetScriptTransaction,
  ISetScriptTransaction, ISponsorshipTransaction,
  ITransaction,
  ITransferTransaction,
  TOrder, TRANSACTION_TYPE, TTransactionType,
  TTx, TTypedData, IUpdateAssetInfoTransaction, TDeleteRequest
} from './transactions'
import { base64Prefix, chainIdFromRecipient, fee, isOrder } from './generic'
import Long from 'long'
import { lease } from './transactions/lease'

const invokeScriptCallSchema = {
  ...schemas.txFields.functionCall[1], withLength: {
    toBytes: serializePrimitives.SHORT,
    fromBytes: parsePrimitives.P_SHORT
  }
}

const recipientFromProto = (recipient: wavesProto.waves.IRecipient, chainId: number): string => {
  if (recipient.alias) {
    return `alias:${String.fromCharCode(chainId)}:${recipient.alias}`
  }
  const rawAddress = concat([1], [chainId], recipient!.publicKeyHash!)
  const checkSum = keccak(blake2b(rawAddress)).slice(0, 4)
  return base58Encode(concat(rawAddress, checkSum))
}

const attachmentFromProto = (a: wavesProto.waves.IAttachment | undefined | null, preProtoVersion: boolean) => {
  if (a == null) return
  switch (true) {