{"id":15061432,"url":"https://github.com/derricklee918/sol-idl-fetcher","last_synced_at":"2025-04-14T10:35:41.750Z","repository":{"id":257349297,"uuid":"857994465","full_name":"derricklee918/Sol-IDL-fetcher","owner":"derricklee918","description":"Retrieves the IDL for a Solana program using Anchor. This includes an example with the pump.fun program's IDL.","archived":false,"fork":false,"pushed_at":"2024-09-16T05:58:10.000Z","size":8322,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T23:51:04.432Z","etag":null,"topics":["pumpfun","solana","solana-program","spltoken"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/derricklee918.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-09-16T05:33:07.000Z","updated_at":"2025-01-25T17:53:49.000Z","dependencies_parsed_at":"2024-09-16T08:52:24.550Z","dependency_job_id":null,"html_url":"https://github.com/derricklee918/Sol-IDL-fetcher","commit_stats":null,"previous_names":["derricklee918/sol-idl-fetcher"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derricklee918%2FSol-IDL-fetcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derricklee918%2FSol-IDL-fetcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derricklee918%2FSol-IDL-fetcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derricklee918%2FSol-IDL-fetcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derricklee918","download_url":"https://codeload.github.com/derricklee918/Sol-IDL-fetcher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248863572,"owners_count":21174030,"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":["pumpfun","solana","solana-program","spltoken"],"created_at":"2024-09-24T23:19:30.649Z","updated_at":"2025-04-14T10:35:41.728Z","avatar_url":"https://github.com/derricklee918.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solana IDL Fetcher\n\nThis repository provides tools and scripts for fetching the Interface Definition Language (IDL) of deployed programs on the Solana blockchain using the `@project-serum/anchor` library. This project is set up using TypeScript and includes essential modules to facilitate IDL fetching and management.\n\nServices are for hire, contact me at \nhttps://t.me/@dwlee918\n\n## Example\nIn this example you can see me run the script for the pump.fun program and the marinade finance program\n\n\nhttps://github.com/user-attachments/assets/6eae475b-2d8f-46c2-ba7f-714a37882647\n\n## Features\n\n- Fetch IDL of deployed programs on the Solana blockchain.\n- Saves the IDL to a json file for further usage or storage\n- Easy integration into existing projects.\n\n## Prerequisites\n\nEnsure you have the following installed:\n\n- [Node.js](https://nodejs.org/) (version 14 or later)\n- [npm](https://www.npmjs.com/)\n- [TypeScript](https://www.typescriptlang.org/)\n\n## Installation\n\nTo install the package, clone the repository and install the dependencies:\n\n```bash\ngit clone https://github.com/derricklee918/Sol-IDL-fetcher.git\ncd Sol-IDL-fetcher\nnpm install\n```\n\n## Usage\n\nTo compile and run the scripts:\n\n1. Configure your environment variables as instructed.\n2. Compile the TypeScript files:\n\n```bash\nnpx tsc\n```\n\n3. Run the compiled JavaScript file:\n\n```bash\nnode example.js\n```\n\n## Important Note\n\nIn order to use the `fetchIdl` method, an IDL must have been previously initialized via the Anchor CLI's `anchor idl init` command. For example, the `pump.fun` program with the ID `6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P` will not work on mainnet-beta, but if you try it on devnet it will actually return the valid program IDL.\n\n```typescript\n/**\n * Fetches an idl from the blockchain.\n *\n * In order to use this method, an IDL must have been previously initialized\n * via the anchor CLI's `anchor idl init` command.\n *\n * @param programId The on-chain address of the program.\n * @param provider  The network and wallet context.\n */\npublic static async fetchIdl\u003cIDL extends Idl = Idl\u003e(\n  address: Address,\n  provider?: Provider\n): Promise\u003cIDL | null\u003e {\n  provider = provider ?? getProvider();\n  const programId = translateAddress(address);\n\n  const idlAddr = await idlAddress(programId);\n  const accountInfo = await provider.connection.getAccountInfo(idlAddr);\n  if (!accountInfo) {\n    return null;\n  }\n  // Chop off account discriminator.\n  let idlAccount = decodeIdlAccount(accountInfo.data.slice(8));\n  const inflatedIdl = inflate(idlAccount.data);\n  return JSON.parse(utf8.decode(inflatedIdl));\n}\n```\n\n## Project Structure\n\n- `example.ts`: Main code file\n- `package.json`: Project metadata and dependencies.\n- `tsconfig.json`: TypeScript configuration file.\n\n\n## Contributing\n\nContributions are welcome! Please fork the repository and submit a pull request with your improvements.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/YourFeature`)\n3. Commit your changes (`git commit -m 'Add some feature'`)\n4. Push to the branch (`git push origin feature/YourFeature`)\n5. Open a pull request\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderricklee918%2Fsol-idl-fetcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderricklee918%2Fsol-idl-fetcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderricklee918%2Fsol-idl-fetcher/lists"}