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',
	}
	// ... 
}

Last updated