{"id":20189919,"url":"https://github.com/crossbell-box/crossbell.js","last_synced_at":"2025-04-10T08:31:36.029Z","repository":{"id":38396400,"uuid":"481269716","full_name":"Crossbell-Box/crossbell.js","owner":"Crossbell-Box","description":"Crossbell.js - A JavaScript SDK to interact with Crossbell","archived":false,"fork":false,"pushed_at":"2025-04-07T23:01:28.000Z","size":13957,"stargazers_count":17,"open_issues_count":14,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-08T00:21:29.638Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crossbell.js.org","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/Crossbell-Box.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":"2022-04-13T15:22:46.000Z","updated_at":"2024-10-25T04:35:27.000Z","dependencies_parsed_at":"2022-07-12T17:28:32.474Z","dependency_job_id":"36ee7773-fae9-4a44-8856-209f003c9bef","html_url":"https://github.com/Crossbell-Box/crossbell.js","commit_stats":{"total_commits":218,"total_committers":2,"mean_commits":109.0,"dds":0.004587155963302725,"last_synced_commit":"c12b7b3e261d2c2433adbd91959e1627aae573da"},"previous_names":[],"tags_count":150,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crossbell-Box%2Fcrossbell.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crossbell-Box%2Fcrossbell.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crossbell-Box%2Fcrossbell.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Crossbell-Box%2Fcrossbell.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Crossbell-Box","download_url":"https://codeload.github.com/Crossbell-Box/crossbell.js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248185544,"owners_count":21061526,"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":[],"created_at":"2024-11-14T03:39:35.971Z","updated_at":"2025-04-10T08:31:35.994Z","avatar_url":"https://github.com/Crossbell-Box.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crossbell.js\n\nA JavaScript SDK to interact with the Crossbell. It works for both browser and Node.js.\n\n[![npm version](https://badgen.net/npm/v/crossbell)](https://npm.im/crossbell) [![npm downloads](https://badgen.net/npm/dm/crossbell)](https://npm.im/crossbell)\n\n- [API Reference](https://crossbell.js.org/)\n- [Vite Example](https://crossbell-js.netlify.app/)\n\n## Installation\n\n```bash\nnpm install crossbell\n```\n\n## Usage\n\n### Requirements\n\nNode.js \u003e= 18.0.0 or Node.js \u003e= 16.14.0 with [fetch polyfill](https://github.com/nodejs/undici)\n\n### Contract\n\n#### Connect with Metamask\n\n```typescript\nimport { createContract } from 'crossbell'\n\n// Create a new contract instance with metamask provider\nconst provider = window.ethereum\nconst contract = new createContract(provider)\n\n// Example API: Create a new character for an address\ntry {\n  const result = await contract.character.create({\n    owner: '0x1234567890123456789012345678901234567890',\n    handle: 'Jason',\n    metadataOrUri: 'ipfs://xxxx/metadata.json',\n  })\n  console.log(result.data) // '42' (characterId)\n  console.log(result.transactionHash) // '0xabcdef...'\n} catch (e) {\n  console.error(e.message) // e.g. \"execution reverted: Web3Entry: HandleExists\"\n}\n```\n\n#### Connect with Private Key\n\nYou can also connect with a private key directly.\n\n```typescript\nimport { createContract } from 'crossbell'\n\nconst privateKey =\n  '0xabcdef0123456789012345678901234567890123456789012345678901234'\nconst contract = new createContract(provider)\n```\n\n#### Connect with Read-Only\n\nYou can also connect with a read-only provider. Note that in this case, you can't do write operations like `createCharacter`.\n\n```typescript\nimport { createContract } from 'crossbell'\n\nconst contract = new createContract(provider) // just pass nothing to use a read-only provider\n```\n\nFor more contract api, see [docs](https://crossbell.js.org/classes/Contract.html).\n\n### Indexer\n\nYou can fetch data from the crossbell indexer.\n\n```typescript\nimport { createIndexer } from 'crossbell'\n\nconst indexer = createIndexer()\n\n// get a list of characters owned by a specific address\nconst res = await indexer.character.getMany(\n  '0x1234567890123456789012345678901234567890',\n)\nconsole.log(res.list)\n```\n\nFor more indexer api, see [docs](https://crossbell.js.org/classes/Indexer.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossbell-box%2Fcrossbell.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrossbell-box%2Fcrossbell.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrossbell-box%2Fcrossbell.js/lists"}