This SDK is designed to work with NodeWallet and provide easy, programmatic, statically-typed access to the user's account(s) and Pocket's RPC.
- SDK written in TypeScript which includes subset of Pocket JS
- SDK hooks for React
- React "Connect" button
- Submit stake transaction functionality
- NodeWallet backend updates to facilitate added SDK functionality
- Backwards compatibility with SendWallet
This is a NodeWallet SDK which will be written in TypeScript and modeled after the MetaMask SDK. On top of providing access to the user's selected account and chain, the NodeWallet SDK will provide a Pocket JS Provider. This provider will be a drop-in replacement for using Pocket JS directly, but rather than communicate over HTTP it will communicate via NodeWallet. This provider will include a large subset of the RPC methods available via Pocket JS with limited exclusions related to size (calls to get the full chain state are too big to go through the wallet), security (private keys are not made available to web pages, so they need to send transactions through the wallet rather than making direct calls to submit transactions), and relevance (calls to make relay requests to other chains is irrelevant for the web wallet). Anyone familiar with Pocket JS's provider library will be able to use NodeWallet's SDK.
Like MetaMask, the NodeWallet SDK will include React hooks. This functionality will amost exactly mirror MetaMask's React Hooks implementation which means that anyone familiar with MetaMask development will be able to easily use it. This strongly-typed hooks will make it simple to add wallet functionality into web applications.
Along with the hooks, the NodeWallet SDK will include a single connect button React UI element which can be addeed to web applications which will initiate the connection to the wallet. Using the connect button with the hooks, POKT functionality can be easily added to any web application.
NodeWallet currently only provides submit transaction functionality, but with the SDK we will be adding stake transaction functionality. This will allow sites to easily sumit stake transactions via NodeWallet. This will allow any staking companies to use NodeWallet to easily onboard users to their services while allowing users to retain control of their keys and coin.
The SDK updates will require a number of updates to the NodeWallet extension in order to facilitate the significantly expanded functionality. This updated functionality will be available via the global pocketNetwork
object added to all websites, but the recommending means of accessing it programmitically will be through the SDK.
SendWallet has significantly limited browser integration functionality. We will be careful to make the SDK backwards compatible with SendWallet, although the SDK's available functionality will be limited to that available via SendWallet's integration API. The connect button, React hooks, and standard API for access wallet functionality will be the same regardless of if the user is connecting via NodeWallet or SendWallet. Only the methods available via the Pocket JS provider will be limited.