Constructors
constructor
- new Harmony(url: string, config?: HarmonyConfig): Harmony
-
Parameters
-
url: string
-
Default value config: HarmonyConfig = {chainId: utils.defaultConfig.Default.Chain_ID,chainType: utils.defaultConfig.Default.Chain_Type,}
Methods
setChainId
- setChainId(chainId: utils.ChainID): void
-
Parameters
Returns void
setChainType
- setChainType(chainType: utils.ChainType): void
-
Parameters
-
chainType: utils.ChainType
Returns void
setProvider
-
Parameters
Returns void
setShardID
- setShardID(shardID: number): void
-
Parameters
Returns void
shardingStructures
- shardingStructures(shardingStructures: ShardingItem[]): void
-
Parameters
-
shardingStructures: ShardingItem[]
Returns void
Create a harmony instance
// import or require Harmony class const { Harmony } = require('@harmony-js/core'); // import or require settings const { ChainID, ChainType } = require('@harmony-js/utils'); // Initialize the Harmony instance const hmy = new Harmony( // rpc url: // local: http://localhost:9500 // testnet: https://api.s0.b.hmny.io/ // mainnet: https://api.s0.t.hmny.io/ 'http://localhost:9500', { // chainType set to Harmony chainType: ChainType.Harmony, // chainType set to HmyLocal chainId: ChainID.HmyLocal, }, );