Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kujira chain #1009

Merged
merged 3 commits into from Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions sdk/src/config/MAINNET.ts
Expand Up @@ -23,6 +23,7 @@ export const MAINNET_CHAINS = {
osmosis: 20,
cosmoshub: 4000,
evmos: 4001,
kujira: 4002,
} as const;

/**
Expand Down Expand Up @@ -260,6 +261,14 @@ const MAINNET: { [chain in MainnetChainName]: ChainConfig } = {
context: Context.COSMOS,
contracts: {},
finalityThreshold: 0,
nativeTokenDecimals: 18,
},
kujira: {
key: 'kujira',
id: 4002,
context: Context.COSMOS,
contracts: {},
finalityThreshold: 0,
nativeTokenDecimals: 6,
},
};
Expand Down Expand Up @@ -289,6 +298,7 @@ const MAINNET_CONFIG: WormholeConfig = {
osmosis: 'https://osmosis-rpc.polkachu.com',
cosmoshub: 'https://cosmos-rpc.polkachu.com',
evmos: 'https://evmos-rpc.polkachu.com',
kujira: 'https://kujira-rpc.polkachu.com',
},
rest: {
sei: '',
Expand Down
20 changes: 12 additions & 8 deletions sdk/src/config/TESTNET.ts
Expand Up @@ -23,6 +23,7 @@ export const TESTNET_CHAINS = {
osmosis: 20,
cosmoshub: 4000,
evmos: 4001,
kujira: 4002,
} as const;

/**
Expand Down Expand Up @@ -255,21 +256,23 @@ const TESTNET: { [chain in TestnetChainName]: ChainConfig } = {
key: 'cosmoshub',
id: 4000,
context: Context.COSMOS,
contracts: {
core: '',
token_bridge: '',
},
contracts: {},
finalityThreshold: 0,
nativeTokenDecimals: 6,
},
evmos: {
key: 'evmos',
id: 4001,
context: Context.COSMOS,
contracts: {
core: '',
token_bridge: '',
},
contracts: {},
finalityThreshold: 0,
nativeTokenDecimals: 18,
},
kujira: {
key: 'kujira',
id: 4002,
context: Context.COSMOS,
contracts: {},
finalityThreshold: 0,
nativeTokenDecimals: 6,
},
Expand Down Expand Up @@ -300,6 +303,7 @@ const TESTNET_CONFIG: WormholeConfig = {
osmosis: 'https://rpc.osmotest5.osmosis.zone',
cosmoshub: 'https://rpc.sentry-02.theta-testnet.polypore.xyz',
evmos: 'https://evmos-testnet-rpc.polkachu.com',
kujira: 'https://kujira-testnet-rpc.polkachu.com',
},
rest: {
sei: 'https://rest.atlantic-2.seinetwork.io',
Expand Down
2 changes: 2 additions & 0 deletions sdk/src/contexts/cosmos/denom.ts
Expand Up @@ -7,6 +7,7 @@ const MAINNET_NATIVE_DENOMS: Record<string, string> = {
terra2: 'uluna',
cosmoshub: 'uatom',
evmos: 'aevmos',
kujira: 'ukuji',
};
const TESTNET_NATIVE_DENOMS: Record<string, string> = {
...MAINNET_NATIVE_DENOMS,
Expand All @@ -20,6 +21,7 @@ const PREFIXES: Record<string, string> = {
cosmoshub: 'cosmos',
evmos: 'evmos',
sei: 'sei',
kujira: 'kujira',
};

export function getNativeDenom(
Expand Down
2 changes: 2 additions & 0 deletions sdk/src/contexts/cosmos/utils.ts
@@ -1,6 +1,7 @@
import {
CHAIN_ID_COSMOSHUB,
CHAIN_ID_EVMOS,
CHAIN_ID_KUJIRA,
CHAIN_ID_OSMOSIS,
CHAIN_ID_WORMCHAIN,
} from '@certusone/wormhole-sdk';
Expand Down Expand Up @@ -42,6 +43,7 @@ const GATEWAY_CHAINS: ChainId[] = [
CHAIN_ID_EVMOS,
CHAIN_ID_OSMOSIS,
CHAIN_ID_WORMCHAIN,
CHAIN_ID_KUJIRA,
];

export function isGatewayChain(chainId: ChainId): boolean {
Expand Down
2 changes: 2 additions & 0 deletions wormhole-connect-loader/README.md
Expand Up @@ -43,6 +43,8 @@ Networks (`networks`):
| aptos | aptos |
| base | basegoerli |
| osmosis | osmosis |
| evmos | evmos |
| kujira | kujira |

<br>

Expand Down
4 changes: 4 additions & 0 deletions wormhole-connect-loader/src/types.ts
Expand Up @@ -14,6 +14,8 @@ export const MAINNET_CHAINS = {
arbitrum: 23,
optimism: 24,
base: 30,
evmos: 4001,
kujira: 4002,
} as const;
export type MainnetChainName = keyof typeof MAINNET_CHAINS;
export type MainnetChainId = (typeof MAINNET_CHAINS)[MainnetChainName];
Expand All @@ -33,6 +35,8 @@ export const TESTNET_CHAINS = {
arbitrumgoerli: 23,
optimismgoerli: 24,
basegoerli: 30,
evmos: 4001,
kujira: 4002,
} as const;
export type TestnetChainName = keyof typeof TESTNET_CHAINS;
export type TestnetChainId = (typeof TESTNET_CHAINS)[TestnetChainName];
Expand Down
1 change: 1 addition & 0 deletions wormhole-connect/src/config/index.ts
Expand Up @@ -130,6 +130,7 @@ export const TESTNET_TO_MAINNET_CHAIN_NAMES: {
osmosis: 'osmosis',
cosmoshub: 'cosmoshub',
evmos: 'evmos',
kujira: 'kujira',
};

validateConfigs();
11 changes: 11 additions & 0 deletions wormhole-connect/src/config/mainnet/chains.ts
Expand Up @@ -178,4 +178,15 @@ export const MAINNET_CHAINS: ChainsConfig = {
automaticRelayer: false,
maxBlockSearch: 0,
},
kujira: {
...chains.kujira!,
displayName: 'Kujira',
explorerUrl: 'https://finder.kujira.app/kaiyo-1/',
explorerName: 'Kujira Finder',
gasToken: 'KUJI',
chainId: 'kaiyo-1',
icon: Icon.KUJI,
automaticRelayer: false,
maxBlockSearch: 0,
},
};
7 changes: 7 additions & 0 deletions wormhole-connect/src/config/mainnet/gasEstimates.ts
Expand Up @@ -188,4 +188,11 @@ export const MAINNET_GAS_ESTIMATES: GasEstimates = {
claim: 0,
},
},
kujira: {
[Route.Bridge]: {
sendNative: 0,
sendToken: 0,
claim: 0,
},
},
};
2 changes: 2 additions & 0 deletions wormhole-connect/src/config/mainnet/rpcs.ts
Expand Up @@ -15,6 +15,7 @@ const {
REACT_APP_OSMOSIS_RPC,
REACT_APP_WORMCHAIN_RPC,
REACT_APP_EVMOS_RPC,
REACT_APP_KUJIRA_RPC,
REACT_APP_SEI_REST,
REACT_APP_EVMOS_REST,
} = process.env;
Expand All @@ -37,6 +38,7 @@ export const MAINNET_RPC_MAPPING = {
...populateRpcField('arbitrum', process.env.REACT_APP_ARBITRUM_RPC),
...populateRpcField('optimism', process.env.REACT_APP_OPTIMISM_RPC),
...populateRpcField('evmos', REACT_APP_EVMOS_RPC),
...populateRpcField('kujira', REACT_APP_KUJIRA_RPC),
};

export const MAINNET_REST_MAPPING = {
Expand Down
15 changes: 15 additions & 0 deletions wormhole-connect/src/config/mainnet/tokens.ts
Expand Up @@ -1806,4 +1806,19 @@ export const MAINNET_TOKENS: TokensConfig = {
default: 8,
},
},
KUJI: {
key: 'KUJI',
symbol: 'KUJI',
nativeChain: 'kujira',
tokenId: {
chain: 'kujira',
address: 'ukuji',
},
icon: Icon.KUJI,
coinGeckoId: 'kujira',
color: '#f51f1e',
decimals: {
default: 6,
},
},
};
11 changes: 11 additions & 0 deletions wormhole-connect/src/config/testnet/chains.ts
Expand Up @@ -199,4 +199,15 @@ export const TESTNET_CHAINS: ChainsConfig = {
automaticRelayer: false,
maxBlockSearch: 0,
},
kujira: {
...chains.kujira!,
displayName: 'Kujira',
explorerUrl: 'https://finder.kujira.app/harpoon-4/',
explorerName: 'Kujira Finder',
gasToken: 'KUJI',
chainId: 'harpoon-4',
icon: Icon.KUJI,
automaticRelayer: false,
maxBlockSearch: 0,
},
};
7 changes: 7 additions & 0 deletions wormhole-connect/src/config/testnet/gasEstimates.ts
Expand Up @@ -193,4 +193,11 @@ export const TESTNET_GAS_ESTIMATES: GasEstimates = {
claim: 0,
},
},
kujira: {
[Route.Bridge]: {
sendNative: 0,
sendToken: 0,
claim: 0,
},
},
};
2 changes: 2 additions & 0 deletions wormhole-connect/src/config/testnet/rpcs.ts
Expand Up @@ -16,6 +16,7 @@ const {
REACT_APP_WORMCHAIN_TESTNET_RPC,
REACT_APP_EVMOS_TESTNET_RPC,
REACT_APP_COSMOSHUB_TESTNET_RPC,
REACT_APP_KUJIRA_TESTNET_RPC,
REACT_APP_SEI_REST,
REACT_APP_EVMOS_REST,
} = process.env;
Expand Down Expand Up @@ -45,6 +46,7 @@ export const TESTNET_RPC_MAPPING = {
),
...populateRpcField('cosmoshub', REACT_APP_COSMOSHUB_TESTNET_RPC),
...populateRpcField('evmos', REACT_APP_EVMOS_TESTNET_RPC),
...populateRpcField('kujira', REACT_APP_KUJIRA_TESTNET_RPC),
};

export const TESTNET_REST_MAPPING = {
Expand Down
15 changes: 15 additions & 0 deletions wormhole-connect/src/config/testnet/tokens.ts
Expand Up @@ -1496,4 +1496,19 @@ export const TESTNET_TOKENS: TokensConfig = {
default: 8,
},
},
KUJI: {
key: 'KUJI',
symbol: 'KUJI',
nativeChain: 'kujira',
tokenId: {
chain: 'kujira',
address: 'ukuji',
},
icon: Icon.KUJI,
coinGeckoId: 'kujira',
color: '#f51f1e',
decimals: {
default: 6,
},
},
};
1 change: 1 addition & 0 deletions wormhole-connect/src/config/types.ts
Expand Up @@ -34,6 +34,7 @@ export enum Icon {
'OPTIMISM',
'ATOM',
'EVMOS',
'KUJI',
}

export enum Route {
Expand Down
4 changes: 4 additions & 0 deletions wormhole-connect/src/icons/TokenIcons.tsx
Expand Up @@ -30,6 +30,7 @@ import TBTC from './Tokens/TBTC';
import WSTETH from './Tokens/WSTETH';
import EVMOS from './Tokens/EVMOS';
import ATOM from './Tokens/ATOM';
import KUJI from './Tokens/KUJI';

const useStyles = makeStyles<{ size: number }>()((theme, { size }) => ({
container: {
Expand Down Expand Up @@ -123,6 +124,9 @@ export const getIcon = (icon: Icon) => {
case Icon.EVMOS: {
return EVMOS;
}
case Icon.KUJI: {
return KUJI;
}
default: {
return noIcon;
}
Expand Down
33 changes: 33 additions & 0 deletions wormhole-connect/src/icons/Tokens/KUJI.tsx
@@ -0,0 +1,33 @@
import React from 'react';

function KUJI() {
return (
<svg
style={{ maxHeight: '100%', maxWidth: '100%' }}
width="100px"
height="100px"
viewBox="0 0 100 100"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
>
<title>kuji</title>
<g id="kuji" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<circle id="Oval" fill="#22242F" cx="50" cy="50" r="50"></circle>
<path
d="M50,2 C76.509668,2 98,23.490332 98,50 C98,76.509668 76.509668,98 50,98 C23.490332,98 2,76.509668 2,50 C2,23.490332 23.490332,2 50,2 Z M50,5.38823529 C25.3616027,5.38823529 5.38823529,25.3616027 5.38823529,50 C5.38823529,74.6383973 25.3616027,94.6117647 50,94.6117647 C74.6383973,94.6117647 94.6117647,74.6383973 94.6117647,50 C94.6117647,25.3616027 74.6383973,5.38823529 50,5.38823529 Z"
id="Oval"
fill="#E53935"
fillRule="nonzero"
></path>
<path
d="M80.2507798,31.0832298 L80.2507798,26.7229814 L66.4391765,26.7229814 C65.6980661,23.9055901 64.9569557,21.4236025 64.1484716,19.1428571 L59.4996881,19.9478261 C60.3081722,21.9602484 61.1166563,24.2409938 61.8577667,26.7229814 L47.2376794,26.7229814 L47.2376794,31.0832298 L80.2507798,31.0832298 Z M44.8796007,63.4832298 L44.8796007,35.6447205 L38.0748596,35.6447205 C39.4897068,33.5652174 40.904554,31.0161491 42.3194011,27.9304348 L42.3194011,24.710559 L31.2027449,24.710559 C31.8091079,23.3689441 32.3480973,22.0273292 32.8870867,20.6186335 L28.5751716,19.2770186 C26.5539613,25.8509317 23.3873986,31.1503106 19.1428571,35.242236 L20.1534623,40.0049689 C21.02932,39.2 21.9051778,38.3950311 22.7136619,37.5229814 L22.7136619,63.4832298 L44.8796007,63.4832298 Z M33.4260761,35.6447205 L24.3980037,35.6447205 C26.1497193,33.4981366 27.8340611,31.0832298 29.316282,28.5341615 L37.8053649,28.5341615 C36.3231441,31.2173913 34.9082969,33.6322981 33.4260761,35.6447205 Z M61.1840299,80.8571429 C64.5527137,80.8571429 66.3044292,78.978882 66.3044292,75.289441 L66.3044292,56.1714286 L77.0168434,56.1714286 L77.0168434,37.1204969 L50.8084841,37.1204969 L50.8084841,56.1714286 L61.588272,56.1714286 L61.588272,74.1490683 C61.588272,75.826087 60.9145352,76.6981366 59.5670618,76.6981366 C58.0174672,76.6981366 56.4004991,76.5639752 54.7835309,76.3627329 L55.7267623,80.8571429 L61.1840299,80.8571429 Z M31.8764816,47.5850932 L26.8908297,47.5850932 L26.8908297,39.6024845 L31.8764816,39.6024845 L31.8764816,47.5850932 Z M40.7024329,47.5850932 L35.7841547,47.5850932 L35.7841547,39.6024845 L40.7024329,39.6024845 L40.7024329,47.5850932 Z M72.4354336,51.9453416 L55.3898939,51.9453416 L55.3898939,41.4136646 L72.4354336,41.4136646 L72.4354336,51.9453416 Z M40.7024329,59.4583851 L35.7841547,59.4583851 L35.7841547,51.4757764 L40.7024329,51.4757764 L40.7024329,59.4583851 Z M31.8764816,59.4583851 L26.8908297,59.4583851 L26.8908297,51.4757764 L31.8764816,51.4757764 L31.8764816,59.4583851 Z M77.2863381,77.7714286 L80.8571429,75.289441 C79.0380536,70.9962733 76.477854,66.0322981 73.1091703,60.3304348 L69.5383656,62.4770186 C72.7723019,68.0447205 75.3998752,73.1428571 77.2863381,77.7714286 Z M49.0567686,78.9118012 C52.0212102,74.2832298 54.5814099,68.7826087 56.7373674,62.4770186 L52.8296943,60.5987578 C50.7411104,66.6360248 48.2482845,71.868323 45.4185901,76.2956522 L49.0567686,78.9118012 Z M43.4647536,74.3503106 L46.7660636,73.5453416 C45.8228322,70.3254658 44.8796007,67.5080745 43.801622,65.0931677 L40.6350593,66.0322981 C41.7130381,68.715528 42.6562695,71.4658385 43.4647536,74.3503106 Z M36.3231441,78.2409938 L39.8265752,77.8385093 C39.4223331,72.7403727 38.6812227,68.715528 37.6032439,65.7639752 L34.2345602,66.1664596 C35.312539,68.9838509 35.9862757,73.0086957 36.3231441,78.2409938 Z M23.4547723,80.0521739 C24.8696195,76.0944099 25.7454772,71.6 26.1497193,66.5018634 L22.5115409,66.0322981 C22.1746725,70.8621118 21.231441,75.1552795 19.7492202,78.9118012 L23.4547723,80.0521739 Z M29.1141609,79.247205 L32.617592,78.8447205 C32.4828447,73.5453416 32.1459763,69.3192547 31.6743606,66.2335404 L28.4404242,66.6360248 C28.7772926,69.5875776 28.9794136,73.8136646 29.1141609,79.247205 Z"
id="鯨"
fill="#E53935"
fillRule="nonzero"
></path>
</g>
</svg>
);
}

export default KUJI;