Skip to content

Commit 0d4d279

Browse files
authored
Add analytic events for fiat deposit (#823)
1 parent 6c5cb23 commit 0d4d279

File tree

7 files changed

+154
-96
lines changed

7 files changed

+154
-96
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ allprojects {
5353
}
5454

5555
group = "exchange.dydx.abacus"
56-
version = "1.14.11"
56+
version = "1.14.12"
5757

5858
repositories {
5959
google()

integration/iOS/Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 90 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/iOS/Pods/Target Support Files/Pods-abacus.ios/Pods-abacus.ios-acknowledgements.markdown

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/iOS/Pods/Target Support Files/Pods-abacus.ios/Pods-abacus.ios-acknowledgements.plist

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commonMain/kotlin/exchange.dydx.abacus/calculator/TradeInput/TradeInputOptionsCalculator.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,51 +79,51 @@ internal class TradeInputOptionsCalculator(
7979
return when (trade.type) {
8080
OrderType.Market -> {
8181
return when (trade.marginMode) {
82-
MarginMode.Isolated -> listOf(
82+
MarginMode.Isolated -> listOfNotNull(
8383
sizeField(),
8484
balancePercentField(),
8585
bracketsField(),
8686
marginModeField(market, account, subaccount),
8787
reduceOnlyField(),
88-
).filterNotNull()
88+
)
8989

90-
else -> listOf(
90+
else -> listOfNotNull(
9191
sizeField(),
9292
leverageField(),
9393
balancePercentField(),
9494
bracketsField(),
9595
marginModeField(market, account, subaccount),
9696
reduceOnlyField(),
97-
).filterNotNull()
97+
)
9898
}
9999
}
100100

101101
OrderType.Limit -> {
102102
when (trade.timeInForce) {
103103
"GTT" ->
104-
listOf(
104+
listOfNotNull(
105105
sizeField(),
106106
limitPriceField(),
107107
timeInForceField(),
108108
goodTilField(),
109109
postOnlyField(),
110110
marginModeField(market, account, subaccount),
111-
).filterNotNull()
111+
)
112112

113113
else ->
114-
listOf(
114+
listOfNotNull(
115115
sizeField(),
116116
limitPriceField(),
117117
timeInForceField(),
118118
marginModeField(market, account, subaccount),
119119
reduceOnlyField(),
120-
).filterNotNull()
120+
)
121121
}
122122
}
123123

124124
OrderType.StopLimit, OrderType.TakeProfitLimit -> {
125125
val execution = trade.execution
126-
listOf(
126+
listOfNotNull(
127127
sizeField(),
128128
limitPriceField(),
129129
triggerPriceField(),
@@ -134,28 +134,28 @@ internal class TradeInputOptionsCalculator(
134134
"IOC" -> reduceOnlyField()
135135
else -> null
136136
},
137-
).filterNotNull()
137+
)
138138
}
139139

140140
OrderType.StopMarket, OrderType.TakeProfitMarket -> {
141-
listOf(
141+
listOfNotNull(
142142
sizeField(),
143143
triggerPriceField(),
144144
goodTilField(),
145145
executionField(includesDefaultAndPostOnly = false),
146146
marginModeField(market, account, subaccount),
147147
reduceOnlyField(),
148-
).filterNotNull()
148+
)
149149
}
150150

151151
OrderType.TrailingStop -> {
152-
listOf(
152+
listOfNotNull(
153153
sizeField(),
154154
trailingPercentField(),
155155
goodTilField(),
156156
executionField(includesDefaultAndPostOnly = false),
157157
marginModeField(market, account, subaccount),
158-
).filterNotNull()
158+
)
159159
}
160160

161161
OrderType.Liquidated,

src/commonMain/kotlin/exchange.dydx.abacus/functional/ClientAnalyticEvents.kt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,44 @@ class ClientTrackableEventType {
259259
"tokenInChainId" to status.routeStatuses?.lastOrNull()?.chainId,
260260
).filterValues { it != null } as Map<String, Any>
261261
}
262+
263+
class FiatDepositShowInputEvent() : ClientTrackableEvent {
264+
override val name: String get() = "FiatDepositShowInput"
265+
override val customParameters: Map<String, Any> get() = emptyMap()
266+
}
267+
268+
class FiatDepositRouteToProviderCompletedEvent(
269+
private val amountUsd: Double?,
270+
private val depositAddress: String?,
271+
private val provider: String,
272+
) : ClientTrackableEvent {
273+
override val name: String get() = "FiatDepositRouteToProviderCompleted"
274+
override val customParameters: Map<String, Any> get() = mapOf(
275+
"amountUsd" to amountUsd,
276+
"depositAddress" to depositAddress,
277+
"provider" to provider,
278+
).filterValues { it != null } as Map<String, Any>
279+
}
280+
281+
class FiatDepositRouteToProviderErrorEvent(
282+
private val message: String?,
283+
private val provider: String,
284+
) : ClientTrackableEvent {
285+
override val name: String get() = "FiatDepositRouteToProviderError"
286+
override val customParameters: Map<String, Any> get() = mapOf(
287+
"message" to message,
288+
"provider" to provider,
289+
).filterValues { it != null } as Map<String, Any>
290+
}
291+
292+
class FiatDepositMoonPayCallbackEvent(
293+
private val callbackName: String,
294+
private val data: Map<String, Any>? = null,
295+
) : ClientTrackableEvent {
296+
override val name: String get() = "FiatDepositMoonPayCallback"
297+
override val customParameters: Map<String, Any> get() = mapOf(
298+
"callbackName" to callbackName,
299+
"data" to data,
300+
).filterValues { it != null } as Map<String, Any>
301+
}
262302
}

v4_abacus.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'v4_abacus'
3-
spec.version = '1.14.11'
3+
spec.version = '1.14.12'
44
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
55
spec.source = { :http=> ''}
66
spec.authors = ''

0 commit comments

Comments
 (0)