Skip to content

Commit

Permalink
update the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lanmeng656 committed Mar 14, 2024
1 parent c484911 commit eaba90c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 216 deletions.
31 changes: 7 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

## About

JS-SDK for Cess Project with file storage.

Supports CommonJS and ES Module import type.
JS-SDK for CESS Project with file storage.

Please install the [Polkadot.js extension](https://polkadot.js.org/extension/) in the browser.

> When used in next.js, it will prompt: ReferenceError: window is not defined,This is due to the Polkadot.js extension, detailed issues can be found at: https://github.com/polkadot-js/extension/issues/1207
<a href="https://cessproject.github.io/cess-js-sdk-frontend/">Online Demo</a>

Expand All @@ -25,24 +24,15 @@ pnpm add cess-js-sdk-frontend
## Example

```ts
const { Space, InitAPI, Common, testnetConfig, wellKnownAcct } = require("cess-js-sdk-frontend");

import { Space, InitAPI, Common, Authorize, Bucket, File, defaultConfig } from "cess-js-sdk-frontend";

async function main() {
const { api, keyring } = await InitAPI(testnetConfig);
const { addr, mnemonicOrAccountId32 } = wellKnownAcct;
const { api, keyring } = await InitAPI(defaultConfig);
let addr="";
let mnemonicOrAccountId32="";

const space = new Space(api, keyring);
/*
const bucket = new Bucket(api, keyring, true);
const space2 = new Space2(api, keyring, true);
const authorizeHandle = new Authorize(api, keyring, true);
const fileHandle = new File(
api,
keyring,
config.gatewayURL,
true
);
*/
const common = new Common(api, keyring);

console.log("query userOwnedSpace:");
Expand Down Expand Up @@ -81,13 +71,6 @@ main()
.finally(() => process.exit());
```

More examples are in the [**examples**](./examples) directory.

To run them all, run the command:

```bash
pnpm examples
```

All examples connect to the Testnet and use the account `cXgaee2N8E77JJv9gdsGAckv1Qsf3hqWYf7NL4q6ZuQzuAUtB` as default with the following mnemonicOrAccountId32:

Expand Down
11 changes: 3 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@
"author": "CESS <[email protected]>",
"homepage": "https://www.cess.cloud",
"license": "MIT",
"version": "0.0.5",
"version": "0.0.8",
"description": "A js-sdk for Cess Project with file storage",
"main": "dist/index.js",
"main": "src/index.js",
"type":"module",
"types": "src/types.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/CESSProject/cess-js-sdk-frontend.git"
},
"scripts": {
"fmt": "prettier --write .",
"build": "esbuild ./src/index.js --bundle --minify --format=esm --outfile=./dist/index.js",
"test:types": "ts-node src/tests/types.ts",
"examples": "ts-node src/examples/index.ts",
"validate": "npm run fmt && npm run lint && npm run test:types"
"build": "esbuild ./src/index.js --bundle --minify --format=esm --outfile=./dist/index.js"
},
"dependencies": {
"@polkadot/api": "^10.9.1",
Expand All @@ -44,7 +40,6 @@
"husky": "^8.0.3",
"lint-staged": "^15.0.2",
"prettier": "^3.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"keywords": [
Expand Down
160 changes: 0 additions & 160 deletions src/types.d.ts

This file was deleted.

24 changes: 0 additions & 24 deletions tsconfig.json

This file was deleted.

0 comments on commit eaba90c

Please sign in to comment.