@daocasino/dc-statistics-client
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.7 • Public • Published

    DC STATISTICS CLIENT

    To analyze your bankroller performance, you can deploy an optional statistics module.

    It collects: channel opening and closing data, player roll.

    It requires connecting to the statistics client library (see the procedure below).

    With this component in place, you can store analytical data. Also, you can request data from your server for front-end.

    INSTALLATION

    NPM

    npm i --save @daocasino/dc-statistics-client

    Yarn

    yarn add @daocasino/dc-statistics-client

    USAGE

    Import package

    import { DCStatisticClient } from '@daocasino/dc-statistics-client'
    

    Initialize new instance

    const statisticsClient = new DCStatisticClient({
        authKey: YOUR_KEY,
        host: 'http://127.0.0.1:4994',
        protocol: 'http'
    })
    

    You can also use ws as protocol

    const statisticsClient = new DCStatisticClient({
        authKey: YOUR_KEY,
        host: 'ws://127.0.0.1:4994',
        protocol: 'ws'
    })
    

    Collect

    this.statisticsClient
    .openChannel('0xTransactionHash', '0xUserAddress', 'dice')
    .catch((error) => {
      console.error(error)
    })
    
    this.statisticsClient
    .roll('0xTransactionHash', '0xUserAddress', 'dice', 20 /* bet value */)
    .catch((error) => {
      console.error(error)
    })
    
    this.statisticsClient
    .closeChannel('0xTransactionHash', '0xUserAddress', 'dice')
    .catch((error) => {
      console.error(error)
    })
    

    DEPENDENCIES

    This client is WS dependent.

    GET USER DATA

    You can get statistics in a simple way:

    curl http://127.0.0.1/statistics?userAddress=0xuserAddress
    

    Install

    npm i @daocasino/dc-statistics-client

    DownloadsWeekly Downloads

    2

    Version

    0.2.7

    License

    GPL-3.0

    Unpacked Size

    28.1 kB

    Total Files

    48

    Last publish

    Collaborators

    • whilesocold
    • dao-credentials
    • mixbytesgovyazin
    • algys
    • garik-