Merge pull request #269 from darcys22/ons_rebrand

Ons Rebrand
This commit is contained in:
kylezs 2021-04-06 14:46:46 +10:00 committed by GitHub
commit 2d1188f2ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 243 additions and 200 deletions

View File

@ -484,14 +484,14 @@ export class Daemon {
});
}
async getLNSRecordsForOwners(owners) {
async getONSRecordsForOwners(owners) {
if (!Array.isArray(owners) || owners.length === 0) {
return [];
}
// only 256 addresses allowed in this call
let ownersMax = owners.slice(0, 256);
const data = await this.sendRPC("lns_owners_to_names", {
const data = await this.sendRPC("ons_owners_to_names", {
entries: ownersMax
});
if (!data.hasOwnProperty("result")) return [];
@ -506,10 +506,10 @@ export class Daemon {
};
});
return this._sanitizeLNSRecords(recordsWithOwners);
return this._sanitizeONSRecords(recordsWithOwners);
}
async getLNSRecord(nameHash) {
async getONSRecord(nameHash) {
if (!nameHash || nameHash.length === 0) {
return null;
}
@ -525,16 +525,16 @@ export class Daemon {
]
};
const data = await this.sendRPC("lns_names_to_owners", params);
const data = await this.sendRPC("ons_names_to_owners", params);
if (!data.hasOwnProperty("result")) return null;
const entries = this._sanitizeLNSRecords(data.result.entries);
const entries = this._sanitizeONSRecords(data.result.entries);
if (entries.length === 0) return null;
return entries[0];
}
_sanitizeLNSRecords(records) {
_sanitizeONSRecords(records) {
return (records || []).map(record => {
// Record type is in uint16 format
// Session = 0

View File

@ -18,14 +18,14 @@ export class WalletRPC {
this.id = 0;
this.net_type = "mainnet";
this.heartbeat = null;
this.lnsHeartbeat = null;
this.onsHeartbeat = null;
this.wallet_state = {
open: false,
name: "",
password_hash: null,
balance: null,
unlocked_balance: null,
lnsRecords: []
onsRecords: []
};
this.isRPCSyncing = false;
this.dirs = null;
@ -253,7 +253,7 @@ export class WalletRPC {
break;
case "decrypt_record": {
const record = await this.decryptLNSRecord(params.type, params.name);
const record = await this.decryptONSRecord(params.type, params.name);
this.sendGateway("set_decrypt_record_result", {
record,
decrypted: !!record
@ -353,8 +353,8 @@ export class WalletRPC {
!!params.isSweepAll
);
break;
case "purchase_lns":
this.purchaseLNS(
case "purchase_ons":
this.purchaseONS(
params.password,
params.type,
params.name,
@ -363,11 +363,11 @@ export class WalletRPC {
params.backup_owner || ""
);
break;
case "lns_renew_mapping":
this.lnsRenewMapping(params.password, params.type, params.name);
case "ons_renew_mapping":
this.onsRenewMapping(params.password, params.type, params.name);
break;
case "update_lns_mapping":
this.updateLNSMapping(
case "update_ons_mapping":
this.updateONSMapping(
params.password,
params.type,
params.name,
@ -864,11 +864,11 @@ export class WalletRPC {
}, 5000);
this.heartbeatAction(true);
clearInterval(this.lnsHeartbeat);
this.lnsHeartbeat = setInterval(() => {
this.updateLocalLNSRecords();
clearInterval(this.onsHeartbeat);
this.onsHeartbeat = setInterval(() => {
this.updateLocalONSRecords();
}, 30 * 1000); // Every 30 seconds
this.updateLocalLNSRecords();
this.updateLocalONSRecords();
}
heartbeatAction(extended = false) {
@ -969,7 +969,7 @@ export class WalletRPC {
});
}
async updateLocalLNSRecords() {
async updateLocalONSRecords() {
try {
const addressData = await this.sendRPC(
"get_address",
@ -988,12 +988,12 @@ export class WalletRPC {
const addresses = results.map(a => a.address).filter(a => !!a);
if (addresses.length === 0) return;
const records = await this.backend.daemon.getLNSRecordsForOwners(
const records = await this.backend.daemon.getONSRecordsForOwners(
addresses
);
// We need to ensure that we decrypt any incoming records that we already have
const currentRecords = this.wallet_state.lnsRecords;
const currentRecords = this.wallet_state.onsRecords;
const recordsToUpdate = { ...this.purchasedNames };
const newRecords = records.map(record => {
// If we have a new record or we haven't decrypted our current record then we should return the new record
@ -1023,13 +1023,13 @@ export class WalletRPC {
};
});
this.wallet_state.lnsRecords = newRecords;
this.wallet_state.onsRecords = newRecords;
// fetch the known (cached) records from the wallet and add the data
// to the records being set in state
let known_names = await this.lnsKnownNames();
let known_names = await this.onsKnownNames();
// Fill the necessary decrypted values of the cached LNS names
// Fill the necessary decrypted values of the cached ONS names
for (let r of newRecords) {
for (let k of known_names) {
if (k.hashed === r.name_hash) {
@ -1040,31 +1040,31 @@ export class WalletRPC {
}
}
this.sendGateway("set_wallet_data", { lnsRecords: newRecords });
this.sendGateway("set_wallet_data", { onsRecords: newRecords });
// Decrypt the records serially
let updatePromise = Promise.resolve();
for (const [name, type] of Object.entries(recordsToUpdate)) {
updatePromise = updatePromise.then(() => {
this.decryptLNSRecord(type, name);
this.decryptONSRecord(type, name);
});
}
} catch (e) {
console.debug("Something went wrong when updating lns records: ", e);
console.debug("Something went wrong when updating ons records: ", e);
}
}
/*
Get the LNS records cached in this wallet.
Get the ONS records cached in this wallet.
*/
async lnsKnownNames() {
async onsKnownNames() {
try {
let params = {
decrypt: true,
include_expired: false
};
let data = await this.sendRPC("lns_known_names", params);
let data = await this.sendRPC("ons_known_names", params);
if (data.result && data.result.known_names) {
return data.result.known_names;
@ -1078,11 +1078,11 @@ export class WalletRPC {
}
/*
Renews an LNS (Lokinet) mapping, since they can expire
Renews an ONS (Lokinet) mapping, since they can expire
type can be:
lokinet_1y, lokinet_2y, lokinet_5y, lokinet_10y
*/
lnsRenewMapping(password, type, name) {
onsRenewMapping(password, type, name) {
let _name = name.trim().toLowerCase();
// the RPC accepts names with the .loki already appeneded only
@ -1099,7 +1099,7 @@ export class WalletRPC {
"sha512",
(err, password_hash) => {
if (err) {
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: -1,
i18n: "notification.errors.internalError",
sending: false
@ -1107,7 +1107,7 @@ export class WalletRPC {
return;
}
if (!this.isValidPasswordHash(password_hash)) {
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: -1,
i18n: "notification.errors.invalidPassword",
sending: false
@ -1120,12 +1120,12 @@ export class WalletRPC {
name: _name
};
this.sendRPC("lns_renew_mapping", params).then(data => {
this.sendRPC("ons_renew_mapping", params).then(data => {
if (data.hasOwnProperty("error")) {
let error =
data.error.message.charAt(0).toUpperCase() +
data.error.message.slice(1);
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: -1,
message: error,
sending: false
@ -1135,9 +1135,9 @@ export class WalletRPC {
this.purchasedNames[name.trim()] = type;
setTimeout(() => this.updateLocalLNSRecords(), 5000);
setTimeout(() => this.updateLocalONSRecords(), 5000);
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: 0,
i18n: "notification.positive.nameRenewed",
sending: false
@ -1148,21 +1148,21 @@ export class WalletRPC {
}
/*
Get our LNS record and update our wallet state with decrypted values.
Get our ONS record and update our wallet state with decrypted values.
This will return `null` if the record is not in our currently stored records.
*/
async decryptLNSRecord(type, name) {
async decryptONSRecord(type, name) {
let _type = type;
// type can initially be "lokinet_1y" etc. on a purchase
if (type.startsWith("lokinet")) {
_type = "lokinet";
}
try {
const record = await this.getLNSRecord(_type, name);
const record = await this.getONSRecord(_type, name);
if (!record) return null;
// Update our current records with the new decrypted record
const currentRecords = this.wallet_state.lnsRecords;
const currentRecords = this.wallet_state.onsRecords;
const isOurRecord = currentRecords.find(
c => c.name_hash === record.name_hash
);
@ -1177,7 +1177,7 @@ export class WalletRPC {
const params = {
names: [_record]
};
this.sendRPC("lns_add_known_names", params);
this.sendRPC("ons_add_known_names", params);
}
const newRecords = currentRecords.map(current => {
@ -1186,19 +1186,19 @@ export class WalletRPC {
}
return current;
});
this.wallet_state.lnsRecords = newRecords;
this.sendGateway("set_wallet_data", { lnsRecords: newRecords });
this.wallet_state.onsRecords = newRecords;
this.sendGateway("set_wallet_data", { onsRecords: newRecords });
return record;
} catch (e) {
console.debug("Something went wrong decrypting lns record: ", e);
console.debug("Something went wrong decrypting ons record: ", e);
return null;
}
}
/*
Get a LNS record associated with the given name
Get a ONS record associated with the given name
*/
async getLNSRecord(type, name) {
async getONSRecord(type, name) {
// We currently only support session and lokinet
const types = ["session", "lokinet"];
if (!types.includes(type)) return null;
@ -1212,14 +1212,14 @@ export class WalletRPC {
fullName = fullName + ".loki";
}
const nameHash = await this.hashLNSName(type, lowerCaseName);
const nameHash = await this.hashONSName(type, lowerCaseName);
if (!nameHash) return null;
const record = await this.backend.daemon.getLNSRecord(nameHash);
const record = await this.backend.daemon.getONSRecord(nameHash);
if (!record || !record.encrypted_value) return null;
// Decrypt the value if possible
const value = await this.decryptLNSValue(
const value = await this.decryptONSValue(
type,
fullName,
record.encrypted_value
@ -1232,7 +1232,7 @@ export class WalletRPC {
};
}
async hashLNSName(type, name) {
async hashONSName(type, name) {
if (!type || !name) return null;
let fullName = name;
@ -1241,7 +1241,7 @@ export class WalletRPC {
}
try {
const data = await this.sendRPC("lns_hash_name", {
const data = await this.sendRPC("ons_hash_name", {
type,
name: fullName
});
@ -1255,12 +1255,12 @@ export class WalletRPC {
return (data.result && data.result.name) || null;
} catch (e) {
console.debug("Failed to hash lns name: ", e);
console.debug("Failed to hash ons name: ", e);
return null;
}
}
async decryptLNSValue(type, name, encrypted_value) {
async decryptONSValue(type, name, encrypted_value) {
if (!type || !name || !encrypted_value) return null;
let fullName = name;
@ -1269,7 +1269,7 @@ export class WalletRPC {
}
try {
const data = await this.sendRPC("lns_decrypt_value", {
const data = await this.sendRPC("ons_decrypt_value", {
type,
name: fullName,
encrypted_value
@ -1284,7 +1284,7 @@ export class WalletRPC {
return (data.result && data.result.value) || null;
} catch (e) {
console.debug("Failed to decrypt lns value: ", e);
console.debug("Failed to decrypt ons value: ", e);
return null;
}
}
@ -1784,7 +1784,7 @@ export class WalletRPC {
crypto.pbkdf2(password, this.auth[2], 1000, 64, "sha512", cryptoCallback);
}
purchaseLNS(password, type, name, value, owner, backupOwner) {
purchaseONS(password, type, name, value, owner, backupOwner) {
let _name = name.trim().toLowerCase();
const _owner = owner.trim() === "" ? null : owner;
const backup_owner = backupOwner.trim() === "" ? null : backupOwner;
@ -1804,7 +1804,7 @@ export class WalletRPC {
"sha512",
(err, password_hash) => {
if (err) {
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: -1,
i18n: "notification.errors.internalError",
sending: false
@ -1812,7 +1812,7 @@ export class WalletRPC {
return;
}
if (!this.isValidPasswordHash(password_hash)) {
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: -1,
i18n: "notification.errors.invalidPassword",
sending: false
@ -1828,12 +1828,12 @@ export class WalletRPC {
value
};
this.sendRPC("lns_buy_mapping", params).then(data => {
this.sendRPC("ons_buy_mapping", params).then(data => {
if (data.hasOwnProperty("error")) {
let error =
data.error.message.charAt(0).toUpperCase() +
data.error.message.slice(1);
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: -1,
message: error,
sending: false
@ -1844,9 +1844,9 @@ export class WalletRPC {
this.purchasedNames[name.trim()] = type;
// Fetch new records and then get the decrypted record for the one we just inserted
setTimeout(() => this.updateLocalLNSRecords(), 5000);
setTimeout(() => this.updateLocalONSRecords(), 5000);
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: 0,
i18n: "notification.positive.namePurchased",
sending: false
@ -1856,7 +1856,7 @@ export class WalletRPC {
);
}
updateLNSMapping(password, type, name, value, owner, backupOwner) {
updateONSMapping(password, type, name, value, owner, backupOwner) {
let _name = name.trim().toLowerCase();
const _owner = owner.trim() === "" ? null : owner;
const backup_owner = backupOwner.trim() === "" ? null : backupOwner;
@ -1876,7 +1876,7 @@ export class WalletRPC {
"sha512",
(err, password_hash) => {
if (err) {
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: -1,
i18n: "notification.errors.internalError",
sending: false
@ -1884,7 +1884,7 @@ export class WalletRPC {
return;
}
if (!this.isValidPasswordHash(password_hash)) {
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: -1,
i18n: "notification.errors.invalidPassword",
sending: false
@ -1900,12 +1900,12 @@ export class WalletRPC {
value
};
this.sendRPC("lns_update_mapping", params).then(data => {
this.sendRPC("ons_update_mapping", params).then(data => {
if (data.hasOwnProperty("error")) {
let error =
data.error.message.charAt(0).toUpperCase() +
data.error.message.slice(1);
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: -1,
message: error,
sending: false
@ -1916,11 +1916,11 @@ export class WalletRPC {
this.purchasedNames[name.trim()] = type;
// Fetch new records and then get the decrypted record for the one we just inserted
setTimeout(() => this.updateLocalLNSRecords(), 5000);
setTimeout(() => this.updateLocalONSRecords(), 5000);
// Optimistically update our record
const { lnsRecords } = this.wallet_state;
const newRecords = lnsRecords.map(record => {
const { onsRecords } = this.wallet_state;
const newRecords = onsRecords.map(record => {
if (
record.type === type &&
record.name &&
@ -1936,12 +1936,12 @@ export class WalletRPC {
return record;
});
this.wallet_state.lnsRecords = newRecords;
this.sendGateway("set_wallet_data", { lnsRecords: newRecords });
this.wallet_state.onsRecords = newRecords;
this.sendGateway("set_wallet_data", { onsRecords: newRecords });
this.sendGateway("set_lns_status", {
this.sendGateway("set_ons_status", {
code: 0,
i18n: "notification.positive.lnsRecordUpdated",
i18n: "notification.positive.onsRecordUpdated",
sending: false
});
});
@ -2796,14 +2796,14 @@ export class WalletRPC {
async closeWallet() {
clearInterval(this.heartbeat);
clearInterval(this.lnsHeartbeat);
clearInterval(this.onsHeartbeat);
this.wallet_state = {
open: false,
name: "",
password_hash: null,
balance: null,
unlocked_balance: null,
lnsRecords: []
onsRecords: []
};
this.purchasedNames = {};

View File

@ -1,6 +1,6 @@
<template>
<div class="lns-input">
<LNSInputForm
<div class="ons-input">
<ONSInputForm
ref="form"
:submit-label="submit_label"
:disable-name="updating || renewing"
@ -11,7 +11,7 @@
@onSubmit="onSubmit"
@onClear="onClear"
/>
<q-inner-loading :showing="lns_status.sending" :dark="theme == 'dark'">
<q-inner-loading :showing="ons_status.sending" :dark="theme == 'dark'">
<q-spinner color="primary" size="30" />
</q-inner-loading>
</div>
@ -19,14 +19,14 @@
<script>
import { mapState } from "vuex";
import LNSInputForm from "./lns_input_form";
import ONSInputForm from "./ons_input_form";
import WalletPassword from "src/mixins/wallet_password";
const objectAssignDeep = require("object-assign-deep");
export default {
name: "LNSInput",
name: "ONSInput",
components: {
LNSInputForm
ONSInputForm
},
mixins: [WalletPassword],
data() {
@ -37,7 +37,7 @@ export default {
},
computed: mapState({
theme: state => state.gateway.app.config.appearance.theme,
lns_status: state => state.gateway.lns_status,
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 : 21;
@ -55,7 +55,7 @@ export default {
}),
watch: {
lns_status: {
ons_status: {
handler(val, old) {
if (val.code == old.code) return;
const { code, message } = val;
@ -119,10 +119,10 @@ export default {
};
let passwordDialog = await this.showPasswordConfirmation({
title: this.$t("dialog.lnsUpdate.title"),
noPasswordMessage: this.$t("dialog.lnsUpdate.message"),
title: this.$t("dialog.onsUpdate.title"),
noPasswordMessage: this.$t("dialog.onsUpdate.message"),
ok: {
label: this.$t("dialog.lnsUpdate.ok"),
label: this.$t("dialog.onsUpdate.ok"),
color: "primary"
},
color: "#1F1C47"
@ -131,15 +131,15 @@ export default {
.onOk(password => {
// if no password set
password = password || "";
this.$store.commit("gateway/set_lns_status", {
this.$store.commit("gateway/set_ons_status", {
code: 1,
message: "Sending transaction",
sending: true
});
const lns = objectAssignDeep.noMutate(updatedRecord, {
const ons = objectAssignDeep.noMutate(updatedRecord, {
password
});
this.$gateway.send("wallet", "update_lns_mapping", lns);
this.$gateway.send("wallet", "update_ons_mapping", ons);
})
.onDismiss(() => {})
.onCancel(() => {});
@ -157,15 +157,15 @@ export default {
.onOk(password => {
// if no password set
password = password || "";
this.$store.commit("gateway/set_lns_status", {
this.$store.commit("gateway/set_ons_status", {
code: 1,
message: "Sending transaction",
sending: true
});
const lns = objectAssignDeep.noMutate(record, {
const ons = objectAssignDeep.noMutate(record, {
password
});
this.$gateway.send("wallet", "purchase_lns", lns);
this.$gateway.send("wallet", "purchase_ons", ons);
})
.onDismiss(() => {})
.onCancel(() => {});
@ -185,7 +185,7 @@ export default {
.onOk(password => {
// if no password set
password = password || "";
this.$store.commit("gateway/set_lns_status", {
this.$store.commit("gateway/set_ons_status", {
code: 1,
message: "Sending renew mapping transaction",
sending: true
@ -195,7 +195,7 @@ export default {
name: record.name,
password
};
this.$gateway.send("wallet", "lns_renew_mapping", params);
this.$gateway.send("wallet", "ons_renew_mapping", params);
})
.onDismiss(() => {})
.onCancel(() => {});

View File

@ -1,8 +1,8 @@
<template>
<div class="lns-input-form">
<div class="ons-input-form">
<!-- Type -->
<div class="col q-mt-sm">
<OxenField :label="$t('fieldLabels.lnsType')" :disable="updating">
<OxenField :label="$t('fieldLabels.onsType')" :disable="updating">
<q-select
v-model.trim="record.type"
emit-value
@ -24,11 +24,13 @@
<q-input
v-model.trim="record.name"
:dark="theme == 'dark'"
:placeholder="$t('placeholders.lnsName')"
:placeholder="$t('placeholders.onsName')"
:disable="disableName"
borderless
dense
:suffix="record.type === 'session' ? '' : '.loki'"
:suffix="
record.type === 'session' || record.type === 'wallet' ? '' : '.loki'
"
@blur="$v.record.name.$touch"
/>
</OxenField>
@ -48,7 +50,9 @@
borderless
dense
:disable="renewing"
:suffix="record.type === 'session' ? '' : '.loki'"
:suffix="
record.type === 'session' || record.type === 'wallet' ? '' : '.loki'
"
@blur="$v.record.value.$touch"
/>
</OxenField>
@ -85,7 +89,7 @@
<q-input
v-model.trim="record.backup_owner"
:dark="theme == 'dark'"
:placeholder="$t('placeholders.lnsBackupOwner')"
:placeholder="$t('placeholders.onsBackupOwner')"
:disable="renewing"
borderless
dense
@ -123,7 +127,7 @@ import OxenField from "components/oxen_field";
import WalletPassword from "src/mixins/wallet_password";
export default {
name: "LNSInputForm",
name: "ONSInputForm",
components: {
OxenField
},
@ -165,28 +169,31 @@ export default {
},
data() {
let sessionOptions = [
{ label: this.$t("strings.lns.sessionID"), value: "session" }
{ label: this.$t("strings.ons.sessionID"), value: "session" }
];
let walletOptions = [
{ label: this.$t("strings.ons.wallet"), value: "wallet" }
];
let lokinetOptions = [
{ label: this.$t("strings.lns.lokinetName1Year"), value: "lokinet_1y" },
{ label: this.$t("strings.ons.lokinetName1Year"), value: "lokinet_1y" },
{
label: this.$t("strings.lns.lokinetNameXYears", { years: 2 }),
label: this.$t("strings.ons.lokinetNameXYears", { years: 2 }),
value: "lokinet_2y"
},
{
label: this.$t("strings.lns.lokinetNameXYears", { years: 5 }),
label: this.$t("strings.ons.lokinetNameXYears", { years: 5 }),
value: "lokinet_5y"
},
{
label: this.$t("strings.lns.lokinetNameXYears", { years: 10 }),
label: this.$t("strings.ons.lokinetNameXYears", { years: 10 }),
value: "lokinet_10y"
}
];
let typeOptions = [...sessionOptions, ...lokinetOptions];
let typeOptions = [...sessionOptions, ...walletOptions, ...lokinetOptions];
const initialRecord = {
// Lokinet 1 year is valid on renew or purchase
type: typeOptions[1].value,
type: typeOptions[2].value,
name: "",
value: "",
owner: "",
@ -207,6 +214,8 @@ export default {
value_field_label() {
if (this.record.type === "session") {
return this.$t("fieldLabels.sessionId");
} else if (this.record.type === "wallet") {
return this.$t("fieldLabels.walletAddress");
} else {
return this.$t("fieldLabels.lokinetFullAddress");
}
@ -231,6 +240,8 @@ export default {
value_placeholder() {
if (this.record.type === "session") {
return this.$t("placeholders.sessionId");
} else if (this.record.type === "wallet") {
return this.$t("placeholders.walletAddress");
} else {
return this.$t("placeholders.lokinetFullAddress");
}
@ -333,7 +344,10 @@ export default {
const submitRecord = {
...this.record,
name: this.record.name.toLowerCase(),
value: this.record.value.toLowerCase()
value:
this.record.type === "wallet"
? this.record.value
: this.record.value.toLowerCase()
};
// Send up the submission with the record
this.$emit("onSubmit", submitRecord);
@ -356,7 +370,7 @@ export default {
if (this.record.type === "session") {
return session_name(_value);
} else {
// shortened lokinet LNS name
// shortened lokinet ONS name
return lokinet_name(_value);
}
}
@ -372,6 +386,8 @@ export default {
const _value = value.toLowerCase();
if (this.record.type === "session") {
return session_id(_value);
} else if (this.record.type === "wallet") {
return this.isAddress(value);
} else {
// full lokinet address
return lokinet_address(_value);
@ -389,7 +405,7 @@ export default {
</script>
<style lang="scss">
.lns-input-form {
.ons-input-form {
.buttons {
margin-top: 6px;

View File

@ -1,21 +1,21 @@
<template>
<div class="my-lns">
<div class="my-ons">
<div class="q-px-md q-pt-md">
<div class="tab-desc">
{{ $t("strings.lnsDescription") }}
{{ $t("strings.onsDescription") }}
</div>
<LNSRecords @onUpdate="onUpdate" @onRenew="onRenew" />
<ONSRecords @onUpdate="onUpdate" @onRenew="onRenew" />
</div>
</div>
</template>
<script>
import LNSRecords from "./lns_records";
import ONSRecords from "./ons_records";
export default {
name: "MyLNS",
name: "MyONS",
components: {
LNSRecords
ONSRecords
},
methods: {
onUpdate(record) {
@ -29,7 +29,7 @@ export default {
</script>
<style lang="scss">
.my-lns {
.my-ons {
.description {
white-space: pre-line;
color: #cecece;

View File

@ -1,45 +1,49 @@
<template>
<div class="lns-purchase">
<div class="ons-purchase">
<div class="q-mb-lg q-px-md q-pt-md">
<div class="tab-desc">
{{ $t("strings.lnsPurchaseDescription") }}
{{ $t("strings.onsPurchaseDescription") }}
</div>
<div class="prices">
{{ $t("strings.lns.prices") }}
{{ $t("strings.ons.prices") }}
<table>
<tr>
<td>{{ $t("strings.lns.sessionID") }}:</td>
<td>{{ $t("strings.ons.sessionID") }}:</td>
<td>15 OXEN</td>
</tr>
<tr>
<td>{{ $t("strings.lns.lokinetName1Year") }}:</td>
<td>{{ $t("strings.ons.wallet") }}:</td>
<td>15 OXEN</td>
</tr>
<tr>
<td>{{ $t("strings.lns.lokinetNameXYears", { years: 2 }) }}:</td>
<td>{{ $t("strings.ons.lokinetName1Year") }}:</td>
<td>15 OXEN</td>
</tr>
<tr>
<td>{{ $t("strings.ons.lokinetNameXYears", { years: 2 }) }}:</td>
<td>30 OXEN</td>
</tr>
<tr>
<td>{{ $t("strings.lns.lokinetNameXYears", { years: 5 }) }}:</td>
<td>{{ $t("strings.ons.lokinetNameXYears", { years: 5 }) }}:</td>
<td>60 OXEN</td>
</tr>
<tr>
<td>{{ $t("strings.lns.lokinetNameXYears", { years: 10 }) }}:</td>
<td>{{ $t("strings.ons.lokinetNameXYears", { years: 10 }) }}:</td>
<td>90 OXEN</td>
</tr>
</table>
</div>
<LNSInput ref="input" />
<ONSInput ref="input" />
</div>
</div>
</template>
<script>
import LNSInput from "./lns_input";
import ONSInput from "./ons_input";
export default {
name: "LNSPurchase",
name: "ONSPurchase",
components: {
LNSInput
ONSInput
},
methods: {
startUpdating(record) {
@ -52,7 +56,7 @@ export default {
};
</script>
<style lang="scss">
.lns-purchase {
.ons-purchase {
.description {
white-space: pre-line;
// oxen-navy

View File

@ -1,5 +1,5 @@
<template>
<q-list link no-border class="lns-record-list">
<q-list link no-border class="ons-record-list">
<q-item
v-for="record in recordList"
:key="record.name_hash"
@ -67,7 +67,7 @@ import ContextMenu from "components/menus/contextmenu";
const { clipboard } = require("electron");
export default {
name: "LNSRecordList",
name: "ONSRecordList",
components: {
ContextMenu
},
@ -146,6 +146,9 @@ export default {
if (record.type === "session") {
message = this.$t("notification.positive.sessionIdCopied");
}
if (record.type === "wallet") {
message = this.$t("notification.positive.walletCopied");
}
this.copy(record.value, message);
},
copy(value, message) {

View File

@ -1,5 +1,5 @@
<template>
<div class="lns-record-list">
<div class="ons-record-list">
<div v-if="needsDecryption" class="decrypt row justify-between items-end">
<OxenField
:label="$t('fieldLabels.decryptRecord')"
@ -11,7 +11,7 @@
:dark="theme == 'dark'"
borderless
dense
:placeholder="$t('placeholders.lnsDecryptName')"
:placeholder="$t('placeholders.onsDecryptName')"
:disable="decrypting"
@blur="$v.name.$touch"
/>
@ -27,19 +27,27 @@
</div>
<div v-if="session_records.length > 0" class="records-group">
<span class="record-type-title">{{
$t("titles.lnsSessionRecords")
$t("titles.onsSessionRecords")
}}</span>
<LNSRecordList
<ONSRecordList
:record-list="session_records"
:is-lokinet="false"
@onUpdate="onUpdate"
/>
</div>
<div v-if="wallet_records.length > 0" class="records-group">
<span class="record-type-title">{{ $t("titles.onsWalletRecords") }}</span>
<ONSRecordList
:record-list="wallet_records"
:is-lokinet="false"
@onUpdate="onUpdate"
/>
</div>
<div v-if="lokinet_records.length > 0" class="records-group">
<span class="record-type-title">{{
$t("titles.lnsLokinetRecords")
$t("titles.onsLokinetRecords")
}}</span>
<LNSRecordList
<ONSRecordList
:record-list="lokinet_records"
:is-lokinet="true"
@onUpdate="onUpdate"
@ -53,13 +61,13 @@
import { mapState } from "vuex";
import OxenField from "components/oxen_field";
import { session_name_or_lokinet_name } from "src/validators/common";
import LNSRecordList from "./lns_record_list";
import ONSRecordList from "./ons_record_list";
export default {
name: "LNSRecords",
name: "ONSRecords",
components: {
OxenField,
LNSRecordList
ONSRecordList
},
data() {
return {
@ -68,7 +76,7 @@ export default {
};
},
mounted() {
this.$gateway.send("wallet", "lns_known_names");
this.$gateway.send("wallet", "ons_known_names");
},
computed: mapState({
theme: state => state.gateway.app.config.appearance.theme,
@ -81,11 +89,18 @@ export default {
session_records(state) {
return this.records_of_type(state, "session");
},
wallet_records(state) {
return this.records_of_type(state, "wallet");
},
lokinet_records(state) {
return this.records_of_type(state, "lokinet");
},
needsDecryption() {
const records = [...this.lokinet_records, ...this.session_records];
const records = [
...this.lokinet_records,
...this.session_records,
...this.wallet_records
];
return records.find(r => this.isLocked(r));
}
}),
@ -93,7 +108,7 @@ export default {
records_of_type(state, type) {
// receives the type and returns the records of that type
const ourAddresses = this.ourAddresses;
const records = state.gateway.wallet.lnsRecords;
const records = state.gateway.wallet.onsRecords;
const ourRecords = records.filter(record => {
return (
record.type === type &&
@ -151,7 +166,7 @@ export default {
this.$q.notify({
type: "positive",
timeout: 2000,
message: this.$t("notification.positive.decryptedLNSRecord", {
message: this.$t("notification.positive.decryptedONSRecord", {
name
})
});
@ -160,7 +175,7 @@ export default {
this.$q.notify({
type: "negative",
timeout: 3000,
message: this.$t("notification.errors.decryptLNSRecord", { name })
message: this.$t("notification.errors.decryptONSRecord", { name })
});
}
this.decrypting = false;
@ -189,7 +204,7 @@ export default {
</script>
<style lang="scss">
.lns-record-list {
.ons-record-list {
.height {
font-size: 0.9em;
}

View File

@ -691,7 +691,7 @@ footer,
width: 180px;
}
.lns-record-list {
.ons-record-list {
.q-item {
cursor: pointer;
color: $oxen-navy;

View File

@ -190,13 +190,13 @@ export class Gateway extends EventEmitter {
break;
}
case "set_lns_status": {
case "set_ons_status": {
const data = { ...decrypted_data.data };
if (data.i18n) {
data.message = this.geti18n(data.i18n);
}
this.app.store.commit("gateway/set_lns_status", data);
this.app.store.commit("gateway/set_ons_status", data);
break;
}

View File

@ -22,7 +22,7 @@ export default {
generate: "GENERATE",
import: "IMPORT",
importWallet: "IMPORT WALLET | IMPORT WALLETS",
lns: "LOKI NAME SERVICE",
ons: "OXEN NAME SERVICE",
max: "MAX",
min: "MIN",
next: "NEXT",
@ -97,9 +97,9 @@ export default {
export: "Export",
import: "Import"
},
lnsUpdate: {
title: "Update LNS record",
message: "Do you want to update the LNS record?",
onsUpdate: {
title: "Update ONS record",
message: "Do you want to update the ONS record?",
ok: "UPDATE"
},
noPassword: {
@ -222,7 +222,7 @@ export default {
},
limitDownloadRate: "LIMIT DOWNLOAD RATE",
limitUploadRate: "LIMIT UPLOAD RATE",
lnsType: "LNS RECORD TYPE",
onsType: "ONS RECORD TYPE",
localDaemonIP: "LOCAL DAEMON IP",
localDaemonPort: "LOCAL DAEMON PORT",
lokinetFullAddress: "LOKINET FULL ADDRESS",
@ -248,6 +248,7 @@ export default {
sessionId: "SESSION ID",
signature: "SIGNATURE",
transactionId: "TRANSACTION ID",
walletAddress: "WALLET ADDRESS",
walletFile: "WALLET FILE",
walletLogLevel: "WALLET LOG LEVEL",
walletName: "WALLET NAME",
@ -313,13 +314,13 @@ export default {
backupOwnerCopied: "Backup owner copied to clipboard",
bannedPeer: "Banned {host} until {time}",
copied: "{item} copied to clipboard",
decryptedLNSRecord: "Successfully decrypted LNS Record for {name}",
decryptedONSRecord: "Successfully decrypted ONS Record for {name}",
itemSaved: "{item} saved to {filename}",
keyImages: {
exported: "Key images exported to {filename}",
imported: "Key images imported"
},
lnsRecordUpdated: "LNS Record was successfully updated",
onsRecordUpdated: "ONS Record was successfully updated",
lokinetAddressCopied: "Full lokinet address copied",
lokinetNameCopied: "Lokinet name copied",
passwordUpdated: "Password updated",
@ -335,7 +336,8 @@ export default {
signatureCopied: "Signature copied to clipboard",
signatureVerified: "Signature verified",
stakeSuccess: "Successfully staked",
transactionNotesSaved: "Transaction notes saved"
transactionNotesSaved: "Transaction notes saved",
walletCopied: "wallet Address copied to clipboard"
},
errors: {
banningPeer: "Error banning peer",
@ -345,7 +347,7 @@ export default {
copyWalletFail: "Failed to copy wallet",
copyingPrivateKeys: "Error copying private keys",
dataPathNotFound: "Data storage path not found",
decryptLNSRecord: "Failed to decrypt LNS Record for {name}",
decryptONSRecord: "Failed to decrypt ONS Record for {name}",
differentNetType: "Remote node is using a different nettype",
enterSeedWords: "Enter seed words",
enterTransactionId: "Enter transaction ID",
@ -412,11 +414,11 @@ export default {
dataToSign: "Data you want to sign with your primary address's private key",
filterTx: "Enter an ID, name, address or amount",
hexCharacters: "{count} hexadecimal characters",
lnsName: "The name to purchase via Loki Name Service",
lnsBackupOwner: "The wallet address of the backup owner",
lnsDecryptName: "A LNS name that belongs to you",
onsName: "The name to purchase via Oxen Name Service",
onsBackupOwner: "The wallet address of the backup owner",
onsDecryptName: "A ONS name that belongs to you",
lokinetFullAddress:
"Full lokinet address to map LNS name to (without .loki)",
"Full lokinet address to map ONS name to (without .loki)",
mnemonicSeed: "25 (or 24) word mnemonic seed",
pasteTransactionId: "Paste transaction ID",
pasteTransactionProof: "Paste transaction proof",
@ -424,10 +426,11 @@ export default {
"Optional message against which the signature is signed",
recipientWalletAddress: "Recipient's wallet address",
selectAFile: "Please select a file",
sessionId: "The Session ID to link to Loki Name Service",
sessionId: "The Session ID to link to Oxen Name Service",
signature: "Signature to verify",
transactionNotes: "Additional notes to locally attach to the transaction",
unsignedData: "The data as it should look before it was signed",
walletAddress: "wallet address to map ONS name to",
walletName: "A name for your wallet",
walletPassword: "An optional password for the wallet"
},
@ -489,16 +492,17 @@ export default {
destinationUnknown: "Destination Unknown",
editAddressBookEntry: "Edit address book entry",
expirationHeight: "Expiration height",
lns: {
ons: {
sessionID: "Session ID",
wallet: "Wallet Address",
lokinetName1Year: "Lokinet Name 1 year",
lokinetNameXYears: "Lokinet Name {years} years",
prices: "LNS Prices:"
prices: "ONS Prices:"
},
lnsPurchaseDescription:
"Purchase or update an LNS record. If you purchase a name, it may take a minute or two for it to show up in the list.",
lnsDescription:
"Here you can find all the LNS names owned by this wallet. Decrypting a record you own will return the name and value of that LNS record.",
onsPurchaseDescription:
"Purchase or update an ONS record. If you purchase a name, it may take a minute or two for it to show up in the list.",
onsDescription:
"Here you can find all the ONS names owned by this wallet. Decrypting a record you own will return the name and value of that ONS record.",
loadingSettings: "Loading settings",
oxenBalance: "Balance",
lokinetNameDescription:
@ -612,14 +616,15 @@ export default {
changePassword: "Change password",
configure: "Configure",
currentlyStakedNodes: "Currently staked nodes",
lnsRecordDetails: "LNS record details",
lnsSessionRecords: "Session records",
lnsLokinetRecords: "Lokinet records",
onsRecordDetails: "ONS record details",
onsSessionRecords: "Session records",
onsLokinetRecords: "Lokinet records",
onsWalletRecords: "Wallet records",
privateKeys: "Private keys",
rescanWallet: "Rescan wallet",
lns: {
ons: {
purchase: "PURCHASE",
myLns: "MY LNS"
myOns: "MY ONS"
},
serviceNode: {
registration: "REGISTRATION",

View File

@ -44,10 +44,10 @@
align="between"
/>
</router-link>
<router-link to="/wallet/lns">
<router-link to="/wallet/ons">
<q-btn
class="large-btn"
:label="$t('buttons.lns')"
:label="$t('buttons.ons')"
size="md"
icon-right="text_fields"
align="between"

View File

@ -1,5 +1,5 @@
<template>
<q-page class="lns-page">
<q-page class="ons-page">
<div class="header row items-center justify-center q-pt-md">
<q-btn-toggle
v-model="screen"
@ -7,31 +7,31 @@
color="accent"
:options="[
{
label: $t('titles.lns.purchase'),
label: $t('titles.ons.purchase'),
value: 'purchase'
},
{
label: $t('titles.lns.myLns'),
value: 'my_lns'
label: $t('titles.ons.myOns'),
value: 'my_ons'
}
]"
/>
</div>
<LNSPurchase v-if="screen === 'purchase'" ref="purchase" />
<MyLNS v-if="screen === 'my_lns'" @onUpdate="onUpdate" @onRenew="onRenew" />
<ONSPurchase v-if="screen === 'purchase'" ref="purchase" />
<MyONS v-if="screen === 'my_ons'" @onUpdate="onUpdate" @onRenew="onRenew" />
</q-page>
</template>
<script>
import LNSPurchase from "components/lns/lns_purchase";
import MyLNS from "components/lns/lns_mylns";
import ONSPurchase from "components/ons/ons_purchase";
import MyONS from "components/ons/ons_myons";
import Vue from "vue";
import _ from "lodash";
export default {
components: {
MyLNS,
LNSPurchase
MyONS,
ONSPurchase
},
data() {
return {

View File

@ -94,8 +94,8 @@ export default [
component: () => import("pages/wallet/service-node")
},
{
path: "lns",
component: () => import("pages/wallet/lns")
path: "ons",
component: () => import("pages/wallet/ons")
},
{
path: "advanced",

View File

@ -54,8 +54,8 @@ export const set_verify_status = (state, data) => {
};
};
export const set_lns_status = (state, data) => {
state.lns_status = data;
export const set_ons_status = (state, data) => {
state.ons_status = data;
};
export const set_update_required = (state, data) => {

View File

@ -48,7 +48,7 @@ export default {
unused: [],
address_book: []
},
lnsRecords: [],
onsRecords: [],
isRPCSyncing: false
},
tx_status: {
@ -109,7 +109,7 @@ export default {
i18n: "",
sending: false
},
lns_status: {
ons_status: {
code: 0,
message: "",
i18n: "",

View File

@ -17,7 +17,7 @@ export const session_id = input => {
return input.length === 66 && /^05[0-9A-Za-z]+$/.test(input);
};
// shortened Lokinet LNS name
// shortened Lokinet ONS name
export const lokinet_name = (input, lokiExt = false) => {
let inputSafe = input || "";
let maxLength = 32;