evelynnmimijae / web3-plugin-faucettestnet2

web3.js plugin (second attempt). Original code and idea placed second in the ChainSafe Ideathon bounty category in LearnWeb3's D.I. Hackathon.
https://msha.ke/faucetplugin
0 stars 0 forks source link

Extend `Web3PluginBase` #3

Open SantiagoDevRel opened 2 months ago

SantiagoDevRel commented 2 months ago

https://github.com/evelynnmimijae/web3-plugin-faucettestnet2/blob/16ddfb5d79c41898243a5625fc8567529cafbeb6/src/index.ts#L24

Don't forget that for creating plugins we must extend from the Web3PluginBase module

import { Web3PluginBase } from "web3" 
//and I saw you imported the web3 module but is actually not needed here, i'll add some other issues for you to understand why isn't needed🧡

export class FaucetPlugin extends Web3PluginBase {}
evelynnmimijae commented 2 months ago

Ok, I think I got it...?

import { Web3PluginBase } from "web3";

export class FaucetPlugin extends Web3PluginBase { public pluginNamespace = "faucet"; public web3: Web3;

SantiagoDevRel commented 2 months ago

Right! by extending the Web3PluginBase you will be able to use the this inside the plugin!