@pioneer-platform/ton-network 8.11.16 → 8.12.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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > @pioneer-platform/ton-network@8.11.16 build /Users/highlander/WebstormProjects/keepkey-stack/projects/pioneer/modules/coins/ton/ton-network
3
+ > @pioneer-platform/ton-network@8.12.0 build /Users/highlander/WebstormProjects/keepkey-stack/projects/pioneer/modules/coins/ton/ton-network
4
4
  > tsc -p .
5
5
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @pioneer-platform/ton-network
2
2
 
3
+ ## 8.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat(monorepo): production release preparation with strict TypeScript and enhanced swap functionality
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @pioneer-platform/pioneer-nodes@8.31.0
13
+
14
+ ## 8.11.19
15
+
16
+ ### Patch Changes
17
+
18
+ - @pioneer-platform/pioneer-nodes@8.30.4
19
+
20
+ ## 8.11.18
21
+
22
+ ### Patch Changes
23
+
24
+ - chore: chore: - Services (discovery-service, watchtower)
25
+
26
+ ## 8.11.17
27
+
28
+ ### Patch Changes
29
+
30
+ - fa09397: chore: - Services (discovery-service, watchtower)
31
+
3
32
  ## 8.11.16
4
33
 
5
34
  ### Patch Changes
package/lib/index.js CHANGED
@@ -67,11 +67,35 @@ var axiosLib = require('axios');
67
67
  var Axios = axiosLib.default || axiosLib;
68
68
  var https = require('https');
69
69
  var log = require('@pioneer-platform/loggerdog')();
70
- // Default TON mainnet API (NOWNodes with API key from env)
70
+ // Optional: Import nodes module if available (not required)
71
+ var TIER_ONE_SEED = null;
72
+ try {
73
+ var nodesModule = require('@pioneer-platform/pioneer-nodes');
74
+ TIER_ONE_SEED = nodesModule.TIER_ONE_SEED;
75
+ }
76
+ catch (e) {
77
+ // Module not available - use fallback public APIs instead
78
+ log.info(TAG, '@pioneer-platform/pioneer-nodes not available, using public TON APIs');
79
+ }
80
+ // Get API key from env
71
81
  var NOWNODES_API_KEY = process.env.NOWNODES_API_KEY;
72
- var DEFAULT_API_URL = NOWNODES_API_KEY
73
- ? "https://ton.nownodes.io"
74
- : "https://toncenter.com/api/v2";
82
+ // Get node config from pioneer-nodes with API key injection
83
+ var getTonNodeUrl = function () {
84
+ // TODO: NOWNodes TON API requires investigation of correct endpoint format
85
+ // For now, use public TonCenter API which is rate-limited but functional
86
+ // NOWNodes endpoints to try:
87
+ // - https://ton.nownodes.io/{API_KEY} (base)
88
+ // - https://ton-index.nownodes.io/{API_KEY} (index)
89
+ // - https://ton-open-api.nownodes.io/{API_KEY} (open api)
90
+ // Temporarily use public API until NOWNodes format is verified
91
+ log.warn("Using public TonCenter API (rate limited) - NOWNodes TON format needs investigation");
92
+ return "https://toncenter.com/api/v2";
93
+ // Uncomment when NOWNodes format is confirmed:
94
+ // if (NOWNODES_API_KEY && TIER_ONE_SEED.TON?.API) {
95
+ // return TIER_ONE_SEED.TON.API.replace('{API_KEY}', NOWNODES_API_KEY)
96
+ // }
97
+ };
98
+ var DEFAULT_API_URL = getTonNodeUrl();
75
99
  // Network constants
76
100
  exports.NETWORK_ID = 'ton:-239';
77
101
  exports.CHAIN_SYMBOL = 'TON';
@@ -112,18 +136,12 @@ module.exports = {
112
136
  apiKey = (settings === null || settings === void 0 ? void 0 : settings.apiKey) || process.env['NOWNODES_API_KEY'] || process.env['TONCENTER_API_KEY'] || null;
113
137
  log.info(tag, "Initializing TON network...");
114
138
  log.info(tag, "API Endpoint:", apiUrl);
139
+ log.info(tag, "Using centralized node config from pioneer-nodes");
115
140
  log.info(tag, "API Key configured:", apiKey ? "Yes" : "No (rate limited)");
116
- log.info(tag, "NOWNODES_API_KEY from env:", process.env['NOWNODES_API_KEY'] ? "SET" : "NOT SET");
117
- log.info(tag, "DEFAULT_API_URL value:", DEFAULT_API_URL);
118
141
  headers = { 'Content-Type': 'application/json' };
119
- if (apiKey) {
120
- // NOWNodes uses 'api-key' header, TonCenter uses 'X-API-Key'
121
- if (apiUrl.includes('nownodes.io')) {
122
- headers['api-key'] = apiKey;
123
- }
124
- else {
125
- headers['X-API-Key'] = apiKey;
126
- }
142
+ // Only add API key for paid services (NOWNodes)
143
+ if (apiKey && apiUrl.includes('nownodes.io')) {
144
+ headers['api-key'] = apiKey;
127
145
  }
128
146
  return [4 /*yield*/, axios({
129
147
  url: "".concat(apiUrl, "/getMasterchainInfo"),
@@ -144,8 +162,10 @@ module.exports = {
144
162
  return [3 /*break*/, 4];
145
163
  case 3:
146
164
  e_1 = _a.sent();
147
- log.error(tag, "Failed to initialize:", e_1.message);
148
- throw e_1;
165
+ log.warn(tag, "Failed to initialize TON network:", e_1.message);
166
+ log.warn(tag, "TON network will be unavailable. This is non-fatal - other networks will continue to work.");
167
+ isInitialized = false;
168
+ return [2 /*return*/, false];
149
169
  case 4: return [2 /*return*/];
150
170
  }
151
171
  });
@@ -228,15 +248,11 @@ module.exports = {
228
248
  //**********************************/
229
249
  function getHeaders() {
230
250
  var headers = { 'Content-Type': 'application/json' };
231
- if (apiKey) {
232
- // NOWNodes uses 'api-key' header, TonCenter uses 'X-API-Key'
233
- if (apiUrl.includes('nownodes.io')) {
234
- headers['api-key'] = apiKey;
235
- }
236
- else {
237
- headers['X-API-Key'] = apiKey;
238
- }
251
+ // Only add API key for paid services (NOWNodes)
252
+ if (apiKey && apiUrl.includes('nownodes.io')) {
253
+ headers['api-key'] = apiKey;
239
254
  }
255
+ // Note: Public TonCenter API doesn't require authentication (rate limited)
240
256
  return headers;
241
257
  }
242
258
  function get_balance(address) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/ton-network",
3
- "version": "8.11.16",
3
+ "version": "8.12.0",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "description": "Pioneer Platform TON Network module",
@@ -13,7 +13,8 @@
13
13
  "dependencies": {
14
14
  "axios": "^1.6.0",
15
15
  "dotenv": "^16.0.0",
16
- "@pioneer-platform/loggerdog": "8.11.0"
16
+ "@pioneer-platform/loggerdog": "8.11.0",
17
+ "@pioneer-platform/pioneer-nodes": "8.31.0"
17
18
  },
18
19
  "devDependencies": {
19
20
  "@types/node": "^18.16.0",