Skip to content

Commit

Permalink
Merge pull request #102 from terra-money/feature/migaloo
Browse files Browse the repository at this point in the history
add migaloo support
  • Loading branch information
simke9445 authored Nov 10, 2023
2 parents 1d74a4e + 4dd0a23 commit b48e715
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 13 deletions.
8 changes: 7 additions & 1 deletion apps/shared/hooks/useChainSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ReactComponent as TerraIcon } from 'components/assets/Terra.svg';
import { ReactComponent as InjectiveIcon } from 'components/assets/Injective.svg';
import { ReactComponent as NeutronIcon } from 'components/assets/Neutron.svg';
import { ReactComponent as NibiruIcon } from 'components/assets/Nibiru.svg';
import { ReactComponent as MigalooIcon } from 'components/assets/Migaloo.svg';
import {
ChainMetadata as SdkChainMetadata,
TERRA_CHAIN,
Expand Down Expand Up @@ -39,6 +40,8 @@ const getChainMetadata = (sdkMetadata: SdkChainMetadata) => {
return { ...sdkMetadata, icon: <NeutronIcon className={styles.chain_icon} /> };
case 'nibiru':
return { ...sdkMetadata, icon: <NibiruIcon className={styles.chain_icon} /> };
case 'migaloo':
return { ...sdkMetadata, icon: <MigalooIcon className={styles.chain_icon} /> };
}
};

Expand Down Expand Up @@ -126,7 +129,10 @@ const ChainSelectorProvider = (props: ChainSelectorProviderProps) => {
supportedChains: ChainModule.supportedChains()
.map(getChainMetadata)
.filter((c) => {
if (c.name === 'nibiru' && networkName(network) === 'mainnet') {
if (
(c.name === 'nibiru' && networkName(network) === 'mainnet') ||
(c.name === 'migaloo' && networkName(network) === 'mainnet')
) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@mui/material": "^5.10.2",
"@terra-money/feather.js": "^1.0.11",
"@terra-money/wallet-kit": "^1.0.11",
"@terra-money/warp-sdk": "^0.1.61",
"@terra-money/warp-sdk": "^0.1.64",
"assert": "^2.0.0",
"big.js": "^6.2.1",
"buffer": "^6.0.3",
Expand Down
3 changes: 2 additions & 1 deletion apps/shared/queries/tokens/useNativeTokensQuery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useQuery, UseQueryResult } from 'react-query';
import { useChainSelector } from '../../hooks';
import { INJ, LUNA, NativeTokensResponse, NEUTRON, NIBIRU } from '../../types';
import { INJ, LUNA, NativeTokensResponse, NEUTRON, NIBIRU, WHALE } from '../../types';

export const useNativeTokensQuery = (
queryName: string = 'QUERY:NATIVE_TOKENS'
Expand All @@ -15,6 +15,7 @@ export const useNativeTokensQuery = (
...(selectedChain.name === 'injective' && { [INJ.key]: INJ }),
...(selectedChain.name === 'neutron' && { [NEUTRON.key]: NEUTRON }),
...(selectedChain.name === 'nibiru' && { [NIBIRU.key]: NIBIRU }),
...(selectedChain.name === 'migaloo' && { [WHALE.key]: WHALE }),
};
},
{
Expand Down
11 changes: 11 additions & 0 deletions apps/shared/types/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ export const NIBIRU: NativeToken = {
coinGeckoId: 'nibiru',
};

export const WHALE: NativeToken = {
key: 'uwhale',
type: 'native',
denom: 'uwhale',
name: 'White Whale',
symbol: 'WHALE',
decimals: 6,
icon: 'https://station-assets.terra.dev/img/chains/Migaloo.svg',
coinGeckoId: 'white-whale',
};

export const INJ: NativeToken = {
key: 'inj',
type: 'native',
Expand Down
2 changes: 1 addition & 1 deletion apps/warp-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@popperjs/core": "^2.11.6",
"@terra-money/feather.js": "^1.0.11",
"@terra-money/wallet-kit": "^1.0.11",
"@terra-money/warp-sdk": "^0.1.61",
"@terra-money/warp-sdk": "^0.1.64",
"assert": "^2.0.0",
"big.js": "^6.2.1",
"brace": "^0.11.1",
Expand Down
5 changes: 5 additions & 0 deletions apps/warp-protocol/src/components/assets/Migaloo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion apps/warp-protocol/src/hooks/useNativeToken.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useChainSelector } from '@terra-money/apps/hooks';
import { INJ, LUNA, NativeToken, NEUTRON, NIBIRU } from '@terra-money/apps/types';
import { INJ, LUNA, NativeToken, NEUTRON, NIBIRU, WHALE } from '@terra-money/apps/types';
import { useMemo } from 'react';

export const useNativeToken = (): NativeToken => {
Expand All @@ -15,6 +15,8 @@ export const useNativeToken = (): NativeToken => {
return NEUTRON;
case 'nibiru':
return NIBIRU;
case 'migaloo':
return WHALE;
}
}, [selectedChain.name]);
};
1 change: 1 addition & 0 deletions apps/warp-protocol/src/utils/finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const useFinderTxUrl = () => {
return neutronFinderTxUrl(chainId, txHash);
case 'injective':
return injectiveFinderTxUrl(connectedWallet.network!, txHash);
// TODO: add nibiru and whale when supported
}
},
[connectedWallet, chainId, chain]
Expand Down
2 changes: 1 addition & 1 deletion indexers/warp-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@aws-sdk/client-dynamodb": "^3.159.0",
"@aws-sdk/util-dynamodb": "^3.159.0",
"@terra-money/feather.js": "^1.0.11",
"@terra-money/warp-sdk": "^0.1.61",
"@terra-money/warp-sdk": "^0.1.64",
"@types/node": "^16.11.56",
"axios": "^1.1.2",
"big.js": "^6.2.1",
Expand Down
10 changes: 10 additions & 0 deletions indexers/warp-protocol/src/utils/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ export class Environment {
};
}
}

