11# AnyWeb JS SDK
22
3- [ comment ] : < > ( [ ; ]( ; https://www.npmjs.com/package/js-conflux-sdk) ; )
4-
5- [ comment ] : < > ( [ ; ]( ; https://www.npmjs.com/package/js-conflux-sdk) ; )
6-
73JavaScript AnyWeb Software Development Kit is a complete library for interacting with the AnyChain in both Node.js and
84browser environment.
95
106Features:
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
3827Install 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
4837Use 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
7658or 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
8264or
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+
0 commit comments