@@ -292,36 +292,66 @@ export default function BRC20TokenScreen() {
292
292
const chainType = useChainType ( ) ;
293
293
const chain = useChain ( ) ;
294
294
295
+ const isBrc20Prog = useMemo ( ( ) => {
296
+ if ( chainType === ChainType . BITCOIN_MAINNET || chainType === ChainType . BITCOIN_SIGNET ) {
297
+ if ( ticker . length == 6 ) {
298
+ return true ;
299
+ }
300
+ }
301
+ return false ;
302
+ } , [ ticker , chainType ] ) ;
303
+
295
304
const enableTrade = useMemo ( ( ) => {
305
+ if ( isBrc20Prog ) {
306
+ return false ;
307
+ }
296
308
if ( chainType === ChainType . BITCOIN_MAINNET || chainType === ChainType . FRACTAL_BITCOIN_MAINNET ) {
297
309
return true ;
298
310
} else {
299
311
return false ;
300
312
}
301
- } , [ chainType ] ) ;
313
+ } , [ chainType , isBrc20Prog ] ) ;
314
+
315
+ const enableHistory = isBrc20Prog ? false : true ;
302
316
303
317
const shouldUseTwoRowLayout = useMemo ( ( ) => {
304
318
return enableTrade && chain . enableBrc20SingleStep ;
305
319
} , [ enableTrade , chain . enableBrc20SingleStep ] ) ;
306
320
307
321
const marketPlaceUrl = useBRC20MarketPlaceWebsite ( ticker ) ;
308
322
323
+ const inscribePlaceUrl = useMemo ( ( ) => {
324
+ if ( isBrc20Prog ) {
325
+ return `${ unisatWebsite } /inscribe?tab=brc20-prog&tick=${ encodeURIComponent ( ticker ) } ` ;
326
+ }
327
+ return `${ unisatWebsite } /inscribe?tick=${ encodeURIComponent ( ticker ) } ` ;
328
+ } , [ isBrc20Prog , ticker , unisatWebsite ] ) ;
329
+
309
330
const tabItems = useMemo ( ( ) => {
310
- const items = [
311
- {
312
- key : TabKey . HISTORY ,
313
- label : t ( 'history' )
314
- } ,
315
- {
316
- key : TabKey . DETAILS ,
317
- label : t ( 'details' )
318
- }
319
- ] ;
320
- return items ;
321
- } , [ t ] ) ;
331
+ if ( enableHistory ) {
332
+ const items = [
333
+ {
334
+ key : TabKey . HISTORY ,
335
+ label : t ( 'history' )
336
+ } ,
337
+ {
338
+ key : TabKey . DETAILS ,
339
+ label : t ( 'details' )
340
+ }
341
+ ] ;
342
+ return items ;
343
+ } else {
344
+ return [
345
+ {
346
+ key : TabKey . DETAILS ,
347
+ label : t ( 'details' )
348
+ }
349
+ ] ;
350
+ }
351
+ } , [ t , enableHistory ] ) ;
322
352
323
353
const renderTabChildren = useMemo ( ( ) => {
324
- if ( activeTab === TabKey . HISTORY ) {
354
+ if ( activeTab === TabKey . HISTORY && enableHistory ) {
325
355
return < BRC20TokenHistory ticker = { ticker } /> ;
326
356
}
327
357
@@ -375,7 +405,7 @@ export default function BRC20TokenScreen() {
375
405
</ Column >
376
406
) ;
377
407
}
378
- } , [ activeTab , deployInscription ] ) ;
408
+ } , [ activeTab , deployInscription , enableHistory , tokenSummary ] ) ;
379
409
380
410
return (
381
411
< Layout >
@@ -399,7 +429,11 @@ export default function BRC20TokenScreen() {
399
429
color = { 'ticker_color2' }
400
430
/>
401
431
< Row style = { { backgroundColor : 'rgba(244, 182, 44, 0.15)' , borderRadius : 4 } } px = "md" py = "sm" >
402
- < Text text = { 'brc-20' } style = { { color : 'rgba(244, 182, 44, 0.85)' } } />
432
+ { isBrc20Prog ? (
433
+ < Text text = { 'brc2.0' } style = { { color : 'rgba(244, 182, 44, 0.85)' } } />
434
+ ) : (
435
+ < Text text = { 'brc-20' } style = { { color : 'rgba(244, 182, 44, 0.85)' } } />
436
+ ) }
403
437
</ Row >
404
438
</ Row >
405
439
< Column itemsCenter fullX justifyCenter >
@@ -420,7 +454,7 @@ export default function BRC20TokenScreen() {
420
454
disabled = { ! enableMint }
421
455
icon = "pencil"
422
456
onClick = { ( e ) => {
423
- window . open ( ` ${ unisatWebsite } /inscribe?tick= ${ encodeURIComponent ( ticker ) } ` ) ;
457
+ window . open ( inscribePlaceUrl ) ;
424
458
} }
425
459
full
426
460
/>
@@ -489,7 +523,7 @@ export default function BRC20TokenScreen() {
489
523
disabled = { ! enableMint }
490
524
icon = "pencil"
491
525
onClick = { ( e ) => {
492
- window . open ( ` ${ unisatWebsite } /brc20/ ${ encodeURIComponent ( ticker ) } ` ) ;
526
+ window . open ( inscribePlaceUrl ) ;
493
527
} }
494
528
style = { {
495
529
...( ! enableMint ? { backgroundColor : 'rgba(255,255,255,0.15)' } : { } ) ,
@@ -536,26 +570,27 @@ export default function BRC20TokenScreen() {
536
570
} ) ;
537
571
} }
538
572
/>
539
- ) : enableTrade ? (
573
+ ) : (
540
574
< Button
541
575
text = { t ( 'trade' ) }
542
576
preset = "home"
543
577
icon = "trade"
578
+ disabled = { ! enableTrade }
544
579
onClick = { ( e ) => {
545
580
window . open ( marketPlaceUrl ) ;
546
581
} }
547
582
style = { {
548
583
width : '101px'
549
584
} }
550
585
/>
551
- ) : null }
586
+ ) }
552
587
</ Row >
553
588
) }
554
589
</ Column >
555
590
556
591
< TabBar
557
- defaultActiveKey = { activeTab }
558
- activeKey = { activeTab }
592
+ defaultActiveKey = { enableHistory ? activeTab : TabKey . DETAILS }
593
+ activeKey = { enableHistory ? activeTab : TabKey . DETAILS }
559
594
items = { tabItems }
560
595
preset = "style3"
561
596
onTabClick = { ( key ) => {
0 commit comments