#BAP CHALLENGE PRODUCT
##GET STARTED
###With challenge In order to use this package, first of all, you need to install
npm i bap-challenge
Create instance from bap-challenge , for example :
const BAP = require('bap-challenge')
First, you need to have instance of ChallengeService class,using https://rinkeby.infura.io/ for web3 provider:
let service = new BAP.ChallengeService(provider,contractAddress1)
let serviceChallengeWithToken = new BAP.ChallengeWithTokenService(provider,contractAddress2)
let serviceToken = new BAP.TanimotoTokenService(provider,contractAddress3)
Get challenge info :
await service.getChallengeInfo();
Ex result : { challengeCleared: '2', challengeDayRequired: '10', daysRemained: '8', isFinished: false }
Get challenge state info :
await service.getChallengeStateInfo();
Ex result : 4
Get token name :
await serviceToken.getTokenName();
Ex result : Tanimoto Token
Get token transfer history of an address :
await serviceToken.getHistoryOf("0xA75B2d7b277919c224B198743C88EfE608BA8c1e");
Ex result :
[ { blockNumber: 7769802,
timestamp: 1608726013,
from: '0x0000000000000000000000000000000000000000',
to: '0xA75B2d7b277919c224B198743C88EfE608BA8c1e',
value: '50000000000000000000' },
{ blockNumber: 7769806,
timestamp: 1608726073,
from: '0x0000000000000000000000000000000000000000',
to: '0xA75B2d7b277919c224B198743C88EfE608BA8c1e',
value: '2000000000000000000' },
{ blockNumber: 7769812,
timestamp: 1608726164,
from: '0xA75B2d7b277919c224B198743C88EfE608BA8c1e',
to: '0xd3DA58a12ec671e5e48D76A13B64be08377DdAc8',
value: '500000000000000000' },
{ blockNumber: 7769814,
timestamp: 1608726194,
from: '0xA75B2d7b277919c224B198743C88EfE608BA8c1e',
to: '0xE869661135D518636FCFF739164D00C601cEFe0B',
value: '700000000000000000' } ]