Skip to content

Commit

Permalink
docs(changeset): account for button post_url in frameInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
daria-github committed May 2, 2024
1 parent 7d291dd commit f9e2098
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-eyes-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@open-frames/proxy": patch
---

account for button post_url in frameInfo
4 changes: 1 addition & 3 deletions packages/server/src/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ const testCases = [
'of:button:1:target': EXPECTED_FRAME_POST_URL,
'of:button:1:post_url': EXPECTED_FRAME_TX_POST_URL,
},
frameInfo: {
ogImage: EXPECTED_FRAME_IMAGE,
expectedFrameInfo: {
acceptedClients: {
xmtp: EXPECTED_FRAME_XMTP_VERSION,
lens: '2',
Expand All @@ -200,7 +199,6 @@ const testCases = [
alt: EXPECTED_IMAGE_ALT,
},
postUrl: EXPECTED_FRAME_POST_URL,
state: EXPECTED_FRAME_STATE,
buttons: {
'1': {
action: 'tx',
Expand Down
7 changes: 6 additions & 1 deletion packages/server/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,18 @@ function updateFrameButton(frameInfo: DeepPartial<OpenFrameResult>, key: string,
frameInfo.buttons = frameInfo.buttons || {};
const button = frameInfo.buttons[buttonIndex] || {};
if (maybeField) {
const field = maybeField as keyof OpenFrameButton;
const field = maybeField as keyof OpenFrameButton | 'post_url';
if (field === 'action' && isAllowedAction(value)) {
button.action = value;
}
if (field === 'target') {
button.target = value;
}
if (button.action === 'tx') {
if (field === 'post_url') {
button.post_url = value;
}
}
} else {
button.label = value;
}
Expand Down

0 comments on commit f9e2098

Please sign in to comment.