flocore-node/src/bitcoindjs.cc
Christopher Jeffrey 3e355bd0fc bitcoind.js
2014-08-12 15:04:13 -04:00

70 lines
1023 B
C++

/**
* bitcoind.js
* Copyright (c) 2014, BitPay (MIT License)
*
* bitcoindjs.cc:
* A bitcoind node.js binding.
*/
#include "nan.h"
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
using namespace node;
using namespace v8;
NAN_METHOD(StartBitcoind);
static int
misc_func(const char *);
extern "C" void
init(Handle<Object>);
/**
* StartBitcoind
* bitcoind.start(callback)
*/
NAN_METHOD(StartBitcoind) {
NanScope();
if (args.Length() < 1 || !args[0]->IsFunction()) {
return NanThrowError(
"Usage: bitcoind.start(callback)");
}
Local<Object> obj = NanNew<Object>();
obj->Set(NanNew<String>("foo"), NanNew<Number>(100));
NanReturnValue(obj);
}
/**
* misc_func
*/
static int
misc_func(const char *file) {
return 0;
}
/**
* Init
*/
extern "C" void
init(Handle<Object> target) {
NanScope();
NODE_SET_METHOD(target, "start", StartBitcoind);
}
NODE_MODULE(bitcoindjs, init)