import camelcaseKeys from 'camelcase-keys' ; import type Client from '../Client' ; interface TransactionVars { txnFeeMultiplier ? : number ; dcPayloadSize ? : number ; stakingFeeTxnAssertLocationV1 ? : number ; stakingFeeTxnAddGatewayV1 ? : number ; } export default class Vars { private client ! : Client ; private private TXN_VARS : string [ ] = [ 'txn_fee_multiplier' , 'dc_payload_size' , 'staking_fee_txn_assert_location_v1' , 'staking_fee_txn_add_gateway_v1' , ] ; private baseUrl = '/vars' ; constructor ( client ) { this . client = client ; } /**
     * Fetches the chain vars required to configure helium-js for blockchain transactions.
     */ async getTransactionVars ( ) { const { data : { data : vars } } = await this . client . get ( this . baseUrl , { keys : this . TXN_VARS . join ( ',' ) } ) ; return camelcaseKeys ( vars ) ; } /**
     * Fetches the specific chain vars passed in keys. If called without keys it will fetch the
     * transaction vars returned by  getTransactionVars .
     *  param keys async get ( keys = [ ] ) { if ( keys . length === 0 ) { return this . getTransactionVars ( ) ; } const { data : { data : vars } } = await this . client . get ( this . baseUrl , { keys : keys . join ( ',' ) } ) ; return camelcaseKeys ( vars ) ; } /**
     * WARNING: This will be return over 10 MB of data.
     * Fetches all chain vars.
     */ async getAll ( ) { const { data : { data : vars } } = await this . client . get ( this . baseUrl ) ; return camelcaseKeys ( vars ) ; } }