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
$ go get -u github.com/mercuryoio/tonlib-go
import "github.com/mercuryoio/tonlib-go"
- 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
- CreateAndSendMessage
- generic.createSendGramsQuery
- query.send
- query.forge
- query.estimateFees
- query.getInfo
- smc.load
- smc.getCode
- smc.getData
- smc.getState
- smc.runGetMethod
Create new client
cln, err := NewClient(getTestConfig(), Config{})
if err != nil {
t.Errorf("Init client error: %v. ", err)
}
defer cln.Destroy()
_, err = cln.CreatePrivateKey([]byte(TEST_PASSWORD))
if err != nil {
t.Errorf("Ton create key error: %v. ", err)
}
_, err = cln.WalletGetAddress(pKey.PublicKey)
if err != nil {
t.Errorf("Ton get wallet address error: %v. ", err)
}
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
PRs are welcome!