@lukso/transaction-decoder 1.0.1-dev.0f1bea5

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.
Files changed (110) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +486 -0
  3. package/dist/browser.cjs +6912 -0
  4. package/dist/browser.cjs.map +1 -0
  5. package/dist/browser.d.cts +6 -0
  6. package/dist/browser.d.ts +6 -0
  7. package/dist/browser.js +131 -0
  8. package/dist/browser.js.map +1 -0
  9. package/dist/cdn/transaction-decoder.global.js +296 -0
  10. package/dist/cdn/transaction-decoder.global.js.map +1 -0
  11. package/dist/chunk-GGBHTWJL.js +437 -0
  12. package/dist/chunk-GGBHTWJL.js.map +1 -0
  13. package/dist/chunk-GXZOF3QY.js +839 -0
  14. package/dist/chunk-GXZOF3QY.js.map +1 -0
  15. package/dist/chunk-LJ6ES5XF.js +776 -0
  16. package/dist/chunk-LJ6ES5XF.js.map +1 -0
  17. package/dist/chunk-XVHJWV5U.js +4925 -0
  18. package/dist/chunk-XVHJWV5U.js.map +1 -0
  19. package/dist/data.cjs +5518 -0
  20. package/dist/data.cjs.map +1 -0
  21. package/dist/data.d.cts +43 -0
  22. package/dist/data.d.ts +43 -0
  23. package/dist/data.js +55 -0
  24. package/dist/data.js.map +1 -0
  25. package/dist/index-BzXh7poJ.d.cts +524 -0
  26. package/dist/index-BzXh7poJ.d.ts +524 -0
  27. package/dist/index.cjs +6912 -0
  28. package/dist/index.cjs.map +1 -0
  29. package/dist/index.d.cts +756 -0
  30. package/dist/index.d.ts +756 -0
  31. package/dist/index.js +131 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/server.cjs +5644 -0
  34. package/dist/server.cjs.map +1 -0
  35. package/dist/server.d.cts +217 -0
  36. package/dist/server.d.ts +217 -0
  37. package/dist/server.js +644 -0
  38. package/dist/server.js.map +1 -0
  39. package/dist/utils-CBAkjQh3.d.cts +108 -0
  40. package/dist/utils-xT9-km0r.d.ts +108 -0
  41. package/package.json +101 -0
  42. package/src/browser.ts +13 -0
  43. package/src/client/resolveAddresses.ts +157 -0
  44. package/src/core/addressCollector.ts +153 -0
  45. package/src/core/addressResolver.ts +135 -0
  46. package/src/core/dataModel.ts +888 -0
  47. package/src/core/instance.ts +33 -0
  48. package/src/core/integrateDecoder.ts +325 -0
  49. package/src/data.ts +70 -0
  50. package/src/decoder/GENERATOR_PROPOSAL.md +182 -0
  51. package/src/decoder/THREE_PHASE_EXAMPLE.md +108 -0
  52. package/src/decoder/aggregation.ts +218 -0
  53. package/src/decoder/browserCache.ts +237 -0
  54. package/src/decoder/cache/README.md +126 -0
  55. package/src/decoder/cache/index.ts +44 -0
  56. package/src/decoder/cache.ts +139 -0
  57. package/src/decoder/constants.ts +125 -0
  58. package/src/decoder/decodeTransaction.ts +292 -0
  59. package/src/decoder/errors.ts +95 -0
  60. package/src/decoder/events.ts +192 -0
  61. package/src/decoder/functionSignature.ts +344 -0
  62. package/src/decoder/getDataFromExternalSources.ts +248 -0
  63. package/src/decoder/graphqlWS.ts +22 -0
  64. package/src/decoder/interfaces.ts +185 -0
  65. package/src/decoder/keyValue.ts +5 -0
  66. package/src/decoder/kvCache.ts +241 -0
  67. package/src/decoder/lruCache.ts +184 -0
  68. package/src/decoder/lsp7Mint.test.ts +179 -0
  69. package/src/decoder/lsp7TransferBatch.test.ts +105 -0
  70. package/src/decoder/plugins/RegistryAbi.ts +562 -0
  71. package/src/decoder/plugins/enhanceBurntPix.ts +132 -0
  72. package/src/decoder/plugins/enhanceGraffiti.ts +70 -0
  73. package/src/decoder/plugins/enhanceLSP0ERC725Account.ts +179 -0
  74. package/src/decoder/plugins/enhanceLSP26FollowerSystem.ts +88 -0
  75. package/src/decoder/plugins/enhanceLSP6KeyManager.ts +231 -0
  76. package/src/decoder/plugins/enhanceLSP7DigitalAsset.ts +165 -0
  77. package/src/decoder/plugins/enhanceLSP8IdentifiableDigitalAsset.ts +170 -0
  78. package/src/decoder/plugins/enhanceLSP9Vault.ts +57 -0
  79. package/src/decoder/plugins/enhanceRetrieveAbi.ts +85 -0
  80. package/src/decoder/plugins/enhanceSetData.ts +135 -0
  81. package/src/decoder/plugins/index.ts +99 -0
  82. package/src/decoder/plugins/schemaDefault.ts +318 -0
  83. package/src/decoder/plugins/standardPlugin.ts +202 -0
  84. package/src/decoder/registry.ts +322 -0
  85. package/src/decoder/singleGQL.ts +293 -0
  86. package/src/decoder/transaction.ts +198 -0
  87. package/src/decoder/types.ts +465 -0
  88. package/src/decoder/utils.ts +212 -0
  89. package/src/example/usage.ts +172 -0
  90. package/src/index.ts +174 -0
  91. package/src/server/addressResolver.ts +68 -0
  92. package/src/server/caches.ts +209 -0
  93. package/src/server/decodeTransactionSync.ts +156 -0
  94. package/src/server/decodeTransactionsBatch.ts +207 -0
  95. package/src/server/finishDecoding.ts +116 -0
  96. package/src/server/index.ts +81 -0
  97. package/src/server/lsp23Resolver.test.ts +46 -0
  98. package/src/server/lsp23Resolver.ts +419 -0
  99. package/src/server/types.ts +168 -0
  100. package/src/server.ts +22 -0
  101. package/src/shared/addressResolver.ts +651 -0
  102. package/src/shared/cache.ts +144 -0
  103. package/src/shared/constants.ts +21 -0
  104. package/src/stubs/tty.ts +13 -0
  105. package/src/stubs/util.ts +42 -0
  106. package/src/types/index.ts +154 -0
  107. package/src/types/provider.ts +46 -0
  108. package/src/umd.ts +13 -0
  109. package/src/utils/debug.ts +49 -0
  110. package/src/utils/json-bigint.ts +47 -0
