- Run lint checker:
yarn lint
- Run tests:
yarn test
- Build sdk:
yarn build
- Install the sdk:
npm install @thebadge/sdk
or
yarn add @thebadge/sdk
- Initialize sdk instance:
const sdkInstance = new TheBadgeSDK(
// check if your chain id is supported with TheBadgeSDK.isChainSupported(chainId)
chainId, // chain id numeric value
// configuration object
{
// read only provider
rpcProviderConfig: {
// your desired provider: 'infura' or 'alchemy'
name: 'infura',
// your infura/alchemy apiKey
apiKey: '00000000000000',
},
// OPTIONAL: web3Provider instance, needed for write methods e.g. mint badge
web3Provider,
// OPTIONAL: use dev mode (relevant only on testnets where qa env is default),
// default value: false
devMode: true,
}
)
Get the list of supported chain ids:
TheBadgeSDK.getSupportedChainIds()
Check if a chain is supported:
TheBadgeSDK.isChainSupported(chainId)
// chainId is a number, for example: 1, 5, etc