-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
transaction options and better confirmation
- Loading branch information
1 parent
7f5e203
commit 2af6dd9
Showing
3 changed files
with
189 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
solanaclient/src/commonMain/kotlin/com/solana/rpc/TransactionOptions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.solana.rpc | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlin.time.Duration | ||
import kotlin.time.Duration.Companion.seconds | ||
|
||
enum class Encoding(private val enc: String) { | ||
base64("base64"), | ||
base58("base58"), | ||
jsonParsed("jsonParsed"); | ||
fun getEncoding(): String { | ||
return enc | ||
} | ||
} | ||
|
||
enum class Commitment(val value: String) { | ||
@SerialName("processed") | ||
PROCESSED("processed"), | ||
|
||
@SerialName("confirmed") | ||
CONFIRMED("confirmed"), | ||
|
||
@SerialName("finalized") | ||
FINALIZED("finalized"), | ||
|
||
@SerialName("max") | ||
MAX("max"); | ||
|
||
override fun toString(): String { | ||
return value | ||
} | ||
} | ||
|
||
data class TransactionOptions( | ||
val commitment: Commitment = Commitment.FINALIZED, | ||
val encoding: Encoding = Encoding.base64, | ||
val skipPreflight: Boolean = false, | ||
val preflightCommitment: Commitment = commitment, | ||
val timeout: Duration = 30.seconds | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters