@@ -73,6 +73,7 @@ <h1 class="text-3xl font-bold text-center text-blue-600 mb-6">Mintlayer Wallet D
73
73
< button onclick ="toggleSection('requestSecretHash') " class ="bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 transition "> Request Secret Hash</ button >
74
74
< button onclick ="toggleSection('createHtlc') " class ="bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 transition "> Create Htlc</ button >
75
75
< button onclick ="toggleSection('refundHtlc') " class ="bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 transition "> Refund Htlc</ button >
76
+ < button onclick ="toggleSection('spendHtlc') " class ="bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 transition "> Spend Htlc</ button >
76
77
< button onclick ="toggleSection('extractHtlcSecret') " class ="bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 transition "> Extract Htlc secret</ button >
77
78
</ div >
78
79
@@ -369,9 +370,18 @@ <h3 class="text-lg font-semibold text-gray-700 mb-4">Refund HTLC</h3>
369
370
</ div >
370
371
</ div >
371
372
373
+ <!-- Spend HTLC Section -->
374
+ < div id ="spendHtlc " class ="bg-white p-6 rounded-lg shadow-md hidden ">
375
+ < h3 class ="text-lg font-semibold text-gray-700 mb-4 "> Spend HTLC</ h3 >
376
+ < div class ="space-y-4 ">
377
+ < input type ="text " id ="spend_htlc_transaction_id " placeholder ="Transaction ID with HTLC " class ="w-full border border-gray-300 rounded-md p-2 focus:ring-2 focus:ring-blue-500 focus:outline-none " />
378
+ < button onclick ="spendHTLC() " class ="bg-green-500 text-white py-2 px-4 rounded-md shadow hover:bg-green-600 transition w-full "> Spend HTLC</ button >
379
+ </ div >
380
+ </ div >
381
+
372
382
<!-- Extract HTLC Secret Section -->
373
383
< div id ="extractHtlcSecret " class ="bg-white p-6 rounded-lg shadow-md hidden ">
374
- < h3 class ="text-lg font-semibold text-gray-700 mb-4 "> Refund HTLC</ h3 >
384
+ < h3 class ="text-lg font-semibold text-gray-700 mb-4 "> Extract Secret from HTLC</ h3 >
375
385
< div class ="space-y-4 ">
376
386
< input type ="text " id ="extract_htlc_transaction_id " placeholder ="Transaction ID with HTLC spend " class ="w-full border border-gray-300 rounded-md p-2 focus:ring-2 focus:ring-blue-500 focus:outline-none " />
377
387
< input type ="text " id ="extract_htlc_transaction_hex " placeholder ="Transaction HEX " class ="w-full border border-gray-300 rounded-md p-2 focus:ring-2 focus:ring-blue-500 focus:outline-none " />
@@ -401,7 +411,7 @@ <h3 class="text-xl font-semibold text-gray-700 mb-4">Output</h3>
401
411
'lockTokenSupply' , 'changeTokenAuthority' , 'changeTokenMetadata' , 'createOrder' ,
402
412
'fillOrder' , 'concludeOrder' , 'bridgeRequest' , 'broadcastTx' , 'freezeToken' ,
403
413
'unfreezeToken' , 'burn' , 'dataDeposit' , 'createDelegation' , 'delegationStake' ,
404
- 'delegationWithdraw' , 'signChallenge' , 'createHtlc' , 'refundHtlc' , 'requestSecretHash' , 'extractHtlcSecret'
414
+ 'delegationWithdraw' , 'signChallenge' , 'createHtlc' , 'refundHtlc' , 'spendHtlc' , ' requestSecretHash', 'extractHtlcSecret'
405
415
] ;
406
416
sections . forEach ( id => {
407
417
const el = document . getElementById ( id ) ;
@@ -1015,6 +1025,20 @@ <h3 class="text-xl font-semibold text-gray-700 mb-4">Output</h3>
1015
1025
}
1016
1026
}
1017
1027
1028
+ async function spendHTLC ( ) {
1029
+ const transaction_id = document . getElementById ( 'spend_htlc_transaction_id' ) . value ;
1030
+
1031
+ try {
1032
+ const result = await window . mintlayer . spendHtlc ( {
1033
+ transaction_id,
1034
+ } ) ;
1035
+
1036
+ displayOutput ( `Signature: ${ JSON . stringify ( result , null , 2 ) } ` ) ;
1037
+ } catch ( error ) {
1038
+ displayOutput ( `Error: ${ error . message } ` ) ;
1039
+ }
1040
+ }
1041
+
1018
1042
async function extractHTLCSecret ( ) {
1019
1043
const transaction_id = document . getElementById ( 'extract_htlc_transaction_id' ) . value ;
1020
1044
const transaction_hex = document . getElementById ( 'extract_htlc_transaction_hex' ) . value ;
0 commit comments