Skip to content

Commit

Permalink
abstract intent creation...
Browse files Browse the repository at this point in the history
  • Loading branch information
astinz committed Feb 9, 2024
1 parent b775302 commit eec1a6f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/src/commonMain/kotlin/xyz/mcxross/ksui/model/Intent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,23 @@ enum class AppId {
data class Intent(val scope: IntentScope, val version: IntentVersion, val appId: AppId)

@Serializable data class IntentMessage<T>(val intent: Intent, val message: T)

// An intent abstraction. This is so as it is scoped, but can well be a top level function
// TODO: This is a placeholder for now, look back at this later
@Serializable
enum class IntentType {
SUI_TX {
override fun intent(scope: IntentScope, version: IntentVersion, appId: AppId): Intent =
Intent(IntentScope.TRANSACTIONDATA, IntentVersion.V0, AppId.SUI)
},
SUI_APP {
override fun intent(scope: IntentScope, version: IntentVersion, appId: AppId): Intent =
Intent(IntentScope.TRANSACTIONEFFECTS, IntentVersion.V0, AppId.SUI)
};

abstract fun intent(
scope: IntentScope = IntentScope.TRANSACTIONDATA,
version: IntentVersion = IntentVersion.V0,
appId: AppId = AppId.SUI,
): Intent
}

0 comments on commit eec1a6f

Please sign in to comment.