@harmony-js/core
Advanced tools
Comparing version 0.1.23 to 0.1.24
@@ -5,2 +5,3 @@ import { HttpProvider, WSProvider, Messenger, ShardingItem } from '@harmony-js/network'; | ||
import { ContractFactory } from '@harmony-js/contract'; | ||
import { HarmonyConfig } from './util'; | ||
export declare enum ExtensionType { | ||
@@ -36,3 +37,3 @@ MathWallet = "MathWallet" | ||
defaultShardID?: number; | ||
constructor(wallet: ExtensionInterface); | ||
constructor(wallet: ExtensionInterface, config?: HarmonyConfig); | ||
setProvider(provider: string | HttpProvider | WSProvider): void; | ||
@@ -39,0 +40,0 @@ setShardID(shardID: number): void; |
@@ -15,3 +15,7 @@ "use strict"; | ||
var HarmonyExtension = /** @class */ (function () { | ||
function HarmonyExtension(wallet) { | ||
function HarmonyExtension(wallet, config) { | ||
if (config === void 0) { config = { | ||
chainId: utils.defaultConfig.Default.Chain_ID, | ||
chainType: utils.defaultConfig.Default.Chain_Type, | ||
}; } | ||
this.extensionType = null; | ||
@@ -26,4 +30,4 @@ this.wallet = wallet; | ||
else { | ||
this.provider = new network_1.Provider(wallet.network.chain_url).provider; | ||
this.messenger = new network_1.Messenger(this.provider, "hmy" /* Harmony */, 0 /* Default */); | ||
this.provider = new network_1.Provider(config.chainUrl || wallet.network.chain_url).provider; | ||
this.messenger = new network_1.Messenger(this.provider, config.chainType, config.chainId); | ||
} | ||
@@ -30,0 +34,0 @@ this.wallet.messenger = this.messenger; |
@@ -933,3 +933,7 @@ /** | ||
var HarmonyExtension = /** @class */ (function () { | ||
function HarmonyExtension(wallet) { | ||
function HarmonyExtension(wallet, config) { | ||
if (config === void 0) { config = { | ||
chainId: utils.defaultConfig.Default.Chain_ID, | ||
chainType: utils.defaultConfig.Default.Chain_Type, | ||
}; } | ||
this.extensionType = null; | ||
@@ -944,4 +948,4 @@ this.wallet = wallet; | ||
else { | ||
this.provider = new network.Provider(wallet.network.chain_url).provider; | ||
this.messenger = new network.Messenger(this.provider, "hmy" /* Harmony */, 0 /* Default */); | ||
this.provider = new network.Provider(config.chainUrl || wallet.network.chain_url).provider; | ||
this.messenger = new network.Messenger(this.provider, config.chainType, config.chainId); | ||
} | ||
@@ -948,0 +952,0 @@ this.wallet.messenger = this.messenger; |
@@ -7,3 +7,3 @@ /** | ||
import * as utils from '@harmony-js/utils'; | ||
import { assertObject, defaultConfig, HarmonyCore, Unit, hexToNumber } from '@harmony-js/utils'; | ||
import { assertObject, defaultConfig, HarmonyCore, hexToNumber, Unit } from '@harmony-js/utils'; | ||
import * as crypto from '@harmony-js/crypto'; | ||
@@ -933,3 +933,7 @@ import { getAddress } from '@harmony-js/crypto'; | ||
var HarmonyExtension = /** @class */ (function () { | ||
function HarmonyExtension(wallet) { | ||
function HarmonyExtension(wallet, config) { | ||
if (config === void 0) { config = { | ||
chainId: defaultConfig.Default.Chain_ID, | ||
chainType: defaultConfig.Default.Chain_Type, | ||
}; } | ||
this.extensionType = null; | ||
@@ -944,4 +948,4 @@ this.wallet = wallet; | ||
else { | ||
this.provider = new Provider(wallet.network.chain_url).provider; | ||
this.messenger = new Messenger(this.provider, "hmy" /* Harmony */, 0 /* Default */); | ||
this.provider = new Provider(config.chainUrl || wallet.network.chain_url).provider; | ||
this.messenger = new Messenger(this.provider, config.chainType, config.chainId); | ||
} | ||
@@ -948,0 +952,0 @@ this.wallet.messenger = this.messenger; |
@@ -928,3 +928,7 @@ /** | ||
var HarmonyExtension = /** @class */ (function () { | ||
function HarmonyExtension(wallet) { | ||
function HarmonyExtension(wallet, config) { | ||
if (config === void 0) { config = { | ||
chainId: utils.defaultConfig.Default.Chain_ID, | ||
chainType: utils.defaultConfig.Default.Chain_Type, | ||
}; } | ||
this.extensionType = null; | ||
@@ -939,4 +943,4 @@ this.wallet = wallet; | ||
else { | ||
this.provider = new network.Provider(wallet.network.chain_url).provider; | ||
this.messenger = new network.Messenger(this.provider, "hmy" /* Harmony */, 0 /* Default */); | ||
this.provider = new network.Provider(config.chainUrl || wallet.network.chain_url).provider; | ||
this.messenger = new network.Messenger(this.provider, config.chainType, config.chainId); | ||
} | ||
@@ -943,0 +947,0 @@ this.wallet.messenger = this.messenger; |
{ | ||
"name": "@harmony-js/core", | ||
"version": "0.1.23", | ||
"version": "0.1.24", | ||
"description": "harmony core package", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@harmony-js/account": "0.1.23", | ||
"@harmony-js/account": "0.1.24", | ||
"@harmony-js/contract": "0.1.23", | ||
@@ -29,3 +29,3 @@ "@harmony-js/crypto": "0.1.23", | ||
}, | ||
"gitHead": "3dbcc4b173e690f08cc0c4e632aab65454babd50" | ||
"gitHead": "504f5416d2c57baa22053f67ff3333c52f2c0ced" | ||
} |
@@ -16,2 +16,3 @@ import { | ||
import { ContractFactory } from '@harmony-js/contract'; | ||
import { HarmonyConfig } from './util'; | ||
@@ -58,3 +59,9 @@ export enum ExtensionType { | ||
constructor(wallet: ExtensionInterface) { | ||
constructor( | ||
wallet: ExtensionInterface, | ||
config: HarmonyConfig = { | ||
chainId: utils.defaultConfig.Default.Chain_ID, | ||
chainType: utils.defaultConfig.Default.Chain_Type, | ||
}, | ||
) { | ||
this.extensionType = null; | ||
@@ -64,2 +71,3 @@ this.wallet = wallet; | ||
this.isExtension(this.wallet); | ||
if (wallet.messenger) { | ||
@@ -69,4 +77,4 @@ this.provider = wallet.messenger.provider; | ||
} else { | ||
this.provider = new Provider(wallet.network.chain_url).provider; | ||
this.messenger = new Messenger(this.provider, utils.ChainType.Harmony, utils.ChainID.Default); | ||
this.provider = new Provider(config.chainUrl || wallet.network.chain_url).provider; | ||
this.messenger = new Messenger(this.provider, config.chainType, config.chainId); | ||
} | ||
@@ -73,0 +81,0 @@ this.wallet.messenger = this.messenger; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
495285
5738
+ Added@harmony-js/account@0.1.24(transitive)
- Removed@harmony-js/account@0.1.23(transitive)
Updated@harmony-js/account@0.1.24