Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.3.0 #166

Merged
merged 19 commits into from
Dec 23, 2024
Merged

1.3.0 #166

Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["framekit", "docs", "@xmtp/tsconfig"]
"ignore": ["baselinks", "client", "docs", "@xmtp/tsconfig"]
}
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ A set of tools for AI developers to build on top of [XMTP](https://xmtp.org)

### Plugins

- [`framekit`](/packages/framekit): A suite for backend frames
- [`xmtp`](/packages/xmtp/): A node js wrapper for AI agents.
- [`xmtp-client`](/packages/xmtp-client/): A client plugin for interacting with hte backend.
- [`xmtp`](/packages/xmtp/): An xmtp node js wrapper for AI agents.
- [`xmtp-e2ee`](/packages/xmtp-e2ee/): A js wrapper for AI agents.

### Other

- [`client`](/packages/client): A simple E2EE encrypted agent inbox
- [`baselinks`](/packages/baselinks): A suite of coinbase wallet usdc links

## Contributing

Expand Down
6 changes: 3 additions & 3 deletions community/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"author": "ephemeraHQ"
},
{
"href": "/plugins/framekit",
"title": "FrameKit",
"description": "Use FrameKit to send frames.",
"href": "/plugins/baselinks",
"title": "Baselinks",
"description": "Use Baselinks to send frames.",
"icon": "🖼️",
"author": "ephemeraHQ"
},
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
"shared/*"
],
"scripts": {
"agent": "yarn build:xmtp-e2ee && cd packages/client && yarn dev",
"build": "yarn build:message-kit && yarn build:packages && yarn build:templates",
"build:client": "turbo run build --filter=./packages/client --force",
"build:message-kit": "turbo run build --filter=./packages/message-kit --force",
"build:packages": "turbo run build --filter='./packages/*' --filter='!./packages/message-kit'",
"build:templates": "turbo run build --filter='./templates/*'",
"build:xmtp": "turbo run build --filter=./packages/xmtp --force",
"build:xmtp-client": "turbo run build --filter=./packages/xmtp-client --force",
"build:xmtp-e2ee": "turbo run build --filter=./packages/xmtp-e2ee --force",
"bump": "node scripts/update-version.js -t patch",
"changeset": "yarn copy && changeset add --type patch",
"clean": "turbo run clean && rm -rf node_modules && rm -rf .turbo && rm -rf packages/message-kit/dist && rm -rf packages/message-kit/.turbo && rm -rf packages/docs/dist && yarn cache clean",
Expand All @@ -24,15 +26,15 @@
"docs": "cd packages/docs && yarn dev",
"domain": "ngrok http --hostname=frames.ngrok.app 3000",
"format": "turbo run format",
"framekit": "yarn build:xmtp-client && cd packages/framekit && yarn dev",
"links": " cd packages/baselinks && yarn dev",
"play": "cd templates/playground && yarn dev",
"publish": "yarn install && yarn build && yarn copy && node scripts/publish.js",
"templates": "node scripts/devTemplates.js",
"test": "FORCE_COLOR=1 turbo run test --force --concurrency=1",
"test:client": "cd packages/xmtp/tests && yarn test:client",
"test:flow": "cd packages/message-kit/tests && yarn test:flow",
"test:framekit": "cd packages/message-kit/tests && yarn test:framekit",
"test:intent": "cd packages/message-kit/tests && yarn test:intent",
"test:links": "cd packages/message-kit/tests && yarn test:links",
"test:parsing": "cd packages/message-kit/tests && yarn test:parsing",
"test:prompt": "cd packages/message-kit/tests && yarn test:prompt",
"typecheck": "FORCE_COLOR=1 turbo run typecheck"
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions packages/baselinks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Baselinks

See [Baselinks](https://message-kit.org/plugins/baselinks) in MessageKit.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "framekit",
"name": "baselinks",
"version": "0.1.0",
"private": true,
"scripts": {
Expand All @@ -9,7 +9,6 @@
"start": "next start"
},
"dependencies": {
"@farcaster/frame-sdk": "0.0.10",
"@types/next": "^9.0.0",
"cheerio": "^1.0.0",
"ethers": "^6.13.4",
Expand All @@ -19,8 +18,7 @@
"qrcode.react": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "^2.21.45",
"xmtp-client": "workspace:*"
"viem": "^2.21.45"
},
"devDependencies": {
"@types/node": "^20",
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function GET(req: NextRequest) {
try {
let searchParams = req.nextUrl.searchParams;
let params = {
url: process.env.NEXT_PUBLIC_URL,
url: process.env.NEXT_PUBLIC_URL ?? "http://localhost:3000",
amount: searchParams.get("amount") ?? "1",
recipientAddress:
searchParams.get("recipientAddress") ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function GET(req: NextRequest) {
let searchParams = req.nextUrl.searchParams;

const params = {
url: process.env.NEXT_PUBLIC_URL,
url: process.env.NEXT_PUBLIC_URL ?? "http://localhost:3000",
balance:
searchParams.get("balance") ?? searchParams.get("Balance") ?? "0",
networkId:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default async function Home({
const resolvedSearchParams = await searchParams; // Await the promises
//tes sd
const params = {
url: `${process.env.NEXT_PUBLIC_URL}`,
url: process.env.NEXT_PUBLIC_URL ?? "http://localhost:3000",
recipientAddress:
(resolvedSearchParams?.recipientAddress as string) ||
"0x93E2fc3e99dFb1238eB9e0eF2580EFC5809C7204",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
:root {
--background: #000000;
--background: #ffffff;
--foreground: #ffffff;
--accent: #fa6977;
--accent: #0052ff;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #000000;
--background: #ffffff;
--foreground: #ffffff;
--accent: #0052ff;
}
}

Expand All @@ -21,12 +22,13 @@ body {
}

body {
color: var(--foreground);
color: var(--accent);
background: var(--background);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
line-height: 1.5;
}

.container {
Expand All @@ -47,18 +49,24 @@ body {
}

.title {
font-size: 2.25rem;
font-weight: bold;
text-align: center;
margin-bottom: 2rem;
font-family: var(--font-geist-sans);
}

.form-container {
background-color: #111111;
width: 800px;
background-color: var(--background);
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
padding: 1.5rem;
margin-bottom: 1rem;
}
@media (max-width: 799px) {
.form-container {
width: 90%;
}
}

.form-group {
Expand All @@ -69,19 +77,20 @@ body {
display: block;
font-size: 0.875rem;
font-weight: 500;
color: #ffffff;
color: var(--accent);
margin-bottom: 0.5rem;
}

.input,
.select {
width: 100%;
padding: 0.5rem 0.75rem;
border: 1px solid #333333;
background-color: #000000;
color: #ffffff;
width: 100% !important;
padding: 0.3rem;
border: 1px solid var(--accent);
background-color: var(--background);
color: var(--accent);
border-radius: 0.375rem;
margin-top: 0.25rem;
display: block;
}

.submit-button {
Expand All @@ -95,7 +104,7 @@ body {
}

.submit-button:hover {
background-color: #e55967;
background-color: #0033a1;
}

.url-container {
Expand All @@ -109,42 +118,14 @@ body {

.copy-button {
padding: 0.5rem 1rem;
background-color: #111111;
color: #ffffff;
background-color: var(--background);
color: var(--accent);
border-radius: 0.375rem;
border: none;
cursor: pointer;
margin-top: 0.25rem;
}

.copy-button:hover {
background-color: #222222;
}

/* For any monospace text, like the generated URL */
.url-container .input {
font-family: var(--font-geist-mono);
}

.powered-by {
text-align: center;
align-items: center;
font-family: var(--font-geist-sans);
color: #ffffff;
}

.powered-by a {
color: var(--accent);
text-decoration: none;
font-weight: 500;
}

.powered-by a:hover {
text-decoration: underline;
}

.nextjs-toast,
nextjs-portal,
.nextjs-static-indicator-toast-wrapper {
display: none !important;
background-color: var(--background);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default async function Home({
}) {
const resolvedSearchParams = await searchParams; // Await the promise

const url = `${process.env.NEXT_PUBLIC_URL || "http://localhost:3000"}`;
const url = process.env.NEXT_PUBLIC_URL || "http://localhost:3000";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Maintain consistency in URL fallback handling

For consistency with other files in the codebase, consider using the nullish coalescing operator (??) instead of logical OR (||).

-  const url = process.env.NEXT_PUBLIC_URL || "http://localhost:3000";
+  const url = process.env.NEXT_PUBLIC_URL ?? "http://localhost:3000";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const url = process.env.NEXT_PUBLIC_URL || "http://localhost:3000";
const url = process.env.NEXT_PUBLIC_URL ?? "http://localhost:3000";

const collectionId =
(resolvedSearchParams.collectionId as string) ||
"0x73a333cb82862d4f66f0154229755b184fb4f5b0";
Expand Down
115 changes: 115 additions & 0 deletions packages/baselinks/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
"use client";
import { GeistMono as geistMono } from "geist/font/mono";
import { GeistSans as geistSans } from "geist/font/sans";
import Head from "next/head";
import UrlGenerator from "../components/UrlGenerator";
import { useState } from "react";

export default function Home() {
const url = `${process.env.NEXT_PUBLIC_URL || "http://localhost:3000"}`;
let image = `${url}/hero.jpg`;
const [formData, setFormData] = useState({
txLink:
"https://sepolia.basescan.org/tx/0x2ec524f740c5831b16ca84053f9b6ae3e3923d3399d527113982e884a75e6bfa",
networkLogo: "https://avatars.githubusercontent.com/u/108554348?s=280&v=4",
amount: "1",
networkName: "Base",
tokenName: "usdc",
});
Comment on lines +11 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove hardcoded transaction link

Hardcoding a specific transaction link in the initial state is not recommended.

   const [formData, setFormData] = useState({
-    txLink:
-      "https://sepolia.basescan.org/tx/0x2ec524f740c5831b16ca84053f9b6ae3e3923d3399d527113982e884a75e6bfa",
-    networkLogo: "https://avatars.githubusercontent.com/u/108554348?s=280&v=4",
+    txLink: '',
+    networkLogo: '',
     amount: "1",
     networkName: "Base",
     tokenName: "usdc",
   });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const [formData, setFormData] = useState({
txLink:
"https://sepolia.basescan.org/tx/0x2ec524f740c5831b16ca84053f9b6ae3e3923d3399d527113982e884a75e6bfa",
networkLogo: "https://avatars.githubusercontent.com/u/108554348?s=280&v=4",
amount: "1",
networkName: "Base",
tokenName: "usdc",
});
const [formData, setFormData] = useState({
txLink: '',
networkLogo: '',
amount: "1",
networkName: "Base",
tokenName: "usdc",
});


const [generatedUrl, setGeneratedUrl] = useState("");

const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
const baseUrl = window.location.origin;

// Create URLSearchParams object to properly encode parameters
const params = new URLSearchParams({
txLink: formData.txLink,
});

setGeneratedUrl(`${baseUrl}/receipt?txLink=${formData.txLink}`);
};
Comment on lines +22 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Improve URL generation security

The URL generation needs additional security measures.

   const handleSubmit = (e: React.FormEvent) => {
     e.preventDefault();
-    const baseUrl = window.location.origin;
+    // Validate and sanitize the base URL
+    const baseUrl = new URL(window.location.origin).origin;
 
-    // Create URLSearchParams object to properly encode parameters
-    const params = new URLSearchParams({
-      txLink: formData.txLink,
-    });
+    try {
+      // Validate txLink is a valid URL
+      new URL(formData.txLink);
+      setGeneratedUrl(`${baseUrl}/receipt?txLink=${encodeURIComponent(formData.txLink)}`);
+    } catch (error) {
+      console.error('Invalid transaction link:', error);
+      // Optional: Show user-friendly error message
+    }
-    setGeneratedUrl(`${baseUrl}/receipt?txLink=${formData.txLink}`);
   };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
const baseUrl = window.location.origin;
// Create URLSearchParams object to properly encode parameters
const params = new URLSearchParams({
txLink: formData.txLink,
});
setGeneratedUrl(`${baseUrl}/receipt?txLink=${formData.txLink}`);
};
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
// Validate and sanitize the base URL
const baseUrl = new URL(window.location.origin).origin;
try {
// Validate txLink is a valid URL
new URL(formData.txLink);
setGeneratedUrl(`${baseUrl}/receipt?txLink=${encodeURIComponent(formData.txLink)}`);
} catch (error) {
console.error('Invalid transaction link:', error);
// Optional: Show user-friendly error message
}
};


return (
<>
<Head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta property="og:title" content="MessageKit" />
<meta property="og:image" content={image} />
<meta property="fc:frame" content="vNext" />
<meta property="of:version" content="vNext" />
<meta property="of:accepts:xmtp" content="vNext" />
<meta property="of:image" content={image} />
<meta property="fc:frame:image" content={image} />
<meta property="fc:frame:button:1" content="Docs" />
<meta property="fc:frame:button:1:action" content="link" />
<meta
property="fc:frame:button:1:target"
content="https://message-kit.org/"
/>

<meta property="fc:frame:button:2" content="Drop a ⭐️" />
<meta property="fc:frame:button:2:action" content="link" />
<meta
property="fc:frame:button:2:target"
content="https://github.com/ephemeraHQ/message-kit"
/>
</Head>
<body>
<div
className={`container ${geistSans.variable} ${geistMono.variable}`}
style={{
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
height: "100vh",
padding: "20px",
boxSizing: "border-box",
}}>
<div
className="wrapper"
style={{
display: "flex",
alignItems: "center",
flexDirection: "column",
gap: "20px",
textAlign: "center",
maxWidth: "800px",
width: "100%",
}}>
<div style={{}}>
<h1
className={`title ${geistSans.className}`}
style={{ marginBottom: "20px" }}>
BaseLinks
</h1>
<p
className={`description ${geistSans.className}`}
style={{ marginBottom: "40px" }}>
Generate payment links with QR code for coinbase wallet
</p>
<div
style={{
display: "flex",
justifyContent: "flex-start",
flexDirection: "column",
}}>
<UrlGenerator
params={{
recipientAddress: "",
amount: 0,
chainId: "1",
tokenAddress: "",
}}
/>
</div>
</div>
</div>
</div>
</body>
</>
);
}
Loading
Loading