Skip to content

Commit 0ce1578

Browse files
committed
Update README documentation with 0.2.0-alpha
1 parent e490d16 commit 0ce1578

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

README.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ This is a JS SDK is intended for browser based applications that need to interac
33

44
## Initialization
55
```
6-
npm i --save three0-js-sdk
6+
npm i --save @three0dev/js-sdk
77
```
88
## Usage
99
1. Import Three0 and prepare configuration
1010
```
11-
import init from 'three0-js-sdk'
11+
import { init } from '@three0dev/js-sdk'
1212
1313
const config = {
1414
"contractName": "myTestContract",
@@ -19,6 +19,7 @@ const config = {
1919
2. Initialize SDK
2020
- - - -
2121
### React
22+
#### React >=18
2223
```
2324
import React from 'react'
2425
import { createRoot } from 'react-dom/client'
@@ -30,6 +31,20 @@ init(config).then(() => {
3031
root.render(<App />)
3132
}).catch(console.error)
3233
```
34+
#### React <18
35+
```
36+
import React from 'react'
37+
import { render } from 'react-dom'
38+
import App from './App'
39+
40+
init(env.config)
41+
.then(() => {
42+
render(
43+
<App />,
44+
document.getElementById("root")
45+
);
46+
}).catch(console.error)
47+
```
3348
### Vue
3449
```
3550
import { createApp } from 'vue';
@@ -52,24 +67,22 @@ WIP: Pending Bug Fixes and CDN Compatibility
5267
## Services
5368
### Auth
5469
```
55-
import { login, logout, isloggedIn, getAccountId } from 'three0-js-sdk'
70+
import { Auth } from '@three0dev/js-sdk'
5671
```
57-
* `login():Promise<void>`
72+
* `Auth.login():Promise<void>`
5873
* Logs into dApp using NEAR Wallet
5974
* Creates new user on NEAR blockchain if user doesn't exist
60-
* `logout():Promise<void>`
75+
* `Auth.logout():Promise<void>`
6176
* Logs out of dApp
62-
* `isLoggedIn():boolean`
77+
* `Auth.isLoggedIn():boolean`
6378
* Returns `true` if user is logged in
64-
* `getAccountId():string`
79+
* `Auth.getAccountId():string`
6580
* Returns user account ID
6681
### Database
67-
82+
import { Database } from 'three0-js-sdk'
6883
#### **DocStore**:
6984
```
70-
import { DocStore } from 'three0-js-sdk'
71-
72-
const docstore = await DocStore([address])
85+
const docstore = await Database.DocStore([address])
7386
```
7487
* `docstore.get(key:string):any`
7588
* Gets value from docstore
@@ -88,9 +101,7 @@ const docstore = await DocStore([address])
88101
* Deletes value from docstore
89102
#### **KeyValue**:
90103
```
91-
import { KeyValue } from 'three0-js-sdk/database'
92-
93-
const keyvalue = await KeyValue([address])
104+
const keyvalue = await Database.KeyValue([address])
94105
```
95106
* `keyvalue.get(key:string):any`
96107
* Gets value from database
@@ -103,9 +114,7 @@ const keyvalue = await KeyValue([address])
103114
* Deletes value from database
104115
#### **Counter**:
105116
```
106-
import { Counter } from 'three0-js-sdk/database'
107-
108-
const counter = await Counter([address])
117+
const counter = await Database.Counter([address])
109118
```
110119
* `counter.get():number`
111120
* Gets current value of counter

0 commit comments

Comments
 (0)