diff --git a/.changeset/nine-wasps-work.md b/.changeset/nine-wasps-work.md index 650905ba5a..fa6b4bdaa9 100644 --- a/.changeset/nine-wasps-work.md +++ b/.changeset/nine-wasps-work.md @@ -2,4 +2,4 @@ '@coinbase/onchainkit': patch --- -- **feat**: added `post_url` optional metadata for `tx` Frame. By @zizzamia #235 +- **feat**: added `post_url` optional metadata for `tx` Frame. By @zizzamia, @cnasc, @spennyp #237 diff --git a/src/frame/getFrameHtmlResponse.test.ts b/src/frame/getFrameHtmlResponse.test.ts index 02bf88b298..b951ec35b2 100644 --- a/src/frame/getFrameHtmlResponse.test.ts +++ b/src/frame/getFrameHtmlResponse.test.ts @@ -147,6 +147,12 @@ describe('getFrameHtmlResponse', () => { const html = getFrameHtmlResponse({ buttons: [ { label: 'Transaction', action: 'tx', target: 'https://zizzamia.xyz/api/frame/tx' }, + { + label: 'Transaction 2', + action: 'tx', + target: 'https://zizzamia.xyz/api/frame/tx', + postUrl: 'https://zizzamia.xyz/api/frame/tx-success', + }, ], image: 'https://zizzamia.xyz/park-1.png', }); @@ -160,6 +166,10 @@ describe('getFrameHtmlResponse', () => { + + + + diff --git a/src/frame/getFrameHtmlResponse.ts b/src/frame/getFrameHtmlResponse.ts index 7950c32601..01c14ac61e 100644 --- a/src/frame/getFrameHtmlResponse.ts +++ b/src/frame/getFrameHtmlResponse.ts @@ -59,6 +59,9 @@ function getFrameHtmlResponse({ if (button.action && button.target) { buttonHtml += ` \n`; } + if (button.action && button.action === 'tx' && button.postUrl) { + buttonHtml += ` \n`; + } return buttonHtml; }) .join('');