@@ -69,6 +69,7 @@ <h1 class="text-3xl font-bold text-center text-blue-600 mb-6">Mintlayer Wallet D
69
69
< button onclick ="toggleSection('createDelegation') " class ="bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 transition "> Create Delegation</ button >
70
70
< button onclick ="toggleSection('delegationStake') " class ="bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 transition "> Delegation Stake</ button >
71
71
< button onclick ="toggleSection('delegationWithdraw') " class ="bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 transition "> Delegation Withdraw</ button >
72
+ < button onclick ="toggleSection('signChallenge') " class ="bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 transition "> Sign Challenge</ button >
72
73
</ div >
73
74
74
75
<!-- Transfer Section -->
@@ -317,6 +318,16 @@ <h3 class="text-lg font-semibold text-gray-700 mb-4">Delegation Withdraw</h3>
317
318
< button onclick ="delegationWithdraw() " class ="bg-green-500 text-white py-2 px-4 rounded-md shadow hover:bg-green-600 transition w-full "> Withdraw</ button >
318
319
</ div >
319
320
</ div >
321
+
322
+ <!-- Sign Challenge Section -->
323
+ < div id ="signChallenge " class ="bg-white p-6 rounded-lg shadow-md hidden ">
324
+ < h3 class ="text-lg font-semibold text-gray-700 mb-4 "> Sign Challenge</ h3 >
325
+ < div class ="space-y-4 ">
326
+ < input type ="text " id ="sign_challenge_address " placeholder ="Address (optional) " class ="w-full border border-gray-300 rounded-md p-2 focus:ring-2 focus:ring-blue-500 focus:outline-none " />
327
+ < input type ="text " id ="sign_challenge_message " placeholder ="Message " class ="w-full border border-gray-300 rounded-md p-2 focus:ring-2 focus:ring-blue-500 focus:outline-none " />
328
+ < button onclick ="signChallenge() " class ="bg-green-500 text-white py-2 px-4 rounded-md shadow hover:bg-green-600 transition w-full "> Sign Challenge</ button >
329
+ </ div >
330
+ </ div >
320
331
</ div >
321
332
</ div >
322
333
@@ -340,7 +351,7 @@ <h3 class="text-xl font-semibold text-gray-700 mb-4">Output</h3>
340
351
'lockTokenSupply' , 'changeTokenAuthority' , 'changeTokenMetadata' , 'createOrder' ,
341
352
'fillOrder' , 'concludeOrder' , 'bridgeRequest' , 'broadcastTx' , 'freezeToken' ,
342
353
'unfreezeToken' , 'burn' , 'dataDeposit' , 'createDelegation' , 'delegationStake' ,
343
- 'delegationWithdraw'
354
+ 'delegationWithdraw' , 'signChallenge'
344
355
] ;
345
356
sections . forEach ( id => {
346
357
const el = document . getElementById ( id ) ;
@@ -893,6 +904,23 @@ <h3 class="text-xl font-semibold text-gray-700 mb-4">Output</h3>
893
904
}
894
905
}
895
906
907
+ async function signChallenge ( ) {
908
+ const address = document . getElementById ( 'sign_challenge_address' ) . value ;
909
+ const message = document . getElementById ( 'sign_challenge_message' ) . value ;
910
+
911
+ if ( ! message ) {
912
+ displayOutput ( 'Please provide a message to sign.' ) ;
913
+ return ;
914
+ }
915
+
916
+ try {
917
+ const { signature } = await window . mintlayer . signChallenge ( { address, message } ) ;
918
+ displayOutput ( `Signature: ${ JSON . stringify ( signature , null , 2 ) } ` ) ;
919
+ } catch ( error ) {
920
+ displayOutput ( `Error: ${ error . message } ` ) ;
921
+ }
922
+ }
923
+
896
924
if ( window . mintlayer ) displayOutput ( 'Mintlayer Connect SDK detected!' ) ;
897
925
else displayOutput ( 'Mintlayer Connect SDK not found.' ) ;
898
926
</ script >
0 commit comments