Updated on 2026-08-14
This commit is contained in:
parent
ff985dec4e
commit
cd78832ff1
30 changed files with 89 additions and 23 deletions
1
domain/tokens/models/.gitignore
vendored
Normal file
1
domain/tokens/models/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/build
|
||||
4
domain/tokens/models/build.gradle.kts
Normal file
4
domain/tokens/models/build.gradle.kts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
plugins {
|
||||
alias(deps.plugins.kotlin.jvm)
|
||||
id("configuration")
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.tangem.domain.tokens.models
|
||||
|
||||
/**
|
||||
* Represents a blockchain network, identified by a unique ID and a human-readable name.
|
||||
*
|
||||
* @property id The unique identifier of the network, encapsulated as an inline value class.
|
||||
* @property name The human-readable name of the network, such as "Ethereum" or "Bitcoin".
|
||||
*
|
||||
* @throws IllegalArgumentException If the name or ID is blank.
|
||||
*/
|
||||
data class Network(val id: ID, val name: String) {
|
||||
|
||||
init {
|
||||
require(name.isNotBlank()) { "Network name must not be blank" }
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a unique identifier for a network.
|
||||
*
|
||||
* @property value The string value of the network ID.
|
||||
*/
|
||||
@JvmInline
|
||||
value class ID(val value: String) {
|
||||
|
||||
init {
|
||||
require(value.isNotBlank()) { "Network ID must not be blank" }
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue