Skip to content

Commit

Permalink
Merge pull request #112 from terra-money/feature/oraichain
Browse files Browse the repository at this point in the history
Feature/oraichain
  • Loading branch information
simke9445 authored Apr 1, 2024
2 parents 2e6caba + 4cd2c56 commit ebea33d
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 13 deletions.
3 changes: 3 additions & 0 deletions apps/shared/hooks/useChainSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ReactComponent as NibiruIcon } from 'components/assets/Nibiru.svg';
import { ReactComponent as MigalooIcon } from 'components/assets/Migaloo.svg';
import { ReactComponent as OsmoIcon } from 'components/assets/Osmo.svg';
import { ReactComponent as ArchwayIcon } from 'components/assets/Archway.svg';
import { ReactComponent as OraiIcon } from 'components/assets/Orai.svg';
import {
ChainMetadata as SdkChainMetadata,
TERRA_CHAIN,
Expand Down Expand Up @@ -48,6 +49,8 @@ const getChainMetadata = (sdkMetadata: SdkChainMetadata) => {
return { ...sdkMetadata, icon: <OsmoIcon className={styles.chain_icon} /> };
case 'archway':
return { ...sdkMetadata, icon: <ArchwayIcon className={styles.chain_icon} /> };
case 'oraichain':
return { ...sdkMetadata, icon: <OraiIcon className={styles.chain_icon} /> };
}
};

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.2.25",
"@terra-money/warp-sdk": "^0.2.27",
"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, WHALE, OSMO, ARCHWAY, ARCHWAY_TESTNET } from '../../types';
import { INJ, LUNA, NativeTokensResponse, NEUTRON, NIBIRU, WHALE, OSMO, ARCHWAY, ARCHWAY_TESTNET, ORAICHAIN } from '../../types';

export const useNativeTokensQuery = (
queryName: string = 'QUERY:NATIVE_TOKENS'
Expand Down Expand Up @@ -31,6 +31,7 @@ export const useNativeTokensQuery = (
...(selectedChain.name === 'nibiru' && { [NIBIRU.key]: NIBIRU }),
...(selectedChain.name === 'migaloo' && { [WHALE.key]: WHALE }),
...(selectedChain.name === 'osmosis' && { [OSMO.key]: OSMO }),
...(selectedChain.name === 'oraichain' && { [ORAICHAIN.key]: ORAICHAIN }),
...archwayTokens,
};
},
Expand Down
12 changes: 12 additions & 0 deletions apps/shared/types/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ export const ARCHWAY_TESTNET: NativeToken = {
coinGeckoId: 'archway',
};


export const ORAICHAIN: NativeToken = {
key: 'orai',
type: 'native',
denom: 'orai',
name: 'Oraichain',
symbol: 'ORAI',
decimals: 6,
icon: 'https://station-assets.terra.dev/img/chains/orai.svg',
coinGeckoId: 'oraichain-token',
};

export interface NativeTokensResponse {
[tokenAddr: string]: NativeToken;
}
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 @@ -57,7 +57,7 @@
"@terra-money/feather.js": "1.0.11",
"@terra-money/terra-station-mobile": "1.0.8",
"@terra-money/wallet-kit": "1.0.11",
"@terra-money/warp-sdk": "^0.2.25",
"@terra-money/warp-sdk": "^0.2.27",
"assert": "^2.0.0",
"big.js": "^6.2.1",
"brace": "^0.11.1",
Expand Down
15 changes: 15 additions & 0 deletions apps/warp-protocol/src/components/assets/Orai.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions apps/warp-protocol/src/hooks/useNativeToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
NativeToken,
NEUTRON,
NIBIRU,
ORAICHAIN,
OSMO,
WHALE,
} from '@terra-money/apps/types';
Expand Down Expand Up @@ -35,6 +36,8 @@ export const useNativeToken = (): NativeToken => {
return OSMO;
case 'archway':
return ARCHWAY;
case 'oraichain':
return ORAICHAIN;
}
}, [selectedChain.name, selectedChainId]);
};
14 changes: 12 additions & 2 deletions apps/warp-protocol/src/utils/finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ const archwayFinderTxUrl = (chainId: string, txHash: string) => {
return `https://www.mintscan.io/archway-testnet/tx/${txHash}`;
};

const oraichainFinderTxUrl = (chainId: string, txHash: string) => {
if (chainId === 'Oraichain') {
return `https://scan.orai.io/txs/${txHash}`;
}

return `https://testnet.scan.orai.io/txs/${txHash}`;
};

export const useFinderTxUrl = () => {
const { connectedWallet, chain, chainId } = useLocalWallet();

Expand All @@ -34,9 +42,11 @@ export const useFinderTxUrl = () => {
case 'injective':
return injectiveFinderTxUrl(connectedWallet.network!, txHash);
case 'osmosis':
return osmoFinderTxUrl(connectedWallet.network!, txHash);
return osmoFinderTxUrl(chainId, txHash);
case 'archway':
return archwayFinderTxUrl(connectedWallet.network!, txHash);
return archwayFinderTxUrl(chainId, txHash);
case 'oraichain':
return oraichainFinderTxUrl(chainId, txHash);
// TODO: add nibiru and whale when supported
}
},
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.2.25",
"@terra-money/warp-sdk": "^0.2.27",
"@types/node": "^16.11.56",
"axios": "^1.1.2",
"big.js": "^6.2.1",
Expand Down
14 changes: 14 additions & 0 deletions indexers/warp-protocol/src/utils/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ export class Environment {
}
}

if (chainName === 'oraichain') {
if (process.env.NETWORK === 'mainnet') {
return {
height: 17469400,
timestamp: 1711987779,
};
} else {
return {
height: 20424285,
timestamp: 1711986354,
};
}
}

// if (chainName === 'migaloo') {
// if (process.env.NETWORK === 'testnet') {
// // testnet
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4346,7 +4346,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.2.25
"@terra-money/warp-sdk": ^0.2.27
"@testing-library/jest-dom": ^5.16.5
"@testing-library/react": ^13.3.0
"@testing-library/user-event": ^13.5.0
Expand Down Expand Up @@ -4521,9 +4521,9 @@ __metadata:
languageName: node
linkType: hard

"@terra-money/warp-sdk@npm:^0.2.25":
version: 0.2.25
resolution: "@terra-money/warp-sdk@npm:0.2.25"
"@terra-money/warp-sdk@npm:^0.2.27":
version: 0.2.27
resolution: "@terra-money/warp-sdk@npm:0.2.27"
dependencies:
"@terra-money/feather.js": 1.0.11
"@types/node": ^16.11.56
Expand All @@ -4536,7 +4536,7 @@ __metadata:
lodash: ^4.17.21
pino: ^8.4.2
typescript: ^4.8.2
checksum: cf4fed73e82142ed19a324bfd6ecbe1e50df7879e076983efb8256f8b9b4d3db16847c14e3fa7b5aec45b8d3ed268309553747837a29db75954bea31f31f55a0
checksum: a640302dc18769eadfec14e45542239ee60c8775c130aa02bb62989e64d19b349cf85e27af9ca4588def13488575e917191620c58c470e445b9d86c67f87d07b
languageName: node
linkType: hard

Expand Down Expand Up @@ -5628,7 +5628,7 @@ __metadata:
"@terra-money/feather.js": 1.0.11
"@terra-money/terra-station-mobile": 1.0.8
"@terra-money/wallet-kit": 1.0.11
"@terra-money/warp-sdk": ^0.2.25
"@terra-money/warp-sdk": ^0.2.27
"@testing-library/jest-dom": ^5.16.5
"@testing-library/react": ^13.3.0
"@testing-library/user-event": ^13.5.0
Expand Down Expand Up @@ -5708,7 +5708,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.2.25
"@terra-money/warp-sdk": ^0.2.27
"@types/d3-array": ^3.0.3
"@types/node": ^16.11.56
axios: ^1.1.2
Expand Down

0 comments on commit ebea33d

Please sign in to comment.