if (chainName === 'migaloo') {
if (process.env.NETWORK === 'testnet') {
// testnet
return {
height: 4415456,
timestamp: 1699648200,
};
}
}
};

static getContractAddress(chainName: string, contract: keyof ContractAddresses) {
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4322,7 +4322,7 @@ __metadata:
"@mui/material": ^5.10.2
"@terra-money/feather.js": ^1.0.11
"@terra-money/wallet-kit": ^1.0.11
"@terra-money/warp-sdk": ^0.1.61
"@terra-money/warp-sdk": ^0.1.64
"@testing-library/jest-dom": ^5.16.5
"@testing-library/react": ^13.3.0
"@testing-library/user-event": ^13.5.0
Expand Down Expand Up @@ -4468,9 +4468,9 @@ __metadata:
languageName: node
linkType: hard

"@terra-money/warp-sdk@npm:^0.1.61":
version: 0.1.61
resolution: "@terra-money/warp-sdk@npm:0.1.61"
"@terra-money/warp-sdk@npm:^0.1.64":
version: 0.1.64
resolution: "@terra-money/warp-sdk@npm:0.1.64"
dependencies:
"@terra-money/feather.js": ^1.0.11
"@types/node": ^16.11.56
Expand All @@ -4483,7 +4483,7 @@ __metadata:
lodash: ^4.17.21
pino: ^8.4.2
typescript: ^4.8.2
checksum: 5afca96779e0be646e1140330e905cfd4bfe586e2e9e1a1596fcca03136f1f3ca4e712194fadc8ce91a222a0ec5af600bb5723faad01d7e2814733e63ea109e9
checksum: 49fff55129aff3d8865d3a9d5d43cfcac61a62d6b7522c3388e1ca96ba26c06ae7466fbef13f700a3eb0ade974ca324e7c9ec31b8e59b7c337fb43e1f7a3db14
languageName: node
linkType: hard

Expand Down Expand Up @@ -5406,7 +5406,7 @@ __metadata:
"@popperjs/core": ^2.11.6
"@terra-money/feather.js": ^1.0.11
"@terra-money/wallet-kit": ^1.0.11
"@terra-money/warp-sdk": ^0.1.61
"@terra-money/warp-sdk": ^0.1.64
"@testing-library/jest-dom": ^5.16.5
"@testing-library/react": ^13.3.0
"@testing-library/user-event": ^13.5.0
Expand Down Expand Up @@ -5483,7 +5483,7 @@ __metadata:
"@aws-sdk/client-dynamodb": ^3.159.0
"@aws-sdk/util-dynamodb": ^3.159.0
"@terra-money/feather.js": ^1.0.11
"@terra-money/warp-sdk": ^0.1.61
"@terra-money/warp-sdk": ^0.1.64
"@types/d3-array": ^3.0.3
"@types/node": ^16.11.56
axios: ^1.1.2
Expand Down

0 comments on commit b48e715

Please sign in to comment.