@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.
- package/LICENSE +201 -0
- package/README.md +486 -0
- package/dist/browser.cjs +6912 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +6 -0
- package/dist/browser.d.ts +6 -0
- package/dist/browser.js +131 -0
- package/dist/browser.js.map +1 -0
- package/dist/cdn/transaction-decoder.global.js +296 -0
- package/dist/cdn/transaction-decoder.global.js.map +1 -0
- package/dist/chunk-GGBHTWJL.js +437 -0
- package/dist/chunk-GGBHTWJL.js.map +1 -0
- package/dist/chunk-GXZOF3QY.js +839 -0
- package/dist/chunk-GXZOF3QY.js.map +1 -0
- package/dist/chunk-LJ6ES5XF.js +776 -0
- package/dist/chunk-LJ6ES5XF.js.map +1 -0
- package/dist/chunk-XVHJWV5U.js +4925 -0
- package/dist/chunk-XVHJWV5U.js.map +1 -0
- package/dist/data.cjs +5518 -0
- package/dist/data.cjs.map +1 -0
- package/dist/data.d.cts +43 -0
- package/dist/data.d.ts +43 -0
- package/dist/data.js +55 -0
- package/dist/data.js.map +1 -0
- package/dist/index-BzXh7poJ.d.cts +524 -0
- package/dist/index-BzXh7poJ.d.ts +524 -0
- package/dist/index.cjs +6912 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +756 -0
- package/dist/index.d.ts +756 -0
- package/dist/index.js +131 -0
- package/dist/index.js.map +1 -0
- package/dist/server.cjs +5644 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +217 -0
- package/dist/server.d.ts +217 -0
- package/dist/server.js +644 -0
- package/dist/server.js.map +1 -0
- package/dist/utils-CBAkjQh3.d.cts +108 -0
- package/dist/utils-xT9-km0r.d.ts +108 -0
- package/package.json +101 -0
- package/src/browser.ts +13 -0
- package/src/client/resolveAddresses.ts +157 -0
- package/src/core/addressCollector.ts +153 -0
- package/src/core/addressResolver.ts +135 -0
- package/src/core/dataModel.ts +888 -0
- package/src/core/instance.ts +33 -0
- package/src/core/integrateDecoder.ts +325 -0
- package/src/data.ts +70 -0
- package/src/decoder/GENERATOR_PROPOSAL.md +182 -0
- package/src/decoder/THREE_PHASE_EXAMPLE.md +108 -0
- package/src/decoder/aggregation.ts +218 -0
- package/src/decoder/browserCache.ts +237 -0
- package/src/decoder/cache/README.md +126 -0
- package/src/decoder/cache/index.ts +44 -0
- package/src/decoder/cache.ts +139 -0
- package/src/decoder/constants.ts +125 -0
- package/src/decoder/decodeTransaction.ts +292 -0
- package/src/decoder/errors.ts +95 -0
- package/src/decoder/events.ts +192 -0
- package/src/decoder/functionSignature.ts +344 -0
- package/src/decoder/getDataFromExternalSources.ts +248 -0
- package/src/decoder/graphqlWS.ts +22 -0
- package/src/decoder/interfaces.ts +185 -0
- package/src/decoder/keyValue.ts +5 -0
- package/src/decoder/kvCache.ts +241 -0
- package/src/decoder/lruCache.ts +184 -0
- package/src/decoder/lsp7Mint.test.ts +179 -0
- package/src/decoder/lsp7TransferBatch.test.ts +105 -0
- package/src/decoder/plugins/RegistryAbi.ts +562 -0
- package/src/decoder/plugins/enhanceBurntPix.ts +132 -0
- package/src/decoder/plugins/enhanceGraffiti.ts +70 -0
- package/src/decoder/plugins/enhanceLSP0ERC725Account.ts +179 -0
- package/src/decoder/plugins/enhanceLSP26FollowerSystem.ts +88 -0
- package/src/decoder/plugins/enhanceLSP6KeyManager.ts +231 -0
- package/src/decoder/plugins/enhanceLSP7DigitalAsset.ts +165 -0
- package/src/decoder/plugins/enhanceLSP8IdentifiableDigitalAsset.ts +170 -0
- package/src/decoder/plugins/enhanceLSP9Vault.ts +57 -0
- package/src/decoder/plugins/enhanceRetrieveAbi.ts +85 -0
- package/src/decoder/plugins/enhanceSetData.ts +135 -0
- package/src/decoder/plugins/index.ts +99 -0
- package/src/decoder/plugins/schemaDefault.ts +318 -0
- package/src/decoder/plugins/standardPlugin.ts +202 -0
- package/src/decoder/registry.ts +322 -0
- package/src/decoder/singleGQL.ts +293 -0
- package/src/decoder/transaction.ts +198 -0
- package/src/decoder/types.ts +465 -0
- package/src/decoder/utils.ts +212 -0
- package/src/example/usage.ts +172 -0
- package/src/index.ts +174 -0
- package/src/server/addressResolver.ts +68 -0
- package/src/server/caches.ts +209 -0
- package/src/server/decodeTransactionSync.ts +156 -0
- package/src/server/decodeTransactionsBatch.ts +207 -0
- package/src/server/finishDecoding.ts +116 -0
- package/src/server/index.ts +81 -0
- package/src/server/lsp23Resolver.test.ts +46 -0
- package/src/server/lsp23Resolver.ts +419 -0
- package/src/server/types.ts +168 -0
- package/src/server.ts +22 -0
- package/src/shared/addressResolver.ts +651 -0
- package/src/shared/cache.ts +144 -0
- package/src/shared/constants.ts +21 -0
- package/src/stubs/tty.ts +13 -0
- package/src/stubs/util.ts +42 -0
- package/src/types/index.ts +154 -0
- package/src/types/provider.ts +46 -0
- package/src/umd.ts +13 -0
- package/src/utils/debug.ts +49 -0
- package/src/utils/json-bigint.ts +47 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
export { A as TransactionAddressResolver, T as TransactionDecoderResult, i as consumerModel, l as createAggregationKey, j as createGlobalInstance, a as decodeTransaction, k as decodeTransactionAsync, m as defaultPlugins, n as defaultSchemaPlugins, p as getArgByName, q as needsEnhancement, o as standardPlugin, s as standardSchemaPlugin } from './utils-CBAkjQh3.cjs';
|
|
2
|
+
import * as viem from 'viem';
|
|
3
|
+
import { Chain, Hex, Address } from 'viem';
|
|
4
|
+
import * as _preact_signals_core from '@preact/signals-core';
|
|
5
|
+
import { c as DataKey, E as EnhancedInfo, I as IDataModel, h as DecoderOptions, b as DecoderResult, T as TransactionState, n as DecoderPlugin, p as ResultAggregate, m as Aggregation, S as SchemaPlugin, e as Info, d as AddressState } from './index-BzXh7poJ.cjs';
|
|
6
|
+
export { j as DecodeEventCallback, a as DecodeEventResult, i as EnhancerCallback, g as IDataModelConsumer, P as PluginOptions, q as ResultCreate, r as ResultError, s as ResultExecute, t as ResultExecuteBatch, u as ResultFollowProfile, v as ResultGrafitti, w as ResultRaw, o as ResultSetData, x as ResultSetDataBatch, y as ResultWrapper } from './index-BzXh7poJ.cjs';
|
|
7
|
+
import '@erc725/erc725.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Address identity cache interface
|
|
11
|
+
* Can be implemented with different backends (LRU, Redis, etc.)
|
|
12
|
+
*/
|
|
13
|
+
interface AddressIdentityCache {
|
|
14
|
+
/**
|
|
15
|
+
* Get cached address data
|
|
16
|
+
*/
|
|
17
|
+
get(key: DataKey): EnhancedInfo | undefined | Promise<EnhancedInfo | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* Set address data in cache
|
|
20
|
+
*/
|
|
21
|
+
set(key: DataKey, value: EnhancedInfo): void | Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Check if address is in cache
|
|
24
|
+
*/
|
|
25
|
+
has(key: DataKey): boolean | Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Get multiple addresses at once
|
|
28
|
+
*/
|
|
29
|
+
getMany?(keys: readonly DataKey[]): Map<DataKey, EnhancedInfo> | Promise<Map<DataKey, EnhancedInfo>>;
|
|
30
|
+
/**
|
|
31
|
+
* Set multiple addresses at once
|
|
32
|
+
*/
|
|
33
|
+
setMany?(entries: Array<[DataKey, EnhancedInfo]>): void | Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Clear all cached data
|
|
36
|
+
*/
|
|
37
|
+
clear?(): void | Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Helper to convert DataKey to cache key string
|
|
41
|
+
*/
|
|
42
|
+
declare function getDataKeyCacheKey(key: DataKey): string;
|
|
43
|
+
/**
|
|
44
|
+
* Convert a DataKey to the standardized string format
|
|
45
|
+
* @param dataKey - A hex string (address or address:tokenId)
|
|
46
|
+
* @returns The same string
|
|
47
|
+
*/
|
|
48
|
+
declare function dataKeyToString(dataKey: DataKey): string;
|
|
49
|
+
/**
|
|
50
|
+
* Parse a string to a DataKey
|
|
51
|
+
* @param str - String in format "address" or "address:tokenId"
|
|
52
|
+
* @returns DataKey as a hex string
|
|
53
|
+
*/
|
|
54
|
+
declare function parseDataKey(str: string): DataKey;
|
|
55
|
+
/**
|
|
56
|
+
* Create a simple in-memory address cache
|
|
57
|
+
*/
|
|
58
|
+
declare function createMemoryAddressIdentityCache(ttlMs?: number): AddressIdentityCache;
|
|
59
|
+
|
|
60
|
+
interface ResolveAddressesOptions {
|
|
61
|
+
/**
|
|
62
|
+
* API endpoint URL (defaults to '/api/resolveAddresses')
|
|
63
|
+
*/
|
|
64
|
+
endpoint?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Optional cache to check before making API call
|
|
67
|
+
*/
|
|
68
|
+
cache?: AddressIdentityCache;
|
|
69
|
+
/**
|
|
70
|
+
* Maximum number of addresses per batch (defaults to 100)
|
|
71
|
+
*/
|
|
72
|
+
batchSize?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Request timeout in milliseconds (defaults to 10000)
|
|
75
|
+
*/
|
|
76
|
+
timeout?: number;
|
|
77
|
+
}
|
|
78
|
+
interface ResolveAddressesResponse {
|
|
79
|
+
success: boolean;
|
|
80
|
+
addresses?: Record<string, EnhancedInfo>;
|
|
81
|
+
cached?: number;
|
|
82
|
+
fetched?: number;
|
|
83
|
+
total?: number;
|
|
84
|
+
error?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Resolve addresses using the API endpoint
|
|
88
|
+
* This allows clients to populate the server cache and get resolved addresses
|
|
89
|
+
*/
|
|
90
|
+
declare function resolveAddresses(addresses: DataKey[], chain: Chain, options?: ResolveAddressesOptions): Promise<Map<DataKey, EnhancedInfo>>;
|
|
91
|
+
/**
|
|
92
|
+
* Create a cache-through address resolver that uses the API
|
|
93
|
+
* This can be used as a drop-in replacement for fetchMultipleAddresses
|
|
94
|
+
*/
|
|
95
|
+
declare function createApiAddressResolver(chain: Chain, options?: ResolveAddressesOptions): (addresses: DataKey[]) => Promise<Map<DataKey, EnhancedInfo>>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Collect all DataKeys from a data structure
|
|
99
|
+
* This is a simplified version that just returns the keys
|
|
100
|
+
* @param data - The data to analyze
|
|
101
|
+
* @param skipGqlTypes - Whether to skip GraphQL type fields
|
|
102
|
+
* @param existingKeys - Optional existing keys to merge with
|
|
103
|
+
*/
|
|
104
|
+
declare function collectDataKeys(data: unknown, skipGqlTypes?: boolean, existingKeys?: DataKey[]): DataKey[];
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Configuration for address resolver
|
|
108
|
+
*/
|
|
109
|
+
interface AddressResolverConfig {
|
|
110
|
+
dataModel: IDataModel;
|
|
111
|
+
graphqlEndpoint: string;
|
|
112
|
+
chain: Chain;
|
|
113
|
+
batchSize?: number;
|
|
114
|
+
batchDelay?: number;
|
|
115
|
+
cache?: AddressIdentityCache;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Resolve addresses using GraphQL
|
|
119
|
+
* Replaces the old patchValue mechanism
|
|
120
|
+
*/
|
|
121
|
+
declare class AddressResolver {
|
|
122
|
+
private dataModel;
|
|
123
|
+
private graphqlEndpoint;
|
|
124
|
+
private batchSize;
|
|
125
|
+
private batchDelay;
|
|
126
|
+
private pendingAddresses;
|
|
127
|
+
private batchTimer?;
|
|
128
|
+
private cache?;
|
|
129
|
+
constructor(config: AddressResolverConfig);
|
|
130
|
+
/**
|
|
131
|
+
* Start watching for missing addresses
|
|
132
|
+
*/
|
|
133
|
+
startWatching(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Queue addresses for batch resolution
|
|
136
|
+
*/
|
|
137
|
+
queueAddresses(addresses: DataKey[]): void;
|
|
138
|
+
/**
|
|
139
|
+
* Process a batch of addresses
|
|
140
|
+
*/
|
|
141
|
+
private processBatch;
|
|
142
|
+
/**
|
|
143
|
+
* Stop watching for addresses
|
|
144
|
+
*/
|
|
145
|
+
stopWatching(): void;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Configuration for decoder integration
|
|
150
|
+
*/
|
|
151
|
+
interface DecoderIntegrationConfig {
|
|
152
|
+
dataModel: IDataModel;
|
|
153
|
+
decoderOptions?: Partial<DecoderOptions>;
|
|
154
|
+
addressCache?: AddressCache;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* External cache interface for address data
|
|
158
|
+
*/
|
|
159
|
+
interface AddressCache {
|
|
160
|
+
get(key: DataKey): Promise<EnhancedInfo | undefined>;
|
|
161
|
+
set(key: DataKey, value: EnhancedInfo): Promise<void>;
|
|
162
|
+
has(key: DataKey): Promise<boolean>;
|
|
163
|
+
delete(key: DataKey): Promise<void>;
|
|
164
|
+
clear(): Promise<void>;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Integrate the decoder with the data model
|
|
168
|
+
* Handles progressive transaction enhancement and address population
|
|
169
|
+
*/
|
|
170
|
+
declare class DecoderIntegration {
|
|
171
|
+
private dataModel;
|
|
172
|
+
private decoderOptions;
|
|
173
|
+
private addressCache?;
|
|
174
|
+
constructor(config: DecoderIntegrationConfig);
|
|
175
|
+
/**
|
|
176
|
+
* Add and decode a transaction
|
|
177
|
+
* @param transaction - Raw transaction data
|
|
178
|
+
* @returns Transaction signal that updates as decoding progresses
|
|
179
|
+
*/
|
|
180
|
+
addAndDecodeTransaction(transaction: DecoderResult): Promise<_preact_signals_core.Signal<TransactionState>>;
|
|
181
|
+
/**
|
|
182
|
+
* Add and decode multiple transactions
|
|
183
|
+
* @param transactions - Array of raw transactions
|
|
184
|
+
* @returns Array of transaction signals
|
|
185
|
+
*/
|
|
186
|
+
addAndDecodeTransactions(transactions: DecoderResult[]): Promise<_preact_signals_core.Signal<TransactionState>[]>;
|
|
187
|
+
/**
|
|
188
|
+
* Extract and register addresses from decoded transaction data
|
|
189
|
+
*/
|
|
190
|
+
private updateAddressesFromDecoded;
|
|
191
|
+
/**
|
|
192
|
+
* Flatten nested batch transactions
|
|
193
|
+
* If a batch contains another batch as a child, flatten all sub-transactions into the parent's children
|
|
194
|
+
*
|
|
195
|
+
* Structure:
|
|
196
|
+
* - Wrappers: The "invisible" execute functions (execute, executeRelayCall, etc.) that wrap the actual transaction
|
|
197
|
+
* - Children: The actual transactions being executed
|
|
198
|
+
*
|
|
199
|
+
* Result:
|
|
200
|
+
* - Single transaction: { resultType: 'execute', wrappers: [...] }
|
|
201
|
+
* - Batch transaction: { resultType: 'executeBatch', children: [flat list], wrappers: [...] }
|
|
202
|
+
*
|
|
203
|
+
* This ensures only ONE level of batch with all transactions flattened
|
|
204
|
+
*/
|
|
205
|
+
private flattenBatchTransactions;
|
|
206
|
+
/**
|
|
207
|
+
* Load missing address data
|
|
208
|
+
* This would be called by an external service that fetches address data
|
|
209
|
+
*/
|
|
210
|
+
loadAddressData(addressData: EnhancedInfo[]): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Get addresses that need to be fetched
|
|
213
|
+
*/
|
|
214
|
+
getMissingAddresses(): DataKey[];
|
|
215
|
+
/**
|
|
216
|
+
* Get addresses currently being loaded
|
|
217
|
+
*/
|
|
218
|
+
getLoadingAddresses(): DataKey[];
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Create a simple in-memory address cache
|
|
222
|
+
*/
|
|
223
|
+
declare function createMemoryAddressCache(): AddressCache;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Helper function to create a typed aggregation configuration
|
|
227
|
+
* @param config The aggregation configuration
|
|
228
|
+
* @returns A frozen aggregation object
|
|
229
|
+
*/
|
|
230
|
+
declare function standardAggregation<T>(config: {
|
|
231
|
+
key: string;
|
|
232
|
+
map: (tx: DecoderResult) => T | undefined;
|
|
233
|
+
reduce: (state: T | undefined, mapped: T) => T;
|
|
234
|
+
finalize: (state: T) => Omit<ResultAggregate, 'resultType'>;
|
|
235
|
+
}): Aggregation<T>;
|
|
236
|
+
/**
|
|
237
|
+
* Aggregation engine for processing transactions with map/reduce pattern
|
|
238
|
+
*/
|
|
239
|
+
interface AggregationState<T = unknown> {
|
|
240
|
+
data: T;
|
|
241
|
+
lastTransaction: DecoderResult;
|
|
242
|
+
}
|
|
243
|
+
declare class PluginAggregationEngine {
|
|
244
|
+
private plugins;
|
|
245
|
+
private states;
|
|
246
|
+
/**
|
|
247
|
+
* Register a plugin with aggregations
|
|
248
|
+
*/
|
|
249
|
+
registerPlugin(plugin: DecoderPlugin): void;
|
|
250
|
+
/**
|
|
251
|
+
* Process a transaction through relevant aggregations
|
|
252
|
+
*/
|
|
253
|
+
processTransaction(tx: DecoderResult): void;
|
|
254
|
+
/**
|
|
255
|
+
* Process a batch of transactions
|
|
256
|
+
*/
|
|
257
|
+
processBatch(txs: DecoderResult[]): void;
|
|
258
|
+
/**
|
|
259
|
+
* Get finalized result for a specific plugin and aggregation key
|
|
260
|
+
*/
|
|
261
|
+
getResult(pluginName: string, key: string): DecoderResult | undefined;
|
|
262
|
+
/**
|
|
263
|
+
* Get all aggregation results
|
|
264
|
+
*/
|
|
265
|
+
getAllResults(): Array<{
|
|
266
|
+
plugin: string;
|
|
267
|
+
key: string;
|
|
268
|
+
result: DecoderResult;
|
|
269
|
+
}>;
|
|
270
|
+
/**
|
|
271
|
+
* Clear all aggregation states
|
|
272
|
+
*/
|
|
273
|
+
clear(): void;
|
|
274
|
+
/**
|
|
275
|
+
* Clear states for a specific plugin
|
|
276
|
+
*/
|
|
277
|
+
clearPlugin(pluginName: string): void;
|
|
278
|
+
/**
|
|
279
|
+
* Get current state (for persistence)
|
|
280
|
+
*/
|
|
281
|
+
getStates(): Map<string, Map<string, AggregationState>>;
|
|
282
|
+
/**
|
|
283
|
+
* Restore states (from persistence)
|
|
284
|
+
*/
|
|
285
|
+
restoreStates(states: Map<string, Map<string, AggregationState>>): void;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Plugin metadata for registry
|
|
290
|
+
*/
|
|
291
|
+
interface PluginMetadata {
|
|
292
|
+
name: string;
|
|
293
|
+
plugin: DecoderPlugin;
|
|
294
|
+
priority?: number;
|
|
295
|
+
required?: boolean;
|
|
296
|
+
description?: string;
|
|
297
|
+
version?: string;
|
|
298
|
+
usesAsync?: boolean;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Schema plugin metadata
|
|
302
|
+
*/
|
|
303
|
+
interface SchemaPluginMetadata {
|
|
304
|
+
name: string;
|
|
305
|
+
plugin: SchemaPlugin;
|
|
306
|
+
priority?: number;
|
|
307
|
+
required?: boolean;
|
|
308
|
+
description?: string;
|
|
309
|
+
version?: string;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Global plugin registry for auto-registration
|
|
313
|
+
*/
|
|
314
|
+
declare class PluginRegistry {
|
|
315
|
+
private plugins;
|
|
316
|
+
private schemaPlugins;
|
|
317
|
+
/**
|
|
318
|
+
* Register a decoder plugin
|
|
319
|
+
* @param name - Unique plugin name
|
|
320
|
+
* @param plugin - Plugin instance
|
|
321
|
+
* @param options - Registration options
|
|
322
|
+
*/
|
|
323
|
+
register(name: string, plugin: DecoderPlugin, options?: {
|
|
324
|
+
priority?: number;
|
|
325
|
+
required?: boolean;
|
|
326
|
+
override?: boolean;
|
|
327
|
+
description?: string;
|
|
328
|
+
version?: string;
|
|
329
|
+
usesAsync?: boolean;
|
|
330
|
+
}): void;
|
|
331
|
+
/**
|
|
332
|
+
* Register a schema plugin
|
|
333
|
+
* @param name - Unique plugin name
|
|
334
|
+
* @param plugin - Schema plugin instance
|
|
335
|
+
* @param options - Registration options
|
|
336
|
+
*/
|
|
337
|
+
registerSchema(name: string, plugin: SchemaPlugin, options?: {
|
|
338
|
+
priority?: number;
|
|
339
|
+
required?: boolean;
|
|
340
|
+
override?: boolean;
|
|
341
|
+
description?: string;
|
|
342
|
+
version?: string;
|
|
343
|
+
}): void;
|
|
344
|
+
/**
|
|
345
|
+
* Unregister a plugin
|
|
346
|
+
*/
|
|
347
|
+
unregister(name: string): boolean;
|
|
348
|
+
/**
|
|
349
|
+
* Get all registered decoder plugins (excluding overridden ones)
|
|
350
|
+
* @param options - Filter options
|
|
351
|
+
*/
|
|
352
|
+
getAll(options?: {
|
|
353
|
+
excludeNames?: string[];
|
|
354
|
+
syncOnly?: boolean;
|
|
355
|
+
}): Promise<DecoderPlugin[]>;
|
|
356
|
+
/**
|
|
357
|
+
* Get all schema plugins (excluding overridden ones)
|
|
358
|
+
* @param excludeNames - Plugin names to exclude
|
|
359
|
+
*/
|
|
360
|
+
getAllSchema(excludeNames?: string[]): SchemaPlugin[];
|
|
361
|
+
/**
|
|
362
|
+
* Get a specific plugin by name
|
|
363
|
+
*/
|
|
364
|
+
get(name: string): Promise<DecoderPlugin | undefined>;
|
|
365
|
+
/**
|
|
366
|
+
* Get plugin metadata
|
|
367
|
+
*/
|
|
368
|
+
getMetadata(name: string): PluginMetadata | undefined;
|
|
369
|
+
/**
|
|
370
|
+
* Get schema plugin metadata
|
|
371
|
+
*/
|
|
372
|
+
getSchemaMetadata(name: string): SchemaPluginMetadata | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* Check if a plugin is registered
|
|
375
|
+
*/
|
|
376
|
+
has(name: string): boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Clear all plugins
|
|
379
|
+
*/
|
|
380
|
+
clear(): void;
|
|
381
|
+
/**
|
|
382
|
+
* Get the number of registered plugins
|
|
383
|
+
*/
|
|
384
|
+
get size(): number;
|
|
385
|
+
/**
|
|
386
|
+
* List all registered plugins with metadata
|
|
387
|
+
*/
|
|
388
|
+
list(): {
|
|
389
|
+
plugins: PluginMetadata[];
|
|
390
|
+
schemaPlugins: SchemaPluginMetadata[];
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
declare const pluginRegistry: PluginRegistry;
|
|
394
|
+
declare function registerPlugin(name: string, plugin: DecoderPlugin, options?: {
|
|
395
|
+
priority?: number;
|
|
396
|
+
required?: boolean;
|
|
397
|
+
override?: boolean;
|
|
398
|
+
description?: string;
|
|
399
|
+
version?: string;
|
|
400
|
+
usesAsync?: boolean;
|
|
401
|
+
}): void;
|
|
402
|
+
declare function registerSchemaPlugin(name: string, plugin: SchemaPlugin, options?: {
|
|
403
|
+
priority?: number;
|
|
404
|
+
required?: boolean;
|
|
405
|
+
override?: boolean;
|
|
406
|
+
description?: string;
|
|
407
|
+
version?: string;
|
|
408
|
+
}): void;
|
|
409
|
+
declare function createNamedSchemaPlugin(name: string, plugin: (key: Hex, value: Hex) => Promise<Info | undefined>): SchemaPlugin;
|
|
410
|
+
declare function createNamedPlugin(name: string, plugin: Omit<DecoderPlugin, 'name'>): DecoderPlugin;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* LSP23 Factory address (same on all networks)
|
|
414
|
+
*/
|
|
415
|
+
declare const LSP23_FACTORY_ADDRESS: "0x2300000a84d25df63081feaa37ba6b62c4c89a30";
|
|
416
|
+
/**
|
|
417
|
+
* deployERC1167Proxies function selector
|
|
418
|
+
*/
|
|
419
|
+
declare const DEPLOY_ERC1167_PROXIES_SELECTOR: "0x6a66a753";
|
|
420
|
+
/**
|
|
421
|
+
* LSP23 deployment data structure
|
|
422
|
+
*/
|
|
423
|
+
interface LSP23DeploymentData {
|
|
424
|
+
profileAddress: Address;
|
|
425
|
+
urdAddress: Address;
|
|
426
|
+
deployerAddress: Address;
|
|
427
|
+
salt: string;
|
|
428
|
+
primaryImplementation: Address;
|
|
429
|
+
secondaryImplementation: Address;
|
|
430
|
+
postDeploymentModule: Address;
|
|
431
|
+
initializationCalldata: string;
|
|
432
|
+
deploymentCalldata: string;
|
|
433
|
+
transactionHash: string;
|
|
434
|
+
blockNumber: bigint;
|
|
435
|
+
blockTimestamp: number;
|
|
436
|
+
chainId: number;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Contract deployment tuple structures
|
|
440
|
+
* Primary: (bytes32 salt, uint256 fundingAmount, address implementationContract, bytes initializeCalldata)
|
|
441
|
+
* Secondary: (uint256 fundingAmount, address implementationContract, bytes addInitializeCalldata, bool addConstructor, bytes constructorParams)
|
|
442
|
+
*/
|
|
443
|
+
/**
|
|
444
|
+
* Decode deployERC1167Proxies calldata
|
|
445
|
+
*
|
|
446
|
+
* Function signature:
|
|
447
|
+
* deployERC1167Proxies(
|
|
448
|
+
* (bytes32 salt, uint256 fundingAmount, address implementationContract, bytes initializeCalldata) primaryContractDeployment,
|
|
449
|
+
* (uint256 fundingAmount, address implementationContract, bytes addInitializeCalldata, bool addConstructor, bytes constructorParams) secondaryContractDeployment,
|
|
450
|
+
* address postDeploymentModule,
|
|
451
|
+
* bytes postDeploymentModuleCalldata
|
|
452
|
+
* )
|
|
453
|
+
*/
|
|
454
|
+
declare function decodeDeploymentCalldata(input: string): {
|
|
455
|
+
salt: string;
|
|
456
|
+
primaryImplementation: Address;
|
|
457
|
+
secondaryImplementation: Address;
|
|
458
|
+
postDeploymentModule: Address;
|
|
459
|
+
initializationCalldata: string;
|
|
460
|
+
} | null;
|
|
461
|
+
/**
|
|
462
|
+
* Decode deployERC1167Proxies output to get deployed addresses
|
|
463
|
+
*
|
|
464
|
+
* Returns: (address primaryContractAddress, address secondaryContractAddress)
|
|
465
|
+
*/
|
|
466
|
+
declare function decodeDeploymentOutput(output: string): {
|
|
467
|
+
profileAddress: Address;
|
|
468
|
+
urdAddress: Address;
|
|
469
|
+
} | null;
|
|
470
|
+
/**
|
|
471
|
+
* Extract controller addresses from initialization calldata
|
|
472
|
+
*
|
|
473
|
+
* The initializationCalldata contains a setDataBatch call that sets up controller permissions.
|
|
474
|
+
* Function: setDataBatch(bytes32[] dataKeys, bytes[] dataValues)
|
|
475
|
+
*
|
|
476
|
+
* The dataKeys contain entries like:
|
|
477
|
+
* - AddressPermissions:Permissions:<controller-address>
|
|
478
|
+
*
|
|
479
|
+
* We extract controller addresses from these keys.
|
|
480
|
+
*/
|
|
481
|
+
declare function extractControllersFromInitCalldata(initializationCalldata: string): Address[];
|
|
482
|
+
/**
|
|
483
|
+
* Hypersync query configuration for LSP23 deployments
|
|
484
|
+
*/
|
|
485
|
+
interface HypersyncQueryConfig {
|
|
486
|
+
/**
|
|
487
|
+
* Controller addresses (derived keys) that deployed profiles
|
|
488
|
+
* We only want LSP23 data for profiles WE created, not imported
|
|
489
|
+
*/
|
|
490
|
+
controllerAddresses?: Address[];
|
|
491
|
+
/**
|
|
492
|
+
* Profile addresses to query deployment data for
|
|
493
|
+
* More efficient than querying by controllers when we already know the profiles
|
|
494
|
+
*/
|
|
495
|
+
profileAddresses?: Address[];
|
|
496
|
+
/**
|
|
497
|
+
* Starting block (0 for genesis)
|
|
498
|
+
*/
|
|
499
|
+
fromBlock?: number;
|
|
500
|
+
/**
|
|
501
|
+
* Ending block (undefined for latest)
|
|
502
|
+
*/
|
|
503
|
+
toBlock?: number;
|
|
504
|
+
/**
|
|
505
|
+
* Chain ID to query
|
|
506
|
+
*/
|
|
507
|
+
chainId: number;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Build Hypersync query to find LSP23 deployments
|
|
511
|
+
*
|
|
512
|
+
* Strategy 1 (by profileAddresses - RECOMMENDED):
|
|
513
|
+
* Query CREATE2 traces where the created address matches our profile addresses.
|
|
514
|
+
* Then filter transactions to LSP23 factory and verify deployer is one of our controllers.
|
|
515
|
+
* This is more efficient when we already know the profile addresses from GraphQL.
|
|
516
|
+
*
|
|
517
|
+
* Strategy 2 (by controllerAddresses - LEGACY):
|
|
518
|
+
* Query transactions TO the LSP23 factory FROM our controller addresses.
|
|
519
|
+
* This scans the entire chain history for all deployments by our controllers.
|
|
520
|
+
*/
|
|
521
|
+
declare function buildLSP23DeploymentQuery(config: HypersyncQueryConfig): {
|
|
522
|
+
from_block: number;
|
|
523
|
+
to_block: number | undefined;
|
|
524
|
+
traces: {
|
|
525
|
+
type: string[];
|
|
526
|
+
to: string[];
|
|
527
|
+
}[];
|
|
528
|
+
transactions: {
|
|
529
|
+
to: string[];
|
|
530
|
+
}[];
|
|
531
|
+
field_selection: {
|
|
532
|
+
transaction: string[];
|
|
533
|
+
trace: string[];
|
|
534
|
+
block: string[];
|
|
535
|
+
};
|
|
536
|
+
include_all_blocks: boolean;
|
|
537
|
+
} | {
|
|
538
|
+
from_block: number;
|
|
539
|
+
to_block: number | undefined;
|
|
540
|
+
transactions: {
|
|
541
|
+
from: string[];
|
|
542
|
+
to: string[];
|
|
543
|
+
}[];
|
|
544
|
+
traces: {
|
|
545
|
+
type: string[];
|
|
546
|
+
}[];
|
|
547
|
+
field_selection: {
|
|
548
|
+
transaction: string[];
|
|
549
|
+
trace: string[];
|
|
550
|
+
block: string[];
|
|
551
|
+
};
|
|
552
|
+
include_all_blocks: boolean;
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Parse Hypersync response to extract LSP23 deployment data
|
|
556
|
+
* @param response - Hypersync API response
|
|
557
|
+
* @param chainId - Chain ID
|
|
558
|
+
* @param controllerAddresses - Optional list of controller addresses to filter by (only return deployments from these deployers)
|
|
559
|
+
*/
|
|
560
|
+
declare function parseLSP23DeploymentsFromHypersync(response: any, chainId: number, controllerAddresses?: Address[]): LSP23DeploymentData[];
|
|
561
|
+
|
|
562
|
+
interface ImageData {
|
|
563
|
+
width?: number;
|
|
564
|
+
height?: number;
|
|
565
|
+
url?: string;
|
|
566
|
+
src?: string;
|
|
567
|
+
verified?: boolean;
|
|
568
|
+
}
|
|
569
|
+
interface LinkData {
|
|
570
|
+
url: string;
|
|
571
|
+
title?: string;
|
|
572
|
+
}
|
|
573
|
+
interface ProfileData {
|
|
574
|
+
id: Hex;
|
|
575
|
+
name?: string;
|
|
576
|
+
fullName?: string;
|
|
577
|
+
tags?: string[];
|
|
578
|
+
description?: string;
|
|
579
|
+
links?: LinkData[];
|
|
580
|
+
standard?: string;
|
|
581
|
+
controllers?: Array<{
|
|
582
|
+
address: string;
|
|
583
|
+
tags?: string[];
|
|
584
|
+
permissions?: Hex;
|
|
585
|
+
}>;
|
|
586
|
+
owner?: {
|
|
587
|
+
id: string;
|
|
588
|
+
};
|
|
589
|
+
profileImages?: ImageData[];
|
|
590
|
+
backgroundImages?: ImageData[];
|
|
591
|
+
avatars?: ImageData[];
|
|
592
|
+
}
|
|
593
|
+
interface AssetData {
|
|
594
|
+
id: Hex;
|
|
595
|
+
name?: string;
|
|
596
|
+
standard?: string;
|
|
597
|
+
lsp4TokenName?: string;
|
|
598
|
+
lsp4TokenSymbol?: string;
|
|
599
|
+
lsp4TokenType?: string;
|
|
600
|
+
method?: string;
|
|
601
|
+
description?: string;
|
|
602
|
+
links?: LinkData[];
|
|
603
|
+
decimals?: number;
|
|
604
|
+
interfaces?: string[];
|
|
605
|
+
isCollection?: boolean;
|
|
606
|
+
isLSP7?: boolean;
|
|
607
|
+
isUnknown?: boolean;
|
|
608
|
+
icons?: ImageData[];
|
|
609
|
+
images?: ImageData[];
|
|
610
|
+
}
|
|
611
|
+
interface TokenData {
|
|
612
|
+
id: Hex;
|
|
613
|
+
tokenId?: Hex;
|
|
614
|
+
name?: string;
|
|
615
|
+
description?: string;
|
|
616
|
+
links?: LinkData[];
|
|
617
|
+
lsp4TokenName?: string;
|
|
618
|
+
lsp4TokenSymbol?: string;
|
|
619
|
+
lsp4TokenType?: string;
|
|
620
|
+
lsp8TokenIdFormat?: string;
|
|
621
|
+
formattedTokenId?: string;
|
|
622
|
+
baseAsset?: {
|
|
623
|
+
id: Hex;
|
|
624
|
+
description?: string;
|
|
625
|
+
icons?: ImageData[];
|
|
626
|
+
isCollection?: boolean;
|
|
627
|
+
isLSP7?: boolean;
|
|
628
|
+
isUnknown?: boolean;
|
|
629
|
+
name?: string;
|
|
630
|
+
standard?: string;
|
|
631
|
+
interfaces?: string[];
|
|
632
|
+
decimals?: number;
|
|
633
|
+
};
|
|
634
|
+
icons?: ImageData[];
|
|
635
|
+
images?: ImageData[];
|
|
636
|
+
}
|
|
637
|
+
type TFetchAddressData = {
|
|
638
|
+
Profile?: ProfileData[];
|
|
639
|
+
Asset?: AssetData[];
|
|
640
|
+
Token?: TokenData[];
|
|
641
|
+
};
|
|
642
|
+
/**
|
|
643
|
+
* Fetch multiple addresses from GraphQL and return them as a Map
|
|
644
|
+
* This is the shared implementation that both server and core can use
|
|
645
|
+
*/
|
|
646
|
+
declare function fetchMultipleAddresses(addresses: readonly DataKey[], graphqlEndpoint: string, cache?: AddressIdentityCache): Promise<Map<DataKey, EnhancedInfo>>;
|
|
647
|
+
/**
|
|
648
|
+
* Get GraphQL endpoint for a given chain
|
|
649
|
+
*/
|
|
650
|
+
declare function getGraphQLEndpoint(chain: Chain): string;
|
|
651
|
+
/**
|
|
652
|
+
* Find profiles controlled by specific controller addresses
|
|
653
|
+
* @param controllerAddresses - Array of controller addresses to search for
|
|
654
|
+
* @param chain - Which chain to query
|
|
655
|
+
* @returns Array of profile data
|
|
656
|
+
*/
|
|
657
|
+
declare function fetchProfilesByControllers(controllerAddresses: readonly Address[], chain: Chain): Promise<ProfileData[]>;
|
|
658
|
+
type ImageURL = {
|
|
659
|
+
url?: string;
|
|
660
|
+
data?: string;
|
|
661
|
+
src?: string;
|
|
662
|
+
width: number;
|
|
663
|
+
height: number;
|
|
664
|
+
index?: number;
|
|
665
|
+
verified?: string;
|
|
666
|
+
};
|
|
667
|
+
/**
|
|
668
|
+
* Assuming the images are sorted ascending by width and/or height pick the first
|
|
669
|
+
* image that's larger than the requested size * dpr and process that one.
|
|
670
|
+
* By default this will assume the data came from the indexer and therefore
|
|
671
|
+
* we do not need to verify the existence of all the images (i.e. HEAD requests for
|
|
672
|
+
* each image) Setting ignoreHead to false is important during RPC mode so that
|
|
673
|
+
* we can skip images that are not really available.
|
|
674
|
+
*
|
|
675
|
+
* @param images - array of images
|
|
676
|
+
* @param options - specify arguments for search/processing
|
|
677
|
+
* @returns { width, height, src } - the image that fits the criteria
|
|
678
|
+
*/
|
|
679
|
+
declare function getImage(images: ImageURL[], options: {
|
|
680
|
+
width: number;
|
|
681
|
+
height?: number;
|
|
682
|
+
index?: number;
|
|
683
|
+
ignoreVerification?: boolean;
|
|
684
|
+
forcePng?: boolean;
|
|
685
|
+
ignoreHead?: boolean;
|
|
686
|
+
fallback?: string;
|
|
687
|
+
dpr?: number;
|
|
688
|
+
}): Promise<{
|
|
689
|
+
width: number;
|
|
690
|
+
height: number;
|
|
691
|
+
src?: string;
|
|
692
|
+
} | undefined>;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Debug wrapper for edge/worker environments
|
|
696
|
+
* This avoids the tty dependency in the debug module
|
|
697
|
+
*/
|
|
698
|
+
declare function createDebug(namespace: string): (...args: any[]) => void;
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* JSON serializer/deserializer that preserves BigInt types
|
|
702
|
+
*
|
|
703
|
+
* This implementation uses an 'n' suffix to indicate BigInt values,
|
|
704
|
+
* ensuring that values that were originally BigInt remain BigInt,
|
|
705
|
+
* and values that were originally numbers remain numbers.
|
|
706
|
+
*
|
|
707
|
+
* Example:
|
|
708
|
+
* - BigInt(123) serializes to "123n"
|
|
709
|
+
* - Number(123) serializes to 123
|
|
710
|
+
*
|
|
711
|
+
* This is important for blockchain data where some values must be BigInt
|
|
712
|
+
* (e.g., gas, value, nonce) while others should remain as numbers
|
|
713
|
+
* (e.g., array indices, status codes).
|
|
714
|
+
*/
|
|
715
|
+
declare const JSONbigString: {
|
|
716
|
+
/**
|
|
717
|
+
* Stringify an object, converting BigInt values to strings with 'n' suffix
|
|
718
|
+
*/
|
|
719
|
+
stringify: (obj: any, replacer?: any, space?: string | number) => string;
|
|
720
|
+
/**
|
|
721
|
+
* Parse a JSON string, converting strings ending with 'n' back to BigInt
|
|
722
|
+
*/
|
|
723
|
+
parse: (text: string) => any;
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
declare const getTransaction: (jsonTransaction: unknown) => _preact_signals_core.Signal<TransactionState> | undefined;
|
|
727
|
+
declare const getTransactionByKey: (hash: viem.Hex, decoderIndex?: number) => _preact_signals_core.Signal<TransactionState> | undefined;
|
|
728
|
+
declare const getTransactionsByIndex: (index: number) => Map<number | null, _preact_signals_core.Signal<TransactionState>> | undefined;
|
|
729
|
+
declare const getTransactionHashByIndex: (index: number) => viem.Hex | undefined;
|
|
730
|
+
declare const getTransactionCount: () => number;
|
|
731
|
+
declare const getDecodedCount: (hash: viem.Hex) => number;
|
|
732
|
+
declare const getDecodedTransactions: (hash: viem.Hex) => Array<_preact_signals_core.Signal<TransactionState>>;
|
|
733
|
+
declare const getTransactionsInOrder: () => Array<{
|
|
734
|
+
hash: viem.Hex;
|
|
735
|
+
transactions: Array<_preact_signals_core.Signal<TransactionState>>;
|
|
736
|
+
}>;
|
|
737
|
+
declare const getAddress: (address: DataKey) => _preact_signals_core.Signal<AddressState>;
|
|
738
|
+
declare const getSignal: (key: DataKey) => _preact_signals_core.Signal<AddressState>;
|
|
739
|
+
declare const subscribe: (key: DataKey, callback: (state: AddressState) => void) => () => void;
|
|
740
|
+
declare const getState: (key: DataKey) => AddressState;
|
|
741
|
+
declare const hasData: (key: DataKey) => boolean;
|
|
742
|
+
declare const getData: (key: DataKey) => {
|
|
743
|
+
readonly [x: string]: unknown;
|
|
744
|
+
readonly address: `0x${string}`;
|
|
745
|
+
readonly standard?: string | undefined;
|
|
746
|
+
readonly tokenId?: `0x${string}` | undefined;
|
|
747
|
+
readonly name?: string | undefined;
|
|
748
|
+
readonly __gqltype?: "Profile" | "Asset" | "Token" | undefined;
|
|
749
|
+
} | undefined;
|
|
750
|
+
declare const isLoading: (key: DataKey) => boolean;
|
|
751
|
+
declare const getError: (key: DataKey) => string | undefined;
|
|
752
|
+
declare const getAllKeys: () => ReadonlyArray<DataKey>;
|
|
753
|
+
declare const getAllData: () => Readonly<Record<string, AddressState>>;
|
|
754
|
+
declare const getAllTransactions: () => Readonly<Record<string, TransactionState>>;
|
|
755
|
+
|
|
756
|
+
export { type AddressCache, type AddressIdentityCache, AddressResolver, type AddressResolverConfig, AddressState, Aggregation, type AggregationState, type AssetData, DEPLOY_ERC1167_PROXIES_SELECTOR, DataKey, DecoderIntegration, type DecoderIntegrationConfig, DecoderPlugin, DecoderResult, EnhancedInfo, type HypersyncQueryConfig, type ImageData, type ImageURL, JSONbigString, type LSP23DeploymentData, LSP23_FACTORY_ADDRESS, type LinkData, PluginAggregationEngine, type PluginMetadata, type ProfileData, type ResolveAddressesOptions, type ResolveAddressesResponse, ResultAggregate, SchemaPlugin, type SchemaPluginMetadata, type TFetchAddressData, type TokenData, TransactionState, buildLSP23DeploymentQuery, collectDataKeys, createApiAddressResolver, createDebug, createMemoryAddressCache, createMemoryAddressIdentityCache, createNamedPlugin, createNamedSchemaPlugin, dataKeyToString, decodeDeploymentCalldata, decodeDeploymentOutput, extractControllersFromInitCalldata, fetchMultipleAddresses, fetchProfilesByControllers, getAddress, getAllData, getAllKeys, getAllTransactions, getData, getDataKeyCacheKey, getDecodedCount, getDecodedTransactions, getError, getGraphQLEndpoint, getImage, getSignal, getState, getTransaction, getTransactionByKey, getTransactionCount, getTransactionHashByIndex, getTransactionsByIndex, getTransactionsInOrder, hasData, isLoading, parseDataKey, parseLSP23DeploymentsFromHypersync, pluginRegistry, registerPlugin, registerSchemaPlugin, resolveAddresses, standardAggregation, subscribe };
|