|
1 | 1 | # TON lite_api
|
2 | 2 |
|
3 |
| -Implementation of [lite_api](https://github.com/ton-blockchain/ton/blob/master/tl/generate/scheme/lite_api.tl) and [lite-client](https://github.com/ton-blockchain/ton/tree/master/lite-client) in Rust using [adnl-rs](https://github.com/tonstack/adnl-rs). |
| 3 | +Implementation of low-level [lite_api](https://github.com/ton-blockchain/ton/blob/master/tl/generate/scheme/lite_api.tl) and [lite-client](https://github.com/ton-blockchain/ton/tree/master/lite-client) in Rust using [adnl-rs](https://github.com/tonstack/adnl-rs). |
4 | 4 |
|
5 |
| -| Feature | Status | |
6 |
| -| ----------------- | -------------------------------- | |
7 |
| -| lite_api client | ✅ Implemented | |
8 |
| -| lite_api server | ✅ Implemented | |
9 |
| -| lite-client cli | ✅ Implemented | |
10 |
| -| async | ✅ Implemented | |
| 5 | +| Feature | Status | |
| 6 | +| --------------- | -------------- | |
| 7 | +| lite_api client | ✅ Implemented | |
| 8 | +| lite_api server | ✅ Implemented | |
| 9 | +| lite-client cli | ✅ Implemented | |
| 10 | +| async | ✅ Implemented | |
11 | 11 |
|
12 | 12 | ## Installation
|
| 13 | + |
13 | 14 | ```bash
|
14 |
| -cargo install --git https://github.com/tonstack/lite-client |
| 15 | +cargo install ton_lc |
15 | 16 | ```
|
16 | 17 |
|
17 | 18 | ## Usage
|
| 19 | + |
18 | 20 | Without any options, [mainnet config](https://ton.org/global.config.json) will be used.
|
19 | 21 | For testnet, use `-t / --testnet` flag.
|
20 |
| -To use your own config, pass `-c / --config <FILE>` option. |
| 22 | +To use your own config, pass `-c / --config <FILE>` option. |
| 23 | +Also you can use `--address` and `--public-key` to connect to specific liteserver. |
21 | 24 |
|
22 | 25 | Send an external message to TON:
|
| 26 | + |
23 | 27 | ```bash
|
24 |
| -echo 1234 | liteclient send - # accept message bytes from stdin |
25 |
| -liteclient send ./query.boc # read from file |
| 28 | +echo 1234 | ton_lc send-message - # accept message bytes from stdin |
| 29 | +ton_lc send-message ./query.boc # read from file |
26 | 30 | ```
|
| 31 | + |
27 | 32 | It prints:
|
| 33 | + |
28 | 34 | ```
|
29 | 35 | [ERROR] Server error [code=0]: cannot apply external message to current state : failed to parse external message cannot deserialize bag-of-cells: invalid header, error 0
|
30 | 36 | ```
|
31 | 37 |
|
| 38 | +``` |
| 39 | +OPTIONS: |
| 40 | + --address <ADDRESS> Liteserver address (IP:PORT) |
| 41 | + -c, --config <FILE> Local network config from file |
| 42 | + -h, --help Print help information |
| 43 | + --public-key <PUBLIC_KEY> Liteserver public key (hex-encoded) |
| 44 | + -t, --testnet Use testnet config, if not provided use mainnet config |
| 45 | + -V, --version Print version information |
| 46 | +
|
| 47 | +SUBCOMMANDS: |
| 48 | + get-account-state Download account state at specified block |
| 49 | + get-all-shards-info |
| 50 | + get-block Downloads and dumps specified block |
| 51 | + get-block-header Download block header with specified merkle proofs |
| 52 | + get-block-proof Download masterchain proof |
| 53 | + get-config-all Download all config params |
| 54 | + get-config-params Download specified config params |
| 55 | + get-libraries Download specified libraries |
| 56 | + get-masterchain-info Get masterchain info |
| 57 | + get-masterchain-info-ext Get masterchain info with additional data |
| 58 | + get-one-transaction |
| 59 | + get-shard-info |
| 60 | + get-state Download state for masterchain block seqnos < 1000 |
| 61 | + get-time Get server time |
| 62 | + get-transactions Iterate through transactions for an account |
| 63 | + get-validator-stats |
| 64 | + get-version Shows server time, version and capabilities |
| 65 | + help Print this message or the help of the given subcommand(s) |
| 66 | + list-block-transactions List transactions for a specified block |
| 67 | + lookup-block Find block by seqno, lt or utime, block header will be |
| 68 | + downloaded with specified merkle proofs |
| 69 | + run-smc-method Run get-method for smart contract |
| 70 | + send-message Send external message |
| 71 | +``` |
| 72 | + |
32 | 73 | ## Debug logging
|
| 74 | + |
33 | 75 | ```bash
|
34 |
| -echo 1234 | RUST_LOG=debug liteclient send - |
| 76 | +echo 1234 | RUST_LOG=debug ton_lc send-message - |
35 | 77 | ```
|
| 78 | + |
36 | 79 | prints:
|
| 80 | + |
37 | 81 | ```
|
38 | 82 | [2022-03-15T10:43:55Z DEBUG liteclient::private] Sending query:
|
39 | 83 | Length: 20 (0x14) bytes
|
|
0 commit comments