libruarySearchByAddress
    Updated 2024-09-22
    WITH latest_transfers AS (
    SELECT
    nft_to_address AS owner,
    tokenId AS token_id,
    block_timestamp,
    ROW_NUMBER() OVER (PARTITION BY tokenId ORDER BY block_timestamp DESC) AS rn
    FROM
    ethereum.nft.ez_nft_transfers
    WHERE
    nft_address = '0x51bb4c8bb4901d6aa061282cd7ed916eec715a29'
    AND nft_to_address IS NOT NULL
    ),
    ranked_metadata AS (
    SELECT
    meta.tokenid_name AS token_name,
    -- Override descriptions for specific tokenids
    CASE
    WHEN meta.tokenid = 1 THEN 'This uncommon egg is bubbling with cosmic energy. This egg offers the texture of the stars, but rub carefully—its power might just glitch your reality.'
    WHEN meta.tokenid = 1171 THEN 'This egg has felt the turmoil of creation. And maybe, just maybe, it will feel it once more.'
    WHEN meta.tokenid = 2339 THEN 'This egg has weathered the chaos of creation. And maybe it will weather the storm once more.'
    WHEN meta.tokenid = 2348 THEN 'This egg has witnessed the chaos of creation. And perhaps it stands ready to witness it all over again.'
    WHEN meta.tokenid = 2349 THEN 'This egg has been shaped by the chaos of creation. And perhaps it will be reshaped by it once more.'
    WHEN meta.tokenid = 2350 THEN 'This egg has glimpsed the chaos of creation. And perhaps it is destined to glimpse it again.'
    WHEN meta.tokenid = 2351 THEN 'This egg has encountered the chaos of creation. And it may well encounter it once more.'
    WHEN meta.tokenid = 2352 THEN 'This egg has braved the chaos of creation. And it might just brave it once again.'
    WHEN meta.tokenid = 2353 THEN 'This uncommon egg is bubbling with cosmic energy. This egg offers the texture of the stars, but rub carefully—its power might just glitch your reality.'
    WHEN meta.tokenid = 2354 THEN 'This egg has endured the storm of creation. And perhaps it is destined to endure it once more.'
    WHEN meta.tokenid = 2355 THEN 'This egg has encountered the chaos of creation. And it may well encounter it once more.'
    WHEN meta.tokenid = 2359 THEN 'This egg has seen the birth pangs of creation. And it might witness them all over again.'
    WHEN meta.tokenid = 2360 THEN 'This egg has observed the chaos of creation. And it may be destined to observe it yet again.'
    WHEN meta.tokenid = 2361 THEN 'This egg has weathered the chaos of creation. And maybe it will weather the storm once more.'
    WHEN meta.tokenid = 2362 THEN 'This egg has survived the chaos of creation. And it could be poised to survive it yet again.'
    WHEN meta.tokenid = 3106 THEN 'This egg has glimpsed the chaos of creation. And perhaps it is destined to glimpse it again.'
    ELSE meta.tokenid_description -- Use the original description for all other tokenids
    END AS description,
    DENSE_RANK() OVER (ORDER BY meta.tokenid_name, meta.tokenid_description) AS edition_id, -- Generate edition_id