Package Exports
- node-walrus
- node-walrus/dist/walrusClient.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-walrus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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-walrusUsage
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()