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

chore: celestia bridge #256

Merged
merged 2 commits into from
Oct 31, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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