ton-provider-system 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,205 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://ton-game.example.com/rpc-schema.json",
4
+ "title": "TON RPC Provider Configuration",
5
+ "description": "Configuration file for unified TON RPC provider system",
6
+ "type": "object",
7
+ "required": ["version", "providers", "defaults"],
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string",
11
+ "description": "JSON Schema reference"
12
+ },
13
+ "version": {
14
+ "type": "string",
15
+ "description": "Configuration file version",
16
+ "pattern": "^\\d+\\.\\d+$",
17
+ "examples": ["1.0"]
18
+ },
19
+ "providers": {
20
+ "type": "object",
21
+ "description": "Provider definitions keyed by unique ID",
22
+ "additionalProperties": {
23
+ "$ref": "#/definitions/provider"
24
+ }
25
+ },
26
+ "defaults": {
27
+ "type": "object",
28
+ "description": "Default provider order per network",
29
+ "required": ["testnet", "mainnet"],
30
+ "properties": {
31
+ "testnet": {
32
+ "type": "array",
33
+ "description": "Default testnet provider order (provider IDs)",
34
+ "items": { "type": "string" }
35
+ },
36
+ "mainnet": {
37
+ "type": "array",
38
+ "description": "Default mainnet provider order (provider IDs)",
39
+ "items": { "type": "string" }
40
+ }
41
+ }
42
+ }
43
+ },
44
+ "definitions": {
45
+ "network": {
46
+ "type": "string",
47
+ "enum": ["testnet", "mainnet"],
48
+ "description": "TON network"
49
+ },
50
+ "providerType": {
51
+ "type": "string",
52
+ "enum": [
53
+ "chainstack",
54
+ "quicknode",
55
+ "toncenter",
56
+ "orbs",
57
+ "onfinality",
58
+ "ankr",
59
+ "getblock",
60
+ "tatum",
61
+ "tonhub",
62
+ "custom"
63
+ ],
64
+ "description": "Provider type identifier"
65
+ },
66
+ "endpoints": {
67
+ "type": "object",
68
+ "description": "Provider endpoint URLs. Use {key} placeholder for API key substitution from environment variable.",
69
+ "properties": {
70
+ "v2": {
71
+ "type": "string",
72
+ "description": "TON HTTP API v2 endpoint URL",
73
+ "format": "uri-template",
74
+ "examples": [
75
+ "https://testnet.toncenter.com/api/v2",
76
+ "https://ton-testnet.core.chainstack.com/{key}/api/v2"
77
+ ]
78
+ },
79
+ "v3": {
80
+ "type": "string",
81
+ "description": "TON HTTP API v3 endpoint URL",
82
+ "format": "uri-template"
83
+ },
84
+ "v4": {
85
+ "type": "string",
86
+ "description": "TON API v4 endpoint URL",
87
+ "format": "uri-template"
88
+ },
89
+ "ws": {
90
+ "type": "string",
91
+ "description": "WebSocket endpoint URL",
92
+ "format": "uri-template",
93
+ "examples": [
94
+ "wss://ton-testnet.api.onfinality.io/ws?apikey={key}"
95
+ ]
96
+ }
97
+ },
98
+ "anyOf": [
99
+ { "required": ["v2"] },
100
+ { "required": ["v3"] },
101
+ { "required": ["v4"] }
102
+ ]
103
+ },
104
+ "provider": {
105
+ "type": "object",
106
+ "description": "Single provider definition",
107
+ "required": ["name", "type", "network", "endpoints", "rps", "priority", "enabled"],
108
+ "properties": {
109
+ "name": {
110
+ "type": "string",
111
+ "description": "Human-readable provider name",
112
+ "examples": ["Chainstack Testnet", "TON Center Mainnet"]
113
+ },
114
+ "type": {
115
+ "$ref": "#/definitions/providerType"
116
+ },
117
+ "network": {
118
+ "$ref": "#/definitions/network"
119
+ },
120
+ "endpoints": {
121
+ "$ref": "#/definitions/endpoints"
122
+ },
123
+ "keyEnvVar": {
124
+ "type": "string",
125
+ "description": "Environment variable name for API key (replaces {key} in endpoint URLs)",
126
+ "pattern": "^[A-Z][A-Z0-9_]*$",
127
+ "examples": ["CHAINSTACK_KEY_TESTNET", "QUICKNODE_KEY_MAINNET"]
128
+ },
129
+ "apiKeyEnvVar": {
130
+ "type": "string",
131
+ "description": "Environment variable name for separate API key (passed in headers)",
132
+ "pattern": "^[A-Z][A-Z0-9_]*$",
133
+ "examples": ["TONCENTER_API_KEY", "TATUM_API_KEY_TESTNET"]
134
+ },
135
+ "rps": {
136
+ "type": "integer",
137
+ "description": "Requests per second limit",
138
+ "minimum": 1,
139
+ "maximum": 1000,
140
+ "examples": [1, 10, 25]
141
+ },
142
+ "priority": {
143
+ "type": "integer",
144
+ "description": "Selection priority (lower = higher priority)",
145
+ "minimum": 1,
146
+ "examples": [1, 10, 100]
147
+ },
148
+ "enabled": {
149
+ "type": "boolean",
150
+ "description": "Whether this provider is enabled",
151
+ "default": true
152
+ },
153
+ "isDynamic": {
154
+ "type": "boolean",
155
+ "description": "Whether this provider uses dynamic endpoint discovery (e.g., Orbs TON Access)",
156
+ "default": false
157
+ },
158
+ "description": {
159
+ "type": "string",
160
+ "description": "Optional notes about this provider",
161
+ "examples": ["Chainstack testnet API - 25 RPS free plan"]
162
+ }
163
+ }
164
+ }
165
+ },
166
+ "examples": [
167
+ {
168
+ "$schema": "./provider_system/rpc-schema.json",
169
+ "version": "1.0",
170
+ "providers": {
171
+ "chainstack_testnet": {
172
+ "name": "Chainstack Testnet",
173
+ "type": "chainstack",
174
+ "network": "testnet",
175
+ "endpoints": {
176
+ "v2": "https://ton-testnet.core.chainstack.com/{key}/api/v2",
177
+ "v3": "https://ton-testnet.core.chainstack.com/{key}/api/v3"
178
+ },
179
+ "keyEnvVar": "CHAINSTACK_KEY_TESTNET",
180
+ "rps": 25,
181
+ "priority": 1,
182
+ "enabled": true,
183
+ "description": "Chainstack testnet API - 25 RPS free plan"
184
+ },
185
+ "toncenter_testnet": {
186
+ "name": "TON Center Testnet",
187
+ "type": "toncenter",
188
+ "network": "testnet",
189
+ "endpoints": {
190
+ "v2": "https://testnet.toncenter.com/api/v2"
191
+ },
192
+ "apiKeyEnvVar": "TONCENTER_API_KEY",
193
+ "rps": 10,
194
+ "priority": 50,
195
+ "enabled": true,
196
+ "description": "Official TON Center - 10 RPS with API key"
197
+ }
198
+ },
199
+ "defaults": {
200
+ "testnet": ["chainstack_testnet", "toncenter_testnet"],
201
+ "mainnet": []
202
+ }
203
+ }
204
+ ]
205
+ }
package/rpc.json ADDED
@@ -0,0 +1,169 @@
1
+ {
2
+ "$schema": "./rpc-schema.json",
3
+ "version": "1.0",
4
+ "providers": {
5
+ "chainstack_testnet": {
6
+ "name": "Chainstack Testnet",
7
+ "type": "chainstack",
8
+ "network": "testnet",
9
+ "endpoints": {
10
+ "v2": "https://ton-testnet.core.chainstack.com/{key}/api/v2",
11
+ "v3": "https://ton-testnet.core.chainstack.com/{key}/api/v3"
12
+ },
13
+ "keyEnvVar": "CHAINSTACK_KEY_TESTNET",
14
+ "rps": 25,
15
+ "priority": 1,
16
+ "enabled": true,
17
+ "description": "Chainstack testnet API - 25 RPS free plan"
18
+ },
19
+ "chainstack_mainnet": {
20
+ "name": "Chainstack Mainnet",
21
+ "type": "chainstack",
22
+ "network": "mainnet",
23
+ "endpoints": {
24
+ "v2": "https://ton-mainnet.core.chainstack.com/{key}/api/v2",
25
+ "v3": "https://ton-mainnet.core.chainstack.com/{key}/api/v3"
26
+ },
27
+ "keyEnvVar": "CHAINSTACK_KEY_MAINNET",
28
+ "rps": 25,
29
+ "priority": 1,
30
+ "enabled": true,
31
+ "description": "Chainstack mainnet API - 25 RPS free plan"
32
+ },
33
+ "toncenter_testnet": {
34
+ "name": "TON Center Testnet",
35
+ "type": "toncenter",
36
+ "network": "testnet",
37
+ "endpoints": {
38
+ "v2": "https://testnet.toncenter.com/api/v2"
39
+ },
40
+ "apiKeyEnvVar": "TONCENTER_API_KEY",
41
+ "rps": 10,
42
+ "priority": 50,
43
+ "enabled": true,
44
+ "description": "Official TON Center testnet - 10 RPS with API key, 1 RPS without"
45
+ },
46
+ "toncenter_mainnet": {
47
+ "name": "TON Center Mainnet",
48
+ "type": "toncenter",
49
+ "network": "mainnet",
50
+ "endpoints": {
51
+ "v2": "https://toncenter.com/api/v2"
52
+ },
53
+ "apiKeyEnvVar": "TONCENTER_API_KEY",
54
+ "rps": 10,
55
+ "priority": 50,
56
+ "enabled": true,
57
+ "description": "Official TON Center mainnet - 10 RPS with API key, 1 RPS without"
58
+ },
59
+ "quicknode_mainnet": {
60
+ "name": "QuickNode Mainnet",
61
+ "type": "quicknode",
62
+ "network": "mainnet",
63
+ "endpoints": {
64
+ "v2": "https://{key}.ton-mainnet.quiknode.pro/"
65
+ },
66
+ "keyEnvVar": "QUICKNODE_KEY_MAINNET",
67
+ "rps": 15,
68
+ "priority": 2,
69
+ "enabled": true,
70
+ "description": "QuickNode mainnet - 15 RPS free plan"
71
+ },
72
+ "getblock_mainnet": {
73
+ "name": "GetBlock Mainnet",
74
+ "type": "getblock",
75
+ "network": "mainnet",
76
+ "endpoints": {
77
+ "v2": "https://go.getblock.io/{key}/"
78
+ },
79
+ "keyEnvVar": "GETBLOCK_KEY_MAINNET",
80
+ "rps": 20,
81
+ "priority": 3,
82
+ "enabled": true,
83
+ "description": "GetBlock mainnet API - 20 RPS"
84
+ },
85
+ "onfinality_testnet": {
86
+ "name": "OnFinality Testnet",
87
+ "type": "onfinality",
88
+ "network": "testnet",
89
+ "endpoints": {
90
+ "v2": "https://ton-testnet.api.onfinality.io/rpc?apikey={key}",
91
+ "ws": "wss://ton-testnet.api.onfinality.io/ws?apikey={key}"
92
+ },
93
+ "keyEnvVar": "ONFINALITY_KEY_TESTNET",
94
+ "rps": 4,
95
+ "priority": 5,
96
+ "enabled": true,
97
+ "description": "OnFinality testnet - 4 RPS free tier"
98
+ },
99
+ "tatum_testnet": {
100
+ "name": "Tatum Testnet",
101
+ "type": "tatum",
102
+ "network": "testnet",
103
+ "endpoints": {
104
+ "v2": "https://api.tatum.io/v3/blockchain/node/ton-testnet"
105
+ },
106
+ "apiKeyEnvVar": "TATUM_API_KEY_TESTNET",
107
+ "rps": 3,
108
+ "priority": 8,
109
+ "enabled": true,
110
+ "description": "Tatum testnet API - 3 RPS free plan"
111
+ },
112
+ "tatum_mainnet": {
113
+ "name": "Tatum Mainnet",
114
+ "type": "tatum",
115
+ "network": "mainnet",
116
+ "endpoints": {
117
+ "v2": "https://api.tatum.io/v3/blockchain/node/ton-mainnet"
118
+ },
119
+ "apiKeyEnvVar": "TATUM_API_KEY_MAINNET",
120
+ "rps": 3,
121
+ "priority": 8,
122
+ "enabled": true,
123
+ "description": "Tatum mainnet API - 3 RPS free plan"
124
+ },
125
+ "orbs_testnet": {
126
+ "name": "Orbs TON Access Testnet",
127
+ "type": "orbs",
128
+ "network": "testnet",
129
+ "endpoints": {
130
+ "v2": "https://ton-testnet.orbs.network/api/v2"
131
+ },
132
+ "rps": 10,
133
+ "priority": 10,
134
+ "enabled": true,
135
+ "isDynamic": true,
136
+ "description": "Orbs decentralized gateway - no hard limit, uses dynamic discovery"
137
+ },
138
+ "orbs_mainnet": {
139
+ "name": "Orbs TON Access Mainnet",
140
+ "type": "orbs",
141
+ "network": "mainnet",
142
+ "endpoints": {
143
+ "v2": "https://ton-mainnet.orbs.network/api/v2"
144
+ },
145
+ "rps": 10,
146
+ "priority": 10,
147
+ "enabled": true,
148
+ "isDynamic": true,
149
+ "description": "Orbs decentralized gateway - no hard limit, uses dynamic discovery"
150
+ }
151
+ },
152
+ "defaults": {
153
+ "testnet": [
154
+ "chainstack_testnet",
155
+ "toncenter_testnet",
156
+ "onfinality_testnet",
157
+ "tatum_testnet",
158
+ "orbs_testnet"
159
+ ],
160
+ "mainnet": [
161
+ "chainstack_mainnet",
162
+ "quicknode_mainnet",
163
+ "getblock_mainnet",
164
+ "toncenter_mainnet",
165
+ "tatum_mainnet",
166
+ "orbs_mainnet"
167
+ ]
168
+ }
169
+ }