web3-plugin-ipfs-registry
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

web3-plugin-ipfs-registry

This is a plugin for uploading files into ipfs, and registering them in a smart contract, built with web3.js v4 plugin.

How to use

  1. Instantiate web3
const provider = new HttpProvider(
  "https://endpoints.omniatech.io/v1/eth/sepolia/public",
);
// const provider = new HttpProvider("HTTP://127.0.0.1:7545"); // Provider for Ganache environment
const web3 = new Web3(provider);
  1. Register plugin for use
web3.registerPlugin(new IPFSRegistryPlugin());
  1. Call the upload function
export const _upload = async (): Promise<UploadReturnData> => {
  return await web3.ipfsRegistry.upload("src/usage.ts");
};
  1. Fetch uploaded CIDs
export const getCids = async (): Promise<void> => {
  await web3.ipfsRegistry.listCids(
    "0x8B90d90F2867D52878483B42bcA591F9Efe2931b",
  );
};
  1. Run test (This runs the E2E test on both node and browser environment)
yarn run test:all
  1. Run build.
yarn run build

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i web3-plugin-ipfs-registry

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

19.4 kB

Total Files

31

Last publish

Collaborators

  • gifted