Skip to content

Commit

Permalink
try to give legacy version a more realistic setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Funkatronics committed Oct 23, 2023
1 parent 6cc5586 commit 2806820
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,34 @@ class MobileWalletAdapterViewModel(application: Application) : AndroidViewModel(
associationUri
)

val config = MobileWalletAdapterConfig(
10,
10,
arrayOf(MobileWalletAdapterConfig.LEGACY_TRANSACTION_VERSION, 0),
LOW_POWER_NO_CONNECTION_TIMEOUT_MS,
arrayOf(ProtocolContract.FEATURE_ID_SIGN_TRANSACTIONS)
)

scenario = if (BuildConfig.PROTOCOL_VERSION == SessionProperties.ProtocolVersion.LEGACY) {
// manually create the scenario here so we can override the association protocol version
// this forces ProtocolVersion.LEGACY to simulate a wallet using walletlib 1.x (for testing)
LocalWebSocketServerScenario(
getApplication<FakeWalletApplication>().applicationContext,
config,
MobileWalletAdapterConfig(
true,
10,
10,
arrayOf(MobileWalletAdapterConfig.LEGACY_TRANSACTION_VERSION, 0),
LOW_POWER_NO_CONNECTION_TIMEOUT_MS
),
AuthIssuerConfig("fakewallet"),
MobileWalletAdapterScenarioCallbacks(),
associationUri.associationPublicKey,
listOf(SessionProperties.ProtocolVersion.LEGACY),
listOf(),
associationUri.port,
)
} else {
associationUri.createScenario(
getApplication<FakeWalletApplication>().applicationContext,
config,
MobileWalletAdapterConfig(
10,
10,
arrayOf(MobileWalletAdapterConfig.LEGACY_TRANSACTION_VERSION, 0),
LOW_POWER_NO_CONNECTION_TIMEOUT_MS,
arrayOf(ProtocolContract.FEATURE_ID_SIGN_TRANSACTIONS)
),
AuthIssuerConfig("fakewallet"),
MobileWalletAdapterScenarioCallbacks()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public MobileWalletAdapterConfig(boolean supportsSignAndSendTransactions,
@NonNull @Size(min = 1) Object[] supportedTransactionVersions,
@IntRange(from = 0) long noConnectionWarningTimeoutMs) {
this(maxTransactionsPerSigningRequest, maxMessagesPerSigningRequest,
supportedTransactionVersions, noConnectionWarningTimeoutMs,
new String[] { ProtocolContract.FEATURE_ID_SIGN_TRANSACTIONS });
supportedTransactionVersions, noConnectionWarningTimeoutMs, new String[] {});
if (!supportsSignAndSendTransactions)
throw new IllegalArgumentException("signAndSendTransactions is required in MWA 2.0");
}
Expand Down

0 comments on commit 2806820

Please sign in to comment.