One needs to install
export EVER_SDK_INSTALLATION_PATH=`pwd`/tmp # example - should be specified as absolute path
# clean previous installation in case of reinstalling
rm -f $EVER_SDK_INSTALLATION_PATH/libton_client.dylib.gz $EVER_SDK_INSTALLATION_PATH/libton_client.dylib
# download binaries
wget https://binaries.tonlabs.io/tonclient_1_darwin.gz -O $EVER_SDK_INSTALLATION_PATH/libton_client.dylib.gz
# extract binaries
gzip -d $EVER_SDK_INSTALLATION_PATH/libton_client.dylib.gz
# make extracted file executable
chmod +x $EVER_SDK_INSTALLATION_PATH/libton_client.dylib
# set loading by absolute path
install_name_tool -id $EVER_SDK_INSTALLATION_PATH/libton_client.dylib $EVER_SDK_INSTALLATION_PATH/libton_client.dylib
# Better to add this to ~/.bashrc or ~/.zshrc to DRY in terminal each time you use it
export CGO_LDFLAGS="-L$EVER_SDK_INSTALLATION_PATH -lton_client"
EVER_SDK_INSTALLATION_PATH=`pwd`/tmp # example - should be specified as absolute path
# clean previous installation in case of reinstalling
rm -f $EVER_SDK_INSTALLATION_PATH/libton_client.so.gz $EVER_SDK_INSTALLATION_PATH/libton_client.so
# download binaries
wget https://binaries.tonlabs.io/tonclient_1_linux.gz -O $EVER_SDK_INSTALLATION_PATH/libton_client.so.gz
# extract binaries
gzip -d $EVER_SDK_INSTALLATION_PATH/libton_client.so.gz
# make extracted file executable
chmod +x $EVER_SDK_INSTALLATION_PATH/libton_client.so
# Better to add this to ~/.bashrc or ~/.zshrc to DRY in terminal each time you use it
export LD_LIBRARY_PATH=$EVER_SDK_INSTALLATION_PATH:$LD_LIBRARY_PATH
export CGO_LDFLAGS="-L$EVER_SDK_INSTALLATION_PATH -lton_client"
One needs to specify compiled DLL directory path:
export CGO_LDFLAGS="-L$EVER_SDK_INSTALLATION_PATH -lton_client"
go build ./cmd/cli
go run ./cmd/cli
# or
task run
On Linux one needs to provide search path for DLL loader:
export LD_LIBRARY_PATH=$EVER_SDK_INSTALLATION_PATH:$LD_LIBRARY_PATH
For examples see cmd/cli/main.go
and run it via go run ./cmd/cli
.
This wrapper covers 100% of functionality for EVER-SDK.
All non-generated code has test coverage at least of 70% - one can see it via task coverage
.
export CGO_LDFLAGS="-L$EVER_SDK_INSTALLATION_PATH -lton_client"
docker run -d --name local-node -p80:80 tonlabs/local-node:0.39.0
task test # tests without node
task full_test # tests including with node
task coverage # full_test with coverage
You need to install:
- golangci-lint.
- Taskfile (optional)
See available task commands via task
without arguments.
To attach git hooks run task attach_hooks
Most of the code is generated via script in ./cmd/gen/gen.go
from spec api-spec.json
one can regenerate it via task generate
.
- https://medium.com/@donblas/fun-with-rpath-otool-and-install-name-tool-e3e41ae86172 - about DLL linking
- https://github.com/tonlabs/EVER-SDK/blob/1.5.2/docs/app_objects.md
- https://eli.thegreenplace.net/2019/passing-callbacks-and-pointers-to-cgo/
- https://dev.to/mattn/call-go-function-from-c-function-1n3
- https://docs.ton.dev/86757ecb2/p/71d7a8-samples/t/35f373 - example how to use GraphQL
See more at spec/types.go
- processing.send_message
- processing.wait_for_transaction
- processing.process_message
- net.subscribe_collection