{"id":13455323,"url":"https://github.com/lndgalante/solutils","last_synced_at":"2025-06-29T03:02:25.984Z","repository":{"id":62160098,"uuid":"555537203","full_name":"lndgalante/solutils","owner":"lndgalante","description":"React Hooks and Helpers for Solana","archived":false,"fork":false,"pushed_at":"2024-01-10T08:21:40.000Z","size":1771,"stargazers_count":31,"open_issues_count":44,"forks_count":4,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-02T17:18:10.238Z","etag":null,"topics":["dapp","hooks","react","solana","solutils","typescript","web3"],"latest_commit_sha":null,"homepage":"https://solutils.vercel.app/","language":"TypeScript","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/lndgalante.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}},"created_at":"2022-10-21T19:31:24.000Z","updated_at":"2024-10-01T03:49:12.000Z","dependencies_parsed_at":"2024-01-13T17:47:03.377Z","dependency_job_id":"d15569f4-85ed-44cd-8f01-aea179e2cac8","html_url":"https://github.com/lndgalante/solutils","commit_stats":{"total_commits":137,"total_committers":3,"mean_commits":"45.666666666666664","dds":"0.021897810218978075","last_synced_commit":"55e3fc94a1a31aac43063f3d2f879aa29c55df0a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lndgalante%2Fsolutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lndgalante%2Fsolutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lndgalante%2Fsolutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lndgalante%2Fsolutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lndgalante","download_url":"https://codeload.github.com/lndgalante/solutils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221947521,"owners_count":16906135,"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":["dapp","hooks","react","solana","solutils","typescript","web3"],"created_at":"2024-07-31T08:01:03.928Z","updated_at":"2025-03-24T08:32:05.085Z","avatar_url":"https://github.com/lndgalante.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n   \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/lndgalante/solutils/main/docs/solutils-light.svg\"\u003e\n    \u003cimg alt=\"solutils logo\" src=\"https://raw.githubusercontent.com/lndgalante/solutils/main/docs/solutils-dark.svg\" width=\"auto\" height=\"90\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  React Hooks and Helpers for Solana\n\u003cp\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@lndgalante/solutils\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@lndgalante/solutils?colorA=21262d\u0026colorB=161b22\u0026style=flat\" alt=\"Version\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@lndgalante/solutils\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/@lndgalante/solutils?colorA=21262d\u0026colorB=161b22\u0026style=flat\" alt=\"Downloads per month\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n### Documentation\n\nFor full documentation and examples, visit [solutils.vercel.app](https://solutils.vercel.app).\n\n### Installation\n\nInstall solutils and its @solana peer dependencies.\n\n```bash\nnpm install @lndgalante/solutils @solana/web3.js@1 @solana/spl-token @solana/wallet-adapter-react\n```\n\n### Quick Start\n\nSend USDC tokens in under a minute\n\n```tsx\nimport { useTransferTokens } from '@lndgalante/solutils';\nimport { useConnection, useWallet } from '@solana/wallet-adapter-react';\nimport { WalletMultiButton, WalletDisconnectButton } from '@solana/wallet-adapter-react-ui';\n\nexport default function Home() {\n  // solana hooks\n  const { connection } = useConnection();\n  const { publicKey, sendTransaction } = useWallet();\n\n  // solutils hooks\n  const { getTransferTokensReceipt, result, status, error } = useTransferTokens(publicKey, connection, sendTransaction);\n\n  // handlers\n  function handleTransferUsdcTokens() {\n    getTransferTokensReceipt('5NSJUuR9Pn1yiFYGPWonqrVh72xxX8D2yADKrUf1USRc', 'USDC', 1);\n  }\n\n  return (\n    \u003cdiv\u003e\n      \u003cWalletMultiButton /\u003e\n      \u003cWalletDisconnectButton /\u003e\n\n      \u003cmain\u003e\n        \u003cbutton onClick={handleTransferUsdcTokens}\u003eSend {AMOUNT_TO_SEND} USDC tokens\u003c/button\u003e\n        {status === 'iddle' ? \u003cp\u003eHaven\u0026apos;t sent any USDC yet\u003c/p\u003e : null}\n        {status === 'loading' ? \u003cp\u003eSending your USDC tokens\u003c/p\u003e : null}\n        {status === 'success' \u0026\u0026 result ? (\n          \u003cdiv\u003e\n            \u003cp\u003eWe successfully sent: {USDC_TO_SEND} USDC\u003c/p\u003e\n            \u003cp\u003eTransaction signature: {result.transactionSignature}\u003c/p\u003e\n            \u003ca href={result.urls.solanaExplorerUrl} target='_blank' rel='noreferrer'\u003e\n              Solana Explorer\n            \u003c/a\u003e\n          \u003c/div\u003e\n        ) : null}\n        {status === 'error' ? \u003cp\u003e{error}\u003c/p\u003e : null}\n      \u003c/main\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\nIn this example we import `useConnection` and `useWallet` which we usually need for solutils hooks to send wallet `publicKey` and wallet `connection` object.\nParticulary here we also need the `sendTransaction` function from `useWallet` to internally send that transaction.\n\n`useTransferTokens` returns many things but the most important thing here is `getTransferTokensReceipt` which takes a address recipient, a token symbol or address, and an amount to send to that address.\n\n`useTransferTokens` also will return `result` object with the result if it the transfer is succesful, a `status` that could be `iddle`, `loading`, `success` or `error`, and finally an `error` which is a string with the error to display on screen.\n\nAnd that's pretty much it, we render a UI to trigger our `handleTransferUsdcTokens` function, and depending on our `status` states we will display different messages.\n\nMost of the hooks works this way, so learn once and then repeat same pattern with the other hooks.\n\n---\n\n### Security\n\nConcerned about using a third-party library due to sensible code? We're working on making a fully tested, and secure library, but in case you or your company don't want to use this directly feel free to fork it, modify it and send any PR to improve it later on.\n\n---\n\n### Authors\n\nThanks to Alejandro [@afreitezzz](https://twitter.com/afreitezzz) for creating the logo!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flndgalante%2Fsolutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flndgalante%2Fsolutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flndgalante%2Fsolutils/lists"}