Skip to content

Commit

Permalink
fix: pr comment
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfurlong committed Nov 27, 2023
1 parent b48275e commit 73aea35
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 70 deletions.
5 changes: 0 additions & 5 deletions examples/api/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,4 @@ module.exports = {
// Fixes https://discord.com/channels/896185694857343026/1174716239508156496
"@lit-protocol/bls-sdk",
],

// experimental: {
// esmExternals: "loose",
// },
// experimental.esmExternals: 'loose'
};
74 changes: 52 additions & 22 deletions examples/api/src/app/api/cast-embeds-metadata/by-url/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,37 @@ export async function POST(request: NextRequest) {
"url_metadata.nft_collection_id",
"nft_collections.id"
)
.selectAll()
.select([
/* Select all columns with aliases to prevent collisions */

// URL metadata
"url_metadata.image_url as url_image_url",
"url_metadata.image_height as url_image_height",
"url_metadata.image_width as url_image_width",
"url_metadata.alt as url_alt",
"url_metadata.url as url_url",
"url_metadata.description as url_description",
"url_metadata.title as url_title",
"url_metadata.publisher as url_publisher",
"url_metadata.logo_url as url_logo_url",
"url_metadata.mime_type as url_mime_type",
"url_metadata.nft_collection_id as nft_collection_id",
"url_metadata.nft_metadata_id as nft_metadata_id",

// NFT Collection metadata
"nft_collections.creator_address as collection_creator_address",
"nft_collections.description as collection_description",
"nft_collections.image_url as collection_image_url",
"nft_collections.item_count as collection_item_count",
"nft_collections.mint_url as collection_mint_url",
"nft_collections.name as collection_name",
"nft_collections.open_sea_url as collection_open_sea_url",
"nft_collections.owner_count as collection_owner_count",

// NFT metadata
"nft_metadata.token_id as nft_token_id",
"nft_metadata.media_url as nft_media_url",
])
.execute();

const rowsFormatted = metadata.map((row) => {
Expand All @@ -41,44 +71,44 @@ export async function POST(request: NextRequest) {
const chain = chainById[chainId];

nftMetadata = {
mediaUrl: row.media_url || undefined,
tokenId: row.token_id || undefined,
mediaUrl: row.nft_media_url || undefined,
tokenId: row.nft_token_id || undefined,
collection: {
chain: chain.network,
contractAddress,
creatorAddress: row.creator_address,
description: row.description,
creatorAddress: row.collection_creator_address,
description: row.collection_description,
id: row.nft_collection_id,
imageUrl: row.image_url,
itemCount: row.item_count,
mintUrl: row.mint_url,
name: row.name,
openSeaUrl: row.open_sea_url || undefined,
ownerCount: row.owner_count || undefined,
imageUrl: row.collection_image_url,
itemCount: row.collection_item_count,
mintUrl: row.collection_mint_url,
name: row.collection_name,
openSeaUrl: row.collection_open_sea_url || undefined,
ownerCount: row.collection_owner_count || undefined,
creator: undefined, // TODO: Look up farcaster user by FID
},
};
}

const urlMetadata: UrlMetadata = {
image: row.image_url
image: row.url_image_url
? {
url: row.image_url,
height: row.image_height || undefined,
width: row.image_width || undefined,
url: row.url_image_url,
height: row.url_image_height || undefined,
width: row.url_image_width || undefined,
}
: undefined,
alt: row.alt || undefined,
description: row.description || undefined,
title: row.title || undefined,
publisher: row.publisher || undefined,
logo: row.logo_url ? { url: row.logo_url } : undefined,
mimeType: row.mime_type || undefined,
alt: row.url_alt || undefined,
description: row.url_description || undefined,
title: row.url_title || undefined,
publisher: row.url_publisher || undefined,
logo: row.url_logo_url ? { url: row.url_logo_url } : undefined,
mimeType: row.url_mime_type || undefined,
nft: nftMetadata,
};

return {
url: row.url,
url: row.url_url,
urlMetadata,
};
});
Expand Down
31 changes: 0 additions & 31 deletions examples/api/src/app/api/lit-protocol-renderer/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NextRequest, NextResponse } from "next/server";
import * as LitJsSdk from "@lit-protocol/lit-node-client";

async function getLitNodeClient() {
// Initialize LitNodeClient
const litNodeClient = new LitJsSdk.LitNodeClient({
alertWhenUnauthorized: false,
litNetwork: "cayenne",
Expand Down Expand Up @@ -41,37 +40,7 @@ async function decryptData({
return decryptedString;
}

// async function retrieveFromIrys(id: string) {
// const gatewayAddress = "https://gateway.irys.xyz/";
// const url = `${gatewayAddress}${id}`;

// try {
// const response = await fetch(url);

// if (!response.ok) {
// throw new Error(`Failed to retrieve data for ID: ${id}`);
// }

// const data = await response.json();
// return [
// data.cipherText,
// data.dataToEncryptHash,
// data.accessControlConditions,
// ];
// } catch (e) {
// console.log("Error retrieving data ", e);
// }
// }

export async function POST(request: NextRequest) {
// const { authSig, irysTransactionId } = await request.json();

// const [
// cipherTextRetrieved,
// dataToEncryptHashRetrieved,
// accessControlConditions,
// ] = await retrieveFromIrys(irysTransactionId);

const {
authSig,
payload: {
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ type OpenLinkAction = BaseAction & {
};

export type EthPersonalSignData = {
// domain: string;
// address: string;
statement: string;
// uri: string;
version: string;
chainId: string;
};
Expand Down
18 changes: 14 additions & 4 deletions packages/core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1212,10 +1212,20 @@ export class Renderer {
{
type: "select",
isClearable: el.isClearable || false,
// perhaps this.replaceInlineContext?
placeholder: el.placeholder,
// perhaps map this.replaceInlineContext over labels?
options: el.options,
placeholder: el.placeholder
? this.replaceInlineContext(el.placeholder)
: el.placeholder,
options: el.options.map(
(
option
): {
label: string;
value: any;
} => ({
value: option.value,
label: this.replaceInlineContext(option.label),
})
),
events: {
onChange: (value: string) => {
if (el.ref) {
Expand Down
8 changes: 4 additions & 4 deletions packages/miniapp-registry/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import NFTMinter from "@miniapps/nft-minter";
import UrlRender from "@miniapps/url-render";
import ImageRender from "@miniapps/image-render";
import ChatGPTShorten from "@miniapps/chatgpt-shorten";
import LitProtocol from "@miniapps/lit-protocol";
import LitProtocolRenderer from "@miniapps/lit-protocol-renderer";
// import LitProtocol from "@miniapps/lit-protocol";
// import LitProtocolRenderer from "@miniapps/lit-protocol-renderer";
import ZoraNftMinter from "@miniapps/zora-nft-minter";

export const allMiniApps = [
Expand All @@ -23,8 +23,8 @@ export const allMiniApps = [
ImageRender,
ChatGPTShorten,
ChatGPT,
LitProtocol,
LitProtocolRenderer,
// LitProtocol,
// LitProtocolRenderer,
];

export const creationMiniApps: ModManifest[] = allMiniApps.filter(
Expand Down
4 changes: 3 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"MICROLINK_API_KEY",
"DATABASE_URL",
"NODE_ENV",
"NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID"
"NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID",
"GATEWAY_URL",
"SIMPLEHASH_API_KEY"
]
}

0 comments on commit 73aea35

Please sign in to comment.