@@ -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('extractHtlcSecret') " class ="bg-gray-200 text-gray-700 py-2 px-4 rounded-md hover:bg-gray-300 transition "> Extract Htlc secret</ button >
76
77
</ div >
77
78
78
79
<!-- Transfer Section -->
@@ -367,6 +368,16 @@ <h3 class="text-lg font-semibold text-gray-700 mb-4">Refund HTLC</h3>
367
368
< button onclick ="refundHTLC() " class ="bg-green-500 text-white py-2 px-4 rounded-md shadow hover:bg-green-600 transition w-full "> Refund HTLC</ button >
368
369
</ div >
369
370
</ div >
371
+
372
+ <!-- Extract HTLC Secret Section -->
373
+ < 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 >
375
+ < div class ="space-y-4 ">
376
+ < 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
+ < 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 " />
378
+ < button onclick ="extractHTLCSecret() " class ="bg-green-500 text-white py-2 px-4 rounded-md shadow hover:bg-green-600 transition w-full "> Extract HTLC Secret</ button >
379
+ </ div >
380
+ </ div >
370
381
</ div >
371
382
</ div >
372
383
@@ -390,7 +401,7 @@ <h3 class="text-xl font-semibold text-gray-700 mb-4">Output</h3>
390
401
'lockTokenSupply' , 'changeTokenAuthority' , 'changeTokenMetadata' , 'createOrder' ,
391
402
'fillOrder' , 'concludeOrder' , 'bridgeRequest' , 'broadcastTx' , 'freezeToken' ,
392
403
'unfreezeToken' , 'burn' , 'dataDeposit' , 'createDelegation' , 'delegationStake' ,
393
- 'delegationWithdraw' , 'signChallenge' , 'createHtlc' , 'refundHtlc' , 'requestSecretHash'
404
+ 'delegationWithdraw' , 'signChallenge' , 'createHtlc' , 'refundHtlc' , 'requestSecretHash' , 'extractHtlcSecret'
394
405
] ;
395
406
sections . forEach ( id => {
396
407
const el = document . getElementById ( id ) ;
@@ -994,11 +1005,28 @@ <h3 class="text-xl font-semibold text-gray-700 mb-4">Output</h3>
994
1005
const transaction_id = document . getElementById ( 'refund_htlc_transaction_id' ) . value ;
995
1006
996
1007
try {
997
- const { signature } = await window . mintlayer . refundHtlc ( {
1008
+ const result = await window . mintlayer . refundHtlc ( {
998
1009
transaction_id,
999
1010
} ) ;
1000
1011
1001
- displayOutput ( `Signature: ${ JSON . stringify ( signature , null , 2 ) } ` ) ;
1012
+ displayOutput ( `Signature: ${ JSON . stringify ( result , null , 2 ) } ` ) ;
1013
+ } catch ( error ) {
1014
+ displayOutput ( `Error: ${ error . message } ` ) ;
1015
+ }
1016
+ }
1017
+
1018
+ async function extractHTLCSecret ( ) {
1019
+ const transaction_id = document . getElementById ( 'extract_htlc_transaction_id' ) . value ;
1020
+ const transaction_hex = document . getElementById ( 'extract_htlc_transaction_hex' ) . value ;
1021
+
1022
+ try {
1023
+ const result = await window . mintlayer . extractHtlcSecret ( {
1024
+ transaction_id,
1025
+ transaction_hex,
1026
+ format : 'hex'
1027
+ } ) ;
1028
+
1029
+ displayOutput ( `Secret HEX: ${ JSON . stringify ( result , null , 2 ) } ` ) ;
1002
1030
} catch ( error ) {
1003
1031
displayOutput ( `Error: ${ error . message } ` ) ;
1004
1032
}
0 commit comments