Merge branch 'master' into ui-2

This commit is contained in:
Jaco Greeff 2017-05-16 17:03:17 +02:00
commit f7ea667140
4 changed files with 39 additions and 3 deletions

2
Cargo.lock generated
View File

@ -1783,7 +1783,7 @@ dependencies = [
[[package]]
name = "parity-ui-precompiled"
version = "1.4.0"
source = "git+https://github.com/paritytech/js-precompiled.git#1be3eaa4cefa85e25b48ac5e8cf579c92108e562"
source = "git+https://github.com/paritytech/js-precompiled.git#05e0ea878ee54bed2e62a5f434663706bdf1919e"
dependencies = [
"parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

View File

@ -1,6 +1,6 @@
{
"name": "parity.js",
"version": "1.7.75",
"version": "1.7.76",
"main": "release/index.js",
"jsnext:main": "src/index.js",
"author": "Parity Team <admin@parity.io>",

View File

@ -16,6 +16,38 @@
import WalletsUtils from './wallets';
/**
* The sender is by default (when the UI loads) the
* default dapp address. It can then be modified when
* sending transactions....
*/
let currentSender = '';
let hasCurrentSenderChanged = false;
export function getSender () {
currentSender;
}
export function loadSender (api) {
// If the current sender has been changed
// then don't bother checking changes of the
// default sender
if (hasCurrentSenderChanged) {
return Promise.resolve(currentSender);
}
return api.parity.getNewDappsDefaultAddress()
.then((defaultAccount) => {
currentSender = defaultAccount;
return defaultAccount;
});
}
export function setSender (sender) {
currentSender = sender;
hasCurrentSenderChanged = true;
}
export function trackRequest (api, options, statusCallback) {
const { requestId, transactionHash } = options;
const txHashPromise = transactionHash

View File

@ -27,7 +27,11 @@ let component;
let onClose;
function createApi () {
api = {};
api = {
parity: {
getNewDappsDefaultAddress: sinon.stub().resolves('')
}
};
return api;
}