Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class Web3jProducerInvokeOnHeaderFactory implements InvokeOnHeaderStrateg
public Object invoke(Object obj, String key, Exchange exchange, AsyncCallback callback) throws Exception {
org.apache.camel.component.web3j.Web3jProducer target = (org.apache.camel.component.web3j.Web3jProducer) obj;
switch (key) {
case "camelweb3jethhashrate":
case "CamelWeb3jEthHashrate": target.ethHashrate(exchange.getMessage()); return null;
case "db_get_hex":
case "DB_GET_HEX": target.dbGetHex(exchange.getMessage()); return null;
case "db_get_string":
Expand Down Expand Up @@ -87,8 +89,6 @@ public Object invoke(Object obj, String key, Exchange exchange, AsyncCallback ca
case "ETH_GET_UNCLE_COUNT_BY_BLOCK_NUMBER": target.ethGetUncleCountByBlockNumber(exchange.getMessage()); return null;
case "eth_get_work":
case "ETH_GET_WORK": target.ethGetWork(exchange.getMessage()); return null;
case "eth_hashrate":
case "ETH_HASHRATE": target.ethHashrate(exchange.getMessage()); return null;
case "eth_mining":
case "ETH_MINING": target.ethMining(exchange.getMessage()); return null;
case "eth_new_block_filter":
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface Web3jConstants {
String ETH_MINING = "ETH_MINING";
@Metadata(label = "producer", description = "A hexadecimal string representation (32 bytes) of the hash rate.",
javaType = "String")
String ETH_HASHRATE = "ETH_HASHRATE";
String ETH_HASHRATE = "CamelWeb3jEthHashrate";
String ETH_GAS_PRICE = "ETH_GAS_PRICE";
String ETH_ACCOUNTS = "ETH_ACCOUNTS";
String ETH_BLOCK_NUMBER = "ETH_BLOCK_NUMBER";
Expand Down Expand Up @@ -98,111 +98,112 @@ public interface Web3jConstants {
String REPLAY_TRANSACTIONS_OBSERVABLE = "REPLAY_TRANSACTIONS_OBSERVABLE";

@Metadata(label = "producer", description = "The id", javaType = "Long")
String ID = "ID";
String OPERATION = "OPERATION";
String ID = "CamelWeb3jId";
@Metadata(label = "producer", description = "The operation to perform", javaType = "String")
String OPERATION = "CamelWeb3jOperation";
String TRANSACTION = "TRANSACTION";
/**
* The block number, or the string "latest" for the last mined block or "pending", "earliest" for not yet mined
* transactions.
*/
@Metadata(label = "producer", javaType = "String")
String AT_BLOCK = "AT_BLOCK";
String AT_BLOCK = "CamelWeb3jAtBlock";
@Metadata(label = "producer", description = "Contract address.", javaType = "String")
String ADDRESS = "ADDRESS";
String ADDRESS = "CamelWeb3jAddress";
@Metadata(label = "producer", description = "Contract address or a list of addresses.", javaType = "List<String>")
String ADDRESSES = "ADDRESSES";
String ADDRESSES = "CamelWeb3jAddresses";
@Metadata(label = "producer", description = "The address the transaction is send from", javaType = "String")
String FROM_ADDRESS = "FROM_ADDRESS";
String FROM_ADDRESS = "CamelWeb3jFromAddress";
@Metadata(label = "producer", description = "The address the transaction is directed to", javaType = "String")
String TO_ADDRESS = "TO_ADDRESS";
String TO_ADDRESS = "CamelWeb3jToAddress";
@Metadata(label = "producer", description = "The transaction index position withing a block.", javaType = "String")
String POSITION = "POSITION";
String POSITION = "CamelWeb3jPosition";
@Metadata(label = "producer", description = "Hash of the block where this transaction was in.", javaType = "String")
String BLOCK_HASH = "BLOCK_HASH";
String BLOCK_HASH = "CamelWeb3jBlockHash";
@Metadata(label = "producer", description = "The information about a transaction requested by transaction hash.",
javaType = "String")
String TRANSACTION_HASH = "TRANSACTION_HASH";
String TRANSACTION_HASH = "CamelWeb3jTransactionHash";
@Metadata(label = "producer", description = "Message to sign by calculating an Ethereum specific signature.",
javaType = "String")
String SHA3_HASH_OF_DATA_TO_SIGN = "SHA3_HASH_OF_DATA_TO_SIGN";
String SHA3_HASH_OF_DATA_TO_SIGN = "CamelWeb3jSha3HashOfDataToSign";
@Metadata(label = "producer",
description = "The signed transaction data for a new message call transaction or a contract creation for signed transactions.",
javaType = "String")
String SIGNED_TRANSACTION_DATA = "SIGNED_TRANSACTION_DATA";
String SIGNED_TRANSACTION_DATA = "CamelWeb3jSignedTransactionData";
@Metadata(label = "producer",
description = "If true it returns the full transaction objects, if false only the hashes of the transactions.",
javaType = "Boolean")
String FULL_TRANSACTION_OBJECTS = "FULL_TRANSACTION_OBJECTS";
String FULL_TRANSACTION_OBJECTS = "CamelWeb3jFullTransactionObjects";
@Metadata(label = "producer", description = "The transactions/uncle index position in the block.", javaType = "String")
String INDEX = "INDEX";
String INDEX = "CamelWeb3jIndex";
@Metadata(label = "producer", description = "The source code to compile.", javaType = "String")
String SOURCE_CODE = "SOURCE_CODE";
String SOURCE_CODE = "CamelWeb3jSourceCode";
@Metadata(label = "producer", description = "The filter id to use.", javaType = "java.math.BigInteger")
String FILTER_ID = "FILTER_ID";
String FILTER_ID = "CamelWeb3jFilterId";
@Metadata(label = "producer", description = "The local database name.", javaType = "String")
String DATABASE_NAME = "DATABASE_NAME";
String DATABASE_NAME = "CamelWeb3jDatabaseName";
@Metadata(label = "producer", description = "The key name in the database.", javaType = "String")
String KEY_NAME = "KEY_NAME";
String KEY_NAME = "CamelWeb3jKeyName";
@Metadata(label = "producer", description = "The nonce found (64 bits) used for submitting a proof-of-work solution.",
javaType = "java.math.BigInteger")
String NONCE = "NONCE";
String NONCE = "CamelWeb3jNonce";
@Metadata(label = "producer",
description = "The header's pow-hash (256 bits) used for submitting a proof-of-work solution.",
javaType = "String")
String HEADER_POW_HASH = "HEADER_POW_HASH";
String HEADER_POW_HASH = "CamelWeb3jHeaderPowHash";
@Metadata(label = "producer", description = "The mix digest (256 bits) used for submitting a proof-of-work solution.",
javaType = "String")
String MIX_DIGEST = "MIX_DIGEST";
String MIX_DIGEST = "CamelWeb3jMixDigest";
@Metadata(label = "producer", description = "A random hexadecimal(32 bytes) ID identifying the client.",
javaType = "String")
String CLIENT_ID = "CLIENT_ID";
String CLIENT_ID = "CamelWeb3jClientId";
@Metadata(label = "producer", description = "Gas price used for each paid gas.", javaType = "java.math.BigInteger")
String GAS_PRICE = "GAS_PRICE";
String GAS_PRICE = "CamelWeb3jGasPrice";
@Metadata(label = "producer", description = "The maximum gas allowed in this block.", javaType = "java.math.BigInteger")
String GAS_LIMIT = "GAS_LIMIT";
String GAS_LIMIT = "CamelWeb3jGasLimit";
@Metadata(label = "producer", description = "The value sent within a transaction.", javaType = "java.math.BigInteger")
String VALUE = "VALUE";
String VALUE = "CamelWeb3jValue";
@Metadata(label = "producer",
description = "The compiled code of a contract OR the hash of the invoked method signature and encoded parameters.",
javaType = "String")
String DATA = "DATA";
String DATA = "CamelWeb3jData";
/**
* The block number, or the string "latest" for the last mined block or "pending", "earliest" for not yet mined
* transactions.
*/
@Metadata(label = "producer", javaType = "String")
String FROM_BLOCK = "FROM_BLOCK";
String FROM_BLOCK = "CamelWeb3jFromBlock";
/**
* The block number, or the string "latest" for the last mined block or "pending", "earliest" for not yet mined
* transactions.
*/
@Metadata(label = "producer", javaType = "String")
String TO_BLOCK = "TO_BLOCK";
String TO_BLOCK = "CamelWeb3jToBlock";
@Metadata(label = "producer", description = "Topics are order-dependent. Each topic can also be a list of topics. " +
"Specify multiple topics separated by comma.",
javaType = "List<String>")
String TOPICS = "TOPICS";
String TOPICS = "CamelWeb3jTopics";
@Metadata(label = "producer", description = "The priority of a whisper message.", javaType = "java.math.BigInteger")
String PRIORITY = "PRIORITY";
String PRIORITY = "CamelWeb3jPriority";
@Metadata(label = "producer", description = "The time to live in seconds of a whisper message.",
javaType = "java.math.BigInteger")
String TTL = "TTL";
String TTL = "CamelWeb3jTtl";
@Metadata(label = "producer", description = "A transaction privateFor nodes with public keys in a Quorum network",
javaType = "List<String>")
String PRIVATE_FOR = "PRIVATE_FOR";
String PRIVATE_FOR = "CamelWeb3jPrivateFor";
@Metadata(label = "producer", description = "A transaction privateFrom",
javaType = "String")
String PRIVATE_FROM = "PRIVATE_FROM";
String PRIVATE_FROM = "CamelWeb3jPrivateFrom";

@Metadata(label = "producer", description = "The error code", javaType = "int")
String ERROR_CODE = "ERROR_CODE";
String ERROR_CODE = "CamelWeb3jErrorCode";
@Metadata(label = "producer", description = "The error data", javaType = "String")
String ERROR_DATA = "ERROR_DATA";
String ERROR_DATA = "CamelWeb3jErrorData";
@Metadata(label = "producer", description = "The error message", javaType = "String")
String ERROR_MESSAGE = "ERROR_MESSAGE";
String ERROR_MESSAGE = "CamelWeb3jErrorMessage";

@Metadata(label = "consumer", description = "The status of the operation", javaType = "String")
String HEADER_STATUS = "status";
String HEADER_STATUS = "CamelWeb3jStatus";
@Metadata(label = "consumer", description = "The operation", javaType = "String")
String HEADER_OPERATION = "operation";
String HEADER_OPERATION = "CamelWeb3jHeaderOperation";
}
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:start")
.to(getUrl() + OPERATION.toLowerCase() + "=" + Web3jConstants.WEB3_CLIENT_VERSION);
.to(getUrl() + "operation" + "=" + Web3jConstants.WEB3_CLIENT_VERSION);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:start")
.to(getUrl() + OPERATION.toLowerCase() + "=" + Web3jConstants.WEB3_CLIENT_VERSION);
.to(getUrl() + "operation" + "=" + Web3jConstants.WEB3_CLIENT_VERSION);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.junit.jupiter.api.Test;

import static org.apache.camel.component.web3j.Web3jConstants.ETH_BLOCK_HASH_OBSERVABLE;
import static org.apache.camel.component.web3j.Web3jConstants.OPERATION;

@Disabled("Requires Ganache instance with few transactions")
public class Web3jConsumerBlockHashTest extends Web3jIntegrationTestSupport {
Expand All @@ -41,7 +40,7 @@ public void configure() {
errorHandler(deadLetterChannel("mock:error"));

from("web3j://" + getUrl()
+ OPERATION.toLowerCase() + "=" + ETH_BLOCK_HASH_OBSERVABLE)
+ "operation" + "=" + ETH_BLOCK_HASH_OBSERVABLE)
.to("mock:result");
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.junit.jupiter.api.Test;

import static org.apache.camel.component.web3j.Web3jConstants.BLOCK_OBSERVABLE;
import static org.apache.camel.component.web3j.Web3jConstants.OPERATION;

@Disabled("Requires Ganache instance with few transactions")
public class Web3jConsumerBlockTest extends Web3jIntegrationTestSupport {
Expand All @@ -41,7 +40,7 @@ public void configure() {
errorHandler(deadLetterChannel("mock:error"));

from("web3j://" + getUrl()
+ OPERATION.toLowerCase() + "=" + BLOCK_OBSERVABLE)
+ "operation" + "=" + BLOCK_OBSERVABLE)
.to("mock:result");
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.junit.jupiter.api.Test;

import static org.apache.camel.component.web3j.Web3jConstants.ETH_LOG_OBSERVABLE;
import static org.apache.camel.component.web3j.Web3jConstants.OPERATION;

@Disabled("Requires Ganache instance with few transactions")
public class Web3jConsumerLogTest extends Web3jIntegrationTestSupport {
Expand All @@ -41,7 +40,7 @@ public void configure() {
errorHandler(deadLetterChannel("mock:error"));

from("web3j://" + getUrl()
+ OPERATION.toLowerCase() + "=" + ETH_LOG_OBSERVABLE + "&"
+ "operation" + "=" + ETH_LOG_OBSERVABLE + "&"
+ "fromBlock=earliest&"
+ "toBlock=latest&"
+ "address=0xc8CDceCE5d006dAB638029EBCf6Dd666efF5A952")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.junit.jupiter.api.Test;
import org.web3j.protocol.core.methods.response.EthBlock;

import static org.apache.camel.component.web3j.Web3jConstants.OPERATION;
import static org.apache.camel.component.web3j.Web3jConstants.REPLAY_BLOCKS_OBSERVABLE;

@Disabled("Requires a local node or registration at Infura")
Expand All @@ -51,7 +50,7 @@ public void configure() {
errorHandler(deadLetterChannel("mock:error"));

from("web3j://" + getUrl()
+ OPERATION.toLowerCase() + "=" + REPLAY_BLOCKS_OBSERVABLE + "&"
+ "operation" + "=" + REPLAY_BLOCKS_OBSERVABLE + "&"
+ "fromBlock=5713030&"
+ "toBlock=5713031&"
+ "fullTransactionObjects=false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.apache.camel.component.web3j.Web3jConstants.OPERATION;
import static org.apache.camel.component.web3j.Web3jConstants.REPLAY_BLOCKS_OBSERVABLE;

@Disabled("Requires Ganache instance with 10 transactions")
Expand All @@ -41,7 +40,7 @@ public void configure() {
errorHandler(deadLetterChannel("mock:error"));

from("web3j://" + getUrl()
+ OPERATION.toLowerCase() + "=" + REPLAY_BLOCKS_OBSERVABLE + "&"
+ "operation" + "=" + REPLAY_BLOCKS_OBSERVABLE + "&"
+ "fromBlock=0&"
+ "toBlock=2&"
+ "fullTransactionObjects=false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.apache.camel.component.web3j.Web3jConstants.OPERATION;
import static org.apache.camel.component.web3j.Web3jConstants.TRANSACTION_OBSERVABLE;

@Disabled("Requires Ganache instance with few transactions")
Expand All @@ -41,7 +40,7 @@ public void configure() {
errorHandler(deadLetterChannel("mock:error"));

from("web3j://" + getUrl()
+ OPERATION.toLowerCase() + "=" + TRANSACTION_OBSERVABLE)
+ "operation" + "=" + TRANSACTION_OBSERVABLE)
.to("mock:result");
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:start")
.to("web3j://" + getUrl() + OPERATION.toLowerCase() + "=" + TRANSACTION);
.to("web3j://" + getUrl() + "operation" + "=" + TRANSACTION);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:start")
.to("web3j://" + getUrl() + OPERATION.toLowerCase() + "=" + TRANSACTION);
.to("web3j://" + getUrl() + "operation" + "=" + TRANSACTION);
}
};
}
Expand Down
Loading