Interface IChainDriver<T>

This interface attempts to define all the chain-specific functionality needed for this library. Any blockchain that wants to use Blockin will implement this interface with its own custom logic.

All chain-specific functions depend on a valid chain driver being set. We export some already implemented ChainDriver classes from this library for your convenience. You may also choose to implement your own.

For example in Blockin's sample demo site, we call setDriver(new AlgoDriver('Mainnet', API_KEY)), and once this is called, all other functions will use the implemented functions for Algorand defined in AlgoDriver

interface IChainDriver {
    isValidAddress: IIsValidAddress;
    verifyAssets: IVerifyAssets<T>;
    verifySignature: IVerifySignature;
}

Type Parameters

  • T extends NumberType

Hierarchy

Properties

isValidAddress: IIsValidAddress

Checks if an address is well-formed.

verifyAssets: IVerifyAssets<T>

Verifies user owns enough of certain assets by querying the public blockchain.

Note that resources can be either URIs or prefixed with 'Asset ID: '. This implementation must parse and only look at the assets, not URIs.

Verifies an address owns enough of all specified resources. Should ignore every resource that doesn't start with 'Asset ID: '. Defaults to succeeding if user has a balance of >= 1 for every asset.

assetMinimumBalancesRequiredMap is optional, but here, one can define a JSON object mapping of 'assetIDs' => minimumBalances. If assetMinimumBalancesRequiredMap[assetId] exists, it will check that the user owns more than the specified minimum balance. If not defined, will use the default.

defaultMinimum is optional, but here, you can specify a new default minimum for all assets to fallback on if not defined in assetMinimumBalancesRequiredMap. Default is normally set to check if user owns >= 1.

verifySignature: IVerifySignature

Verifies a signature is signed correctly by an address

Generated using TypeDoc