commit 3e355bd0fcfe0a5ab77dd7bb9e512271e5a51d42 Author: Christopher Jeffrey Date: Tue Aug 12 15:03:04 2014 -0400 bitcoind.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..98d77135 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +node_modules/* +out/* +build/* +.lock-wscript +Makefile.gyp +*.swp +*.Makefile +*.target.gyp.mk +*.node +*.sln +*.sdf +*.vcxproj +*.suo +*.opensdf +*.filters +*.user +*.project +test.js diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..cd70b6e4 --- /dev/null +++ b/.npmignore @@ -0,0 +1,10 @@ +.git* +build/ +.lock-wscript +out/ +Makefile.gyp +*.Makefile +*.target.gyp.mk +node_modules/ +test/ +*.node diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..2d7b0fe0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014, BitPay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..ceb96145 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +all: + @type node-gyp > /dev/null 2>&1 && make gyp || make waf + +waf: + node-waf configure build + +gyp: + node-gyp configure + node-gyp build + +clean: + @type node-gyp > /dev/null 2>&1 && make clean-gyp || make clean-waf + +clean-waf: + @rm -rf ./build .lock-wscript + +clean-gyp: + @node-gyp clean 2>/dev/null + +.PHONY: all waf gyp clean clean-waf clean-gyp diff --git a/README.md b/README.md new file mode 100644 index 00000000..df0e7570 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# bitcoind.js + +Bitcoind for node + +## Contribution and License Agreement + +If you contribute code to this project, you are implicitly allowing your code +to be distributed under the MIT license. You are also implicitly verifying that +all code is your original work. `` + +## License + +Copyright (c) 2014, BitPay (MIT License). diff --git a/binding.gyp b/binding.gyp new file mode 100644 index 00000000..c11917f9 --- /dev/null +++ b/binding.gyp @@ -0,0 +1,16 @@ +{ + 'targets': [{ + 'target_name': 'bitcoindjs', + 'include_dirs' : [ + ' +#include +#include + +#include +#include +#include +#include + +using namespace node; +using namespace v8; + +NAN_METHOD(StartBitcoind); + +static int +misc_func(const char *); + +extern "C" void +init(Handle); + +/** + * StartBitcoind + * bitcoind.start(callback) + */ + +NAN_METHOD(StartBitcoind) { + NanScope(); + + if (args.Length() < 1 || !args[0]->IsFunction()) { + return NanThrowError( + "Usage: bitcoind.start(callback)"); + } + + Local obj = NanNew(); + obj->Set(NanNew("foo"), NanNew(100)); + + NanReturnValue(obj); +} + +/** + * misc_func + */ + +static int +misc_func(const char *file) { + return 0; +} + +/** + * Init + */ + +extern "C" void +init(Handle target) { + NanScope(); + NODE_SET_METHOD(target, "start", StartBitcoind); +} + +NODE_MODULE(bitcoindjs, init) diff --git a/wscript b/wscript new file mode 100644 index 00000000..92d54bac --- /dev/null +++ b/wscript @@ -0,0 +1,17 @@ +srcdir = "." +blddir = "build" +VERSION = "0.0.1" + +def set_options(opt): + opt.tool_options("compiler_cxx") + +def configure(conf): + conf.check_tool("compiler_cxx") + conf.check_tool("node_addon") + +def build(bld): + obj = bld.new_task_gen("cxx", "shlib", "node_addon") + obj.cxxflags = ["-Wall"] + obj.linkflags = [] + obj.target = "bitcoindjs" + obj.source = "src/bitcoindjs.cc"