@@ -5,32 +5,26 @@ class ProtocolExtractor
55 COLLECTIONS_DEFAULT_PARAMS = Erc721EthscriptionsCollectionParser ::DEFAULT_PARAMS
66 GENERIC_DEFAULT_PARAMS = GenericProtocolExtractor ::DEFAULT_PARAMS
77
8- def self . extract ( content_uri )
9- return nil unless content_uri . is_a? ( String )
10-
11- # Centralized validation: must be a valid data URI and JSON payload
12- return nil unless DataUri . valid? ( content_uri )
13- begin
14- payload = DataUri . new ( content_uri ) . decoded_data
15- rescue StandardError
16- return nil
17- end
18- return nil unless payload . start_with? ( '{' )
8+ def self . extract ( content_uri , ethscription_id : nil )
9+ # begin
10+ # payload = DataUri.new(content_uri).decoded_data
11+ # rescue StandardError
12+ # return nil
13+ # end
14+ # return nil unless payload.start_with?('{')
1915
2016 # Try extractors in order of strictness
2117 # 1. Token protocol (most strict - exact character position matters)
22- # 2. Collections protocol (strict - exact key order required) - gated by ENABLE_COLLECTIONS
18+ # 2. Collections protocol (strict - exact key order required)
2319 # 3. Generic protocol (flexible - for all other protocols) - gated by ENABLE_GENERIC_PROTOCOLS
2420
2521 # Try token extractor first (most strict)
2622 result = try_token_extractor ( content_uri )
2723 return result if result
2824
2925 # Try collections extractor next (if enabled)
30- if ENV [ 'ENABLE_COLLECTIONS' ] == 'true'
31- result = try_collections_extractor ( content_uri )
32- return result if result
33- end
26+ result = try_collections_extractor ( content_uri , ethscription_id : ethscription_id )
27+ return result if result
3428
3529 # Try generic extractor last (if enabled)
3630 if ENV [ 'ENABLE_GENERIC_PROTOCOLS' ] == 'true'
@@ -63,9 +57,12 @@ def self.try_token_extractor(content_uri)
6357 end
6458 end
6559
66- def self . try_collections_extractor ( content_uri )
60+ def self . try_collections_extractor ( content_uri , ethscription_id : nil )
6761 # Erc721EthscriptionsCollectionParser returns [''.b, ''.b, ''.b] if no match
68- protocol , operation , encoded_data = Erc721EthscriptionsCollectionParser . extract ( content_uri )
62+ protocol , operation , encoded_data = Erc721EthscriptionsCollectionParser . extract (
63+ content_uri ,
64+ ethscription_id : ethscription_id
65+ )
6966
7067 # Check if extraction succeeded
7168 if protocol != '' . b && operation != '' . b
@@ -129,8 +126,8 @@ def self.encode_token_params(params)
129126
130127 # Get protocol data formatted for L2 calldata
131128 # Returns [protocol, operation, encoded_data] for contract consumption
132- def self . for_calldata ( content_uri )
133- result = extract ( content_uri )
129+ def self . for_calldata ( content_uri , ethscription_id : nil )
130+ result = extract ( content_uri , ethscription_id : ethscription_id )
134131
135132 if result . nil?
136133 # No protocol detected - return empty protocol params
0 commit comments