Skip to content

akme/tonlib-go

Repository files navigation

TONLIB Golang library

Go Report Card GoDoc

TONLIB Golang library for accessing Telegram Open Network with liteclient protocol, which is based itself on tdlib library. Warning: this repository is under active development, not ready for production use

Install

$ go get -u github.com/mercuryoio/tonlib-go

Usage

import "github.com/mercuryoio/tonlib-go"

Supported methods

  • createNewKey
  • deleteKey
  • exportKey
  • exportPemKey
  • exportEncryptedKey
  • importKey
  • importPemKey
  • importEncryptedKey
  • changeLocalPassword
  • unpackAccountAddress
  • packAccountAddress
  • wallet.init
  • wallet.getAccountAddress
  • wallet.getAccountState
  • wallet.sendGrams
  • raw.sendMessage
  • raw.getTransactions
  • raw.getAccountState
  • generic.sendGrams
  • getLogStream
  • sync

Examples

Create new client

    cln, err := NewClient(getTestConfig(), Config{})
    if err != nil {
        t.Errorf("Init client error: %v. ", err)
    }
    defer cln.Destroy()

Create new private key

    _, err = cln.CreatePrivateKey([]byte(TEST_PASSWORD))
    if err != nil {
        t.Errorf("Ton create key error: %v. ", err)
    }

Get wallet address

    _, err = cln.WalletGetAddress(pKey.PublicKey)
    if err != nil {
        t.Errorf("Ton get wallet address error: %v. ", err)
    }

CLI:

To install sample cli application:

$ go get -u github.com/mercuryoio/tonlib-go/cmd/tongo

To run sample cli app your have to set LD_LIBRARY_PATH:

For linux export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path2repository>/lib/linux

For MacOS export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path2repository>/lib/darwin

Developers

Mercuryo.io

Contribute

PRs are welcome!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •