diff --git a/altchain-sdk/src/main/kotlin/org/veriblock/sdk/alt/SecurityInheritingChain.kt b/altchain-sdk/src/main/kotlin/org/veriblock/sdk/alt/SecurityInheritingChain.kt index 81a1bda35..d3d80e512 100644 --- a/altchain-sdk/src/main/kotlin/org/veriblock/sdk/alt/SecurityInheritingChain.kt +++ b/altchain-sdk/src/main/kotlin/org/veriblock/sdk/alt/SecurityInheritingChain.kt @@ -23,12 +23,7 @@ interface SecurityInheritingChain { /** * Common configuration for the chain. */ - val config: ChainConfig - - /** - * Returns this security inheriting chain's unique identifier. - */ - val id: Long + suspend fun getConfig(): ChainConfig /** * Returns this security inheriting chain's key, usually the token symbol. @@ -71,41 +66,39 @@ interface SecurityInheritingChain { suspend fun getTransaction(txId: String): SecurityInheritingTransaction? /** - * Returns this security inheriting chain's payout delay, in blocks. + * Returns this security inheriting chain's best known VeriBlock Block hash. */ - fun getPayoutDelay(): Int + suspend fun getVbkBestKnownBlockHash(): String - /** - * Returns this security inheriting chain's best known VeriBlock Block hash. + /** + * Returns this security inheriting chain's VBK block */ - suspend fun getBestKnownVbkBlockHash(): String + suspend fun getVbkBlock(hash: String): VbkBlock /** - * Returns this security inheriting chain's PoP mempool (ATVs and VTBs). + * Returns this security inheriting chain's best known Bitcoin Block hash. */ - suspend fun getPopMempool(): PopMempool + suspend fun getBtcBestKnownBlockHash(): String /** - * Retrieves mining instruction from the SI chain for the given [blockHeight] (or the best block height - * if [blockHeight] is null). + * Returns this security inheriting chain's BTC block */ - suspend fun getMiningInstruction(blockHeight: Int? = null): ApmInstruction + suspend fun getBtcBlock(hash: String): BtcBlock /** - * Submits VeriBlock context blocks ([contextBlocks]), ATVs ([atvs]) and VTBs ([vtbs]) to the altchain - * @return The submission's resulting first ATV id + * Returns this security inheriting chain's PoP mempool (ATVs and VTBs). */ - suspend fun submit( - contextBlocks: List, - atvs: List, - vtbs: List - ) - - suspend fun submitContext(contextBlocks: List) = submit(contextBlocks, emptyList(), emptyList()) + suspend fun getPopMempool(): PopMempool - suspend fun submitAtvs(atvs: List) = submit(emptyList(), atvs, emptyList()) + /** + * Retrieves mining instruction from the SI chain for the given [blockHash] (or the best block hash + * if [block hash] is null). + */ + suspend fun getMiningInstruction(blockHash: String? = null): ApmInstruction - suspend fun submitVtbs(vtbs: List) = submit(emptyList(), emptyList(), vtbs) + suspend fun submitAtv(atv: AltPublication): ValidationState + suspend fun submitVtb(vtb: VeriBlockPublication): ValidationState + suspend fun submitVbk(vbk: VbkBlock): ValidationState /** * Extracts an address' display string from the given data (coming from the Mining Instruction) @@ -132,3 +125,9 @@ interface SecurityInheritingChain { */ suspend fun getBlockChainInfo(): StateInfo } + +data class ValidationState( + val valid: Boolean, + val code: String? = null, + val message: String? = null +) \ No newline at end of file