Update MobileCoin dependency and add new configuration.
This commit is contained in:
parent
8ee96b40d0
commit
d9c9ae8dae
5 changed files with 32 additions and 22 deletions
|
@ -379,7 +379,7 @@ dependencies {
|
||||||
implementation 'org.whispersystems:signal-client-android:0.8.0'
|
implementation 'org.whispersystems:signal-client-android:0.8.0'
|
||||||
implementation 'com.google.protobuf:protobuf-javalite:3.10.0'
|
implementation 'com.google.protobuf:protobuf-javalite:3.10.0'
|
||||||
|
|
||||||
implementation('com.mobilecoin:android-sdk:1.0.0') {
|
implementation('com.mobilecoin:android-sdk:1.1.0') {
|
||||||
exclude group: 'com.google.protobuf'
|
exclude group: 'com.google.protobuf'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,21 +61,30 @@ final class MobileCoinMainNetConfig extends MobileCoinConfig {
|
||||||
@NonNull ClientConfig getConfig() {
|
@NonNull ClientConfig getConfig() {
|
||||||
try {
|
try {
|
||||||
byte[] mrEnclaveConsensus = Hex.toByteArray("e66db38b8a43a33f6c1610d335a361963bb2b31e056af0dc0a895ac6c857cab9");
|
byte[] mrEnclaveConsensus = Hex.toByteArray("e66db38b8a43a33f6c1610d335a361963bb2b31e056af0dc0a895ac6c857cab9");
|
||||||
|
byte[] mrEnclaveConsensusNew = Hex.toByteArray("653228afd2b02a6c28f1dc3b108b1dfa457d170b32ae8ec2978f941bd1655c83");
|
||||||
byte[] mrEnclaveReport = Hex.toByteArray("709ab90621e3a8d9eb26ed9e2830e091beceebd55fb01c5d7c31d27e83b9b0d1");
|
byte[] mrEnclaveReport = Hex.toByteArray("709ab90621e3a8d9eb26ed9e2830e091beceebd55fb01c5d7c31d27e83b9b0d1");
|
||||||
|
byte[] mrEnclaveReportNew = Hex.toByteArray("f3f7e9a674c55fb2af543513527b6a7872de305bac171783f6716a0bf6919499");
|
||||||
byte[] mrEnclaveLedger = Hex.toByteArray("511eab36de691ded50eb08b173304194da8b9d86bfdd7102001fe6bb279c3666");
|
byte[] mrEnclaveLedger = Hex.toByteArray("511eab36de691ded50eb08b173304194da8b9d86bfdd7102001fe6bb279c3666");
|
||||||
|
byte[] mrEnclaveLedgerNew = Hex.toByteArray("89db0d1684fcc98258295c39f4ab68f7de5917ef30f0004d9a86f29930cebbbd");
|
||||||
byte[] mrEnclaveView = Hex.toByteArray("ddd59da874fdf3239d5edb1ef251df07a8728c9ef63057dd0b50ade5a9ddb041");
|
byte[] mrEnclaveView = Hex.toByteArray("ddd59da874fdf3239d5edb1ef251df07a8728c9ef63057dd0b50ade5a9ddb041");
|
||||||
|
byte[] mrEnclaveViewNew = Hex.toByteArray("dd84abda7f05116e21fcd1ee6361b0ec29445fff0472131eaf37bf06255b567a");
|
||||||
|
|
||||||
Set<X509Certificate> trustRoots = getTrustRoots(R.raw.signal_mobilecoin_authority);
|
Set<X509Certificate> trustRoots = getTrustRoots(R.raw.signal_mobilecoin_authority);
|
||||||
ClientConfig config = new ClientConfig();
|
ClientConfig config = new ClientConfig();
|
||||||
String[] hardeningAdvisories = { "INTEL-SA-00334" };
|
String[] hardeningAdvisories = { "INTEL-SA-00334" };
|
||||||
|
|
||||||
config.logAdapter = new MobileCoinLogAdapter();
|
config.logAdapter = new MobileCoinLogAdapter();
|
||||||
config.fogView = new ClientConfig.Service().withTrustRoots(trustRoots)
|
config.fogView = new ClientConfig.Service().withTrustRoots(trustRoots)
|
||||||
.withVerifier(new Verifier().withMrEnclave(mrEnclaveView, null, hardeningAdvisories));
|
.withVerifier(new Verifier().withMrEnclave(mrEnclaveView, null, hardeningAdvisories)
|
||||||
|
.withMrEnclave(mrEnclaveViewNew, null, hardeningAdvisories));
|
||||||
config.fogLedger = new ClientConfig.Service().withTrustRoots(trustRoots)
|
config.fogLedger = new ClientConfig.Service().withTrustRoots(trustRoots)
|
||||||
.withVerifier(new Verifier().withMrEnclave(mrEnclaveLedger, null, hardeningAdvisories));
|
.withVerifier(new Verifier().withMrEnclave(mrEnclaveLedger, null, hardeningAdvisories)
|
||||||
|
.withMrEnclave(mrEnclaveLedgerNew, null, hardeningAdvisories));
|
||||||
config.consensus = new ClientConfig.Service().withTrustRoots(trustRoots)
|
config.consensus = new ClientConfig.Service().withTrustRoots(trustRoots)
|
||||||
.withVerifier(new Verifier().withMrEnclave(mrEnclaveConsensus, null, hardeningAdvisories));
|
.withVerifier(new Verifier().withMrEnclave(mrEnclaveConsensus, null, hardeningAdvisories)
|
||||||
config.report = new ClientConfig.Service().withVerifier(new Verifier().withMrEnclave(mrEnclaveReport, null, hardeningAdvisories));
|
.withMrEnclave(mrEnclaveConsensusNew, null, hardeningAdvisories));
|
||||||
|
config.report = new ClientConfig.Service().withVerifier(new Verifier().withMrEnclave(mrEnclaveReport, null, hardeningAdvisories)
|
||||||
|
.withMrEnclave(mrEnclaveReportNew, null, hardeningAdvisories));
|
||||||
return config;
|
return config;
|
||||||
} catch (AttestationException ex) {
|
} catch (AttestationException ex) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
|
|
@ -66,10 +66,10 @@ final class MobileCoinTestNetConfig extends MobileCoinConfig {
|
||||||
@Override
|
@Override
|
||||||
@NonNull ClientConfig getConfig() {
|
@NonNull ClientConfig getConfig() {
|
||||||
try {
|
try {
|
||||||
byte[] mrEnclaveConsensus = Hex.toByteArray("9268c3220a5260e51e4b586f00e4677fed2b80380f1eeaf775af60f8e880fde8");
|
byte[] mrEnclaveConsensus = Hex.toByteArray("9659ea738275b3999bf1700398b60281be03af5cb399738a89b49ea2496595af");
|
||||||
byte[] mrEnclaveReport = Hex.toByteArray("185875464ccd67a879d58181055383505a719b364b12d56d9bef90a40bed07ca");
|
byte[] mrEnclaveReport = Hex.toByteArray("a4764346f91979b4906d4ce26102228efe3aba39216dec1e7d22e6b06f919f11");
|
||||||
byte[] mrEnclaveLedger = Hex.toByteArray("7330c9987f21b91313b39dcdeaa7da8da5ca101c929f5740c207742c762e6dcd");
|
byte[] mrEnclaveLedger = Hex.toByteArray("768f7bea6171fb83d775ee8485e4b5fcebf5f664ca7e8b9ceef9c7c21e9d9bf3");
|
||||||
byte[] mrEnclaveView = Hex.toByteArray("4e598799faa4bb08a3bd55c0bcda7e1d22e41151d0c591f6c2a48b3562b0881e");
|
byte[] mrEnclaveView = Hex.toByteArray("e154f108c7758b5aa7161c3824c176f0c20f63012463bf3cc5651e678f02fb9e");
|
||||||
byte[] mrSigner = Hex.toByteArray("bf7fa957a6a94acb588851bc8767e0ca57706c79f4fc2aa6bcb993012c3c386c");
|
byte[] mrSigner = Hex.toByteArray("bf7fa957a6a94acb588851bc8767e0ca57706c79f4fc2aa6bcb993012c3c386c");
|
||||||
Set<X509Certificate> trustRoots = getTrustRoots(R.raw.signal_mobilecoin_authority);
|
Set<X509Certificate> trustRoots = getTrustRoots(R.raw.signal_mobilecoin_authority);
|
||||||
ClientConfig config = new ClientConfig();
|
ClientConfig config = new ClientConfig();
|
||||||
|
|
|
@ -104,7 +104,8 @@ public final class Wallet {
|
||||||
paymentsValues.setMobileCoinFullLedger(Objects.requireNonNull(ledger));
|
paymentsValues.setMobileCoinFullLedger(Objects.requireNonNull(ledger));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if ((retryOnAuthFailure && e.getCause() instanceof NetworkException) &&
|
if ((retryOnAuthFailure && e.getCause() instanceof NetworkException) &&
|
||||||
(((NetworkException) e.getCause()).statusCode == 401)) {
|
(((NetworkException) e.getCause()).statusCode == 401))
|
||||||
|
{
|
||||||
Log.w(TAG, "Failed to get up to date ledger, due to temp auth failure, retrying", e);
|
Log.w(TAG, "Failed to get up to date ledger, due to temp auth failure, retrying", e);
|
||||||
return getFullLedger(false);
|
return getFullLedger(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -124,6 +125,7 @@ public final class Wallet {
|
||||||
UnsignedLong highestBlockIndex = UnsignedLong.ZERO;
|
UnsignedLong highestBlockIndex = UnsignedLong.ZERO;
|
||||||
final long asOfTimestamp = System.currentTimeMillis();
|
final long asOfTimestamp = System.currentTimeMillis();
|
||||||
AccountSnapshot accountSnapshot = mobileCoinClient.getAccountSnapshot();
|
AccountSnapshot accountSnapshot = mobileCoinClient.getAccountSnapshot();
|
||||||
|
final BigInteger minimumTxFee = mobileCoinClient.getOrFetchMinimumTxFee();
|
||||||
|
|
||||||
if (minimumBlockIndex != null) {
|
if (minimumBlockIndex != null) {
|
||||||
long snapshotBlockIndex = accountSnapshot.getBlockIndex().longValue();
|
long snapshotBlockIndex = accountSnapshot.getBlockIndex().longValue();
|
||||||
|
@ -140,8 +142,7 @@ public final class Wallet {
|
||||||
.setKeyImage(ByteString.copyFrom(txOut.getKeyImage().getData()))
|
.setKeyImage(ByteString.copyFrom(txOut.getKeyImage().getData()))
|
||||||
.setPublicKey(ByteString.copyFrom(txOut.getPublicKey().getKeyBytes()));
|
.setPublicKey(ByteString.copyFrom(txOut.getPublicKey().getKeyBytes()));
|
||||||
if (txOut.getSpentBlockIndex() != null &&
|
if (txOut.getSpentBlockIndex() != null &&
|
||||||
(minimumBlockIndex == null ||
|
(minimumBlockIndex == null || txOut.isSpent(UnsignedLong.valueOf(minimumBlockIndex))))
|
||||||
txOut.isSpent(UnsignedLong.valueOf(minimumBlockIndex))))
|
|
||||||
{
|
{
|
||||||
txoBuilder.setSpentInBlock(getBlock(txOut.getSpentBlockIndex(), txOut.getSpentBlockTimestamp()));
|
txoBuilder.setSpentInBlock(getBlock(txOut.getSpentBlockIndex(), txOut.getSpentBlockTimestamp()));
|
||||||
builder.addSpentTxos(txoBuilder);
|
builder.addSpentTxos(txoBuilder);
|
||||||
|
@ -167,7 +168,7 @@ public final class Wallet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.setBalance(Uint64Util.bigIntegerToUInt64(totalUnspent))
|
builder.setBalance(Uint64Util.bigIntegerToUInt64(totalUnspent))
|
||||||
.setTransferableBalance(Uint64Util.bigIntegerToUInt64(accountSnapshot.getTransferableAmount()))
|
.setTransferableBalance(Uint64Util.bigIntegerToUInt64(accountSnapshot.getTransferableAmount(minimumTxFee)))
|
||||||
.setAsOfTimeStamp(asOfTimestamp)
|
.setAsOfTimeStamp(asOfTimestamp)
|
||||||
.setHighestBlock(MobileCoinLedger.Block.newBuilder()
|
.setHighestBlock(MobileCoinLedger.Block.newBuilder()
|
||||||
.setBlockNumber(highestBlockIndex.longValue())
|
.setBlockNumber(highestBlockIndex.longValue())
|
||||||
|
@ -399,7 +400,7 @@ public final class Wallet {
|
||||||
public enum TransactionStatus {
|
public enum TransactionStatus {
|
||||||
COMPLETE,
|
COMPLETE,
|
||||||
IN_PROGRESS,
|
IN_PROGRESS,
|
||||||
FAILED;
|
FAILED
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class TransactionStatusResult {
|
public static final class TransactionStatusResult {
|
||||||
|
|
|
@ -405,8 +405,8 @@ dependencyVerification {
|
||||||
['com.melnykov:floatingactionbutton:1.3.0',
|
['com.melnykov:floatingactionbutton:1.3.0',
|
||||||
'15d58d4fac0f7a288d0e5301bbaf501a146f5b3f5921277811bf99bd3b397263'],
|
'15d58d4fac0f7a288d0e5301bbaf501a146f5b3f5921277811bf99bd3b397263'],
|
||||||
|
|
||||||
['com.mobilecoin:android-sdk:1.0.0',
|
['com.mobilecoin:android-sdk:1.1.0',
|
||||||
'607b6d2bcbac6f4906fef84404f0e3dc30436eb86239db744f780e9112963359'],
|
'a57b73613c8fb255bf735d910268f945a6c690ff24d45cc6034aa34e9a3ae4d5'],
|
||||||
|
|
||||||
['com.nineoldandroids:library:2.4.0',
|
['com.nineoldandroids:library:2.4.0',
|
||||||
'68025a14e3e7673d6ad2f95e4b46d78d7d068343aa99256b686fe59de1b3163a'],
|
'68025a14e3e7673d6ad2f95e4b46d78d7d068343aa99256b686fe59de1b3163a'],
|
||||||
|
|
Loading…
Add table
Reference in a new issue