@@ -0,0 +1,437 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-XVHJWV5U.js";
4
+
5
+ // src/shared/addressResolver.ts
6
+ import request, { gql } from "graphql-request";
7
+ import { lukso } from "viem/chains";
8
+ var addressesGql = gql`
9
+ query AddressQuery($profiles: [String!], $assets: [String!], $tokens: [String!]) {
10
+ Profile(
11
+ where: {id: {_in: $profiles}}
12
+ ) {
13
+ fullName
14
+ id
15
+ name
16
+ tags
17
+ description
18
+ standard
19
+ controllers {
20
+ address
21
+ tags
22
+ permissions
23
+ }
24
+ owner {
25
+ id
26
+ }
27
+ profileImages(where: {error: {_is_null: true}}, order_by: {width: asc}) {
28
+ width
29
+ height
30
+ src
31
+ verified
32
+ }
33
+ backgroundImages(where: {error: {_is_null: true}}, order_by: {width: asc}) {
34
+ width
35
+ height
36
+ src
37
+ verified
38
+ }
39
+ avatars(where: {error: {_is_null: true}}, order_by: {width: asc}) {
40
+ width
41
+ height
42
+ src
43
+ verified
44
+ }
45
+ }
46
+ Token(where: {id: {_in: $tokens}}) {
47
+ id
48
+ baseAsset {
49
+ id
50
+ description
51
+ icons {
52
+ src
53
+ verified
54
+ width
55
+ height
56
+ }
57
+ isCollection
58
+ isLSP7
59
+ isUnknown
60
+ name
61
+ standard
62
+ interfaces
63
+ decimals
64
+ owner_id
65
+ lsp4Creators {
66
+ profile_id
67
+ }
68
+ }
69
+ formattedTokenId
70
+ icons {
71
+ src
72
+ verified
73
+ width
74
+ height
75
+ }
76
+ images(where: {index: {_eq: 0}}) {
77
+ src
78
+ verified
79
+ width
80
+ height
81
+ }
82
+ lsp4TokenName
83
+ lsp4TokenSymbol
84
+ lsp4TokenType
85
+ lsp8TokenIdFormat
86
+ tokenId
87
+ name
88
+ description
89
+ lsp4Creators {
90
+ profile_id
91
+ }
92
+ }
93
+ Asset(where: {id: {_in: $assets}}) {
94
+ id
95
+ images(where: {index: {_eq: 0}}) {
96
+ src
97
+ width
98
+ verified
99
+ height
100
+ }
101
+ interfaces
102
+ isCollection
103
+ isLSP7
104
+ isUnknown
105
+ lsp4TokenName
106
+ lsp4TokenSymbol
107
+ lsp4TokenType
108
+ method
109
+ name
110
+ icons {
111
+ src
112
+ width
113
+ height
114
+ }
115
+ description
116
+ decimals
117
+ standard
118
+ owner_id
119
+ lsp4Creators {
120
+ profile_id
121
+ }
122
+ }
123
+ }
124
+ `;
125
+ async function fetchMultipleAddresses(addresses, graphqlEndpoint, cache) {
126
+ const results = /* @__PURE__ */ new Map();
127
+ if (addresses.length === 0) {
128
+ return results;
129
+ }
130
+ const uncachedAddresses = [];
131
+ if (cache) {
132
+ if (cache.getMany) {
133
+ const cachedResults = await cache.getMany(addresses);
134
+ for (const [key, value] of cachedResults) {
135
+ results.set(key, value);
136
+ }
137
+ for (const addr of addresses) {
138
+ if (!results.has(addr)) {
139
+ uncachedAddresses.push(addr);
140
+ }
141
+ }
142
+ } else {
143
+ for (const addr of addresses) {
144
+ const cached = await cache.get(addr);
145
+ if (cached) {
146
+ results.set(addr, cached);
147
+ } else {
148
+ uncachedAddresses.push(addr);
149
+ }
150
+ }
151
+ }
152
+ if (uncachedAddresses.length === 0) {
153
+ return results;
154
+ }
155
+ } else {
156
+ uncachedAddresses.push(...addresses);
157
+ }
158
+ const profiles = [];
159
+ const assets = [];
160
+ const tokens = [];
161
+ const tokenMapping = /* @__PURE__ */ new Map();
162
+ for (const key of uncachedAddresses) {
163
+ const hasDash = key.includes("-");
164
+ const hasColon = key.includes(":");
165
+ if (hasColon || hasDash) {
166
+ const normalizedKey = key.replace(/[-:]/, "-");
167
+ tokens.push(normalizedKey);
168
+ const [address, tokenId] = key.split(/[-:]/);
169
+ tokenMapping.set(key, { address, tokenId });
170
+ } else {
171
+ profiles.push(key);
172
+ assets.push(key);
173
+ }
174
+ }
175
+ try {
176
+ const data = await request(graphqlEndpoint, addressesGql, {
177
+ profiles,
178
+ assets,
179
+ tokens
180
+ });
181
+ if (data.Profile) {
182
+ for (const profile of data.Profile) {
183
+ if (profile.standard !== "LSP0ERC725Account") {
184
+ continue;
185
+ }
186
+ const enhancedInfo = {
187
+ address: profile.id,
188
+ __gqltype: "Profile",
189
+ name: profile.name || profile.fullName,
190
+ fullName: profile.fullName,
191
+ standard: profile.standard,
192
+ tags: profile.tags,
193
+ description: profile.description,
194
+ owner: profile.owner,
195
+ controllers: profile.controllers,
196
+ profileImages: profile.profileImages,
197
+ backgroundImages: profile.backgroundImages,
198
+ avatars: profile.avatars
199
+ };
200
+ results.set(profile.id, enhancedInfo);
201
+ }
202
+ }
203
+ if (data.Token) {
204
+ for (const token of data.Token) {
205
+ const { id, baseAsset, tokenId, ...rest } = token;
206
+ if (baseAsset?.id && tokenId) {
207
+ const enhancedInfo = {
208
+ address: baseAsset.id,
209
+ tokenId,
210
+ __gqltype: "Token",
211
+ ...rest,
212
+ baseAsset
213
+ };
214
+ const keyWithColon = `${baseAsset.id}:${tokenId}`;
215
+ const keyWithDash = `${baseAsset.id}-${tokenId}`;
216
+ results.set(keyWithColon, enhancedInfo);
217
+ results.set(keyWithDash, enhancedInfo);
218
+ }
219
+ }
220
+ }
221
+ if (data.Asset) {
222
+ for (const asset of data.Asset) {
223
+ if (asset.standard === "LSP0ERC725Account") {
224
+ continue;
225
+ }
226
+ const enhancedInfo = {
227
+ address: asset.id,
228
+ __gqltype: "Asset",
229
+ ...asset
230
+ };
231
+ if (!results.has(asset.id)) {
232
+ results.set(asset.id, enhancedInfo);
233
+ }
234
+ }
235
+ }
236
+ if (cache) {
237
+ const newEntries = [];
238
+ for (const [key, value] of results) {
239
+ const isCached = addresses.some(
240
+ (addr) => addr.toLowerCase() === key.toLowerCase()
241
+ );
242
+ if (isCached && uncachedAddresses.some(
243
+ (addr) => addr.toLowerCase() === key.toLowerCase()
244
+ )) {
245
+ newEntries.push([key, value]);
246
+ }
247
+ }
248
+ if (cache.setMany && newEntries.length > 0) {
249
+ await cache.setMany(newEntries);
250
+ } else {
251
+ for (const [key, value] of newEntries) {
252
+ await cache.set(key, value);
253
+ }
254
+ }
255
+ }
256
+ return results;
257
+ } catch (error) {
258
+ console.error("Failed to fetch addresses:", error);
259
+ return results;
260
+ }
261
+ }
262
+ __name(fetchMultipleAddresses, "fetchMultipleAddresses");
263
+ function getGraphQLEndpoint(chain) {
264
+ return chain.id === lukso.id ? "https://envio.lukso-mainnet.universal.tech/v1/graphql" : "https://envio.lukso-testnet.universal.tech/v1/graphql";
265
+ }
266
+ __name(getGraphQLEndpoint, "getGraphQLEndpoint");
267
+ var profilesByControllerGql = gql`
268
+ query ProfilesByController($controllerAddresses: [String!]) {
269
+ Profile(
270
+ where: {
271
+ controllers: {
272
+ address: { _in: $controllerAddresses }
273
+ tags: {
274
+ _contains: [
275
+ "ADDCONTROLLER"
276
+ "EDITPERMISSIONS"
277
+ "SUPER_TRANSFERVALUE"
278
+ "TRANSFERVALUE"
279
+ "SUPER_CALL"
280
+ "CALL"
281
+ "SUPER_STATICCALL"
282
+ "STATICCALL"
283
+ "DEPLOY"
284
+ "SUPER_SETDATA"
285
+ "SETDATA"
286
+ "ENCRYPT"
287
+ "DECRYPT"
288
+ "SIGN"
289
+ "EXECUTE_RELAY_CALL"
290
+ ]
291
+ }
292
+ }
293
+ }
294
+ order_by: { blockNumber: asc }
295
+ ) {
296
+ fullName
297
+ id
298
+ name
299
+ tags
300
+ description
301
+ standard
302
+ controllers {
303
+ address
304
+ tags
305
+ permissions
306
+ }
307
+ owner {
308
+ id
309
+ }
310
+ profileImages(where: {error: {_is_null: true}}, order_by: {width: asc}) {
311
+ width
312
+ height
313
+ src
314
+ verified
315
+ }
316
+ backgroundImages(where: {error: {_is_null: true}}, order_by: {width: asc}) {
317
+ width
318
+ height
319
+ src
320
+ verified
321
+ }
322
+ avatars(where: {error: {_is_null: true}}, order_by: {width: asc}) {
323
+ width
324
+ height
325
+ src
326
+ verified
327
+ }
328
+ }
329
+ }
330
+ `;
331
+ async function fetchProfilesByControllers(controllerAddresses, chain) {
332
+ const graphqlEndpoint = getGraphQLEndpoint(chain);
333
+ try {
334
+ const data = await request(graphqlEndpoint, profilesByControllerGql, {
335
+ controllerAddresses: controllerAddresses.map(
336
+ (addr) => addr.toLowerCase()
337
+ )
338
+ });
339
+ return data.Profile || [];
340
+ } catch (error) {
341
+ console.error(
342
+ `Failed to fetch profiles by controllers on ${chain.name}:`,
343
+ error
344
+ );
345
+ return [];
346
+ }
347
+ }
348
+ __name(fetchProfilesByControllers, "fetchProfilesByControllers");
349
+ async function getImage(images, options) {
350
+ const {
351
+ width,
352
+ height: _height,
353
+ index,
354
+ ignoreVerification,
355
+ ignoreHead = true,
356
+ // By default we don't want to do HEAD requests for all images.
357
+ dpr = 1
358
+ } = options;
359
+ const boost = dpr === 1 ? 1.5 : 1;
360
+ const height = _height || width;
361
+ const { src: _src, verified } = (images || []).find(
362
+ (i) => i.width >= width * boost * dpr && i.height && i.height >= height * boost * dpr && (index ? i.index === index : i.index === void 0)
363
+ ) || images?.at(-1) || {};
364
+ const url = _src?.startsWith("https://api.universalprofile.cloud/ipfs/") ? _src?.replace(/\/ipfs\//, "/image/") : _src;
365
+ if (!url) {
366
+ return options.fallback ? { src: options.fallback, width: 128, height: 128 } : void 0;
367
+ }
368
+ try {
369
+ let isImage = void 0;
370
+ if (typeof caches !== "undefined" && !ignoreHead) {
371
+ const cache = await caches.open("image-types");
372
+ const cached = await cache.match(url);
373
+ if (cached) {
374
+ const response = await cached.json();
375
+ if (response) {
376
+ isImage = response;
377
+ }
378
+ }
379
+ }
380
+ if (!isImage && !ignoreHead) {
381
+ const now = Date.now();
382
+ isImage = await fetch(url, { method: "HEAD" }).then((response) => {
383
+ if (response.ok) {
384
+ const mime = response.headers.get("content-type") || "";
385
+ response.body?.cancel();
386
+ return /^image\//.test(mime) ? mime : void 0;
387
+ }
388
+ response.body?.cancel();
389
+ return void 0;
390
+ }).catch((error) => {
391
+ console.error(error.stack);
392
+ return void 0;
393
+ });
394
+ if (isImage != null && typeof caches !== "undefined") {
395
+ const cache = await caches.open("image-types");
396
+ await cache.put(url, new Response(JSON.stringify(isImage))).catch((error) => {
397
+ console.error(error.stack, url);
398
+ });
399
+ }
400
+ }
401
+ if (isImage || ignoreHead) {
402
+ const finalUrl = new URL(url);
403
+ const { searchParams } = finalUrl;
404
+ const qs = new URLSearchParams(searchParams);
405
+ if (width) {
406
+ qs.set("width", `${width * boost}`);
407
+ }
408
+ if (width || height) {
409
+ qs.set("height", `${(height || width) * boost}`);
410
+ }
411
+ qs.set("fit", "cover");
412
+ qs.set("dpr", dpr.toString());
413
+ if (!options.ignoreHead && !/\/svg/.test(isImage || "") && options.forcePng) {
414
+ qs.set("format", "png");
415
+ }
416
+ finalUrl.search = qs.toString();
417
+ const image = finalUrl.toString();
418
+ return {
419
+ width,
420
+ height: height || width,
421
+ src: verified === "INVALID" && !ignoreVerification ? `${image}&blur=30` : image
422
+ };
423
+ }
424
+ } catch (error) {
425
+ console.error(error.stack);
426
+ }
427
+ return options.fallback ? { src: options.fallback, width: 128, height: 128 } : void 0;
428
+ }
429
+ __name(getImage, "getImage");
430
+
431
+ export {
432
+ fetchMultipleAddresses,
433
+ getGraphQLEndpoint,
434
+ fetchProfilesByControllers,
435
+ getImage
436
+ };
437
+ //# sourceMappingURL=chunk-GGBHTWJL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shared/addressResolver.ts"],"sourcesContent":["import request, { gql } from 'graphql-request'\nimport type { Address, Chain, Hex } from 'viem'\nimport { lukso } from 'viem/chains'\nimport type { DataKey, EnhancedInfo } from '../types'\nimport type { AddressIdentityCache } from './cache'\n\n/**\n * GraphQL queries for address resolution\n * Using the exact schema from addressGQL.ts\n */\nconst addressesGql = gql`\nquery AddressQuery($profiles: [String!], $assets: [String!], $tokens: [String!]) {\n Profile(\n where: {id: {_in: $profiles}}\n ) {\n fullName\n id\n name\n tags\n description\n standard\n controllers {\n address\n tags\n permissions\n }\n owner {\n id\n }\n profileImages(where: {error: {_is_null: true}}, order_by: {width: asc}) {\n width\n height\n src\n verified\n }\n backgroundImages(where: {error: {_is_null: true}}, order_by: {width: asc}) {\n width\n height\n src\n verified\n }\n avatars(where: {error: {_is_null: true}}, order_by: {width: asc}) {\n width\n height\n src\n verified\n }\n }\n Token(where: {id: {_in: $tokens}}) {\n id\n baseAsset {\n id\n description\n icons {\n src\n verified\n width\n height\n }\n isCollection\n isLSP7\n isUnknown\n name\n standard\n interfaces\n decimals\n owner_id\n lsp4Creators {\n profile_id\n }\n }\n formattedTokenId\n icons {\n src\n verified\n width\n height\n }\n images(where: {index: {_eq: 0}}) {\n src\n verified\n width\n height\n }\n lsp4TokenName\n lsp4TokenSymbol\n lsp4TokenType\n lsp8TokenIdFormat\n tokenId\n name\n description\n lsp4Creators {\n profile_id\n }\n }\n Asset(where: {id: {_in: $assets}}) {\n id\n images(where: {index: {_eq: 0}}) {\n src\n width\n verified\n height\n }\n interfaces\n isCollection\n isLSP7\n isUnknown\n lsp4TokenName\n lsp4TokenSymbol\n lsp4TokenType\n method\n name\n icons {\n src\n width\n height\n }\n description\n decimals\n standard\n owner_id\n lsp4Creators {\n profile_id\n }\n }\n}\n`\n\n// Image data structure from GraphQL\nexport interface ImageData {\n width?: number\n height?: number\n url?: string // Raw URL (may be ipfs://)\n src?: string // Resolved HTTPS URL (fallback to url if not present)\n verified?: boolean\n}\n\n// Link data structure from GraphQL\nexport interface LinkData {\n url: string\n title?: string\n}\n\n// Profile data from GraphQL\nexport interface ProfileData {\n id: Hex\n name?: string\n fullName?: string\n tags?: string[]\n description?: string\n links?: LinkData[]\n standard?: string\n controllers?: Array<{\n address: string\n tags?: string[]\n permissions?: Hex\n }>\n owner?: { id: string }\n profileImages?: ImageData[]\n backgroundImages?: ImageData[]\n avatars?: ImageData[]\n}\n\n// Asset data from GraphQL\nexport interface AssetData {\n id: Hex\n name?: string\n standard?: string\n lsp4TokenName?: string\n lsp4TokenSymbol?: string\n lsp4TokenType?: string\n method?: string\n description?: string\n links?: LinkData[]\n decimals?: number\n interfaces?: string[]\n isCollection?: boolean\n isLSP7?: boolean\n isUnknown?: boolean\n icons?: ImageData[]\n images?: ImageData[]\n}\n\n// Token data from GraphQL\nexport interface TokenData {\n id: Hex\n tokenId?: Hex\n name?: string\n description?: string\n links?: LinkData[]\n lsp4TokenName?: string\n lsp4TokenSymbol?: string\n lsp4TokenType?: string\n lsp8TokenIdFormat?: string\n formattedTokenId?: string\n baseAsset?: {\n id: Hex\n description?: string\n icons?: ImageData[]\n isCollection?: boolean\n isLSP7?: boolean\n isUnknown?: boolean\n name?: string\n standard?: string\n interfaces?: string[]\n decimals?: number\n }\n icons?: ImageData[]\n images?: ImageData[]\n}\n\nexport type TFetchAddressData = {\n Profile?: ProfileData[]\n Asset?: AssetData[]\n Token?: TokenData[]\n}\n\n/**\n * Fetch multiple addresses from GraphQL and return them as a Map\n * This is the shared implementation that both server and core can use\n */\nexport async function fetchMultipleAddresses(\n addresses: readonly DataKey[],\n graphqlEndpoint: string,\n cache?: AddressIdentityCache\n): Promise<Map<DataKey, EnhancedInfo>> {\n const results = new Map<DataKey, EnhancedInfo>()\n\n if (addresses.length === 0) {\n return results\n }\n\n // Check cache first if provided\n const uncachedAddresses: DataKey[] = []\n\n if (cache) {\n // Try to get many at once if supported\n if (cache.getMany) {\n const cachedResults = await cache.getMany(addresses)\n for (const [key, value] of cachedResults) {\n results.set(key, value)\n }\n // Find which ones we still need to fetch\n for (const addr of addresses) {\n if (!results.has(addr)) {\n uncachedAddresses.push(addr)\n }\n }\n } else {\n // Fall back to individual lookups\n for (const addr of addresses) {\n const cached = await cache.get(addr)\n if (cached) {\n results.set(addr, cached)\n } else {\n uncachedAddresses.push(addr)\n }\n }\n }\n\n // If all were cached, return early\n if (uncachedAddresses.length === 0) {\n return results\n }\n } else {\n // No cache, fetch all\n uncachedAddresses.push(...addresses)\n }\n\n // Parse addresses and tokens\n const profiles: string[] = []\n const assets: string[] = []\n const tokens: string[] = []\n const tokenMapping = new Map<string, { address: Address; tokenId: string }>()\n\n for (const key of uncachedAddresses) {\n const hasDash = key.includes('-')\n const hasColon = key.includes(':')\n\n if (hasColon || hasDash) {\n const normalizedKey = key.replace(/[-:]/, '-')\n tokens.push(normalizedKey)\n const [address, tokenId] = key.split(/[-:]/)\n tokenMapping.set(key, { address: address as Address, tokenId })\n } else {\n // Regular addresses - could be profiles or assets\n profiles.push(key)\n assets.push(key)\n }\n }\n\n try {\n // Fetch data from GraphQL\n const data = (await request(graphqlEndpoint, addressesGql, {\n profiles,\n assets,\n tokens,\n })) as TFetchAddressData\n\n // Process profiles\n if (data.Profile) {\n for (const profile of data.Profile) {\n if (profile.standard !== 'LSP0ERC725Account') {\n continue\n }\n const enhancedInfo: EnhancedInfo = {\n address: profile.id as Address,\n __gqltype: 'Profile',\n name: profile.name || profile.fullName,\n fullName: profile.fullName,\n standard: profile.standard,\n tags: profile.tags,\n description: profile.description,\n owner: profile.owner,\n controllers: profile.controllers,\n profileImages: profile.profileImages,\n backgroundImages: profile.backgroundImages,\n avatars: profile.avatars,\n }\n results.set(profile.id as Address, enhancedInfo)\n }\n }\n\n // Process tokens (must be before assets per addressGQL.ts logic)\n if (data.Token) {\n for (const token of data.Token) {\n const { id, baseAsset, tokenId, ...rest } = token\n\n // Tokens have a composite ID format and baseAsset reference\n if (baseAsset?.id && tokenId) {\n const enhancedInfo: EnhancedInfo = {\n address: baseAsset.id as Address,\n tokenId: tokenId as Address,\n __gqltype: 'Token',\n ...rest,\n baseAsset,\n }\n // Store with both dash and colon separators to handle both formats\n const keyWithColon = `${baseAsset.id}:${tokenId}` as DataKey\n const keyWithDash = `${baseAsset.id}-${tokenId}` as DataKey\n results.set(keyWithColon, enhancedInfo)\n results.set(keyWithDash, enhancedInfo)\n }\n }\n }\n\n // Process assets\n if (data.Asset) {\n for (const asset of data.Asset) {\n if (asset.standard === 'LSP0ERC725Account') {\n // Skip profiles - already processed\n continue\n }\n const enhancedInfo: EnhancedInfo = {\n address: asset.id as Address,\n __gqltype: 'Asset',\n ...asset,\n }\n if (!results.has(asset.id as Address)) {\n results.set(asset.id as Address, enhancedInfo)\n }\n }\n }\n\n // Cache the newly fetched results\n if (cache) {\n const newEntries: Array<[DataKey, EnhancedInfo]> = []\n\n // Collect all new entries\n for (const [key, value] of results) {\n // Only cache entries that were fetched (not from cache)\n const isCached = addresses.some(\n (addr) => addr.toLowerCase() === key.toLowerCase()\n )\n\n if (\n isCached &&\n uncachedAddresses.some(\n (addr) => addr.toLowerCase() === key.toLowerCase()\n )\n ) {\n newEntries.push([key, value])\n }\n }\n\n // Use batch update if available\n if (cache.setMany && newEntries.length > 0) {\n await cache.setMany(newEntries)\n } else {\n // Fall back to individual updates\n for (const [key, value] of newEntries) {\n await cache.set(key, value)\n }\n }\n }\n\n return results\n } catch (error) {\n console.error('Failed to fetch addresses:', error)\n return results\n }\n}\n\n/**\n * Get GraphQL endpoint for a given chain\n */\nexport function getGraphQLEndpoint(chain: Chain): string {\n return chain.id === lukso.id\n ? 'https://envio.lukso-mainnet.universal.tech/v1/graphql'\n : 'https://envio.lukso-testnet.universal.tech/v1/graphql'\n}\n\n/**\n * GraphQL query to find profiles controlled by specific addresses\n */\nconst profilesByControllerGql = gql`\nquery ProfilesByController($controllerAddresses: [String!]) {\n Profile(\n where: {\n controllers: {\n address: { _in: $controllerAddresses }\n tags: {\n _contains: [\n \"ADDCONTROLLER\"\n \"EDITPERMISSIONS\"\n \"SUPER_TRANSFERVALUE\"\n \"TRANSFERVALUE\"\n \"SUPER_CALL\"\n \"CALL\"\n \"SUPER_STATICCALL\"\n \"STATICCALL\"\n \"DEPLOY\"\n \"SUPER_SETDATA\"\n \"SETDATA\"\n \"ENCRYPT\"\n \"DECRYPT\"\n \"SIGN\"\n \"EXECUTE_RELAY_CALL\"\n ]\n }\n }\n }\n order_by: { blockNumber: asc }\n ) {\n fullName\n id\n name\n tags\n description\n standard\n controllers {\n address\n tags\n permissions\n }\n owner {\n id\n }\n profileImages(where: {error: {_is_null: true}}, order_by: {width: asc}) {\n width\n height\n src\n verified\n }\n backgroundImages(where: {error: {_is_null: true}}, order_by: {width: asc}) {\n width\n height\n src\n verified\n }\n avatars(where: {error: {_is_null: true}}, order_by: {width: asc}) {\n width\n height\n src\n verified\n }\n }\n}\n`\n\n/**\n * Find profiles controlled by specific controller addresses\n * @param controllerAddresses - Array of controller addresses to search for\n * @param chain - Which chain to query\n * @returns Array of profile data\n */\nexport async function fetchProfilesByControllers(\n controllerAddresses: readonly Address[],\n chain: Chain\n): Promise<ProfileData[]> {\n const graphqlEndpoint = getGraphQLEndpoint(chain)\n\n try {\n const data = (await request(graphqlEndpoint, profilesByControllerGql, {\n controllerAddresses: controllerAddresses.map((addr) =>\n addr.toLowerCase()\n ),\n })) as { Profile?: ProfileData[] }\n\n return data.Profile || []\n } catch (error) {\n console.error(\n `Failed to fetch profiles by controllers on ${chain.name}:`,\n error\n )\n return []\n }\n}\n\nexport type ImageURL = {\n url?: string\n data?: string\n src?: string\n width: number\n height: number\n index?: number\n verified?: string\n}\n\n/**\n * Assuming the images are sorted ascending by width and/or height pick the first\n * image that's larger than the requested size * dpr and process that one.\n * By default this will assume the data came from the indexer and therefore\n * we do not need to verify the existence of all the images (i.e. HEAD requests for\n * each image) Setting ignoreHead to false is important during RPC mode so that\n * we can skip images that are not really available.\n *\n * @param images - array of images\n * @param options - specify arguments for search/processing\n * @returns { width, height, src } - the image that fits the criteria\n */\nexport async function getImage(\n images: ImageURL[],\n options: {\n width: number\n height?: number\n index?: number\n ignoreVerification?: boolean\n forcePng?: boolean\n ignoreHead?: boolean\n fallback?: string\n dpr?: number\n }\n): Promise<{ width: number; height: number; src?: string } | undefined> {\n const {\n width,\n height: _height,\n index,\n ignoreVerification,\n ignoreHead = true, // By default we don't want to do HEAD requests for all images.\n dpr = 1,\n } = options\n const boost = dpr === 1 ? 1.5 : 1\n const height = _height || width\n const { src: _src, verified } =\n (images || []).find(\n (i) =>\n i.width >= width * boost * dpr &&\n i.height &&\n i.height >= height * boost * dpr &&\n (index ? i.index === index : i.index === undefined)\n ) ||\n images?.at(-1) ||\n {}\n // We're talking about images here, so we should be using /image/ instead of /ipfs/\n const url = _src?.startsWith('https://api.universalprofile.cloud/ipfs/')\n ? _src?.replace(/\\/ipfs\\//, '/image/')\n : _src\n if (!url) {\n return options.fallback\n ? { src: options.fallback, width: 128, height: 128 }\n : undefined\n }\n try {\n let isImage: string | undefined = undefined\n if (typeof caches !== 'undefined' && !ignoreHead) {\n const cache = await caches.open('image-types')\n const cached = await cache.match(url)\n if (cached) {\n const response = await cached.json()\n if (response) {\n isImage = response\n }\n }\n }\n if (!isImage && !ignoreHead) {\n // HEAD will return 200, 404 and so including the 'content-type'\n // We use this to determine what type of images we have.\n // If the images came from the indexer then this test\n // has already been done on the indexer and we can skip it here.\n const now = Date.now()\n isImage = await fetch(url, { method: 'HEAD' })\n .then((response) => {\n if (response.ok) {\n const mime = response.headers.get('content-type') || ''\n response.body?.cancel()\n return /^image\\//.test(mime) ? mime : undefined\n }\n response.body?.cancel()\n return undefined\n })\n .catch((error) => {\n console.error((error as Error).stack)\n return undefined\n })\n if (isImage != null && typeof caches !== 'undefined') {\n const cache = await caches.open('image-types')\n await cache\n .put(url, new Response(JSON.stringify(isImage)))\n .catch((error) => {\n console.error((error as Error).stack, url)\n })\n }\n }\n if (isImage || ignoreHead) {\n const finalUrl = new URL(url)\n const { searchParams } = finalUrl\n const qs = new URLSearchParams(searchParams)\n if (width) {\n qs.set('width', `${width * boost}`)\n }\n if (width || height) {\n qs.set('height', `${(height || width) * boost}`)\n }\n qs.set('fit', 'cover')\n qs.set('dpr', dpr.toString())\n if (\n !options.ignoreHead &&\n !/\\/svg/.test(isImage || '') &&\n options.forcePng\n ) {\n qs.set('format', 'png')\n }\n finalUrl.search = qs.toString()\n const image = finalUrl.toString()\n return {\n width,\n height: height || width,\n src:\n verified === 'INVALID' && !ignoreVerification\n ? `${image}&blur=30`\n : image,\n }\n }\n } catch (error) {\n console.error((error as Error).stack)\n }\n return options.fallback\n ? { src: options.fallback, width: 128, height: 128 }\n : undefined\n}\n"],"mappings":";;;;;AAAA,OAAO,WAAW,WAAW;AAE7B,SAAS,aAAa;AAQtB,IAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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