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