File tree 2 files changed +34
-1
lines changed
2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 80
80
</ mat-card-actions >
81
81
</ mat-card >
82
82
83
+ < mat-card class ="card ">
84
+ < mat-card-header >
85
+ < mat-card-title > Signing PSBT</ mat-card-title >
86
+ </ mat-card-header >
87
+ < mat-card-content >
88
+ < mat-form-field class ="input-full-width " appearance ="outline ">
89
+ < mat-label > Raw PSBT</ mat-label >
90
+ < input matInput type ="text " [(ngModel)] ="rawPSBT " />
91
+ </ mat-form-field >
92
+ < div *ngIf ="signedPsbtSignature ">
93
+ < p > Signed PSBT:< br /> {{ signedPsbtSignature }}</ p >
94
+ </ div >
95
+ </ mat-card-content >
96
+ < mat-card-actions >
97
+ < button mat-flat-button color ="primary " (click) ="signPsbtAnyAccount(rawPSBT) "> Request Signing</ button >
98
+ </ mat-card-actions >
99
+ </ mat-card >
100
+
83
101
< mat-card class ="card ">
84
102
< mat-card-header >
85
103
< mat-card-title > Signing (JSON)</ mat-card-title >
303
321
</ mat-card >
304
322
</ mat-tab >
305
323
< mat-tab label ="Atomic Swap ">
306
-
307
324
< div class ="actions ">
308
325
< br />
309
326
< p >
Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ export class AppComponent implements OnInit {
24
24
signedTextNetwork ?: string ;
25
25
signedTextValidSignature ?: boolean ;
26
26
27
+ // rawPSBT is a Base64-encoded string representing the PSBT
28
+ rawPSBT : string =
29
+ '70736274ff010052020000000197ad5142d4b313e39d06320d52aa608c06525dd3aad59f3033306cc7dae20ecc0000000000ffffffff01e803000000000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00000000000100e10200000000010179c41695a3be63ad012bdfb3e4fa1e1ed529b546671ee175eca105193940394f0100000000fdffffff02e8030000000000001976a914ad0e5d23994e4aedea78930662c1488ca2544efd88ac4232000000000000160014e3b767040067973106e977f46b9b449fd67f92120247304402200268c49c6e89dd3b8d59b78e35612ec2685730bc471aba3a49edd58d08d089cb02203e12e950cd59f7e0af3da88e33e221247c9ccada7a43ee4910e4d589245c37c80121026b0945d725e12b3c8fe123858bfb4d6da697329b8fbe5e02ee1e0b6ccdf3be79efd42b002206030272524d872070574dc2d183060efb8e691b0d3523e965644384446ec53190f4186c127a852c000080010000800000008000000000000000000000' ;
30
+
31
+ signedPsbtSignature ?: string ;
32
+
27
33
signedJsonSignature ?: string ;
28
34
signedJsonKey ?: string ;
29
35
signedJsonNetwork ?: string ;
@@ -243,6 +249,16 @@ export class AppComponent implements OnInit {
243
249
this . signedTextValidSignature = bitcoinMessage . verify ( value , result . key , result . response . signature ) ;
244
250
}
245
251
252
+ async signPsbtAnyAccount ( value : string ) {
253
+ const result : any = await this . provider ! . request ( {
254
+ method : 'signPsbt' ,
255
+ params : [ { message : value , network : this . provider ?. indexer . network } ] ,
256
+ } ) ;
257
+ console . log ( 'Result:' , result ) ;
258
+
259
+ this . signedPsbtSignature = result . response . signature ;
260
+ }
261
+
246
262
async signMessageAnyAccountJson ( value : string ) {
247
263
const message = JSON . parse ( value ) ;
248
264
You can’t perform that action at this time.
0 commit comments