Initialise
In order to begin using NotVault within your TypeScript projects, you will need to initialise the library correctly. This initialisation process sets up the necessary connections and providers for the library's operations, particularly for interacting with IPFS and the Ethereum blockchain via JSON-RPC.
Environment Variables
Prior to initializing NotVault, you'll need to ensure the following environment variables are set:
PUBLIC_URL
PINATA_API_KEY
PINATA_SECRET_API_KEY
These are critical for the functioning of IPFS file operations and the connectivity with Pinata.
Initialization Steps
To initialise NotVault in a TypeScript environment, follow the steps below:
Import the necessary libraries:
Instantiate the NotVault class:
Create an JSON RPC connection:
Set up a new instance of
JsonRpcProvider
from theethers
library. You need to pass in your RPC Host URL to theJsonRpcProvider
constructor.Create a
signer
by creating a new instance of theWallet
class from theethers
library. Pass in your private key and the custom HttpProvider instance.
Initialise the vault object: Now, using the
.init
function of thevault
instance, pass in your Chain ID and thesigner
instance created in the previous step.
After successfully following these steps, your NotVault instance is set up and ready for file operations on IPFS and transactions on an EVM compatible blockchain.
Last updated