Updated on 2026-08-14
This commit is contained in:
parent
0658cf67cb
commit
84570a8406
15 changed files with 2860 additions and 2107 deletions
|
|
@ -22,9 +22,14 @@ android {
|
|||
jniLibs {
|
||||
useLegacyPackaging = true
|
||||
}
|
||||
resources.excludes.add("META-INF/DEPENDENCIES")
|
||||
resources.excludes.add("META-INF/LICENSE.md")
|
||||
resources.excludes.add("META-INF/NOTICE.md")
|
||||
resources.excludes.add("META-INF/DISCLAIMER")
|
||||
resources.excludes.add("META-INF/DEPENDENCIES")
|
||||
resources.excludes.add("META-INF/FastDoubleParser-NOTICE")
|
||||
resources.excludes.add("META-INF/FastDoubleParser-LICENSE")
|
||||
resources.excludes.add("META-INF/io.netty.versions.properties")
|
||||
resources.excludes.add("META-INF/INDEX.LIST")
|
||||
}
|
||||
androidResources {
|
||||
generateLocaleConfig = true
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ internal class VisaCurrencyFactory {
|
|||
available = balances.available.forPayment,
|
||||
blocked = balances.blocked,
|
||||
debt = balances.debt,
|
||||
pendingRefund = balances.pendingRefund,
|
||||
)
|
||||
},
|
||||
limits = VisaCurrency.Limits(
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ data class VisaCurrency(
|
|||
val available: BigDecimal,
|
||||
val blocked: BigDecimal,
|
||||
val debt: BigDecimal,
|
||||
val pendingRefund: BigDecimal,
|
||||
)
|
||||
|
||||
data class Limits(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ internal data class BalancesAndLimitsBottomSheetConfig(
|
|||
val availableBalance: String,
|
||||
val blockedBalance: String,
|
||||
val debit: String,
|
||||
val pending: String,
|
||||
val amlVerified: String,
|
||||
val onInfoClick: () -> Unit,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ internal class BalancesAndLimitsBottomSheetConverter(
|
|||
availableBalance = value.balances.available.let(::formatAmount),
|
||||
blockedBalance = value.balances.blocked.let(::formatAmount),
|
||||
debit = value.balances.debt.let(::formatAmount),
|
||||
pending = value.balances.pendingRefund.let(::formatAmount),
|
||||
amlVerified = value.balances.verified.let(::formatAmount),
|
||||
onInfoClick = this::showBalanceInfo,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -78,10 +78,6 @@ private fun BalancesBlock(balances: BalancesAndLimitsBottomSheetConfig.Balance,
|
|||
title = stringReference("Debit"),
|
||||
value = balances.debit,
|
||||
)
|
||||
BlockItem(
|
||||
title = stringReference("Pending refund"),
|
||||
value = balances.pending,
|
||||
)
|
||||
},
|
||||
description = {
|
||||
InfoButton(onClick = balances.onInfoClick)
|
||||
|
|
@ -180,7 +176,6 @@ private class BalancesAndLimitsBottomSheetParameterProvider :
|
|||
availableBalance = "392.45 USDT",
|
||||
blockedBalance = "36.00 USDT",
|
||||
debit = "00.00 USDT",
|
||||
pending = "20.99 USDT",
|
||||
amlVerified = "356.45 USDT",
|
||||
onInfoClick = {},
|
||||
),
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ mlKit-barcodeScanning = "17.2.0"
|
|||
androidXCamera = "1.3.0"
|
||||
listenableFuture = "1.0"
|
||||
swipeRefreshLayout = "1.1.0"
|
||||
web3j = "4.10.1"
|
||||
web3j = "4.12.3-SNAPSHOT"
|
||||
leakcanary = "2.13"
|
||||
decompose = "2.2.2"
|
||||
room = "2.6.1"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,12 @@ plugins {
|
|||
|
||||
android {
|
||||
namespace = "com.tangem.libs.visa"
|
||||
|
||||
packaging {
|
||||
resources {
|
||||
excludes += "/META-INF/*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
package com.tangem.lib.visa;
|
||||
|
||||
import io.reactivex.Flowable;
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.web3j.abi.EventEncoder;
|
||||
import org.web3j.abi.TypeReference;
|
||||
import org.web3j.abi.datatypes.*;
|
||||
import org.web3j.abi.datatypes.Address;
|
||||
import org.web3j.abi.datatypes.Event;
|
||||
import org.web3j.abi.datatypes.Function;
|
||||
import org.web3j.abi.datatypes.Type;
|
||||
import org.web3j.abi.datatypes.Utf8String;
|
||||
import org.web3j.abi.datatypes.generated.Uint256;
|
||||
import org.web3j.abi.datatypes.generated.Uint8;
|
||||
import org.web3j.crypto.Credentials;
|
||||
|
|
@ -17,25 +27,17 @@ import org.web3j.tx.Contract;
|
|||
import org.web3j.tx.TransactionManager;
|
||||
import org.web3j.tx.gas.ContractGasProvider;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Flowable;
|
||||
|
||||
/**
|
||||
* <p>Auto generated code.
|
||||
* <p><strong>Do not modify!</strong>
|
||||
* <p>Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>,
|
||||
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
|
||||
* <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
|
||||
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
|
||||
* <a href="https://github.com/hyperledger/web3j/tree/main/codegen">codegen module</a> to update.
|
||||
*
|
||||
* <p>Generated with web3j version 1.5.2.
|
||||
* <p>Generated with web3j version 1.6.1.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
class ERC20 extends Contract {
|
||||
public class ERC20 extends Contract {
|
||||
public static final String BINARY = "Bin file was not provided";
|
||||
|
||||
public static final String FUNC_ALLOWANCE = "allowance";
|
||||
|
|
@ -57,39 +59,40 @@ class ERC20 extends Contract {
|
|||
public static final String FUNC_TRANSFERFROM = "transferFrom";
|
||||
|
||||
public static final Event APPROVAL_EVENT = new Event("Approval",
|
||||
Arrays.asList(new TypeReference<Address>(true) {
|
||||
}, new TypeReference<Address>(true) {
|
||||
}, new TypeReference<Uint256>() {
|
||||
}));
|
||||
Arrays.<TypeReference<?>>asList(new TypeReference<Address>(true) {}, new TypeReference<Address>(true) {}, new TypeReference<Uint256>() {}));
|
||||
;
|
||||
|
||||
public static final Event TRANSFER_EVENT = new Event("Transfer",
|
||||
Arrays.asList(new TypeReference<Address>(true) {
|
||||
}, new TypeReference<Address>(true) {
|
||||
}, new TypeReference<Uint256>() {
|
||||
}));
|
||||
Arrays.<TypeReference<?>>asList(new TypeReference<Address>(true) {}, new TypeReference<Address>(true) {}, new TypeReference<Uint256>() {}));
|
||||
;
|
||||
|
||||
@Deprecated
|
||||
protected ERC20(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
|
||||
protected ERC20(String contractAddress, Web3j web3j, Credentials credentials,
|
||||
BigInteger gasPrice, BigInteger gasLimit) {
|
||||
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
|
||||
}
|
||||
|
||||
protected ERC20(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
|
||||
protected ERC20(String contractAddress, Web3j web3j, Credentials credentials,
|
||||
ContractGasProvider contractGasProvider) {
|
||||
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected ERC20(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
|
||||
protected ERC20(String contractAddress, Web3j web3j, TransactionManager transactionManager,
|
||||
BigInteger gasPrice, BigInteger gasLimit) {
|
||||
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
|
||||
}
|
||||
|
||||
protected ERC20(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
|
||||
protected ERC20(String contractAddress, Web3j web3j, TransactionManager transactionManager,
|
||||
ContractGasProvider contractGasProvider) {
|
||||
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
|
||||
}
|
||||
|
||||
public static List<ApprovalEventResponse> getApprovalEvents(TransactionReceipt transactionReceipt) {
|
||||
List<EventValuesWithLog> valueList = staticExtractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt);
|
||||
public static List<ApprovalEventResponse> getApprovalEvents(
|
||||
TransactionReceipt transactionReceipt) {
|
||||
List<Contract.EventValuesWithLog> valueList = staticExtractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt);
|
||||
ArrayList<ApprovalEventResponse> responses = new ArrayList<ApprovalEventResponse>(valueList.size());
|
||||
for (EventValuesWithLog eventValues : valueList) {
|
||||
for (Contract.EventValuesWithLog eventValues : valueList) {
|
||||
ApprovalEventResponse typedResponse = new ApprovalEventResponse();
|
||||
typedResponse.log = eventValues.getLog();
|
||||
typedResponse.owner = (String) eventValues.getIndexedValues().get(0).getValue();
|
||||
|
|
@ -101,7 +104,7 @@ class ERC20 extends Contract {
|
|||
}
|
||||
|
||||
public static ApprovalEventResponse getApprovalEventFromLog(Log log) {
|
||||
EventValuesWithLog eventValues = staticExtractEventParametersWithLog(APPROVAL_EVENT, log);
|
||||
Contract.EventValuesWithLog eventValues = staticExtractEventParametersWithLog(APPROVAL_EVENT, log);
|
||||
ApprovalEventResponse typedResponse = new ApprovalEventResponse();
|
||||
typedResponse.log = log;
|
||||
typedResponse.owner = (String) eventValues.getIndexedValues().get(0).getValue();
|
||||
|
|
@ -110,20 +113,22 @@ class ERC20 extends Contract {
|
|||
return typedResponse;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ERC20 load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
|
||||
return new ERC20(contractAddress, web3j, credentials, gasPrice, gasLimit);
|
||||
public Flowable<ApprovalEventResponse> approvalEventFlowable(EthFilter filter) {
|
||||
return web3j.ethLogFlowable(filter).map(log -> getApprovalEventFromLog(log));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ERC20 load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
|
||||
return new ERC20(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
|
||||
public Flowable<ApprovalEventResponse> approvalEventFlowable(DefaultBlockParameter startBlock,
|
||||
DefaultBlockParameter endBlock) {
|
||||
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
|
||||
filter.addSingleTopic(EventEncoder.encode(APPROVAL_EVENT));
|
||||
return approvalEventFlowable(filter);
|
||||
}
|
||||
|
||||
public static List<TransferEventResponse> getTransferEvents(TransactionReceipt transactionReceipt) {
|
||||
List<EventValuesWithLog> valueList = staticExtractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt);
|
||||
public static List<TransferEventResponse> getTransferEvents(
|
||||
TransactionReceipt transactionReceipt) {
|
||||
List<Contract.EventValuesWithLog> valueList = staticExtractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt);
|
||||
ArrayList<TransferEventResponse> responses = new ArrayList<TransferEventResponse>(valueList.size());
|
||||
for (EventValuesWithLog eventValues : valueList) {
|
||||
for (Contract.EventValuesWithLog eventValues : valueList) {
|
||||
TransferEventResponse typedResponse = new TransferEventResponse();
|
||||
typedResponse.log = eventValues.getLog();
|
||||
typedResponse.from = (String) eventValues.getIndexedValues().get(0).getValue();
|
||||
|
|
@ -135,7 +140,7 @@ class ERC20 extends Contract {
|
|||
}
|
||||
|
||||
public static TransferEventResponse getTransferEventFromLog(Log log) {
|
||||
EventValuesWithLog eventValues = staticExtractEventParametersWithLog(TRANSFER_EVENT, log);
|
||||
Contract.EventValuesWithLog eventValues = staticExtractEventParametersWithLog(TRANSFER_EVENT, log);
|
||||
TransferEventResponse typedResponse = new TransferEventResponse();
|
||||
typedResponse.log = log;
|
||||
typedResponse.from = (String) eventValues.getIndexedValues().get(0).getValue();
|
||||
|
|
@ -148,107 +153,107 @@ class ERC20 extends Contract {
|
|||
return web3j.ethLogFlowable(filter).map(log -> getTransferEventFromLog(log));
|
||||
}
|
||||
|
||||
public Flowable<TransferEventResponse> transferEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
|
||||
public Flowable<TransferEventResponse> transferEventFlowable(DefaultBlockParameter startBlock,
|
||||
DefaultBlockParameter endBlock) {
|
||||
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
|
||||
filter.addSingleTopic(EventEncoder.encode(TRANSFER_EVENT));
|
||||
return transferEventFlowable(filter);
|
||||
}
|
||||
|
||||
public static ERC20 load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
|
||||
return new ERC20(contractAddress, web3j, credentials, contractGasProvider);
|
||||
}
|
||||
|
||||
public static ERC20 load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
|
||||
return new ERC20(contractAddress, web3j, transactionManager, contractGasProvider);
|
||||
}
|
||||
|
||||
public Flowable<ApprovalEventResponse> approvalEventFlowable(EthFilter filter) {
|
||||
return web3j.ethLogFlowable(filter).map(log -> getApprovalEventFromLog(log));
|
||||
}
|
||||
|
||||
public Flowable<ApprovalEventResponse> approvalEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
|
||||
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
|
||||
filter.addSingleTopic(EventEncoder.encode(APPROVAL_EVENT));
|
||||
return approvalEventFlowable(filter);
|
||||
}
|
||||
|
||||
public RemoteFunctionCall<BigInteger> allowance(String owner, String spender) {
|
||||
final Function function = new Function(FUNC_ALLOWANCE,
|
||||
Arrays.asList(new Address(160, owner),
|
||||
new Address(160, spender)),
|
||||
List.of(new TypeReference<Uint256>() {
|
||||
}));
|
||||
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, owner),
|
||||
new org.web3j.abi.datatypes.Address(160, spender)),
|
||||
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
|
||||
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
|
||||
}
|
||||
|
||||
public RemoteFunctionCall<TransactionReceipt> approve(String spender, BigInteger value) {
|
||||
final Function function = new Function(
|
||||
FUNC_APPROVE,
|
||||
Arrays.asList(new Address(160, spender),
|
||||
new Uint256(value)),
|
||||
Collections.emptyList());
|
||||
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, spender),
|
||||
new org.web3j.abi.datatypes.generated.Uint256(value)),
|
||||
Collections.<TypeReference<?>>emptyList());
|
||||
return executeRemoteCallTransaction(function);
|
||||
}
|
||||
|
||||
public RemoteFunctionCall<BigInteger> balanceOf(String account) {
|
||||
final Function function = new Function(FUNC_BALANCEOF,
|
||||
List.of(new Address(160, account)),
|
||||
List.of(new TypeReference<Uint256>() {
|
||||
}));
|
||||
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, account)),
|
||||
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
|
||||
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
|
||||
}
|
||||
|
||||
public RemoteFunctionCall<BigInteger> decimals() {
|
||||
final Function function = new Function(FUNC_DECIMALS,
|
||||
List.of(),
|
||||
List.of(new TypeReference<Uint8>() {
|
||||
}));
|
||||
Arrays.<Type>asList(),
|
||||
Arrays.<TypeReference<?>>asList(new TypeReference<Uint8>() {}));
|
||||
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
|
||||
}
|
||||
|
||||
public RemoteFunctionCall<String> name() {
|
||||
final Function function = new Function(FUNC_NAME,
|
||||
List.of(),
|
||||
List.of(new TypeReference<Utf8String>() {
|
||||
}));
|
||||
Arrays.<Type>asList(),
|
||||
Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
|
||||
return executeRemoteCallSingleValueReturn(function, String.class);
|
||||
}
|
||||
|
||||
public RemoteFunctionCall<String> symbol() {
|
||||
final Function function = new Function(FUNC_SYMBOL,
|
||||
List.of(),
|
||||
List.of(new TypeReference<Utf8String>() {
|
||||
}));
|
||||
Arrays.<Type>asList(),
|
||||
Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
|
||||
return executeRemoteCallSingleValueReturn(function, String.class);
|
||||
}
|
||||
|
||||
public RemoteFunctionCall<BigInteger> totalSupply() {
|
||||
final Function function = new Function(FUNC_TOTALSUPPLY,
|
||||
List.of(),
|
||||
List.of(new TypeReference<Uint256>() {
|
||||
}));
|
||||
Arrays.<Type>asList(),
|
||||
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
|
||||
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
|
||||
}
|
||||
|
||||
public RemoteFunctionCall<TransactionReceipt> transfer(String to, BigInteger value) {
|
||||
final Function function = new Function(
|
||||
FUNC_TRANSFER,
|
||||
Arrays.asList(new Address(160, to),
|
||||
new Uint256(value)),
|
||||
Collections.emptyList());
|
||||
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, to),
|
||||
new org.web3j.abi.datatypes.generated.Uint256(value)),
|
||||
Collections.<TypeReference<?>>emptyList());
|
||||
return executeRemoteCallTransaction(function);
|
||||
}
|
||||
|
||||
public RemoteFunctionCall<TransactionReceipt> transferFrom(String from, String to, BigInteger value) {
|
||||
public RemoteFunctionCall<TransactionReceipt> transferFrom(String from, String to,
|
||||
BigInteger value) {
|
||||
final Function function = new Function(
|
||||
FUNC_TRANSFERFROM,
|
||||
Arrays.asList(new Address(160, from),
|
||||
new Address(160, to),
|
||||
new Uint256(value)),
|
||||
Collections.emptyList());
|
||||
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, from),
|
||||
new org.web3j.abi.datatypes.Address(160, to),
|
||||
new org.web3j.abi.datatypes.generated.Uint256(value)),
|
||||
Collections.<TypeReference<?>>emptyList());
|
||||
return executeRemoteCallTransaction(function);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ERC20 load(String contractAddress, Web3j web3j, Credentials credentials,
|
||||
BigInteger gasPrice, BigInteger gasLimit) {
|
||||
return new ERC20(contractAddress, web3j, credentials, gasPrice, gasLimit);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ERC20 load(String contractAddress, Web3j web3j,
|
||||
TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
|
||||
return new ERC20(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
|
||||
}
|
||||
|
||||
public static ERC20 load(String contractAddress, Web3j web3j, Credentials credentials,
|
||||
ContractGasProvider contractGasProvider) {
|
||||
return new ERC20(contractAddress, web3j, credentials, contractGasProvider);
|
||||
}
|
||||
|
||||
public static ERC20 load(String contractAddress, Web3j web3j,
|
||||
TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
|
||||
return new ERC20(contractAddress, web3j, transactionManager, contractGasProvider);
|
||||
}
|
||||
|
||||
public static class ApprovalEventResponse extends BaseEventResponse {
|
||||
public String owner;
|
||||
|
||||
|
|
@ -264,4 +269,4 @@ class ERC20 extends Contract {
|
|||
|
||||
public BigInteger value;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -102,8 +102,7 @@ internal class DefaultVisaContractInfoProvider(
|
|||
{ paymentAccount.availableForDebtPayment().send() },
|
||||
{ paymentAccount.blockedAmount().send() },
|
||||
{ paymentAccount.debtAmount().send() },
|
||||
{ paymentAccount.pendingRefundTotal().send() },
|
||||
) { total, verified, payment, withdrawal, debtPayment, blocked, debt, refund ->
|
||||
) { total, verified, payment, withdrawal, debtPayment, blocked, debt ->
|
||||
val decimals = paymentToken.decimals
|
||||
|
||||
Balances(
|
||||
|
|
@ -116,40 +115,42 @@ internal class DefaultVisaContractInfoProvider(
|
|||
),
|
||||
blocked = blocked.toBigDecimal(decimals),
|
||||
debt = debt.toBigDecimal(decimals),
|
||||
pendingRefund = refund.toBigDecimal(decimals),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
private fun fetchLimits(
|
||||
paymentAccount: TangemPaymentAccount,
|
||||
paymentToken: PaymentTokenInfo,
|
||||
): Triple<Limits, Limits, Instant> {
|
||||
val (
|
||||
oldLimit,
|
||||
newLimit,
|
||||
changeDateSeconds,
|
||||
) = paymentAccount.limits().send()
|
||||
|
||||
return Triple(
|
||||
first = getLimits(oldLimit, paymentToken),
|
||||
second = getLimits(newLimit, paymentToken),
|
||||
third = changeDateSeconds.toInstant(),
|
||||
)
|
||||
TODO() // TODO: [REDACTED_TASK_KEY]
|
||||
// val (
|
||||
// oldLimit,
|
||||
// newLimit,
|
||||
// changeDateSeconds,
|
||||
// ) = paymentAccount.cards("").send().component5()
|
||||
//
|
||||
// return Triple(
|
||||
// first = getLimits(oldLimit, paymentToken),
|
||||
// second = getLimits(newLimit, paymentToken),
|
||||
// third = changeDateSeconds.toInstant(),
|
||||
// )
|
||||
}
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
private fun getLimits(limit: TangemPaymentAccount.Limits, paymentToken: PaymentTokenInfo): Limits = Limits(
|
||||
spendLimit = limit._01_spendLimit.toLimit(paymentToken.decimals),
|
||||
noOtpLimit = limit._02_noOtpSpendLimit.toLimit(paymentToken.decimals),
|
||||
singleTransactionLimit = limit._00_singleTransactionLimit.toBigDecimal(paymentToken.decimals),
|
||||
expirationDate = limit._03_spendLimitsTimer.expireTimestamp.toInstant(),
|
||||
spendPeriodSeconds = limit._04_spendLimitsPeriod,
|
||||
spendLimit = limit.spendLimit.toLimit(paymentToken.decimals),
|
||||
noOtpLimit = limit.noConfirmationSpendLimit.toLimit(paymentToken.decimals),
|
||||
singleTransactionLimit = limit.singleTransactionLimit.toBigDecimal(paymentToken.decimals),
|
||||
expirationDate = limit.spendLimitsTimer.expireTimestamp.toInstant(),
|
||||
spendPeriodSeconds = limit.spendLimitsPeriod,
|
||||
)
|
||||
|
||||
private fun TangemPaymentAccount.Limit.toLimit(decimals: Int): Limits.Limit {
|
||||
return Limits.Limit(
|
||||
limit = _00_limit.toBigDecimal(decimals),
|
||||
spent = _01_spent.toBigDecimal(decimals),
|
||||
limit = limit.toBigDecimal(decimals),
|
||||
spent = spent.toBigDecimal(decimals),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ data class VisaContractInfo(
|
|||
val available: Available,
|
||||
val blocked: BigDecimal,
|
||||
val debt: BigDecimal,
|
||||
val pendingRefund: BigDecimal,
|
||||
) {
|
||||
|
||||
data class Available(
|
||||
|
|
|
|||
|
|
@ -106,6 +106,17 @@ dependencyResolutionManagement {
|
|||
includeGroupAndSubgroups("com.tangem.ic4j")
|
||||
}
|
||||
}
|
||||
maven {
|
||||
// setting any repository from tangem project allows maven search all packages in the project
|
||||
url = uri("https://maven.pkg.github.com/tangem/web3j")
|
||||
credentials {
|
||||
username = properties.getProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
|
||||
password = properties.getProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
content {
|
||||
includeGroupAndSubgroups("org.web3j")
|
||||
}
|
||||
}
|
||||
maven("https://jitpack.io")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue