Skip to content

Commit c97f01d

Browse files
committed
feat: ton service profile
1 parent 263e073 commit c97f01d

File tree

5 files changed

+196
-155
lines changed

5 files changed

+196
-155
lines changed

book/src/framework/components/blockchains/ton.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,24 @@ TON (The Open Network) support in the framework utilizes MyLocalTon Docker Compo
88
[blockchain_a]
99
type = "ton"
1010
image = "ghcr.io/neodix42/mylocalton-docker:latest"
11+
service_profile = "core" # "core" (default) or "full"
1112
```
1213

13-
## Default Ports
14+
## Service Profiles
1415

15-
The TON implementation exposes several services:
16+
* Core (default): Genesis node only
17+
* Full: Genesis + HTTP API + Faucet + Explorer + Indexing services
1618

17-
- TON Lite Server: Port 40004
18-
- TON HTTP API: Port 8081
19-
- TON Simple HTTP Server: Port 8000
20-
- TON Explorer: Port 8080
19+
## Ports
20+
21+
Ports are allocated based on the base port (default 8000):
22+
23+
* Base: Genesis HTTP server
24+
* Base + 10: TON HTTP API (full profile)
25+
* Base + 20: Block Explorer (full profile)
26+
* Base + 30: Index API (full profile)
27+
* Base + 40: Faucet (full profile)
28+
* Base + 50: Lite Server
2129

2230
> **Note**: By default, only the lite client service is exposed externally. Other services may need additional configuration to be accessible outside the Docker network.
2331
@@ -31,6 +39,7 @@ By default, the MyLocalTon environment starts with only one validator enabled. I
3139
package examples
3240

3341
import (
42+
"fmt"
3443
"strings"
3544
"testing"
3645

@@ -59,27 +68,27 @@ func TestTonSmoke(t *testing.T) {
5968
t.Run("setup:connect", func(t *testing.T) {
6069
// Create a connection pool
6170
connectionPool := liteclient.NewConnectionPool()
62-
71+
6372
// Get the network configuration from the global config URL
6473
cfg, cferr := liteclient.GetConfigFromUrl(t.Context(), fmt.Sprintf("http://%s/localhost.global.config.json", bc.Nodes[0].ExternalHTTPUrl))
6574
require.NoError(t, cferr, "Failed to get config from URL")
66-
75+
6776
// Add connections from the config
6877
caerr := connectionPool.AddConnectionsFromConfig(t.Context(), cfg)
6978
require.NoError(t, caerr, "Failed to add connections from config")
70-
79+
7180
// Create an API client with retry functionality
7281
client = ton.NewAPIClient(connectionPool).WithRetry()
7382

7483
t.Run("setup:faucet", func(t *testing.T) {
7584
// Create a wallet from the pre-funded high-load wallet seed
7685
rawHlWallet, err := wallet.FromSeed(client, strings.Fields(blockchain.DefaultTonHlWalletMnemonic), wallet.HighloadV2Verified)
7786
require.NoError(t, err, "failed to create highload wallet")
78-
87+
7988
// Create a workchain -1 (masterchain) wallet
8089
mcFunderWallet, err := wallet.FromPrivateKeyWithOptions(client, rawHlWallet.PrivateKey(), wallet.HighloadV2Verified, wallet.WithWorkchain(-1))
8190
require.NoError(t, err, "failed to create highload wallet")
82-
91+
8392
// Get subwallet with ID 42
8493
funder, err := mcFunderWallet.GetSubwallet(uint32(42))
8594
require.NoError(t, err, "failed to get highload subwallet")
@@ -96,13 +105,15 @@ func TestTonSmoke(t *testing.T) {
96105
})
97106
})
98107
}
108+
99109
```
100110

101111
## Test Private Keys
102112

103113
The framework includes a pre-funded high-load wallet for testing purposes. This wallet type can send up to 254 messages per 1 external message, making it efficient for test scenarios.
104114

105115
Default High-Load Wallet:
116+
106117
```
107118
Address: -1:5ee77ced0b7ae6ef88ab3f4350d8872c64667ffbe76073455215d3cdfab3294b
108119
Mnemonic: twenty unfair stay entry during please water april fabric morning length lumber style tomorrow melody similar forum width ride render void rather custom coin

framework/components/blockchain/blockchain.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ type Input struct {
5858
// GAPv2 specific params
5959
HostNetworkMode bool `toml:"host_network_mode"`
6060
CertificatesPath string `toml:"certificates_path"`
61+
62+
// Ton specific params
63+
ServiceProfile string `toml:"service_profile" validate:"omitempty,oneof=core full"`
6164
}
6265

6366
// Output is a blockchain network output, ChainID and one or more nodes that forms the network

0 commit comments

Comments
 (0)