You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains [TonAPI](https://tonapi.io) SDK and examples.
5
6
6
-
The native TON's RPC is very low-level.
7
-
And it is not suitable for building applications on top of it.
7
+
The native TON's RPC is very low-level and is not suitable for building applications on top of it. [TonAPI](https://tonapi.io) aims at speeding up development of TON-based applications and provides an API centered around high-level concepts like Jettons, NFTs and so on, while keeping a way to access low-level details.
8
8
9
-
[TonAPI](https://tonapi.io) aims at speeding up development of TON-based applications and
10
-
provides an API centered around high-level concepts like Jettons, NFTs and so on,
11
-
keeping a way to access low-level details.
9
+
Check out more details at [TonAPI Documentation](https://docs.tonconsole.com/tonapi/rest-api).
12
10
13
-
Check out more details at [TonAPI Documentation](https://docs.tonconsole.com/tonapi/api-v2).
11
+
## Installation
14
12
15
-
# TonAPI SDK Example
13
+
To install the TonAPI SDK, run:
16
14
17
-
Development of TON-based applications is much easier with TonAPI SDK:
15
+
```bash
16
+
go get github.com/tonkeeper/tonapi-go
17
+
```
18
+
19
+
## Quick Start
20
+
21
+
Here's a simple example to get you started:
18
22
19
23
```go
20
24
package main
@@ -28,36 +32,171 @@ import (
28
32
)
29
33
30
34
funcmain() {
31
-
client, err:= tonapi.New()
35
+
// Create a new client with default settings
36
+
// If you want to use testnet, use tonapi.TestnetTonApiURL
37
+
// You can use TonAPI.io without a token by passing &tonapi.Security{} as the second parameter,
38
+
// but note that TonAPI.io has strict rate limits, so it's better to get a Token from tonconsole.com
TonAPI has rate limits based on your authentication:
166
+
- Anonymous users: Strict rate limits
167
+
- API token users: Higher limits based on your plan
168
+
169
+
For high-volume applications, consider implementing a throttled client as shown in the examples.
170
+
171
+
## Best Practices
172
+
173
+
1. Always use an API token for production applications
174
+
2. Implement proper error handling for all API calls
175
+
3. Use a custom HTTP client with rate limiting for high-volume applications
176
+
4. Consider caching frequently accessed data
177
+
178
+
## Documentation
179
+
180
+
For complete API documentation, visit the [Documentation](https://docs.tonconsole.com) website.
181
+
182
+
## Support
183
+
184
+
For support and questions, join the [TonApi Tech](https://t.me/tonapitech) on Telegram.
185
+
186
+
## REST API
187
+
188
+
You can always find the latest version of TonAPI REST API documentation at [TonAPI Documentation](https://docs.tonconsole.com/tonapi/rest-api).
189
+
190
+
[TonAPI SDK example](examples/tonapi-sdk/main.go) shows how to work with REST API in golang.
50
191
51
192
## Streaming API
52
193
53
194
Usually, an application needs to monitor the blockchain for specific events and act accordingly.
54
195
TonAPI offers two ways to do it: SSE and Websocket.
55
196
56
-
The advantage of Websocket is that Websocket can be reconfigured dynamically to subscribe/unsubscribe to/from specific events.
57
-
Where SSE has to reconnect to TonAPI to change the list of events it is subscribed to.
197
+
The advantage of Websocket is that it can be reconfigured dynamically to subscribe/unsubscribe to/from specific events,
198
+
whereas SSE has to reconnect to TonAPI to change the list of events it is subscribed to.
58
199
59
200
Take a look at [SSE example](examples/sse/main.go) and [Websocket example](examples/websocket/main.go) to see how to work with TonAPI Streaming API in golang.
60
201
61
-
More details can be found at [TonAPI Streaming API Documentation](https://docs.tonconsole.com/tonapi/streaming-api).
62
-
63
-
202
+
More details can be found at [TonAPI Streaming API Documentation](https://docs.tonconsole.com/tonapi/streaming-api).
0 commit comments