UNPKG

@aeternity/aepp-sdk

Version:

SDK for the æternity blockchain

35 lines (33 loc) 977 B
import shortUInt from './short-u-int.js'; import { ArgumentError } from '../../../utils/errors.js'; import { getHeight } from '../../../chain.js'; // TODO: restore after the mainnet mining issue is solved, was used via `_isInternalBuild` flag // eslint-disable-next-line @typescript-eslint/no-unused-vars const DEFAULT_INTERNAL_RELATIVE_TTL = 3; /** * Time to leave */ export default { ...shortUInt, serialize(value) { return shortUInt.serialize(value !== null && value !== void 0 ? value : 0); }, async prepare(value, params, // TODO: { absoluteTtl: true } | { absoluteTtl: false, onNode: Node } { onNode, absoluteTtl, ...options }) { if (absoluteTtl !== true && value !== 0 && value != null) { if (onNode == null) throw new ArgumentError('onNode', 'provided', onNode); value += await getHeight({ ...options, onNode, cached: true }); } return value; } }; //# sourceMappingURL=ttl.js.map