From 29c0fa30aac8bce9c8d4e2230df54d87e61e2a1b Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Wed, 14 Aug 2024 15:09:06 -0700 Subject: [PATCH 1/8] updated FrameButtonMetadata to allow custom postUrl --- src/frame/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frame/types.ts b/src/frame/types.ts index 4b0af76e2a..e7f48912f8 100644 --- a/src/frame/types.ts +++ b/src/frame/types.ts @@ -95,6 +95,7 @@ export type FrameButtonMetadata = | { action?: 'post' | 'post_redirect'; label: string; + postUrl?: string; target?: string; } | { From 6c31bf78cc42b8bfa7b3a47a83e455ea0be4d2c2 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Wed, 14 Aug 2024 15:09:30 -0700 Subject: [PATCH 2/8] updated logic to handle post-button postUrl setting --- src/frame/utils/getFrameMetadata.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frame/utils/getFrameMetadata.ts b/src/frame/utils/getFrameMetadata.ts index 23e75b4045..eccae8424b 100644 --- a/src/frame/utils/getFrameMetadata.ts +++ b/src/frame/utils/getFrameMetadata.ts @@ -44,7 +44,7 @@ export const getFrameMetadata = ({ if (button.target) { metadata[`fc:frame:button:${index + 1}:target`] = button.target; } - if (button.action && button.action === 'tx' && button.postUrl) { + if (button.action && (button.action === 'tx' || button.action === 'post') && button.postUrl) { metadata[`fc:frame:button:${index + 1}:post_url`] = button.postUrl; } }); From d5a61f29dfc02a42c0a50be7bbff8c278d6e148c Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 15 Aug 2024 13:25:41 -0700 Subject: [PATCH 3/8] addressed linter formatting issues --- src/frame/utils/getFrameMetadata.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/frame/utils/getFrameMetadata.ts b/src/frame/utils/getFrameMetadata.ts index eccae8424b..f13991eabe 100644 --- a/src/frame/utils/getFrameMetadata.ts +++ b/src/frame/utils/getFrameMetadata.ts @@ -44,7 +44,11 @@ export const getFrameMetadata = ({ if (button.target) { metadata[`fc:frame:button:${index + 1}:target`] = button.target; } - if (button.action && (button.action === 'tx' || button.action === 'post') && button.postUrl) { + if ( + button.action && + (button.action === 'tx' || button.action === 'post') && + button.postUrl + ) { metadata[`fc:frame:button:${index + 1}:post_url`] = button.postUrl; } }); From fe98b0d6e493394fe1007ab92a65759646db3918 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 15 Aug 2024 13:35:35 -0700 Subject: [PATCH 4/8] added test for multiple buttons with custom s --- src/frame/utils/getFrameMetadata.test.ts | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/frame/utils/getFrameMetadata.test.ts b/src/frame/utils/getFrameMetadata.test.ts index 81b3bd7a06..915f297ebd 100644 --- a/src/frame/utils/getFrameMetadata.test.ts +++ b/src/frame/utils/getFrameMetadata.test.ts @@ -217,6 +217,39 @@ describe('getFrameMetadata', () => { }); }); + it('should return the correct metadata with action post and post_url', () => { + expect( + getFrameMetadata({ + buttons: [ + { + label: 'Button1', + action: 'post', + postUrl: 'https://zizzamia.xyz/api/frame/post-url?queryParam=XXX', + }, + { + label: 'Button2', + action: 'post', + postUrl: 'https://zizzamia.xyz/api/frame/post-url?queryParam=YYY', + }, + ], + image: 'https://zizzamia.xyz/park-1.png', + postUrl: 'https://zizzamia.xyz/api/frame', + }), + ).toEqual({ + 'fc:frame': 'vNext', + 'fc:frame:button:1': 'Button1', + 'fc:frame:button:1:action': 'post', + 'fc:frame:button:1:post_url': + 'https://zizzamia.xyz/api/frame/post-url?queryParam=XXX', + 'fc:frame:button:2': 'Button2', + 'fc:frame:button:2:action': 'post', + 'fc:frame:button:2:post_url': + 'https://zizzamia.xyz/api/frame/post-url?queryParam=YYY', + 'fc:frame:image': 'https://zizzamia.xyz/park-1.png', + 'fc:frame:post_url': 'https://zizzamia.xyz/api/frame', + }); + }); + it('should not render action target if action is not link, mint or tx', () => { expect( getFrameMetadata({ From 17419c99ff676be952795f2bf5ab53e8d49bd590 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 15 Aug 2024 14:46:15 -0700 Subject: [PATCH 5/8] created utility function for setting Button metadata --- .../utils/setFrameMetadataButtons.test.ts | 90 +++++++++++++++++++ src/frame/utils/setFrameMetadataButtons.ts | 27 ++++++ 2 files changed, 117 insertions(+) create mode 100644 src/frame/utils/setFrameMetadataButtons.test.ts create mode 100644 src/frame/utils/setFrameMetadataButtons.ts diff --git a/src/frame/utils/setFrameMetadataButtons.test.ts b/src/frame/utils/setFrameMetadataButtons.test.ts new file mode 100644 index 0000000000..d74753a295 --- /dev/null +++ b/src/frame/utils/setFrameMetadataButtons.test.ts @@ -0,0 +1,90 @@ +import { describe, expect, it } from "vitest"; +import { setFrameMetadataButtons } from "./setFrameMetadataButtons"; + +describe("setFrameMetadataButtons", () => { + it("should return the correct metadata", () => { + expect( + setFrameMetadataButtons({}, [ + { label: "button1", action: "post" }, + { label: "button2", action: "post_redirect" }, + { label: "button3" }, + ]) + ).toEqual({ + "fc:frame:button:1": "button1", + "fc:frame:button:1:action": "post", + "fc:frame:button:2": "button2", + "fc:frame:button:2:action": "post_redirect", + "fc:frame:button:3": "button3", + }); + }); + + it("should return the correct metadata for button with action tx and target", () => { + expect( + setFrameMetadataButtons({}, [ + { + label: "Button1", + action: "tx", + target: "https://zizzamia.xyz/api/frame/tx", + }, + ]) + ).toEqual({ + "fc:frame:button:1": "Button1", + "fc:frame:button:1:action": "tx", + "fc:frame:button:1:target": "https://zizzamia.xyz/api/frame/tx", + }); + }); + + it("should return the correct metadata for buttons with action tx and custom targets", () => { + expect( + setFrameMetadataButtons({}, [ + { + label: "Button1", + action: "tx", + target: "https://zizzamia.xyz/api/frame/tx?queryParam=XXX", + }, + { + label: "Button1", + action: "tx", + target: "https://zizzamia.xyz/api/frame/tx?queryParam=YYY", + }, + ]) + ).toEqual({ + "fc:frame:button:1": "Button1", + "fc:frame:button:1:action": "tx", + "fc:frame:button:1:target": + "https://zizzamia.xyz/api/frame/tx?queryParam=xxx", + "fc:frame:button:2": "Button2", + "fc:frame:button:2:action": "tx", + "fc:frame:button:2:target": + "https://zizzamia.xyz/api/frame/tx?queryParam=YYY", + }); + }); + + it("should return the correct metadata for buttons with action post and custom post_urls", () => { + expect( + setFrameMetadataButtons({}, [ + { + label: "Button1", + action: "post", + postUrl: + "https://zizzamia.xyz/api/frame/post-url?queryParam=XXX", + }, + { + label: "Button2", + action: "post", + postUrl: + "https://zizzamia.xyz/api/frame/post-url?queryParam=YYY", + }, + ]) + ).toEqual({ + "fc:frame:button:1": "Button1", + "fc:frame:button:1:action": "post", + "fc:frame:button:1:post_url": + "https://zizzamia.xyz/api/frame/post-url?queryParam=XXX", + "fc:frame:button:2": "Button2", + "fc:frame:button:2:action": "post", + "fc:frame:button:2:post_url": + "https://zizzamia.xyz/api/frame/post-url?queryParam=YYY", + }); + }); +}); diff --git a/src/frame/utils/setFrameMetadataButtons.ts b/src/frame/utils/setFrameMetadataButtons.ts new file mode 100644 index 0000000000..7086e8ff41 --- /dev/null +++ b/src/frame/utils/setFrameMetadataButtons.ts @@ -0,0 +1,27 @@ +import { FrameMetadataType } from "../types"; + +export function setFrameMetadataButtons( + metadata: Record, + buttons: FrameMetadataType['buttons'], +) { + if (!buttons) { + return; + } + + buttons.forEach((button, index) => { + metadata[`fc:frame:button:${index + 1}`] = button.label; + if (button.action) { + metadata[`fc:frame:button:${index + 1}:action`] = button.action; + } + if (button.target) { + metadata[`fc:frame:button:${index + 1}:target`] = button.target; + } + if ( + button.action && + (button.action === 'tx' || button.action === 'post') && + button.postUrl + ) { + metadata[`fc:frame:button:${index + 1}:post_url`] = button.postUrl; + } + }); +} From b661c40598b6e2e460c4a183010258a195e34058 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 15 Aug 2024 15:06:14 -0700 Subject: [PATCH 6/8] added additional tests --- .../utils/setFrameMetadataButtons.test.ts | 133 +++++++++++------- 1 file changed, 86 insertions(+), 47 deletions(-) diff --git a/src/frame/utils/setFrameMetadataButtons.test.ts b/src/frame/utils/setFrameMetadataButtons.test.ts index d74753a295..c82a980351 100644 --- a/src/frame/utils/setFrameMetadataButtons.test.ts +++ b/src/frame/utils/setFrameMetadataButtons.test.ts @@ -2,14 +2,29 @@ import { describe, expect, it } from "vitest"; import { setFrameMetadataButtons } from "./setFrameMetadataButtons"; describe("setFrameMetadataButtons", () => { + it("should return no button metadata", () => { + const testMetadata = { + "fc:frame": "vNext", + }; + setFrameMetadataButtons(testMetadata, undefined); + + expect(testMetadata).toEqual({ + "fc:frame": "vNext", + }); + }); + it("should return the correct metadata", () => { - expect( - setFrameMetadataButtons({}, [ - { label: "button1", action: "post" }, - { label: "button2", action: "post_redirect" }, - { label: "button3" }, - ]) - ).toEqual({ + const testMetadata = { + "fc:frame": "vNext", + }; + setFrameMetadataButtons(testMetadata, [ + { label: "button1", action: "post" }, + { label: "button2", action: "post_redirect" }, + { label: "button3" }, + ]); + + expect(testMetadata).toEqual({ + "fc:frame": "vNext", "fc:frame:button:1": "button1", "fc:frame:button:1:action": "post", "fc:frame:button:2": "button2", @@ -19,40 +34,63 @@ describe("setFrameMetadataButtons", () => { }); it("should return the correct metadata for button with action tx and target", () => { - expect( - setFrameMetadataButtons({}, [ - { - label: "Button1", - action: "tx", - target: "https://zizzamia.xyz/api/frame/tx", - }, - ]) - ).toEqual({ + const testMetadata = { "fc:frame": "vNext" }; + setFrameMetadataButtons(testMetadata, [ + { + label: "Button1", + action: "tx", + target: "https://zizzamia.xyz/api/frame/tx", + }, + ]); + + expect(testMetadata).toEqual({ + "fc:frame": "vNext", "fc:frame:button:1": "Button1", "fc:frame:button:1:action": "tx", "fc:frame:button:1:target": "https://zizzamia.xyz/api/frame/tx", }); }); + it("should return the correct metadata for button with action post and post_url", () => { + const testMetadata = { "fc:frame": "vNext" }; + setFrameMetadataButtons(testMetadata, [ + { + label: "Button1", + action: "post", + postUrl: "https://zizzamia.xyz/api/frame/post_url", + }, + ]); + + expect(testMetadata).toEqual({ + "fc:frame": "vNext", + "fc:frame:button:1": "Button1", + "fc:frame:button:1:action": "post", + "fc:frame:button:1:post_url": + "https://zizzamia.xyz/api/frame/post_url", + }); + }); + it("should return the correct metadata for buttons with action tx and custom targets", () => { - expect( - setFrameMetadataButtons({}, [ - { - label: "Button1", - action: "tx", - target: "https://zizzamia.xyz/api/frame/tx?queryParam=XXX", - }, - { - label: "Button1", - action: "tx", - target: "https://zizzamia.xyz/api/frame/tx?queryParam=YYY", - }, - ]) - ).toEqual({ + const testMetadata = { "fc:frame": "vNext" }; + setFrameMetadataButtons(testMetadata, [ + { + label: "Button1", + action: "tx", + target: "https://zizzamia.xyz/api/frame/tx?queryParam=XXX", + }, + { + label: "Button2", + action: "tx", + target: "https://zizzamia.xyz/api/frame/tx?queryParam=YYY", + }, + ]); + + expect(testMetadata).toEqual({ + "fc:frame": "vNext", "fc:frame:button:1": "Button1", "fc:frame:button:1:action": "tx", "fc:frame:button:1:target": - "https://zizzamia.xyz/api/frame/tx?queryParam=xxx", + "https://zizzamia.xyz/api/frame/tx?queryParam=XXX", "fc:frame:button:2": "Button2", "fc:frame:button:2:action": "tx", "fc:frame:button:2:target": @@ -61,22 +99,23 @@ describe("setFrameMetadataButtons", () => { }); it("should return the correct metadata for buttons with action post and custom post_urls", () => { - expect( - setFrameMetadataButtons({}, [ - { - label: "Button1", - action: "post", - postUrl: - "https://zizzamia.xyz/api/frame/post-url?queryParam=XXX", - }, - { - label: "Button2", - action: "post", - postUrl: - "https://zizzamia.xyz/api/frame/post-url?queryParam=YYY", - }, - ]) - ).toEqual({ + const testMetadata = { "fc:frame": "vNext" }; + setFrameMetadataButtons(testMetadata, [ + { + label: "Button1", + action: "post", + postUrl: + "https://zizzamia.xyz/api/frame/post-url?queryParam=XXX", + }, + { + label: "Button2", + action: "post", + postUrl: + "https://zizzamia.xyz/api/frame/post-url?queryParam=YYY", + }, + ]); + expect(testMetadata).toEqual({ + "fc:frame": "vNext", "fc:frame:button:1": "Button1", "fc:frame:button:1:action": "post", "fc:frame:button:1:post_url": From 86be7fc5334d2ba91081b3e66ee52b3192f91c50 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 15 Aug 2024 15:06:51 -0700 Subject: [PATCH 7/8] implement setFrameMetadataButtons for button metadata --- src/frame/utils/getFrameMetadata.ts | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/frame/utils/getFrameMetadata.ts b/src/frame/utils/getFrameMetadata.ts index f13991eabe..b20e103370 100644 --- a/src/frame/utils/getFrameMetadata.ts +++ b/src/frame/utils/getFrameMetadata.ts @@ -1,4 +1,5 @@ import type { FrameMetadataResponse, FrameMetadataType } from '../types'; +import { setFrameMetadataButtons } from './setFrameMetadataButtons'; /** * This function generates the metadata for a Farcaster Frame. @@ -36,22 +37,7 @@ export const getFrameMetadata = ({ metadata['fc:frame:input:text'] = input.text; } if (buttons) { - buttons.forEach((button, index) => { - metadata[`fc:frame:button:${index + 1}`] = button.label; - if (button.action) { - metadata[`fc:frame:button:${index + 1}:action`] = button.action; - } - if (button.target) { - metadata[`fc:frame:button:${index + 1}:target`] = button.target; - } - if ( - button.action && - (button.action === 'tx' || button.action === 'post') && - button.postUrl - ) { - metadata[`fc:frame:button:${index + 1}:post_url`] = button.postUrl; - } - }); + setFrameMetadataButtons(metadata, buttons); } if (postUrlToUse) { metadata['fc:frame:post_url'] = postUrlToUse; From d4718064c169157fb29406a11e1f6cb0d0a26058 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 15 Aug 2024 15:24:59 -0700 Subject: [PATCH 8/8] addressed linter and formatter issues --- .../utils/setFrameMetadataButtons.test.ts | 219 +++++++++--------- src/frame/utils/setFrameMetadataButtons.ts | 2 +- 2 files changed, 109 insertions(+), 112 deletions(-) diff --git a/src/frame/utils/setFrameMetadataButtons.test.ts b/src/frame/utils/setFrameMetadataButtons.test.ts index c82a980351..a77ac62b47 100644 --- a/src/frame/utils/setFrameMetadataButtons.test.ts +++ b/src/frame/utils/setFrameMetadataButtons.test.ts @@ -1,129 +1,126 @@ -import { describe, expect, it } from "vitest"; -import { setFrameMetadataButtons } from "./setFrameMetadataButtons"; +import { describe, expect, it } from 'vitest'; +import { setFrameMetadataButtons } from './setFrameMetadataButtons'; -describe("setFrameMetadataButtons", () => { - it("should return no button metadata", () => { - const testMetadata = { - "fc:frame": "vNext", - }; - setFrameMetadataButtons(testMetadata, undefined); +describe('setFrameMetadataButtons', () => { + it('should return no button metadata', () => { + const testMetadata = { + 'fc:frame': 'vNext', + }; + setFrameMetadataButtons(testMetadata, undefined); - expect(testMetadata).toEqual({ - "fc:frame": "vNext", - }); + expect(testMetadata).toEqual({ + 'fc:frame': 'vNext', }); + }); - it("should return the correct metadata", () => { - const testMetadata = { - "fc:frame": "vNext", - }; - setFrameMetadataButtons(testMetadata, [ - { label: "button1", action: "post" }, - { label: "button2", action: "post_redirect" }, - { label: "button3" }, - ]); + it('should return the correct metadata', () => { + const testMetadata = { + 'fc:frame': 'vNext', + }; + setFrameMetadataButtons(testMetadata, [ + { label: 'button1', action: 'post' }, + { label: 'button2', action: 'post_redirect' }, + { label: 'button3' }, + ]); - expect(testMetadata).toEqual({ - "fc:frame": "vNext", - "fc:frame:button:1": "button1", - "fc:frame:button:1:action": "post", - "fc:frame:button:2": "button2", - "fc:frame:button:2:action": "post_redirect", - "fc:frame:button:3": "button3", - }); + expect(testMetadata).toEqual({ + 'fc:frame': 'vNext', + 'fc:frame:button:1': 'button1', + 'fc:frame:button:1:action': 'post', + 'fc:frame:button:2': 'button2', + 'fc:frame:button:2:action': 'post_redirect', + 'fc:frame:button:3': 'button3', }); + }); - it("should return the correct metadata for button with action tx and target", () => { - const testMetadata = { "fc:frame": "vNext" }; - setFrameMetadataButtons(testMetadata, [ - { - label: "Button1", - action: "tx", - target: "https://zizzamia.xyz/api/frame/tx", - }, - ]); + it('should return the correct metadata for button with action tx and target', () => { + const testMetadata = { 'fc:frame': 'vNext' }; + setFrameMetadataButtons(testMetadata, [ + { + label: 'Button1', + action: 'tx', + target: 'https://zizzamia.xyz/api/frame/tx', + }, + ]); - expect(testMetadata).toEqual({ - "fc:frame": "vNext", - "fc:frame:button:1": "Button1", - "fc:frame:button:1:action": "tx", - "fc:frame:button:1:target": "https://zizzamia.xyz/api/frame/tx", - }); + expect(testMetadata).toEqual({ + 'fc:frame': 'vNext', + 'fc:frame:button:1': 'Button1', + 'fc:frame:button:1:action': 'tx', + 'fc:frame:button:1:target': 'https://zizzamia.xyz/api/frame/tx', }); + }); - it("should return the correct metadata for button with action post and post_url", () => { - const testMetadata = { "fc:frame": "vNext" }; - setFrameMetadataButtons(testMetadata, [ - { - label: "Button1", - action: "post", - postUrl: "https://zizzamia.xyz/api/frame/post_url", - }, - ]); + it('should return the correct metadata for button with action post and post_url', () => { + const testMetadata = { 'fc:frame': 'vNext' }; + setFrameMetadataButtons(testMetadata, [ + { + label: 'Button1', + action: 'post', + postUrl: 'https://zizzamia.xyz/api/frame/post_url', + }, + ]); - expect(testMetadata).toEqual({ - "fc:frame": "vNext", - "fc:frame:button:1": "Button1", - "fc:frame:button:1:action": "post", - "fc:frame:button:1:post_url": - "https://zizzamia.xyz/api/frame/post_url", - }); + expect(testMetadata).toEqual({ + 'fc:frame': 'vNext', + 'fc:frame:button:1': 'Button1', + 'fc:frame:button:1:action': 'post', + 'fc:frame:button:1:post_url': 'https://zizzamia.xyz/api/frame/post_url', }); + }); - it("should return the correct metadata for buttons with action tx and custom targets", () => { - const testMetadata = { "fc:frame": "vNext" }; - setFrameMetadataButtons(testMetadata, [ - { - label: "Button1", - action: "tx", - target: "https://zizzamia.xyz/api/frame/tx?queryParam=XXX", - }, - { - label: "Button2", - action: "tx", - target: "https://zizzamia.xyz/api/frame/tx?queryParam=YYY", - }, - ]); + it('should return the correct metadata for buttons with action tx and custom targets', () => { + const testMetadata = { 'fc:frame': 'vNext' }; + setFrameMetadataButtons(testMetadata, [ + { + label: 'Button1', + action: 'tx', + target: 'https://zizzamia.xyz/api/frame/tx?queryParam=XXX', + }, + { + label: 'Button2', + action: 'tx', + target: 'https://zizzamia.xyz/api/frame/tx?queryParam=YYY', + }, + ]); - expect(testMetadata).toEqual({ - "fc:frame": "vNext", - "fc:frame:button:1": "Button1", - "fc:frame:button:1:action": "tx", - "fc:frame:button:1:target": - "https://zizzamia.xyz/api/frame/tx?queryParam=XXX", - "fc:frame:button:2": "Button2", - "fc:frame:button:2:action": "tx", - "fc:frame:button:2:target": - "https://zizzamia.xyz/api/frame/tx?queryParam=YYY", - }); + expect(testMetadata).toEqual({ + 'fc:frame': 'vNext', + 'fc:frame:button:1': 'Button1', + 'fc:frame:button:1:action': 'tx', + 'fc:frame:button:1:target': + 'https://zizzamia.xyz/api/frame/tx?queryParam=XXX', + 'fc:frame:button:2': 'Button2', + 'fc:frame:button:2:action': 'tx', + 'fc:frame:button:2:target': + 'https://zizzamia.xyz/api/frame/tx?queryParam=YYY', }); + }); - it("should return the correct metadata for buttons with action post and custom post_urls", () => { - const testMetadata = { "fc:frame": "vNext" }; - setFrameMetadataButtons(testMetadata, [ - { - label: "Button1", - action: "post", - postUrl: - "https://zizzamia.xyz/api/frame/post-url?queryParam=XXX", - }, - { - label: "Button2", - action: "post", - postUrl: - "https://zizzamia.xyz/api/frame/post-url?queryParam=YYY", - }, - ]); - expect(testMetadata).toEqual({ - "fc:frame": "vNext", - "fc:frame:button:1": "Button1", - "fc:frame:button:1:action": "post", - "fc:frame:button:1:post_url": - "https://zizzamia.xyz/api/frame/post-url?queryParam=XXX", - "fc:frame:button:2": "Button2", - "fc:frame:button:2:action": "post", - "fc:frame:button:2:post_url": - "https://zizzamia.xyz/api/frame/post-url?queryParam=YYY", - }); + it('should return the correct metadata for buttons with action post and custom post_urls', () => { + const testMetadata = { 'fc:frame': 'vNext' }; + setFrameMetadataButtons(testMetadata, [ + { + label: 'Button1', + action: 'post', + postUrl: 'https://zizzamia.xyz/api/frame/post-url?queryParam=XXX', + }, + { + label: 'Button2', + action: 'post', + postUrl: 'https://zizzamia.xyz/api/frame/post-url?queryParam=YYY', + }, + ]); + expect(testMetadata).toEqual({ + 'fc:frame': 'vNext', + 'fc:frame:button:1': 'Button1', + 'fc:frame:button:1:action': 'post', + 'fc:frame:button:1:post_url': + 'https://zizzamia.xyz/api/frame/post-url?queryParam=XXX', + 'fc:frame:button:2': 'Button2', + 'fc:frame:button:2:action': 'post', + 'fc:frame:button:2:post_url': + 'https://zizzamia.xyz/api/frame/post-url?queryParam=YYY', }); + }); }); diff --git a/src/frame/utils/setFrameMetadataButtons.ts b/src/frame/utils/setFrameMetadataButtons.ts index 7086e8ff41..d5a375931b 100644 --- a/src/frame/utils/setFrameMetadataButtons.ts +++ b/src/frame/utils/setFrameMetadataButtons.ts @@ -1,4 +1,4 @@ -import { FrameMetadataType } from "../types"; +import type { FrameMetadataType } from '../types'; export function setFrameMetadataButtons( metadata: Record,