2020-06-10 00:08:19 -07:00
package cash.z.ecc.android.sdk.jni
2019-05-23 21:37:17 -07:00
2020-06-10 00:08:19 -07:00
import cash.z.ecc.android.sdk.ext.ZcashSdk.OUTPUT_PARAM_FILE_NAME
import cash.z.ecc.android.sdk.ext.ZcashSdk.SPEND_PARAM_FILE_NAME
2021-10-21 13:05:02 -07:00
import cash.z.ecc.android.sdk.internal.SdkDispatchers
import cash.z.ecc.android.sdk.internal.ext.deleteSuspend
2022-07-12 05:40:09 -07:00
import cash.z.ecc.android.sdk.internal.model.Checkpoint
2021-11-18 04:10:30 -08:00
import cash.z.ecc.android.sdk.internal.twig
2022-07-12 05:40:09 -07:00
import cash.z.ecc.android.sdk.model.BlockHeight
2022-07-07 05:52:07 -07:00
import cash.z.ecc.android.sdk.model.WalletBalance
2022-06-21 16:34:42 -07:00
import cash.z.ecc.android.sdk.model.Zatoshi
2022-08-02 06:29:09 -07:00
import cash.z.ecc.android.sdk.model.ZcashNetwork
2021-03-31 23:23:41 -07:00
import cash.z.ecc.android.sdk.tool.DerivationTool
import cash.z.ecc.android.sdk.type.UnifiedViewingKey
2021-10-21 13:05:02 -07:00
import kotlinx.coroutines.withContext
2019-10-21 03:26:02 -07:00
import java.io.File
2019-05-23 21:37:17 -07:00
/ * *
2019-09-26 09:58:37 -07:00
* Serves as the JNI boundary between the Kotlin and Rust layers . Functions in this class should
* not be called directly by code outside of the SDK . Instead , one of the higher - level components
* should be used such as Wallet . kt or CompactBlockProcessor . kt .
2019-05-23 21:37:17 -07:00
* /
2022-07-12 05:40:09 -07:00
internal class RustBackend private constructor (
override val network : ZcashNetwork ,
val birthdayHeight : BlockHeight ,
val pathDataDb : String ,
val pathCacheDb : String ,
val pathParamsDir : String
) : RustBackendWelding {
2019-11-01 13:25:28 -07:00
2021-10-21 13:05:02 -07:00
suspend fun clear ( clearCacheDb : Boolean = true , clearDataDb : Boolean = true ) {
2020-02-11 16:56:31 -08:00
if ( clearCacheDb ) {
2020-09-11 00:33:25 -07:00
twig ( " Deleting the cache database! " )
2021-10-21 13:05:02 -07:00
File ( pathCacheDb ) . deleteSuspend ( )
2020-02-11 16:56:31 -08:00
}
if ( clearDataDb ) {
2020-09-11 00:33:25 -07:00
twig ( " Deleting the data database! " )
2021-10-21 13:05:02 -07:00
File ( pathDataDb ) . deleteSuspend ( )
2020-02-11 16:56:31 -08:00
}
2019-10-21 03:26:02 -07:00
}
2019-09-26 09:58:37 -07:00
//
// Wrapper Functions
//
2022-01-19 10:39:07 -08:00
override suspend fun initDataDb ( ) = withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
initDataDb (
pathDataDb ,
networkId = network . id
)
}
2019-11-01 13:25:28 -07:00
2021-10-21 13:05:02 -07:00
override suspend fun initAccountsTable ( vararg keys : UnifiedViewingKey ) : Boolean {
2021-03-31 23:23:41 -07:00
val extfvks = Array ( keys . size ) { " " }
val extpubs = Array ( keys . size ) { " " }
keys . forEachIndexed { i , key ->
extfvks [ i ] = key . extfvk
extpubs [ i ] = key . extpub
}
2022-01-19 10:39:07 -08:00
return withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
initAccountsTableWithKeys (
pathDataDb ,
extfvks ,
extpubs ,
networkId = network . id
)
}
2021-03-31 23:23:41 -07:00
}
2019-09-26 09:58:37 -07:00
2021-10-21 13:05:02 -07:00
override suspend fun initAccountsTable (
2019-11-01 13:25:28 -07:00
seed : ByteArray ,
numberOfAccounts : Int
2021-03-31 23:23:41 -07:00
) : Array < UnifiedViewingKey > {
2021-04-09 18:43:07 -07:00
return DerivationTool . deriveUnifiedViewingKeys ( seed , network , numberOfAccounts ) . apply {
2021-03-31 23:23:41 -07:00
initAccountsTable ( * this )
}
}
2019-09-26 09:58:37 -07:00
2021-10-21 13:05:02 -07:00
override suspend fun initBlocksTable (
2022-07-12 05:40:09 -07:00
checkpoint : Checkpoint
2019-11-01 13:25:28 -07:00
) : Boolean {
2022-01-19 10:39:07 -08:00
return withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
initBlocksTable (
pathDataDb ,
2022-07-12 05:40:09 -07:00
checkpoint . height . value ,
checkpoint . hash ,
checkpoint . epochSeconds ,
checkpoint . tree ,
2021-10-21 13:05:02 -07:00
networkId = network . id
)
}
2019-11-01 13:25:28 -07:00
}
2019-09-26 09:58:37 -07:00
2022-06-21 16:34:42 -07:00
override suspend fun getShieldedAddress ( account : Int ) =
withContext ( SdkDispatchers . DATABASE _IO ) {
getShieldedAddress (
pathDataDb ,
account ,
networkId = network . id
)
}
2021-02-17 13:07:57 -08:00
2021-10-21 13:05:02 -07:00
override suspend fun getTransparentAddress ( account : Int , index : Int ) : String {
2021-02-17 13:07:57 -08:00
throw NotImplementedError ( " TODO: implement this at the zcash_client_sqlite level. But for now, use DerivationTool, instead to derive addresses from seeds " )
}
2019-05-23 21:37:17 -07:00
2022-06-21 16:34:42 -07:00
override suspend fun getBalance ( account : Int ) : Zatoshi {
val longValue = withContext ( SdkDispatchers . DATABASE _IO ) {
getBalance (
pathDataDb ,
account ,
networkId = network . id
)
}
return Zatoshi ( longValue )
2021-10-21 13:05:02 -07:00
}
2019-05-23 21:37:17 -07:00
2022-06-21 16:34:42 -07:00
override suspend fun getVerifiedBalance ( account : Int ) : Zatoshi {
val longValue = withContext ( SdkDispatchers . DATABASE _IO ) {
getVerifiedBalance (
pathDataDb ,
account ,
networkId = network . id
)
}
return Zatoshi ( longValue )
2021-10-21 13:05:02 -07:00
}
2019-09-26 09:58:37 -07:00
2021-10-21 13:05:02 -07:00
override suspend fun getReceivedMemoAsUtf8 ( idNote : Long ) =
2022-06-21 16:34:42 -07:00
withContext ( SdkDispatchers . DATABASE _IO ) {
getReceivedMemoAsUtf8 (
pathDataDb ,
idNote ,
networkId = network . id
)
}
2019-09-26 09:58:37 -07:00
2022-01-19 10:39:07 -08:00
override suspend fun getSentMemoAsUtf8 ( idNote : Long ) = withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
getSentMemoAsUtf8 (
pathDataDb ,
idNote ,
networkId = network . id
)
}
2019-09-26 09:58:37 -07:00
2022-01-19 10:39:07 -08:00
override suspend fun validateCombinedChain ( ) = withContext ( SdkDispatchers . DATABASE _IO ) {
2022-07-12 05:40:09 -07:00
val validationResult = validateCombinedChain (
2021-10-21 13:05:02 -07:00
pathCacheDb ,
pathDataDb ,
2022-06-23 05:31:02 -07:00
networkId = network . id
2021-10-21 13:05:02 -07:00
)
2022-07-12 05:40:09 -07:00
if ( - 1L == validationResult ) {
null
} else {
BlockHeight . new ( network , validationResult )
}
2021-10-21 13:05:02 -07:00
}
2019-09-26 09:58:37 -07:00
2022-07-12 05:40:09 -07:00
override suspend fun getNearestRewindHeight ( height : BlockHeight ) : BlockHeight =
2022-06-21 16:34:42 -07:00
withContext ( SdkDispatchers . DATABASE _IO ) {
2022-07-12 05:40:09 -07:00
BlockHeight . new (
network ,
getNearestRewindHeight (
pathDataDb ,
height . value ,
networkId = network . id
)
2022-06-21 16:34:42 -07:00
)
}
2021-04-14 15:44:17 -07:00
2021-04-09 18:25:21 -07:00
/ * *
* Deletes data for all blocks above the given height . Boils down to :
*
* DELETE FROM blocks WHERE height > ?
* /
2022-07-12 05:40:09 -07:00
override suspend fun rewindToHeight ( height : BlockHeight ) =
2022-06-21 16:34:42 -07:00
withContext ( SdkDispatchers . DATABASE _IO ) {
rewindToHeight (
pathDataDb ,
2022-07-12 05:40:09 -07:00
height . value ,
2022-06-21 16:34:42 -07:00
networkId = network . id
)
}
2019-09-26 09:58:37 -07:00
2021-10-21 13:05:02 -07:00
override suspend fun scanBlocks ( limit : Int ) : Boolean {
2020-01-14 09:56:03 -08:00
return if ( limit > 0 ) {
2022-01-19 10:39:07 -08:00
withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
scanBlockBatch (
pathCacheDb ,
pathDataDb ,
limit ,
networkId = network . id
)
}
2020-01-14 09:56:03 -08:00
} else {
2022-01-19 10:39:07 -08:00
withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
scanBlocks (
pathCacheDb ,
pathDataDb ,
networkId = network . id
)
}
2020-01-14 09:56:03 -08:00
}
}
2019-09-26 09:58:37 -07:00
2022-06-21 16:34:42 -07:00
override suspend fun decryptAndStoreTransaction ( tx : ByteArray ) =
withContext ( SdkDispatchers . DATABASE _IO ) {
decryptAndStoreTransaction (
pathDataDb ,
tx ,
networkId = network . id
)
}
2020-03-12 21:41:17 -07:00
2021-10-21 13:05:02 -07:00
override suspend fun createToAddress (
2020-06-09 19:14:22 -07:00
consensusBranchId : Long ,
2019-09-26 09:58:37 -07:00
account : Int ,
extsk : String ,
to : String ,
value : Long ,
2019-11-12 08:58:15 -08:00
memo : ByteArray ?
2022-01-19 10:39:07 -08:00
) : Long = withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
createToAddress (
2021-02-17 13:07:57 -08:00
pathDataDb ,
2021-10-21 13:05:02 -07:00
consensusBranchId ,
account ,
2021-02-17 13:07:57 -08:00
extsk ,
2021-10-21 13:05:02 -07:00
to ,
value ,
2021-02-17 13:07:57 -08:00
memo ?: ByteArray ( 0 ) ,
2021-03-10 19:04:39 -08:00
" $pathParamsDir / $SPEND _PARAM_FILE_NAME " ,
2021-04-09 18:43:07 -07:00
" $pathParamsDir / $OUTPUT _PARAM_FILE_NAME " ,
2022-06-23 05:31:02 -07:00
networkId = network . id
2021-02-17 13:07:57 -08:00
)
}
2021-10-21 13:05:02 -07:00
override suspend fun shieldToAddress (
extsk : String ,
tsk : String ,
memo : ByteArray ?
) : Long {
twig ( " TMP: shieldToAddress with db path: $pathDataDb , ${memo?.size} " )
2022-01-19 10:39:07 -08:00
return withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
shieldToAddress (
pathDataDb ,
0 ,
extsk ,
tsk ,
memo ?: ByteArray ( 0 ) ,
" $pathParamsDir / $SPEND _PARAM_FILE_NAME " ,
" $pathParamsDir / $OUTPUT _PARAM_FILE_NAME " ,
2022-06-23 05:31:02 -07:00
networkId = network . id
2021-10-21 13:05:02 -07:00
)
}
}
override suspend fun putUtxo (
2021-02-17 13:07:57 -08:00
tAddress : String ,
txId : ByteArray ,
index : Int ,
script : ByteArray ,
value : Long ,
2022-07-12 05:40:09 -07:00
height : BlockHeight
2022-01-19 10:39:07 -08:00
) : Boolean = withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
putUtxo (
pathDataDb ,
tAddress ,
txId ,
index ,
script ,
value ,
2022-07-12 05:40:09 -07:00
height . value ,
2021-10-21 13:05:02 -07:00
networkId = network . id
)
}
2021-02-17 13:07:57 -08:00
2021-10-21 13:05:02 -07:00
override suspend fun clearUtxos (
2021-03-31 06:36:46 -07:00
tAddress : String ,
2022-07-12 05:40:09 -07:00
aboveHeightInclusive : BlockHeight
2022-01-19 10:39:07 -08:00
) : Boolean = withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
clearUtxos (
pathDataDb ,
tAddress ,
2022-07-12 05:40:09 -07:00
// The Kotlin API is inclusive, but the Rust API is exclusive.
// This can create invalid BlockHeights if the height is saplingActivationHeight.
aboveHeightInclusive . value - 1 ,
2021-10-21 13:05:02 -07:00
networkId = network . id
)
}
2021-03-31 06:36:46 -07:00
2021-10-21 13:05:02 -07:00
override suspend fun getDownloadedUtxoBalance ( address : String ) : WalletBalance {
2022-01-19 10:39:07 -08:00
val verified = withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
getVerifiedTransparentBalance (
pathDataDb ,
address ,
networkId = network . id
)
}
2022-01-19 10:39:07 -08:00
val total = withContext ( SdkDispatchers . DATABASE _IO ) {
2021-10-21 13:05:02 -07:00
getTotalTransparentBalance (
pathDataDb ,
address ,
networkId = network . id
)
}
2022-06-21 16:34:42 -07:00
return WalletBalance ( Zatoshi ( total ) , Zatoshi ( verified ) )
2021-02-17 13:07:57 -08:00
}
2021-10-21 13:05:02 -07:00
override fun isValidShieldedAddr ( addr : String ) =
isValidShieldedAddress ( addr , networkId = network . id )
2019-05-23 21:37:17 -07:00
2021-10-21 13:05:02 -07:00
override fun isValidTransparentAddr ( addr : String ) =
isValidTransparentAddress ( addr , networkId = network . id )
2020-06-09 19:14:22 -07:00
2022-07-12 05:40:09 -07:00
override fun getBranchIdForHeight ( height : BlockHeight ) : Long =
branchIdForHeight ( height . value , networkId = network . id )
2019-05-23 21:37:17 -07:00
2021-02-17 13:07:57 -08:00
// /**
// * This is a proof-of-concept for doing Local RPC, where we are effectively using the JNI
// * boundary as a grpc server. It is slightly inefficient in terms of both space and time but
// * given that it is all done locally, on the heap, it seems to be a worthwhile tradeoff because
// * it reduces the complexity and expands the capacity for the two layers to communicate.
// *
// * We're able to keep the "unsafe" byteArray functions private and wrap them in typeSafe
// * equivalents and, eventually, surface any parse errors (for now, errors are only logged).
// */
// override fun parseTransactionDataList(tdl: LocalRpcTypes.TransactionDataList): LocalRpcTypes.TransparentTransactionList {
// return try {
// // serialize the list, send it over to rust and get back a serialized set of results that we parse out and return
// return LocalRpcTypes.TransparentTransactionList.parseFrom(parseTransactionDataList(tdl.toByteArray()))
// } catch (t: Throwable) {
// twig("ERROR: failed to parse transaction data list due to: $t caused by: ${t.cause}")
// LocalRpcTypes.TransparentTransactionList.newBuilder().build()
// }
// }
2020-08-13 18:03:19 -07:00
2019-11-01 13:25:28 -07:00
/ * *
* Exposes all of the librustzcash functions along with helpers for loading the static library .
* /
companion object {
2021-10-21 13:05:02 -07:00
internal val rustLibraryLoader = NativeLibraryLoader ( " zcashwalletsdk " )
2019-11-01 13:25:28 -07:00
2020-09-21 19:43:50 -07:00
/ * *
* Loads the library and initializes path variables . Although it is best to only call this
* function once , it is idempotent .
* /
2021-10-21 13:05:02 -07:00
suspend fun init (
2020-09-21 19:43:50 -07:00
cacheDbPath : String ,
dataDbPath : String ,
paramsPath : String ,
2021-04-09 18:43:07 -07:00
zcashNetwork : ZcashNetwork ,
2022-07-12 05:40:09 -07:00
birthdayHeight : BlockHeight
2020-09-21 19:43:50 -07:00
) : RustBackend {
2021-10-21 13:05:02 -07:00
rustLibraryLoader . load ( )
2022-07-12 05:40:09 -07:00
return RustBackend (
zcashNetwork ,
birthdayHeight ,
pathDataDb = dataDbPath ,
pathCacheDb = cacheDbPath ,
2020-09-21 19:43:50 -07:00
pathParamsDir = paramsPath
2022-07-12 05:40:09 -07:00
)
2020-09-21 19:43:50 -07:00
}
2021-07-29 10:23:45 -07:00
/ * *
* Forwards Rust logs to logcat . This is a function that is intended for debug purposes . All
* logs will be tagged with ` cash . z . rust . logs ` . Typically , a developer would clone
* librustzcash locally and then modify Cargo . toml in this project to point to their local
* build ( see Cargo . toml for details ) . From there , they can add any log messages they want
* and have them surfaced into the Android logging system . By default , this behavior is
* disabled and this is the function that enables it . Initially only the logs in
* [ src / main / rust / lib . rs ] will appear and any additional logs would need to be added by the
* developer .
* /
fun enableRustLogs ( ) = initLogs ( )
2019-11-01 13:25:28 -07:00
//
// External Functions
//
2019-06-04 07:15:19 -07:00
2021-10-21 13:05:02 -07:00
@JvmStatic
private external fun initDataDb ( dbDataPath : String , networkId : Int ) : Boolean
2019-05-23 21:37:17 -07:00
2021-10-21 13:05:02 -07:00
@JvmStatic
private external fun initAccountsTableWithKeys (
2020-09-11 00:23:08 -07:00
dbDataPath : String ,
2021-03-31 23:23:41 -07:00
extfvk : Array < out String > ,
extpub : Array < out String > ,
2022-06-23 05:31:02 -07:00
networkId : Int
2020-09-11 00:23:08 -07:00
) : Boolean
2019-05-23 21:37:17 -07:00
2021-10-21 13:05:02 -07:00
@JvmStatic
private external fun initBlocksTable (
2019-11-01 13:25:28 -07:00
dbDataPath : String ,
2022-07-12 05:40:09 -07:00
height : Long ,
2019-11-01 13:25:28 -07:00
hash : String ,
time : Long ,
2021-04-09 18:43:07 -07:00
saplingTree : String ,
2022-06-23 05:31:02 -07:00
networkId : Int
2019-11-01 13:25:28 -07:00
) : Boolean
2019-05-23 21:37:17 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun getShieldedAddress (
dbDataPath : String ,
account : Int ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-04-09 18:43:07 -07:00
) : String
2019-05-23 21:37:17 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun isValidShieldedAddress ( addr : String , networkId : Int ) : Boolean
2019-05-23 21:37:17 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun isValidTransparentAddress ( addr : String , networkId : Int ) : Boolean
2019-11-01 13:25:28 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun getBalance ( dbDataPath : String , account : Int , networkId : Int ) : Long
2019-11-01 13:25:28 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun getVerifiedBalance (
dbDataPath : String ,
account : Int ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-04-09 18:43:07 -07:00
) : Long
2019-11-01 13:25:28 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun getReceivedMemoAsUtf8 (
dbDataPath : String ,
idNote : Long ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-04-09 18:43:07 -07:00
) : String
2019-11-01 13:25:28 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun getSentMemoAsUtf8 (
dbDataPath : String ,
dNote : Long ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-04-09 18:43:07 -07:00
) : String
2019-11-01 13:25:28 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun validateCombinedChain (
dbCachePath : String ,
dbDataPath : String ,
2022-06-23 05:31:02 -07:00
networkId : Int
2022-07-12 05:40:09 -07:00
) : Long
2019-11-01 13:25:28 -07:00
2021-04-14 15:44:17 -07:00
@JvmStatic
private external fun getNearestRewindHeight (
dbDataPath : String ,
2022-07-12 05:40:09 -07:00
height : Long ,
2022-06-23 05:31:02 -07:00
networkId : Int
2022-07-12 05:40:09 -07:00
) : Long
2021-04-14 15:44:17 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun rewindToHeight (
dbDataPath : String ,
2022-07-12 05:40:09 -07:00
height : Long ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-04-09 18:43:07 -07:00
) : Boolean
2019-11-01 13:25:28 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun scanBlocks (
dbCachePath : String ,
dbDataPath : String ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-04-09 18:43:07 -07:00
) : Boolean
2019-11-01 13:25:28 -07:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun scanBlockBatch (
dbCachePath : String ,
dbDataPath : String ,
limit : Int ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-04-09 18:43:07 -07:00
) : Boolean
2020-01-14 09:56:03 -08:00
2021-04-09 18:43:07 -07:00
@JvmStatic
private external fun decryptAndStoreTransaction (
dbDataPath : String ,
tx : ByteArray ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-04-09 18:43:07 -07:00
)
2020-03-12 21:41:17 -07:00
2021-10-21 13:05:02 -07:00
@JvmStatic
private external fun createToAddress (
2019-11-01 13:25:28 -07:00
dbDataPath : String ,
2020-06-09 19:14:22 -07:00
consensusBranchId : Long ,
2019-11-01 13:25:28 -07:00
account : Int ,
extsk : String ,
to : String ,
value : Long ,
memo : ByteArray ,
spendParamsPath : String ,
2021-04-09 18:43:07 -07:00
outputParamsPath : String ,
2022-06-23 05:31:02 -07:00
networkId : Int
2019-11-01 13:25:28 -07:00
) : Long
2021-10-21 13:05:02 -07:00
@JvmStatic
private external fun shieldToAddress (
2021-02-17 13:07:57 -08:00
dbDataPath : String ,
account : Int ,
extsk : String ,
tsk : String ,
memo : ByteArray ,
spendParamsPath : String ,
2021-04-09 18:43:07 -07:00
outputParamsPath : String ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-02-17 13:07:57 -08:00
) : Long
2021-10-21 13:05:02 -07:00
@JvmStatic
private external fun initLogs ( )
2019-05-23 21:37:17 -07:00
2021-10-21 13:05:02 -07:00
@JvmStatic
2022-07-12 05:40:09 -07:00
private external fun branchIdForHeight ( height : Long , networkId : Int ) : Long
2020-08-13 18:03:19 -07:00
2021-10-21 13:05:02 -07:00
@JvmStatic
private external fun putUtxo (
2021-02-17 13:07:57 -08:00
dbDataPath : String ,
tAddress : String ,
txId : ByteArray ,
index : Int ,
script : ByteArray ,
value : Long ,
2022-07-12 05:40:09 -07:00
height : Long ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-02-17 13:07:57 -08:00
) : Boolean
2021-10-21 13:05:02 -07:00
@JvmStatic
private external fun clearUtxos (
2021-03-31 06:36:46 -07:00
dbDataPath : String ,
tAddress : String ,
2022-07-12 05:40:09 -07:00
aboveHeight : Long ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-03-31 06:36:46 -07:00
) : Boolean
2021-10-21 13:05:02 -07:00
@JvmStatic
private external fun getVerifiedTransparentBalance (
2021-02-17 13:07:57 -08:00
pathDataDb : String ,
2021-04-09 18:43:07 -07:00
taddr : String ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-02-17 13:07:57 -08:00
) : Long
2021-10-21 13:05:02 -07:00
@JvmStatic
private external fun getTotalTransparentBalance (
2021-02-17 13:07:57 -08:00
pathDataDb : String ,
2021-04-09 18:43:07 -07:00
taddr : String ,
2022-06-23 05:31:02 -07:00
networkId : Int
2021-02-17 13:07:57 -08:00
) : Long
2019-11-01 13:25:28 -07:00
}
2020-06-09 19:14:22 -07:00
}