Skip to content

Commit

Permalink
Merge branch 'main' into mulan/ct-1206-update-web-package
Browse files Browse the repository at this point in the history
  • Loading branch information
moo-onthelawn committed Sep 20, 2024
2 parents 622e107 + add11be commit ab2280f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
15 changes: 14 additions & 1 deletion src/hooks/useAccounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ const useAccountsContext = () => {
}

setPreviousEvmAddress(evmAddress);
// TODO: create a better pattern than this.
// We only want to set the source evm address if the evm address changes
// OR when our connection state changes.
// The evm address can be cached via local storage, so it won't change when we reconnect
// But the hasSubAccount value will become true once you reconnect
// This allows us to trigger a state update and make sure abacus knows the source address
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [evmAddress, hasSubAccount]);

const { ready, authenticated } = usePrivy();
Expand Down Expand Up @@ -206,7 +213,13 @@ const useAccountsContext = () => {
}

setPreviousSolAddress(solAddress);
}, [solAddress]);
// We only want to set the source sol address if the sol address changes
// OR when our connection state changes.
// The sol address can be cached via local storage, so it won't change when we reconnect
// But the hasSubAccount value will become true once you reconnect
// This allows us to trigger a state update and make sure abacus knows the source address
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [solAddress, hasSubAccount]);

const decryptSignature = (encryptedSignature: string | undefined) => {
const staticEncryptionKey = import.meta.env.VITE_PK_ENCRYPTION_KEY;
Expand Down
10 changes: 4 additions & 6 deletions src/hooks/useDisplayedWallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useMemo } from 'react';

import { WalletType as CosmosWalletType } from 'graz';

import { isDev, isTestnet } from '@/constants/networks';
import { StatsigFlags } from '@/constants/statsig';
import {
COINBASE_MIPD_RDNS,
Expand Down Expand Up @@ -63,11 +62,10 @@ export const useDisplayedWallets = (): WalletInfo[] => {

...enabledInjectedWallets,

(isTestnet || isDev) &&
phantomDetected && {
connectorType: ConnectorType.PhantomSolana,
name: WalletType.Phantom,
},
phantomDetected && {
connectorType: ConnectorType.PhantomSolana,
name: WalletType.Phantom,
},

keplrEnabled && {
connectorType: ConnectorType.Cosmos,
Expand Down
3 changes: 2 additions & 1 deletion src/lib/abacus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import {
import { getInputTradeOptions, getTransferInputs } from '@/state/inputsSelectors';

import { LocaleSeparators } from '../numbers';
import { testFlags } from '../testFlags';
import AbacusAnalytics from './analytics';
import AbacusChainTransaction from './dydxChainTransactions';
import AbacusFileSystem from './filesystem';
Expand Down Expand Up @@ -120,7 +121,7 @@ class AbacusStateManager {

const appConfigs = AbacusAppConfig.Companion.forWebAppWithIsolatedMargins;
appConfigs.onboardingConfigs.squidVersion = OnboardingConfig.SquidVersion.V2;
appConfigs.staticTyping = import.meta.env.MODE !== 'production';
appConfigs.staticTyping = testFlags.enableStaticTyping;

this.stateManager = new AsyncAbacusStateManager(
'',
Expand Down
4 changes: 4 additions & 0 deletions src/lib/testFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ class TestFlags {
get referralCode() {
return this.queryParams.ref;
}

get enableStaticTyping() {
return !!this.queryParams.statictyping;
}
}

export const testFlags = new TestFlags();

0 comments on commit ab2280f

Please sign in to comment.