{"id":14968466,"url":"https://github.com/SolanaNameService/sns-sdk","last_synced_at":"2025-12-29T23:55:53.335Z","repository":{"id":160756787,"uuid":"608108744","full_name":"Bonfida/sns-sdk","owner":"Bonfida","description":"Solana Name Service SDKs monorepo","archived":false,"fork":false,"pushed_at":"2025-03-31T11:21:13.000Z","size":2092,"stargazers_count":44,"open_issues_count":9,"forks_count":31,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-04T03:07:50.899Z","etag":null,"topics":["python","react","rust","solana","typescript","web3","web3-domains"],"latest_commit_sha":null,"homepage":"https://sns.id/","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/Bonfida.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":"2023-03-01T10:40:16.000Z","updated_at":"2025-03-16T15:05:32.000Z","dependencies_parsed_at":"2024-01-16T07:13:29.406Z","dependency_job_id":"e0381191-208f-4fa6-b09b-e7e82884f4e7","html_url":"https://github.com/Bonfida/sns-sdk","commit_stats":{"total_commits":363,"total_committers":10,"mean_commits":36.3,"dds":0.1900826446280992,"last_synced_commit":"7927659b64ea7c7a1fb6a9ded618990ef727b244"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bonfida%2Fsns-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bonfida%2Fsns-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bonfida%2Fsns-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bonfida%2Fsns-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bonfida","download_url":"https://codeload.github.com/Bonfida/sns-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248639130,"owners_count":21137782,"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":["python","react","rust","solana","typescript","web3","web3-domains"],"created_at":"2024-09-24T13:39:58.467Z","updated_at":"2025-12-29T23:55:53.273Z","avatar_url":"https://github.com/Bonfida.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eSNS SDK\u003c/h1\u003e\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"250\" src=\"https://i.imgur.com/nn7LMNV.png\"/\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://twitter.com/bonfida\"\u003e\n\u003cimg src=\"https://img.shields.io/twitter/url?label=Bonfida\u0026style=social\u0026url=https%3A%2F%2Ftwitter.com%2Fbonfida\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr /\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cstrong\u003e\nSNS SDK monorepo\n\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge\u0026logo=typescript\u0026logoColor=white\" /\u003e\n\u003cimg src=\"https://img.shields.io/badge/Rust-000000?style=for-the-badge\u0026logo=rust\u0026logoColor=white\" /\u003e\n\u003cimg src=\"https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge\u0026logo=react\u0026logoColor=%2361DAFB\" /\u003e\n\u003cimg src=\"https://img.shields.io/badge/Cloudflare-F38020?style=for-the-badge\u0026logo=Cloudflare\u0026logoColor=white\" /\u003e\n\u003cimg src=\"https://img.shields.io/badge/python-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54\" /\u003e\n\u003cimg src=\"https://img.shields.io/badge/java-%23ED8B00.svg?style=for-the-badge\u0026logo=java\u0026logoColor=white\" /\u003e\n\u003cimg src=\"https://img.shields.io/badge/swift-F54A2A?style=for-the-badge\u0026logo=swift\u0026logoColor=white\" /\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\u003ch3 align=\"center\"\u003e\n🚧 This repository is in active development and is subject to changes 🚧\n\u003c/h3\u003e\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\u003ch2 align=\"center\"\u003eTable of contents\u003c/h2\u003e\n\u003cbr /\u003e\n\n1. [SNS documentation](#sns-documentation)\n2. [Javascript](#javascript)\n3. [Rust](#rust)\n4. [SDK Proxy](#sdk-proxy)\n5. [Python](#python)\n6. [Java](#java)\n7. [Swift](#swift)\n8. [CLI](#cli)\n9. [React](#react)\n10. [Vue](#vue)\n11. [Examples](#examples)\n\n- Resolving a domain\n\n12. [Bounties](#bounties)\n\n\u003cbr /\u003e\n\u003ca name=\"sns-documentation\"\u003e\u003c/a\u003e\n\u003ch2 align=\"center\"\u003eSNS documentation\u003c/h2\u003e\n\u003cbr /\u003e\n\nThis repository contains the Developer documentation specifically for the SNS SDK. You can find the general SNS documentation at [sns.guide](https://sns.guide/)\n\n\u003cbr /\u003e\n\u003ca name=\"javascript\"\u003e\u003c/a\u003e\n\u003ch2 align=\"center\"\u003eJavascript\u003c/h2\u003e\n\u003cbr /\u003e\n\n```\nyarn add @bonfida/spl-name-service\n```\n\n```\nnpm i @bonfida/spl-name-service\n```\n\nThe JS SDK is the most complete SDK, it contains all the utils methods to interact with domain names as well as instruction builders to register domain names.\n\n\u003cbr /\u003e\n\u003ca name=\"rust\"\u003e\u003c/a\u003e\n\u003ch2 align=\"center\"\u003eRust\u003c/h2\u003e\n\u003cbr /\u003e\n\nThe Rust SDK provides everything you need for resolving domain ownership and records within the Solana Name Service (SNS)\n\n- `resolve_owner`: Resolves the owner of a given domain\n- `resolve_record`: Resolves a specific record of a given domain\n- `resolve_name_registry`: Resolves the name registry of a given public key\n- `resolve_name_registry_batch`: Resolves the name registry of a given list of public keys\n- `resolve_reverse`: Resolves the reverse record of a given public key\n- `resolve_reverse_batch`: Resolves the reverse records for a given list of public keys\n- `get_domains_owner`: Retrieves all domains owned by a given public key\n- `get_subdomains`: Retrieves all subdomains of a given parent domain\n- `resolve_nft_owner`: Resolves the NFT owner of a given domain key\n- `get_domain_key`: Takes a domain string and a boolean indicating whether it is a record. It returns the public key for the given domain, or an error if the domain is invalid\n- `get_reverse_key`: Takes a domain string and returns the public key for the reverse lookup account of the domain, or an error if the domain is invalid\n- `get_domain_mint`: Takes a domain key and returns the corresponding domain NFT mint's public key\n\nThe functions in this code are available in both blocking and non-blocking (asynchronous) versions. To use the blocking version one must enable the `blocking` feature.\n\n\u003cbr /\u003e\n\u003ca name=\"sdk-proxy\"\u003e\u003c/a\u003e\n\u003ch2 align=\"center\"\u003eSDK Proxy\u003c/h2\u003e\n\u003cbr /\u003e\n\nThe SDK proxy is a Cloudflare worker that proxies the JS SDK via REST calls. It's meant to be used if you are programming in a language that is not supported. It currently supports the following endpoints:\n\n- `GET /resolve/:domain`: Resolves the current owner of `domain`\n- `GET /domain-key/:domain`: Returns the public key of the `domain` account\n- `GET /domains/:owner`: Returns the list of domains (public keys) owned by `owner`\n- `GET /reverse-key/:domain` Returns the key of the reverse account of `domain`\n- `GET /record-key/:domain/:record`: Returns the public key of the `record` of `domain`\n- `GET /record/:domain/:record`: Returns the content of the `record` of `domain`. The result is a base64 encoded buffer.\n- `GET /favorite-domain/:owner`: Returns the favorite domain of `owner`. If `owner` has not set up a favorite domain it returns `null`\n- `GET /types/record`: Returns the list of supported records\n- `GET /reverse-lookup/:pubkey`: Returns the reverse lookup of `pubkey`\n- `GET /subdomains/:parent`: Returns all the subdomains of `parent`\n- `GET /register?buyer={buyer}\u0026domain={domain}\u0026space={space}\u0026serialize={serialize}`: This endpoint can be used to register `domain` for `buyer`. Additionally, the `buyer` dans specify the `space` it wants to allocate for the `domain` account. In the case where `serialize` is `true` the endpoint will return the transaction serialized in the wire format base64 encoded. Otherwise it will return the instruction in the following format: `{ programId: string, keys: {isWritable: boolean, isSigner: boolean, pubkey: string}[], data: string }` where data is base64 encoded. This endpoint also supports the optional `mint` parameter to change the mint of the token used for registration (currently supports USDC, USDT, FIDA and wSOL), if `mint` is omitted it defaults to USDC.\n- `GET /twitter/get-handle-by-key/:key`: This endpoint can be used to fetch the Twitter handle of a given public key\n- `GET /twitter/get-key-by-handle/:handle`: This endpoint can be used to fetch the public key of a given Twitter handle\n- `GET /multiple-favorite-domains/:owners`: Returns the favorite domains for a list of owners that are comma separated\n- `GET /record-v2/:domain/:record`: Returns the content of the `record` (v2) of `domain`. The result is made of the deserialized value, staleness boolean (`stale`), right of association (`roa`) if applicable, and the record object made of its`header` and `data` (base64 encoded).\n\nNOTE: All endpoints capable of performing RPC calls currently support an optional `rpc` query parameter for specifying a custom RPC URL. In the future, this parameter will become mandatory, and the Cloudflare worker will exclusively proxy calls to a specified custom RPC URL.\n\nThe SDK proxy is deployed at: https://sns-sdk-proxy.bonfida.workers.dev/\n\n\u003cbr /\u003e\n\u003ca name=\"cli\"\u003e\u003c/a\u003e\n\u003ch2 align=\"center\"\u003eCLI\u003c/h2\u003e\n\u003cbr /\u003e\n\nThe CLI can be installed with:\n\n```\ncargo install sns-cli\n```\n\nThe CLI has the following commands:\n\n- `sns resolve \u003cdomains\u003e`\n- `sns domains \u003cowners\u003e`\n- `sns burn \u003cdomains\u003e \u003ckeypair_path\u003e`\n- `sns transfer \u003ckeypair_path\u003e \u003cnew_owner_key\u003e \u003cdomains\u003e`\n- `sns lookup \u003cdomains\u003e`\n- `sns reverse-lookup \u003ckey\u003e`\n- `sns bridge \u003ctarget_chain\u003e \u003cdomain\u003e \u003ckeypair_path\u003e`\n- `sns register \u003ckeypair_path\u003e \u003cspace\u003e \u003cdomains\u003e`\n\nFor instance\n\n```\n$ sns resolve bonfida solana.sol coinbase\n\n+------------+----------------------------------------------+----------------------------------------------------------------------------------+\n| Domain     | Owner                                        | Explorer                                                                         |\n+------------+----------------------------------------------+----------------------------------------------------------------------------------+\n| bonfida    | HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA | https://explorer.solana.com/address/HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA |\n+------------+----------------------------------------------+----------------------------------------------------------------------------------+\n| solana.sol | 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX | https://explorer.solana.com/address/3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX |\n+------------+----------------------------------------------+----------------------------------------------------------------------------------+\n| coinbase   | 7sF2JumHpWiPjS3XtnQ8cKraTzzfcGSvQHcV3yTaPZ5E | https://explorer.solana.com/address/7sF2JumHpWiPjS3XtnQ8cKraTzzfcGSvQHcV3yTaPZ5E |\n+------------+----------------------------------------------+----------------------------------------------------------------------------------+\n\n```\n\n\u003cbr /\u003e\n\u003ca name=\"python\"\u003e\u003c/a\u003e\n\u003ch2 align=\"center\"\u003ePython\u003c/h2\u003e\n\u003cbr /\u003e\nWork in progress\n\n\u003cbr /\u003e\n\u003ca name=\"java\"\u003e\u003c/a\u003e\n\u003ch2 align=\"center\"\u003eJava\u003c/h2\u003e\n\u003cbr /\u003e\nWork in progress\n\n\u003cbr /\u003e\n\u003ca name=\"swift\"\u003e\u003c/a\u003e\n\u003ch2 align=\"center\"\u003eSwift\u003c/h2\u003e\n\u003cbr /\u003e\nWork in progress\n\n\u003cbr /\u003e\n\u003ca name=\"examples\"\u003e\u003c/a\u003e\n\u003ch2 id=\"react\" align=\"center\"\u003eReact\u003c/h2\u003e\n\u003cbr /\u003e\n\nThis package contains a set of useful React hooks to help you build your perfect dApp. If you are interested in a hook that is not included in this package please open an issue to let us know!\n\n```\nnpm i @bonfida/sns-react\n```\n\n```\nyarn add @bonfida/sns-react\n```\n\n\u003cbr /\u003e\n\u003ch2 id=\"vue\" align=\"center\"\u003eVue\u003c/h2\u003e\n\u003cbr /\u003e\n\nThis package contains a set of useful Vue composables to help you build your perfect dApp. If you are interested in a composable that is not included in this package please open an issue to let us know!\n\n```\nnpm i @bonfida/sns-vue\n```\n\n```\nyarn add @bonfida/sns-vue\n```\n\n[Demo app](/examples/vue-app) with an example of each composable usage.\n\n\u003cbr /\u003e\n\u003ca name=\"examples\"\u003e\u003c/a\u003e\n\u003ch2 align=\"center\"\u003eExamples\u003c/h2\u003e\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\u003ch3 align=\"center\"\u003eResolving a domain\u003c/h2\u003e\n\u003cbr /\u003e\n\nThe following examples show how to resolve the domain `bonfida.sol`:\n\n1. With the JS SDK\n\n```js\nconst connection = new Connection(clusterApiUrl(\"mainnet-beta\"));\nconst owner = await resolve(connection, \"bonfida\");\nexpect(owner.toBase58()).toBe(\"HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA\");\n```\n\n2. With the Rust SDK\n\n```rust\nlet client = RpcClient::new(std::env::var(\"RPC_URL\").unwrap());\nlet res = resolve_owner(\u0026client, \"bonfida\").await.unwrap();\nassert_eq!(res, pubkey!(\"HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA\"));\n```\n\n3. With the CLI\n\n```bash\n$ sns resolve bonfida\n\n+---------+----------------------------------------------+----------------------------------------------------------------------------------+\n| Domain  | Owner                                        | Explorer                                                                         |\n+---------+----------------------------------------------+----------------------------------------------------------------------------------+\n| bonfida | HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA | https://explorer.solana.com/address/HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA |\n+---------+----------------------------------------------+----------------------------------------------------------------------------------+\n```\n\n4. With the Cloudflare worker\n\n```bash\nGET https://sns-sdk-proxy.bonfida.workers.dev/resolve/bonfida\n```\n\n```json\n{ \"s\": \"ok\", \"result\": \"HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA\" }\n```\n\n5. With the React SDK\n\n```ts\nimport { useConnection, useWallet } from \"@solana/wallet-adapter-react\";\nimport { useDomainOwner, useDomainsForOwner } from \"@bonfida/sns-react\";\n\nexport const Example = () =\u003e {\n  const { connection } = useConnection();\n  const { publicKey, connected } = useWallet();\n  const { result } = useDomainOwner(connection, \"bonfida\");\n  // ...\n};\n```\n\n\u003cbr /\u003e\n\u003ca name=\"bounties\"\u003e\u003c/a\u003e\n\u003ch2 align=\"center\"\u003eBounties\u003c/h2\u003e\n\u003cbr /\u003e\n\n| Feature | Description                                                                         | In progress | Completed | Bounty |\n| ------- | ----------------------------------------------------------------------------------- | ----------- | --------- | ------ |\n| Golang  | Translate JS SDK into a robust, well-tested Golang SDK; high-quality code essential | ❌          | ❌        | ✅     |\n| Python  | Translate JS SDK into a robust, well-tested Python SDK; high-quality code essential | ❌          | ❌        | ✅     |\n| Java    | Translate JS SDK into a robust, well-tested Java SDK; high-quality code essential   | ❌          | ❌        | ✅     |\n| Swift   | Translate JS SDK into a robust, well-tested Swift SDK; high-quality code essential  | ❌          | ❌        | ✅     |\n\n\u003chr\u003e\n\n_If you have any questions or suggestions, feel free to open an issue or pull request, or simply contact us at [@bonfida](https://twitter.com/bonfida). We're always here for a good chat about Solana and the decentralized web!_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSolanaNameService%2Fsns-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSolanaNameService%2Fsns-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSolanaNameService%2Fsns-sdk/lists"}