@lukso/transaction-decoder 1.3.2-dev.205b184 → 1.3.2-dev.d85bba3
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/dist/browser.cjs.map +1 -1
- package/dist/browser.js +1 -1
- package/dist/cdn/transaction-decoder.global.js.map +1 -1
- package/dist/{chunk-Z2373EJ6.js → chunk-2ZO6MJJX.js} +1 -1
- package/dist/{chunk-Z2373EJ6.js.map → chunk-2ZO6MJJX.js.map} +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shared/cache.ts","../src/client/resolveAddresses.ts","../src/core/addressResolver.ts","../src/core/integrateDecoder.ts","../src/server/lsp23Resolver.ts","../src/utils/json-bigint.ts","../src/index.ts"],"sourcesContent":["import type { DataKey, EnhancedInfo } from '../types'\n\n/**\n * Address identity cache interface\n * Can be implemented with different backends (LRU, Redis, etc.)\n */\nexport interface AddressIdentityCache {\n /**\n * Get cached address data\n */\n get(\n key: DataKey\n ): EnhancedInfo | undefined | Promise<EnhancedInfo | undefined>\n\n /**\n * Set address data in cache\n */\n set(key: DataKey, value: EnhancedInfo): void | Promise<void>\n\n /**\n * Check if address is in cache\n */\n has(key: DataKey): boolean | Promise<boolean>\n\n /**\n * Get multiple addresses at once\n */\n getMany?(\n keys: readonly DataKey[]\n ): Map<DataKey, EnhancedInfo> | Promise<Map<DataKey, EnhancedInfo>>\n\n /**\n * Set multiple addresses at once\n */\n setMany?(entries: Array<[DataKey, EnhancedInfo]>): void | Promise<void>\n\n /**\n * Clear all cached data\n */\n clear?(): void | Promise<void>\n}\n\n/**\n * Type guard to check if value is a promise\n */\nfunction isPromise<T>(value: T | Promise<T>): value is Promise<T> {\n return value instanceof Promise\n}\n\n/**\n * Helper to convert DataKey to cache key string\n */\nexport function getDataKeyCacheKey(key: DataKey): string {\n return key.toLowerCase()\n}\n\n/**\n * Convert a DataKey to the standardized string format\n * @param dataKey - A hex string (address or address:tokenId)\n * @returns The same string\n */\nexport function dataKeyToString(dataKey: DataKey): string {\n return dataKey\n}\n\n/**\n * Parse a string to a DataKey\n * @param str - String in format \"address\" or \"address:tokenId\"\n * @returns DataKey as a hex string\n */\nexport function parseDataKey(str: string): DataKey {\n // Just return the string as-is since DataKey is now always a string\n return str as DataKey\n}\n\n/**\n * Create a simple in-memory address cache\n */\nexport function createMemoryAddressIdentityCache(\n ttlMs: number = 1000 * 60 * 5 // 5 minutes default\n): AddressIdentityCache {\n const cache = new Map<string, { data: EnhancedInfo; expires: number }>()\n\n return {\n get(key: DataKey): EnhancedInfo | undefined {\n const cacheKey = getDataKeyCacheKey(key)\n const entry = cache.get(cacheKey)\n\n if (!entry) return undefined\n\n if (Date.now() > entry.expires) {\n cache.delete(cacheKey)\n return undefined\n }\n\n return entry.data\n },\n\n set(key: DataKey, value: EnhancedInfo): void {\n const cacheKey = getDataKeyCacheKey(key)\n cache.set(cacheKey, {\n data: value,\n expires: Date.now() + ttlMs,\n })\n },\n\n has(key: DataKey): boolean {\n const cacheKey = getDataKeyCacheKey(key)\n const entry = cache.get(cacheKey)\n\n if (!entry) return false\n\n if (Date.now() > entry.expires) {\n cache.delete(cacheKey)\n return false\n }\n\n return true\n },\n\n getMany(keys: DataKey[]): Map<DataKey, EnhancedInfo> {\n const results = new Map<DataKey, EnhancedInfo>()\n\n for (const key of keys) {\n const data = this.get(key)\n if (data && !isPromise(data)) {\n results.set(key, data)\n }\n }\n\n return results\n },\n\n setMany(entries: Array<[DataKey, EnhancedInfo]>): void {\n for (const [key, value] of entries) {\n this.set(key, value)\n }\n },\n\n clear(): void {\n cache.clear()\n },\n }\n}\n","import type { Chain } from 'viem'\nimport type { AddressIdentityCache } from '../shared/cache'\nimport { getDataKeyCacheKey } from '../shared/cache'\nimport type { DataKey, EnhancedInfo } from '../types'\n\nexport interface ResolveAddressesOptions {\n /**\n * API endpoint URL (defaults to '/api/resolveAddresses')\n */\n endpoint?: string\n\n /**\n * Optional cache to check before making API call\n */\n cache?: AddressIdentityCache\n\n /**\n * Maximum number of addresses per batch (defaults to 100)\n */\n batchSize?: number\n\n /**\n * Request timeout in milliseconds (defaults to 10000)\n */\n timeout?: number\n}\n\nexport interface ResolveAddressesResponse {\n success: boolean\n addresses?: Record<string, EnhancedInfo>\n cached?: number\n fetched?: number\n total?: number\n error?: string\n}\n\n/**\n * Resolve addresses using the API endpoint\n * This allows clients to populate the server cache and get resolved addresses\n */\nexport async function resolveAddresses(\n addresses: DataKey[],\n chain: Chain,\n options: ResolveAddressesOptions = {}\n): Promise<Map<DataKey, EnhancedInfo>> {\n const {\n endpoint = '/api/resolveAddresses',\n cache,\n batchSize = 100,\n timeout = 10000,\n } = options\n\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 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 if (uncachedAddresses.length === 0) {\n return results\n }\n } else {\n uncachedAddresses.push(...addresses)\n }\n\n // Process in batches\n const batches: DataKey[][] = []\n for (let i = 0; i < uncachedAddresses.length; i += batchSize) {\n batches.push(uncachedAddresses.slice(i, i + batchSize))\n }\n\n // Fetch all batches in parallel\n const batchPromises = batches.map(async (batch) => {\n try {\n // DataKey is now just Hex string, use batch directly\n const apiAddresses = batch\n\n // Make API request with timeout\n const controller = new AbortController()\n const timeoutId = setTimeout(() => controller.abort(), timeout)\n\n const response = await fetch(endpoint, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n chainId: chain.id,\n addresses: apiAddresses,\n }),\n signal: controller.signal,\n })\n\n clearTimeout(timeoutId)\n\n if (!response.ok) {\n console.error(\n `Address resolution failed: ${response.status} ${response.statusText}`\n )\n return\n }\n\n const data: ResolveAddressesResponse = await response.json()\n\n if (data.success && data.addresses) {\n // Convert response back to DataKey -> EnhancedInfo map\n for (const [cacheKey, enhancedInfo] of Object.entries(data.addresses)) {\n // Find the original DataKey that matches this cache key\n const matchingKey = batch.find(\n (key) => getDataKeyCacheKey(key) === cacheKey\n )\n\n if (matchingKey) {\n results.set(matchingKey, enhancedInfo)\n\n // Update cache if provided\n if (cache) {\n await cache.set(matchingKey, enhancedInfo)\n }\n }\n }\n }\n } catch (error) {\n console.error('Failed to resolve addresses batch:', error)\n }\n })\n\n await Promise.all(batchPromises)\n\n return results\n}\n\n/**\n * Create a cache-through address resolver that uses the API\n * This can be used as a drop-in replacement for fetchMultipleAddresses\n */\nexport function createApiAddressResolver(\n chain: Chain,\n options: ResolveAddressesOptions = {}\n) {\n return async (addresses: DataKey[]): Promise<Map<DataKey, EnhancedInfo>> => {\n return resolveAddresses(addresses, chain, options)\n }\n}\n","import type { Chain } from 'viem'\nimport { fetchMultipleAddresses } from '../shared/addressResolver'\nimport type { AddressIdentityCache } from '../shared/cache'\nimport type { DataKey, EnhancedInfo, IDataModel } from '../types'\n\n/**\n * Configuration for address resolver\n */\nexport interface AddressResolverConfig {\n dataModel: IDataModel\n graphqlEndpoint: string\n chain: Chain\n batchSize?: number\n batchDelay?: number\n cache?: AddressIdentityCache\n}\n\n/**\n * Resolve addresses using GraphQL\n * Replaces the old patchValue mechanism\n */\nexport class AddressResolver {\n private dataModel: IDataModel\n private graphqlEndpoint: string\n private batchSize: number\n private batchDelay: number\n private pendingAddresses = new Set<string>()\n private batchTimer?: NodeJS.Timeout\n private cache?: AddressIdentityCache\n\n constructor(config: AddressResolverConfig) {\n this.dataModel = config.dataModel\n this.graphqlEndpoint = config.graphqlEndpoint\n this.batchSize = config.batchSize || 50\n this.batchDelay = config.batchDelay || 100\n this.cache = config.cache\n }\n\n /**\n * Start watching for missing addresses\n */\n startWatching() {\n // Check for missing addresses periodically\n setInterval(() => {\n const missing = this.dataModel.getMissingKeys()\n if (missing.length > 0) {\n this.queueAddresses(missing)\n }\n }, 1000)\n }\n\n /**\n * Queue addresses for batch resolution\n */\n queueAddresses(addresses: DataKey[]) {\n // Add to pending set\n for (const addr of addresses) {\n this.pendingAddresses.add(addr)\n }\n\n // Clear existing timer\n if (this.batchTimer) {\n clearTimeout(this.batchTimer)\n }\n\n // Set new timer\n this.batchTimer = setTimeout(() => {\n this.processBatch()\n }, this.batchDelay)\n\n // Process immediately if batch is full\n if (this.pendingAddresses.size >= this.batchSize) {\n clearTimeout(this.batchTimer)\n this.processBatch()\n }\n }\n\n /**\n * Process a batch of addresses\n */\n private async processBatch() {\n const batch = Array.from(this.pendingAddresses).slice(0, this.batchSize)\n if (batch.length === 0) return\n\n // Remove from pending\n for (const key of batch) {\n this.pendingAddresses.delete(key)\n }\n\n // Convert batch keys back to DataKey format\n const dataKeys: DataKey[] = batch.map((key) => {\n return key as DataKey\n })\n\n try {\n // Fetch data using shared implementation with cache\n const results = await fetchMultipleAddresses(\n dataKeys,\n this.graphqlEndpoint,\n this.cache\n )\n\n // Convert to array for injection\n const enhancedData: EnhancedInfo[] = Array.from(results.values())\n\n // Inject data into model\n if (enhancedData.length > 0) {\n this.dataModel.injectData(enhancedData)\n }\n } catch (error) {\n console.error('Failed to resolve addresses:', error)\n\n // Mark addresses as having errors\n for (const key of dataKeys) {\n this.dataModel.setError(key, 'Failed to fetch address data')\n }\n }\n\n // Continue processing if more pending\n if (this.pendingAddresses.size > 0) {\n this.batchTimer = setTimeout(() => {\n this.processBatch()\n }, this.batchDelay)\n }\n }\n\n /**\n * Stop watching for addresses\n */\n stopWatching() {\n if (this.batchTimer) {\n clearTimeout(this.batchTimer)\n }\n }\n}\n","import { effect } from '@preact/signals-core'\nimport { lukso } from 'viem/chains'\nimport { decodeTransaction } from '../decoder/decodeTransaction'\nimport { defaultPlugins, defaultSchemaPlugins } from '../decoder/plugins'\nimport type { DecoderOptions, DecoderResult } from '../decoder/types'\nimport type { DataKey, EnhancedInfo, IDataModel } from '../types'\nimport { collectDataKeys } from './addressCollector'\n\n/**\n * Configuration for decoder integration\n */\nexport interface DecoderIntegrationConfig {\n dataModel: IDataModel\n decoderOptions?: Partial<DecoderOptions>\n addressCache?: AddressCache\n}\n\n/**\n * External cache interface for address data\n */\nexport interface AddressCache {\n get(key: DataKey): Promise<EnhancedInfo | undefined>\n set(key: DataKey, value: EnhancedInfo): Promise<void>\n has(key: DataKey): Promise<boolean>\n delete(key: DataKey): Promise<void>\n clear(): Promise<void>\n}\n\n/**\n * Integrate the decoder with the data model\n * Handles progressive transaction enhancement and address population\n */\nexport class DecoderIntegration {\n private dataModel: IDataModel\n private decoderOptions: DecoderOptions\n private addressCache?: AddressCache\n\n constructor(config: DecoderIntegrationConfig) {\n this.dataModel = config.dataModel\n this.addressCache = config.addressCache\n\n // Set up default decoder options\n this.decoderOptions = {\n plugins: defaultPlugins,\n schemaPlugins: defaultSchemaPlugins,\n wrappers: [],\n chain: config.decoderOptions?.chain || lukso,\n ...config.decoderOptions,\n }\n }\n\n /**\n * Add and decode a transaction\n * @param transaction - Raw transaction data\n * @returns Transaction signal that updates as decoding progresses\n */\n async addAndDecodeTransaction(transaction: DecoderResult) {\n // Add transaction to data model\n const signal = this.dataModel.addTransactions(transaction)\n\n // Create fresh wrappers array for this transaction\n const transactionOptions: DecoderOptions = {\n ...this.decoderOptions,\n wrappers: [], // Fresh array for collecting wrappers in this decode hierarchy\n }\n\n // Start decoding process\n const { signal: decodingSignal } = await decodeTransaction(\n transaction,\n transactionOptions\n )\n\n // Update transaction data as decoding progresses\n effect(() => {\n const state = decodingSignal.value\n if (state.data) {\n const decodedResult = state.data as DecoderResult\n\n // Process any collected wrappers\n if (transactionOptions.wrappers.length > 0) {\n // Only certain result types support wrappers\n if (\n 'wrappers' in decodedResult &&\n typeof decodedResult === 'object'\n ) {\n ;(decodedResult as Record<string, unknown>).wrappers =\n transactionOptions.wrappers\n }\n\n // Extract addresses from wrappers\n for (const wrapper of transactionOptions.wrappers) {\n this.updateAddressesFromDecoded(wrapper as DecoderResult)\n }\n }\n\n // Flatten nested batch transactions if configured\n const processedResult = this.flattenBatchTransactions(decodedResult)\n\n if (transaction.hash) {\n this.dataModel.updateTransactionData(\n transaction.hash,\n processedResult,\n 0 // decoder index\n )\n }\n\n // Extract and update addresses from decoded data\n this.updateAddressesFromDecoded(processedResult)\n }\n })\n\n return signal\n }\n\n /**\n * Add and decode multiple transactions\n * @param transactions - Array of raw transactions\n * @returns Array of transaction signals\n */\n async addAndDecodeTransactions(transactions: DecoderResult[]) {\n // Add all transactions to data model\n const signals = this.dataModel.addTransactions(transactions)\n\n // Start decoding for each transaction\n const decodingPromises = transactions.map(async (tx, _index) => {\n // Create fresh wrappers array for each transaction\n const transactionOptions: DecoderOptions = {\n ...this.decoderOptions,\n wrappers: [], // Fresh array for collecting wrappers in this decode hierarchy\n }\n\n const { signal: decodingSignal } = await decodeTransaction(\n tx,\n transactionOptions\n )\n\n // Update transaction data as decoding progresses\n effect(() => {\n const state = decodingSignal.value\n if (state.data) {\n const decodedResult = state.data as DecoderResult\n\n // Process any collected wrappers\n if (transactionOptions.wrappers.length > 0) {\n // Only certain result types support wrappers\n if (\n 'wrappers' in decodedResult &&\n typeof decodedResult === 'object'\n ) {\n ;(decodedResult as Record<string, unknown>).wrappers =\n transactionOptions.wrappers\n }\n\n // Extract addresses from wrappers\n for (const wrapper of transactionOptions.wrappers) {\n this.updateAddressesFromDecoded(wrapper as DecoderResult)\n }\n }\n\n // Flatten nested batch transactions if configured\n const processedResult = this.flattenBatchTransactions(decodedResult)\n\n if (tx.hash) {\n this.dataModel.updateTransactionData(\n tx.hash,\n processedResult,\n 0 // decoder index\n )\n }\n\n // Extract and update addresses from decoded data\n this.updateAddressesFromDecoded(processedResult)\n }\n })\n\n return decodingSignal\n })\n\n await Promise.all(decodingPromises)\n return signals\n }\n\n /**\n * Extract and register addresses from decoded transaction data\n */\n private async updateAddressesFromDecoded(decodedData: DecoderResult) {\n const addresses = collectDataKeys(decodedData)\n\n // Check cache and inject into data model\n for (const address of addresses) {\n // Check cache first\n if (this.addressCache) {\n const cached = await this.addressCache.get(address)\n if (cached) {\n // Inject into data model\n this.dataModel.updateData(cached)\n }\n }\n\n // Ensure the address signal exists (creates empty signal if not)\n // This allows views to getAddress() without errors\n this.dataModel.getAddress(address)\n }\n }\n\n /**\n * Flatten nested batch transactions\n * If a batch contains another batch as a child, flatten all sub-transactions into the parent's children\n *\n * Structure:\n * - Wrappers: The \"invisible\" execute functions (execute, executeRelayCall, etc.) that wrap the actual transaction\n * - Children: The actual transactions being executed\n *\n * Result:\n * - Single transaction: { resultType: 'execute', wrappers: [...] }\n * - Batch transaction: { resultType: 'executeBatch', children: [flat list], wrappers: [...] }\n *\n * This ensures only ONE level of batch with all transactions flattened\n */\n private flattenBatchTransactions(result: DecoderResult): DecoderResult {\n // Only process batch result types\n if (\n result.resultType !== 'executeBatch' &&\n result.resultType !== 'setDataBatch'\n ) {\n return result\n }\n\n // Type guard to ensure we have children property\n if (!('children' in result) || !Array.isArray(result.children)) {\n return result\n }\n\n // Flatten children - if any child is also a batch, merge its children up\n const flattenedChildren: unknown[] = []\n\n for (const child of result.children) {\n if (typeof child === 'object' && child && 'resultType' in child) {\n const childResult = child as Record<string, unknown>\n if (\n childResult.resultType === 'executeBatch' ||\n childResult.resultType === 'setDataBatch'\n ) {\n // This child is also a batch - flatten its children into our array\n if (\n 'children' in childResult &&\n Array.isArray(childResult.children)\n ) {\n flattenedChildren.push(...childResult.children)\n }\n } else {\n // Regular child - keep as is\n flattenedChildren.push(child)\n }\n }\n }\n\n // Return updated result with flattened children\n return {\n ...result,\n children: flattenedChildren,\n } as DecoderResult\n }\n\n /**\n * Load missing address data\n * This would be called by an external service that fetches address data\n */\n async loadAddressData(addressData: EnhancedInfo[]) {\n // Update data model\n this.dataModel.injectData(addressData)\n\n // Update cache if available\n if (this.addressCache) {\n await Promise.all(\n addressData.map((data) => {\n const key: DataKey = data.tokenId\n ? (`${data.address}:${data.tokenId}` as DataKey)\n : (data.address as DataKey)\n return this.addressCache?.set(key, data) ?? Promise.resolve()\n })\n )\n }\n }\n\n /**\n * Get addresses that need to be fetched\n */\n getMissingAddresses(): DataKey[] {\n return this.dataModel.getMissingKeys()\n }\n\n /**\n * Get addresses currently being loaded\n */\n getLoadingAddresses(): DataKey[] {\n return this.dataModel.getLoadingKeys()\n }\n}\n\n/**\n * Create a simple in-memory address cache\n */\nexport function createMemoryAddressCache(): AddressCache {\n const cache = new Map<string, EnhancedInfo>()\n\n return {\n async get(key: DataKey) {\n return cache.get(key)\n },\n async set(key: DataKey, value: EnhancedInfo) {\n cache.set(key, value)\n },\n async has(key: DataKey) {\n return cache.has(key)\n },\n async delete(key: DataKey) {\n cache.delete(key)\n },\n async clear() {\n cache.clear()\n },\n }\n}\n","import type { Address } from 'viem'\nimport {\n bytesToHex,\n decodeAbiParameters,\n isHex,\n parseAbiParameters,\n} from 'viem'\n\n/**\n * LSP23 Factory address (same on all networks)\n */\nexport const LSP23_FACTORY_ADDRESS =\n '0x2300000a84d25df63081feaa37ba6b62c4c89a30' as const\n\n/**\n * deployERC1167Proxies function selector\n */\nexport const DEPLOY_ERC1167_PROXIES_SELECTOR = '0x6a66a753' as const\n\n/**\n * LSP23 deployment data structure\n */\nexport interface LSP23DeploymentData {\n profileAddress: Address\n urdAddress: Address\n deployerAddress: Address // The controller that deployed this profile\n salt: string\n primaryImplementation: Address\n secondaryImplementation: Address\n postDeploymentModule: Address\n initializationCalldata: string\n deploymentCalldata: string // Full calldata to deployERC1167Proxies\n transactionHash: string\n blockNumber: bigint\n blockTimestamp: number // Unix timestamp of the block\n chainId: number\n}\n\n/**\n * Contract deployment tuple structures\n * Primary: (bytes32 salt, uint256 fundingAmount, address implementationContract, bytes initializeCalldata)\n * Secondary: (uint256 fundingAmount, address implementationContract, bytes addInitializeCalldata, bool addConstructor, bytes constructorParams)\n */\n\n/**\n * Decode deployERC1167Proxies calldata\n *\n * Function signature:\n * deployERC1167Proxies(\n * (bytes32 salt, uint256 fundingAmount, address implementationContract, bytes initializeCalldata) primaryContractDeployment,\n * (uint256 fundingAmount, address implementationContract, bytes addInitializeCalldata, bool addConstructor, bytes constructorParams) secondaryContractDeployment,\n * address postDeploymentModule,\n * bytes postDeploymentModuleCalldata\n * )\n */\nexport function decodeDeploymentCalldata(input: string): {\n salt: string\n primaryImplementation: Address\n secondaryImplementation: Address\n postDeploymentModule: Address\n initializationCalldata: string\n} | null {\n try {\n // Remove function selector (first 4 bytes / 8 hex chars + 0x)\n const params = `0x${input.slice(10)}` as `0x${string}`\n\n // Decode the parameters\n const decoded = decodeAbiParameters(\n parseAbiParameters(\n '(bytes32,uint256,address,bytes), (uint256,address,bytes,bool,bytes), address, bytes'\n ),\n params\n )\n\n const [\n primaryDeployment,\n secondaryDeployment,\n postDeploymentModule,\n postDeploymentModuleCalldata,\n ] = decoded\n\n // Primary deployment tuple: (bytes32 salt, uint256 fundingAmount, address implementationContract, bytes initializeCalldata)\n const [salt, , primaryImplementation] = primaryDeployment as [\n string,\n bigint,\n Address,\n string,\n ]\n\n // Secondary deployment tuple: (uint256 fundingAmount, address implementationContract, bytes addInitializeCalldata, bool addConstructor, bytes constructorParams)\n const [, secondaryImplementation] = secondaryDeployment as [\n bigint,\n Address,\n string,\n boolean,\n string,\n ]\n\n if (!primaryImplementation || !secondaryImplementation) {\n return null\n }\n\n return {\n salt,\n primaryImplementation,\n secondaryImplementation,\n postDeploymentModule: postDeploymentModule as Address,\n initializationCalldata: postDeploymentModuleCalldata as string,\n }\n } catch (error) {\n console.error('Failed to decode LSP23 deployment calldata:', error)\n return null\n }\n}\n\n/**\n * Decode deployERC1167Proxies output to get deployed addresses\n *\n * Returns: (address primaryContractAddress, address secondaryContractAddress)\n */\nexport function decodeDeploymentOutput(output: string): {\n profileAddress: Address\n urdAddress: Address\n} | null {\n try {\n const decoded = decodeAbiParameters(\n parseAbiParameters('address, address'),\n output as `0x${string}`\n )\n\n return {\n profileAddress: decoded[0],\n urdAddress: decoded[1],\n }\n } catch (error) {\n console.error('Failed to decode LSP23 deployment output:', error)\n return null\n }\n}\n\n/**\n * Extract controller addresses from initialization calldata\n *\n * The initializationCalldata contains a setDataBatch call that sets up controller permissions.\n * Function: setDataBatch(bytes32[] dataKeys, bytes[] dataValues)\n *\n * The dataKeys contain entries like:\n * - AddressPermissions:Permissions:<controller-address>\n *\n * We extract controller addresses from these keys.\n */\nexport function extractControllersFromInitCalldata(\n initializationCalldata: string\n): Address[] {\n try {\n if (!initializationCalldata || initializationCalldata === '0x') {\n return []\n }\n\n // The postDeploymentModuleCalldata is raw ABI-encoded (bytes32[], bytes[])\n // No function selector - decode directly\n const decoded = decodeAbiParameters(\n parseAbiParameters('bytes32[], bytes[]'),\n initializationCalldata as `0x${string}`\n )\n\n const [dataKeys, dataValues] = decoded\n const controllers: Address[] = []\n\n // Look for AddressPermissions[] keys\n // The key is 0xdf30dba06db6a30e65354d9a64c60986 followed by zeros\n // The controller address is in the corresponding value at the same index (encoded as bytes)\n const ADDRESS_PERMISSIONS_ARRAY_PREFIX =\n '0xdf30dba06db6a30e65354d9a64c60986'\n\n for (let i = 0; i < dataKeys.length; i++) {\n const keyStr = dataKeys[i].toLowerCase()\n if (keyStr.startsWith(ADDRESS_PERMISSIONS_ARRAY_PREFIX)) {\n // The value contains the controller address\n const value = dataValues[i]\n\n // Convert to hex if it's not already\n const valueHex = isHex(value) ? value : bytesToHex(value as Uint8Array)\n\n // The value should be a 20-byte address (40 hex chars + 0x = 42 total)\n // or possibly 32 bytes with padding\n if (valueHex.length === 42) {\n // Exactly 20 bytes - this is the address\n const addr = valueHex as Address\n if (\n addr !== '0x0000000000000000000000000000000000000000' &&\n !controllers.some((c) => c.toLowerCase() === addr.toLowerCase())\n ) {\n controllers.push(addr)\n }\n }\n }\n }\n\n return controllers\n } catch (error) {\n console.error('Failed to extract controllers from init calldata:', error)\n return []\n }\n}\n\n/**\n * Hypersync query configuration for LSP23 deployments\n */\nexport interface HypersyncQueryConfig {\n /**\n * Controller addresses (derived keys) that deployed profiles\n * We only want LSP23 data for profiles WE created, not imported\n */\n controllerAddresses?: Address[]\n\n /**\n * Profile addresses to query deployment data for\n * More efficient than querying by controllers when we already know the profiles\n */\n profileAddresses?: Address[]\n\n /**\n * Starting block (0 for genesis)\n */\n fromBlock?: number\n\n /**\n * Ending block (undefined for latest)\n */\n toBlock?: number\n\n /**\n * Chain ID to query\n */\n chainId: number\n}\n\n/**\n * Build Hypersync query to find LSP23 deployments\n *\n * Strategy 1 (by profileAddresses - RECOMMENDED):\n * Query CREATE2 traces where the created address matches our profile addresses.\n * Then filter transactions to LSP23 factory and verify deployer is one of our controllers.\n * This is more efficient when we already know the profile addresses from GraphQL.\n *\n * Strategy 2 (by controllerAddresses - LEGACY):\n * Query transactions TO the LSP23 factory FROM our controller addresses.\n * This scans the entire chain history for all deployments by our controllers.\n */\nexport function buildLSP23DeploymentQuery(config: HypersyncQueryConfig) {\n const {\n controllerAddresses,\n profileAddresses,\n fromBlock = 0,\n toBlock,\n } = config\n\n // Prefer querying by profile addresses (more efficient)\n if (profileAddresses && profileAddresses.length > 0) {\n return {\n from_block: fromBlock,\n to_block: toBlock,\n // Query CREATE2 traces where the created address is one of our profiles\n traces: [\n {\n type: ['create2'],\n to: profileAddresses.map((addr) => addr.toLowerCase()),\n },\n ],\n // Also get the transactions to verify they're to the LSP23 factory\n transactions: [\n {\n to: [LSP23_FACTORY_ADDRESS.toLowerCase()],\n },\n ],\n field_selection: {\n transaction: ['hash', 'from', 'to', 'input', 'output', 'block_number'],\n trace: ['transaction_hash', 'type', 'from', 'to'],\n block: ['number', 'timestamp'],\n },\n include_all_blocks: false,\n }\n }\n\n // Fall back to querying by controller addresses (less efficient)\n if (controllerAddresses && controllerAddresses.length > 0) {\n return {\n from_block: fromBlock,\n to_block: toBlock,\n // Query transactions to the LSP23 factory from our controllers\n transactions: [\n {\n from: controllerAddresses.map((addr) => addr.toLowerCase()),\n to: [LSP23_FACTORY_ADDRESS.toLowerCase()],\n },\n ],\n // Also get traces to see the CREATE2 operations\n traces: [\n {\n type: ['create2'],\n // No filter on 'to' - we'll match by transaction hash\n },\n ],\n field_selection: {\n transaction: ['hash', 'from', 'to', 'input', 'output', 'block_number'],\n trace: ['transaction_hash', 'type', 'from', 'to'],\n block: ['number', 'timestamp'],\n },\n include_all_blocks: false,\n }\n }\n\n throw new Error(\n 'Either profileAddresses or controllerAddresses must be provided'\n )\n}\n\n/**\n * Parse Hypersync response to extract LSP23 deployment data\n * @param response - Hypersync API response\n * @param chainId - Chain ID\n * @param controllerAddresses - Optional list of controller addresses to filter by (only return deployments from these deployers)\n */\nexport function parseLSP23DeploymentsFromHypersync(\n response: any,\n chainId: number,\n controllerAddresses?: Address[]\n): LSP23DeploymentData[] {\n const deployments: LSP23DeploymentData[] = []\n\n if (!response?.data) {\n return deployments\n }\n\n // Build a map of block number -> timestamp\n const blockTimestamps = new Map<number, number>()\n for (const block of response.data.blocks || []) {\n blockTimestamps.set(block.number, block.timestamp)\n }\n\n // Build a map of transaction hash -> transaction data\n const txMap = new Map<string, any>()\n for (const tx of response.data.transactions || []) {\n if (\n tx.to?.toLowerCase() === LSP23_FACTORY_ADDRESS.toLowerCase() &&\n tx.input?.startsWith(DEPLOY_ERC1167_PROXIES_SELECTOR)\n ) {\n txMap.set(tx.hash.toLowerCase(), tx)\n }\n }\n\n // Process traces to find CREATE2 operations\n const create2Traces = new Map<string, Address>() // txHash -> created profile address\n\n for (const trace of response.data.traces || []) {\n if (trace.type === 'create2' && trace.to) {\n create2Traces.set(\n trace.transaction_hash.toLowerCase(),\n trace.to as Address\n )\n }\n }\n\n // Create a Set of lowercase controller addresses for efficient filtering\n const controllerSet = controllerAddresses\n ? new Set(controllerAddresses.map((addr) => addr.toLowerCase()))\n : null\n\n // Match transactions with traces\n for (const [txHash, _profileAddress] of create2Traces) {\n const tx = txMap.get(txHash)\n if (!tx) continue\n\n // If controller filtering is enabled, verify the deployer is one of our controllers\n if (controllerSet && !controllerSet.has(tx.from.toLowerCase())) {\n continue\n }\n\n // Decode the transaction\n const decodedInput = decodeDeploymentCalldata(tx.input)\n const decodedOutput = tx.output ? decodeDeploymentOutput(tx.output) : null\n\n if (!decodedInput || !decodedOutput) continue\n\n // Get block timestamp for this transaction\n const blockTimestamp = blockTimestamps.get(tx.block_number) || 0\n\n deployments.push({\n profileAddress: decodedOutput.profileAddress,\n urdAddress: decodedOutput.urdAddress,\n deployerAddress: tx.from as Address, // The controller that deployed this profile\n salt: decodedInput.salt,\n primaryImplementation: decodedInput.primaryImplementation,\n secondaryImplementation: decodedInput.secondaryImplementation,\n postDeploymentModule: decodedInput.postDeploymentModule,\n initializationCalldata: decodedInput.initializationCalldata,\n deploymentCalldata: tx.input, // Full calldata to deployERC1167Proxies\n transactionHash: tx.hash,\n blockNumber: BigInt(tx.block_number),\n blockTimestamp, // Unix timestamp of the block\n chainId,\n })\n }\n\n return deployments\n}\n\n/**\n * Note: Hypersync querying should be done server-side to protect HYPERSYNC_TOKEN.\n * Use the wallet-app API endpoint /api/lsp23Deployments instead of calling Hypersync directly.\n *\n * This module exports:\n * - buildLSP23DeploymentQuery() - Build the Hypersync query structure\n * - parseLSP23DeploymentsFromHypersync() - Parse Hypersync response\n * - decodeDeploymentCalldata() - Decode LSP23 transaction input\n * - decodeDeploymentOutput() - Decode LSP23 transaction output\n */\n","/**\n * JSON serializer/deserializer that preserves BigInt types\n *\n * This implementation uses an 'n' suffix to indicate BigInt values,\n * ensuring that values that were originally BigInt remain BigInt,\n * and values that were originally numbers remain numbers.\n *\n * Example:\n * - BigInt(123) serializes to \"123n\"\n * - Number(123) serializes to 123\n *\n * This is important for blockchain data where some values must be BigInt\n * (e.g., gas, value, nonce) while others should remain as numbers\n * (e.g., array indices, status codes).\n */\n\nexport const JSONbigString = {\n /**\n * Stringify an object, converting BigInt values to strings with 'n' suffix\n */\n stringify: (obj: any, _replacer?: any, space?: string | number): string => {\n return JSON.stringify(\n obj,\n (_key, value) => {\n if (typeof value === 'bigint') {\n return `${value.toString()}n`\n }\n return value\n },\n space\n )\n },\n\n /**\n * Parse a JSON string, converting strings ending with 'n' back to BigInt\n */\n parse: (text: string): any => {\n return JSON.parse(text, (_key, value) => {\n if (typeof value === 'string' && /^\\d+n$/.test(value)) {\n return BigInt(value.slice(0, -1))\n }\n return value\n })\n },\n}\n\nexport default JSONbigString\n","/**\n * @lukso/decoder - Consumer API\n *\n * This is the main entry point for consumers of the decoder.\n * Import data provider functions from '@lukso/transaction-decoder/data' instead.\n */\n\nimport { consumerModel, createGlobalInstance } from './core/instance'\n\n// Export all types that consumers need\nexport type {\n AddressState,\n DataKey,\n EnhancedInfo,\n IDataModelConsumer,\n TransactionState,\n} from './types'\n// DecoderResult is exported from decoder/types via the decoder imports below\n\n// Export all consumer methods directly\nexport const getTransaction = consumerModel.getTransaction.bind(consumerModel)\nexport const getTransactionByKey =\n consumerModel.getTransactionByKey.bind(consumerModel)\nexport const getTransactionsByIndex =\n consumerModel.getTransactionsByIndex.bind(consumerModel)\nexport const getTransactionHashByIndex =\n consumerModel.getTransactionHashByIndex.bind(consumerModel)\nexport const getTransactionCount =\n consumerModel.getTransactionCount.bind(consumerModel)\nexport const getDecodedCount = consumerModel.getDecodedCount.bind(consumerModel)\nexport const getDecodedTransactions =\n consumerModel.getDecodedTransactions.bind(consumerModel)\nexport const getTransactionsInOrder =\n consumerModel.getTransactionsInOrder.bind(consumerModel)\n\n// Address methods\nexport const getAddress = consumerModel.getAddress.bind(consumerModel)\nexport const getSignal = consumerModel.getSignal.bind(consumerModel)\nexport const subscribe = consumerModel.subscribe.bind(consumerModel)\nexport const getState = consumerModel.getState.bind(consumerModel)\nexport const hasData = consumerModel.hasData.bind(consumerModel)\nexport const getData = consumerModel.getData.bind(consumerModel)\nexport const isLoading = consumerModel.isLoading.bind(consumerModel)\nexport const getError = consumerModel.getError.bind(consumerModel)\n\n// Collection methods\nexport const getAllKeys = consumerModel.getAllKeys.bind(consumerModel)\nexport const getAllData = consumerModel.getAllData.bind(consumerModel)\nexport const getAllTransactions =\n consumerModel.getAllTransactions.bind(consumerModel)\n\n// Also export the consumer model instance for advanced usage\nexport { consumerModel }\n\n// Export the function to create global instance (for manual setup)\nexport { createGlobalInstance }\n\n// Export client utilities\nexport {\n createApiAddressResolver,\n type ResolveAddressesOptions,\n type ResolveAddressesResponse,\n resolveAddresses,\n} from './client/resolveAddresses'\n// Export address collection utilities from core\nexport { collectDataKeys } from './core/addressCollector'\nexport {\n AddressResolver,\n type AddressResolverConfig,\n} from './core/addressResolver'\n// Export integration classes\nexport {\n type AddressCache,\n createMemoryAddressCache,\n DecoderIntegration,\n type DecoderIntegrationConfig,\n} from './core/integrateDecoder'\n// Export aggregation utilities\nexport {\n type AggregationState,\n PluginAggregationEngine,\n standardAggregation,\n} from './decoder/aggregation'\nexport type {\n AddressResolver as TransactionAddressResolver,\n TransactionDecoderResult,\n} from './decoder/decodeTransaction'\n// Export decoder integration utilities\nexport {\n decodeTransaction,\n decodeTransactionAsync,\n} from './decoder/decodeTransaction'\n// Export plugin development utilities\n// Export default plugins to ensure they're imported and register themselves\nexport {\n createAggregationKey,\n defaultPlugins,\n defaultSchemaPlugins,\n standardPlugin,\n standardSchemaPlugin,\n} from './decoder/plugins'\nexport type {\n PluginMetadata,\n SchemaPluginMetadata,\n} from './decoder/registry'\nexport {\n createNamedPlugin,\n createNamedSchemaPlugin,\n pluginRegistry,\n registerPlugin,\n registerSchemaPlugin,\n} from './decoder/registry'\nexport type {\n Aggregation,\n DecodeEventCallback,\n DecodeEventResult,\n DecoderPlugin,\n DecoderResult,\n EnhancerCallback,\n PluginOptions,\n ResultAggregate,\n ResultCreate,\n ResultError,\n ResultExecute,\n ResultExecuteBatch,\n ResultFollowProfile,\n ResultGrafitti,\n ResultRaw,\n ResultSetData,\n ResultSetDataBatch,\n ResultWrapper,\n SchemaPlugin,\n} from './decoder/types'\n// Export utility functions\nexport { getArgByName, needsEnhancement } from './decoder/utils'\n// Export LSP23 deployment resolver utilities\n// Note: Actual Hypersync querying should be done via wallet-app API to protect HYPERSYNC_TOKEN\nexport {\n buildLSP23DeploymentQuery,\n DEPLOY_ERC1167_PROXIES_SELECTOR,\n decodeDeploymentCalldata,\n decodeDeploymentOutput,\n extractControllersFromInitCalldata,\n type HypersyncQueryConfig,\n LSP23_FACTORY_ADDRESS,\n type LSP23DeploymentData,\n parseLSP23DeploymentsFromHypersync,\n} from './server/lsp23Resolver'\n// Export shared address resolver utilities\nexport {\n type AssetData,\n fetchMultipleAddresses,\n fetchProfilesByControllers,\n getGraphQLEndpoint,\n getImage,\n type ImageData,\n type ImageURL,\n type LinkData,\n type ProfileData,\n type TFetchAddressData,\n type TokenData,\n} from './shared/addressResolver'\n// Export cache utilities\nexport {\n type AddressIdentityCache,\n createMemoryAddressIdentityCache,\n dataKeyToString,\n getDataKeyCacheKey,\n parseDataKey,\n} from './shared/cache'\n// Export debug utility for edge/worker environments\nexport { createDebug } from './utils/debug'\n// Export JSON BigInt serializer/deserializer\nexport { JSONbigString } from './utils/json-bigint'\n// Release update\n// build 2\n"],"mappings":";;;;;;;;;;;;;;;AA6CA,SAAS,UAAa,OAA4C;AAChE,SAAO,iBAAiB;AAC1B;AAFS;AAOF,SAAS,mBAAmB,KAAsB;AACvD,SAAO,IAAI,YAAY;AACzB;AAFgB;AAST,SAAS,gBAAgB,SAA0B;AACxD,SAAO;AACT;AAFgB;AAST,SAAS,aAAa,KAAsB;AAEjD,SAAO;AACT;AAHgB;AAQT,SAAS,iCACd,QAAgB,MAAO,KAAK,GACN;AACtB,QAAM,QAAQ,oBAAI,IAAqD;AAEvE,SAAO;AAAA,IACL,IAAI,KAAwC;AAC1C,YAAM,WAAW,mBAAmB,GAAG;AACvC,YAAM,QAAQ,MAAM,IAAI,QAAQ;AAEhC,UAAI,CAAC,MAAO,QAAO;AAEnB,UAAI,KAAK,IAAI,IAAI,MAAM,SAAS;AAC9B,cAAM,OAAO,QAAQ;AACrB,eAAO;AA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B,KAAK,aAAa;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/shared/cache.ts","../src/client/resolveAddresses.ts","../src/core/addressResolver.ts","../src/core/integrateDecoder.ts","../src/server/lsp23Resolver.ts","../src/utils/json-bigint.ts","../src/index.ts"],"sourcesContent":["import type { DataKey, EnhancedInfo } from '../types'\n\n/**\n * Address identity cache interface\n * Can be implemented with different backends (LRU, Redis, etc.)\n */\nexport interface AddressIdentityCache {\n /**\n * Get cached address data\n */\n get(\n key: DataKey\n ): EnhancedInfo | undefined | Promise<EnhancedInfo | undefined>\n\n /**\n * Set address data in cache\n */\n set(key: DataKey, value: EnhancedInfo): void | Promise<void>\n\n /**\n * Check if address is in cache\n */\n has(key: DataKey): boolean | Promise<boolean>\n\n /**\n * Get multiple addresses at once\n */\n getMany?(\n keys: readonly DataKey[]\n ): Map<DataKey, EnhancedInfo> | Promise<Map<DataKey, EnhancedInfo>>\n\n /**\n * Set multiple addresses at once\n */\n setMany?(entries: Array<[DataKey, EnhancedInfo]>): void | Promise<void>\n\n /**\n * Clear all cached data\n */\n clear?(): void | Promise<void>\n}\n\n/**\n * Type guard to check if value is a promise\n */\nfunction isPromise<T>(value: T | Promise<T>): value is Promise<T> {\n return value instanceof Promise\n}\n\n/**\n * Helper to convert DataKey to cache key string\n */\nexport function getDataKeyCacheKey(key: DataKey): string {\n return key.toLowerCase()\n}\n\n/**\n * Convert a DataKey to the standardized string format\n * @param dataKey - A hex string (address or address:tokenId)\n * @returns The same string\n */\nexport function dataKeyToString(dataKey: DataKey): string {\n return dataKey\n}\n\n/**\n * Parse a string to a DataKey\n * @param str - String in format \"address\" or \"address:tokenId\"\n * @returns DataKey as a hex string\n */\nexport function parseDataKey(str: string): DataKey {\n // Just return the string as-is since DataKey is now always a string\n return str as DataKey\n}\n\n/**\n * Create a simple in-memory address cache\n */\nexport function createMemoryAddressIdentityCache(\n ttlMs: number = 1000 * 60 * 5 // 5 minutes default\n): AddressIdentityCache {\n const cache = new Map<string, { data: EnhancedInfo; expires: number }>()\n\n return {\n get(key: DataKey): EnhancedInfo | undefined {\n const cacheKey = getDataKeyCacheKey(key)\n const entry = cache.get(cacheKey)\n\n if (!entry) return undefined\n\n if (Date.now() > entry.expires) {\n cache.delete(cacheKey)\n return undefined\n }\n\n return entry.data\n },\n\n set(key: DataKey, value: EnhancedInfo): void {\n const cacheKey = getDataKeyCacheKey(key)\n cache.set(cacheKey, {\n data: value,\n expires: Date.now() + ttlMs,\n })\n },\n\n has(key: DataKey): boolean {\n const cacheKey = getDataKeyCacheKey(key)\n const entry = cache.get(cacheKey)\n\n if (!entry) return false\n\n if (Date.now() > entry.expires) {\n cache.delete(cacheKey)\n return false\n }\n\n return true\n },\n\n getMany(keys: DataKey[]): Map<DataKey, EnhancedInfo> {\n const results = new Map<DataKey, EnhancedInfo>()\n\n for (const key of keys) {\n const data = this.get(key)\n if (data && !isPromise(data)) {\n results.set(key, data)\n }\n }\n\n return results\n },\n\n setMany(entries: Array<[DataKey, EnhancedInfo]>): void {\n for (const [key, value] of entries) {\n this.set(key, value)\n }\n },\n\n clear(): void {\n cache.clear()\n },\n }\n}\n","import type { Chain } from 'viem'\nimport type { AddressIdentityCache } from '../shared/cache'\nimport { getDataKeyCacheKey } from '../shared/cache'\nimport type { DataKey, EnhancedInfo } from '../types'\n\nexport interface ResolveAddressesOptions {\n /**\n * API endpoint URL (defaults to '/api/resolveAddresses')\n */\n endpoint?: string\n\n /**\n * Optional cache to check before making API call\n */\n cache?: AddressIdentityCache\n\n /**\n * Maximum number of addresses per batch (defaults to 100)\n */\n batchSize?: number\n\n /**\n * Request timeout in milliseconds (defaults to 10000)\n */\n timeout?: number\n}\n\nexport interface ResolveAddressesResponse {\n success: boolean\n addresses?: Record<string, EnhancedInfo>\n cached?: number\n fetched?: number\n total?: number\n error?: string\n}\n\n/**\n * Resolve addresses using the API endpoint\n * This allows clients to populate the server cache and get resolved addresses\n */\nexport async function resolveAddresses(\n addresses: DataKey[],\n chain: Chain,\n options: ResolveAddressesOptions = {}\n): Promise<Map<DataKey, EnhancedInfo>> {\n const {\n endpoint = '/api/resolveAddresses',\n cache,\n batchSize = 100,\n timeout = 10000,\n } = options\n\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 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 if (uncachedAddresses.length === 0) {\n return results\n }\n } else {\n uncachedAddresses.push(...addresses)\n }\n\n // Process in batches\n const batches: DataKey[][] = []\n for (let i = 0; i < uncachedAddresses.length; i += batchSize) {\n batches.push(uncachedAddresses.slice(i, i + batchSize))\n }\n\n // Fetch all batches in parallel\n const batchPromises = batches.map(async (batch) => {\n try {\n // DataKey is now just Hex string, use batch directly\n const apiAddresses = batch\n\n // Make API request with timeout\n const controller = new AbortController()\n const timeoutId = setTimeout(() => controller.abort(), timeout)\n\n const response = await fetch(endpoint, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n chainId: chain.id,\n addresses: apiAddresses,\n }),\n signal: controller.signal,\n })\n\n clearTimeout(timeoutId)\n\n if (!response.ok) {\n console.error(\n `Address resolution failed: ${response.status} ${response.statusText}`\n )\n return\n }\n\n const data: ResolveAddressesResponse = await response.json()\n\n if (data.success && data.addresses) {\n // Convert response back to DataKey -> EnhancedInfo map\n for (const [cacheKey, enhancedInfo] of Object.entries(data.addresses)) {\n // Find the original DataKey that matches this cache key\n const matchingKey = batch.find(\n (key) => getDataKeyCacheKey(key) === cacheKey\n )\n\n if (matchingKey) {\n results.set(matchingKey, enhancedInfo)\n\n // Update cache if provided\n if (cache) {\n await cache.set(matchingKey, enhancedInfo)\n }\n }\n }\n }\n } catch (error) {\n console.error('Failed to resolve addresses batch:', error)\n }\n })\n\n await Promise.all(batchPromises)\n\n return results\n}\n\n/**\n * Create a cache-through address resolver that uses the API\n * This can be used as a drop-in replacement for fetchMultipleAddresses\n */\nexport function createApiAddressResolver(\n chain: Chain,\n options: ResolveAddressesOptions = {}\n) {\n return async (addresses: DataKey[]): Promise<Map<DataKey, EnhancedInfo>> => {\n return resolveAddresses(addresses, chain, options)\n }\n}\n","import type { Chain } from 'viem'\nimport { fetchMultipleAddresses } from '../shared/addressResolver'\nimport type { AddressIdentityCache } from '../shared/cache'\nimport type { DataKey, EnhancedInfo, IDataModel } from '../types'\n\n/**\n * Configuration for address resolver\n */\nexport interface AddressResolverConfig {\n dataModel: IDataModel\n graphqlEndpoint: string\n chain: Chain\n batchSize?: number\n batchDelay?: number\n cache?: AddressIdentityCache\n}\n\n/**\n * Resolve addresses using GraphQL\n * Replaces the old patchValue mechanism\n */\nexport class AddressResolver {\n private dataModel: IDataModel\n private graphqlEndpoint: string\n private batchSize: number\n private batchDelay: number\n private pendingAddresses = new Set<string>()\n private batchTimer?: NodeJS.Timeout\n private cache?: AddressIdentityCache\n\n constructor(config: AddressResolverConfig) {\n this.dataModel = config.dataModel\n this.graphqlEndpoint = config.graphqlEndpoint\n this.batchSize = config.batchSize || 50\n this.batchDelay = config.batchDelay || 100\n this.cache = config.cache\n }\n\n /**\n * Start watching for missing addresses\n */\n startWatching() {\n // Check for missing addresses periodically\n setInterval(() => {\n const missing = this.dataModel.getMissingKeys()\n if (missing.length > 0) {\n this.queueAddresses(missing)\n }\n }, 1000)\n }\n\n /**\n * Queue addresses for batch resolution\n */\n queueAddresses(addresses: DataKey[]) {\n // Add to pending set\n for (const addr of addresses) {\n this.pendingAddresses.add(addr)\n }\n\n // Clear existing timer\n if (this.batchTimer) {\n clearTimeout(this.batchTimer)\n }\n\n // Set new timer\n this.batchTimer = setTimeout(() => {\n this.processBatch()\n }, this.batchDelay)\n\n // Process immediately if batch is full\n if (this.pendingAddresses.size >= this.batchSize) {\n clearTimeout(this.batchTimer)\n this.processBatch()\n }\n }\n\n /**\n * Process a batch of addresses\n */\n private async processBatch() {\n const batch = Array.from(this.pendingAddresses).slice(0, this.batchSize)\n if (batch.length === 0) return\n\n // Remove from pending\n for (const key of batch) {\n this.pendingAddresses.delete(key)\n }\n\n // Convert batch keys back to DataKey format\n const dataKeys: DataKey[] = batch.map((key) => {\n return key as DataKey\n })\n\n try {\n // Fetch data using shared implementation with cache\n const results = await fetchMultipleAddresses(\n dataKeys,\n this.graphqlEndpoint,\n this.cache\n )\n\n // Convert to array for injection\n const enhancedData: EnhancedInfo[] = Array.from(results.values())\n\n // Inject data into model\n if (enhancedData.length > 0) {\n this.dataModel.injectData(enhancedData)\n }\n } catch (error) {\n console.error('Failed to resolve addresses:', error)\n\n // Mark addresses as having errors\n for (const key of dataKeys) {\n this.dataModel.setError(key, 'Failed to fetch address data')\n }\n }\n\n // Continue processing if more pending\n if (this.pendingAddresses.size > 0) {\n this.batchTimer = setTimeout(() => {\n this.processBatch()\n }, this.batchDelay)\n }\n }\n\n /**\n * Stop watching for addresses\n */\n stopWatching() {\n if (this.batchTimer) {\n clearTimeout(this.batchTimer)\n }\n }\n}\n","import { effect } from '@preact/signals-core'\nimport { lukso } from 'viem/chains'\nimport { decodeTransaction } from '../decoder/decodeTransaction'\nimport { defaultPlugins, defaultSchemaPlugins } from '../decoder/plugins'\nimport type { DecoderOptions, DecoderResult } from '../decoder/types'\nimport type { DataKey, EnhancedInfo, IDataModel } from '../types'\nimport { collectDataKeys } from './addressCollector'\n\n/**\n * Configuration for decoder integration\n */\nexport interface DecoderIntegrationConfig {\n dataModel: IDataModel\n decoderOptions?: Partial<DecoderOptions>\n addressCache?: AddressCache\n}\n\n/**\n * External cache interface for address data\n */\nexport interface AddressCache {\n get(key: DataKey): Promise<EnhancedInfo | undefined>\n set(key: DataKey, value: EnhancedInfo): Promise<void>\n has(key: DataKey): Promise<boolean>\n delete(key: DataKey): Promise<void>\n clear(): Promise<void>\n}\n\n/**\n * Integrate the decoder with the data model\n * Handles progressive transaction enhancement and address population\n */\nexport class DecoderIntegration {\n private dataModel: IDataModel\n private decoderOptions: DecoderOptions\n private addressCache?: AddressCache\n\n constructor(config: DecoderIntegrationConfig) {\n this.dataModel = config.dataModel\n this.addressCache = config.addressCache\n\n // Set up default decoder options\n this.decoderOptions = {\n plugins: defaultPlugins,\n schemaPlugins: defaultSchemaPlugins,\n wrappers: [],\n chain: config.decoderOptions?.chain || lukso,\n ...config.decoderOptions,\n }\n }\n\n /**\n * Add and decode a transaction\n * @param transaction - Raw transaction data\n * @returns Transaction signal that updates as decoding progresses\n */\n async addAndDecodeTransaction(transaction: DecoderResult) {\n // Add transaction to data model\n const signal = this.dataModel.addTransactions(transaction)\n\n // Create fresh wrappers array for this transaction\n const transactionOptions: DecoderOptions = {\n ...this.decoderOptions,\n wrappers: [], // Fresh array for collecting wrappers in this decode hierarchy\n }\n\n // Start decoding process\n const { signal: decodingSignal } = await decodeTransaction(\n transaction,\n transactionOptions\n )\n\n // Update transaction data as decoding progresses\n effect(() => {\n const state = decodingSignal.value\n if (state.data) {\n const decodedResult = state.data as DecoderResult\n\n // Process any collected wrappers\n if (transactionOptions.wrappers.length > 0) {\n // Only certain result types support wrappers\n if (\n 'wrappers' in decodedResult &&\n typeof decodedResult === 'object'\n ) {\n ;(decodedResult as Record<string, unknown>).wrappers =\n transactionOptions.wrappers\n }\n\n // Extract addresses from wrappers\n for (const wrapper of transactionOptions.wrappers) {\n this.updateAddressesFromDecoded(wrapper as DecoderResult)\n }\n }\n\n // Flatten nested batch transactions if configured\n const processedResult = this.flattenBatchTransactions(decodedResult)\n\n if (transaction.hash) {\n this.dataModel.updateTransactionData(\n transaction.hash,\n processedResult,\n 0 // decoder index\n )\n }\n\n // Extract and update addresses from decoded data\n this.updateAddressesFromDecoded(processedResult)\n }\n })\n\n return signal\n }\n\n /**\n * Add and decode multiple transactions\n * @param transactions - Array of raw transactions\n * @returns Array of transaction signals\n */\n async addAndDecodeTransactions(transactions: DecoderResult[]) {\n // Add all transactions to data model\n const signals = this.dataModel.addTransactions(transactions)\n\n // Start decoding for each transaction\n const decodingPromises = transactions.map(async (tx, _index) => {\n // Create fresh wrappers array for each transaction\n const transactionOptions: DecoderOptions = {\n ...this.decoderOptions,\n wrappers: [], // Fresh array for collecting wrappers in this decode hierarchy\n }\n\n const { signal: decodingSignal } = await decodeTransaction(\n tx,\n transactionOptions\n )\n\n // Update transaction data as decoding progresses\n effect(() => {\n const state = decodingSignal.value\n if (state.data) {\n const decodedResult = state.data as DecoderResult\n\n // Process any collected wrappers\n if (transactionOptions.wrappers.length > 0) {\n // Only certain result types support wrappers\n if (\n 'wrappers' in decodedResult &&\n typeof decodedResult === 'object'\n ) {\n ;(decodedResult as Record<string, unknown>).wrappers =\n transactionOptions.wrappers\n }\n\n // Extract addresses from wrappers\n for (const wrapper of transactionOptions.wrappers) {\n this.updateAddressesFromDecoded(wrapper as DecoderResult)\n }\n }\n\n // Flatten nested batch transactions if configured\n const processedResult = this.flattenBatchTransactions(decodedResult)\n\n if (tx.hash) {\n this.dataModel.updateTransactionData(\n tx.hash,\n processedResult,\n 0 // decoder index\n )\n }\n\n // Extract and update addresses from decoded data\n this.updateAddressesFromDecoded(processedResult)\n }\n })\n\n return decodingSignal\n })\n\n await Promise.all(decodingPromises)\n return signals\n }\n\n /**\n * Extract and register addresses from decoded transaction data\n */\n private async updateAddressesFromDecoded(decodedData: DecoderResult) {\n const addresses = collectDataKeys(decodedData)\n\n // Check cache and inject into data model\n for (const address of addresses) {\n // Check cache first\n if (this.addressCache) {\n const cached = await this.addressCache.get(address)\n if (cached) {\n // Inject into data model\n this.dataModel.updateData(cached)\n }\n }\n\n // Ensure the address signal exists (creates empty signal if not)\n // This allows views to getAddress() without errors\n this.dataModel.getAddress(address)\n }\n }\n\n /**\n * Flatten nested batch transactions\n * If a batch contains another batch as a child, flatten all sub-transactions into the parent's children\n *\n * Structure:\n * - Wrappers: The \"invisible\" execute functions (execute, executeRelayCall, etc.) that wrap the actual transaction\n * - Children: The actual transactions being executed\n *\n * Result:\n * - Single transaction: { resultType: 'execute', wrappers: [...] }\n * - Batch transaction: { resultType: 'executeBatch', children: [flat list], wrappers: [...] }\n *\n * This ensures only ONE level of batch with all transactions flattened\n */\n private flattenBatchTransactions(result: DecoderResult): DecoderResult {\n // Only process batch result types\n if (\n result.resultType !== 'executeBatch' &&\n result.resultType !== 'setDataBatch'\n ) {\n return result\n }\n\n // Type guard to ensure we have children property\n if (!('children' in result) || !Array.isArray(result.children)) {\n return result\n }\n\n // Flatten children - if any child is also a batch, merge its children up\n const flattenedChildren: unknown[] = []\n\n for (const child of result.children) {\n if (typeof child === 'object' && child && 'resultType' in child) {\n const childResult = child as Record<string, unknown>\n if (\n childResult.resultType === 'executeBatch' ||\n childResult.resultType === 'setDataBatch'\n ) {\n // This child is also a batch - flatten its children into our array\n if (\n 'children' in childResult &&\n Array.isArray(childResult.children)\n ) {\n flattenedChildren.push(...childResult.children)\n }\n } else {\n // Regular child - keep as is\n flattenedChildren.push(child)\n }\n }\n }\n\n // Return updated result with flattened children\n return {\n ...result,\n children: flattenedChildren,\n } as DecoderResult\n }\n\n /**\n * Load missing address data\n * This would be called by an external service that fetches address data\n */\n async loadAddressData(addressData: EnhancedInfo[]) {\n // Update data model\n this.dataModel.injectData(addressData)\n\n // Update cache if available\n if (this.addressCache) {\n await Promise.all(\n addressData.map((data) => {\n const key: DataKey = data.tokenId\n ? (`${data.address}:${data.tokenId}` as DataKey)\n : (data.address as DataKey)\n return this.addressCache?.set(key, data) ?? Promise.resolve()\n })\n )\n }\n }\n\n /**\n * Get addresses that need to be fetched\n */\n getMissingAddresses(): DataKey[] {\n return this.dataModel.getMissingKeys()\n }\n\n /**\n * Get addresses currently being loaded\n */\n getLoadingAddresses(): DataKey[] {\n return this.dataModel.getLoadingKeys()\n }\n}\n\n/**\n * Create a simple in-memory address cache\n */\nexport function createMemoryAddressCache(): AddressCache {\n const cache = new Map<string, EnhancedInfo>()\n\n return {\n async get(key: DataKey) {\n return cache.get(key)\n },\n async set(key: DataKey, value: EnhancedInfo) {\n cache.set(key, value)\n },\n async has(key: DataKey) {\n return cache.has(key)\n },\n async delete(key: DataKey) {\n cache.delete(key)\n },\n async clear() {\n cache.clear()\n },\n }\n}\n","import type { Address } from 'viem'\nimport {\n bytesToHex,\n decodeAbiParameters,\n isHex,\n parseAbiParameters,\n} from 'viem'\n\n/**\n * LSP23 Factory address (same on all networks)\n */\nexport const LSP23_FACTORY_ADDRESS =\n '0x2300000a84d25df63081feaa37ba6b62c4c89a30' as const\n\n/**\n * deployERC1167Proxies function selector\n */\nexport const DEPLOY_ERC1167_PROXIES_SELECTOR = '0x6a66a753' as const\n\n/**\n * LSP23 deployment data structure\n */\nexport interface LSP23DeploymentData {\n profileAddress: Address\n urdAddress: Address\n deployerAddress: Address // The controller that deployed this profile\n salt: string\n primaryImplementation: Address\n secondaryImplementation: Address\n postDeploymentModule: Address\n initializationCalldata: string\n deploymentCalldata: string // Full calldata to deployERC1167Proxies\n transactionHash: string\n blockNumber: bigint\n blockTimestamp: number // Unix timestamp of the block\n chainId: number\n}\n\n/**\n * Contract deployment tuple structures\n * Primary: (bytes32 salt, uint256 fundingAmount, address implementationContract, bytes initializeCalldata)\n * Secondary: (uint256 fundingAmount, address implementationContract, bytes addInitializeCalldata, bool addConstructor, bytes constructorParams)\n */\n\n/**\n * Decode deployERC1167Proxies calldata\n *\n * Function signature:\n * deployERC1167Proxies(\n * (bytes32 salt, uint256 fundingAmount, address implementationContract, bytes initializeCalldata) primaryContractDeployment,\n * (uint256 fundingAmount, address implementationContract, bytes addInitializeCalldata, bool addConstructor, bytes constructorParams) secondaryContractDeployment,\n * address postDeploymentModule,\n * bytes postDeploymentModuleCalldata\n * )\n */\nexport function decodeDeploymentCalldata(input: string): {\n salt: string\n primaryImplementation: Address\n secondaryImplementation: Address\n postDeploymentModule: Address\n initializationCalldata: string\n} | null {\n try {\n // Remove function selector (first 4 bytes / 8 hex chars + 0x)\n const params = `0x${input.slice(10)}` as `0x${string}`\n\n // Decode the parameters\n const decoded = decodeAbiParameters(\n parseAbiParameters(\n '(bytes32,uint256,address,bytes), (uint256,address,bytes,bool,bytes), address, bytes'\n ),\n params\n )\n\n const [\n primaryDeployment,\n secondaryDeployment,\n postDeploymentModule,\n postDeploymentModuleCalldata,\n ] = decoded\n\n // Primary deployment tuple: (bytes32 salt, uint256 fundingAmount, address implementationContract, bytes initializeCalldata)\n const [salt, , primaryImplementation] = primaryDeployment as [\n string,\n bigint,\n Address,\n string,\n ]\n\n // Secondary deployment tuple: (uint256 fundingAmount, address implementationContract, bytes addInitializeCalldata, bool addConstructor, bytes constructorParams)\n const [, secondaryImplementation] = secondaryDeployment as [\n bigint,\n Address,\n string,\n boolean,\n string,\n ]\n\n if (!primaryImplementation || !secondaryImplementation) {\n return null\n }\n\n return {\n salt,\n primaryImplementation,\n secondaryImplementation,\n postDeploymentModule: postDeploymentModule as Address,\n initializationCalldata: postDeploymentModuleCalldata as string,\n }\n } catch (error) {\n console.error('Failed to decode LSP23 deployment calldata:', error)\n return null\n }\n}\n\n/**\n * Decode deployERC1167Proxies output to get deployed addresses\n *\n * Returns: (address primaryContractAddress, address secondaryContractAddress)\n */\nexport function decodeDeploymentOutput(output: string): {\n profileAddress: Address\n urdAddress: Address\n} | null {\n try {\n const decoded = decodeAbiParameters(\n parseAbiParameters('address, address'),\n output as `0x${string}`\n )\n\n return {\n profileAddress: decoded[0],\n urdAddress: decoded[1],\n }\n } catch (error) {\n console.error('Failed to decode LSP23 deployment output:', error)\n return null\n }\n}\n\n/**\n * Extract controller addresses from initialization calldata\n *\n * The initializationCalldata contains a setDataBatch call that sets up controller permissions.\n * Function: setDataBatch(bytes32[] dataKeys, bytes[] dataValues)\n *\n * The dataKeys contain entries like:\n * - AddressPermissions:Permissions:<controller-address>\n *\n * We extract controller addresses from these keys.\n */\nexport function extractControllersFromInitCalldata(\n initializationCalldata: string\n): Address[] {\n try {\n if (!initializationCalldata || initializationCalldata === '0x') {\n return []\n }\n\n // The postDeploymentModuleCalldata is raw ABI-encoded (bytes32[], bytes[])\n // No function selector - decode directly\n const decoded = decodeAbiParameters(\n parseAbiParameters('bytes32[], bytes[]'),\n initializationCalldata as `0x${string}`\n )\n\n const [dataKeys, dataValues] = decoded\n const controllers: Address[] = []\n\n // Look for AddressPermissions[] keys\n // The key is 0xdf30dba06db6a30e65354d9a64c60986 followed by zeros\n // The controller address is in the corresponding value at the same index (encoded as bytes)\n const ADDRESS_PERMISSIONS_ARRAY_PREFIX =\n '0xdf30dba06db6a30e65354d9a64c60986'\n\n for (let i = 0; i < dataKeys.length; i++) {\n const keyStr = dataKeys[i].toLowerCase()\n if (keyStr.startsWith(ADDRESS_PERMISSIONS_ARRAY_PREFIX)) {\n // The value contains the controller address\n const value = dataValues[i]\n\n // Convert to hex if it's not already\n const valueHex = isHex(value) ? value : bytesToHex(value as Uint8Array)\n\n // The value should be a 20-byte address (40 hex chars + 0x = 42 total)\n // or possibly 32 bytes with padding\n if (valueHex.length === 42) {\n // Exactly 20 bytes - this is the address\n const addr = valueHex as Address\n if (\n addr !== '0x0000000000000000000000000000000000000000' &&\n !controllers.some((c) => c.toLowerCase() === addr.toLowerCase())\n ) {\n controllers.push(addr)\n }\n }\n }\n }\n\n return controllers\n } catch (error) {\n console.error('Failed to extract controllers from init calldata:', error)\n return []\n }\n}\n\n/**\n * Hypersync query configuration for LSP23 deployments\n */\nexport interface HypersyncQueryConfig {\n /**\n * Controller addresses (derived keys) that deployed profiles\n * We only want LSP23 data for profiles WE created, not imported\n */\n controllerAddresses?: Address[]\n\n /**\n * Profile addresses to query deployment data for\n * More efficient than querying by controllers when we already know the profiles\n */\n profileAddresses?: Address[]\n\n /**\n * Starting block (0 for genesis)\n */\n fromBlock?: number\n\n /**\n * Ending block (undefined for latest)\n */\n toBlock?: number\n\n /**\n * Chain ID to query\n */\n chainId: number\n}\n\n/**\n * Build Hypersync query to find LSP23 deployments\n *\n * Strategy 1 (by profileAddresses - RECOMMENDED):\n * Query CREATE2 traces where the created address matches our profile addresses.\n * Then filter transactions to LSP23 factory and verify deployer is one of our controllers.\n * This is more efficient when we already know the profile addresses from GraphQL.\n *\n * Strategy 2 (by controllerAddresses - LEGACY):\n * Query transactions TO the LSP23 factory FROM our controller addresses.\n * This scans the entire chain history for all deployments by our controllers.\n */\nexport function buildLSP23DeploymentQuery(config: HypersyncQueryConfig) {\n const {\n controllerAddresses,\n profileAddresses,\n fromBlock = 0,\n toBlock,\n } = config\n\n // Prefer querying by profile addresses (more efficient)\n if (profileAddresses && profileAddresses.length > 0) {\n return {\n from_block: fromBlock,\n to_block: toBlock,\n // Query CREATE2 traces where the created address is one of our profiles\n traces: [\n {\n type: ['create2'],\n to: profileAddresses.map((addr) => addr.toLowerCase()),\n },\n ],\n // Also get the transactions to verify they're to the LSP23 factory\n transactions: [\n {\n to: [LSP23_FACTORY_ADDRESS.toLowerCase()],\n },\n ],\n field_selection: {\n transaction: ['hash', 'from', 'to', 'input', 'output', 'block_number'],\n trace: ['transaction_hash', 'type', 'from', 'to'],\n block: ['number', 'timestamp'],\n },\n include_all_blocks: false,\n }\n }\n\n // Fall back to querying by controller addresses (less efficient)\n if (controllerAddresses && controllerAddresses.length > 0) {\n return {\n from_block: fromBlock,\n to_block: toBlock,\n // Query transactions to the LSP23 factory from our controllers\n transactions: [\n {\n from: controllerAddresses.map((addr) => addr.toLowerCase()),\n to: [LSP23_FACTORY_ADDRESS.toLowerCase()],\n },\n ],\n // Also get traces to see the CREATE2 operations\n traces: [\n {\n type: ['create2'],\n // No filter on 'to' - we'll match by transaction hash\n },\n ],\n field_selection: {\n transaction: ['hash', 'from', 'to', 'input', 'output', 'block_number'],\n trace: ['transaction_hash', 'type', 'from', 'to'],\n block: ['number', 'timestamp'],\n },\n include_all_blocks: false,\n }\n }\n\n throw new Error(\n 'Either profileAddresses or controllerAddresses must be provided'\n )\n}\n\n/**\n * Parse Hypersync response to extract LSP23 deployment data\n * @param response - Hypersync API response\n * @param chainId - Chain ID\n * @param controllerAddresses - Optional list of controller addresses to filter by (only return deployments from these deployers)\n */\nexport function parseLSP23DeploymentsFromHypersync(\n response: any,\n chainId: number,\n controllerAddresses?: Address[]\n): LSP23DeploymentData[] {\n const deployments: LSP23DeploymentData[] = []\n\n if (!response?.data) {\n return deployments\n }\n\n // Build a map of block number -> timestamp\n const blockTimestamps = new Map<number, number>()\n for (const block of response.data.blocks || []) {\n blockTimestamps.set(block.number, block.timestamp)\n }\n\n // Build a map of transaction hash -> transaction data\n const txMap = new Map<string, any>()\n for (const tx of response.data.transactions || []) {\n if (\n tx.to?.toLowerCase() === LSP23_FACTORY_ADDRESS.toLowerCase() &&\n tx.input?.startsWith(DEPLOY_ERC1167_PROXIES_SELECTOR)\n ) {\n txMap.set(tx.hash.toLowerCase(), tx)\n }\n }\n\n // Process traces to find CREATE2 operations\n const create2Traces = new Map<string, Address>() // txHash -> created profile address\n\n for (const trace of response.data.traces || []) {\n if (trace.type === 'create2' && trace.to) {\n create2Traces.set(\n trace.transaction_hash.toLowerCase(),\n trace.to as Address\n )\n }\n }\n\n // Create a Set of lowercase controller addresses for efficient filtering\n const controllerSet = controllerAddresses\n ? new Set(controllerAddresses.map((addr) => addr.toLowerCase()))\n : null\n\n // Match transactions with traces\n for (const [txHash, _profileAddress] of create2Traces) {\n const tx = txMap.get(txHash)\n if (!tx) continue\n\n // If controller filtering is enabled, verify the deployer is one of our controllers\n if (controllerSet && !controllerSet.has(tx.from.toLowerCase())) {\n continue\n }\n\n // Decode the transaction\n const decodedInput = decodeDeploymentCalldata(tx.input)\n const decodedOutput = tx.output ? decodeDeploymentOutput(tx.output) : null\n\n if (!decodedInput || !decodedOutput) continue\n\n // Get block timestamp for this transaction\n const blockTimestamp = blockTimestamps.get(tx.block_number) || 0\n\n deployments.push({\n profileAddress: decodedOutput.profileAddress,\n urdAddress: decodedOutput.urdAddress,\n deployerAddress: tx.from as Address, // The controller that deployed this profile\n salt: decodedInput.salt,\n primaryImplementation: decodedInput.primaryImplementation,\n secondaryImplementation: decodedInput.secondaryImplementation,\n postDeploymentModule: decodedInput.postDeploymentModule,\n initializationCalldata: decodedInput.initializationCalldata,\n deploymentCalldata: tx.input, // Full calldata to deployERC1167Proxies\n transactionHash: tx.hash,\n blockNumber: BigInt(tx.block_number),\n blockTimestamp, // Unix timestamp of the block\n chainId,\n })\n }\n\n return deployments\n}\n\n/**\n * Note: Hypersync querying should be done server-side to protect HYPERSYNC_TOKEN.\n * Use the wallet-app API endpoint /api/lsp23Deployments instead of calling Hypersync directly.\n *\n * This module exports:\n * - buildLSP23DeploymentQuery() - Build the Hypersync query structure\n * - parseLSP23DeploymentsFromHypersync() - Parse Hypersync response\n * - decodeDeploymentCalldata() - Decode LSP23 transaction input\n * - decodeDeploymentOutput() - Decode LSP23 transaction output\n */\n","/**\n * JSON serializer/deserializer that preserves BigInt types\n *\n * This implementation uses an 'n' suffix to indicate BigInt values,\n * ensuring that values that were originally BigInt remain BigInt,\n * and values that were originally numbers remain numbers.\n *\n * Example:\n * - BigInt(123) serializes to \"123n\"\n * - Number(123) serializes to 123\n *\n * This is important for blockchain data where some values must be BigInt\n * (e.g., gas, value, nonce) while others should remain as numbers\n * (e.g., array indices, status codes).\n */\n\nexport const JSONbigString = {\n /**\n * Stringify an object, converting BigInt values to strings with 'n' suffix\n */\n stringify: (obj: any, _replacer?: any, space?: string | number): string => {\n return JSON.stringify(\n obj,\n (_key, value) => {\n if (typeof value === 'bigint') {\n return `${value.toString()}n`\n }\n return value\n },\n space\n )\n },\n\n /**\n * Parse a JSON string, converting strings ending with 'n' back to BigInt\n */\n parse: (text: string): any => {\n return JSON.parse(text, (_key, value) => {\n if (typeof value === 'string' && /^\\d+n$/.test(value)) {\n return BigInt(value.slice(0, -1))\n }\n return value\n })\n },\n}\n\nexport default JSONbigString\n","/**\n * @lukso/decoder - Consumer API\n *\n * This is the main entry point for consumers of the decoder.\n * Import data provider functions from '@lukso/transaction-decoder/data' instead.\n */\n\nimport { consumerModel, createGlobalInstance } from './core/instance'\n\n// Export all types that consumers need\nexport type {\n AddressState,\n DataKey,\n EnhancedInfo,\n IDataModelConsumer,\n TransactionState,\n} from './types'\n// DecoderResult is exported from decoder/types via the decoder imports below\n\n// Export all consumer methods directly\nexport const getTransaction = consumerModel.getTransaction.bind(consumerModel)\nexport const getTransactionByKey =\n consumerModel.getTransactionByKey.bind(consumerModel)\nexport const getTransactionsByIndex =\n consumerModel.getTransactionsByIndex.bind(consumerModel)\nexport const getTransactionHashByIndex =\n consumerModel.getTransactionHashByIndex.bind(consumerModel)\nexport const getTransactionCount =\n consumerModel.getTransactionCount.bind(consumerModel)\nexport const getDecodedCount = consumerModel.getDecodedCount.bind(consumerModel)\nexport const getDecodedTransactions =\n consumerModel.getDecodedTransactions.bind(consumerModel)\nexport const getTransactionsInOrder =\n consumerModel.getTransactionsInOrder.bind(consumerModel)\n\n// Address methods\nexport const getAddress = consumerModel.getAddress.bind(consumerModel)\nexport const getSignal = consumerModel.getSignal.bind(consumerModel)\nexport const subscribe = consumerModel.subscribe.bind(consumerModel)\nexport const getState = consumerModel.getState.bind(consumerModel)\nexport const hasData = consumerModel.hasData.bind(consumerModel)\nexport const getData = consumerModel.getData.bind(consumerModel)\nexport const isLoading = consumerModel.isLoading.bind(consumerModel)\nexport const getError = consumerModel.getError.bind(consumerModel)\n\n// Collection methods\nexport const getAllKeys = consumerModel.getAllKeys.bind(consumerModel)\nexport const getAllData = consumerModel.getAllData.bind(consumerModel)\nexport const getAllTransactions =\n consumerModel.getAllTransactions.bind(consumerModel)\n\n// Also export the consumer model instance for advanced usage\nexport { consumerModel }\n\n// Export the function to create global instance (for manual setup)\nexport { createGlobalInstance }\n\n// Export client utilities\nexport {\n createApiAddressResolver,\n type ResolveAddressesOptions,\n type ResolveAddressesResponse,\n resolveAddresses,\n} from './client/resolveAddresses'\n// Export address collection utilities from core\nexport { collectDataKeys } from './core/addressCollector'\nexport {\n AddressResolver,\n type AddressResolverConfig,\n} from './core/addressResolver'\n// Export integration classes\nexport {\n type AddressCache,\n createMemoryAddressCache,\n DecoderIntegration,\n type DecoderIntegrationConfig,\n} from './core/integrateDecoder'\n// Export aggregation utilities\nexport {\n type AggregationState,\n PluginAggregationEngine,\n standardAggregation,\n} from './decoder/aggregation'\nexport type {\n AddressResolver as TransactionAddressResolver,\n TransactionDecoderResult,\n} from './decoder/decodeTransaction'\n// Export decoder integration utilities\nexport {\n decodeTransaction,\n decodeTransactionAsync,\n} from './decoder/decodeTransaction'\n// Export plugin development utilities\n// Export default plugins to ensure they're imported and register themselves\nexport {\n createAggregationKey,\n defaultPlugins,\n defaultSchemaPlugins,\n standardPlugin,\n standardSchemaPlugin,\n} from './decoder/plugins'\nexport type {\n PluginMetadata,\n SchemaPluginMetadata,\n} from './decoder/registry'\nexport {\n createNamedPlugin,\n createNamedSchemaPlugin,\n pluginRegistry,\n registerPlugin,\n registerSchemaPlugin,\n} from './decoder/registry'\nexport type {\n Aggregation,\n DecodeEventCallback,\n DecodeEventResult,\n DecoderPlugin,\n DecoderResult,\n EnhancerCallback,\n PluginOptions,\n ResultAggregate,\n ResultCreate,\n ResultError,\n ResultExecute,\n ResultExecuteBatch,\n ResultFollowProfile,\n ResultGrafitti,\n ResultRaw,\n ResultSetData,\n ResultSetDataBatch,\n ResultWrapper,\n SchemaPlugin,\n} from './decoder/types'\n// Export utility functions\nexport { getArgByName, needsEnhancement } from './decoder/utils'\n// Export LSP23 deployment resolver utilities\n// Note: Actual Hypersync querying should be done via wallet-app API to protect HYPERSYNC_TOKEN\nexport {\n buildLSP23DeploymentQuery,\n DEPLOY_ERC1167_PROXIES_SELECTOR,\n decodeDeploymentCalldata,\n decodeDeploymentOutput,\n extractControllersFromInitCalldata,\n type HypersyncQueryConfig,\n LSP23_FACTORY_ADDRESS,\n type LSP23DeploymentData,\n parseLSP23DeploymentsFromHypersync,\n} from './server/lsp23Resolver'\n// Export shared address resolver utilities\nexport {\n type AssetData,\n fetchMultipleAddresses,\n fetchProfilesByControllers,\n getGraphQLEndpoint,\n getImage,\n type ImageData,\n type ImageURL,\n type LinkData,\n type ProfileData,\n type TFetchAddressData,\n type TokenData,\n} from './shared/addressResolver'\n// Export cache utilities\nexport {\n type AddressIdentityCache,\n createMemoryAddressIdentityCache,\n dataKeyToString,\n getDataKeyCacheKey,\n parseDataKey,\n} from './shared/cache'\n// Export debug utility for edge/worker environments\nexport { createDebug } from './utils/debug'\n// Export JSON BigInt serializer/deserializer\nexport { JSONbigString } from './utils/json-bigint'\n// Release update\n// build 1\n"],"mappings":";;;;;;;;;;;;;;;AA6CA,SAAS,UAAa,OAA4C;AAChE,SAAO,iBAAiB;AAC1B;AAFS;AAOF,SAAS,mBAAmB,KAAsB;AACvD,SAAO,IAAI,YAAY;AACzB;AAFgB;AAST,SAAS,gBAAgB,SAA0B;AACxD,SAAO;AACT;AAFgB;AAST,SAAS,aAAa,KAAsB;AAEjD,SAAO;AACT;AAHgB;AAQT,SAAS,iCACd,QAAgB,MAAO,KAAK,GACN;AACtB,QAAM,QAAQ,oBAAI,IAAqD;AAEvE,SAAO;AAAA,IACL,IAAI,KAAwC;AAC1C,YAAM,WAAW,mBAAmB,GAAG;AACvC,YAAM,QAAQ,MAAM,IAAI,QAAQ;AAEhC,UAAI,CAAC,MAAO,QAAO;AAEnB,UAAI,KAAK,IAAI,IAAI,MAAM,SAAS;AAC9B,cAAM,OAAO,QAAQ;AACrB,eAAO;AAAA,MACT;AAEA,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,IAAI,KAAc,OAA2B;AAC3C,YAAM,WAAW,mBAAmB,GAAG;AACvC,YAAM,IAAI,UAAU;AAAA,QAClB,MAAM;AAAA,QACN,SAAS,KAAK,IAAI,IAAI;AAAA,MACxB,CAAC;AAAA,IACH;AAAA,IAEA,IAAI,KAAuB;AACzB,YAAM,WAAW,mBAAmB,GAAG;AACvC,YAAM,QAAQ,MAAM,IAAI,QAAQ;AAEhC,UAAI,CAAC,MAAO,QAAO;AAEnB,UAAI,KAAK,IAAI,IAAI,MAAM,SAAS;AAC9B,cAAM,O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