aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-20 04:29:54 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-20 04:29:54 +0800
commita75d6531f207aac8aeefa94bb44fa96a5b295998 (patch)
treefc1c581f4c35e188b0a16461936b8d0e3323bfe6 /packages/website/ts/utils
parentbdd299dd9ee4699ccf5a4ab648e721e03ab2a139 (diff)
parentda69ddc19b29cfca05d28084b196324e121987ea (diff)
downloaddexon-sol-tools-a75d6531f207aac8aeefa94bb44fa96a5b295998.tar.gz
dexon-sol-tools-a75d6531f207aac8aeefa94bb44fa96a5b295998.tar.zst
dexon-sol-tools-a75d6531f207aac8aeefa94bb44fa96a5b295998.zip
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into bug/website/onboarding-improvements
Diffstat (limited to 'packages/website/ts/utils')
-rw-r--r--packages/website/ts/utils/utils.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index 414361c1b..0bd3dbcfa 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -190,6 +190,25 @@ export const utils = {
const truncatedAddress = `${address.substring(0, 6)}...${address.substr(-4)}`; // 0x3d5a...b287
return truncatedAddress;
},
+ getReadableAccountState(
+ isBlockchainReady: boolean,
+ providerType: ProviderType,
+ injectedProviderName: string,
+ userAddress?: string,
+ ): string {
+ const isAddressAvailable = !_.isUndefined(userAddress) && !_.isEmpty(userAddress);
+ const isExternallyInjectedProvider = utils.isExternallyInjected(providerType, injectedProviderName);
+ if (!isBlockchainReady) {
+ return 'Loading account';
+ } else if (isAddressAvailable) {
+ return utils.getAddressBeginAndEnd(userAddress);
+ // tslint:disable-next-line: prefer-conditional-expression
+ } else if (isExternallyInjectedProvider) {
+ return 'Account locked';
+ } else {
+ return 'No wallet detected';
+ }
+ },
hasUniqueNameAndSymbol(tokens: Token[], token: Token): boolean {
if (token.isRegistered) {
return true; // Since it's registered, it is the canonical token