@@ -84,6 +84,9 @@ import com.getcode.opencode.compose.LocalExchange
8484import com.getcode.opencode.model.financial.LocalFiat
8585import com.getcode.opencode.model.financial.Token
8686import com.getcode.opencode.model.ui.BillBackground
87+ import com.getcode.opencode.model.ui.BillTexture
88+ import com.getcode.opencode.model.ui.TokenBillCustomizations
89+ import com.getcode.solana.keys.Mint
8790import com.getcode.opencode.model.ui.BlendMode as PlaygroundBlendMode
8891import com.getcode.solana.keys.base58
8992import com.getcode.theme.CodeTheme
@@ -109,12 +112,12 @@ private object CashBillDefaults {
109112 const val AspectRatio = 0.555f
110113
111114 fun billColor (
112- token : Token ,
115+ billCustomizations : TokenBillCustomizations ? ,
113116 alpha : Float = 1f,
114117 startY : Float = 0f,
115118 endY : Float = Float .POSITIVE_INFINITY ,
116119 ): Brush {
117- val billCustomizations = token. billCustomizations ? : return Brush .verticalGradient(
120+ val billCustomizations = billCustomizations ? : return Brush .verticalGradient(
118121 listOf (Color (0xFF06450F ), Color (0xFF06450F ))
119122 )
120123
@@ -144,8 +147,8 @@ private object CashBillDefaults {
144147 const val CodeBackgroundOpacity = 0.8f
145148
146149 @Composable
147- fun punchBrushIn (punch : Punch , token : Token ): Brush {
148- val billCustomizations = token. billCustomizations
150+ fun punchBrushIn (punch : Punch ,billCustomizations : TokenBillCustomizations ? ): Brush {
151+ val billCustomizations = billCustomizations
149152 if (billCustomizations?.background == null ) {
150153 val color = Black .copy(0.15f )
151154 .compositeOver(CodeTheme .colors.cashBillColor.copy(alpha = CodeBackgroundOpacity ))
@@ -291,13 +294,32 @@ private class CashBillGeometry(width: Dp, height: Dp) : Geometry(width, height)
291294@OptIn(ExperimentalLayoutApi ::class )
292295@Composable
293296internal fun CashBill (
294- modifier : Modifier = Modifier ,
295297 payloadData : List <Byte >,
298+ amount : LocalFiat ,
296299 token : Token ,
300+ modifier : Modifier = Modifier ,
301+ ) {
302+ CashBill (
303+ payloadData = payloadData,
304+ amount = amount,
305+ mint = token.address.base58(),
306+ billCustomizations = token.billCustomizations,
307+ modifier = modifier,
308+ )
309+ }
310+
311+ @SuppressLint(" UnusedBoxWithConstraintsScope" )
312+ @OptIn(ExperimentalLayoutApi ::class )
313+ @Composable
314+ internal fun CashBill (
315+ payloadData : List <Byte >,
297316 amount : LocalFiat ,
317+ modifier : Modifier = Modifier ,
318+ billCustomizations : TokenBillCustomizations ? = null,
319+ mint : String ,
298320) {
299321 val exchange = LocalExchange .current
300- val customTexture = token. billCustomizations?.texture
322+ val customTexture = billCustomizations?.texture
301323 val hasCustomTexture = customTexture != null
302324
303325 Box (
@@ -326,7 +348,7 @@ internal fun CashBill(
326348 Box (
327349 modifier = Modifier
328350 .fillMaxSize()
329- .background(CashBillDefaults .billColor(token ), punchShape)
351+ .background(CashBillDefaults .billColor(billCustomizations ), punchShape)
330352 )
331353
332354 // Texture layers — clipped with even-odd punch
@@ -412,7 +434,7 @@ internal fun CashBill(
412434 }
413435
414436 // Security strip
415- SecurityStrip (geometry = geometry, token = token )
437+ SecurityStrip (geometry = geometry, billCustomizations = billCustomizations )
416438
417439 // Bill Value Top Left
418440 BillAmount (
@@ -462,7 +484,7 @@ internal fun CashBill(
462484 ) {
463485 // Mint
464486 Text (
465- text = token.address.base58() ,
487+ text = mint ,
466488 fontSize = geometry.mintFontSize,
467489 color = CashBillDefaults .DecorColor ,
468490 )
@@ -508,7 +530,7 @@ internal fun CashBill(
508530 modifier = Modifier .align(Alignment .Center ),
509531 geometry = geometry,
510532 data = payloadData,
511- token = token
533+ billCustomizations = billCustomizations
512534 )
513535 }
514536 }
@@ -518,13 +540,13 @@ internal fun CashBill(
518540private fun SecurityStrip (
519541 modifier : Modifier = Modifier ,
520542 geometry : CashBillGeometry ,
521- token : Token ,
543+ billCustomizations : TokenBillCustomizations ? ,
522544) {
523545 Row (
524546 modifier = modifier
525547 .size(geometry.securityStripSize)
526548 .offset(geometry.securityStripPosition.x, geometry.securityStripPosition.y)
527- .punchRectangle(CashBillDefaults .punchBrushIn(punch = Punch .SecurityStrip , token )),
549+ .punchRectangle(CashBillDefaults .punchBrushIn(punch = Punch .SecurityStrip , billCustomizations )),
528550 ) {
529551 repeat(CashBillDefaults .SecurityStripCount ) {
530552 Image (
@@ -590,12 +612,12 @@ private fun BillCode(
590612 modifier : Modifier = Modifier ,
591613 geometry : CashBillGeometry ,
592614 data : List <Byte >,
593- token : Token
615+ billCustomizations : TokenBillCustomizations ? ,
594616) {
595617 Box (
596618 modifier = modifier
597619 .punchCircle(
598- brush = CashBillDefaults .punchBrushIn(punch = Punch .Code , token ),
620+ brush = CashBillDefaults .punchBrushIn(punch = Punch .Code , billCustomizations ),
599621 ),
600622 contentAlignment = Alignment .Center
601623 ) {
@@ -604,7 +626,7 @@ private fun BillCode(
604626 modifier = Modifier
605627 .size(geometry.codeSize),
606628 data = data,
607- token = token
629+ billCustomizations = billCustomizations
608630 )
609631 }
610632 }
0 commit comments