Chain Driver Interface

ChainDrivers are the heart and soul of BitBadges. They handle all chain-specific logic.

Interface Definition

https://blockin-labs.github.io/blockin/docs/interfaces/IChainDriver.html

Individual Functions

See Adding a New Chain for some notes on implementing ChainDriver functions.

Note that verifyAssets typically requires an API key of some sort, depending on how it is implemented. Also, assert your selected ChainDrivers can handle all the asset types and functionality you need for verification.

balancesSnapshot is an optional field to verifyAssets that allows you to pass in a snapshot of balances as opposed to fetching from the blockchain or an API. Make sure this is supported by your ChainDrivers.

For IDs (collections or assets) which are number based (such as BitBadges assets), you can use the UintRange<T> type. Otherwise, specify them as strings.

export interface AssetDetails<T extends NumberType> {
  chain: string,
  collectionId: T | string,
  assetIds: (string | UintRange<T>)[],
  ownershipTimes?: UintRange<T>[],
  mustOwnAmounts: UintRange<T>,
  additionalCriteria?: string,
}
{
  collectionId: "0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB",
  assetIds: ["15"],
  mustOwnAmounts: { start: 0, end: 0 },
  chain: 'Ethereum',
},
{
  collectionId: 1,
  assetIds: [{ start: 1, end: 1 }],
  mustOwnAmounts: { start: 0, end: 0 },
  chain: 'BitBadges',
}

Last updated