Sumer Docs
  • 👋Welcome to Sumer
  • Overview
    • 💡What we do
    • ✨Our Features
  • Fundamentals
    • 🛠️Getting set up
    • 💻DApp Starter Kit
  • Sumer SDK
    • 🚀Quickstart
  • API Reference
    • 👁️‍🗨️Overview
    • Alerts
    • Roles
    • Users
  • Support
    • ⁉️FAQs
    • 👩‍🔧Contact our Team
    • 😁Leave Feedback
  • Use Cases
    • ⛓️Web3 projects
  • References
    • 📖Privacy Policy
    • 🍪Cookie Policy
    • 📄Terms & Conditions
Powered by GitBook
On this page
  • 1. Install the SDK:
  • 2. Register your DApp:
  • 3. Import and initialize Sumer :
  • 4. Use Sumer:
  • Using wagmi.sh:
  • To observe the Smart Contracts
  • 5. Custom Observers:
  • Other Web3 provider libraries:

Was this helpful?

  1. Sumer SDK

Quickstart

Plug-and-play.

PreviousDApp Starter KitNextOverview

Last updated 1 year ago

Was this helpful?

Decentralized Applications can integrate SumerSDK to start tracking events, errors, and user actions all over in. Sumer prepares the collected data and users can inspect for insights and behavioral patterns.

1. Install the SDK:

npm i sumer-sdk
yarn add sumer-sdk

The allows RPC requests observing that may occur within a Decentralized Application while using an and interacting with the .

2. Register your DApp:

As described in the , register your DApp and get a unique key that will be used to identify your DApp and start tracking transactions and go on.

3. Import and initialize Sumer :

import { Sumer } from "sumer-sdk"
Sumer.init({ dappKey: 'YOUR_DAPP_KEY' })

4. Use Sumer:

The Sumer SDK currently has full support on , , and . Once integrated, all transactions activity will be captured and observed while being available for monitorization in the .

Once the SDK is initialized for Ethers and Web3-React integrations, you are set to go!

Using wagmi.sh:

For wagmi.sh implementations, use the Sumer.observe() method over the provider returned by the wagmi.configureChains() function:

import { WagmiConfig, createClient, configureChains } from 'wagmi'
import { MetaMaskConnector } from 'wagmi/connectors/metaMask'
import { Sumer } from 'sumer-sdk'

const { chains, provider, webSocketProvider } = configureChains(
  [mainnet],
  [publicProvider()],
)
const client = createClient({
  autoConnect: true,
  connectors: [
    new MetaMaskConnector({ chains }),
  ],
  provider: Sumer.observe(provider),
  webSocketProvider: Sumer.observe(webSocketProvider),
})

<WagmiConfig client={client}>
  <YourDappComponents />
</WagmiConfig>

To observe the Smart Contracts

In the case of contracts executions, use the static method Sumer.contract() from the Sumer Interface to observe an ethers.js contract instance:

// using ethers.js:
// const contract = new ethers.Contract(address, abi, signerOrProvider)

// whereas using Sumer:
const contract = Sumer.contract(address, abi, signerOrProvider)

// then use the contract as desired:
const tx = await contract.myFunction(...)

5. Custom Observers:

The SDK allows the developer to create an extended observer targeting the desired object:

import { Sumer, Observer, TargetExecution } from 'sumer-sdk';

class CustomObserver extends Observer {
  public async inspect(execution: TargetExecution): Promise<void> {
    // use execution object as needed
  }
}

// pass the CustomObserver to Sumer:
Sumer.init({ dappKey: 'YOUR_DAPP_KEY', observers: [new CustomObserver()] })

// or use the static observe method:
const observedTarget = Sumer.observe(target, [new CustomObserver()])

Other Web3 provider libraries:

If you want to use other web3 react hooks libraries, and you may have any trouble implementing it, please contact us to provide .

🚀
support
SumerSDK
Ethereum Provider
EVM
Wagmi
Ethers
Web3-React
Sumer App
Getting set up - Step 2