Update to SDK 1.4.1 (#32)
- Update SDK, token, and widgets to 1.4.1 - Use SDK values for Solana chains - Change format of Solana CAIP2 IDs to use numbers - Fix bug with tx prep for Zebec chainpull/36/head
parent
f4e82cd014
commit
46a5493e5a
@ -1,100 +0,0 @@ |
||||
import type { Cluster } from '@solana/web3.js'; |
||||
|
||||
import { ChainMap, ExplorerFamily } from '@hyperlane-xyz/sdk'; |
||||
|
||||
import { CustomChainMetadata } from '../features/chains/types'; |
||||
|
||||
// TODO move to SDK
|
||||
export const solanaChains: ChainMap<CustomChainMetadata> = { |
||||
solanamainnet: { |
||||
protocol: 'sealevel', |
||||
chainId: 1399811149, // https://www.alchemy.com/chain-connect/chain/solana
|
||||
domainId: 1399811149, |
||||
name: 'solanamainnet', |
||||
displayName: 'Solana', |
||||
nativeToken: { name: 'Sol', symbol: 'SOL', decimals: 9 }, |
||||
publicRpcUrls: [{ http: 'https://api.mainnet-beta.solana.com' }], |
||||
blockExplorers: [ |
||||
{ |
||||
name: 'SolScan', |
||||
url: 'https://solscan.io', |
||||
apiUrl: 'https://public-api.solscan.io', |
||||
family: ExplorerFamily.Other, |
||||
}, |
||||
], |
||||
blocks: { |
||||
confirmations: 1, |
||||
reorgPeriod: 1, |
||||
estimateBlockTime: 1, |
||||
}, |
||||
mailbox: 'TODO', |
||||
logoURI: '/logos/solana.svg', |
||||
}, |
||||
solanatestnet: { |
||||
protocol: 'sealevel', |
||||
chainId: 13998111450, |
||||
domainId: 13998111450, |
||||
name: 'solanatestnet', |
||||
displayName: 'Sol Testnet', |
||||
nativeToken: { name: 'Sol', symbol: 'SOL', decimals: 9 }, |
||||
publicRpcUrls: [{ http: 'https://api.testnet.solana.com' }], |
||||
blockExplorers: [], |
||||
blocks: { |
||||
confirmations: 1, |
||||
reorgPeriod: 1, |
||||
estimateBlockTime: 1, |
||||
}, |
||||
mailbox: 'TODO', |
||||
logoURI: '/logos/solana.svg', |
||||
}, |
||||
solanadevnet: { |
||||
protocol: 'sealevel', |
||||
chainId: 1399811151, |
||||
domainId: 1399811151, |
||||
name: 'solanadevnet', |
||||
displayName: 'Sol Devnet', |
||||
nativeToken: { name: 'Sol', symbol: 'SOL', decimals: 9 }, |
||||
publicRpcUrls: [{ http: 'https://api.devnet.solana.com' }], |
||||
blockExplorers: [], |
||||
blocks: { |
||||
confirmations: 1, |
||||
reorgPeriod: 1, |
||||
estimateBlockTime: 1, |
||||
}, |
||||
mailbox: '4v25Dz9RccqUrTzmfHzJMsjd1iVoNrWzeJ4o6GYuJrVn', |
||||
logoURI: '/logos/solana.svg', |
||||
}, |
||||
zbctestnet: { |
||||
protocol: 'sealevel', |
||||
chainId: 2053254516, |
||||
domainId: 2053254516, |
||||
name: 'zbctestnet', |
||||
displayName: 'Zbc Testnet', |
||||
nativeToken: { name: 'Sol', symbol: 'SOL', decimals: 9 }, |
||||
publicRpcUrls: [{ http: 'https://api.zebec.eclipsenetwork.xyz:8899' }], |
||||
blockExplorers: [], |
||||
blocks: { |
||||
confirmations: 1, |
||||
reorgPeriod: 1, |
||||
estimateBlockTime: 1, |
||||
}, |
||||
mailbox: '4hW22NXtJ2AXrEVbeAmxjhvxWPSNvfTfAphKXdRBZUco', |
||||
logoURI: '/logos/zebec.png', |
||||
}, |
||||
}; |
||||
|
||||
// For general use in UI
|
||||
export function getSolanaChainName(rpcEndpoint: string) { |
||||
if (!rpcEndpoint) return {}; |
||||
if (rpcEndpoint?.includes('devnet')) return { name: 'solanadevnet', displayName: 'Sol Devnet' }; |
||||
if (rpcEndpoint?.includes('testnet')) |
||||
return { name: 'solanatestnet', displayName: 'Sol Testnet' }; |
||||
return { name: 'solanamainnet', displayName: 'Solana' }; |
||||
} |
||||
|
||||
// For use in when interacting with solana/web3.js Connection class
|
||||
export function getSolanaClusterName(chainName: string): Cluster { |
||||
if (chainName?.includes('devnet')) return 'devnet'; |
||||
if (chainName?.includes('testnet')) return 'testnet'; |
||||
return 'mainnet-beta'; |
||||
} |
@ -1,32 +0,0 @@ |
||||
import { z } from 'zod'; |
||||
|
||||
import { ChainMetadata, ChainMetadataSchema } from '@hyperlane-xyz/sdk'; |
||||
|
||||
export enum ProtocolType { |
||||
Ethereum = 'ethereum', |
||||
Sealevel = 'sealevel', |
||||
} |
||||
|
||||
export const ProtocolSmallestUnit = { |
||||
[ProtocolType.Ethereum]: 'wei', |
||||
[ProtocolType.Sealevel]: 'lamports', |
||||
}; |
||||
|
||||
export const ChainMetadataExtensionSchema = z.object({ |
||||
// Extended chain metadata for multi-env support
|
||||
// TODO move to SDK (see https://github.com/hyperlane-xyz/hyperlane-monorepo/pull/2203)
|
||||
protocol: z.nativeEnum(ProtocolType).optional(), |
||||
mailbox: z.string().nonempty().optional(), |
||||
interchainGasPaymaster: z.string().nonempty().optional(), |
||||
validatorAnnounce: z.string().nonempty().optional(), |
||||
// Additional extensions for use just in UI here
|
||||
logoURI: z.string().nonempty().optional(), |
||||
}); |
||||
|
||||
export type CustomChainMetadata = ChainMetadata & |
||||
Omit<z.infer<typeof ChainMetadataExtensionSchema>, 'protocol'> & { |
||||
// Loosen loose protocol type to allow literal strings
|
||||
protocol?: `${ProtocolType}`; |
||||
}; |
||||
|
||||
export const ChainConfigSchema = z.record(ChainMetadataSchema.merge(ChainMetadataExtensionSchema)); |
Before Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in new issue