Merge pull request #302 from oxen-io/development

Merge to master
This commit is contained in:
Sean 2022-06-14 06:59:50 +09:30 committed by GitHub
commit 7bbfede014
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 22621 additions and 2095 deletions

24576
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "oxen-electron-wallet",
"version": "1.6.0",
"version": "1.7.0",
"description": "Modern GUI interface for Oxen Currency",
"productName": "Oxen Electron Wallet",
"repository": {
@ -63,7 +63,6 @@
"eslint-plugin-vue": "^5.2.3",
"husky": "^4.2.3",
"lint-staged": "^10.0.8",
"node-sass": "^4.13.1",
"prettier": "^1.19.1",
"sass-loader": "^7.1.0",
"strip-ansi": "^3.0.1"

View File

@ -165,7 +165,7 @@ module.exports = function() {
linux: {
target: ["AppImage", "deb"],
icon: "src-electron/icon.png",
icon: "oxen-electron-wallet.png",
category: "Finance"
},

View File

@ -13,7 +13,7 @@ const path = require("upath");
* The reason we are setting it here is that the path needs to be evaluated at runtime
*/
if (process.env.PROD) {
global.__statics = path.join(__dirname, "statics").replace(/\\/g, "\\\\");
global.__statics = path.join(__dirname, "").replace(/\\/g, "\\\\");
global.__ryo_bin = path.join(__dirname, "..", "bin").replace(/\\/g, "\\\\");
} else {
global.__ryo_bin = path.join(process.cwd(), "bin").replace(/\\/g, "\\\\");

View File

@ -288,7 +288,7 @@ export class Backend {
if (params.type === "tx") {
path = "tx";
} else if (params.type === "service_node") {
path = "service_node";
path = "sn";
}
if (path) {

View File

@ -25,6 +25,8 @@ export class WalletRPC {
password_hash: null,
balance: null,
unlocked_balance: null,
accrued_balance: null,
accrued_balance_next_payout: null,
onsRecords: []
};
this.isRPCSyncing = false;
@ -757,6 +759,8 @@ export class WalletRPC {
address: "",
balance: 0,
unlocked_balance: 0,
accrued_balance: 0,
accrued_balance_next_payout: 0,
height: 0,
view_only: false
},
@ -777,6 +781,9 @@ export class WalletRPC {
} else if (n.method == "getbalance") {
wallet.info.balance = n.result.balance;
wallet.info.unlocked_balance = n.result.unlocked_balance;
wallet.info.accrued_balance = n.result.accrued_balance;
wallet.info.accrued_balance_next_payout =
n.result.accrued_balance_next_payout;
} else if (n.method == "query_key") {
wallet.secret[n.params.key_type] = n.result.key;
if (n.params.key_type == "spend_key") {
@ -928,7 +935,10 @@ export class WalletRPC {
} else if (n.method == "getbalance") {
if (
this.wallet_state.balance == n.result.balance &&
this.wallet_state.unlocked_balance == n.result.unlocked_balance
this.wallet_state.unlocked_balance == n.result.unlocked_balance &&
this.wallet_state.accrued_balance == n.result.accrued_balance &&
this.wallet_state.accrued_balance_next_payout ==
n.result.accrued_balance_next_payout
) {
continue;
}
@ -936,6 +946,10 @@ export class WalletRPC {
this.wallet_state.balance = wallet.info.balance = n.result.balance;
this.wallet_state.unlocked_balance = wallet.info.unlocked_balance =
n.result.unlocked_balance;
this.wallet_state.accrued_balance = wallet.info.accrued_balance =
n.result.accrued_balance;
this.wallet_state.accrued_balance_next_payout = wallet.info.accrued_balance_next_payout =
n.result.accrued_balance_next_payout;
this.sendGateway("set_wallet_data", {
info: wallet.info
});
@ -2115,7 +2129,10 @@ export class WalletRPC {
info: {
address: data[0].result.address,
balance: data[1].result.balance,
unlocked_balance: data[1].result.unlocked_balance
unlocked_balance: data[1].result.unlocked_balance,
accrued_balance: data[1].result.accrued_balance,
accrued_balance_next_payout:
data[1].result.accrued_balance_next_payout
// num_unspent_outputs: data[1].result.num_unspent_outputs
},
address_list: {
@ -2879,6 +2896,8 @@ export class WalletRPC {
password_hash: null,
balance: null,
unlocked_balance: null,
accrued_balance: null,
accrued_balance_next_payout: null,
onsRecords: []
};

View File

@ -0,0 +1,35 @@
<template>
<span> {{ value }} </span>
</template>
<script>
export default {
name: "FormatNextPayout",
props: {
payoutBlock: {
type: Number,
required: true
},
currentBlock: {
type: Number,
required: true
}
},
computed: {
value() {
console.log(this.payoutBlock);
console.log(this.currentBlock);
if (this.payoutBlock == 0) return "";
let blocks = this.payoutBlock - this.currentBlock;
console.log(this.currentBlock);
if (blocks > 720) return (blocks / 720).toFixed(1) + " days";
else if (blocks > 30) return (blocks / 30).toFixed(1) + " hours";
else return blocks * 2 + " minutes";
}
}
};
</script>
<style></style>

View File

@ -32,7 +32,7 @@
<img class="q-mb-md" src="oxen.svg" height="42" />
<p class="q-my-sm">Wallet Version: v{{ version }}</p>
<p class="q-my-sm">Deaemon Version: v{{ daemonVersion }}</p>
<p class="q-my-sm">Daemon Version: v{{ daemonVersion }}</p>
<p class="q-my-sm">Copyright (c) 2018-2021, Oxen</p>
<p class="q-my-sm">Copyright (c) 2018, Ryo Currency Project</p>
<p class="q-my-sm">All rights reserved.</p>

View File

@ -40,7 +40,7 @@ export default {
ons_status: state => state.gateway.ons_status,
unlocked_balance: state => state.gateway.wallet.info.unlocked_balance,
disable_submit_button() {
const minBalance = this.updating ? 0.05 : 8;
const minBalance = this.updating ? 0.05 : 7.1;
return this.unlocked_balance < minBalance * 1e9;
},
submit_label() {

View File

@ -8,19 +8,46 @@
<div class="row justify-center">
<div class="funds column items-center">
<div class="balance">
<div class="text">
<span>{{ $t("strings.oxenBalance") }}</span>
</div>
<q-btn-toggle
v-model="balancestakeselector"
text-color="white"
toggle-text-color="primary"
flat
:options="[
{
label: $t('strings.oxenBalance'),
value: 'balance'
},
{
label: $t('strings.stake'),
value: 'stake'
}
]"
/>
<div class="value">
<span><FormatOxen :amount="info.balance"/></span>
</div>
</div>
<div class="row unlocked">
<div v-if="balancestakeselector != 'stake'" class="row unlocked">
<span
>{{ $t("strings.oxenUnlockedShort") }}:
<FormatOxen :amount="info.unlocked_balance"
/></span>
</div>
<div v-if="balancestakeselector == 'stake'" class="row unlocked">
<span v-if="info.accrued_balance > 0"
>{{ $t("strings.oxenAccumulatedRewards") }}:
<FormatOxen :amount="info.accrued_balance" />
{{ $t("strings.nextPayout") }}:
<FormatNextPayout
:payout-block="info.accrued_balance_next_payout"
:current-block="info.height"
/>
</span>
<span v-if="info.accrued_balance == 0">
No accumulated rewards from staking
</span>
</div>
</div>
</div>
<div class="wallet-address row justify-center items-center">
@ -34,19 +61,26 @@
<script>
import { mapState } from "vuex";
import FormatOxen from "components/format_oxen";
import FormatNextPayout from "components/format_next_payout";
import WalletSettings from "components/menus/wallet_settings";
import CopyIcon from "components/icons/copy_icon";
export default {
name: "WalletDetails",
components: {
FormatOxen,
FormatNextPayout,
WalletSettings,
CopyIcon
},
computed: mapState({
theme: state => state.gateway.app.config.appearance.theme,
info: state => state.gateway.wallet.info
})
}),
data() {
return {
balancestakeselector: "balance"
};
}
};
</script>

View File

@ -423,8 +423,7 @@ footer,
.header-popover {
background: $primary;
color: white;
background: white;
max-width: 250px !important;
}

View File

@ -20,7 +20,7 @@ export class Gateway extends EventEmitter {
let theme = LocalStorage.has("theme")
? LocalStorage.getItem("theme")
: "dark";
: "light";
this.app.store.commit("gateway/set_app_data", {
config: {
appearance: {

View File

@ -504,6 +504,7 @@ export default {
destinationUnknown: "Destination Unknown",
editAddressBookEntry: "Edit address book entry",
expirationHeight: "Expiration height",
nextPayout: "Next payout",
ons: {
sessionID: "Session ID",
wallet: "Wallet Address",
@ -519,6 +520,7 @@ export default {
oxenBalance: "Balance",
lokinetNameDescription:
"Purchase or update a name on Lokinet. If you purchase a name it may take a minute or two for it to show up in the list. To learn more about lokinet visit: ",
oxenAccumulatedRewards: "Accumulated rewards",
oxenUnlockedBalance: "Unlocked balance",
oxenUnlockedShort: "Unlocked",
me: "Me",
@ -575,6 +577,7 @@ export default {
signAndVerifyDescription:
"Sign data with your primary address's private key or verify a signature against a public address.",
spendKey: "Spend key",
stake: "Staking",
startingDaemon: "Starting daemon",
startingWallet: "Starting wallet",
switchToDateSelect: "Switch to date select",

View File

@ -22,8 +22,13 @@ export default {
if (minContributionAtomicUnits === 0 && node.contributors.length < MAX_NUMBER_OF_CONTRIBUTORS) {
const openContributionRemaining = this.openForContribution(node);
let contributors_length = 0;
for (const contributor of node.contributors) {
contributors_length = contributors_length + contributor.locked_contributions.length;
}
minContributionAtomicUnits = openContributionRemaining /
(MAX_NUMBER_OF_CONTRIBUTORS - node.contributors.length);
(MAX_NUMBER_OF_CONTRIBUTORS - contributors_length);
}
const minContributionOxen = minContributionAtomicUnits / 1e9;

View File

@ -166,11 +166,9 @@ export default {
},
cancel: {
flat: true,
label: this.$t("dialog.buttons.cancel"),
color: this.theme === "dark" ? "white" : "dark"
label: this.$t("dialog.buttons.cancel")
},
dark: this.theme == "dark",
color: "positive"
color: "primary"
});
passwordPromise
.onOk(() => {

View File

@ -10,6 +10,8 @@ export const resetWalletData = state => {
height: 0,
balance: 0,
unlocked_balance: 0,
accrued_balance: 0,
accrued_balance_next_payout: 0,
view_only: false
},
secret: {

View File

@ -33,6 +33,8 @@ export default {
height: 0,
balance: 0,
unlocked_balance: 0,
accrued_balance: 0,
accrued_balance_next_payout: 0,
view_only: false
},
secret: {