From b51f01ed100f97076584c6900f73deb5dc5f6bbc Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 29 Apr 2015 19:17:07 +0200 Subject: [PATCH 1/8] resources scripts --- CMakeLists.txt | 3 +++ cmake/EthUtils.cmake | 28 ++++++++++++++++++++++++++ cmake/scripts/resource.cpp.in | 26 ++++++++++++++++++++++++ cmake/scripts/resources.cmake | 37 +++++++++++++++++++++++++++++++++++ cmake/scripts/test.cmake | 6 ++++++ 5 files changed, 100 insertions(+) create mode 100644 cmake/scripts/resource.cpp.in create mode 100644 cmake/scripts/resources.cmake create mode 100644 cmake/scripts/test.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ff8732156..a770e9704 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -383,6 +383,9 @@ if (GUI) endif() +set(ETH_RESOURCES "LICENSE" "README.md") +eth_create_resources(ETH_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/here.h") + #unset(TARGET_PLATFORM CACHE) if (WIN32) diff --git a/cmake/EthUtils.cmake b/cmake/EthUtils.cmake index 69690156a..5d271f341 100644 --- a/cmake/EthUtils.cmake +++ b/cmake/EthUtils.cmake @@ -62,3 +62,31 @@ macro(eth_add_test NAME) endmacro() +# Based on +# http://stackoverflow.com/questions/11813271/embed-resources-eg-shader-code-images-into-executable-library-with-cmake +# Creates C resources file from files +function(eth_create_resources bins output) + set(tmp_output "${output}.tmp") + # Create empty output file + file(WRITE ${tmp_output} "") + # Collect input files +# file(GLOB bins ${dir}/*) + # Iterate through input files + foreach(bin ${${bins}}) + # Get short filename + string(REGEX MATCH "([^/]+)$" filename ${bin}) + # Replace filename spaces & extension separator for C compatibility + string(REGEX REPLACE "\\.| " "_" filename ${filename}) + # Add eth prefix (qt does the same thing) + set(filename "eth_${filename}") + # full name + file(GLOB the_name ${bin}) + # Read hex data from file + file(READ ${bin} filedata HEX) + # Convert hex data for C compatibility + string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata}) + # Append data to output file + file(APPEND ${tmp_output} "static const unsigned char ${filename}[] = {\n // ${the_name}\n ${filedata}};\nstatic const unsigned ${filename}_size = sizeof(${filename});\n") + endforeach() + replace_if_different("${tmp_output}" "${output}") +endfunction() diff --git a/cmake/scripts/resource.cpp.in b/cmake/scripts/resource.cpp.in new file mode 100644 index 000000000..369f7b56f --- /dev/null +++ b/cmake/scripts/resource.cpp.in @@ -0,0 +1,26 @@ + +#include +#include +#include +#include + +using namespace std; + +${ETH_RESULT_DATA} + +static unordered_map eth_resources; +static unordered_map eth_sizes; + +void initResources() +{ + ${ETH_RESULT_INIT} + //eth_resources["LICENSE"] = (char const*)eth_LICENSE; + //eth_sizes["LICENSE"] = sizeof(eth_LICENSE); +} + +string loadResource(string _name) +{ + ostringstream bistream; + bistream.write(eth_resources[_name], eth_sizes[_name]); + return bistream.str(); +} diff --git a/cmake/scripts/resources.cmake b/cmake/scripts/resources.cmake new file mode 100644 index 000000000..2c92103ff --- /dev/null +++ b/cmake/scripts/resources.cmake @@ -0,0 +1,37 @@ + +# cmake -DETH_RES_FILE=... -DETH_DST_NAME=... -P scripts/resources.cmake +# cmake -DETH_RES_FILE=test.cmake -DETH_DST_NAME=dst -P resources.cmake + +# should define ETH_RESOURCES +include(${ETH_RES_FILE}) + +set(ETH_RESULT_DATA) +set(ETH_RESULT_INIT) + +# resource is a name visible for cpp application +foreach(resource ${ETH_RESOURCES}) + + # filename is the name of file which will be used in app + set(filename ${${resource}}) + + # filedata is a file content + file(READ ${filename} filedata HEX) + + # Convert hex data for C compatibility + string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata}) + + # append static variables to result variable + list(APPEND ${ETH_RESULT_DATA} "static const unsigned char eth_${resource}[] = {\n // ${filename}\n ${filedata}\n};\n") + + # append init resources + list(APPEND ${ETH_RESULT_INIT} " eth_resources[\"${resource}\"] = (char const*)eth_${resource};\n") + list(APPEND ${ETH_RESULT_INIT} " eth_sizes[\"${resource}\"] = sizeof(eth_${resource});\n") + +endforeach(resource) + +configure_file("resource.cpp.in" "${ETH_DST_NAME}.cpp.tmp") + +include("../EthUtils.cmake") +replace_if_different("${ETH_DST_NAME}.cpp.tmp" "${ETH_DST_NAME}.cpp") +replace_if_different("resource.h" "${ETH_DST_NAME}.h") + diff --git a/cmake/scripts/test.cmake b/cmake/scripts/test.cmake new file mode 100644 index 000000000..883ed324e --- /dev/null +++ b/cmake/scripts/test.cmake @@ -0,0 +1,6 @@ + +set(copydlls "copydlls.cmake") +set(conf "configure.cmake") + +set(ETH_RESOURCES "copyddls" "conf") + From a7996f4de717da9a82fb740e8d7abbb64d90c1d7 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 29 Apr 2015 22:38:58 +0200 Subject: [PATCH 2/8] finished resource scripts --- CMakeLists.txt | 3 --- cmake/EthUtils.cmake | 30 +++------------------- cmake/scripts/resource.cpp.in | 21 +++++++--------- cmake/scripts/resource.h.in | 26 +++++++++++++++++++ cmake/scripts/resources.cmake | 47 ++++++++++++++++++++++++++--------- cmake/scripts/test.cmake | 6 ----- 6 files changed, 74 insertions(+), 59 deletions(-) create mode 100644 cmake/scripts/resource.h.in delete mode 100644 cmake/scripts/test.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a770e9704..ff8732156 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -383,9 +383,6 @@ if (GUI) endif() -set(ETH_RESOURCES "LICENSE" "README.md") -eth_create_resources(ETH_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/here.h") - #unset(TARGET_PLATFORM CACHE) if (WIN32) diff --git a/cmake/EthUtils.cmake b/cmake/EthUtils.cmake index 5d271f341..147ce0737 100644 --- a/cmake/EthUtils.cmake +++ b/cmake/EthUtils.cmake @@ -62,31 +62,9 @@ macro(eth_add_test NAME) endmacro() -# Based on -# http://stackoverflow.com/questions/11813271/embed-resources-eg-shader-code-images-into-executable-library-with-cmake # Creates C resources file from files -function(eth_create_resources bins output) - set(tmp_output "${output}.tmp") - # Create empty output file - file(WRITE ${tmp_output} "") - # Collect input files -# file(GLOB bins ${dir}/*) - # Iterate through input files - foreach(bin ${${bins}}) - # Get short filename - string(REGEX MATCH "([^/]+)$" filename ${bin}) - # Replace filename spaces & extension separator for C compatibility - string(REGEX REPLACE "\\.| " "_" filename ${filename}) - # Add eth prefix (qt does the same thing) - set(filename "eth_${filename}") - # full name - file(GLOB the_name ${bin}) - # Read hex data from file - file(READ ${bin} filedata HEX) - # Convert hex data for C compatibility - string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata}) - # Append data to output file - file(APPEND ${tmp_output} "static const unsigned char ${filename}[] = {\n // ${the_name}\n ${filedata}};\nstatic const unsigned ${filename}_size = sizeof(${filename});\n") - endforeach() - replace_if_different("${tmp_output}" "${output}") +function(eth_add_resources TARGET RESOURCE_FILE) + add_custom_command(TARGET ${TARGET} PRE_BUILD + COMMAND ${CMAKE_COMMAND} -DETH_RES_FILE="${RESOURCE_FILE}" -P "${ETH_SCRIPTS_DIR}/resources.cmake" + ) endfunction() diff --git a/cmake/scripts/resource.cpp.in b/cmake/scripts/resource.cpp.in index 369f7b56f..b73a8df1a 100644 --- a/cmake/scripts/resource.cpp.in +++ b/cmake/scripts/resource.cpp.in @@ -1,26 +1,23 @@ +// this file is autogenerated, do not modify!!! -#include #include #include -#include +#include "${ETH_RESOURCE_NAME}.h" using namespace std; +using namespace dev; +using namespace dev::eth; -${ETH_RESULT_DATA} - -static unordered_map eth_resources; -static unordered_map eth_sizes; - -void initResources() +${ETH_RESOURCE_NAME}::${ETH_RESOURCE_NAME}() { - ${ETH_RESULT_INIT} - //eth_resources["LICENSE"] = (char const*)eth_LICENSE; - //eth_sizes["LICENSE"] = sizeof(eth_LICENSE); +${ETH_RESULT_DATA} +${ETH_RESULT_INIT} } -string loadResource(string _name) +string ${ETH_RESOURCE_NAME}::loadResourceAsString(string _name) { ostringstream bistream; bistream.write(eth_resources[_name], eth_sizes[_name]); return bistream.str(); } + diff --git a/cmake/scripts/resource.h.in b/cmake/scripts/resource.h.in new file mode 100644 index 000000000..b27c3c882 --- /dev/null +++ b/cmake/scripts/resource.h.in @@ -0,0 +1,26 @@ +// this file is autogenerated, do not modify!!! +#pragma once + +#include +#include + +namespace dev +{ +namespace eth +{ + +class ${ETH_RESOURCE_NAME} +{ +public: + ${ETH_RESOURCE_NAME}(); + std::string loadResourceAsString(std::string _name): + +private: + std::unordered_map m_resources; + std::unordered_map m_sizes; + +}; + +} +} + diff --git a/cmake/scripts/resources.cmake b/cmake/scripts/resources.cmake index 2c92103ff..3e47a1bfb 100644 --- a/cmake/scripts/resources.cmake +++ b/cmake/scripts/resources.cmake @@ -1,37 +1,60 @@ - -# cmake -DETH_RES_FILE=... -DETH_DST_NAME=... -P scripts/resources.cmake -# cmake -DETH_RES_FILE=test.cmake -DETH_DST_NAME=dst -P resources.cmake +# based on: http://stackoverflow.com/questions/11813271/embed-resources-eg-shader-code-images-into-executable-library-with-cmake +# +# example: +# cmake -DETH_RES_FILE=test.cmake -P resources.cmake +# +# where test.cmake is: +# +# # BEGIN OF cmake.test +# +# set(copydlls "copydlls.cmake") +# set(conf "configure.cmake") +# +# # this three properties must be set! +# +# set(ETH_RESOURCE_NAME "EthResources") +# set(ETH_RESOURCE_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}") +# set(ETH_RESOURCES "copydlls" "conf") +# +# # END of cmake.test +# # should define ETH_RESOURCES include(${ETH_RES_FILE}) -set(ETH_RESULT_DATA) -set(ETH_RESULT_INIT) +set(ETH_RESULT_DATA "") +set(ETH_RESULT_INIT "") # resource is a name visible for cpp application foreach(resource ${ETH_RESOURCES}) - + # filename is the name of file which will be used in app set(filename ${${resource}}) # filedata is a file content file(READ ${filename} filedata HEX) + # read full name of the file + file(GLOB filename ${filename}) + # Convert hex data for C compatibility string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata}) # append static variables to result variable - list(APPEND ${ETH_RESULT_DATA} "static const unsigned char eth_${resource}[] = {\n // ${filename}\n ${filedata}\n};\n") + set(ETH_RESULT_DATA "${ETH_RESULT_DATA} static const unsigned char eth_${resource}[] = {\n // ${filename}\n ${filedata}\n};\n") # append init resources - list(APPEND ${ETH_RESULT_INIT} " eth_resources[\"${resource}\"] = (char const*)eth_${resource};\n") - list(APPEND ${ETH_RESULT_INIT} " eth_sizes[\"${resource}\"] = sizeof(eth_${resource});\n") + set(ETH_RESULT_INIT "${ETH_RESULT_INIT} eth_resources[\"${resource}\"] = (char const*)eth_${resource};\n") + set(ETH_RESULT_INIT "${ETH_RESULT_INIT} eth_sizes[\"${resource}\"] = sizeof(eth_${resource});\n") endforeach(resource) -configure_file("resource.cpp.in" "${ETH_DST_NAME}.cpp.tmp") +set(ETH_DST_NAME "${ETH_RESOURCE_LOCATION}/${ETH_RESOURCE_NAME}") + +configure_file("${CMAKE_CURRENT_LIST_DIR}/resource.cpp.in" "${ETH_DST_NAME}.cpp.tmp") +configure_file("${CMAKE_CURRENT_LIST_DIR}/resource.h.in" "${ETH_DST_NAME}.h.tmp") -include("../EthUtils.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/../EthUtils.cmake") replace_if_different("${ETH_DST_NAME}.cpp.tmp" "${ETH_DST_NAME}.cpp") -replace_if_different("resource.h" "${ETH_DST_NAME}.h") +replace_if_different("${ETH_DST_NAME}.h.tmp" "${ETH_DST_NAME}.h") diff --git a/cmake/scripts/test.cmake b/cmake/scripts/test.cmake deleted file mode 100644 index 883ed324e..000000000 --- a/cmake/scripts/test.cmake +++ /dev/null @@ -1,6 +0,0 @@ - -set(copydlls "copydlls.cmake") -set(conf "configure.cmake") - -set(ETH_RESOURCES "copyddls" "conf") - From 6da6f4ee53e884fe210ce8804c772c98971db324 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 29 Apr 2015 23:09:40 +0200 Subject: [PATCH 3/8] fixed indention --- cmake/scripts/resources.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/scripts/resources.cmake b/cmake/scripts/resources.cmake index 3e47a1bfb..d69d99e96 100644 --- a/cmake/scripts/resources.cmake +++ b/cmake/scripts/resources.cmake @@ -34,8 +34,8 @@ foreach(resource ${ETH_RESOURCES}) # filedata is a file content file(READ ${filename} filedata HEX) - # read full name of the file - file(GLOB filename ${filename}) + # read full name of the file + file(GLOB filename ${filename}) # Convert hex data for C compatibility string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata}) From 6315351b7af0377fd56c1022ff4991779838111e Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 30 Apr 2015 00:57:58 +0200 Subject: [PATCH 4/8] fixes for eth_add_resources --- cmake/EthUtils.cmake | 6 +++++- cmake/scripts/resource.cpp.in | 23 ---------------------- cmake/scripts/resource.h.in | 26 ------------------------- cmake/scripts/resource.hpp.in | 36 +++++++++++++++++++++++++++++++++++ cmake/scripts/resources.cmake | 10 ++++------ 5 files changed, 45 insertions(+), 56 deletions(-) delete mode 100644 cmake/scripts/resource.cpp.in delete mode 100644 cmake/scripts/resource.h.in create mode 100644 cmake/scripts/resource.hpp.in diff --git a/cmake/EthUtils.cmake b/cmake/EthUtils.cmake index 147ce0737..d5da866ea 100644 --- a/cmake/EthUtils.cmake +++ b/cmake/EthUtils.cmake @@ -64,7 +64,11 @@ endmacro() # Creates C resources file from files function(eth_add_resources TARGET RESOURCE_FILE) - add_custom_command(TARGET ${TARGET} PRE_BUILD + + add_custom_target("${TARGET}.resources" COMMAND ${CMAKE_COMMAND} -DETH_RES_FILE="${RESOURCE_FILE}" -P "${ETH_SCRIPTS_DIR}/resources.cmake" ) + + add_dependencies(${TARGET} "${TARGET}.resources") + endfunction() diff --git a/cmake/scripts/resource.cpp.in b/cmake/scripts/resource.cpp.in deleted file mode 100644 index b73a8df1a..000000000 --- a/cmake/scripts/resource.cpp.in +++ /dev/null @@ -1,23 +0,0 @@ -// this file is autogenerated, do not modify!!! - -#include -#include -#include "${ETH_RESOURCE_NAME}.h" - -using namespace std; -using namespace dev; -using namespace dev::eth; - -${ETH_RESOURCE_NAME}::${ETH_RESOURCE_NAME}() -{ -${ETH_RESULT_DATA} -${ETH_RESULT_INIT} -} - -string ${ETH_RESOURCE_NAME}::loadResourceAsString(string _name) -{ - ostringstream bistream; - bistream.write(eth_resources[_name], eth_sizes[_name]); - return bistream.str(); -} - diff --git a/cmake/scripts/resource.h.in b/cmake/scripts/resource.h.in deleted file mode 100644 index b27c3c882..000000000 --- a/cmake/scripts/resource.h.in +++ /dev/null @@ -1,26 +0,0 @@ -// this file is autogenerated, do not modify!!! -#pragma once - -#include -#include - -namespace dev -{ -namespace eth -{ - -class ${ETH_RESOURCE_NAME} -{ -public: - ${ETH_RESOURCE_NAME}(); - std::string loadResourceAsString(std::string _name): - -private: - std::unordered_map m_resources; - std::unordered_map m_sizes; - -}; - -} -} - diff --git a/cmake/scripts/resource.hpp.in b/cmake/scripts/resource.hpp.in new file mode 100644 index 000000000..a8bbca377 --- /dev/null +++ b/cmake/scripts/resource.hpp.in @@ -0,0 +1,36 @@ +// this file is autogenerated, do not modify!!! +#pragma once + +#include +#include +#include + +namespace dev +{ +namespace eth +{ + +class ${ETH_RESOURCE_NAME} +{ +public: + ${ETH_RESOURCE_NAME}() + { +${ETH_RESULT_DATA} +${ETH_RESULT_INIT} + } + + std::string loadResourceAsString(std::string _name) + { + std::ostringstream bistream; + bistream.write(m_resources[_name], m_sizes[_name]); + return bistream.str(); + } + +private: + std::map m_resources; + std::map m_sizes; +}; + +} +} + diff --git a/cmake/scripts/resources.cmake b/cmake/scripts/resources.cmake index d69d99e96..93326a257 100644 --- a/cmake/scripts/resources.cmake +++ b/cmake/scripts/resources.cmake @@ -44,17 +44,15 @@ foreach(resource ${ETH_RESOURCES}) set(ETH_RESULT_DATA "${ETH_RESULT_DATA} static const unsigned char eth_${resource}[] = {\n // ${filename}\n ${filedata}\n};\n") # append init resources - set(ETH_RESULT_INIT "${ETH_RESULT_INIT} eth_resources[\"${resource}\"] = (char const*)eth_${resource};\n") - set(ETH_RESULT_INIT "${ETH_RESULT_INIT} eth_sizes[\"${resource}\"] = sizeof(eth_${resource});\n") + set(ETH_RESULT_INIT "${ETH_RESULT_INIT} m_resources[\"${resource}\"] = (char const*)eth_${resource};\n") + set(ETH_RESULT_INIT "${ETH_RESULT_INIT} m_sizes[\"${resource}\"] = sizeof(eth_${resource});\n") endforeach(resource) set(ETH_DST_NAME "${ETH_RESOURCE_LOCATION}/${ETH_RESOURCE_NAME}") -configure_file("${CMAKE_CURRENT_LIST_DIR}/resource.cpp.in" "${ETH_DST_NAME}.cpp.tmp") -configure_file("${CMAKE_CURRENT_LIST_DIR}/resource.h.in" "${ETH_DST_NAME}.h.tmp") +configure_file("${CMAKE_CURRENT_LIST_DIR}/resource.hpp.in" "${ETH_DST_NAME}.hpp.tmp") include("${CMAKE_CURRENT_LIST_DIR}/../EthUtils.cmake") -replace_if_different("${ETH_DST_NAME}.cpp.tmp" "${ETH_DST_NAME}.cpp") -replace_if_different("${ETH_DST_NAME}.h.tmp" "${ETH_DST_NAME}.h") +replace_if_different("${ETH_DST_NAME}.hpp.tmp" "${ETH_DST_NAME}.hpp") From 0cbdda18d18f59fc05c3b2e84097fcf223da8de5 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 30 Apr 2015 10:43:30 +0200 Subject: [PATCH 5/8] simplified loading string from eth resources --- cmake/scripts/resource.hpp.in | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cmake/scripts/resource.hpp.in b/cmake/scripts/resource.hpp.in index a8bbca377..6a9740616 100644 --- a/cmake/scripts/resource.hpp.in +++ b/cmake/scripts/resource.hpp.in @@ -2,7 +2,6 @@ #pragma once #include -#include #include namespace dev @@ -19,12 +18,7 @@ ${ETH_RESULT_DATA} ${ETH_RESULT_INIT} } - std::string loadResourceAsString(std::string _name) - { - std::ostringstream bistream; - bistream.write(m_resources[_name], m_sizes[_name]); - return bistream.str(); - } + std::string loadResourceAsString(std::string _name) { return std::string(m_resources[_name], m_sizes[_name]); } private: std::map m_resources; From d4373dc185460790e280a35ff3ebe23a13816266 Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 30 Apr 2015 12:06:56 +0200 Subject: [PATCH 6/8] deployment fixed to work with GlobalRegistrar --- alethzero/DappLoader.cpp | 2 +- mix/qml/js/NetworkDeployment.js | 28 +++++++++++++++++++++++++--- mix/qml/js/TransactionHelper.js | 4 ++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/alethzero/DappLoader.cpp b/alethzero/DappLoader.cpp index 6ac1afbcb..7c754f8f5 100644 --- a/alethzero/DappLoader.cpp +++ b/alethzero/DappLoader.cpp @@ -82,7 +82,7 @@ DappLocation DappLoader::resolveAppUri(QString const& _uri) } string32 urlHintName = ZeroString32; - QByteArray utf8 = QString("UrlHint").toUtf8(); + QByteArray utf8 = QString("urlhint").toUtf8(); std::copy(utf8.data(), utf8.data() + utf8.size(), urlHintName.data()); Address urlHint = abiOut
(web3()->ethereum()->call(m_nameReg, abiIn("addr(bytes32)", urlHintName)).output); diff --git a/mix/qml/js/NetworkDeployment.js b/mix/qml/js/NetworkDeployment.js index fa85ddc54..9bbed2415 100644 --- a/mix/qml/js/NetworkDeployment.js +++ b/mix/qml/js/NetworkDeployment.js @@ -219,7 +219,9 @@ function finalizeDeployment(deploymentId, addresses) { function checkEthPath(dappUrl, callBack) { if (dappUrl.length === 1) - registerContentHash(deploymentDialog.eth, callBack); // we directly create a dapp under the root registrar. + reserve(deploymentDialog.eth, function() { + registerContentHash(deploymentDialog.eth, callBack); // we directly create a dapp under the root registrar. + }); else { // the first owned registrar must have been created to follow the path. @@ -310,7 +312,7 @@ function checkRegistration(dappUrl, addr, callBack) requests.push({ jsonrpc: "2.0", method: "eth_sendTransaction", - params: [ { "from": deploymentDialog.currentAccount, "gas": 20000, "code": "0x600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317815561058990819061003990396000f3007c010000000000000000000000000000000000000000000000000000000060003504630198489281146100a757806302571be3146100d957806321f8a721146100e35780632dff6941146100ed5780633b3b57de1461010d5780635a3a05bd1461013d5780635fd4b08a1461017057806389a69c0e1461017c578063b5c645bd146101b0578063be99a9801461022c578063c3d014d614610264578063d93e75731461029857005b73ffffffffffffffffffffffffffffffffffffffff600435166000908152600160205260409020548060005260206000f35b6000808052602081f35b6000808052602081f35b600435600090815260026020819052604090912001548060005260206000f35b600435600090815260026020908152604082205473ffffffffffffffffffffffffffffffffffffffff1680835291f35b600435600090815260026020908152604082206001015473ffffffffffffffffffffffffffffffffffffffff1680835291f35b60008060005260206000f35b6000546102c89060043590602435903373ffffffffffffffffffffffffffffffffffffffff908116911614610451576104b1565b600435600090815260026020819052604090912080546001820154919092015473ffffffffffffffffffffffffffffffffffffffff9283169291909116908273ffffffffffffffffffffffffffffffffffffffff166000528173ffffffffffffffffffffffffffffffffffffffff166020528060405260606000f35b6000546102ce906004359060243590604435903373ffffffffffffffffffffffffffffffffffffffff9081169116146104b557610584565b6000546102d49060043590602435903373ffffffffffffffffffffffffffffffffffffffff9081169116146102e05761031d565b6000546102da90600435903373ffffffffffffffffffffffffffffffffffffffff9081169116146103215761044e565b60006000f35b60006000f35b60006000f35b60006000f35b600082815260026020819052604080832090910183905583917fa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc91a25b5050565b60008181526002602090815260408083205473ffffffffffffffffffffffffffffffffffffffff1683526001909152902054811461035e576103de565b6000818152600260205260408082205473ffffffffffffffffffffffffffffffffffffffff169183917ff63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a85459190a360008181526002602090815260408083205473ffffffffffffffffffffffffffffffffffffffff16835260019091528120555b600081815260026020819052604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081168255600182018054909116905590910182905582917fa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc91a25b50565b60008281526002602052604080822060010180547fffffffffffffffffffffffff0000000000000000000000000000000000000000168417905583917fa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc91a25b5050565b600083815260026020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016831790558061051c57827fa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc60006040a2610583565b73ffffffffffffffffffffffffffffffffffffffff8216837ff63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a854560006040a373ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090208390555b5b50505056" } ], + params: [ { "from": deploymentDialog.currentAccount, "gas": 20000, "code": "0x600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317815561058990819061003990396000f3007c010000000000000000000000000000000000000000000000000000000060003504630198489281146100a757806302571be3146100d957806321f8a721146100e35780632dff6941146100ed5780633b3b57de1461010d5780635a3a05bd1461013d5780635fd4b08a1461017057806389a69c0e1461017c578063b5c645bd146101b0578063be99a9801461022c578063c3d014d614610264578063d93e75731461029857005b73ffffffffffffffffffffffffffffffffffffffff600435166000908152600160205260409020548060005260206000f35b6000808052602081f35b6000808052602081f35b600435600090815260026020819052604090912001548060005260206000f35b600435600090815260026020908152604082205473ffffffffffffffffffffffffffffffffffffffff1680835291f35b600435600090815260026020908152604082206001015473ffffffffffffffffffffffffffffffffffffffff1680835291f35b60008060005260206000f35b6000546102c89060043590602435903373ffffffffffffffffffffffffffffffffffffffff90811691161461052557610585565b600435600090815260026020819052604090912080546001820154919092015473ffffffffffffffffffffffffffffffffffffffff9283169291909116908273ffffffffffffffffffffffffffffffffffffffff166000528173ffffffffffffffffffffffffffffffffffffffff166020528060405260606000f35b6000546102ce906004359060243590604435903373ffffffffffffffffffffffffffffffffffffffff9081169116146102e0576103af565b6000546102d49060043590602435903373ffffffffffffffffffffffffffffffffffffffff9081169116146103b4576103f1565b6000546102da90600435903373ffffffffffffffffffffffffffffffffffffffff9081169116146103f557610522565b60006000f35b60006000f35b60006000f35b60006000f35b600083815260026020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016831790558061034757827fa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc60006040a26103ae565b73ffffffffffffffffffffffffffffffffffffffff8216837ff63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a854560006040a373ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090208390555b5b505050565b600082815260026020819052604080832090910183905583917fa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc91a25b5050565b60008181526002602090815260408083205473ffffffffffffffffffffffffffffffffffffffff16835260019091529020548114610432576104b2565b6000818152600260205260408082205473ffffffffffffffffffffffffffffffffffffffff169183917ff63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a85459190a360008181526002602090815260408083205473ffffffffffffffffffffffffffffffffffffffff16835260019091528120555b600081815260026020819052604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081168255600182018054909116905590910182905582917fa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc91a25b50565b60008281526002602052604080822060010180547fffffffffffffffffffffffff0000000000000000000000000000000000000000168417905583917fa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc91a25b505056" } ], id: jsonRpcRequestId++ }); @@ -353,6 +355,26 @@ function trCountIncrementTimeOut() deploymentError(error); } +function reserve(registrar, callBack) +{ + var txt = qsTr("Making reservation in the root registrar..."); + deploymentStepChanged(txt); + console.log(txt); + var requests = []; + var paramTitle = clientModel.encodeStringParam(projectModel.projectTitle); + requests.push({ + //reserve() + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ { "from": deploymentDialog.currentAccount, "gas": "0xfffff", "to": '0x' + registrar, "data": "0x432ced04" + paramTitle } ], + id: jsonRpcRequestId++ + }); + rpcCall(requests, function (httpRequest, response) { + callBack(); + }); +} + + function registerContentHash(registrar, callBack) { var txt = qsTr("Finalizing Dapp registration ..."); @@ -398,7 +420,7 @@ function registerToUrlHint() function urlHintAddress(callBack) { var requests = []; - var urlHint = clientModel.encodeStringParam("UrlHint"); + var urlHint = clientModel.encodeStringParam("urlhint"); requests.push({ //registrar: get UrlHint addr jsonrpc: "2.0", diff --git a/mix/qml/js/TransactionHelper.js b/mix/qml/js/TransactionHelper.js index f0b4991fc..be057917c 100644 --- a/mix/qml/js/TransactionHelper.js +++ b/mix/qml/js/TransactionHelper.js @@ -17,6 +17,7 @@ function rpcCall(requests, callBack) { var jsonRpcUrl = "http://localhost:8080"; var rpcRequest = JSON.stringify(requests); + console.log(rpcRequest); var httpRequest = new XMLHttpRequest(); httpRequest.open("POST", jsonRpcUrl, true); httpRequest.setRequestHeader("Content-type", "application/json"); @@ -31,7 +32,10 @@ function rpcCall(requests, callBack) deploymentError(errorText); } else + { + console.log(httpRequest.responseText); callBack(httpRequest.status, httpRequest.responseText) + } } } httpRequest.send(rpcRequest); From 2a9e2f663e46cb521f12abd981e505cfae48ecd0 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 30 Apr 2015 12:40:02 +0200 Subject: [PATCH 7/8] improved eth_add_resources --- cmake/EthUtils.cmake | 19 ++++++++++++++----- cmake/scripts/resources.cmake | 1 - 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cmake/EthUtils.cmake b/cmake/EthUtils.cmake index d5da866ea..85d8c0dc4 100644 --- a/cmake/EthUtils.cmake +++ b/cmake/EthUtils.cmake @@ -63,12 +63,21 @@ macro(eth_add_test NAME) endmacro() # Creates C resources file from files -function(eth_add_resources TARGET RESOURCE_FILE) +function(eth_add_resources RESOURCE_FILE OUT_FILE) + include("${RESOURCE_FILE}") + set(OUTPUT "${ETH_RESOURCE_LOCATION}/${ETH_RESOURCE_NAME}.hpp") + set(${OUT_FILE} "${OUTPUT}" PARENT_SCOPE) - add_custom_target("${TARGET}.resources" - COMMAND ${CMAKE_COMMAND} -DETH_RES_FILE="${RESOURCE_FILE}" -P "${ETH_SCRIPTS_DIR}/resources.cmake" - ) + set(filenames "${RESOURCE_FILE}") + list(APPEND filenames "${ETH_SCRIPTS_DIR}/resources.cmake") + foreach(resource ${ETH_RESOURCES}) + list(APPEND filenames "${${resource}}") + endforeach(resource) - add_dependencies(${TARGET} "${TARGET}.resources") + message(STATUS "filenames; ${filenames}") + add_custom_command(OUTPUT ${OUTPUT} + COMMAND ${CMAKE_COMMAND} -DETH_RES_FILE="${RESOURCE_FILE}" -P "${ETH_SCRIPTS_DIR}/resources.cmake" + DEPENDS ${filenames} + ) endfunction() diff --git a/cmake/scripts/resources.cmake b/cmake/scripts/resources.cmake index 93326a257..b0cadbf6d 100644 --- a/cmake/scripts/resources.cmake +++ b/cmake/scripts/resources.cmake @@ -55,4 +55,3 @@ configure_file("${CMAKE_CURRENT_LIST_DIR}/resource.hpp.in" "${ETH_DST_NAME}.hpp. include("${CMAKE_CURRENT_LIST_DIR}/../EthUtils.cmake") replace_if_different("${ETH_DST_NAME}.hpp.tmp" "${ETH_DST_NAME}.hpp") - From 9dfabc79665e9420c297823daaa2bb5ee2055a5e Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 30 Apr 2015 12:47:14 +0200 Subject: [PATCH 8/8] removed redundant log in cmake utils --- cmake/EthUtils.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake/EthUtils.cmake b/cmake/EthUtils.cmake index 85d8c0dc4..a426b1218 100644 --- a/cmake/EthUtils.cmake +++ b/cmake/EthUtils.cmake @@ -74,8 +74,6 @@ function(eth_add_resources RESOURCE_FILE OUT_FILE) list(APPEND filenames "${${resource}}") endforeach(resource) - message(STATUS "filenames; ${filenames}") - add_custom_command(OUTPUT ${OUTPUT} COMMAND ${CMAKE_COMMAND} -DETH_RES_FILE="${RESOURCE_FILE}" -P "${ETH_SCRIPTS_DIR}/resources.cmake" DEPENDS ${filenames}