@robertprp/intents-sdk
Version:
Shogun Network Intent-based cross-chain swaps SDK
62 lines • 1.93 kB
JavaScript
/**
* Represents the blockchain platform type
* Used to distinguish between different blockchain ecosystems
*/
export var ChainType;
(function (ChainType) {
ChainType["EVM"] = "EVM";
ChainType["Solana"] = "Solana";
ChainType["Sui"] = "Sui";
})(ChainType || (ChainType = {}));
/**
* Enum of chain IDs for supported blockchains
* EVM chains use their standard chain IDs
* Non-EVM chains use custom assigned IDs
*/
export var ChainID;
(function (ChainID) {
ChainID[ChainID["Arbitrum"] = 42161] = "Arbitrum";
ChainID[ChainID["Optimism"] = 10] = "Optimism";
ChainID[ChainID["Base"] = 8453] = "Base";
ChainID[ChainID["Hyperliquid"] = 999] = "Hyperliquid";
ChainID[ChainID["Solana"] = 7565164] = "Solana";
ChainID[ChainID["Sui"] = 101] = "Sui";
})(ChainID || (ChainID = {}));
/**
* Array of chain IDs that are supported by the SDK
* Used as a source of truth for type generation
*/
export const SupportedChains = [
ChainID.Arbitrum,
ChainID.Base,
ChainID.Optimism,
ChainID.Hyperliquid,
ChainID.Solana,
ChainID.Sui,
];
export function isEvmChain(chainId) {
return chainId !== 7565164 && chainId !== 101;
}
/**
* Type guard that checks if a chain ID is among the supported chains
* @param chain - The chain ID to check
* @returns Boolean indicating if the chain is supported
*/
export const isSupportedChain = (chain) => {
if (typeof chain !== 'number')
return false;
return SupportedChains.includes(chain);
};
/**
* Maps chain IDs to their corresponding chain types
* Used to determine which SDK implementation to use for a given chain
*/
export const chainIdToChainTypeMap = {
[ChainID.Arbitrum]: ChainType.EVM,
[ChainID.Base]: ChainType.EVM,
[ChainID.Optimism]: ChainType.EVM,
[ChainID.Hyperliquid]: ChainType.EVM,
[ChainID.Solana]: ChainType.Solana,
[ChainID.Sui]: ChainType.Sui,
};
//# sourceMappingURL=chains.js.map