🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@spheron/fvm-deal-utils

Package Overview
Dependencies
Maintainers
5
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@spheron/fvm-deal-utils

Typescript library for creating deal parameters for creating a FVM storage deal.

unpublished
latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
5
Created
Source

Spheron

FVM Deal Utils SDK

đź§° SDK to create storage deals on FVM, powered by Spheron.

getFvmMetadata Example

In the example below you can see how to create an instance of SpheronDealClient and how to generate the metadata required for creating a storage deal on FVM.

const {
  SpheronDealClient,
  DealDataResult,
} = require("@spheron/fvm-deal-utils");

const client = new SpheronDealClient({ token });

let currentlyUploaded = 0;
const result: DealDataResult = await client.getFvmMetadata(filePath, {
  name,
  onUploadInitiated: (uploadId) => {
    console.log(`Upload with id ${uploadId} started...`);
  },
  onChunkUploaded: (uploadedSize, totalSize) => {
    currentlyUploaded += uploadedSize;
    console.log(`Uploaded ${currentlyUploaded} of ${totalSize} Bytes.`);
  },
});
  • The response of the getFvmMetadata function is an object with the following properties:
    • pieceSize - the size of the file in bytes
    • size - the size of the CAR file in bytes
    • pieceCid - hash of the piece in hex
    • dataCid - IPFS hash of the car file
    • carLink - the IPFS URL of the generated car file.
    • carName - the name of the car
    • uploadId - the id of the upload on which the car was uploaded

Access Token

To create the token that is used with the SpheronClient, follow the instructions in the DOCS. When you are creating the tokens, please choose web app type in the dashboard.

Notes

The package is only meant for Node.js environments and will not work in a browser or frontend apps.

Learn More

You can learn more about Spheron and Storage SDK here:

Keywords

Storage

FAQs

Package last updated on 22 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts