Sha256: e72d334eab9ffc03c63fb9ccd02f74ee2d36147d005dd3cd55c543b20c2fa306

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

import {TRANSACTION_TYPE} from '@waves/ts-types'
import { orderValidator } from './order'
import {
    isEq,
    orEq,
    isNumber,
    isNumberLike,
    isArray,
    getError,
    validateByShema,
    ifElse, defaultValue, isPublicKey, validatePipe, isRequired, isNaturalNumberOrZeroLike
} from './validators'


const exchangeScheme = {
    type: isEq(TRANSACTION_TYPE.EXCHANGE),
    senderPublicKey: isPublicKey,
    version: orEq([undefined, 1, 2, 3]),
    order1: validatePipe(
        isRequired(true),
        orderValidator
    ),
    order2: validatePipe(
        isRequired(true),
        orderValidator
    ),
    amount: isNumberLike,
    price: isNumberLike,
    buyMatcherFee: isNumberLike,
    sellMatcherFee: isNumberLike,
    fee: isNaturalNumberOrZeroLike,
    timestamp: isNumber,
    proofs: ifElse(isArray, defaultValue(true), orEq([ undefined ])),
}

export const exchangeValidator = validateByShema(exchangeScheme, getError)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
waves_lib-0.1.0 js/node_modules/@waves/waves-transactions/src/validators/exchange.ts