Skip to content

Commit

Permalink
Feat/docker (#506)
Browse files Browse the repository at this point in the history
* feat: add doc store

* feat: merge sdk into db3

* fix: fix the contract test case

* fix: fix the test case

* fix: add protobuf generator

* fix: add protobuf generator

* feat: add record arweave tx to smart contract

* fix: fix the case

* feat: add new readme

* fix: remove the test large case

* feat: add arch png

* feat: update docker cd

* feat: update sdk

* feat: remove some unused file

* feat: remove pages
  • Loading branch information
imotai committed Jun 25, 2023
1 parent 2c73f71 commit e4c3b80
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 83 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/pages.yml

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ DB3 Network is a lightweight, permanent JSON document database for Web3. It is d
## Set up self-hosted Node

```shell

sudo docker run -p 26639:26639 -p 26619:26619 -p 26629:26629 \
-e ADMIN_ADDR=0xF78c...29679 \
-it imotai/db3:v0.3.11
Expand Down Expand Up @@ -61,7 +60,7 @@ const {id} = await addDoc(collection, {
// query the document
const resultSet = await queryDoc<Book>(collection, "/[author=Cixin-Liu]")
```
you can go to [sdk](https://dbpunk-labs.github.io/db3.js/) for more
you can go to [sdk](https://docs.db3.network/) for more

# How it works

Expand Down
Empty file added docker/pages/.gitkeep
Empty file.
76 changes: 15 additions & 61 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,68 +16,22 @@ yarn add db3.js

## Use db3.js in action

```ts

```typescript
// create a account
const account = createRandomAccount()
const client = createClient('http://127.0.0.1:26619', '', account)
const nonce = await syncAccountNonce(client)
// create a database
const { db, result } = await createDocumentDatabase(client, 'desc')
const index: Index = {
path: '/name',
indexType: IndexType.StringKey,
}
// create a collection
const { collection, result } = await createCollection(
db,
'col',
[index]
)
// add a document
const [txId, block, order] = await addDoc(collection, {
name: 'book1',
author: 'db3 developers',
tag:'web3',
time: 1686285013,
})
// query document
const query = '/[name = book1]'
const resultSet = await queryDoc<Book>(
collection,
query)
```

## Show Your Support
Please ⭐️ this repository if this project helped you!
// create the client
const client = createClient('http://127.0.0.1:26619',
'http://127.0.0.1:26639',
account)

// get the collection
const collection = await getCollection("0xF7..79", "book", client)

# Contribution

## 1. Checkout

```shell
git clone https://github.com/dbpunk-labs/db3.js.git
git submodule update --recursive
```

## 2. Run DB3 Localnet

```shell
cd tools && bash start_localnet.sh
```

## 3. Run Testcase

```shell
git submodule update
# install the dependency
yarn
# generate the protobuf
make
# run test
yarn test
# format the code
yarn prettier --write src
# run benchmark
yarn benny-sdk
// add a document
const {id} = await addDoc(collection, {
name:"The Three-Body Problem"
author:"Cixin-Liu",
rate:"4.8"} as Book)
// query the document
const resultSet = await queryDoc<Book>(collection, "/[author=Cixin-Liu]")
```

0 comments on commit e4c3b80

Please sign in to comment.