Skip to content

Commit c2eea34

Browse files
committed
feat(support iframe): Now support H5 to call the iframe, auto set the window.conflux, and some new function
1 parent bbab8f6 commit c2eea34

34 files changed

+41628
-9921
lines changed

README.md

Lines changed: 25 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,33 @@
11
# AnyWeb JS SDK
22

3-
[comment]: <> ([![npm]&#40;https://img.shields.io/npm/v/js-conflux-sdk.svg&#41;]&#40;https://www.npmjs.com/package/js-conflux-sdk&#41;)
4-
5-
[comment]: <> ([![npm]&#40;https://img.shields.io/npm/dm/js-conflux-sdk.svg&#41;]&#40;https://www.npmjs.com/package/js-conflux-sdk&#41;)
6-
73
JavaScript AnyWeb Software Development Kit is a complete library for interacting with the AnyChain in both Node.js and
84
browser environment.
95

106
Features:
117

12-
* Can be used in both browser and Node.js environment
13-
* Connect to Conflux node over HTTP/Websocket JSON-RPC
14-
* Meta-classes create JavaScript objects from any contract ABI
15-
* Account utilities
16-
* Type converter, sign and hash utilities
17-
* Extensive [documentation](https://confluxnetwork.gitbook.io/js-conflux-sdk/)
18-
* Builtin support for CRC20 and Internal Contracts
19-
* Batch RPC support
8+
* Support for Mobile and Desktop
9+
* Support H5 without plugin
10+
* Support for multiple chains
11+
* Support hot Wallet and cold Wallet
12+
* Easy to use for developers
2013

2114
## Docs
2215

23-
* [Overview](docs/overview.md)
24-
* [Complete document for sending transaction](docs/how_to_send_tx.md)
25-
* [Interact with contract](docs/interact_with_contract.md)
26-
* [SDK support for CIP37 address](docs/conflux_checksum_address.md)
27-
* [API](docs/api/README.md)
28-
* [Error handling](docs/error_handling.md)
29-
* [Conflux Official document](https://developer.conflux-chain.org/docs/introduction/en/conflux_overview)
30-
* [Public available RPC service](https://github.com/conflux-fans/conflux-rpc-endpoints)
31-
* [Examples](https://github.com/conflux-fans/js-sdk-example)
32-
* [Fullnode RPC document](https://developer.confluxnetwork.org/conflux-doc/docs/json_rpc)
16+
* [Home](README.md)
17+
* [Quick Start](docs/quick_start.md)
18+
* [API](docs/api/modules.md)
19+
* [Provider](docs/api/classed/defaults.md)
20+
* [Release notes](CHANGELOG.md)
21+
*
3322

34-
Check [SDK's documentation](https://confluxnetwork.gitbook.io/js-conflux-sdk/) site for more info.
23+
Check [SDK's documentation](https://wiki.anyweb.cc) site for more info.
3524

3625
## Install
3726

3827
Install through npm
3928

4029
```sh
41-
$ npm install js-conflux-sdk
30+
$ npm install --save anyweb-js-sdk
4231
```
4332

4433
## How to import
@@ -48,90 +37,39 @@ $ npm install js-conflux-sdk
4837
Use in Node.js script
4938

5039
```javascript
51-
const { Conflux } = require('js-conflux-sdk');
52-
53-
const conflux = new Conflux({
54-
url: 'https://test.confluxrpc.com',
55-
networkId: 1,
56-
logger: console, // for debug
57-
});
58-
```
59-
60-
require deep nested file/dir
40+
import * from 'anyweb-js-sdk';
6141

62-
```javascript
63-
const util = require('js-conflux-sdk/src/util');
42+
const conflux = new Provider({
43+
logger: console,
44+
appId: 'Your app id which get from open.anyweb.cc',
45+
})
6446
```
6547

6648
### Frontend
6749

6850
#### umd
6951

70-
The front packed package is located in `js-conflux-sdk`'s dist folder.
52+
The front packed package is located in `anyweb-js-sdk`'s dist folder.
7153

7254
```javascript
73-
import { Conflux } from 'js-conflux-sdk/dist/js-conflux-sdk.umd.min.js';
55+
import { Conflux } from 'anyweb-js-sdk/dist/anyweb-js-sdk.umd.min.js';
7456
```
7557

7658
or if your bundler supports the [`browser` field](https://docs.npmjs.com/files/package.json#browser) in `package.json`
7759

7860
```javascript
79-
import { Conflux } from 'js-conflux-sdk';
61+
import * from 'anyweb-js-sdk';
8062
```
8163

8264
or
8365

8466
```html
8567

86-
<script type="text/javascript" src="node_modules/js-conflux-sdk/dist/js-conflux-sdk.umd.min.js"></script>
68+
<script type="text/javascript" src="node_modules/anyweb-js-sdk/dist/anyweb-js-sdk.umd.min.js"></script>
8769
<script type="text/javascript">
88-
const conflux = new window.TreeGraph.Conflux({
89-
url: 'https://test.confluxrpc.com',
70+
const anyweb = new window.AnyWeb({
9071
logger: console,
91-
networkId: 1,
92-
});
72+
appId: 'Your app id which get from open.anyweb.cc'
73+
})
9374
</script>
9475
```
95-
96-
From `v2.0` the exported class to browser window name change from Conflux to `TreeGraph`
97-
98-
Or you can use public CDN links:
99-
100-
* [`jsdelivr`](https://cdn.jsdelivr.net/npm/js-conflux-sdk/dist/js-conflux-sdk.umd.min.js)
101-
102-
## Address conversion performance
103-
104-
To gain a address conversion(hex->base32 or reverse) performance boost, you can
105-
install [`@conflux-dev/conflux-address-rust`](https://github.com/conflux-fans/conflux-address-rust-binding) in your
106-
project. Which will be used to relace the purejs version and can gain a `10-100` performance boost.
107-
108-
Note: @conflux-dev/conflux-address-rust required a rust environment to install.
109-
110-
## SDK version relation with Conflux-rust
111-
112-
How to know SDK's version
113-
114-
```js
115-
const { Conflux } = require('js-conflux-sdk');
116-
const conflux = new Conflux({
117-
url: 'https://test.confluxrpc.com',
118-
networkId: 1,
119-
});
120-
console.log(conflux.version);
121-
// 2.0.0
122-
```
123-
124-
How to know fullnode's version
125-
126-
```js
127-
const clientVersion = await conflux.cfx.getClientVersion();
128-
console.log(clientVersion);
129-
// conflux-rust-2.0.0
130-
```
131-
132-
js-conflux-sdk | conflux-rust(node)
133-
-------------- | -------------
134-
v2.0.0+ | v2.0.0+
135-
v1.7.0+ | v1.1.5+
136-
v1.6.0+ | v1.1.3+
137-
v1.5.11+ | v1.1.1+

SUMMARY.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,7 @@
11
# Table of contents
22

33
* [Home](README.md)
4-
* [QuickStart](docs/quick_start.md)
5-
* [Introduction](docs/index.md)
6-
* [Overview](docs/overview.md)
7-
* [Contrast with web3.js](docs/jssdk-vs-web3.md)
8-
* [Guides](docs/README.md)
9-
* [Providers](docs/providers.md)
10-
* [CIP37 Address](docs/conflux_checksum_address.md)
11-
* [Account](docs/account.md)
12-
* [Sending Transaction](docs/how_to_send_tx.md)
13-
* [Interact with Contract](docs/interact_with_contract.md)
14-
* [Sign methods](docs/sign_methods.md)
15-
* [Error Handling](docs/error_handling.md)
16-
* [Batch RPC](docs/batch_rpc.md)
17-
* [API](docs/api/README.md)
18-
* [Conflux](docs/api/Conflux.md)
19-
* [PoS](docs/api/PoS.md)
20-
* [TxPool](docs/api/txpool.md)
21-
* [Provider](docs/api/Provider.md)
22-
* [Drip](docs/api/Drip.md)
23-
* [Contract](docs/api/Contract.md)
24-
* [Transaction](docs/api/Transaction.md)
25-
* [Wallet](docs/api/Wallet.md)
26-
* [utils](docs/api/utils.md)
27-
* [Misc](docs/api/misc.md)
4+
* [Quick Start](docs/quick_start.md)
5+
* [API](docs/api/modules.md)
6+
* [Provider](docs/api/classed/defaults.md)
287
* [Release notes](CHANGELOG.md)
29-
* [v2.0 Changes](docs/v2.0_changes.md)

docs/FAQs.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/account.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

docs/api/README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
anyweb-js-sdk / [Exports](modules.md)
22

3-
# js-conflux-sdk
3+
# AnyWeb JS SDK
44

5-
[![npm](https://img.shields.io/npm/v/js-conflux-sdk.svg)](https://www.npmjs.com/package/js-conflux-sdk)
6-
[![npm](https://img.shields.io/npm/dm/js-conflux-sdk.svg)](https://www.npmjs.com/package/js-conflux-sdk)
7-
8-
JavaScript Conflux Software Development Kit is a complete library for interacting with the Conflux Blockchain in both Node.js and browser environment.
5+
JavaScript AnyWeb Software Development Kit is a complete library for interacting with the AnyChain in both Node.js and
6+
browser environment.
97

108
Features:
119

12-
* Can be used in both browser and Node.js environment
13-
* Connect to Conflux node over HTTP/Websocket JSON-RPC
14-
* Meta-classes create JavaScript objects from any contract ABI
15-
* Account utilities
16-
* Type converter, sign and hash utilities
17-
* Extensive [documentation](https://confluxnetwork.gitbook.io/js-conflux-sdk/)
18-
* Builtin support for CRC20 and Internal Contracts
19-
* Batch RPC support
10+
* Support for Mobile and Desktop
11+
* Support H5 without plugin
12+
* Support for multiple chains
13+
* Support hot Wallet and cold Wallet
14+
* Easy to use for developers
2015

2116
## Docs
2217

@@ -82,6 +77,7 @@ import { Conflux } from 'js-conflux-sdk';
8277
or
8378

8479
```html
80+
8581
<script type="text/javascript" src="node_modules/js-conflux-sdk/dist/js-conflux-sdk.umd.min.js"></script>
8682
<script type="text/javascript">
8783
const conflux = new window.TreeGraph.Conflux({
@@ -100,7 +96,9 @@ Or you can use public CDN links:
10096

10197
## Address conversion performance
10298

103-
To gain a address conversion(hex->base32 or reverse) performance boost, you can install [`@conflux-dev/conflux-address-rust`](https://github.com/conflux-fans/conflux-address-rust-binding) in your project. Which will be used to relace the purejs version and can gain a `10-100` performance boost.
99+
To gain a address conversion(hex->base32 or reverse) performance boost, you can
100+
install [`@conflux-dev/conflux-address-rust`](https://github.com/conflux-fans/conflux-address-rust-binding) in your
101+
project. Which will be used to relace the purejs version and can gain a `10-100` performance boost.
104102

105103
Note: @conflux-dev/conflux-address-rust required a rust environment to install.
106104

0 commit comments

Comments
 (0)