{"id":43592552,"url":"https://github.com/thenamespace/namespace-sdk","last_synced_at":"2026-02-04T02:12:19.108Z","repository":{"id":249321618,"uuid":"831174325","full_name":"thenamespace/namespace-sdk","owner":"thenamespace","description":"A typescript library for interacting with namespace contracts and apis","archived":false,"fork":false,"pushed_at":"2024-12-15T20:19:32.000Z","size":115,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-15T21:25:08.418Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/thenamespace.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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-07-19T20:58:43.000Z","updated_at":"2024-12-02T23:27:23.000Z","dependencies_parsed_at":"2024-08-06T22:11:53.954Z","dependency_job_id":"48f567fc-bcd6-4066-9d27-b0e065e8c136","html_url":"https://github.com/thenamespace/namespace-sdk","commit_stats":null,"previous_names":["thenamespace/namespace-sdk"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/thenamespace/namespace-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenamespace%2Fnamespace-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenamespace%2Fnamespace-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenamespace%2Fnamespace-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenamespace%2Fnamespace-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thenamespace","download_url":"https://codeload.github.com/thenamespace/namespace-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thenamespace%2Fnamespace-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29064264,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T01:55:38.219Z","status":"online","status_checked_at":"2026-02-04T02:00:07.999Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-02-04T02:12:17.768Z","updated_at":"2026-02-04T02:12:19.095Z","avatar_url":"https://github.com/thenamespace.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Namespace Ninja](https://namespace.fra1.cdn.digitaloceanspaces.com/brand/logo_small.png)\n# Namespace-SDK\n\nA Typescript library used to interact with Namespace contracts and APIs. \nIt uses Viem under the hood and can be used to:\n* Find names listed on the Namespace platform\n* Check the availability of subnames\n* Mint subnames\n\nThis is the initial version, expect many more functionalities in the future!\n\n# Installation\n\nUse a package manager to install the library into your project\n\nYarn\n```bash\nyarn add namespace-sdk\n```\nNpm\n```bash\nnpm install namespace-sdk\n```\n\n# Getting started\n\nFirst, we can create a simple NamespaceClient and specify the chainID. The chain id specifies a chain on which read/write blockchain operations happen. If we list our name on a Mainnet and subnames are minted on Mainnet, we'll have to specify a chainID 1. We will use a sepolia testnet as an example.\n\nThe chainID is required since the library supports minting subnames on both Layer 1 and its testnet (Sepolia) but also on Layer 2 (currently, only Base chain is supported).\n\n```typescript\nimport { createNamespaceClient } from \"namespace-sdk\";\nimport { sepolia } from \"viem/chains\";\n\nconst namespaceClient = createNamespaceClient({\n  chainId: sepolia.id\n});\n```\n# Minting a subname\n\nMinting ENS subnames requires a couple of steps. \n\n## 1. Listing an ENS name\n\nFirst, we would need to have an ENS name that is listed on the Namespace platform. To do so, visit our [Platform](https://app.namespace.tech) and check \n[Manager](https://docs.namespace.tech/namespace-platform/manager)\n\nFor testing purposes, you can use \"namespace-sdk.eth\" on the Sepolia chain.\n## 2. Generate minting parameters\n\nAfter we list the ENS name, our platform allows minting subnames under it. We can use a library to check for subname availability and to generate mint transaction parameters.\n\n```typescript\nimport { createNamespaceClient, SetRecordsRequest, MintTransactionParameters } from \"namespace-sdk\";\nimport { sepolia } from \"viem/chains\";\n\nconst namespaceClient = createNamespaceClient({\n  chainId: sepolia.id,\n});\n\nconst LISTED_NAME = \"namespace-sdk.eth\"\nconst ETH_COIN_TYPE = 60;\n\nconst generateMintingParameters = async (): Promise\u003cMintTransactionParameters\u003e =\u003e {\n\n  // Get listed name from namespace api\n  const listedName = await namespaceClient.getListedName(\n    LISTED_NAME,\n    sepolia.id\n  );\n\n  const subnameLabel = \"myfunnylabel\";\n  const minterAddress = \"0x6CaBE5E77F90d58600A3C13127Acf6320Bee0aA7\"\n\n  // Check for name availability\n  const isNotTaken = await namespaceClient.isSubnameAvailable(\n    listedName,\n    subnameLabel\n  );\n  \n  if (!isNotTaken) {\n    throw Error(\"Subname is already taken!\");\n  }\n\n   // Generate mint transcation parameters\n  const mintDetails = await namespaceClient.getMintTransactionParameters(listedName, {\n    minterAddress: minterAddress,\n    subnameLabel: subnameLabel,\n    subnameOwner: minterAddress,\n    // Optionaly, we can also set resolver records with the mint transaction\n    records: {\n        addresses: [\n            {\n                address: minterAddress,\n                coinType: ETH_COIN_TYPE\n            }\n        ],\n        texts: [\n            {\n                key: \"name\",\n                value: \"namespace\"\n            }\n        ]\n    }\n  });\n  return mintDetails;\n};\n```\n## 3. Send Transaction\nSending a transaction is the last step. Since the library uses Viem under the hood, we will use WalletClient to send a transaction.\n\n```typescript\nimport { sepolia } from \"viem/chains\";\nimport { privateKeyToAccount } from \"viem/accounts\";\nimport { createWalletClient, http } from \"viem\";\nimport { generateMintingParameters } from \"./minting\";\n\nconst sendMintTransaction = async () =\u003e {\n\n    // Import your wallet and create a Viem Wallet Client\n    const wallet = privateKeyToAccount(\"0xYourWallet\");\n    const walletClient = createWalletClient({\n        transport: http(),\n        chain: sepolia,\n        account: wallet\n    })\n\n    // Generate minting parameters\n    const mintParams = await generateMintingParameters();\n\n    // Send transaction\n    const transactionHash = await walletClient.writeContract({\n        abi: mintParams.abi,\n        address: mintParams.contractAddress,\n        functionName: mintParams.functionName,\n        args: mintParams.args,\n        value: mintParams.value\n    })\n\n    console.log(transactionHash);\n}\n```\n## Authors\n[artii.eth](https://github.com/nenadmitt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthenamespace%2Fnamespace-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthenamespace%2Fnamespace-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthenamespace%2Fnamespace-sdk/lists"}