/ever-client-go

Golang-Binding for TVM blockchains (Everscale, Gosh, TON, Venom Blockchain, etc).

Primary LanguageGoApache License 2.0Apache-2.0

Client for TVM blockchains (Everscale, Gosh, TON, Venom Blockchain, etc).

Everscale SDK Client library Golang bindings based itself on Ever SDK.

version license Go version

Channel on Telegram Chat on Telegram RU Chat on Telegram EN

Many thanks to @temamagic for advice on architecture, tests, code and commit style.

Installation

$ go get -u github.com/markgenuine/ever-client-go

or

$ git clone https://github.com/markgenuine/ever-client-go.git
$ cd ever-client-go

Installation for MAC OS

#Set path to library
install_name_tool -id PATH_WITH_BINDING/gateway/client/lib/darwin/libton_client.dylib PATH_WITH_BINDING/gateway/client/lib/darwin/libton_client.dylib

#Add to ~/.bashrc or execute everytime 
export CGO_LDFLAGS="-LPATH_WITH_BINDING/gateway/client/lib/darwin -lton_client"

Installation for Linux

#Add to ~/.bashrc or execute everytime 
export LD_LIBRARY_PATH=PATH_WITH_BINDING/gateway/client/lib/linux/:$LD_LIBRARY_PATH
export CGO_LDFLAGS="-LPATH_WITH_BINDING/gateway/client/lib/linux -lton_client"

Or use "-exec" for example:

go build
go run  -exec "env DYLD_LIBRARY_PATH=/path-with-lib/" main.go
go test -exec "env DYLD_LIBRARY_PATH=/path-with-lib/ ./... " -v

Tests

$ go test ./... -v
$ go run ./example/*.go

Usage

import goever "github.com/markgenuine/ever-client-go"

Example

package main

import (
	"fmt"
	"github.com/markgenuine/ever-client-go/domain"
	"log"

	goton "github.com/markgenuine/ever-client-go"
)

func main() {
	ever, err := goever.NewEver("", domain.GetDevNetBaseUrls())
	if err != nil {
		log.Fatal(err)
	}

	defer ever.Client.Destroy()

	value, err := ever.Client.Version()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("Version bindings is: ", value.Version)
}

For more examples see *_test.go files ever-client-go/usecase