mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-android.git
synced 2026-07-22 13:45:48 +00:00
fix: ktlint violations (nested-comment doc text, line length)
Doc comments describing "/wallet/*" endpoints were parsed as opening a nested block comment (Kotlin block comments nest, unlike Java/C), leaving the outer KDoc unterminated - not just a lint nit, ktlint flagged these as invalid Kotlin files. Reworded to drop the trailing "*". Also wraps two over-long function signatures/calls.
This commit is contained in:
+7
-2
@@ -14,7 +14,7 @@ import java.math.BigInteger
|
||||
|
||||
/**
|
||||
* Thrown whenever TronGrid reports a failure via an HTTP-200 body (rather than an HTTP error status), which is
|
||||
* how most `/wallet/*` endpoints signal validation/execution failures, e.g.
|
||||
* how most `/wallet/` endpoints signal validation/execution failures, e.g.
|
||||
* `{"Error": "... no OwnerAccount."}` from `createtransaction`, or
|
||||
* `{"code": "CONTRACT_VALIDATE_ERROR", "message": "<hex>"}` from `broadcasttransaction`.
|
||||
*/
|
||||
@@ -98,7 +98,12 @@ class RealTronGridApi(
|
||||
return rawBalance?.toBigIntegerOrNull() ?: BigInteger.ZERO
|
||||
}
|
||||
|
||||
override suspend fun createNativeTransfer(baseUrl: String, ownerHexAddress: String, toHexAddress: String, amountSun: BigInteger): TronUnsignedTransactionResponse {
|
||||
override suspend fun createNativeTransfer(
|
||||
baseUrl: String,
|
||||
ownerHexAddress: String,
|
||||
toHexAddress: String,
|
||||
amountSun: BigInteger
|
||||
): TronUnsignedTransactionResponse {
|
||||
val request = TronCreateTransactionRequest(
|
||||
ownerAddress = ownerHexAddress,
|
||||
toAddress = toHexAddress,
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import com.google.gson.JsonObject
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
/**
|
||||
* Request/response shapes for TronGrid's transaction-construction/broadcast endpoints (`/wallet/*`).
|
||||
* Request/response shapes for TronGrid's transaction-construction/broadcast endpoints (`/wallet/`).
|
||||
*
|
||||
* All requests are sent with `"visible": false`, i.e. addresses are hex-encoded (`41` prefix byte ++ 20-byte
|
||||
* accountId, see `toTronHexAddress`) rather than Base58Check. Every shape below was confirmed against
|
||||
|
||||
+14
-2
@@ -100,7 +100,13 @@ class RealTronTransactionService(
|
||||
|
||||
val feeSun = when (intent) {
|
||||
is TronTransactionIntent.Native -> estimateNativeFee(baseUrl, ownerHex, recipient, intent.amountSun)
|
||||
is TronTransactionIntent.Trc20Transfer -> estimateTrc20FeeFromContractHex(baseUrl, ownerHex, recipient, intent.contractAddress.tronAddressToHexAddress(), intent.amountSun)
|
||||
is TronTransactionIntent.Trc20Transfer -> estimateTrc20FeeFromContractHex(
|
||||
baseUrl,
|
||||
ownerHex,
|
||||
recipient,
|
||||
intent.contractAddress.tronAddressToHexAddress(),
|
||||
intent.amountSun
|
||||
)
|
||||
}
|
||||
|
||||
return TronFee(feeSun, SubmissionOrigin.singleOrigin(ownerAccountId), chain.commissionAsset)
|
||||
@@ -213,7 +219,13 @@ class RealTronTransactionService(
|
||||
return bandwidthShortfall.toBigInteger() * bandwidthPrice
|
||||
}
|
||||
|
||||
private suspend fun estimateTrc20FeeFromContractHex(baseUrl: String, ownerHex: String, recipient: AccountId, contractHex: String, amountSun: BigInteger): BigInteger {
|
||||
private suspend fun estimateTrc20FeeFromContractHex(
|
||||
baseUrl: String,
|
||||
ownerHex: String,
|
||||
recipient: AccountId,
|
||||
contractHex: String,
|
||||
amountSun: BigInteger
|
||||
): BigInteger {
|
||||
val parameterHex = Trc20TransferAbi.encodeTransferParameters(recipient, amountSun)
|
||||
|
||||
val dryRun = runCatching {
|
||||
|
||||
Reference in New Issue
Block a user