@reown/appkit-adapter-ton 1.8.15-e95f0d61c614677233e13ea9f055d3f75fcdba81.0 → 1.8.15-viem-upgrade.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.
- package/package.json +7 -7
- package/dist/esm/exports/index.js +0 -3
- package/dist/esm/exports/index.js.map +0 -1
- package/dist/esm/exports/utils.js +0 -2
- package/dist/esm/exports/utils.js.map +0 -1
- package/dist/esm/src/adapter.js +0 -249
- package/dist/esm/src/adapter.js.map +0 -1
- package/dist/esm/src/connectors/TonConnectConnector.js +0 -175
- package/dist/esm/src/connectors/TonConnectConnector.js.map +0 -1
- package/dist/esm/src/connectors/TonWalletConnectConnector.js +0 -67
- package/dist/esm/src/connectors/TonWalletConnectConnector.js.map +0 -1
- package/dist/esm/src/utils/Base64.js +0 -47
- package/dist/esm/src/utils/Base64.js.map +0 -1
- package/dist/esm/src/utils/ProviderEventEmitter.js +0 -26
- package/dist/esm/src/utils/ProviderEventEmitter.js.map +0 -1
- package/dist/esm/src/utils/TonConnectTypeUtils.js +0 -2
- package/dist/esm/src/utils/TonConnectTypeUtils.js.map +0 -1
- package/dist/esm/src/utils/TonConnectUtil.js +0 -413
- package/dist/esm/src/utils/TonConnectUtil.js.map +0 -1
- package/dist/esm/src/utils/TonWalletUtils.js +0 -160
- package/dist/esm/src/utils/TonWalletUtils.js.map +0 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/exports/index.d.ts +0 -2
- package/dist/types/exports/utils.d.ts +0 -1
- package/dist/types/src/adapter.d.ts +0 -29
- package/dist/types/src/connectors/TonConnectConnector.d.ts +0 -29
- package/dist/types/src/connectors/TonWalletConnectConnector.d.ts +0 -26
- package/dist/types/src/utils/Base64.d.ts +0 -11
- package/dist/types/src/utils/ProviderEventEmitter.d.ts +0 -11
- package/dist/types/src/utils/TonConnectTypeUtils.d.ts +0 -66
- package/dist/types/src/utils/TonConnectUtil.d.ts +0 -35
- package/dist/types/src/utils/TonWalletUtils.d.ts +0 -23
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TonConnectTypeUtils.js","sourceRoot":"","sources":["../../../../src/utils/TonConnectTypeUtils.ts"],"names":[],"mappings":""}
|
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
import { ApiController, BlockchainApiController, CoreHelperUtil, FetchUtil, OptionsController, StorageUtil } from '@reown/appkit-controllers';
|
|
2
|
-
const TONCONNECT_MANIFEST_URL = 'https://api.reown.com/ton/v1/manifest';
|
|
3
|
-
const listenerUnsubscribes = new Map();
|
|
4
|
-
export const TonConnectUtil = {
|
|
5
|
-
getTonConnectManifestUrl() {
|
|
6
|
-
const { metadata, projectId } = OptionsController.state;
|
|
7
|
-
const { st, sv } = BlockchainApiController.getSdkProperties();
|
|
8
|
-
const appUrl = metadata?.url || (typeof window === 'undefined' ? '' : window.location.origin);
|
|
9
|
-
const name = metadata?.name || '';
|
|
10
|
-
const iconUrl = metadata?.icons?.[0] || '';
|
|
11
|
-
const u = new URL(TONCONNECT_MANIFEST_URL);
|
|
12
|
-
u.searchParams.set('projectId', projectId);
|
|
13
|
-
u.searchParams.set('st', st);
|
|
14
|
-
u.searchParams.set('sv', sv);
|
|
15
|
-
u.searchParams.set('url', appUrl);
|
|
16
|
-
u.searchParams.set('name', name);
|
|
17
|
-
u.searchParams.set('iconUrl', iconUrl);
|
|
18
|
-
return u.toString();
|
|
19
|
-
},
|
|
20
|
-
async connectInjected(jsBridgeKey, tonProof) {
|
|
21
|
-
if (!CoreHelperUtil.isClient()) {
|
|
22
|
-
return Promise.resolve('');
|
|
23
|
-
}
|
|
24
|
-
const wallet = this.getTonConnect(jsBridgeKey);
|
|
25
|
-
if (!wallet) {
|
|
26
|
-
throw new Error(`TonConnectConnector.connectInjected: Injected wallet "${jsBridgeKey}" not available`);
|
|
27
|
-
}
|
|
28
|
-
const manifestUrl = this.getTonConnectManifestUrl();
|
|
29
|
-
const request = this.createConnectRequest(manifestUrl, tonProof);
|
|
30
|
-
const PROTOCOL_VERSION = 2;
|
|
31
|
-
try {
|
|
32
|
-
if (typeof wallet.restoreConnection === 'function') {
|
|
33
|
-
const restored = await wallet.restoreConnection();
|
|
34
|
-
if (restored?.event === 'connect') {
|
|
35
|
-
const addr = restored?.payload?.items?.find?.((i) => i?.name === 'ton_addr')?.address;
|
|
36
|
-
if (addr) {
|
|
37
|
-
return addr;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
}
|
|
44
|
-
try {
|
|
45
|
-
if (typeof wallet.connect !== 'function') {
|
|
46
|
-
throw new Error('Wallet does not support connect method');
|
|
47
|
-
}
|
|
48
|
-
const connectEvent = await wallet.connect(PROTOCOL_VERSION, request);
|
|
49
|
-
if (connectEvent?.event === 'connect') {
|
|
50
|
-
const addr = connectEvent?.payload?.items?.find?.((i) => i?.name === 'ton_addr')?.address;
|
|
51
|
-
if (addr) {
|
|
52
|
-
if (typeof wallet.listen === 'function') {
|
|
53
|
-
this.setupWalletListener(jsBridgeKey, wallet);
|
|
54
|
-
}
|
|
55
|
-
return addr;
|
|
56
|
-
}
|
|
57
|
-
throw new Error('TON address not found in connect response');
|
|
58
|
-
}
|
|
59
|
-
else if (connectEvent?.event === 'connect_error') {
|
|
60
|
-
const msg = connectEvent?.payload?.message || 'TON connect error';
|
|
61
|
-
throw new Error(msg);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
throw new Error('Unexpected connect event type');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
if (err instanceof Error) {
|
|
69
|
-
throw err;
|
|
70
|
-
}
|
|
71
|
-
throw new Error(`TON connect failed: ${String(err)}`);
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
async disconnectInjected(jsBridgeKey) {
|
|
75
|
-
if (!CoreHelperUtil.isClient()) {
|
|
76
|
-
return Promise.resolve();
|
|
77
|
-
}
|
|
78
|
-
const unsubscribe = listenerUnsubscribes.get(jsBridgeKey);
|
|
79
|
-
if (unsubscribe) {
|
|
80
|
-
try {
|
|
81
|
-
unsubscribe();
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
}
|
|
85
|
-
listenerUnsubscribes.delete(jsBridgeKey);
|
|
86
|
-
}
|
|
87
|
-
const wallet = this.getTonConnect(jsBridgeKey);
|
|
88
|
-
if (!wallet) {
|
|
89
|
-
throw new Error(`TonConnectConnector.disconnectInjected: Injected wallet "${jsBridgeKey}" not available`);
|
|
90
|
-
}
|
|
91
|
-
return new Promise(resolve => {
|
|
92
|
-
function onRequestSent() {
|
|
93
|
-
resolve();
|
|
94
|
-
}
|
|
95
|
-
try {
|
|
96
|
-
if (typeof wallet.disconnect === 'function') {
|
|
97
|
-
wallet.disconnect();
|
|
98
|
-
onRequestSent();
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
throw new Error('disconnect method not available');
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch (e) {
|
|
105
|
-
if (typeof wallet.send === 'function') {
|
|
106
|
-
wallet
|
|
107
|
-
.send({
|
|
108
|
-
method: 'disconnect',
|
|
109
|
-
params: [],
|
|
110
|
-
id: String(CoreHelperUtil.getUUID())
|
|
111
|
-
})
|
|
112
|
-
.then(() => {
|
|
113
|
-
onRequestSent();
|
|
114
|
-
})
|
|
115
|
-
.catch(() => {
|
|
116
|
-
onRequestSent();
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
onRequestSent();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
createConnectRequest(manifestUrl, tonProof) {
|
|
126
|
-
const items = [
|
|
127
|
-
{ name: 'ton_addr' }
|
|
128
|
-
];
|
|
129
|
-
if (tonProof) {
|
|
130
|
-
items.push({ name: 'ton_proof', payload: tonProof });
|
|
131
|
-
}
|
|
132
|
-
return { manifestUrl, items };
|
|
133
|
-
},
|
|
134
|
-
normalizeBase64(data) {
|
|
135
|
-
if (typeof data !== 'string') {
|
|
136
|
-
return undefined;
|
|
137
|
-
}
|
|
138
|
-
const paddedLength = data.length + ((4 - (data.length % 4)) % 4);
|
|
139
|
-
return data.replace(/-/gu, '+').replace(/_/gu, '/').padEnd(paddedLength, '=');
|
|
140
|
-
},
|
|
141
|
-
async getInjectedWallets() {
|
|
142
|
-
const dtoList = await this.fetchWalletsListDTO();
|
|
143
|
-
const remoteByKey = new Map();
|
|
144
|
-
for (const dto of dtoList) {
|
|
145
|
-
for (const br of dto.bridge ?? []) {
|
|
146
|
-
if (br.type === 'js') {
|
|
147
|
-
remoteByKey.set(br.key, dto);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
const w = CoreHelperUtil.getWindow();
|
|
152
|
-
const injected = [];
|
|
153
|
-
if (w) {
|
|
154
|
-
let entries = [];
|
|
155
|
-
try {
|
|
156
|
-
entries = Object.entries(w);
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
entries = [];
|
|
160
|
-
}
|
|
161
|
-
for (const [key, value] of entries) {
|
|
162
|
-
try {
|
|
163
|
-
const obj = value;
|
|
164
|
-
const hasTonconnect = Boolean(obj && typeof obj === 'object' && obj.tonconnect);
|
|
165
|
-
if (!hasTonconnect) {
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
const tc = obj?.tonconnect;
|
|
169
|
-
const wi = tc?.walletInfo;
|
|
170
|
-
const dto = remoteByKey.get(key);
|
|
171
|
-
const name = wi?.name || dto?.name || key;
|
|
172
|
-
const appName = wi?.app_name || dto?.app_name || name;
|
|
173
|
-
const imageUrl = wi?.image || dto?.image || '';
|
|
174
|
-
const aboutUrl = wi?.about_url || dto?.about_url || '';
|
|
175
|
-
const tondns = wi?.tondns || dto?.tondns;
|
|
176
|
-
const platforms = wi?.platforms || dto?.platforms || [];
|
|
177
|
-
const features = wi?.features || dto?.features;
|
|
178
|
-
injected.push({
|
|
179
|
-
name,
|
|
180
|
-
appName,
|
|
181
|
-
imageUrl,
|
|
182
|
-
aboutUrl,
|
|
183
|
-
tondns,
|
|
184
|
-
platforms,
|
|
185
|
-
features,
|
|
186
|
-
jsBridgeKey: key,
|
|
187
|
-
injected: true,
|
|
188
|
-
embedded: Boolean(tc?.isWalletBrowser)
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
catch {
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return injected;
|
|
196
|
-
},
|
|
197
|
-
isWalletInjected(jsBridgeKey) {
|
|
198
|
-
const w = CoreHelperUtil.getWindow();
|
|
199
|
-
if (!w) {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
try {
|
|
203
|
-
const obj = w[jsBridgeKey];
|
|
204
|
-
return Boolean(this.isJSBridgeWithMetadata(obj));
|
|
205
|
-
}
|
|
206
|
-
catch {
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
isInsideWalletBrowser(jsBridgeKey) {
|
|
211
|
-
const w = CoreHelperUtil.getWindow();
|
|
212
|
-
if (!w) {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
try {
|
|
216
|
-
const obj = w[jsBridgeKey];
|
|
217
|
-
return this.isJSBridgeWithMetadata(obj) ? Boolean(obj.tonconnect.isWalletBrowser) : false;
|
|
218
|
-
}
|
|
219
|
-
catch {
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
getCurrentlyInjectedWallets() {
|
|
224
|
-
const w = CoreHelperUtil.getWindow();
|
|
225
|
-
if (!w) {
|
|
226
|
-
return [];
|
|
227
|
-
}
|
|
228
|
-
let entries = [];
|
|
229
|
-
try {
|
|
230
|
-
entries = Object.entries(w);
|
|
231
|
-
}
|
|
232
|
-
catch {
|
|
233
|
-
return [];
|
|
234
|
-
}
|
|
235
|
-
const wallets = [];
|
|
236
|
-
for (const [key, value] of entries) {
|
|
237
|
-
try {
|
|
238
|
-
if (value &&
|
|
239
|
-
typeof value === 'object' &&
|
|
240
|
-
value['tonconnect'] &&
|
|
241
|
-
!this.isJSBridgeWithMetadata(value)) {
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
if (!this.isJSBridgeWithMetadata(value)) {
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
const info = value.tonconnect.walletInfo;
|
|
248
|
-
wallets.push({
|
|
249
|
-
name: info.name,
|
|
250
|
-
appName: info.app_name,
|
|
251
|
-
imageUrl: info.image,
|
|
252
|
-
aboutUrl: info.about_url,
|
|
253
|
-
tondns: info.tondns,
|
|
254
|
-
jsBridgeKey: key,
|
|
255
|
-
injected: true,
|
|
256
|
-
embedded: Boolean(value.tonconnect.isWalletBrowser),
|
|
257
|
-
platforms: info.platforms,
|
|
258
|
-
features: info.features
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
catch {
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
return wallets;
|
|
265
|
-
},
|
|
266
|
-
async fetchWalletsListDTO() {
|
|
267
|
-
const api = new FetchUtil({
|
|
268
|
-
baseUrl: CoreHelperUtil.getApiUrl(),
|
|
269
|
-
clientId: null
|
|
270
|
-
});
|
|
271
|
-
const tonWalletsCache = StorageUtil.getTonWalletsCache();
|
|
272
|
-
if (tonWalletsCache) {
|
|
273
|
-
return tonWalletsCache.wallets.filter(this.isCorrectWalletInfoDTO);
|
|
274
|
-
}
|
|
275
|
-
const response = await api.get({
|
|
276
|
-
path: '/ton/v1/wallets',
|
|
277
|
-
params: ApiController._getSdkProperties()
|
|
278
|
-
});
|
|
279
|
-
StorageUtil.updateTonWalletsCache(response);
|
|
280
|
-
return response.filter(this.isCorrectWalletInfoDTO);
|
|
281
|
-
},
|
|
282
|
-
isCorrectWalletInfoDTO(value) {
|
|
283
|
-
if (!value || typeof value !== 'object') {
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
|
-
const v = value;
|
|
287
|
-
if (!v['name'] ||
|
|
288
|
-
!v['app_name'] ||
|
|
289
|
-
!v['image'] ||
|
|
290
|
-
!v['about_url'] ||
|
|
291
|
-
!Array.isArray(v['platforms']) ||
|
|
292
|
-
!Array.isArray(v['bridge']) ||
|
|
293
|
-
v['bridge'].length === 0) {
|
|
294
|
-
return false;
|
|
295
|
-
}
|
|
296
|
-
for (const bridge of v['bridge']) {
|
|
297
|
-
if (!bridge || typeof bridge !== 'object' || !('type' in bridge)) {
|
|
298
|
-
return false;
|
|
299
|
-
}
|
|
300
|
-
if (bridge.type === 'sse') {
|
|
301
|
-
if (!('url' in bridge) || !v['universal_url']) {
|
|
302
|
-
return false;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
if (bridge.type === 'js') {
|
|
306
|
-
if (!('key' in bridge) || !bridge.key) {
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
return true;
|
|
312
|
-
},
|
|
313
|
-
isJSBridgeWithMetadata(value) {
|
|
314
|
-
try {
|
|
315
|
-
return Boolean(value &&
|
|
316
|
-
typeof value === 'object' &&
|
|
317
|
-
'tonconnect' in value &&
|
|
318
|
-
value.tonconnect &&
|
|
319
|
-
typeof value.tonconnect === 'object' &&
|
|
320
|
-
'walletInfo' in value.tonconnect &&
|
|
321
|
-
value.tonconnect.walletInfo &&
|
|
322
|
-
typeof value.tonconnect.walletInfo === 'object' &&
|
|
323
|
-
'name' in value.tonconnect.walletInfo &&
|
|
324
|
-
typeof value.tonconnect.walletInfo.name === 'string' &&
|
|
325
|
-
'app_name' in value.tonconnect.walletInfo &&
|
|
326
|
-
typeof value.tonconnect.walletInfo.app_name === 'string' &&
|
|
327
|
-
'image' in value.tonconnect.walletInfo &&
|
|
328
|
-
typeof value.tonconnect.walletInfo.image === 'string' &&
|
|
329
|
-
'about_url' in value.tonconnect.walletInfo &&
|
|
330
|
-
typeof value.tonconnect.walletInfo.about_url === 'string' &&
|
|
331
|
-
'platforms' in value.tonconnect.walletInfo &&
|
|
332
|
-
Array.isArray(value.tonconnect.walletInfo.platforms));
|
|
333
|
-
}
|
|
334
|
-
catch {
|
|
335
|
-
return false;
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
getWalletFeatures(wallet) {
|
|
339
|
-
const features = wallet?.features;
|
|
340
|
-
return Array.isArray(features) ? features : undefined;
|
|
341
|
-
},
|
|
342
|
-
assertSendTransactionSupported(wallet, requiredMessagesNumber, requireExtraCurrencies) {
|
|
343
|
-
const features = this.getWalletFeatures(wallet);
|
|
344
|
-
if (!features) {
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
const hasDeprecatedSupport = features.includes?.('SendTransaction');
|
|
348
|
-
const st = features.find?.((f) => f && typeof f === 'object' && f.name === 'SendTransaction');
|
|
349
|
-
if (!hasDeprecatedSupport && !st) {
|
|
350
|
-
throw new Error("Wallet doesn't support SendTransaction feature.");
|
|
351
|
-
}
|
|
352
|
-
if (requireExtraCurrencies) {
|
|
353
|
-
if (!st ||
|
|
354
|
-
typeof st === 'string' ||
|
|
355
|
-
st.name !== 'SendTransaction' ||
|
|
356
|
-
!st.extraCurrencySupported) {
|
|
357
|
-
throw new Error('Wallet is not able to handle such SendTransaction request. Extra currencies support is required.');
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
if (st &&
|
|
361
|
-
typeof st !== 'string' &&
|
|
362
|
-
st.name === 'SendTransaction' &&
|
|
363
|
-
typeof st.maxMessages === 'number') {
|
|
364
|
-
if (st.maxMessages < requiredMessagesNumber) {
|
|
365
|
-
throw new Error(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${st.maxMessages}, but ${requiredMessagesNumber} is required.`);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
|
-
assertSignDataSupported(wallet, requiredTypes) {
|
|
370
|
-
const features = this.getWalletFeatures(wallet);
|
|
371
|
-
if (!features) {
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
const sd = features.find?.((f) => f && typeof f === 'object' && f.name === 'SignData');
|
|
375
|
-
if (!sd || typeof sd === 'string' || sd.name !== 'SignData') {
|
|
376
|
-
throw new Error("Wallet doesn't support SignData feature.");
|
|
377
|
-
}
|
|
378
|
-
const walletTypes = Array.isArray(sd.types) ? sd.types : [];
|
|
379
|
-
const unsupported = requiredTypes.filter(t => !walletTypes.includes(t));
|
|
380
|
-
if (unsupported.length) {
|
|
381
|
-
throw new Error(`Wallet doesn't support required SignData types: ${unsupported.join(', ')}.`);
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
getJSBridgeKey(wallet) {
|
|
385
|
-
return wallet?.jsBridgeKey;
|
|
386
|
-
},
|
|
387
|
-
getTonConnect(jsBridgeKey) {
|
|
388
|
-
if (!jsBridgeKey) {
|
|
389
|
-
return undefined;
|
|
390
|
-
}
|
|
391
|
-
return window[jsBridgeKey]?.tonconnect;
|
|
392
|
-
},
|
|
393
|
-
setupWalletListener(jsBridgeKey, wallet) {
|
|
394
|
-
const existingUnsubscribe = listenerUnsubscribes.get(jsBridgeKey);
|
|
395
|
-
if (existingUnsubscribe) {
|
|
396
|
-
try {
|
|
397
|
-
existingUnsubscribe();
|
|
398
|
-
}
|
|
399
|
-
catch {
|
|
400
|
-
}
|
|
401
|
-
listenerUnsubscribes.delete(jsBridgeKey);
|
|
402
|
-
}
|
|
403
|
-
const unsubscribe = wallet.listen((evt) => {
|
|
404
|
-
if (evt?.event === 'disconnect') {
|
|
405
|
-
listenerUnsubscribes.delete(jsBridgeKey);
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
if (typeof unsubscribe === 'function') {
|
|
409
|
-
listenerUnsubscribes.set(jsBridgeKey, unsubscribe);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
};
|
|
413
|
-
//# sourceMappingURL=TonConnectUtil.js.map
|
|
@@ -1 +0,0 @@
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
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { Base64 } from './Base64.js';
|
|
2
|
-
export function isWalletInfoInjectable(value) {
|
|
3
|
-
return 'jsBridgeKey' in value;
|
|
4
|
-
}
|
|
5
|
-
export function isWalletInfoRemote(value) {
|
|
6
|
-
return 'bridgeUrl' in value && typeof value.bridgeUrl === 'string';
|
|
7
|
-
}
|
|
8
|
-
export function isWalletInfoCurrentlyInjected(value) {
|
|
9
|
-
return isWalletInfoInjectable(value) && value.injected;
|
|
10
|
-
}
|
|
11
|
-
export function isWalletInfoCurrentlyEmbedded(value) {
|
|
12
|
-
return isWalletInfoCurrentlyInjected(value) && value.embedded;
|
|
13
|
-
}
|
|
14
|
-
const bounceableTag = 0x11;
|
|
15
|
-
const noBounceableTag = 0x51;
|
|
16
|
-
const testOnlyTag = 0x80;
|
|
17
|
-
export function toUserFriendlyAddress(hexAddress, testOnly = false) {
|
|
18
|
-
const { wc, hex } = parseHexAddress(hexAddress);
|
|
19
|
-
let tag = noBounceableTag;
|
|
20
|
-
if (testOnly) {
|
|
21
|
-
tag |= testOnlyTag;
|
|
22
|
-
}
|
|
23
|
-
const addr = new Int8Array(34);
|
|
24
|
-
addr[0] = tag;
|
|
25
|
-
addr[1] = wc;
|
|
26
|
-
addr.set(hex, 2);
|
|
27
|
-
const addressWithChecksum = new Uint8Array(36);
|
|
28
|
-
addressWithChecksum.set(addr);
|
|
29
|
-
addressWithChecksum.set(crc16(Uint8Array.from(addr)), 34);
|
|
30
|
-
const addressBase64 = Base64.encode(addressWithChecksum);
|
|
31
|
-
return addressBase64.replace(/\+/gu, '-').replace(/\//gu, '_');
|
|
32
|
-
}
|
|
33
|
-
function parseHexAddress(raw) {
|
|
34
|
-
const parts = raw.split(':');
|
|
35
|
-
if (parts.length !== 2) {
|
|
36
|
-
throw new Error(`Invalid address (expected "wc:hex"): ${raw}`);
|
|
37
|
-
}
|
|
38
|
-
const wcPart = parts[0];
|
|
39
|
-
if (!wcPart) {
|
|
40
|
-
throw new Error('Missing workchain');
|
|
41
|
-
}
|
|
42
|
-
const wcNum = parseInt(wcPart, 10);
|
|
43
|
-
if (wcNum !== 0 && wcNum !== -1) {
|
|
44
|
-
throw new Error(`Invalid workchain: ${wcNum}`);
|
|
45
|
-
}
|
|
46
|
-
const hexPart = parts[1];
|
|
47
|
-
if (!hexPart) {
|
|
48
|
-
throw new Error('Missing hex part');
|
|
49
|
-
}
|
|
50
|
-
const hex = hexPart.toLowerCase();
|
|
51
|
-
if (!/^[0-9a-f]{64}$/u.test(hex)) {
|
|
52
|
-
throw new Error(`Hex must be 64 chars (32 bytes): ${hex}`);
|
|
53
|
-
}
|
|
54
|
-
return { wc: wcNum, hex: hexToBytes(hex) };
|
|
55
|
-
}
|
|
56
|
-
const toByteMap = {};
|
|
57
|
-
for (let ord = 0; ord <= 0xff; ord += 1) {
|
|
58
|
-
let s = ord.toString(16);
|
|
59
|
-
if (s.length < 2) {
|
|
60
|
-
s = `0${s}`;
|
|
61
|
-
}
|
|
62
|
-
toByteMap[s] = ord;
|
|
63
|
-
}
|
|
64
|
-
export function hexToBytes(hex) {
|
|
65
|
-
const lowerHex = hex.toLowerCase();
|
|
66
|
-
const length2 = lowerHex.length;
|
|
67
|
-
if (length2 % 2 !== 0) {
|
|
68
|
-
throw new Error(`Hex string must have length a multiple of 2: ${lowerHex}`);
|
|
69
|
-
}
|
|
70
|
-
const length = length2 / 2;
|
|
71
|
-
const result = new Uint8Array(length);
|
|
72
|
-
for (let i = 0; i < length; i += 1) {
|
|
73
|
-
const doubled = i * 2;
|
|
74
|
-
const hexSubstring = lowerHex.substring(doubled, doubled + 2);
|
|
75
|
-
if (!Object.hasOwn(toByteMap, hexSubstring)) {
|
|
76
|
-
throw new Error(`Invalid hex character: ${hexSubstring}`);
|
|
77
|
-
}
|
|
78
|
-
const byteValue = toByteMap[hexSubstring];
|
|
79
|
-
if (byteValue === undefined) {
|
|
80
|
-
throw new Error(`Invalid hex character: ${hexSubstring}`);
|
|
81
|
-
}
|
|
82
|
-
result[i] = byteValue;
|
|
83
|
-
}
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
function crc16(data) {
|
|
87
|
-
const poly = 0x1021;
|
|
88
|
-
let reg = 0;
|
|
89
|
-
const msg = new Uint8Array(data.length + 2);
|
|
90
|
-
msg.set(data);
|
|
91
|
-
for (const byte of msg) {
|
|
92
|
-
let mask = 0x80;
|
|
93
|
-
while (mask) {
|
|
94
|
-
reg <<= 1;
|
|
95
|
-
if (byte & mask) {
|
|
96
|
-
reg += 1;
|
|
97
|
-
}
|
|
98
|
-
mask >>= 1;
|
|
99
|
-
if (reg > 0xffff) {
|
|
100
|
-
reg &= 0xffff;
|
|
101
|
-
reg ^= poly;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return new Uint8Array([Math.floor(reg / 256), reg % 256]);
|
|
106
|
-
}
|
|
107
|
-
export function parseUserFriendlyAddress(address) {
|
|
108
|
-
const base64 = address.replace(/-/gu, '+').replace(/_/gu, '/');
|
|
109
|
-
let decoded = undefined;
|
|
110
|
-
try {
|
|
111
|
-
decoded = Base64.decode(base64).toUint8Array();
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
throw new Error(`Invalid base64 encoding in address: ${address}`);
|
|
115
|
-
}
|
|
116
|
-
if (decoded.length !== 36) {
|
|
117
|
-
throw new Error(`Invalid address length: ${address}`);
|
|
118
|
-
}
|
|
119
|
-
const addr = decoded.slice(0, 34);
|
|
120
|
-
const checksum = decoded.slice(34, 36);
|
|
121
|
-
const calculatedChecksum = crc16(addr);
|
|
122
|
-
if (!checksum.every((byte, i) => byte === calculatedChecksum[i])) {
|
|
123
|
-
throw new Error(`Invalid checksum in address: ${address}`);
|
|
124
|
-
}
|
|
125
|
-
const tagValue = addr[0];
|
|
126
|
-
if (tagValue === undefined) {
|
|
127
|
-
throw new Error(`Invalid address: missing tag byte`);
|
|
128
|
-
}
|
|
129
|
-
let tag = tagValue;
|
|
130
|
-
let isTestOnly = false;
|
|
131
|
-
let isBounceable = false;
|
|
132
|
-
if (tag & testOnlyTag) {
|
|
133
|
-
isTestOnly = true;
|
|
134
|
-
tag ^= testOnlyTag;
|
|
135
|
-
}
|
|
136
|
-
if (tag !== bounceableTag && tag !== noBounceableTag) {
|
|
137
|
-
throw new Error(`Unknown address tag: ${tag}`);
|
|
138
|
-
}
|
|
139
|
-
isBounceable = tag === bounceableTag;
|
|
140
|
-
let wc = null;
|
|
141
|
-
if (addr[1] === 0xff) {
|
|
142
|
-
wc = -1;
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
wc = addr[1];
|
|
146
|
-
}
|
|
147
|
-
const hex = addr.slice(2);
|
|
148
|
-
if (wc !== 0 && wc !== -1) {
|
|
149
|
-
throw new Error(`Invalid workchain: ${wc}`);
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
wc,
|
|
153
|
-
hex: Array.from(hex)
|
|
154
|
-
.map(b => b.toString(16).padStart(2, '0'))
|
|
155
|
-
.join(''),
|
|
156
|
-
testOnly: isTestOnly,
|
|
157
|
-
isBounceable
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
//# sourceMappingURL=TonWalletUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TonWalletUtils.js","sourceRoot":"","sources":["../../../../src/utils/TonWalletUtils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,UAAU,sBAAsB,CAAC,KAAoB;IACzD,OAAO,aAAa,IAAI,KAAK,CAAA;AAC/B,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAoB;IACrD,OAAO,WAAW,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,CAAA;AACpE,CAAC;AAKD,MAAM,UAAU,6BAA6B,CAC3C,KAAoB;IAEpB,OAAO,sBAAsB,CAAC,KAAK,CA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