async batch_estimate(opts = {}) {
    // we select our record again to get our current nonce
    if (!me.id || !me.record || me.batch.length == 0) {
      return false
    }

    // reload to latest nonce
    await me.record.reload()

    let by_first = (a, b) => b[0] - a[0]

    let merged = me.batch.map((m) => {
      if (m[0] == 'deposit' || m[0] == 'withdraw') {
        m[1][1].sort(by_first)
      }

      return [methodMap(m[0]), m[1]]
    })

    let gaslimit = 0 //uncapped
    let gasprice = opts.gasprice ? parseInt(opts.gasprice) : K.min_gasprice

    let to_sign = r([
      methodMap('batch'),
      me.record.batch_nonce,
      gaslimit,
      gasprice,
      merged
    ])
    let signed_batch = r([me.record.id, ec(to_sign, me.id.secretKey), to_sign])

    return {
      signed_batch: signed_batch,
      size: to_sign.length,
      batch_nonce: me.record.batch_nonce,
      batch_body: merged
    }
  }
// compiles signed tx from current batch, not state changing
compiles signed tx from current batch, not state changing
compiles signed tx from current batch not state changing
async batch_estimate(opts = {}) {
    if (!me.id || !me.record || me.batch.length == 0) {
      return false
    }
    await me.record.reload()
    let by_first = (a, b) => b[0] - a[0]
    let merged = me.batch.map((m) => {
      if (m[0] == 'deposit' || m[0] == 'withdraw') {
        m[1][1].sort(by_first)
      }
      return [methodMap(m[0]), m[1]]
    })
    let gaslimit = 0 
    let gasprice = opts.gasprice ? parseInt(opts.gasprice) : K.min_gasprice
    let to_sign = r([
      methodMap('batch'),
      me.record.batch_nonce,
      gaslimit,
      gasprice,
      merged
    ])
    let signed_batch = r([me.record.id, ec(to_sign, me.id.secretKey), to_sign])
    return {
      signed_batch: signed_batch,
      size: to_sign.length,
      batch_nonce: me.record.batch_nonce,
      batch_body: merged
    }
  }
async batch_estimate ( opts = { } ) { if ( ! me . id || ! me . record || me . batch . length == 0 ) { return false } await me . record . reload ( ) let by_first = ( a , b ) => b [ 0 ] - a [ 0 ] let merged = me . batch . map ( ( m ) => { if ( m [ 0 ] == 'deposit' || m [ 0 ] == 'withdraw' ) { m [ 1 ] [ 1 ] . sort ( by_first ) } return [ methodMap ( m [ 0 ] ) , m [ 1 ] ] } ) let gaslimit = 0 let gasprice = opts . gasprice ? parseInt ( opts . gasprice ) : K . min_gasprice let to_sign = r ( [ methodMap ( 'batch' ) , me . record . batch_nonce , gaslimit , gasprice , merged ] ) let signed_batch = r ( [ me . record . id , ec ( to_sign , me . id . secretKey ) , to_sign ] ) return { signed_batch : signed_batch , size : to_sign . length , batch_nonce : me . record . batch_nonce , batch_body : merged } }
compiles signed tx from current batch, not state changing
compiles signed tx from current batch not state changing
// we select our record again to get our current nonce // reload to latest nonce //uncapped