File tree Expand file tree Collapse file tree
libs/encryption/keys/src/main/kotlin/com/getcode/solana/keys
services/opencode/src/main/kotlin/com/getcode/opencode/internal/network/executors Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,13 @@ abstract class KeyType(bytes: List<Byte>) {
3030
3131fun KeyType.base58 (): String = Base58 .encode(bytes.toByteArray())
3232fun KeyType.base64 (): String = bytes.toByteArray().encodeBase64()
33+ fun KeyType.base58Redacted (): String = base58().redact(visibleLength = 4 )
34+ fun KeyType.base64Redacted (): String = base64().redact(visibleLength = 8 )
35+
36+ fun String.redact (visibleLength : Int = 4): String {
37+ if (length <= visibleLength * 2 ) return this
38+ return " ${take(visibleLength)} …${takeLast(visibleLength)} "
39+ }
3340
3441class Key16 (bytes : List <Byte >) : KeyType(bytes) {
3542 override val size: Int get() = LENGTH_16
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import com.getcode.opencode.solana.intents.IntentType
1414import com.getcode.opencode.solana.intents.ServerParameter
1515import com.getcode.services.opencode.BuildConfig
1616import com.getcode.solana.keys.base58
17+ import com.getcode.solana.keys.redact
1718import com.getcode.utils.TraceType
1819import com.getcode.utils.trace
1920import kotlinx.coroutines.CoroutineScope
@@ -99,7 +100,13 @@ class IntentExecutor(
99100 owner : KeyPair ,
100101 ): Result <IntentType > = openBidirectionalStreamForResult(
101102 streamRef = streamRef,
102- apiCall = api::submitIntent,
103+ apiCall = { request ->
104+ trace(
105+ tag = " SubmitIntent" ,
106+ message = " submitting intent ${intent.id.base58().redact()} "
107+ )
108+ api.submitIntent(request)
109+ },
103110 initialRequest = { intent.requestToSubmitActions(owner) },
104111 responseHandler = { response, onResult, requestChannel ->
105112 when (val result = response.responseCase) {
You can’t perform that action at this time.
0 commit comments