mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-android.git
synced 2026-07-22 11:25:53 +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:
@@ -117,7 +117,7 @@ fun emptyTronAccountId() = ByteArray(20) { 1 }
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hex form of a Tron address (`0x41` prefix byte ++ accountId, hex-encoded, no `0x` prefix), e.g.
|
* Hex form of a Tron address (`0x41` prefix byte ++ accountId, hex-encoded, no `0x` prefix), e.g.
|
||||||
* `41a614f803b6fd780986a42c78ec9c7f77e6ded13c`. This is the format TronGrid's `/wallet/*` transaction
|
* `41a614f803b6fd780986a42c78ec9c7f77e6ded13c`. This is the format TronGrid's `/wallet/` transaction
|
||||||
* construction/broadcast endpoints expect when called with `"visible": false` (as opposed to the human-facing
|
* construction/broadcast endpoints expect when called with `"visible": false` (as opposed to the human-facing
|
||||||
* Base58Check form used by the `/v1/accounts/{address}` balance endpoint and by [toTronAddress]).
|
* Base58Check form used by the `/v1/accounts/{address}` balance endpoint and by [toTronAddress]).
|
||||||
*/
|
*/
|
||||||
|
|||||||
+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
|
* 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
|
* `{"Error": "... no OwnerAccount."}` from `createtransaction`, or
|
||||||
* `{"code": "CONTRACT_VALIDATE_ERROR", "message": "<hex>"}` from `broadcasttransaction`.
|
* `{"code": "CONTRACT_VALIDATE_ERROR", "message": "<hex>"}` from `broadcasttransaction`.
|
||||||
*/
|
*/
|
||||||
@@ -98,7 +98,12 @@ class RealTronGridApi(
|
|||||||
return rawBalance?.toBigIntegerOrNull() ?: BigInteger.ZERO
|
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(
|
val request = TronCreateTransactionRequest(
|
||||||
ownerAddress = ownerHexAddress,
|
ownerAddress = ownerHexAddress,
|
||||||
toAddress = toHexAddress,
|
toAddress = toHexAddress,
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import com.google.gson.JsonObject
|
|||||||
import com.google.gson.annotations.SerializedName
|
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
|
* 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
|
* accountId, see `toTronHexAddress`) rather than Base58Check. Every shape below was confirmed against
|
||||||
|
|||||||
+14
-2
@@ -100,7 +100,13 @@ class RealTronTransactionService(
|
|||||||
|
|
||||||
val feeSun = when (intent) {
|
val feeSun = when (intent) {
|
||||||
is TronTransactionIntent.Native -> estimateNativeFee(baseUrl, ownerHex, recipient, intent.amountSun)
|
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)
|
return TronFee(feeSun, SubmissionOrigin.singleOrigin(ownerAccountId), chain.commissionAsset)
|
||||||
@@ -213,7 +219,13 @@ class RealTronTransactionService(
|
|||||||
return bandwidthShortfall.toBigInteger() * bandwidthPrice
|
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 parameterHex = Trc20TransferAbi.encodeTransferParameters(recipient, amountSun)
|
||||||
|
|
||||||
val dryRun = runCatching {
|
val dryRun = runCatching {
|
||||||
|
|||||||
Reference in New Issue
Block a user