Updated on 2026-08-14
This commit is contained in:
parent
d3ab3d6f11
commit
470fc8c140
5 changed files with 190 additions and 3 deletions
|
|
@ -86,4 +86,11 @@ interface TangemExpressApi {
|
|||
@Header("refcode") refCode: String?,
|
||||
@Body body: ExchangeSentRequestBody,
|
||||
): ApiResponse<ExchangeSentResponseBody>
|
||||
|
||||
@GET("exchange/history")
|
||||
suspend fun getHistory(
|
||||
@Query("wallet_address") walletAddress: String,
|
||||
@Query("cursor") cursor: String?,
|
||||
@Query("limit") limit: Int = 100,
|
||||
): ApiResponse<ExchangeHistoryResponse>
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.tangem.datasource.api.express.models.response
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ExchangeHistoryResponse(
|
||||
@Json(name = "data")
|
||||
val data: List<ExchangeRecord>,
|
||||
@Json(name = "next_cursor")
|
||||
val nextCursor: String,
|
||||
@Json(name = "has_more")
|
||||
val hasMore: Boolean,
|
||||
) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ExchangeRecord(
|
||||
@Json(name = "tx_id")
|
||||
val txId: String,
|
||||
@Json(name = "status")
|
||||
val status: String,
|
||||
@Json(name = "provider")
|
||||
val provider: Provider,
|
||||
@Json(name = "from")
|
||||
val from: AssetRef,
|
||||
@Json(name = "to")
|
||||
val to: AssetRef,
|
||||
@Json(name = "payin_hash")
|
||||
val payinHash: String?,
|
||||
@Json(name = "payout_hash")
|
||||
val payoutHash: String?,
|
||||
@Json(name = "external_tx_id")
|
||||
val externalTxId: String?,
|
||||
@Json(name = "external_tx_url")
|
||||
val externalTxUrl: String?,
|
||||
@Json(name = "refund")
|
||||
val refund: RefundInfo?,
|
||||
@Json(name = "rate_type")
|
||||
val rateType: String,
|
||||
@Json(name = "created_at")
|
||||
val createdAt: Long,
|
||||
@Json(name = "updated_at")
|
||||
val updatedAt: Long,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Provider(
|
||||
@Json(name = "id")
|
||||
val id: String,
|
||||
@Json(name = "name")
|
||||
val name: String,
|
||||
@Json(name = "icon_url")
|
||||
val iconUrl: String,
|
||||
@Json(name = "provider_url")
|
||||
val providerUrl: String,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class AssetRef(
|
||||
@Json(name = "network")
|
||||
val network: String,
|
||||
@Json(name = "token_id")
|
||||
val tokenId: String?,
|
||||
@Json(name = "raw_amount")
|
||||
val rawAmount: String,
|
||||
@Json(name = "decimals")
|
||||
val decimals: Int,
|
||||
@Json(name = "is_actual")
|
||||
val isActual: Boolean?,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class RefundInfo(
|
||||
@Json(name = "network")
|
||||
val network: String,
|
||||
@Json(name = "token_id")
|
||||
val tokenId: String?,
|
||||
@Json(name = "raw_amount")
|
||||
val rawAmount: String,
|
||||
@Json(name = "decimals")
|
||||
val decimals: Int,
|
||||
@Json(name = "hash")
|
||||
val hash: String?,
|
||||
)
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.tangem.datasource.api.onramp
|
|||
import com.tangem.datasource.api.common.response.ApiResponse
|
||||
import com.tangem.datasource.api.onramp.models.request.OnrampPairsRequest
|
||||
import com.tangem.datasource.api.onramp.models.response.OnrampDataResponse
|
||||
import com.tangem.datasource.api.onramp.models.response.OnrampHistoryResponse
|
||||
import com.tangem.datasource.api.onramp.models.response.OnrampQuoteResponse
|
||||
import com.tangem.datasource.api.onramp.models.response.OnrampStatusResponse
|
||||
import com.tangem.datasource.api.onramp.models.response.model.OnrampCountryDTO
|
||||
|
|
@ -86,4 +87,11 @@ interface OnrampApi {
|
|||
@Header("refcode") refCode: String?,
|
||||
@Query("txId") txId: String,
|
||||
): ApiResponse<OnrampStatusResponse>
|
||||
|
||||
@GET("onramp/history")
|
||||
suspend fun getHistory(
|
||||
@Query("wallet_address") walletAddress: String,
|
||||
@Query("cursor") cursor: String?,
|
||||
@Query("limit") limit: Int = 100,
|
||||
): ApiResponse<OnrampHistoryResponse>
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.tangem.datasource.api.onramp.models.response
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class OnrampHistoryResponse(
|
||||
@Json(name = "data")
|
||||
val data: List<OnrampRecord>,
|
||||
@Json(name = "next_cursor")
|
||||
val nextCursor: String,
|
||||
@Json(name = "has_more")
|
||||
val hasMore: Boolean,
|
||||
) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class OnrampRecord(
|
||||
@Json(name = "tx_id")
|
||||
val txId: String,
|
||||
@Json(name = "status")
|
||||
val status: String,
|
||||
@Json(name = "provider")
|
||||
val provider: Provider,
|
||||
@Json(name = "from")
|
||||
val from: FiatRef,
|
||||
@Json(name = "to")
|
||||
val to: OnrampAssetRef,
|
||||
@Json(name = "payout_hash")
|
||||
val payoutHash: String?,
|
||||
@Json(name = "external_tx_id")
|
||||
val externalTxId: String?,
|
||||
@Json(name = "external_tx_url")
|
||||
val externalTxUrl: String?,
|
||||
@Json(name = "refund")
|
||||
val refund: OnrampRefundInfo?,
|
||||
@Json(name = "rate_type")
|
||||
val rateType: String,
|
||||
@Json(name = "fail_reason")
|
||||
val failReason: String?,
|
||||
@Json(name = "created_at")
|
||||
val createdAt: Long,
|
||||
@Json(name = "updated_at")
|
||||
val updatedAt: Long,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Provider(
|
||||
@Json(name = "id")
|
||||
val id: String,
|
||||
@Json(name = "name")
|
||||
val name: String,
|
||||
@Json(name = "icon_url")
|
||||
val iconUrl: String,
|
||||
@Json(name = "provider_url")
|
||||
val providerUrl: String,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class FiatRef(
|
||||
@Json(name = "currency_code")
|
||||
val currencyCode: String,
|
||||
@Json(name = "amount")
|
||||
val amount: String,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class OnrampAssetRef(
|
||||
@Json(name = "network")
|
||||
val network: String,
|
||||
@Json(name = "token_id")
|
||||
val tokenId: String?,
|
||||
@Json(name = "expected_raw_amount")
|
||||
val expectedRawAmount: String,
|
||||
@Json(name = "actual_raw_amount")
|
||||
val actualRawAmount: String?,
|
||||
@Json(name = "decimals")
|
||||
val decimals: Int,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class OnrampRefundInfo(
|
||||
@Json(name = "currency_code")
|
||||
val currencyCode: String,
|
||||
@Json(name = "amount")
|
||||
val amount: String,
|
||||
)
|
||||
}
|
||||
|
|
@ -3,12 +3,12 @@ package com.tangem.datasource.api.tangemTech
|
|||
import com.tangem.datasource.api.common.response.ApiResponse
|
||||
import com.tangem.datasource.api.stories.models.StoryContentResponse
|
||||
import com.tangem.datasource.api.tangemTech.models.*
|
||||
import com.tangem.datasource.api.tangemTech.models.promobanners.PromoBannerDisplaysResponse
|
||||
import com.tangem.datasource.api.tangemTech.models.promobanners.DismissPromoBannerRequest
|
||||
import com.tangem.datasource.api.tangemTech.models.promobanners.DismissPromoBannerResponse
|
||||
import com.tangem.datasource.api.tangemTech.models.account.GetWalletAccountsResponse
|
||||
import com.tangem.datasource.api.tangemTech.models.account.GetWalletArchivedAccountsResponse
|
||||
import com.tangem.datasource.api.tangemTech.models.account.SaveWalletAccountsResponse
|
||||
import com.tangem.datasource.api.tangemTech.models.promobanners.DismissPromoBannerRequest
|
||||
import com.tangem.datasource.api.tangemTech.models.promobanners.DismissPromoBannerResponse
|
||||
import com.tangem.datasource.api.tangemTech.models.promobanners.PromoBannerDisplaysResponse
|
||||
import com.tangem.datasource.api.utils.ReadTimeout
|
||||
import com.tangem.datasource.local.config.providers.models.ProviderModel
|
||||
import retrofit2.http.*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue