Skip to content

Commit

Permalink
docs: Add comments and explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
lanmeng656 committed Sep 21, 2023
1 parent d6dbe4c commit 2d63b2f
Show file tree
Hide file tree
Showing 22 changed files with 92 additions and 15 deletions.
2 changes: 1 addition & 1 deletion API.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# API Docs

js sdk
## List

1. Space
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## About

A js-sdk for Cess Project with file storage
JS-SDK for Cess Project with file storage

Supports CommonJS and ES Module import type

Expand Down
5 changes: 5 additions & 0 deletions example/authorize.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const { Authorize, InitAPI } = require("../");

const config = require("../src/config");
Expand Down
5 changes: 5 additions & 0 deletions example/bucket.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const { Bucket, InitAPI } = require("../");

const { api, keyring } = InitAPI();
Expand Down
5 changes: 5 additions & 0 deletions example/file.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const { File, InitAPI, Common } = require("../index.js");

const config = require("../src/config");
Expand Down
5 changes: 5 additions & 0 deletions example/space.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const { Space, InitAPI, Common } = require("../");
const { api, keyring } = InitAPI();
const accountId32 = "cXh5StobuVP4B7mGH9xn8dSsDtXks4qLAou8ZdkZ6DbB6zzxe";
Expand Down
5 changes: 5 additions & 0 deletions example/space.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
if (typeof global != "undefined") {
global.window = { isNode: true };
} else {
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const InitAPI = require("./src/init-api");
const Common = require("./src/api/common");
const Authorize = require("./src/api/authorize");
Expand Down
4 changes: 4 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*/
import InitAPI from "./src/init-api.js";
import Common from "./src/api/common.js";
import Authorize from "./src/api/authorize.js";
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cess-js-sdk",
"version": "0.7.0",
"version": "0.7.1",
"description": "A js-sdk for Cess Project with file storage",
"main": "index.js",
"module":"index.mjs",
Expand Down
5 changes: 5 additions & 0 deletions src/api/authorize.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const ControlBase = require("../control-base");
const defaultConfig = require("../config");

Expand Down
5 changes: 5 additions & 0 deletions src/api/bucket.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const ControlBase = require("../control-base");
const { formatEntries } = require("../util/formatter");

Expand Down
5 changes: 5 additions & 0 deletions src/api/common.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const ControlBase = require("../control-base");
const formatter = require("../util/formatter");
const moment = require("moment");
Expand Down
5 changes: 5 additions & 0 deletions src/api/file.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const ControlBase = require("../control-base");
const config = require("../config");
const fileHelper = require("../util/file-helper");
Expand Down
5 changes: 5 additions & 0 deletions src/api/space.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const ControlBase = require("../control-base");

module.exports = class Space extends ControlBase {
Expand Down
5 changes: 5 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
module.exports = {
nodeURL: "wss://testnet-rpc0.cess.cloud/ws/",
keyringOption: { type: "sr25519", ss58Format: 42 },
Expand Down
5 changes: 5 additions & 0 deletions src/control-base.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
let web3Enable = () => [];
let web3FromAddress = () => {
return {};
Expand Down
5 changes: 5 additions & 0 deletions src/init-api.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const defaultConfig = require("./config");
const { ApiPromise, WsProvider, Keyring } = require("@polkadot/api");

Expand Down
5 changes: 5 additions & 0 deletions src/util/file-helper.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
let fs = null;
let FormDataNode = null;
const axios = require("axios");
Expand Down
5 changes: 5 additions & 0 deletions src/util/formatter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const _ = require("lodash");

module.exports = {
Expand Down
5 changes: 5 additions & 0 deletions src/util/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* @Description: js-sdk for cess storage
* @Autor: cess lab
*
*/
const bs58 = require("bs58");

const uint8ArrayToHex = (bytes) =>
Expand Down
12 changes: 0 additions & 12 deletions test.js

This file was deleted.

0 comments on commit 2d63b2f

Please sign in to comment.