Skip to content

Commit

Permalink
Merge branch 'master' into mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpne committed Nov 5, 2020
2 parents b014eed + d5e26df commit 57162d3
Show file tree
Hide file tree
Showing 13 changed files with 625 additions and 562 deletions.
13 changes: 10 additions & 3 deletions api/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function getBalance(addressHash) {
/**
* @typedef {Object} BalanceItem
* @property {number|string} amount
* @property {CoinItem} coin
* @property {Coin} coin
*/


Expand Down Expand Up @@ -94,6 +94,13 @@ export function getCoinList() {
}));
}


/**
* @typedef {Object} Coin
* @property {number} id
* @property {string} symbol
*/

/**
* @typedef {Object} CoinItem
* @property {number} id
Expand All @@ -120,7 +127,7 @@ export function getAddressStakeList(address) {
* @property {string} [address]
* @property {string|number} value
* @property {string|number} bipValue
* @property {string} coin
* @property {Coin} coin
* @property {boolean} isWaitlisted
*/

Expand Down Expand Up @@ -148,7 +155,7 @@ export function getValidatorList() {
* @property {string|number} [stake]
* @property {string|number} [part]
* @property {number} [delegatorCount]
* @property {Array<{coin: string, value: string, address: string}>} [delegatorList]
* @property {Array<{coin: Coin, value: string, address: string}>} [delegatorList]
*/


Expand Down
45 changes: 30 additions & 15 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,25 @@ export function login(data) {
* @return {Promise<User>}
*/
export function getProfile() {
return accounts.get('profile')
.then((response) => response.data.data);
return accounts.getProfile();
}


export function updateProfile(profile) {
return accounts.updateProfile(profile);
}

export function updateProfilePassword(oldPasswordToStore, newPasswordToStore) {
return accounts.updateProfilePassword(oldPasswordToStore, newPasswordToStore);
}

/**
* @param {Blob|File} avatar
* @return {Promise<UserAvatar>}
*/
export function updateProfileAvatar(avatar) {
return accounts.updateProfileAvatar(avatar);
}



Expand All @@ -45,25 +59,23 @@ export function getProfile() {
* @return {Promise<[Address]>}
*/
export function getProfileAddressList() {
return accounts.get('addresses')
.then((response) => response.data.data.map(markSecured));
return accounts.getProfileAddressList();
}

export function getProfileAddressEncrypted(id) {
return accounts.get('addresses/' + id + '/encrypted')
.then((response) => markSecured(response.data.data));
return accounts.getProfileAddressEncrypted(id);
}

export function addProfileAddress(address) {
return accounts.post('addresses', address);
return accounts.addProfileAddress(address);
}

export function setMainProfileAddress(id) {
return accounts.put('addresses/' + id, {isMain: true});
return accounts.updateProfileAddress(id, {isMain: true});
}

export function deleteProfileAddress(id) {
return accounts.delete('addresses/' + id);
return accounts.deleteProfileAddress(id);
}

/**
Expand All @@ -74,12 +86,15 @@ export function deleteProfileAddress(id) {
* @return {Promise<Object>}
*/
export function getAddressInfo(params, cancelToken) {
return accounts
.get('info/address/by/contact', {
params,
cancelToken,
})
.then((response) => response.data.data);
return accounts.getAddressInfoByContact(params, {cancelToken});
}

/**
* @param {Array<string>} addressList
* @return {Promise<Array<UserInfo>>}
*/
export function getAddressListInfo(addressList) {
return accounts.getAddressListInfo(addressList);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions assets/less/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ td, th {
.footer__menu {width: 100%; text-align: center;}
.footer__menu-item {
font-size: 14px; font-weight: 700; display: inline-block;
&::after {content: '|'; /* mid spaces U+2005, bc. last regular space not preserved */ margin: 0 3px;}
&::after {content: '·'; /* mid spaces U+2005, bc. last regular space not preserved */ margin: 0 3px;}
&:last-child::after {content: none;}
}
@media (min-width: @breakpoint-large-up) {
Expand Down Expand Up @@ -354,6 +354,6 @@ td, th {
.multisig-signature__remove {margin-left: 10px; flex-shrink: 0; margin-top: 14px;}


.reinvest__textarea {width: 100%; padding: 4px 8px; border: 1px solid @c-border; border-radius: 10px;}
.reinvest__textarea {width: 100%; padding: 4px 8px; border: 1px solid @c-border; border-radius: 10px; overflow: auto;}
.reinvest__upload-textarea {max-height: 200px;}

2 changes: 1 addition & 1 deletion assets/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export function suggestionValidatorFilter(suggestion, query) {
if (!query) {
return true;
}
return [suggestion.value, suggestion.name].some((item) => ~item.toLowerCase().indexOf(query.toLowerCase()));
return [suggestion.value, suggestion.name].some((item) => item?.toLowerCase().includes(query.toLowerCase()));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions components/ValidatorReinvestForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
const signedTx = prepareSignedTx({
...txParams,
nonce,
}, {privateKey}).serialize().toString('hex');
}, {privateKey}).serializeToString();
result.push(signedTx);
nonce++;
}
Expand All @@ -176,7 +176,7 @@
this.form.data.stake = null;
this.form.gasPrice = '';
if (this.form.nonce && this.$store.getters.isOfflineMode) {
this.form.nonce += this.formTxCount;
this.form.nonce = Number(this.form.nonce) + Number(this.formTxCount);
} else {
this.form.nonce = '';
}
Expand Down
6 changes: 1 addition & 5 deletions components/common/FieldDomain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@
}
return this.$store.state.validatorList.map((item) => {
let name = '';
if (item.meta && item.meta.name) {
name = item.meta.name;
}
return {name, value: item.publicKey};
return {name: item.name || '', value: item.publicKey};
});
},
},
Expand Down
2 changes: 1 addition & 1 deletion components/common/FieldQr.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<VueSimpleSuggest
v-bind="$attrs"
:value="value"
:list="suggestionList"
:list="suggestionList.slice(0)"
:max-suggestions="$options.MAX_ITEM_COUNT"
:min-length="suggestionMinInputLength"
:filter-by-query="true"
Expand Down
26 changes: 18 additions & 8 deletions components/common/TxForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@
beforeShowPromise = Promise.resolve();
}
beforeShowPromise.then(() => {
this.isConfirmModalVisible = true;
if (this.$store.getters.isOfflineMode) {
this.submit();
} else {
this.isConfirmModalVisible = true;
}
}).catch((e) => {
console.log(e);
});
Expand All @@ -255,14 +259,20 @@
},
generateTx() {
let tx;
if (!this.form.multisigAddress) {
// private key to sign
tx = prepareTx(this.getTxParams(), {privateKey: this.$store.getters.privateKey});
} else {
// address to make proof for RedeemCheck
tx = prepareTx(this.getTxParamsMultisigData(), {address: this.form.multisigAddress});
try {
if (!this.form.multisigAddress) {
// private key to sign
tx = prepareTx(this.getTxParams(), {privateKey: this.$store.getters.privateKey});
} else {
// address to make proof for RedeemCheck
tx = prepareTx(this.getTxParamsMultisigData(), {address: this.form.multisigAddress});
}
} catch (error) {
console.log(error);
this.serverError = error.message;
return;
}
this.signedTx = tx.serialize().toString('hex');
this.signedTx = tx.serializeToString();
this.clearForm();
},
postTx() {
Expand Down
6 changes: 5 additions & 1 deletion desktop/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ async function initNuxt() {
}
config.rootDir = path.resolve(__dirname, '..');
config.dev = false;
config.mode = 'spa';
config.ssr = false;
config.telemetry = false;
config.dir = {
static: 'dist',
};
Expand Down Expand Up @@ -88,8 +89,10 @@ app.on('before-quit', () => {
// });

app.on('activate', () => {
// console.log('activate');
// macOS style
if (mainWindow === null) {
isReadyToClose = false;
createWindow();
}
});
Expand Down Expand Up @@ -139,6 +142,7 @@ function createWindow() {
// await mainWindow.webContents.session.flushStorageData()
if (vuex && !vuex.auth.advanced && !vuex.auth.password) {
await mainWindow.webContents.session.clearStorageData();
// console.log('clear')

// looks like `clearStorageData` works well and no need to delete files
// deleteLogs(app);
Expand Down
4 changes: 3 additions & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const scriptCSP = NUXT_LOADING_INLINE_SCRIPT_SHA.map((item) => {

export default {
ssr: false,
telemetry: false,
/*
** Headers of the page
*/
Expand Down Expand Up @@ -200,7 +201,8 @@ export default {
],
],
plugins: [
// "@babel/plugin-proposal-optional-chaining",
//@TODO remove when https://github.com/nuxt/nuxt.js/issues/7722 will be fixed
"@babel/plugin-proposal-optional-chaining",
],
// prevent @babel/plugin-transform-runtime from inserting `import` statement into commonjs files (bc. it breaks webpack)
sourceType: 'unambiguous',
Expand Down
Loading

0 comments on commit 57162d3

Please sign in to comment.