Node.js bindings to status-go
Go to file
Ivan Danyliuk ab77088b54
Update bindings and autogenertor
2017-11-24 15:54:05 +02:00
src Update bindings and autogenertor 2017-11-24 15:54:05 +02:00
tools/go2nodebinding Update bindings and autogenertor 2017-11-24 15:54:05 +02:00
.gitignore Update bindings and autogenertor 2017-11-24 15:54:05 +02:00
README.md Update bindings and autogenertor 2017-11-24 15:54:05 +02:00
binding.gyp Initial commit 2017-11-24 14:59:43 +02:00
index.js Initial commit 2017-11-24 14:59:43 +02:00
package-lock.json Commited package-lock.json 2017-11-24 15:13:25 +02:00
package.json Update package description 2017-11-24 15:28:22 +02:00
test.js Update bindings and autogenertor 2017-11-24 15:54:05 +02:00

README.md

status-nodejs

This package provides wrappers to status-go exported methods.

Usage

First, make sure that status-go and status-nodejs are in the same dir.

In status-go, build shared library:

make statusgo-shared

or directly:

build/bin/xgo --image farazdagi/xgo --go=latest -buildmode=c-archive -out libstatus --dest=build/bin --targets=darwin/amd64 -v $(shell build/testnet-flags.sh) ./lib
ranlib build/bin/libstatus-darwin-10.6-amd64.a

Resulting shared library file and header will be at build/bin/libstatus-darwin-10.6-amd64.a and build/bin/libstatus-darwin-10.6-amd64.h accordingly. Copy them into status-nodejs/bin/ folder:

mkdir -p status-nodejs/bin/
cp -v status-go/build/bin/libstatus-darwin-10.6-amd64.a status-nodejs/bin/libstatus.a
cp -v status-go/build/bin/libstatus-darwin-10.6-amd64.h status-nodejs/bin/libstatus.h

Next, go to status-nodejs dir, and run:

npm install

You should have resulting module in build/Release folder.

Package module

TBD

Autogenerate bindings from Go code

It's possible to autogenerate C++ code from status-go Go code. First, build autogenerator tool:

go build ./tools/go2nodebinding

then, run it:

./go2nodebinding ../status-go/lib/library.go > src/status.cpp

check the diff and commit.