Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

crossbell

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crossbell - npm Package Compare versions

Comparing version 0.0.0 to 1.0.0-rc.0

dist/chunk-JJGB2J3U.mjs

86

package.json
{
"name": "crossbell",
"version": "0.0.0",
"description": "Online game framework",
"main": "crossbell.js",
"version": "1.0.0-rc.0",
"packageManager": "pnpm@8.3.1",
"description": "JavaScript SDK to interact with Crossbell",
"keywords": [
"crossbell",
"eth",
"contract",
"web3"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/Crossbell-Box/crossbell.js/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/vi-works/crossbell.git"
"url": "https://github.com/Crossbell-Box/crossbell.js.git"
},
"license": "MIT",
"files": [
"dist"
],
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./network": {
"types": "./dist/network.d.ts",
"import": "./dist/network.mjs",
"require": "./dist/network.js"
},
"./ipfs": {
"types": "./dist/ipfs.d.ts",
"import": "./dist/ipfs.mjs",
"require": "./dist/ipfs.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/*",
"./*"
]
}
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsup --dts",
"watch": "tsup --watch",
"update-abi": "node ./scripts/update-abi.mjs",
"docs:build": "typedoc",
"docs:preview": "serve docs",
"prepublishOnly": "npm run build",
"test": "vitest",
"lint": "ESLINT_USE_FLAT_CONFIG=true eslint -c eslint.config.mjs --max-warnings 0 .",
"typecheck": "tsc --noEmit",
"release": "bumpp"
},
"dependencies": {
"@crossbell/ipfs-fetch": "^0.0.19",
"async-retry": "^1.3.3",
"eip1193-types": "^0.2.0",
"p-limit": "^3.1.0",
"viem": "^0.3.16"
},
"devDependencies": {
"@sxzz/eslint-config": "3.0.0-beta.9",
"@types/async-retry": "^1.4.5",
"@types/node": "^18.16.3",
"abitype": "^0.8.2",
"bumpp": "^9.1.0",
"change-case": "^4.1.2",
"eslint": "^8.39.0",
"prettier": "^2.8.8",
"tsup": "^6.7.0",
"typedoc": "^0.24.6",
"typescript": "^5.0.4",
"vitest": "^0.30.1"
},
"engines": {
"node": ">=16.14.0"
}
}

@@ -1,1 +0,87 @@

# crossbell
# crossbell.js
A JavaScript SDK to interact with the Crossbell. It works for both browser and Node.js.
[![npm version](https://badgen.net/npm/v/crossbell)](https://npm.im/crossbell) [![npm downloads](https://badgen.net/npm/dm/crossbell)](https://npm.im/crossbell)
- [API Reference](https://crossbell-box.github.io/crossbell.js/)
- [Vite Example](https://crossbell-js.netlify.app/)
## Installation
```bash
npm install crossbell
```
## Usage
### Requirements
Node.js >= 18.0.0 or Node.js >= 16.14.0 with [fetch polyfill](https://github.com/nodejs/undici)
### Contract
#### Connect with Metamask
```typescript
import { Contract } from 'crossbell'
// Create a new contract instance with metamask provider
const provider = window.ethereum
const contract = new Contract(provider)
// Example API: Create a new character for an address
try {
const result = await contract.character.create(
'0x1234567890123456789012345678901234567890',
'Jason',
'ipfs://xxxx/metadata.json',
)
console.log(result.data) // '42' (characterId)
console.log(result.transactionHash) // '0xabcdef...'
} catch (e) {
console.error(e.message) // e.g. "execution reverted: Web3Entry: HandleExists"
}
```
#### Connect with Private Key
You can also connect with a private key directly.
```typescript
import { Contract } from 'crossbell'
const privateKey =
'0xabcdef0123456789012345678901234567890123456789012345678901234'
const contract = new Contract(privateKey)
```
#### Connect with Read-Only
You can also connect with a read-only provider. Note that in this case, you can't do write operations like `createCharacter`.
```typescript
import { Contract } from 'crossbell'
const contract = new Contract() // just pass nothing to use a read-only provider
```
For more contract api, see [docs](https://crossbell-box.github.io/crossbell.js/classes/Contract.html).
### Indexer
You can fetch data from the crossbell indexer.
```typescript
import { createIndexer } from 'crossbell'
const indexer = createIndexer()
// get a list of characters owned by a specific address
const res = await indexer.character.getMany(
'0x1234567890123456789012345678901234567890',
)
console.log(res.list)
```
For more indexer api, see [docs](https://crossbell-box.github.io/crossbell.js/classes/Indexer.html).
.npmignore

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc