-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AND-5746 [Solana] Improved fee calculation logic
- Loading branch information
1 parent
ec4bba3
commit 68f59ee
Showing
22 changed files
with
677 additions
and
487 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
blockchain/src/main/java/com/tangem/blockchain/blockchains/solana/ResultExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.tangem.blockchain.blockchains.solana | ||
|
||
import com.tangem.blockchain.extensions.Result | ||
import com.tangem.blockchain.extensions.SimpleResult | ||
import com.tangem.common.CompletionResult | ||
|
||
internal fun <T> Result<T>.toSimpleResult(): SimpleResult { | ||
return when (this) { | ||
is Result.Success -> SimpleResult.Success | ||
is Result.Failure -> SimpleResult.Failure(this.error) | ||
} | ||
} | ||
|
||
internal inline fun <T> CompletionResult<T>.successOr(failureClause: (CompletionResult.Failure<T>) -> Nothing): T { | ||
return when (this) { | ||
is CompletionResult.Success -> this.data | ||
is CompletionResult.Failure -> failureClause(this) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.