Skip to content

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

License

Notifications You must be signed in to change notification settings

markgenuine/ever-client-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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