packageDocumentation module import * as crypto from '@harmony-js/crypto' ; import * as utils from '@harmony-js/utils' ; import { Provider , HttpProvider , Messenger , WSProvider , ShardingItem } from '@harmony-js/network' ; import { TransactionFactory , Transaction } from '@harmony-js/transaction' ; import { StakingTransaction , StakingFactory } from '@harmony-js/staking' ; import { ContractFactory , Contract } from '@harmony-js/contract' ; import { Wallet , Account } from '@harmony-js/account' ; import { Blockchain } from './blockchain' ; import { HarmonyConfig } from './util' ; export class Harmony extends utils . HarmonyCore { ignore Modules = { HttpProvider , WSProvider , Messenger , Blockchain , TransactionFactory , StakingFactory , Wallet , Transaction , StakingTransaction , Account , Contract , } ; ignore messenger : Messenger ; ignore transactions : TransactionFactory ; ignore stakings : StakingFactory ; ignore wallet : Wallet ; ignore blockchain : Blockchain ; ignore contracts : ContractFactory ; ignore crypto : any ; ignore utils : any ; ignore defaultShardID ? : number ; ignore private provider : HttpProvider | WSProvider ; param url param config example constructor ( url , config = { chainId : utils . defaultConfig . Default . Chain_ID , chainType : utils . defaultConfig . Default . Chain_Type , } ) { super ( config . chainType , config . chainId ) ; const providerUrl = config . chainUrl || url || utils . defaultConfig . Default . Chain_URL ; this . provider = new Provider ( providerUrl ) . provider ; this . messenger = new Messenger ( this . provider , this . chainType , this . chainId ) ; this . blockchain = new Blockchain ( this . messenger ) ; this . transactions = new TransactionFactory ( this . messenger ) ; this . stakings = new StakingFactory ( this . messenger ) ; this . wallet = new Wallet ( this . messenger ) ; this . contracts = new ContractFactory ( this . wallet ) ; this . crypto = crypto ; this . utils = utils ; this . defaultShardID = config . shardID ; if ( this . defaultShardID !== undefined ) { this . setShardID ( this . defaultShardID ) ; } } param provider example public setProvider ( provider ) { this . provider = new Provider ( provider ) . provider ; this . messenger . setProvider ( this . provider ) ; this . setMessenger ( this . messenger ) ; } hint param chainId example public setChainId ( chainId ) { this . chainId = chainId ; this . messenger . setChainId ( this . chainId ) ; this . setMessenger ( this . messenger ) ; } example public setShardID ( shardID ) { this . defaultShardID = shardID ; this . messenger . setDefaultShardID ( this . defaultShardID ) ; this . setMessenger ( this . messenger ) ; } param chainType example public setChainType ( chainType ) { this . chainType = chainType ; this . messenger . setChainType ( this . chainType ) ; this . setMessenger ( this . messenger ) ; } param shardingStructures example public shardingStructures ( shardingStructures ) { for ( const shard of shardingStructures ) { const shardID = typeof shard . shardID === 'string' ? Number . parseInt ( shard . shardID , 10 ) : shard . shardID ; this . messenger . shardProviders . set ( shardID , { current : shard . current !== undefined ? shard . current : false , shardID , http : shard . http , ws : shard . ws , } ) ; } this . setMessenger ( this . messenger ) ; } ignore private setMessenger ( messenger ) { this . blockchain . setMessenger ( messenger ) ; this . wallet . setMessenger ( messenger ) ; this . transactions . setMessenger ( messenger ) ; this . stakings . setMessenger ( messenger ) ; } }