Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gift-stack/web3-plugin-ipfs-registry
Web3.js Plugin that have two main functions for uploading a provided local file to IPFS, then store the CID in a smart contract, and another function for listing all stored CIDs of given ethereum address.
https://github.com/gift-stack/web3-plugin-ipfs-registry
chainsafe ipfs web3js
Last synced: about 2 months ago
JSON representation
Web3.js Plugin that have two main functions for uploading a provided local file to IPFS, then store the CID in a smart contract, and another function for listing all stored CIDs of given ethereum address.
- Host: GitHub
- URL: https://github.com/gift-stack/web3-plugin-ipfs-registry
- Owner: Gift-Stack
- Created: 2023-11-13T22:16:55.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-14T18:33:55.000Z (about 1 year ago)
- Last Synced: 2024-11-15T22:09:22.832Z (2 months ago)
- Topics: chainsafe, ipfs, web3js
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/web3-plugin-ipfs-registry
- Size: 158 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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
------------
TL;DR: The `usage.ts` file has it implemented already!! 🚀1. Instantiate `web3`
```javascript
const provider = new HttpProvider(
"https://ethereum-sepolia.publicnode.com",
);
// const provider = new HttpProvider("HTTP://127.0.0.1:7545"); // Provider for Ganache environment
const web3 = new Web3(provider);
```
Here are a list of supported RPCs:
```javascript
["https://ethereum-sepolia.publicnode.com", "https://endpoints.omniatech.io/v1/eth/sepolia/public", "https://rpc.sepolia.org", "https://sepolia.gateway.tenderly.co"]
```
There are more rpcs [here](https://chainlist.org/chain/11155111)2. Register plugin for use
```javascript
web3.registerPlugin(new IPFSRegistryPlugin());
```3. Call the upload function
```javascript
export const _upload = async (): Promise => {
return await web3.ipfsRegistry.upload("src/usage.ts");
};
```4. Fetch uploaded CIDs
```javascript
export const getCids = async (): Promise => {
await web3.ipfsRegistry.listCids(
"0x8B90d90F2867D52878483B42bcA591F9Efe2931b",
);
};```
5. Run test (This runs the E2E test on both node and browser environment)
```sql
yarn run test:all
```7. Run build.
```sql
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](https://choosealicense.com/licenses/mit/)