Subbi
  • What is Subbi?
  • Getting Started
    • Setting up your first subscription
    • Supported tokens
    • Contract links
  • Hosted Checkout
    • Introduction
    • Configuring URLs
  • Self Hosted Checkout
    • Installation
    • Components
      • Subbi Provider
      • Buttons
        • Metamask Button
        • Approve Button
        • Subscribe Button
        • Cancel Button
      • Checkout Flow
    • Hooks
  • Direct contract interaction
    • Introduction
    • Contract ABIs
  • Extras
    • Fee sharing
Powered by GitBook
On this page
  1. Direct contract interaction

Introduction

PreviousHooksNextContract ABIs

Last updated 3 years ago

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 , 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 .

Ethers (Javascript)
Web3 (Javascript)
Web3Py (Python)
Subscription ABI
here