@gateway.fm/gtw-dvf-client-js
Version:
DVF client js lib with gateway.fm rpc endpoints
14 lines (10 loc) • 316 B
JavaScript
const DVFError = require('../dvf/DVFError')
module.exports = (dvf, nonce) => {
if (typeof nonce === 'string') nonce = +nonce
if (!nonce || isNaN(nonce)) {
throw new DVFError('ERR_INVALID_NONCE')
}
if (Date.now() / 1000 - nonce > dvf.defaultNonceAge) {
throw new DVFError('NONCE_IS_TOO_OLD')
}
}