@@ -8,40 +8,40 @@ import {
8
8
getPreviousFrame ,
9
9
useFramesReducer ,
10
10
getFrameMessage ,
11
- } from " frames.js/next/server" ;
12
- import Link from " next/link" ;
13
- import { getTokenUrl } from " frames.js" ;
14
- import { createDebugUrl } from " ../../debug" ;
15
- import { currentURL } from " ../../utils" ;
11
+ } from ' frames.js/next/server' ;
12
+ import Link from ' next/link' ;
13
+ import { getTokenUrl } from ' frames.js' ;
14
+ import { createDebugUrl } from ' ../../debug' ;
15
+ import { currentURL } from ' ../../utils' ;
16
16
17
17
type State = {
18
18
active : string ;
19
19
total_button_presses : number ;
20
20
} ;
21
21
22
- const initialState = { active : "1" , total_button_presses : 0 } ;
22
+ const initialState = { active : '1' , total_button_presses : 0 } ;
23
23
24
24
const reducer : FrameReducer < State > = ( state , action ) => {
25
25
return {
26
26
total_button_presses : state . total_button_presses + 1 ,
27
27
active : action . postBody ?. untrustedData . buttonIndex
28
28
? String ( action . postBody ?. untrustedData . buttonIndex )
29
- : "1" ,
29
+ : '1' ,
30
30
} ;
31
31
} ;
32
32
33
33
// This is a react server component only
34
34
export default async function Home ( { searchParams } : NextServerPageProps ) {
35
- const url = currentURL ( " /examples/custom-hub" ) ;
35
+ const url = currentURL ( ' /examples/custom-hub' ) ;
36
36
const previousFrame = getPreviousFrame < State > ( searchParams ) ;
37
37
38
38
const frameMessage = await getFrameMessage ( previousFrame . postBody , {
39
- hubHttpUrl : " https://hub.freefarcasterhub.com:3281" ,
39
+ hubHttpUrl : ' https://hub.freefarcasterhub.com:3281' ,
40
40
fetchHubContext : true ,
41
41
} ) ;
42
42
43
43
if ( frameMessage && ! frameMessage ?. isValid ) {
44
- throw new Error ( " Invalid frame payload" ) ;
44
+ throw new Error ( ' Invalid frame payload' ) ;
45
45
}
46
46
47
47
const [ state , dispatch ] = useFramesReducer < State > (
@@ -53,7 +53,7 @@ export default async function Home({ searchParams }: NextServerPageProps) {
53
53
// Here: do a server side side effect either sync or async (using await), such as minting an NFT if you want.
54
54
// example: load the users credentials & check they have an NFT
55
55
56
- console . log ( " info: state is:" , state ) ;
56
+ console . log ( ' info: state is:' , state ) ;
57
57
58
58
if ( frameMessage ) {
59
59
const {
@@ -70,13 +70,13 @@ export default async function Home({ searchParams }: NextServerPageProps) {
70
70
requesterUserData,
71
71
} = frameMessage ;
72
72
73
- console . log ( " info: frameMessage is:" , frameMessage ) ;
73
+ console . log ( ' info: frameMessage is:' , frameMessage ) ;
74
74
}
75
75
76
76
// then, when done, return next frame
77
77
return (
78
78
< div className = "p-4" >
79
- frames.js starter kit.{ " " }
79
+ frames.js starter kit.{ ' ' }
80
80
< Link href = { createDebugUrl ( url ) } className = "underline" >
81
81
Debug
82
82
</ Link >
@@ -88,21 +88,21 @@ export default async function Home({ searchParams }: NextServerPageProps) {
88
88
{ /* <FrameImage src="https://framesjs.org/og.png" /> */ }
89
89
< FrameImage >
90
90
< div tw = "w-full h-full bg-slate-700 text-white justify-center items-center" >
91
- { frameMessage ?. inputText ? frameMessage . inputText : " Hello world" }
91
+ { frameMessage ?. inputText ? frameMessage . inputText : ' Hello world' }
92
92
</ div >
93
93
</ FrameImage >
94
94
< FrameInput text = "put some text here" />
95
95
< FrameButton >
96
- { state ?. active === "1" ? " Active" : " Inactive" }
96
+ { state ?. active === '1' ? ' Active' : ' Inactive' }
97
97
</ FrameButton >
98
98
< FrameButton >
99
- { state ?. active === "2" ? " Active" : " Inactive" }
99
+ { state ?. active === '2' ? ' Active' : ' Inactive' }
100
100
</ FrameButton >
101
101
< FrameButton
102
102
action = "mint"
103
103
target = { getTokenUrl ( {
104
- address : " 0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df" ,
105
- tokenId : " 123" ,
104
+ address : ' 0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df' ,
105
+ tokenId : ' 123' ,
106
106
chainId : 7777777 ,
107
107
} ) }
108
108
>
0 commit comments