Skip to content

Commit

Permalink
feat: renamed generateFrameNextMetadata to getFrameMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Zizzamia committed Jan 27, 2024
1 parent 79a247b commit 28389e0
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-lobsters-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@coinbase/onchainkit": patch
---

- **feat**: renamed `generateFrameNextMetadata` to `getFrameMetadata`
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ pnpm add @coinbase/onchainkit

<br />

## FrameKit utilities
## FrameKit 🖼️

### generateFrameNextMetadata
### getFrameMetadata()

Next App `page.ts`
With Next.js App routing, use the `getFrameMetadata` inside your `page.ts` to get the metadata need it for your Frame.

```ts
// Steps 1. import generateFrameNextMetadata from @coinbase/onchainkit
import { generateFrameNextMetadata } from '@coinbase/onchainkit';
import { getFrameMetadata } from '@coinbase/onchainkit';
import type { Metadata } from 'next';
import HomePage from './home';

// Step 2. Use generateFrameNextMetadata to shape your Frame metadata
const frameMetadata = generateFrameNextMetadata({
const frameMetadata = getFrameMetadata({
buttons: ['boat'],
image: 'https://build-onchain-apps.vercel.app/release/v-0-17.png',
post_url: 'https://build-onchain-apps.vercel.app/api/frame',
Expand All @@ -51,3 +51,8 @@ export default function Page() {
return <HomePage />;
}
```

`getFrameMetadata` params
- `buttons`: A list of strings which are the label for the buttons in the frame (max 4 buttons).
- `image`: An image which must be smaller than 10MB and should have an aspect ratio of 1.91:1
- `post_url`: A valid POST URL to send the Signature Packet to.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coinbase/onchainkit",
"version": "0.1.1",
"version": "0.1.2",
"repository": "https://github.com/coinbase/onchainkit.git",
"license": "MIT",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/**
* This function generates the metadata for a Farcaster Frame.
* @param param0
* @returns
* @param buttons: An array of button names.
* @param image: The image to use for the frame.
* @param post_url: The URL to post the frame to.
* @returns The metadata for the frame.
*/
export const generateFrameNextMetadata = function ({
export const getFrameMetadata = function ({
buttons,
image,
post_url,
Expand Down
1 change: 0 additions & 1 deletion src/core/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
const version = '0.1.2';

// TODO remove this line from here
export { generateFrameNextMetadata } from './core/generateFrameNextMetadata';
export { getFrameMetadata } from './core/getFrameMetadata';

0 comments on commit 28389e0

Please sign in to comment.