Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge develop-tonlib new tonlib methods #70

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3d80d78
Switch to newton repo
akme Jul 16, 2021
dbbabf6
Build lib (#68)
akme Jul 16, 2021
4d020ff
Update tonlib-linux.yml
akme Jul 20, 2021
abe8f12
Update Linux tonlib
actions-user Jul 20, 2021
badefce
New methods (#69)
akme Jul 20, 2021
1f27a41
Update tonlib-linux.yml
akme Jul 20, 2021
867ae2e
Update Linux tonlib
actions-user Jul 20, 2021
dc16465
Update MacOS tonlib
actions-user Jul 20, 2021
217cd31
Async on extra (#71)
demindsmr Aug 23, 2021
86f73fe
Update Linux tonlib
actions-user Aug 23, 2021
718de67
Update MacOS tonlib
actions-user Aug 23, 2021
0281682
feat(MRC-8783): add send_mode param in MsgMessage // regenerate struc…
demindsmr Aug 30, 2021
ba11c95
Update Linux tonlib
actions-user Aug 30, 2021
a351a9f
Update MacOS tonlib
actions-user Aug 30, 2021
0578dd8
feat(MRC-8783): fix TonClientUpdate (#73)
demindsmr Aug 31, 2021
1160427
Update Linux tonlib
actions-user Aug 31, 2021
83a87b6
Update MacOS tonlib
actions-user Aug 31, 2021
79dc2d4
feat(MRC-9460): mini fixes in logs / trigger build tonlib C (#74)
demindsmr Sep 8, 2021
e35ee0f
Update Linux tonlib
actions-user Sep 8, 2021
c442915
Update MacOS tonlib
actions-user Sep 8, 2021
09dd84f
fix(): fix indirect self reference / may be broke some tests (#75)
demindsmr Sep 21, 2021
7c4237a
Update MacOS tonlib
actions-user Sep 21, 2021
62b561e
fix(): fix gitignore for linux binaries (#76)
demindsmr Sep 22, 2021
d62a93c
Update Linux tonlib
actions-user Sep 22, 2021
7fdf0bc
Update MacOS tonlib
actions-user Sep 22, 2021
b680a1b
fix(): fix gitignore for linux binaries (#77)
demindsmr Sep 22, 2021
0855cd2
Update Linux tonlib
actions-user Sep 22, 2021
b76b43f
Update MacOS tonlib
actions-user Sep 22, 2021
5e66c1a
fix(MRC-12099): trigger new build / dummy commit (#78)
demindsmr Nov 8, 2021
8b0807c
Update Linux tonlib
actions-user Nov 8, 2021
ae5ea4c
Update MacOS tonlib
actions-user Nov 8, 2021
da03f0a
Update tlStructGenerator.go (#79)
mr-tron Feb 15, 2022
3f0239a
Update MacOS tonlib
actions-user Feb 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/tonlib-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Fetch TON repo
run: |
cd ..
git clone --recursive https://github.com/ton-blockchain/ton
git clone --recursive https://github.com/newton-blockchain/ton

- name: Build tonlibjson
run: |
Expand All @@ -26,6 +26,7 @@ jobs:
cd build
cmake ../ton -DCMAKE_BUILD_TYPE=Release
cmake --build . --target tonlibjson
make tonlibjson_static

- name: Copy built lib
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tonlib-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Fetch TON repo
run: |
cd ..
git clone --recursive https://github.com/ton-blockchain/ton
git clone --recursive https://github.com/newton-blockchain/ton

- name: Build tonlibjson
run: |
Expand All @@ -26,6 +26,7 @@ jobs:
cd build
cmake ../ton -DOPENSSL_ROOT_DIR=$(brew --prefix)/opt/openssl -DCMAKE_BUILD_TYPE=Release
cmake --build . --target tonlibjson
make tonlibjson_static

- name: Copy built lib
run: |
Expand Down
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,15 @@
.idea
./vendor

# tonlib-c files
lib/linux*
lib/linux

lib/linux/*.so
lib/linux/*.a

tlgenerator

# auto generated files
test.keys/*
test.keys/*
test.keys.testnet/*
1 change: 0 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ func (client *Client) executeSynchronously(data interface{}) (*TONResult, error)

func (client *Client) Destroy() {
C.tonlib_client_json_destroy(client.client)
C.free(client.client)
}

//sync node`s blocks to current
Expand Down
2 changes: 1 addition & 1 deletion cmd/tlgenerator/tlStructGenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func generateStructsFromTnEntities(
}
}

illStr := `fmt.Errorf("error! code: %d msg: %s", result.Data["code"], result.Data["message"])`
illStr := `fmt.Errorf("error! code: %v msg: %s", result.Data["code"], result.Data["message"])`
if strings.Contains(paramsStr, returnTypeCamel) {
returnTypeCamel = returnTypeCamel + "Dummy"
}
Expand Down
2 changes: 1 addition & 1 deletion example/send_gram.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func main() {
base64.StdEncoding.EncodeToString(loc),
tonlib.TONPrivateKey{
pKey.PublicKey,
base64.StdEncoding.EncodeToString((*pKey.Secret)[:]),
base64.StdEncoding.EncodeToString([]byte(pKey.Secret)),
},
}

Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ go 1.13

require (
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a // indirect
github.com/joho/godotenv v1.3.0 // indirect
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 // indirect
github.com/spf13/cobra v0.0.5
)
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,16 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a h1:mq+R6XEM6lJX5VlLyZIrUSP8tSuJp82xTK89hvBwJbU=
github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v0.0.0-20190905144223-a36b5d85f337 h1:Da9XEUfFxgyDOqUfwgoTDcWzmnlOnCGi6i4iPS+8Fbw=
github.com/shopspring/decimal v0.0.0-20190905144223-a36b5d85f337/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
Expand Down
Binary file removed lib/darwin/libtonlib.a
Binary file not shown.
Binary file removed lib/darwin/libtonlibjson.0.5.dylib
Binary file not shown.
Binary file removed lib/darwin/libtonlibjson.dylib
Binary file not shown.
Binary file removed lib/darwin/libtonlibjson_private.a
Binary file not shown.
Binary file removed lib/darwin/libtonlibjson_static.a
Binary file not shown.
1 change: 0 additions & 1 deletion lib/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ package linux

import (
_ "github.com/mercuryoio/tonlib-go/lib/darwin"
_ "github.com/mercuryoio/tonlib-go/lib/linux"
)
Binary file removed lib/linux/libtonlib.a
Binary file not shown.
Binary file removed lib/linux/libtonlibjson.so
Binary file not shown.
Binary file removed lib/linux/libtonlibjson.so.0.5
Binary file not shown.
Binary file removed lib/linux/libtonlibjson_private.a
Binary file not shown.
Binary file removed lib/linux/libtonlibjson_static.a
Binary file not shown.
223 changes: 223 additions & 0 deletions tonlib.mainnet.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
{
"config": {
"config": {
"@type": "config.global",
"dht": {
"@type": "dht.config.global",
"k": 6,
"a": 3,
"static_nodes": {
"@type": "dht.nodes",
"nodes": [
{
"@type": "dht.node",
"id": {
"@type": "pub.ed25519",
"key": "znOAvy1ECxyzeKishi4PdSO2edaVx78wynVyNKLBmQ8="
},
"addr_list": {
"@type": "adnl.addressList",
"addrs": [
{
"@type": "adnl.address.udp",
"ip": -1068377703,
"port": 6302
}
],
"version": 0,
"reinit_date": 0,
"priority": 0,
"expire_at": 0
},
"version": -1,
"signature": "KLH17nNKmOk3carKwbsUcVBc4JZpdAUdUOMxe8FSyqnkOw/lolnltbylJcC+lvPpIV5ySI/Qx8UZdNRV/4HzCA=="
},
{
"@type": "dht.node",
"id": {
"@type": "pub.ed25519",
"key": "Qjhv9rmeqXm0a+nYYhCJG1AH7C2TM6DAmyIM3FgO0Eo="
},
"addr_list": {
"@type": "adnl.addressList",
"addrs": [
{
"@type": "adnl.address.udp",
"ip": -1057912003,
"port": 6302
}
],
"version": 0,
"reinit_date": 0,
"priority": 0,
"expire_at": 0
},
"version": -1,
"signature": "2Gw5eIsZR+SdbWCU139DCuBI8Rv8T9iUioxDkgV6/IjcCHf6hNz8WCyUsKd5l5P1NBs/kdaxUBIybINDpYXoCw=="
},
{
"@type": "dht.node",
"id": {
"@type": "pub.ed25519",
"key": "2YsTRIu3aRYzZe8eoR8PK2N2ydHJyKllwKcLPk676d4="
},
"addr_list": {
"@type": "adnl.addressList",
"addrs": [
{
"@type": "adnl.address.udp",
"ip": -1057911744,
"port": 6302
}
],
"version": 0,
"reinit_date": 0,
"priority": 0,
"expire_at": 0
},
"version": -1,
"signature": "9/TJsaj0wELvRKXVIrBdyZWjgLKhfSvl7v0Oqq/9p9MsU/t9iRuGcpAzHqQF4bQAWrN8j9ARwMumRata7dH8Bg=="
},
{
"@type": "dht.node",
"id": {
"@type": "pub.ed25519",
"key": "SHrXmMEEUBGa51TWZwHSA+2RF4Vyavw51jgtnAz1ypU="
},
"addr_list": {
"@type": "adnl.addressList",
"addrs": [
{
"@type": "adnl.address.udp",
"ip": -1057911148,
"port": 6302
}
],
"version": 0,
"reinit_date": 0,
"priority": 0,
"expire_at": 0
},
"version": -1,
"signature": "R4ku8+tvjKSLIGe18zWHBHDv1maQHD5tGbAUOgbldGpBvfqH+/b76XkJjJzDsjnCO/bpxwUZfcI1sM1h6vFJCQ=="
},
{
"@type": "dht.node",
"id": {
"@type": "pub.ed25519",
"key": "G+Lr6UtSWUcyYHTUutwbxrIG9GGZan3h96j8qQPLIXQ="
},
"addr_list": {
"@type": "adnl.addressList",
"addrs": [
{
"@type": "adnl.address.udp",
"ip": -960017601,
"port": 6302
}
],
"version": 0,
"reinit_date": 0,
"priority": 0,
"expire_at": 0
},
"version": -1,
"signature": "fWU9hSNLvmaSCQOBW9M4Lja5pIWcqOzU1g9vtSywdgtASj9oQpwAslvr2sjNh9E2Np1c26NW8Sc5gUKf8YY7BA=="
}
]
}
},
"liteservers": [
{
"ip": 1137658550,
"port": "4924",
"id": {
"@type": "pub.ed25519",
"key": "peJTw/arlRfssgTuf9BMypJzqOi7SXEqSPSWiEw2U1M="
}
},
{
"ip": 1560268637,
"port": "6199",
"id": {
"@type": "pub.ed25519",
"key": "NSyVw0XhPhW4Yg5a3NhS1dkCc6ZY7Hex40tJ6EiBMAI="
}
},
{
"ip": 84478511,
"port": "19949",
"id": {
"@type": "pub.ed25519",
"key": "n4VDnSCUuSpjnCyUk9e3QOOd6o0ItSWYbTnW3Wnn8wk="
}
},
{
"ip": 84478479,
"port": "48014",
"id": {
"@type": "pub.ed25519",
"key": "3XO67K/qi+gu3T9v8G2hx1yNmWZhccL3O7SoosFo8G0="
}
},
{
"ip": -2018135749,
"port": "53312",
"id": {
"@type": "pub.ed25519",
"key": "aF91CuUHuuOv9rm2W5+O/4h38M3sRm40DtSdRxQhmtQ="
}
},
{
"ip": -2018145068,
"port": "13206",
"id": {
"@type": "pub.ed25519",
"key": "K0t3+IWLOXHYMvMcrGZDPs+pn58a17LFbnXoQkKc2xw="
}
},
{
"ip": -2018145059,
"port": "46995",
"id": {
"@type": "pub.ed25519",
"key": "wQE0MVhXNWUXpWiW5Bk8cAirIh5NNG3cZM1/fSVKIts="
}
}
],
"validator": {
"@type": "validator.config.global",
"zero_state": {
"workchain": -1,
"shard": -9223372036854775808,
"seqno": 0,
"root_hash": "F6OpKZKqvqeFp6CQmFomXNMfMj2EnaUSOXN+Mh+wVWk=",
"file_hash": "XplPz01CXAps5qeSWUtxcyBfdAo5zVb1N979KLSKD24="
},
"init_block" : {
"root_hash": "irEt9whDfgaYwD+8AzBlYzrMZHhrkhSVp3PU1s4DOz4=",
"seqno": 10171687,
"file_hash": "lay/bUKUUFDJXU9S6gx9GACQFl+uK+zX8SqHWS9oLZc=",
"workchain": -1,
"shard": -9223372036854775808
},
"hardforks": [
{
"file_hash": "t/9VBPODF7Zdh4nsnA49dprO69nQNMqYL+zk5bCjV/8=",
"seqno": 8536841,
"root_hash": "08Kpc9XxrMKC6BF/FeNHPS3MEL1/Vi/fQU/C9ELUrkc=",
"workchain": -1,
"shard": -9223372036854775808
}
]
}
},
"blockchain_name": "mainnet",
"use_callbacks_for_network": false,
"ignore_cache": false
},
"keystore_type": {
"@type": "keyStoreTypeDirectory",
"directory": "./main.keys"
}
}
8 changes: 5 additions & 3 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ type TonlibListenserverConfig struct {
ID map[string]string `json:"id"`
}
type ValidatorConfig struct {
Type string `json:"@type"`
ZeroState ZeroState `json:"zero_state"`
Type string `json:"@type"`
ZeroState InitBlock `json:"zero_state"`
InitBlock InitBlock `json:"init_block,omitempty"`
Hardforks []InitBlock `json:"hardforks,omitempty"`
}

type ZeroState struct {
type InitBlock struct {
Workchain int `json:"workchain"`
Shard int64 `json:"shard"`
Seqno int `json:"seqno"`
Expand Down
Loading