Updated on 2026-08-14

This commit is contained in:
Tangem 2024-07-16 19:59:07 +05:00
parent 3c8fb7f668
commit ebfa4fed41
8 changed files with 160 additions and 39 deletions

View file

@ -51,12 +51,18 @@ interface StakeKitApi {
@POST("actions/exit")
suspend fun createExitAction(@Body body: ActionRequestBody): ApiResponse<EnterActionResponse>
@POST("actions/pending")
suspend fun createPendingAction(@Body body: PendingActionRequestBody): ApiResponse<EnterActionResponse>
@POST("actions/enter/estimate-gas")
suspend fun estimateGasOnEnter(@Body body: ActionRequestBody): ApiResponse<StakingGasEstimateDTO>
@POST("actions/exit/estimate-gas")
suspend fun estimateGasOnExit(@Body body: ActionRequestBody): ApiResponse<StakingGasEstimateDTO>
@POST("actions/pending/estimate-gas")
suspend fun estimateGasOnPending(@Body body: PendingActionRequestBody): ApiResponse<StakingGasEstimateDTO>
@PATCH("transactions/{transactionId}")
suspend fun constructTransaction(
@Path("transactionId") transactionId: String,

View file

@ -4,6 +4,20 @@ import com.squareup.moshi.Json
import com.tangem.datasource.api.stakekit.models.request.ConstructTransactionRequestBody.GasArgs
import com.tangem.datasource.api.stakekit.models.response.model.BalanceDTO
import com.tangem.datasource.api.stakekit.models.response.model.TokenDTO
import com.tangem.domain.staking.model.action.StakingActionType
data class PendingActionRequestBody(
@Json(name = "type")
val type: StakingActionType,
@Json(name = "integrationId")
val integrationId: String,
@Json(name = "passthrough")
val passthrough: String,
@Json(name = "args")
val args: ActionRequestBodyArgs,
@Json(name = "gasArgs")
val gasArgs: GasArgs? = null, // used only in estimate_gas request
)
data class ActionRequestBody(
@Json(name = "integrationId")
@ -11,40 +25,39 @@ data class ActionRequestBody(
@Json(name = "addresses")
val addresses: Address,
@Json(name = "args")
val args: EnterActionRequestBodyArgs,
val args: ActionRequestBodyArgs,
@Json(name = "referralCode")
val referralCode: String? = null,
@Json(name = "gasArgs")
val gasArgs: GasArgs? = null, // used only in estimate_gas request
) {
)
data class EnterActionRequestBodyArgs(
@Json(name = "amount")
val amount: String,
@Json(name = "validatorAddress")
val validatorAddress: String? = null,
@Json(name = "validatorAddresses")
val validatorAddresses: List<String>? = null,
@Json(name = "providerId")
val providerId: String? = null,
@Json(name = "duration")
val duration: String? = null,
@Json(name = "nfts")
val nfts: List<BalanceDTO.PendingAction.PendingActionArgs.Nft>? = null,
@Json(name = "ledgerWalletAPICompatible")
val ledgerWalletAPICompatible: Boolean? = null,
@Json(name = "tronResource")
val tronResource: String? = null,
@Json(name = "signatureVerification")
val signatureVerification: SignatureVerification? = null,
@Json(name = "inputToken")
val inputToken: TokenDTO? = null,
)
data class ActionRequestBodyArgs(
@Json(name = "amount")
val amount: String,
@Json(name = "validatorAddress")
val validatorAddress: String? = null,
@Json(name = "validatorAddresses")
val validatorAddresses: List<String>? = null,
@Json(name = "providerId")
val providerId: String? = null,
@Json(name = "duration")
val duration: String? = null,
@Json(name = "nfts")
val nfts: List<BalanceDTO.PendingAction.PendingActionArgs.Nft>? = null,
@Json(name = "ledgerWalletAPICompatible")
val ledgerWalletAPICompatible: Boolean? = null,
@Json(name = "tronResource")
val tronResource: String? = null,
@Json(name = "signatureVerification")
val signatureVerification: SignatureVerification? = null,
@Json(name = "inputToken")
val inputToken: TokenDTO? = null,
)
data class SignatureVerification(
@Json(name = "message")
val message: String,
@Json(name = "signed")
val signed: String,
)
}
data class SignatureVerification(
@Json(name = "message")
val message: String,
@Json(name = "signed")
val signed: String,
)