SDK
Last updated
Last updated
The sub2 SDK is a Node library to interact with the sub2 protocol in a typescript/javascript environment. It is built with and contains functionality that makes it easy to integrate sub2 as a receiver of subscription payments among other features. The implementation can be found .
Interactions requiring querying on-chain data require the user to supply a viem public client. Some functionality like canceling a subscription or generating a sponsor signature requires the user to additionally supply a viem wallet client.
The SDK can be installed through npm.
After installation, the SDK contains a class called Sub2SDK which can be initialized as follows:
Now you are ready to start interacting with the sub2 protocol!
Careful: Remember to never store your private key and RPC URL in plain text in your project. We recommend creating and using a .env file.