{"id":22834679,"url":"https://github.com/decryptu/crypto-resolver","last_synced_at":"2026-05-09T17:33:23.982Z","repository":{"id":226946980,"uuid":"770044531","full_name":"Decryptu/crypto-resolver","owner":"Decryptu","description":"A lightweight Node.js package for resolving cryptocurrency names and tickers to their CoinGecko IDs and vice versa, leveraging the CoinGecko API. Perfect for developers working with cryptocurrency data who need a reliable way to translate between different identifiers.","archived":false,"fork":false,"pushed_at":"2024-03-25T09:31:00.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T20:51:44.479Z","etag":null,"topics":["bitcoin","coingecko","coingecko-api","crypto","cryptocurrency","npm","npm-package","package"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/crypto-resolver?activeTab=readme","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Decryptu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-10T19:05:52.000Z","updated_at":"2024-03-10T19:52:14.000Z","dependencies_parsed_at":"2024-03-25T10:53:23.651Z","dependency_job_id":null,"html_url":"https://github.com/Decryptu/crypto-resolver","commit_stats":null,"previous_names":["decryptu/crypto-resolver"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decryptu%2Fcrypto-resolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decryptu%2Fcrypto-resolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decryptu%2Fcrypto-resolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Decryptu%2Fcrypto-resolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Decryptu","download_url":"https://codeload.github.com/Decryptu/crypto-resolver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246408101,"owners_count":20772228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","coingecko","coingecko-api","crypto","cryptocurrency","npm","npm-package","package"],"created_at":"2024-12-12T22:07:14.223Z","updated_at":"2026-05-09T17:33:18.950Z","avatar_url":"https://github.com/Decryptu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crypto-resolver\n\nA lightweight Node.js package for resolving cryptocurrency names and tickers to their CoinGecko IDs and vice versa, leveraging the CoinGecko API. Perfect for developers working with cryptocurrency data who need a reliable way to translate between different identifiers.\n\n## Features\n\n- **Name to ID Resolution**: Convert cryptocurrency names or tickers to their unique CoinGecko IDs.\n- **ID to Name Resolution**: Convert CoinGecko IDs back to cryptocurrency names and tickers.\n- **Initialization Check**: Ensures the resolver is properly initialized before usage, improving reliability.\n- **Error Handling**: Provides clear error messages for better debugging and user experience.\n- **Lightweight \u0026 Fast**: Minimal dependencies for quick and efficient performance.\n- **Easy to Use**: Designed with simplicity in mind for developers of all skill levels.\n\n## Installation\n\nInstall `crypto-resolver` using npm:\n\n```bash\nnpm install crypto-resolver\n```\n\nOr yarn:\n\n```bash\nyarn add crypto-resolver\n```\n\n## Usage\n\nFirst, import and initialize the `CryptoResolver` class. Ensure you call the `init` method before using any resolver functionality to fetch the latest cryptocurrency data:\n\n```javascript\nconst CryptoResolver = require('crypto-resolver');\nconst resolver = new CryptoResolver();\n\nasync function initialize() {\n  try {\n    await resolver.init();\n    console.log('Initialization successful.');\n  } catch (error) {\n    console.error('Initialization failed:', error);\n  }\n}\n\ninitialize();\n```\n\n### Resolving Name or Ticker to CoinGecko ID\n\n```javascript\nasync function resolveNameOrTicker() {\n  try {\n    const id = await resolver.resolveNameOrTickerToId('btc');\n    console.log(`The CoinGecko ID for BTC is ${id}`);\n  } catch (error) {\n    console.error('Error resolving name or ticker:', error);\n  }\n}\n\nresolveNameOrTicker();\n```\n\n### Resolving CoinGecko ID to Name and Ticker\n\n```javascript\nasync function resolveIdToNameAndTicker() {\n  try {\n    const info = await resolver.resolveIdToNameAndTicker('bitcoin');\n    console.log(`Name: ${info.name}, Ticker: ${info.ticker}`);\n  } catch (error) {\n    console.error('Error resolving ID to name and ticker:', error);\n  }\n}\n\nresolveIdToNameAndTicker();\n```\n\n## Example Code\n\nBelow are some \"real-life\" examples of what you can achieve with `crypto-resolver`:\n\n### Display Multiple Cryptocurrencies Info\n\nRetrieve and display information for multiple cryptocurrencies by name or ticker:\n\n```javascript\nconst CryptoResolver = require('crypto-resolver');\nconst resolver = new CryptoResolver();\n\nasync function displayCryptoInfo(names) {\n  await resolver.init();\n  for (const name of names) {\n    const id = await resolver.resolveNameOrTickerToId(name);\n    if (id) {\n      const info = await resolver.resolveIdToNameAndTicker(id);\n      console.log(`${info.name} (${info.ticker}): CoinGecko ID = ${id}`);\n    } else {\n      console.log(`No CoinGecko ID found for \"${name}\".`);\n    }\n  }\n}\n\ndisplayCryptoInfo(['btc', 'eth', 'invalidCrypto']);\n```\n\n### Handling Errors Gracefully\n\nDemonstrate handling a common error – using the resolver without initialization:\n\n```javascript\nconst CryptoResolver = require('crypto-resolver');\nconst uninitResolver = new CryptoResolver();\n\nasync function attemptResolveWithoutInit() {\n  try {\n    const id = await uninitResolver.resolveNameOrTickerToId('btc');\n    console.log(`CoinGecko ID for BTC: ${id}`);\n  } catch (error) {\n    console.error('Caught error:', error.message);\n  }\n}\n\nattemptResolveWithoutInit();\n```\n\nThis script shows how `crypto-resolver` throws an error when trying to resolve a cryptocurrency name or ticker without first calling `init()`, and how to catch and handle that error.\n\n## Error Handling\n\nThe `crypto-resolver` package throws errors if it's not properly initialized or if an issue occurs during the initialization process. Ensure you handle these errors in your application to maintain stability and provide feedback to your users.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a pull request or open an issue on GitHub if you have any suggestions, improvements, or bug reports.\n\n## License\n\nThis project is licensed under the ISC License - see the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecryptu%2Fcrypto-resolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdecryptu%2Fcrypto-resolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecryptu%2Fcrypto-resolver/lists"}