Skip to content

Commit

Permalink
Merge pull request #256 from InjectiveLabs/chore/celestia-bridge
Browse files Browse the repository at this point in the history
chore: celestia bridge
  • Loading branch information
bangjelkoski authored Oct 31, 2023
2 parents c47a9ce + 1943080 commit ed2db98
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/sdk-ui-ts/src/types/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export enum BridgingNetwork {
Kava = 'kava',
Oraichain = 'oraichain',
Noble = 'noble',
Celestia = 'celestia',
}

export const MintScanExplorerUrl = {
Expand All @@ -48,6 +49,7 @@ export const MintScanExplorerUrl = {
[BridgingNetwork.Canto]: 'canto',
[BridgingNetwork.Kava]: 'kava',
[BridgingNetwork.Noble]: 'noble',
[BridgingNetwork.Celestia]: 'celestia',
} as Record<BridgingNetwork, string>

export enum BridgeTransactionState {
Expand Down
21 changes: 21 additions & 0 deletions packages/sdk-ui-ts/src/utils/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const KeplrNetworks = [
BridgingNetwork.Kava,
BridgingNetwork.Oraichain,
BridgingNetwork.Noble,
BridgingNetwork.Celestia,
]

export const LeapNetworks = [
Expand All @@ -63,6 +64,7 @@ export const LeapNetworks = [
BridgingNetwork.Canto,
BridgingNetwork.Kava,
BridgingNetwork.Noble,
BridgingNetwork.Celestia,
]

export const CosmostationNetworks = [
Expand All @@ -80,6 +82,7 @@ export const CosmostationNetworks = [
BridgingNetwork.Canto,
BridgingNetwork.Kava,
BridgingNetwork.Noble,
BridgingNetwork.Celestia,
]

export const CosmosNetworks = [
Expand All @@ -98,6 +101,7 @@ export const CosmosNetworks = [
BridgingNetwork.Kava,
BridgingNetwork.Oraichain,
BridgingNetwork.Noble,
BridgingNetwork.Celestia,
]

export const EvmWormholeNetworks = [
Expand Down Expand Up @@ -275,6 +279,13 @@ export const tokenDenomsPerNetwork = [
],
symbols: ['usdcnb'],
},
{
network: BridgingNetwork.Celestia,
denoms: [
'ibc/F51BB221BAA275F2EBF654F70B005627D7E713AFFD6D86AFD1E43CAA886149F4',
],
symbols: ['utia'],
},
] as NetworkConfig[]

export const cosmosChainTokenMetaMap = {
Expand Down Expand Up @@ -450,6 +461,12 @@ export const cosmosChainTokenMetaMap = {
denom:
'ibc/2CBC2EA121AE42563B08028466F37B600F2D7D4282342DE938283CC3FB2BC00E',
},
[CosmosChainId.Celestia]: {
...tokenMetaUtils.getMetaBySymbol('TIA'),
tokenType: TokenType.Ibc,
denom:
'ibc/F51BB221BAA275F2EBF654F70B005627D7E713AFFD6D86AFD1E43CAA886149F4',
},
} as Record<string, Token | Token[]>

export const ibcHashToNativeInjPerNetwork = {
Expand Down Expand Up @@ -656,6 +673,10 @@ export const getNetworkFromAddress = (sender: string): BridgingNetwork => {
return BridgingNetwork.Noble
}

if (sender.startsWith('celestia')) {
return BridgingNetwork.Celestia
}

return BridgingNetwork.CosmosHub
}

Expand Down
4 changes: 4 additions & 0 deletions packages/token-metadata/src/ibc/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export enum CanonicalChannelToDestinationChannel {
Kava = 'channel-143',
Oraichain = 'channel-147',
Noble = 'channel-148',
Celestia = 'channel-152',
}

/**
Expand Down Expand Up @@ -86,6 +87,7 @@ export const canonicalChannelsToChainList = [
{ channelId: 'channel-122', chainA: 'Kava', chainB: 'Injective' },
{ channelId: 'channel-146', chainA: 'Oraichain', chainB: 'Injective' },
{ channelId: 'channel-31', chainA: 'Noble', chainB: 'Injective' },
{ channelId: 'channel-1', chainA: 'Celestia', chainB: 'Injective' },
{ channelId: 'channel-1', chainA: 'Injective', chainB: 'CosmosHub' },
{ channelId: 'channel-83', chainA: 'Injective', chainB: 'Evmos' },
{ channelId: 'channel-8', chainA: 'Injective', chainB: 'Osmosis' },
Expand All @@ -106,6 +108,7 @@ export const canonicalChannelsToChainList = [
{ channelId: 'channel-143', chainA: 'Injective', chainB: 'Kava' },
{ channelId: 'channel-147', chainA: 'Injective', chainB: 'Oraichain' },
{ channelId: 'channel-148', chainA: 'Injective', chainB: 'Noble' },
{ channelId: 'channel-152', chainA: 'Injective', chainB: 'Celestia' },
]

export default legacyCanonicalChannels
Expand Down Expand Up @@ -134,6 +137,7 @@ export const canonicalChannelIds = [
'channel-143',
'channel-147',
'channel-148',
'channel-152',
]

export const channelIbcDenomToBaseDenomMap = {
Expand Down
10 changes: 10 additions & 0 deletions packages/token-metadata/src/tokens/tokens/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1852,6 +1852,16 @@ export default {
decimals: 6,
logo: 'tia.webp',
coinGeckoId: '',

ibc: {
decimals: 6,
isNative: true,
baseDenom: 'utia',
path: 'transfer/channel-152',
channelId: 'channel-152',
hash: 'F51BB221BAA275F2EBF654F70B005627D7E713AFFD6D86AFD1E43CAA886149F4',
tokenType: TokenType.Ibc,
},
},

TALIS: {
Expand Down
1 change: 1 addition & 0 deletions packages/ts-types/src/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export enum CosmosChainId {
Kava = 'kava_2222-10',
Oraichain = 'Oraichain',
Noble = 'noble-1',
Celestia = 'celestia',
}

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 @@ -116,6 +116,11 @@ export const getEndpointsFromChainId = (
rpc: 'https://rpc.cosmos.directory/noble',
rest: 'https://rest.cosmos.directory/noble',
}
case CosmosChainId.Celestia:
return {
rpc: 'https://rpc.cosmos.directory/celestia',
rest: 'https://rest.cosmos.directory/celestia',
}
default:
throw new GeneralException(
new Error(`Endpoints for ${chainId} not found`),
Expand Down

0 comments on commit ed2db98

Please sign in to comment.