Skip to content

Commit

Permalink
Merge pull request #13 from Beldex-Coin/dev
Browse files Browse the repository at this point in the history
PR Accepted
  • Loading branch information
codeman-crypto authored Sep 2, 2022
2 parents 19d0c4a + 6364e74 commit 4cc60ff
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 82 deletions.
153 changes: 77 additions & 76 deletions src-electron/main-process/modules/wallet-rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -927,11 +927,12 @@ export class WalletRPC {
}, 8000);
this.heartbeatAction(true);

clearInterval(this.bnsHeartbeat);
this.bnsHeartbeat = setInterval(() => {
this.updateLocalBNSRecords();
}, 80000); // change from 30*1000 to 80000
this.updateLocalBNSRecords();
// disabled the BNS for the future release
// clearInterval(this.bnsHeartbeat);
// this.bnsHeartbeat = setInterval(() => {
// this.updateLocalBNSRecords();
// }, 80000); // change from 30*1000 to 80000
// this.updateLocalBNSRecords();
}

heartbeatAction(extended = false) {
Expand Down Expand Up @@ -1846,77 +1847,77 @@ export class WalletRPC {
crypto.pbkdf2(password, this.auth[2], 1000, 64, "sha512", cryptoCallback);
}

purchaseBNS(password, type, name, value, owner, backupOwner) {
let _name = name.trim().toLowerCase();
const _owner = owner.trim() === "" ? null : owner;
const backup_owner = backupOwner.trim() === "" ? null : backupOwner;

// the RPC accepts names with the .bdx already appeneded only
// can be belnet_1y, belnet_2y, belnet_5y, belnet_10y
if (type.startsWith("belnet")) {
_name = _name + ".bdx";
value = value + ".bdx";
}

crypto.pbkdf2(
password,
this.auth[2],
1000,
64,
"sha512",
(err, password_hash) => {
if (err) {
this.sendGateway("set_bns_status", {
code: -1,
i18n: "notification.errors.internalError",
sending: false
});
return;
}
if (!this.isValidPasswordHash(password_hash)) {
this.sendGateway("set_bns_status", {
code: -1,
i18n: "notification.errors.invalidPassword",
sending: false
});
return;
}

const params = {
type,
owner: _owner,
backup_owner,
name: _name,
value
};

this.sendRPC("bns_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_bns_status", {
code: -1,
message: error,
sending: false
});
return;
}

this.purchasedNames[name.trim()] = type;

// Fetch new records and then get the decrypted record for the one we just inserted
setTimeout(() => this.updateLocalBNSRecords(), 5000);

this.sendGateway("set_bns_status", {
code: 0,
i18n: "notification.positive.namePurchased",
sending: false
});
});
}
);
}
// purchaseBNS(password, type, name, value, owner, backupOwner) {
// let _name = name.trim().toLowerCase();
// const _owner = owner.trim() === "" ? null : owner;
// const backup_owner = backupOwner.trim() === "" ? null : backupOwner;

// // the RPC accepts names with the .bdx already appeneded only
// // can be belnet_1y, belnet_2y, belnet_5y, belnet_10y
// if (type.startsWith("belnet")) {
// _name = _name + ".bdx";
// value = value + ".bdx";
// }

// crypto.pbkdf2(
// password,
// this.auth[2],
// 1000,
// 64,
// "sha512",
// (err, password_hash) => {
// if (err) {
// this.sendGateway("set_bns_status", {
// code: -1,
// i18n: "notification.errors.internalError",
// sending: false
// });
// return;
// }
// if (!this.isValidPasswordHash(password_hash)) {
// this.sendGateway("set_bns_status", {
// code: -1,
// i18n: "notification.errors.invalidPassword",
// sending: false
// });
// return;
// }

// const params = {
// type,
// owner: _owner,
// backup_owner,
// name: _name,
// value
// };

// this.sendRPC("bns_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_bns_status", {
// code: -1,
// message: error,
// sending: false
// });
// return;
// }

// this.purchasedNames[name.trim()] = type;

// // Fetch new records and then get the decrypted record for the one we just inserted
// setTimeout(() => this.updateLocalBNSRecords(), 5000);

// this.sendGateway("set_bns_status", {
// code: 0,
// i18n: "notification.positive.namePurchased",
// sending: false
// });
// });
// }
// );
// }

updateBNSMapping(password, type, name, value, owner, backupOwner) {
let _name = name.trim().toLowerCase();
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/wallet/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@
align="between"
/>
</router-link>
<router-link to="/wallet/bns">
<!-- <router-link to="/wallet/bns">
<q-btn
class="large-btn"
:label="$t('buttons.bns')"
size="md"
icon-right="text_fields"
align="between"
/>
</router-link>
</router-link> -->
<router-link to="/wallet/advanced">
<q-btn
class="large-btn"
Expand Down
8 changes: 4 additions & 4 deletions src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ export default [
path: "masternode",
component: () => import("pages/wallet/master-node")
},
{
path: "bns",
component: () => import("pages/wallet/bns")
},
// {
// path: "bns",
// component: () => import("pages/wallet/bns")
// },
{
path: "advanced",
component: () => import("pages/wallet/advanced")
Expand Down

0 comments on commit 4cc60ff

Please sign in to comment.