Plug's Inpage Provider is an Internet Computer Provider API package that is injected into the browser so that developers can call/interact with Plug. Allowing for integration, authentication, and handling of in-app transactions.
The Plug Inpage Provider package is in the Github Package Registry and not in the NPM Registry!
This is important to note as we keep our projects under the @Psychedelic organisation on Github, our official channel for our projects.
yarn add @psychedelic/plug-inpage-provider
To pull and install the Plug Connect package from @Psychedelic via the NPM CLI, you'll need:
-
A personal access token (you can create a personal acess token here)
-
The personal access token with the correct scopes, repo and read:packages to be granted access to the GitHub Package Registry.
-
Authentication via
npm login
, using your Github email for the username and the personal access token as your password:
Once you have those ready, run:
npm login --registry=https://npm.pkg.github.com --scope=@Psychedelic
Note: You only need to configure this once to install the package! On npm login provide your Github email as your username and the Personal access token as the password.
You can also setup your npm global settings to fetch from the Github registry everytime it finds a @Psychdelic package, find the instructions here.
Set your project to fetch @Psychdelic packages from the correct registry, if you haven't setup your npm globals to do this automatically you need an npmrc
file.
Create the .npmrc
in the root of your project by:
touch .npmrc
Open the file and put the following content:
@psychedelic:registry=https://npm.pkg.github.com
You can now import the PlugConnect package:
import Provider from '@psychedelic/plug-inpage-provider';