Updated on 2026-08-14
This commit is contained in:
commit
20cfc4e1ae
5 changed files with 33 additions and 7 deletions
|
|
@ -341,6 +341,7 @@ class IdFragment : BaseFragment(), NfcAdapter.ReaderCallback,
|
|||
validator.check(ctx, false)
|
||||
context?.let { ContextCompat.getColor(it, validator.color) }?.let { tvBalanceLine1?.setTextColor(it) }
|
||||
tvBalanceLine1?.text = getString(validator.firstLine)
|
||||
tvBalanceLine2?.text = getString(validator.getSecondLine(false)).format(ctx.card.idCardData.trustedAddress)
|
||||
}
|
||||
|
||||
if (ctx.card.hasIDCardData()) {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class IssueNewIdFragment : BaseFragment(), NavigationResultListener {
|
|||
photoInBytes,
|
||||
issuerExpireDate.issueDate,
|
||||
issuerExpireDate.expireDate,
|
||||
(CoinEngineFactory.create(ctx) as? EthIdEngine)?.approvalAddress
|
||||
(CoinEngineFactory.create(ctx) as? EthIdEngine)?.coinData?.approvalAddress
|
||||
)
|
||||
|
||||
val inputs = "$name $lastName;$birthDate${gender.toString()}"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ public class EthIdData extends CoinData {
|
|||
private boolean hasApprovalTx = false;
|
||||
private Long approvalAddressNonce;
|
||||
private byte[] CKDpub = null;
|
||||
private String approvalAddress = null; //default approval address for issuance
|
||||
|
||||
public boolean isHasApprovalTx() {
|
||||
return hasApprovalTx;
|
||||
|
|
@ -34,6 +35,14 @@ public class EthIdData extends CoinData {
|
|||
this.CKDpub = CKDpub;
|
||||
}
|
||||
|
||||
public String getApprovalAddress() {
|
||||
return approvalAddress;
|
||||
}
|
||||
|
||||
public void setApprovalAddress(String approvalAddress) {
|
||||
this.approvalAddress = approvalAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearInfo() {
|
||||
super.clearInfo();
|
||||
|
|
@ -50,6 +59,8 @@ public class EthIdData extends CoinData {
|
|||
}
|
||||
if (B.containsKey("CKDpub")) CKDpub = B.getByteArray("CKDpub");
|
||||
hasApprovalTx = B.getBoolean("HasApprovalTx");
|
||||
if (B.containsKey("ApprovalAddress")) approvalAddress = B.getString("ApprovalAddress");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -59,6 +70,7 @@ public class EthIdData extends CoinData {
|
|||
if (approvalAddressNonce != null) B.putLong("ApprovalAddressNonce", approvalAddressNonce);
|
||||
if (CKDpub != null) B.putByteArray("CKDpub", CKDpub);
|
||||
B.putBoolean("HasApprovalTx", hasApprovalTx);
|
||||
if (approvalAddress != null) B.putString("ApprovalAddress", approvalAddress);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("Can't save to bundle ", e.getMessage());
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ public class EthIdEngine extends CoinEngine {
|
|||
|
||||
private static final String TAG = com.tangem.wallet.eth.EthEngine.class.getSimpleName();
|
||||
public EthIdData coinData = null;
|
||||
private byte[] approvalPubKey = Util.hexToBytes("04EAD74FEEE4061044F46B19EB654CEEE981E9318F0C8FE99AF5CDB9D779D2E52BB51EA2D14545E0B323F7A90CF4CC72753C973149009C10DB2D83DCEC28487729"); //TODO
|
||||
public String approvalAddress = calculateAddress(approvalPubKey); //TODO
|
||||
//default approval public key for issuance
|
||||
private byte[] approvalPubKey = Util.hexToBytes("04EAD74FEEE4061044F46B19EB654CEEE981E9318F0C8FE99AF5CDB9D779D2E52BB51EA2D14545E0B323F7A90CF4CC72753C973149009C10DB2D83DCEC28487729");
|
||||
|
||||
public EthIdEngine(TangemContext ctx) throws Exception {
|
||||
super(ctx);
|
||||
|
|
@ -56,12 +56,24 @@ public class EthIdEngine extends CoinEngine {
|
|||
} else {
|
||||
throw new Exception("Invalid type of Blockchain data for " + this.getClass().getSimpleName());
|
||||
}
|
||||
defineApprovalAddress();
|
||||
}
|
||||
|
||||
public EthIdEngine() {
|
||||
super();
|
||||
}
|
||||
|
||||
private void defineApprovalAddress() {
|
||||
TangemCard.IDCardData idCardData = ctx.getCard().getIDCardData();
|
||||
String approvalAddress;
|
||||
if (idCardData != null && idCardData.trustedAddress != null) {
|
||||
approvalAddress = ctx.getCard().getIDCardData().trustedAddress;
|
||||
} else {
|
||||
approvalAddress = calculateAddress(approvalPubKey);
|
||||
}
|
||||
coinData.setApprovalAddress(approvalAddress);
|
||||
}
|
||||
|
||||
private static int getDecimals() {
|
||||
return 18;
|
||||
}
|
||||
|
|
@ -232,12 +244,12 @@ public class EthIdEngine extends CoinEngine {
|
|||
if (coinData != null && coinData.isHasApprovalTx()) {
|
||||
balanceValidator.setScore(100);
|
||||
balanceValidator.setFirstLine(R.string.id_verified);
|
||||
balanceValidator.setSecondLine(R.string.balance_validator_second_line_unverified_balance);
|
||||
balanceValidator.setSecondLine(R.string.balance_validator_second_line_issued_by);
|
||||
return false;
|
||||
} else {
|
||||
balanceValidator.setScore(0);
|
||||
balanceValidator.setFirstLine(R.string.id_not_registered);
|
||||
balanceValidator.setSecondLine(R.string.balance_validator_second_line_unverified_balance);
|
||||
balanceValidator.setSecondLine(R.string.empty_string);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -389,7 +401,7 @@ public class EthIdEngine extends CoinEngine {
|
|||
public void onSuccess(BlockcypherTx response) {
|
||||
Log.i(TAG, "onSuccess: BlockcypherTx");
|
||||
try {
|
||||
String address = approvalAddress;
|
||||
String address = coinData.getApprovalAddress();
|
||||
if (address.startsWith("0x") || address.startsWith("0X")) {
|
||||
address = address.substring(2);
|
||||
}
|
||||
|
|
@ -542,6 +554,6 @@ public class EthIdEngine extends CoinEngine {
|
|||
};
|
||||
serverApiInfura.setResponseListener(responseListener);
|
||||
|
||||
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_GET_PENDING_COUNT, 67, approvalAddress, "", "");
|
||||
serverApiInfura.requestData(ServerApiInfura.INFURA_ETH_GET_PENDING_COUNT, 67, coinData.getApprovalAddress(), "", "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@
|
|||
<string name="balance_validator_second_line_create_account_instruction">To create account send 1+ XLM to this address</string>
|
||||
<string name="balance_validator_second_line_create_account_xrp">Load 20+ XRP to create account</string>
|
||||
<string name="balance_validator_second_line_authenticity_not_verified">Authenticity cannot be verified. Swipe down to refresh.</string>
|
||||
<string name="balance_validator_second_line_issued_by">Issued by %s</string>
|
||||
|
||||
<!-- CreateNewWallet, Purge, SignTransaction -->
|
||||
<string name="now_touch_the_card_with_id">Now touch the card with ID</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue