Introduction

You may wish to completely build your own implementation, or perhaps make some server side calls to check certain properties on your deployed subscription contract. In that case it is probably best to interact directly with the contract.

Some great libraries for help interacting with contracts include:

At Subbi we use Ethers for most interaction with EVM compatible blockchains, but feel free to use whatever you want. As long as you have the Subscription ABI, you can interact with the contract directly with whichever web3 library and whatever UI/UX you wish.

An example with Ethers might look like:

import { ethers } from "ethers";

const subscriptionContractAddress = "0xadac08d7d5bf608d622a94bfab669b38fdc7bcb2";
const signer = new ethers.Wallet("private key of the wallet signing transactions");
const contract = new ethers.Contract(
    subscriptionContractAddress,
    [you will find the full ABI on the next page],
    signer // Can also just be an InfuraProvider for reading data
);

// Once you have your contract you can read information from the deployed subscription
// contract or sign transactions depending on the provider given as an argument when
// instantiating the contract.

const isSubscribed = await contract.isSubscribed("0xsomeuseraddresstocheck");

More information on creating Ethers contract instances can be found here.

Last updated