es/tx/tx.js
async function calculateTtl (ttl = 0, relative = true) {
  if (ttl === 0) return 0
  if (ttl < 0) throw new Error('ttl must be greater than 0')

  if (relative) {
    const { height } = await this.api.getCurrentKeyBlock()
    return +(height) + ttl
  }
  return ttl
}
async function calculateTtl (ttl = 0, relative = true) {
  if (ttl === 0) return 0
  if (ttl < 0) throw new Error('ttl must be greater than 0')

  if (relative) {
    const { height } = await this.api.getCurrentKeyBlock()
    return +(height) + ttl
  }
  return ttl
}
async function calculateTtl ( ttl = 0 , relative = true ) { if ( ttl === 0 ) return 0 if ( ttl < 0 ) throw new Error ( 'ttl must be greater than 0' ) if ( relative ) { const { height } = await this . api . getCurrentKeyBlock ( ) return + ( height ) + ttl } return ttl }
Compute the absolute ttl by adding the ttl to the current height of the chain

@param {number} ttl
@param {boolean} relative ttl is absolute or relative(default: true(relative))
@return {number} Absolute Ttl
Compute the absolute ttl by adding the ttl to the current height of the chain