Comparing version 0.0.0 to 1.0.0-rc.0
{ | ||
"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). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
4872428
31
41833
1
88
5
12
27
+ Addedasync-retry@^1.3.3
+ Addedeip1193-types@^0.2.0
+ Addedp-limit@^3.1.0
+ Addedviem@^0.3.16
+ Added@adraffy/ens-normalize@1.9.0(transitive)
+ Added@crossbell/ipfs-fetch@0.0.19(transitive)
+ Added@noble/curves@1.0.0(transitive)
+ Added@noble/hashes@1.3.0(transitive)
+ Added@scure/base@1.1.9(transitive)
+ Added@scure/bip32@1.3.0(transitive)
+ Added@scure/bip39@1.2.0(transitive)
+ Added@wagmi/chains@1.0.0(transitive)
+ Addedabitype@0.8.7(transitive)
+ Addedasync-retry@1.3.3(transitive)
+ Addedeip1193-types@0.2.2(transitive)
+ Addedisomorphic-ws@5.0.0(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedretry@0.13.1(transitive)
+ Addedtypescript@5.7.2(transitive)
+ Addedviem@0.3.50(transitive)
+ Addedws@8.12.0(transitive)
+ Addedyocto-queue@0.1.0(transitive)