The system module has nothing more than just runtime version and getting account details. But for your convenience we've added a huge list for all possible account retrieval options:
Copy interface SystemModule {
suspend fun runtimeVersion (): RuntimeVersion ?
suspend fun accountByAccountId (accountId: ByteArrayConvertible ): Account ?
suspend fun accountByAccountId (accountId: AccountId ): Account ?
suspend fun accountByAccountId (accountIdHex: String ): Account ?
suspend fun accountByPublicKey (publicKey: ByteArray ): Account ?
suspend fun accountByPublicKey (publicKeyHex: String ): Account ?
suspend fun accountByKeyPair (keyPair: KeyPair ): Account ?
}
Runtime version
Runtime version is declared like this:
Copy data class RuntimeVersion (
val specName: String ,
val implName: String ,
val authoringVersion: Index ,
val specVersion: Index ,
val implVersion: Index ,
val apis: List < RuntimeVersionApi >,
val txVersion: Index ,
val stateVersion: UInt8
)
data class RuntimeVersionApi (
@FixedArray (size = 8 ) val id: List < Byte >,
val index: Index
)
Index is a dynamic type, and you can read more about this here .
And to get runtime version, it's simple as that:
Copy val client: SubstrateClient
val runtimeVersion: RuntimeVersion ? = client.modules.system. runtimeVersion ()
Account details
You can take a look at Account details class below:
Copy data class Account (
val nonce: Index ,
val consumers: Index ,
val providers: Index ,
val sufficients: Index ,
val data : Data
) {
data class Data (
val free: Balance ,
val reserved: Balance ,
val miscFrozen: Balance ,
val feeFrozen: Balance
)
}
In addition to Index , here you can find Balance type, which is also another dynamic type .
So here are all examples of how to get account details using different approaches:
Copy val client: SubstrateClient
val keyPair: KeyPair
val account: Account ? = client.modules.system. accountByKeyPair (keyPair)
val publicKey: ByteArray = keyPair.publicKey
val account: Account ? = client.modules.system. accountByPublicKey (publicKey)
val account: Account ? = client.modules.system. accountByPublicKey (publicKey.hex. encode ())
val accountId: AccountId = publicKey.ss58. accountId ()
val account: Account ? = client.modules.system. accountByAccountId (accountId)
val account: Account ? = client.modules.system. accountByAccountId (accountId.hex. encode ())
val account: Account ? = client.modules.system. accountByAccountId (accountId. asByteArrayConvertible ())