Charged Particles
  • What is Charged Particles
  • GETTING STARTED
    • Quick Start
  • CHARGED PARTICLES PROTOCOL
    • Protocol Overview
      • How It Works
      • Current Status
      • Protocol Revenue
      • Protocol Features
    • Why Use Charged Particles?
      • NFT Platforms And How They Differ
      • Charged Particles NFTs - What Are They?
    • How to Use Charged Particles
      • Minting an NFT
      • Energizing an NFT
      • Manage an NFT
      • Using A Test Network
      • Migrating Particles from V1 to V2
    • Developer Docs
      • System Overview
      • Quickstart
        • Read and Write to Contracts
        • Read from the Subgraph
        • Get Kovan ETH + ERC20s
        • VSCode Node.js Typescript Debugging
      • Smart Contracts
        • V2
          • Charged Particles Contract (V2)
          • Charged Settings Contract (V2)
          • Charged State Contract (V2)
          • ProtonB Contract
        • V1
          • Charged Particles Contract
          • Charged Settings Contract
          • Charged State Contract
          • Proton Contract
        • Error Codes
      • Protocol Subgraph
    • IONX
      • IONX Token Addresses
      • IONX Rewards
    • Web3 Packs
    • Liquidity Mining
      • Base Reward Program
      • Leptons
    • Protocol Governance
      • Governance Process
      • Creating a Proposal
      • Voting
      • Delegating Votes
    • Projects + Use Cases
    • Allowlist Application
    • Team
    • Guilds
    • Roadmap
    • Hackathons
      • Hackathon Ideas
      • Previous Hackathons
    • Dune Analytics
  • SDK
    • Charged Particles SDK Overview
    • Quick Start
    • API
    • Advanced Use
    • Types
    • Common Issues / FAQ
    • Common Terminology
  • RESOURCES
    • Hiring!
      • Full-stack/Back-end Web3 Engineer
      • Create Your Own Position
    • Glossary of Terms
    • FAQs
      • Protocol and app.charged.fi
      • Governance
      • Other
      • How to report a bug
    • External Contracts Allowlisted
    • Audits
    • Legal
      • Beta End User License Agreement (EULA)
      • Privacy Policy
      • Policies & Terms of Service
    • Media Kit
  • Additional Resources
    • Discord
    • Telegram
    • Twitter
    • Medium
    • Github
    • LinkedIn
    • Instagram
    • TikTok
Powered by GitBook
On this page
  • Example Usage
  • Network Object Structure

Was this helpful?

  1. SDK

Advanced Use

The SDK’s core functionality was built around certain work flows but we understand the need to go above and beyond. You can import all of our contract ABIs, and the addresses of said contracts on all of our supported networks.

You can see what contract and functions the SDK methods are utilizing in the documentation above.

(B) means we provide the non-B and B versions aka V1 and V2 respectively

ABIs Provided:

  • chargedParticles

  • chargedSettings

  • chargedState

  • chargedManagers

  • proton(B)

  • aaveWalletManager(B)

  • genericWalletManager(B)

  • genericBasketManager(B)

We also provide the contract locations (address + start block) for: Mainnet, Kovan, Polygon, Mumbai

Example Usage

import { ethers } from 'ethers';
import { mainnetAddresses, chargedParticlesAbi } from '@charged-particles/sdk';

const contract = new ethers.Contract(
	mainnet.chargedParticles.address,
	chargedParticlesAbi,
	ethers.getDefaultProvider()
);

const result = contract.getStateAddress();
console.log(result);
// 0x48974C6ae5A0A25565b0096cE3c81395f604140f
console.log(result == mainnetAddresses.chargedState.address);
// true

Network Object Structure

When looking for the contract’s address you will need to specify network, contract name, and then address or start block.

mainnetAddresses {
	chargedParticles: {
		address: 'xxx',
		startBlock: 'xxx',
	}
	// ... 
}
PreviousAPINextTypes

Last updated 2 years ago

Was this helpful?