aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-12-15 06:10:15 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-12-15 06:10:15 +0800
commit21a193e51650a78e59aaf6ae49b5120fb8b73e15 (patch)
tree687d226c40d7707dd7ffbe79776a9f903bab677e
parent926fcb296fb728c3520c638a43a5da950393832e (diff)
downloaddexon-sol-tools-21a193e51650a78e59aaf6ae49b5120fb8b73e15.tar.gz
dexon-sol-tools-21a193e51650a78e59aaf6ae49b5120fb8b73e15.tar.zst
dexon-sol-tools-21a193e51650a78e59aaf6ae49b5120fb8b73e15.zip
feature(instant): add trust wallet detection
-rw-r--r--packages/instant/src/constants.ts1
-rw-r--r--packages/instant/src/types.ts1
-rw-r--r--packages/instant/src/util/env.ts2
3 files changed, 4 insertions, 0 deletions
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
index f83eb4ac7..6d3680dc1 100644
--- a/packages/instant/src/constants.ts
+++ b/packages/instant/src/constants.ts
@@ -71,5 +71,6 @@ export const PROVIDER_TYPE_TO_NAME: { [key in ProviderType]: string } = {
[ProviderType.Mist]: 'Mist',
[ProviderType.CoinbaseWallet]: 'Coinbase Wallet',
[ProviderType.Parity]: 'Parity',
+ [ProviderType.TrustWallet]: 'Trust Wallet',
[ProviderType.Fallback]: 'Fallback',
};
diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts
index 1c7490e63..6374dda09 100644
--- a/packages/instant/src/types.ts
+++ b/packages/instant/src/types.ts
@@ -176,6 +176,7 @@ export enum ProviderType {
Mist = 'MIST',
CoinbaseWallet = 'COINBASE_WALLET',
Cipher = 'CIPHER',
+ TrustWallet = 'TRUST_WALLET',
Fallback = 'FALLBACK',
}
diff --git a/packages/instant/src/util/env.ts b/packages/instant/src/util/env.ts
index 0fda0cc0e..0f0b472b2 100644
--- a/packages/instant/src/util/env.ts
+++ b/packages/instant/src/util/env.ts
@@ -44,6 +44,8 @@ export const envUtil = {
getProviderType(provider: Provider): ProviderType | undefined {
if (provider.constructor.name === 'EthereumProvider') {
return ProviderType.Mist;
+ } else if (provider.constructor.name === 'TrustWeb3Provider') {
+ return ProviderType.TrustWallet;
} else if ((provider as any).isParity) {
return ProviderType.Parity;
} else if ((provider as any).isMetaMask) {