Skip to content

Commit

Permalink
fix: dev tokens not showing in deploy previews part 2 (#464)
Browse files Browse the repository at this point in the history
* fix: separately duality and dev assets without name changes

* fix: get both duality and dev assets to show in TokenPicker

* fix: add first dev token as fee token if available

* feat: remove hard-coded gas token, make consistent with bridging logic
  • Loading branch information
dib542 authored Oct 3, 2023
1 parent a944123 commit 06b5566
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/lib/web3/hooks/useChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const dualityChain: Chain = {
// override default settings with an env variable for the whole chain config
...(REACT_APP__CHAIN ? (JSON.parse(REACT_APP__CHAIN) as Chain) : {}),
};
export const devChain = { ...dualityChain, chain_name: '___dev___' };
export const devChain = { ...dualityChain };

export const providerChain: Chain | undefined = REACT_APP__PROVIDER_CHAIN
? JSON.parse(REACT_APP__PROVIDER_CHAIN)
Expand Down
6 changes: 3 additions & 3 deletions src/lib/web3/hooks/useTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const dualityAssets: AssetList | undefined = REACT_APP__CHAIN_ASSETS
? (JSON.parse(REACT_APP__CHAIN_ASSETS) as AssetList)
: isTestnet
? {
chain_name: devChain.chain_name,
chain_name: dualityChain.chain_name,
assets: [dualityStakeToken, dualityMainToken],
}
: undefined;
Expand All @@ -97,7 +97,7 @@ export const providerAssets: AssetList | undefined = REACT_APP__PROVIDER_ASSETS
? (JSON.parse(REACT_APP__PROVIDER_ASSETS) as AssetList)
: undefined;

const devAssets: AssetList | undefined = REACT_APP__DEV_ASSET_MAP
export const devAssets: AssetList | undefined = REACT_APP__DEV_ASSET_MAP
? {
chain_name: devChain.chain_name,
assets: Object.entries(
Expand Down Expand Up @@ -188,7 +188,7 @@ export function useMainnetTokens(sortFunction = defaultSort) {
}

const dualityTokensFilter = (chain: Chain) =>
chain?.chain_id === 'duality' || chain === devChain;
chain.chain_id === dualityChain.chain_id;
export function useDualityTokens(sortFunction = defaultSort) {
tokenListCache['dualityTokens'] =
tokenListCache['dualityTokens'] || getTokens(dualityTokensFilter);
Expand Down
5 changes: 3 additions & 2 deletions src/lib/web3/wallets/keplr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import { AccountData, OfflineSigner } from '@cosmjs/proto-signing';
import { ChainInfo, Keplr, Window as KeplrWindow } from '@keplr-wallet/types';
import { chainRegistryChainToKeplr } from '@chain-registry/keplr';
import { dualityChain, providerChain } from '../hooks/useChains';
import { dualityAssets, providerAssets } from '../hooks/useTokens';
import { devAssets, dualityAssets, providerAssets } from '../hooks/useTokens';
import { AssetList } from '@chain-registry/types';

const { REACT_APP__CHAIN_ID: chainId = '' } = process.env;

const chainInfo: ChainInfo = chainRegistryChainToKeplr(
dualityChain,
dualityAssets ? [dualityAssets] : []
[devAssets, dualityAssets].filter((list): list is AssetList => !!list)
);

declare global {
Expand Down
4 changes: 1 addition & 3 deletions src/pages/MyLiquidity/useEditLiquidity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,7 @@ export function useEditLiquidity(): [
),
{
gas: gasEstimate.toFixed(0),
amount: [
{ amount: (gasEstimate * 0.025).toFixed(0), denom: 'token' },
],
amount: [],
},
''
);
Expand Down
4 changes: 1 addition & 3 deletions src/pages/MyLiquidity/useStaking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ export function useStake(): [
],
{
gas: gasEstimate.toFixed(0),
amount: [
{ amount: (gasEstimate * 0.025).toFixed(0), denom: 'token' },
],
amount: [],
},
''
);
Expand Down
4 changes: 1 addition & 3 deletions src/pages/Pool/useDeposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,7 @@ export function useDeposit([tokenA, tokenB]: [
],
{
gas: gasEstimate.toFixed(0),
amount: [
{ amount: (gasEstimate * 0.025).toFixed(0), denom: 'token' },
],
amount: [],
}
);

Expand Down
2 changes: 1 addition & 1 deletion src/pages/Swap/hooks/useSwap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function sendSwap(
],
{
gas: gasEstimate.toFixed(0),
amount: [{ amount: (gasEstimate * 0.025).toFixed(0), denom: 'token' }],
amount: [],
}
);
}
Expand Down

0 comments on commit 06b5566

Please sign in to comment.