tech.pylons.lib.core.IEngine.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of libpylons Show documentation
Show all versions of libpylons Show documentation
Library providing common functionality for interacting with the Pylons ecosystem
The newest version!
package tech.pylons.lib.core
import tech.pylons.lib.types.*
import tech.pylons.lib.types.credentials.ICredentials
import tech.pylons.lib.types.tx.Coin
import tech.pylons.lib.types.tx.Trade
import tech.pylons.lib.types.tx.item.Item
import tech.pylons.lib.types.tx.recipe.*
import tech.pylons.lib.types.tx.trade.TradeItemInput
/***
* Generic interface for transaction-handling layers.
* Engine provides a suite of basic functionality that WalletCore as a whole
* can use to handle transactions at a high level; individual TXHandler implementations
* will do the dirty work of binding that functionality to low-level blockchain
* systems, in effect acting as "drivers."
*/
interface IEngine {
/**
* Identifier string, unique per Engine implementation.
* Used to identify the engine type associated with a given dataset
* when we dump the datastore to XML.
*/
val prefix : String
/** Specifies the TX-handling backend associated with an Engine instance. */
val backendType : Backend
/** Identifies whether or not we're using BIP44 mnemonics when doing keygen. */
val usesMnemonic : Boolean
/** Should this engine have access to developer-use methods? */
val isDevEngine : Boolean
/** The current CryptoHandler instance associated with this engine */
var cryptoHandler : ICryptoHandler
/** Enable-recipe message */
fun enableRecipe(id : String) : Transaction
/** Batch enable-recipe message */
fun enableRecipes(recipes : List) : List
/** Disable-recipe message */
fun disableRecipe(id : String) : Transaction
/** Batch enable-recipe message */
fun disableRecipes(recipes : List) : List
/** Execute-recipe message */
fun applyRecipe(id : String, itemIds : List) : Transaction
/** Check-execution message */
fun checkExecution(id : String, payForCompletion : Boolean) : Transaction
/** Create-trade message */
fun createTrade(coinInputs: List, itemInputs: List,
coinOutputs : List, itemOutputs : List- ,
ExtraInfo : String) : Transaction
/** Create-recipe message */
fun createRecipe(name : String, cookbookId : String, description: String, blockInterval : Long,
coinInputs : List
, itemInputs : List, entries : EntriesList,
outputs : List) : Transaction
/** Batch create-recipe message */
fun createRecipes(names : List, cookbookIds : List, descriptions: List,
blockIntervals : List, coinInputs : List>,
itemInputs : List>, entries : List,
outputs: List>) : List
/** Create-cookbook message */
fun createCookbook (id : String, name : String, developer : String, description : String, version : String,
supportEmail : String, level : Long, costPerBlock : Long) : Transaction
/** Batch create-cookbook message */
fun createCookbooks(ids : List, names : List, developers: List, descriptions: List,
versions : List, supportEmails: List, levels : List,
costsPerBlock : List) : List
/**
* Copies some data from profile's credentials object to userdata
* for serialization.
* TODO: why does this actually exist?
*/
fun dumpCredentials (credentials: ICredentials)
fun fulfillTrade (tradeId : String, itemIds : List) : Transaction
fun cancelTrade (tradeId : String) : Transaction
/**
* Generates a new Credentials object appropriate for our engine
* type from the given mnemonic.
*/
fun generateCredentialsFromMnemonic (mnemonic : String, passphrase : String) : ICredentials
/**
* Generates a new Credentials object appropriate for our engine
* type from keys in userdata.
*/
fun generateCredentialsFromKeys () : ICredentials
/**
* Creates new, default Credentials object appropriate for engine
* type.
*/
fun getNewCredentials () : ICredentials
fun getProfileState (addr : String) : Profile?
/** Get the balances of the user account. */
fun getMyProfileState () : MyProfile?
fun getCompletedExecutions() : List
fun getPendingExecutions () : List
/** Get a new instance of a CryptoHandler object appropriate for engine type. */
fun getNewCryptoHandler() : ICryptoHandler
/** Get the current status block. (Status block is returned w/ all IPC calls) */
fun getStatusBlock() : StatusBlock
/**
* Retrieves transaction w/ the given ID.
* (In an engine built to implement Cosmos functionality, this is the txhash)
*/
fun getTransaction (id : String) : Transaction
/** Registers a new profile under given name. */
fun registerNewProfile (name : String, kp : PylonsSECP256K1.KeyPair?) : Transaction
fun createChainAccount () : Transaction
/** Calls non-IAP get pylons endpoint. Shouldn't work against production nodes. */
fun getPylons (q : Long) : Transaction
/** Calls Google IAP get pylons endpoint. */
fun googleIapGetPylons(productId: String, purchaseToken: String, receiptData: String, signature: String): Transaction
fun checkGoogleIapOrder(purchaseToken: String) : Boolean
/** Gets initial userdata tables for the engine type. */
fun getInitialDataSets () : MutableMap>
/** Calls send pylons endpoint. */
fun sendCoins (coins : List, receiver : String) : Transaction
/** Update-cookbook message */
fun updateCookbook (id : String, developer : String, description : String, version : String,
supportEmail : String) : Transaction
/** Batch update-cookbook message */
fun updateCookbooks(ids : List, names : List, developers: List, descriptions: List,
versions : List, supportEmails: List) : List
/** Update-recipe message */
fun updateRecipe(id : String, name : String, cookbookId : String, description: String, blockInterval : Long,
coinInputs : List, itemInputs : List, entries : EntriesList, outputs: List) : Transaction
/** Batch update-recipe message */
fun updateRecipes (ids: List, names : List, cookbookIds : List, descriptions: List,
blockIntervals : List, coinInputs : List>, itemInputs : List>,
entries : List, outputs: List>) : List
/** List recipes query */
fun listRecipes () : List
/** List cookbooks query */
fun listCookbooks () : List
fun setItemFieldString (itemId : String, field : String, value : String) : Transaction
fun listTrades () : List
fun sendItems(receiver: String, itemIds: List) : Transaction
fun getLockedCoins () : LockedCoin
fun getLockedCoinDetails () : LockedCoinDetails
fun listRecipesBySender() : List
fun getRecipe(recipeId: String) : Recipe?
fun listRecipesByCookbookId(cookbookId: String) : List
}