-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* auth/reauth refactor pass 1 * get_capabilities refactor * chains + account metadata refactor * revert fakewallet changes (apps will updated separately) * derp
- Loading branch information
1 parent
e2671f5
commit 4562678
Showing
11 changed files
with
484 additions
and
93 deletions.
There are no files selected for viewing
178 changes: 144 additions & 34 deletions
178
...ain/java/com/solana/mobilewalletadapter/clientlib/protocol/MobileWalletAdapterClient.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
android/common/src/main/java/com/solana/mobilewalletadapter/common/util/Identifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.solana.mobilewalletadapter.common.util; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import com.solana.mobilewalletadapter.common.ProtocolContract; | ||
|
||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
public class Identifier { | ||
|
||
// matches "{namespace}:{reference}", no whitespace | ||
private static final Pattern namespacedIdentifierPattern = Pattern.compile("^\\S+:\\S+$"); | ||
|
||
public static boolean isValidIdentifier(@NonNull String input) { | ||
Matcher matcher = namespacedIdentifierPattern.matcher(input); | ||
return matcher.find(); | ||
} | ||
|
||
public static @NonNull String clusterToChainIdentifier(@NonNull String cluster) | ||
throws IllegalArgumentException { | ||
switch (cluster) { | ||
case ProtocolContract.CLUSTER_MAINNET_BETA: | ||
return ProtocolContract.CHAIN_SOLANA_MAINNET; | ||
case ProtocolContract.CLUSTER_TESTNET: | ||
return ProtocolContract.CHAIN_SOLANA_TESTNET; | ||
case ProtocolContract.CLUSTER_DEVNET: | ||
return ProtocolContract.CHAIN_SOLANA_DEVNET; | ||
default: | ||
throw new IllegalArgumentException("input is not a valid solana cluster"); | ||
} | ||
} | ||
|
||
private Identifier() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.