Skip to content

Wujerry/node-walrus

Repository files navigation

node-walrus

node-walrus is a JavaScript library for interacting with the Walrus blockchain. It provides a simple and intuitive API for developers to build decentralized applications (dApps).

Example

Demo site: https://node-walrus-example.vercel.app/

https://github.com/Wujerry/node-walrus-example

Features

  • Auto download Walrus bin
  • Api to interact with the Walrus blockchain
  • Typescript support
  • support vercel

Installation

To install Walrus-JS, use npm or yarn or pnpm:

npm install node-walrus
yarn add node-walrus
pnpm add node-walrus

Usage

Create a WalrusClient

const walrus = require('node-walrus')
const path = require('path')

// path to the walrus client config file
const walrusConfigPath = path.join(__dirname, 'client_config.yaml')
const suiWalletConfigPath = path.join(__dirname, 'sui_config.yaml')

const walrusClient = new walrus.WalrusClient(walrusConfigPath, suiWalletConfigPath)

Walrus Info

const walrusInfo = await walrusClient.getInfo()

Store blob

const res = await walrusClient.storeBlob('/path/to/file', { deletable: false })

Read blob

const res = await walrusClient.readBlobToPath('blobId', '/path/to/file')

Blob status

const res = await walrusClient.blobStatus({blobId: 'blobId'})
const res = await walrusClient.blobStatus({file: '/path/to/file'})

Delete blob

const res = await walrusClient.deleteBlob({blobId: 'blobId'})

List blobs

const res = await walrusClient.listBlobs()

About

Walrus-JS is a JavaScript library for interacting with the Walrus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published