@@ -25,8 +25,13 @@ import { useAppSelector, useCheckCameraPermissionStatus, useFullscreenGuard } fr
2525import { AppType } from '../../redux/slices/app/appType' ;
2626import { Warning } from '@iota/apps-ui-icons' ;
2727
28+ export enum SignatureType {
29+ Transaction = 'transaction' ,
30+ Message = 'message' ,
31+ }
32+
2833interface KeystoneContextValue {
29- requestSignature : ( ur : UR ) => Promise < string > ;
34+ requestSignature : ( ur : UR , signatureType ?: SignatureType ) => Promise < string > ;
3035}
3136
3237const KeystoneContext = createContext < KeystoneContextValue | undefined > ( undefined ) ;
@@ -37,6 +42,7 @@ interface KeystoneProviderProps {
3742
3843interface Request {
3944 ur : UR ;
45+ signatureType : SignatureType ;
4046 reply : ( signature : string ) => void ;
4147 cancel : ( ) => void ;
4248}
@@ -69,10 +75,11 @@ export function KeystoneProvider({ children }: KeystoneProviderProps) {
6975
7076 const context = useMemo ( ( ) => {
7177 return {
72- requestSignature : ( ur : UR ) =>
78+ requestSignature : ( ur : UR , signatureType = SignatureType . Transaction ) =>
7379 new Promise < string > ( ( resolve , reject ) => {
7480 setCurrentRequest ( {
7581 ur,
82+ signatureType,
7683 reply : ( signature ) => {
7784 setCurrentRequest ( null ) ;
7885 resolve ( signature ) ;
@@ -103,7 +110,11 @@ enum Step {
103110 ScanQr ,
104111}
105112
106- export function ScanBothWays ( { request : { ur, reply, cancel } } : { request : Request } ) {
113+ export function ScanBothWays ( {
114+ request : { ur, signatureType, reply, cancel } ,
115+ } : {
116+ request : Request ;
117+ } ) {
107118 const [ step , setStep ] = useState < Step > ( Step . ShowQr ) ;
108119 const [ cameraPermissionStatus ] = useCheckCameraPermissionStatus ( ) ;
109120
@@ -128,10 +139,13 @@ export function ScanBothWays({ request: { ur, reply, cancel } }: { request: Requ
128139 toast . error ( `Error while scanning QR: ${ error } ` ) ;
129140 }
130141
142+ const headerTitle =
143+ signatureType === SignatureType . Message ? 'Confirm Message' : 'Confirm Transaction' ;
144+
131145 return (
132146 < Dialog open onOpenChange = { ( open ) => { } } >
133147 < DialogContent containerId = "overlay-portal-container" >
134- < Header title = "Confirm Transaction" titleCentered onClose = { ( ) => onCancel ( ) } />
148+ < Header title = { headerTitle } titleCentered onClose = { ( ) => onCancel ( ) } />
135149 < DialogBody >
136150 < div className = "flex flex-col items-center gap-2" >
137151 { step === Step . ShowQr ? (
@@ -186,26 +200,26 @@ export function ScanBothWays({ request: { ur, reply, cancel } }: { request: Requ
186200 < div className = "flex flex-col items-center justify-center" >
187201 < Link
188202 to = "https://docs.iota.org/users/iota-wallet/how-to/basics#using-keystone-wallet"
189- className = "mb-1 text-body-md text-iota-primary-30 no-underline dark:text-iota-primary-80 "
203+ className = "dark:text-iota-primary-80 mb-1 text-body-md text-iota-primary-30 no-underline"
190204 target = "_blank"
191205 rel = "noreferrer"
192206 >
193207 { step === Step . ShowQr ? 'Step 1' : 'Step 2' }
194208 </ Link >
195- < span className = "text-center text-body-md text-iota-neutral-40 dark:text-iota-neutral-60 " >
209+ < span className = "dark: text-iota-neutral-60 text- center text-body-md text-iota-neutral-40" >
196210 { step === Step . ShowQr
197211 ? 'Scan this QR code with your Keystone device, then press continue'
198212 : 'Scan the QR code displayed on your keystone device' }
199213 </ span >
200214 </ div >
201215 < div className = "flex w-full flex-col" >
202216 < div className = "mb-2 flex items-center justify-center gap-x-1" >
203- < span className = "text-body-md text-iota-neutral-40 dark: text-iota-neutral-60 " >
217+ < span className = "dark: text-iota-neutral-60 text-body-md text-iota-neutral-40 " >
204218 Need more help?
205219 </ span >
206220 < Link
207221 to = "https://docs.iota.org/users/iota-wallet/how-to/basics#using-keystone-wallet"
208- className = "text-body-md text-iota-primary-30 no-underline dark:text-iota-primary-80 "
222+ className = "dark: text-iota-primary-80 text- body-md text-iota-primary-30 no-underline"
209223 target = "_blank"
210224 rel = "noreferrer"
211225 >
0 commit comments