@harmony-js/account
Advanced tools
Comparing version 0.1.57 to 0.1.58
@@ -34,3 +34,5 @@ "use strict"; | ||
this.addressCount = addressCount; | ||
this.getHdWallet(menmonic || HDNode.generateMnemonic()); | ||
if (menmonic !== null && menmonic !== '') { | ||
this.getHdWallet(menmonic || HDNode.generateMnemonic()); | ||
} | ||
this.gasLimit = gasLimit; | ||
@@ -197,3 +199,3 @@ this.gasPrice = gasPrice; | ||
var foundIndex = this.addresses.findIndex(function (value) { return value === address; }); | ||
this.addresses.slice(foundIndex, foundIndex + 1); | ||
this.addresses.splice(foundIndex, 1); | ||
this.addresses.unshift(address); | ||
@@ -200,0 +202,0 @@ }; |
{ | ||
"name": "@harmony-js/account", | ||
"version": "0.1.57", | ||
"version": "0.1.58", | ||
"description": "account and wallet for harmony", | ||
@@ -21,10 +21,10 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@harmony-js/core": "0.1.57", | ||
"@harmony-js/crypto": "0.1.56", | ||
"@harmony-js/network": "0.1.56", | ||
"@harmony-js/staking": "0.1.56", | ||
"@harmony-js/transaction": "0.1.56", | ||
"@harmony-js/utils": "0.1.56" | ||
"@harmony-js/core": "0.1.58", | ||
"@harmony-js/crypto": "0.1.58", | ||
"@harmony-js/network": "0.1.58", | ||
"@harmony-js/staking": "0.1.58", | ||
"@harmony-js/transaction": "0.1.58", | ||
"@harmony-js/utils": "0.1.58" | ||
}, | ||
"gitHead": "99a827782fabcd5f91f025af0d8de228956d42b4" | ||
"gitHead": "5eddd0feb2bfe92c36b194fe0a9ffe40f8173d6c" | ||
} |
@@ -99,3 +99,5 @@ /** | ||
this.addressCount = addressCount; | ||
this.getHdWallet(menmonic || HDNode.generateMnemonic()); | ||
if (menmonic !== null && menmonic !== '') { | ||
this.getHdWallet(menmonic || HDNode.generateMnemonic()); | ||
} | ||
this.gasLimit = gasLimit; | ||
@@ -155,2 +157,3 @@ this.gasPrice = gasPrice; | ||
} | ||
// tslint:disable-next-line: ban-types | ||
@@ -171,2 +174,3 @@ getPrivateKey(address: string, cb?: Function) { | ||
} | ||
// tslint:disable-next-line: ban-types | ||
@@ -244,2 +248,3 @@ async signTransaction(txParams: any | Web3TxPrams) { | ||
} | ||
getAddress(idx?: number) { | ||
@@ -252,5 +257,7 @@ if (!idx) { | ||
} | ||
getAddresses() { | ||
return this.addresses; | ||
} | ||
addByPrivateKey(privateKey: string) { | ||
@@ -266,5 +273,5 @@ const account = new Account(privateKey); | ||
const foundIndex = this.addresses.findIndex((value) => value === address); | ||
this.addresses.slice(foundIndex, foundIndex + 1); | ||
this.addresses.splice(foundIndex, 1); | ||
this.addresses.unshift(address); | ||
} | ||
} |
@@ -7,2 +7,3 @@ /** | ||
import fetch from 'jest-fetch-mock'; | ||
import { Account } from '../src/account'; | ||
@@ -17,2 +18,12 @@ import { HttpProvider, Messenger } from '@harmony-js/network'; | ||
it('test Account.getBalance returns object that implements Balance interface', () => { | ||
fetch.mockResponses( | ||
[ | ||
JSON.stringify({"jsonrpc": "2.0", "id": 1, "result": "0x166c690f33421e"}), | ||
{ status: 200 } | ||
], | ||
[ | ||
JSON.stringify({"jsonrpc": "2.0", "id": 1, "result": "0x106"}), | ||
{ status: 200 } | ||
] | ||
); | ||
const acc = Account.new(); | ||
@@ -19,0 +30,0 @@ acc.setMessenger(messenger); |
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
582914
43
7527
+ Added@harmony-js/contract@0.1.58(transitive)
+ Added@harmony-js/core@0.1.58(transitive)
+ Added@harmony-js/crypto@0.1.58(transitive)
+ Added@harmony-js/network@0.1.58(transitive)
+ Added@harmony-js/staking@0.1.58(transitive)
+ Added@harmony-js/transaction@0.1.58(transitive)
+ Added@harmony-js/utils@0.1.58(transitive)
+ Addedscrypt@6.0.3(transitive)
+ Addedscrypt.js@0.3.0(transitive)
+ Addedscryptsy@1.2.1(transitive)
- Removed@harmony-js/account@0.1.56(transitive)
- Removed@harmony-js/contract@0.1.56(transitive)
- Removed@harmony-js/core@0.1.560.1.57(transitive)
- Removed@harmony-js/crypto@0.1.56(transitive)
- Removed@harmony-js/network@0.1.56(transitive)
- Removed@harmony-js/staking@0.1.56(transitive)
- Removed@harmony-js/transaction@0.1.56(transitive)
- Removed@harmony-js/utils@0.1.56(transitive)
Updated@harmony-js/core@0.1.58
Updated@harmony-js/crypto@0.1.58
Updated@harmony-js/network@0.1.58
Updated@harmony-js/staking@0.1.58
Updated@harmony-js/utils@0.1.58