Skip to content

Commit 1075fbe

Browse files
committed
chore(services/opencode): add tracing for failures to fund/cancel cash links
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent faf4091 commit 1075fbe

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

apps/flipcash/shared/session/src/main/kotlin/com/flipcash/app/session/internal/RealSessionController.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,6 @@ class RealSessionController @Inject constructor(
429429
vault = giftCard.cluster.vaultPublicKey,
430430
owner = owner,
431431
).onFailure {
432-
TopBarManager.showMessage(
433-
title = resources.getString(R.string.error_title_failedToCancelCashLink),
434-
message = resources.getString(R.string.error_description_failedToCancelCashLink)
435-
)
436432
cancelSend()
437433
}.onSuccess {
438434
balanceController.fetchBalance()

services/opencode/src/main/kotlin/com/getcode/opencode/controllers/TransactionController.kt

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class TransactionController @Inject constructor(
6060
if (areLimitsStale || force) {
6161
val since = Clock.System.now()
6262
trace(
63-
tag = "TRX",
63+
tag = "Transactions",
6464
message = "updating limits from $since",
6565
type = TraceType.Process
6666
)
@@ -71,7 +71,7 @@ class TransactionController @Inject constructor(
7171
_limits.value = it
7272
}.onFailure {
7373
trace(
74-
tag = "TRX",
74+
tag = "Transactions",
7575
message = "Failed to update limits",
7676
error = it
7777
)
@@ -88,7 +88,7 @@ class TransactionController @Inject constructor(
8888
destination = destination
8989
).onSuccess {
9090
trace(
91-
tag = "TRX",
91+
tag = "Transactions",
9292
message = "Airdrop was successful.",
9393
type = TraceType.Process
9494
)
@@ -147,18 +147,34 @@ class TransactionController @Inject constructor(
147147
)
148148

149149
return submitIntent(scope, intent, owner.authority.keyPair)
150+
.onFailure {
151+
trace(
152+
tag = "Transactions",
153+
message = "Failed to fund cash link",
154+
error = it,
155+
type = TraceType.Process
156+
)
157+
}
150158
}
151159

152160
suspend fun cancelRemoteSend(
153161
owner: AccountCluster,
154162
vault: PublicKey,
155163
): Result<Unit> {
156164
trace(
157-
tag = "TRX",
165+
tag = "Transactions",
158166
message = "Canceling remote send for vault ${vault.bytes.base64}",
159167
type = TraceType.User
160168
)
161169
return repository.voidGiftCard(owner.authority.keyPair, vault)
170+
.onFailure {
171+
trace(
172+
tag = "Transactions",
173+
message = "Failed to cancel cash link",
174+
error = it,
175+
type = TraceType.Process
176+
)
177+
}
162178
}
163179

164180
suspend fun receiveRemotely(
@@ -197,7 +213,7 @@ class TransactionController @Inject constructor(
197213

198214
if (debugLogs) {
199215
trace(
200-
tag = "opencodescan",
216+
tag = "CodeScan",
201217
message = "pollIntentMetadata: start",
202218
type = TraceType.Process
203219
)
@@ -209,7 +225,7 @@ class TransactionController @Inject constructor(
209225
.onEach {
210226
if (debugLogs) {
211227
trace(
212-
tag = "opencodescan",
228+
tag = "CodeScan",
213229
message = "pollIntentMetadata: [$it] fetch data",
214230
type = TraceType.Process
215231
)
@@ -231,7 +247,7 @@ class TransactionController @Inject constructor(
231247
onSuccess = { metadata ->
232248
if (debugLogs) {
233249
trace(
234-
tag = "opencodescan",
250+
tag = "CodeScan",
235251
message = "pollIntentMetadata: took ${attemptCount.get()} attempts",
236252
type = TraceType.Process
237253
)

0 commit comments

Comments
 (0)