Skip to content

Commit

Permalink
Change project name pokefork to localnode
Browse files Browse the repository at this point in the history
  • Loading branch information
ruXlab committed Nov 12, 2023
1 parent 7b707fd commit 0b5d903
Show file tree
Hide file tree
Showing 37 changed files with 99 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# 🍴 PokeFork: Seamless integration of Hardhat and Foundry Anvil with your Java/Kotlin app
# 🍴 LocalNode: get Hardhat and Foundry Anvil integrated in your Java/Kotlin app

[![build status](https://github.com/ruXlab/pokefork/actions/workflows/tests.yml/badge.svg)](https://github.com/ruXlab/pokefork/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Maven Central](https://img.shields.io/maven-central/v/vc.rux.pokefork/ktx-module.svg)](https://search.maven.org/artifact/vc.rux.pokefork/web3j)


PokeFork is an open-source library project designed to empower
developers working with Ethereum Virtual Machine (EVM) based networks.
It allows to run a local development or forked node of the Ethereum-like network
using **Hardhat or Foundry Anvil** and interact with it from your Java/Kotlin/Scala code.
LocalNode allows to run a local development or forked node of the Ethereum-like network
using **Hardhat or Foundry Anvil** and interact with it from your Java/Kotlin/Scala code.
Thanks to docker there won't be a port conflict and you can run multiple nodes at the same time.

Developer gets full control over the management of the local node via the extended (see the table below) web3j interface.

## Motivation

Expand Down Expand Up @@ -75,7 +76,7 @@ Seriously, Java devs deserve it.
Add dependency to your project:

```kotlin
implementation("vc.rux.pokefork:web3j:0.1.0")
implementation("vc.rux.localnodee:web3j:0.1.0")
implementation("org.web3j:core:4.10.3")
```

Expand All @@ -97,10 +98,6 @@ EVM network interactions.
Seriously, it's clear that number of bad actors in blockchain
space is crazy. Trust no one.

## Punning Around

We couldn't resist the opportunity for some wordplay with "PokeFork."
Just like a fork in the road, we're here to help you choose the
path that leads to success in EVM network development.
------------------------

Happy forking!
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ plugins {
id("publication")
}

group = "vc.rux.pokefork"
group = "vc.rux.localnode"
version = "0.0-SNAPSHOT"
4 changes: 2 additions & 2 deletions examples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
kotlin("jvm")
}

group = "vc.rux.pokefork.examples"
group = "vc.rux.localnode.examples"
version = "0.0-SNAPSHOT"

repositories {
Expand All @@ -11,7 +11,7 @@ repositories {
}

dependencies {
implementation("vc.rux.pokefork:web3j:0.1.0")
implementation("vc.rux.localnode:web3j:0.1.0")
implementation("org.web3j:core:4.10.3")
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
kotlin.code.style=official


artifactName=pokefork
artifactName=localnode
artifactDesc=Run local node or fork Ethereum-like blockchains from your Kotlin/Java app using Hardhat or Foundry Anvil
artifactUrl=https://github.com/ruXlab/pokefork
artifactScm[email protected]:ruXlab/pokefork.git
artifactUrl=https://github.com/ruXlab/localnode
artifactScm[email protected]:ruXlab/localnode.git
artifactLicenseName=MIT License
artifactLicenseUrl=http://www.opensource.org/licenses/mit-license.php
artifactPublishVersion=0.1.0
6 changes: 6 additions & 0 deletions localnode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LocalNode library module
=========

This is a library module, please refer to the
[parent README](../README.md) to learn more about
the project and how to use it.
2 changes: 1 addition & 1 deletion core/build.gradle.kts → localnode/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
signing
}

group = "vc.rux.pokefork"
group = "vc.rux.localnode"
version = "0.0-SNAPSHOT"

repositories {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package vc.rux.pokefork

import vc.rux.pokefork.ILocalNode
package vc.rux.localnode

interface IForkNode : ILocalNode {
fun forkBlock(blockNumber: Long)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vc.rux.pokefork
package vc.rux.localnode

import java.math.BigInteger

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vc.rux.pokefork
package vc.rux.localnode

/**
* NodeMode is a sealed interface with two implementations:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vc.rux.pokefork.anvil
package vc.rux.localnode.anvil

import com.github.dockerjava.api.DockerClient
import com.github.dockerjava.api.command.CreateContainerResponse
Expand All @@ -7,12 +7,12 @@ import com.github.dockerjava.api.model.ExposedPort
import com.github.dockerjava.api.model.HostConfig
import com.github.dockerjava.api.model.PullResponseItem
import org.slf4j.LoggerFactory
import vc.rux.pokefork.NodeMode
import vc.rux.pokefork.common.idPrefix
import vc.rux.pokefork.common.waitForRpcToBoot
import vc.rux.pokefork.defaultDockerClient
import vc.rux.pokefork.hardhat.HardhatNode
import vc.rux.pokefork.hardhat.IEthereumLikeNode
import vc.rux.localnode.NodeMode
import vc.rux.localnode.common.idPrefix
import vc.rux.localnode.common.waitForRpcToBoot
import vc.rux.localnode.defaultDockerClient
import vc.rux.localnode.hardhat.HardhatNode
import vc.rux.localnode.hardhat.IEthereumLikeNode
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package vc.rux.pokefork.anvil
package vc.rux.localnode.anvil

import vc.rux.pokefork.NodeMode
import vc.rux.localnode.NodeMode

data class AnvilNodeConfig(
val nodeMode: NodeMode,
val blockNumber: Long? = null,
val imageName: String = "pokefork",
val imageName: String = "localnode",
val imageTag: String? = null,
val foundryImage: String = "ghcr.io/foundry-rs/foundry:latest"
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vc.rux.pokefork.anvil.internal
package vc.rux.localnode.anvil.internal

internal data class AnvilDockerfile(
val commandLineParams: List<String>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package vc.rux.pokefork.common
package vc.rux.localnode.common

import vc.rux.pokefork.NodeMode
import vc.rux.localnode.NodeMode

internal val NodeMode.idPrefix
get() = when (this) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vc.rux.pokefork.common
package vc.rux.localnode.common

import org.slf4j.LoggerFactory
import java.net.HttpURLConnection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vc.rux.pokefork
package vc.rux.localnode

import com.github.dockerjava.core.DockerClientBuilder

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package vc.rux.pokefork.errors

import javax.ws.rs.core.Response
package vc.rux.localnode.errors

open class PokeForkError : RuntimeException {
constructor(message: String) : super(message)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package vc.rux.pokefork.hardhat
package vc.rux.localnode.hardhat

import vc.rux.pokefork.NodeMode
import vc.rux.localnode.NodeMode

data class HardHatNodeConfig(
val nodeMode: NodeMode,
val blockNumber: Long? = null,
val imageName: String = "pokefork",
val imageName: String = "localnode",
val imageTag: String? = null,
val hardhatVersion: String = "2.17.3"
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vc.rux.pokefork.hardhat
package vc.rux.localnode.hardhat

import com.github.dockerjava.api.DockerClient
import com.github.dockerjava.api.async.ResultCallback
Expand All @@ -7,12 +7,12 @@ import com.github.dockerjava.api.command.CreateContainerResponse
import com.github.dockerjava.api.model.BuildResponseItem
import com.github.dockerjava.api.model.HostConfig
import org.slf4j.LoggerFactory
import vc.rux.pokefork.NodeMode
import vc.rux.pokefork.common.idPrefix
import vc.rux.pokefork.common.waitForRpcToBoot
import vc.rux.pokefork.defaultDockerClient
import vc.rux.pokefork.hardhat.internal.HardHatConfigJs
import vc.rux.pokefork.hardhat.internal.HardHatDockerfile
import vc.rux.localnode.NodeMode
import vc.rux.localnode.common.idPrefix
import vc.rux.localnode.common.waitForRpcToBoot
import vc.rux.localnode.defaultDockerClient
import vc.rux.localnode.hardhat.internal.HardHatConfigJs
import vc.rux.localnode.hardhat.internal.HardHatDockerfile
import java.nio.file.Files
import kotlin.time.Duration.Companion.seconds

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package vc.rux.pokefork.hardhat
package vc.rux.localnode.hardhat

import vc.rux.pokefork.NodeMode
import vc.rux.localnode.NodeMode

interface IEthereumLikeNode {
val localRpcNodeUrl: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vc.rux.pokefork.hardhat.internal
package vc.rux.localnode.hardhat.internal

import com.fasterxml.jackson.databind.ObjectMapper

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package vc.rux.pokefork.hardhat.internal
package vc.rux.localnode.hardhat.internal

import java.util.Base64
import java.util.*


internal class HardHatDockerfile(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package vc.rux.pokefork.web3j
package vc.rux.localnode.web3j

import org.slf4j.LoggerFactory
import org.web3j.protocol.Web3j
import org.web3j.protocol.core.JsonRpc2_0Web3j
import org.web3j.protocol.core.Request
import org.web3j.protocol.core.Response
import org.web3j.protocol.http.HttpService
import vc.rux.pokefork.IForkNode
import vc.rux.pokefork.ILocalNode
import vc.rux.pokefork.NodeMode
import vc.rux.pokefork.hardhat.IEthereumLikeNode
import vc.rux.pokefork.web3j.utils.toHexStringPrefixed
import vc.rux.pokefork.web3j.utils.toHexStringSuffixed
import vc.rux.localnode.IForkNode
import vc.rux.localnode.ILocalNode
import vc.rux.localnode.NodeMode
import vc.rux.localnode.hardhat.IEthereumLikeNode
import vc.rux.localnode.web3j.utils.toHexStringPrefixed
import vc.rux.localnode.web3j.utils.toHexStringSuffixed
import java.lang.System.currentTimeMillis
import java.math.BigInteger

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package vc.rux.pokefork.web3j
package vc.rux.localnode.web3j

import org.web3j.protocol.core.Response
import vc.rux.pokefork.errors.PokeForkError
import vc.rux.localnode.errors.PokeForkError

class PokeForkRpcCallError : PokeForkError {
val error: Response.Error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package vc.rux.pokefork.web3j.utils
package vc.rux.localnode.web3j.utils

import java.math.BigInteger

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
</appender>
<!-- <logger name="org.apache.http.wire" level="OFF" />-->

<logger name="vc.rux.pokefork" level="DEBUG" />
<logger name="vc.rux.localnode" level="DEBUG" />
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import assertk.assertions.isNotNull
import assertk.assertions.isNull
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.ValueSource
import vc.rux.pokefork.anvil.AnvilNode
import vc.rux.pokefork.anvil.AnvilNodeConfig
import vc.rux.pokefork.defaultDockerClient
import vc.rux.localnode.anvil.AnvilNode
import vc.rux.localnode.anvil.AnvilNodeConfig
import vc.rux.localnode.defaultDockerClient

class AnvilNodeTest {
@ValueSource(strings = ["local", "fork"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import assertk.assertions.isNotNull
import assertk.assertions.isNull
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.ValueSource
import vc.rux.pokefork.defaultDockerClient
import vc.rux.pokefork.hardhat.HardHatNodeConfig
import vc.rux.pokefork.hardhat.HardhatNode
import vc.rux.localnode.defaultDockerClient
import vc.rux.localnode.hardhat.HardHatNodeConfig
import vc.rux.localnode.hardhat.HardhatNode

class HardhatTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package web3j

import vc.rux.pokefork.NodeMode
import vc.rux.pokefork.anvil.AnvilNode
import vc.rux.pokefork.anvil.AnvilNodeConfig
import vc.rux.localnode.NodeMode
import vc.rux.localnode.anvil.AnvilNode
import vc.rux.localnode.anvil.AnvilNodeConfig

/**
* Since junit5 doesn't support tests with multiple paramterised parameters in constructor and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import org.web3j.protocol.core.DefaultBlockParameterName.LATEST
import org.web3j.protocol.core.Ethereum
import org.web3j.protocol.core.methods.request.Transaction
import org.web3j.tx.gas.DefaultGasProvider
import vc.rux.pokefork.NodeMode
import vc.rux.pokefork.errors.PokeForkError
import vc.rux.pokefork.hardhat.IEthereumLikeNode
import vc.rux.pokefork.web3j.LocalWeb3jNode
import vc.rux.pokefork.web3j.PokeForkRpcCallError
import vc.rux.pokefork.web3j.throwIfErrored
import vc.rux.pokefork.web3j.utils.toHexStringSuffixed
import vc.rux.localnode.NodeMode
import vc.rux.localnode.errors.PokeForkError
import vc.rux.localnode.hardhat.IEthereumLikeNode
import vc.rux.localnode.web3j.LocalWeb3jNode
import vc.rux.localnode.web3j.PokeForkRpcCallError
import vc.rux.localnode.web3j.throwIfErrored
import vc.rux.localnode.web3j.utils.toHexStringSuffixed
import java.math.BigDecimal
import java.math.BigDecimal.TEN
import java.math.BigInteger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package web3j

import vc.rux.pokefork.NodeMode
import vc.rux.pokefork.hardhat.HardHatNodeConfig
import vc.rux.pokefork.hardhat.HardhatNode
import vc.rux.localnode.NodeMode
import vc.rux.localnode.hardhat.HardHatNodeConfig
import vc.rux.localnode.hardhat.HardhatNode

/**
* Since junit5 doesn't support tests with multiple paramterised parameters in constructor and
Expand Down
Loading

0 comments on commit 0b5d903

Please sign in to comment.