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. Self Hosted Checkout
  2. Components

Subbi Provider

PreviousComponentsNextButtons

Last updated 3 years ago

The SubbiProvider wraps your app at the root level and uses the to provide information to the hooks that Subbi components use. It has the following optional props:

network (optional):Defaults to 'polygon', currently the only options are 'polygon' or 'mumbai'

signer (optional): If you don't want Subbi to handle it's own connection to sign requests, then you can pass a signer in directly if you prefer.

Usage

An example of using both optional props might look like:

import { ethers } from "ethers";

const provider = window.ethereum; // Injected into the browser by Metamask or similar
const signer = new ethers.providers.Web3Provider(provider).getSigner();

<SubbiProvider
    network="poylgon"
    signer={signer}
>
    {children}
</SubbiProvider>
React Context API