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
import kotlinx.coroutines.reactor.mono | |
import org.ton.api.tonnode.TonNodeBlockIdExt | |
import org.ton.bigint.BigInt | |
import org.ton.block.* | |
import org.ton.crypto.base64 | |
import org.ton.lite.api.liteserver.LiteServerBlockTransactions | |
import org.ton.lite.api.liteserver.LiteServerTransactionId3 | |
import org.ton.lite.client.LiteClient | |
import reactor.kotlin.core.publisher.toFlux |
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
@JsonIgnoreProperties(ignoreUnknown = true) | |
data class TelegramAuthRequestDTO( | |
@JsonProperty("auth_date") | |
val authDate: Long, | |
@JsonProperty("first_name") | |
val firstName: String?, | |
@JsonProperty("last_name") | |
val lastName: String?, |
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
fun Any.forceSerialize(separator: String, sorted: Boolean = false): String { | |
var fieldNameToAnnotatedNameMap = this.javaClass.declaredFields.map { it.name }.associateWith { fieldName -> | |
val jsonFieldName = | |
this::class.primaryConstructor?.parameters?.first { it.name == fieldName }?.annotations?.firstOrNull { it is JsonProperty } | |
val serializedName = if (jsonFieldName != null) (jsonFieldName as JsonProperty).value else fieldName | |
serializedName | |
} | |
if (sorted) | |
fieldNameToAnnotatedNameMap = fieldNameToAnnotatedNameMap.toList().sortedBy { (_, value) -> value}.toMap() | |
return fieldNameToAnnotatedNameMap.entries.joinToString(separator) { e -> |
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
class TrieNode<T>( | |
val key: String?, var value: T? | |
) { | |
var parent: TrieNode<T>? = null | |
val children: HashMap<String, TrieNode<T>> = hashMapOf() | |
var end: Boolean = false | |
fun getWord(): String { | |
val output = mutableListOf<String?>() | |
var node: TrieNode<T>? = this |
NewerOlder