All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ergoplatform.appkit.ColdErgoClient.scala Maven / Gradle / Ivy

The newest version!
package org.ergoplatform.appkit

import java.util.function
import org.ergoplatform.restapi.client
import org.ergoplatform.appkit.impl.{ColdBlockchainContext, NodeInfoParameters}
import org.ergoplatform.restapi.client.NodeInfo

class ColdErgoClient(networkType: NetworkType, val params: BlockchainParameters) extends ErgoClient {

  /**
    * Convenience constructor for giving maxBlockCost
    */
  def this(networkType: NetworkType, maxBlockCost: Int, blockVersion: Byte) {
    this(networkType,
      new NodeInfoParameters(
        new NodeInfo()
          .parameters(new client.Parameters()
            .maxBlockCost(Integer.valueOf(maxBlockCost))
            .blockVersion(Integer.valueOf(blockVersion))
          )
      )
    )
  }

  override def execute[T](action: function.Function[BlockchainContext, T]): T = {
    val ctx = new ColdBlockchainContext(networkType, params)
    val res = action.apply(ctx)
    res
  }
  override def getDataSource: BlockchainDataSource = ???
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy