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

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

2. Register your DApp:

As described in the Getting set up - Step 2, 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 Wagmi, Ethers, and Web3-React. Once integrated, all transactions activity will be captured and observed while being available for monitorization in the Sumer App.

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(
const client = createClient({
  autoConnect: true,
  connectors: [
    new MetaMaskConnector({ chains }),
  provider: Sumer.observe(provider),
  webSocketProvider: Sumer.observe(webSocketProvider),

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

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.

Last updated