@spacetimexyz/client
TypeScript icon, indicating that this package has built-in type declarations

0.2.4 • Public • Published

Spacetime Client (Browser/Node)

A client to connect to the Spacetime decentralized database.

Install Spacetime

npm install @spacetimexyz/spacetime
yarn add @spacetimexyz/spacetime

Initialize the SDK

import Spacetime from '@spacetimexyz/spacetime'

const db = new Spacetime({
  ...config
})

Get a single record

You can read data once, by calling the .doc(id: string).get() method on a collection.

const colRef = db.collection("org/places")
const record = await colRef.doc("id").get()

const { id, ...data } = record

Write data

const colRef = db.collection("org/places")
const doc = await colRef.doc("london").set({
  name: "London",
  country: "UK",
})

Tests

To run E2E tests, ensure that Spacetime is running, and then run:

yarn test:e2e

Readme

Keywords

none

Package Sidebar

Install

npm i @spacetimexyz/client

Weekly Downloads

4

Version

0.2.4

License

MIT

Unpacked Size

99.9 kB

Total Files

53

Last publish

Collaborators

  • mateuszmlc
  • calum.moore