Skip to content

Commit

Permalink
chore: kava bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
shane-moore committed Aug 15, 2023
1 parent 7435258 commit 04705ba
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 19 deletions.
4 changes: 3 additions & 1 deletion packages/sdk-ui-ts/src/types/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export enum BridgingNetwork {
Polygon = 'polygon',
Klaytn = 'klaytn',
Sui = 'sui',
Kava = 'kava',
}

export const MintScanExplorerUrl = {
Expand All @@ -42,7 +43,8 @@ export const MintScanExplorerUrl = {
[BridgingNetwork.Stride]: 'stride',
[BridgingNetwork.Crescent]: 'crescent',
[BridgingNetwork.Sommelier]: 'sommelier',
[BridgingNetwork.Canto]: '',
[BridgingNetwork.Canto]: 'canto',
[BridgingNetwork.Kava]: 'kava',
} as Record<BridgingNetwork, string>

export enum BridgeTransactionState {
Expand Down
26 changes: 25 additions & 1 deletion packages/sdk-ui-ts/src/utils/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const KeplrNetworks = [
BridgingNetwork.Secret,
BridgingNetwork.Stride,
BridgingNetwork.Sommelier,
BridgingNetwork.Canto,
BridgingNetwork.Kava,
]

export const LeapNetworks = [
Expand All @@ -59,6 +59,7 @@ export const LeapNetworks = [
BridgingNetwork.Stride,
BridgingNetwork.Sommelier,
BridgingNetwork.Canto,
BridgingNetwork.Kava,
]

export const CosmostationNetworks = [
Expand All @@ -74,6 +75,7 @@ export const CosmostationNetworks = [
BridgingNetwork.Crescent,
BridgingNetwork.Sommelier,
BridgingNetwork.Canto,
BridgingNetwork.Kava,
]

export const CosmosNetworks = [
Expand All @@ -89,6 +91,7 @@ export const CosmosNetworks = [
BridgingNetwork.Stride,
BridgingNetwork.Sommelier,
BridgingNetwork.Canto,
BridgingNetwork.Kava,
]

export const EvmWormholeNetworks = [
Expand Down Expand Up @@ -215,6 +218,13 @@ export const tokenDenomsPerNetwork = [
],
symbols: ['canto'],
},
{
network: BridgingNetwork.Kava,
denoms: [
'ibc/57AA1A70A4BC9769C525EBF6386F7A21536E04A79D62E1981EFCEF9428EBB205',
],
symbols: ['kava'],
},
{
network: BridgingNetwork.CosmosHubTestnet,
denoms: [
Expand Down Expand Up @@ -364,6 +374,14 @@ export const cosmosNativeDenomsFromChainId = {
denom:
'ibc/D91A2C4EE7CD86BBAFCE0FA44A60DDD9AFBB7EEB5B2D46C0984DEBCC6FEDFAE8',
},
[CosmosChainId.Kava]: [
{
...tokenMetaUtils.getMetaBySymbol('KAVA'),
tokenType: TokenType.Ibc,
denom:
'ibc/57AA1A70A4BC9769C525EBF6386F7A21536E04A79D62E1981EFCEF9428EBB205',
},
],
[TestnetCosmosChainId.Cosmoshub]: {
...tokenMetaUtils.getMetaBySymbol('UPHOTON'),
tokenType: TokenType.Ibc,
Expand Down Expand Up @@ -561,6 +579,10 @@ export const getNetworkFromAddress = (sender: string): BridgingNetwork => {
return BridgingNetwork.Canto
}

if (sender.startsWith('kava')) {
return BridgingNetwork.Kava
}

if (sender.startsWith('0x')) {
return BridgingNetwork.Ethereum
}
Expand Down Expand Up @@ -626,6 +648,8 @@ export const getGasPriceForChainId = (chainId: CosmosChainId) => {
return 0.01
case CosmosChainId.Juno:
return 0.01
case CosmosChainId.Kava:
return 0.01
case CosmosChainId.Injective:
return 0.01
default:
Expand Down
36 changes: 20 additions & 16 deletions packages/token-metadata/src/ibc/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export enum CanonicalChannelToDestinationChannel {
Crescent = 'channel-90',
Sommelier = 'channel-93',
Migaloo = 'channel-102',
Kava = 'channel-143',
}

/**
Expand Down Expand Up @@ -59,24 +60,26 @@ export const canonicalChannelsToChainMapFromInjective = {
'channel-102': { chainA: 'Injective', chainB: 'Migaloo' },
'channel-104': { chainA: 'Injective', chainB: 'Terra2' },
'channel-105': { chainA: 'Injective', chainB: 'Terra2' },
'channel-143': { chainA: 'Injective', chainB: 'Kava' },
}

export const canonicalChannelsToChainMapToInjective = {
'channel-220': { chainA: 'CosmosHub', chainB: 'Injective' },
'channel-122': { chainA: 'Osmosis', chainB: 'Injective' },
'channel-17': { chainA: 'Terra', chainB: 'Injective' },
'channel-41': { chainA: 'Persistence', chainB: 'Injective' },
'channel-12': { chainA: 'Chihuahua', chainB: 'Injective' },
'channel-23': { chainA: 'Secret Network', chainB: 'Injective' },
'channel-59': { chainA: 'Juno', chainB: 'Injective' },
'channel-6': { chainA: 'Stride', chainB: 'Injective' },
'channel-90': { chainA: 'Crescent', chainB: 'Injective' },
'channel-1': { chainA: 'Sommelier', chainB: 'Injective' },
'channel-8': { chainA: 'Canto', chainB: 'Injective' },
'channel-91': { chainA: 'Terra2', chainB: 'Injective' },
'channel-92': { chainA: 'Terra2', chainB: 'Injective' },
'channel-3': { chainA: 'Migaloo', chainB: 'Injective' },
}
export const canonicalChannelsToChainMapToInjective = [
{ channelId: 'channel-220', chainA: 'CosmosHub', chainB: 'Injective' },
{ channelId: 'channel-122', chainA: 'Osmosis', chainB: 'Injective' },
{ channelId: 'channel-17', chainA: 'Terra', chainB: 'Injective' },
{ channelId: 'channel-41', chainA: 'Persistence', chainB: 'Injective' },
{ channelId: 'channel-12', chainA: 'Chihuahua', chainB: 'Injective' },
{ channelId: 'channel-23', chainA: 'Secret Network', chainB: 'Injective' },
{ channelId: 'channel-59', chainA: 'Juno', chainB: 'Injective' },
{ channelId: 'channel-6', chainA: 'Stride', chainB: 'Injective' },
{ channelId: 'channel-90', chainA: 'Crescent', chainB: 'Injective' },
{ channelId: 'channel-1', chainA: 'Sommelier', chainB: 'Injective' },
{ channelId: 'channel-8', chainA: 'Canto', chainB: 'Injective' },
{ channelId: 'channel-91', chainA: 'Terra2', chainB: 'Injective' },
{ channelId: 'channel-92', chainA: 'Terra2', chainB: 'Injective' },
{ channelId: 'channel-3', chainA: 'Migaloo', chainB: 'Injective' },
{ channelId: 'channel-122', chainA: 'Kava', chainB: 'Injective' },
]

export default legacyCanonicalChannels

Expand All @@ -101,6 +104,7 @@ export const canonicalChannelIds = [
'channel-102',
'channel-104',
'channel-105',
'channel-143',
]

export const channelIbcDenomToBaseDenomMap = {
Expand Down
Binary file added packages/token-metadata/src/images/kava.webp
Binary file not shown.
18 changes: 17 additions & 1 deletion packages/token-metadata/src/tokens/tokens/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ export default {
baseDenom: 'acanto',
path: 'transfer/channel-99',
channelId: 'channel-99',
hash: 'C733F37CB50114AFE8053C320DF45D0AAD8B94F556EB306AC2ABA0B9963CDF0D',
hash: 'D91A2C4EE7CD86BBAFCE0FA44A60DDD9AFBB7EEB5B2D46C0984DEBCC6FEDFAE8',
tokenType: TokenType.Ibc,
},
},
Expand Down Expand Up @@ -1685,4 +1685,20 @@ export default {
tokenType: TokenType.TokenFactory,
},

KAVA: {
name: 'KAVA',
symbol: 'KAVA',
decimals: 6,
logo: 'kava.webp',
coinGeckoId: 'kava',
ibc: {
decimals: 6,
isNative: true,
baseDenom: 'ukava',
path: 'transfer/channel-143',
channelId: 'channel-143',
hash: '57AA1A70A4BC9769C525EBF6386F7A21536E04A79D62E1981EFCEF9428EBB205',
tokenType: TokenType.Ibc,
},
},
} as Record<string, TokenMeta>
1 change: 1 addition & 0 deletions packages/ts-types/src/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export enum CosmosChainId {
Crescent = 'crescent-1',
Sommelier = 'sommelier-3',
Canto = 'canto_7700-1',
Kava = 'kava_2222-10',
}

export enum TestnetCosmosChainId {
Expand Down
5 changes: 5 additions & 0 deletions packages/wallet-ts/src/utils/wallets/cosmos/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ export const getEndpointsFromChainId = (
rpc: 'https://rpc.cosmos.directory/canto',
rest: 'https://rest.cosmos.directory/canto',
}
case CosmosChainId.Kava:
return {
rpc: 'https://rpc.cosmos.directory/kava',
rest: 'https://rest.cosmos.directory/kava',
}
case TestnetCosmosChainId.Cosmoshub:
return {
rpc: 'https://testnet.tm.cosmos.injective.dev',
Expand Down

0 comments on commit 04705ba

Please sign in to comment.