How to use the @waves/marshall.binary.serializeOrder 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 / order.ts View on Github external
price,
    amount,
    timestamp: t,
    expiration: expiration || t + 29 * 24 * 60 * 60 * 1000,
    matcherFee: matcherFee || 300000,
    matcherPublicKey,
    senderPublicKey,
    proofs,
    id: '',
  }

  if (ord.version === 3) {
    ord.matcherFeeAssetId = paramsOrOrder.matcherFeeAssetId === 'WAVES' ? null : paramsOrOrder.matcherFeeAssetId
  }

  const bytes = binary.serializeOrder(ord)

  seedsAndIndexes.forEach(([s, i]) => addProof(ord, signBytes(s, bytes), i))

  validate.order(ord)

  ord.id = base58Encode(blake2b(bytes))

  // OrderV1 uses signature instead of proofs
  if (ord.version === undefined || ord.version === 1) (ord as any).signature = ord.proofs && ord.proofs[0]

  return ord
}
github wavesplatform / waves-transactions / src / general.ts View on Github external
export function serialize(obj: TTx | TOrder): Uint8Array {
  if (isOrder(obj)) return binary.serializeOrder(obj)
  return binary.serializeTx(obj)
}