Skip to content

Commit

Permalink
Merge branch 'master' into proposal-creation-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
JSKitty authored Sep 19, 2023
2 parents aed3ac8 + b7e9264 commit 4516123
Show file tree
Hide file tree
Showing 27 changed files with 945 additions and 897 deletions.
2 changes: 1 addition & 1 deletion index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ <h3 class="noselect balance-title">
<a id="guiExportWalletItem" class="dropdown-item ptr" data-toggle="modal" data-target="#exportPrivateKeysModal" data-backdrop="static" data-keyboard="false" onclick="MPW.toggleExportUI()">
<i class="fas fa-key"></i> <span data-i18n="export">Export</span>
</a>
<a class="dropdown-item ptr" id="guiNewAddress" data-toggle="modal" data-target="#qrModal" onclick="MPW.getNewAddress({updateGUI: true, verify: true});">
<a class="dropdown-item ptr" id="guiNewAddress" data-toggle="modal" data-target="#qrModal" onclick="MPW.wallet.getNewAddress({updateGUI: true, verify: true});">
<i class="fas fa-sync-alt"></i> <span data-i18n="refreshAddress">Refresh address</span>
</a>
<a class="dropdown-item ptr" data-toggle="modal" data-target="#redeemCodeModal">
Expand Down
1 change: 1 addition & 0 deletions locale/de/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export const de_translation = {
proposalFinalisationReady: 'Bereit zum Einreichen', //Ready to submit
proposalPassing: 'Bestehend', //PASSING
proposalFailing: 'Scheiternd', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'Finanziert', //FUNDED
proposalNotFunded: 'nicht Finanziert', //NOT FUNDED
proposalPaymentsRemaining: 'Ausstehende Transaktionen<br>', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/en/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ export const en_translation = {
proposalFinalisationReady: 'Ready to submit',
proposalPassing: 'PASSING',
proposalFailing: 'FAILING',
proposalTooYoung: 'TOO YOUNG',
proposalFunded: 'FUNDED',
proposalNotFunded: 'NOT FUNDED',
proposalPaymentsRemaining: 'installment(s) remaining<br>of',
Expand Down
1 change: 1 addition & 0 deletions locale/es-mx/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export const es_mx_translation = {
proposalFinalisationReady: 'Listo para enviarla', //Ready to submit
proposalPassing: 'PASANDO', //PASSING
proposalFailing: 'FRACASANDO', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'FINANCIADA', //FUNDED
proposalNotFunded: 'NO FINANCIADA', //NOT FUNDED
proposalPaymentsRemaining: 'plazo(s) restante(s)<br>de', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/fr/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ export const fr_translation = {
proposalFinalisationReady: 'Prêt à soumettre', //Ready to submit
proposalPassing: 'PASSANT', //PASSING
proposalFailing: 'ÉCHOUANT', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'FINANCÉE', //FUNDED
proposalNotFunded: 'NON FINANCÉE', //NOT FUNDED
proposalPaymentsRemaining: "l'installation(s) restants<br>de", //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/it/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export const it_translation = {
proposalFinalisationReady: "Pronto per l'invio", //Ready to submit
proposalPassing: 'Passata', //PASSING
proposalFailing: 'Fallita', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'Finanziata', //FUNDED
proposalNotFunded: 'Non finanziata', //NOT FUNDED
proposalPaymentsRemaining: 'rata/i rimanente<br>di', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/ph/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ export const ph_translation = {
proposalFinalisationReady: 'Handa ng ipasa', //Ready to submit
proposalPassing: 'PASSING', //PASSING
proposalFailing: 'FAILING', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'FUNDED', //FUNDED
proposalNotFunded: 'NOT FUNDED', //NOT FUNDED
proposalPaymentsRemaining: 'installment(s) remaining<br>of', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/pt-br/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export const pt_br_translation = {
proposalFinalisationReady: 'Pronto para enviar', //Ready to submit
proposalPassing: 'PASSAGEM', //PASSING
proposalFailing: 'FALHA', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'FINANCIADO/A', //FUNDED
proposalNotFunded: 'NÃO FINANCIADO/A', //NOT FUNDED
proposalPaymentsRemaining: 'parcela(s) restante(s)<br>de', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/pt-pt/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export const pt_pt_translation = {
proposalFinalisationReady: 'Pronto para enviar', //Ready to submit
proposalPassing: 'PASSAGEM', //PASSING
proposalFailing: 'FALHA', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'FINANCIADO/A', //FUNDED
proposalNotFunded: 'NÃO FINANCIADO/A', //NOT FUNDED
proposalPaymentsRemaining: 'parcela(s) restante(s)<br>de', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/template/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ export const translation_template = {
proposalFinalisationReady: '', //Ready to submit
proposalPassing: '', //PASSING
proposalFailing: '', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: '', //FUNDED
proposalNotFunded: '', //NOT FUNDED
proposalPaymentsRemaining: '', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/uwu/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ export const uwu_translation = {
proposalFinalisationReady: 'Ready tew submit', //Ready to submit
proposalPassing: 'PASSING, YAY!', //PASSING
proposalFailing: 'FAILING, NAY!', //FAILING
proposalTooYoung: 'TOO YOUNG, BAKA!', //TOO YOUNG
proposalFunded: 'FUNDED!', //FUNDED
proposalNotFunded: 'NO MONIES', //NOT FUNDED
proposalPaymentsRemaining: 'payment(s) remainingz<br>of', //installment(s) remaining<br>of
Expand Down
5 changes: 3 additions & 2 deletions scripts/bitTrx.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import * as nobleSecp256k1 from '@noble/secp256k1';
import { BigInteger } from 'biginteger';
import bs58 from 'bs58';
import { OP } from './script.js';
import { deriveAddress, parseWIF, getDerivationPath } from './wallet.js';
import { wallet } from './wallet.js';
import { parseWIF, deriveAddress } from './encoding.js';
import { sha256 } from '@noble/hashes/sha256';
import { getNetwork } from './network.js';
import { cChainParams } from './chain_params.js';
Expand All @@ -30,7 +31,7 @@ export default class bitjs {
index,
script,
sequence,
path = getDerivationPath(),
path = wallet.getDerivationPath(),
}) {
const o = {};
o.outpoint = { hash: txid, index: index };
Expand Down
2 changes: 2 additions & 0 deletions scripts/chain_params.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const cChainParams = {
},
budgetCycleBlocks: 43200,
proposalFee: 50 * COIN,
proposalFeeConfirmRequirement: 6,
maxPaymentCycles: 6,
maxPayment: 10 * 43200 * COIN, // 43200 blocks of 10 PIV
},
Expand Down Expand Up @@ -74,6 +75,7 @@ export const cChainParams = {
},
budgetCycleBlocks: 144,
proposalFee: 50 * COIN,
proposalFeeConfirmRequirement: 3,
maxPaymentCycles: 20,
maxPayment: 10 * 144 * COIN, // 144 blocks of 10 tPIV
},
Expand Down
54 changes: 30 additions & 24 deletions scripts/contacts-book.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
sanitizeHTML,
} from './misc';
import { scanQRCode } from './scanner';
import { getDerivationPath, hasEncryptedWallet, masterKey } from './wallet';
import { wallet, hasEncryptedWallet } from './wallet';

/**
* Represents an Account contact
Expand Down Expand Up @@ -343,17 +343,16 @@ export async function guiRenderReceiveModal(
let strPubkey = '';

// If HD: use xpub, otherwise we'll fallback to our single address
if (masterKey.isHD) {
if (wallet.isHD()) {
// Get our current wallet XPub
const derivationPath = getDerivationPath(
masterKey.isHardwareWallet
)
const derivationPath = wallet
.getDerivationPath()
.split('/')
.slice(0, 4)
.join('/');
strPubkey = await masterKey.getxpub(derivationPath);
strPubkey = await wallet.getMasterKey().getxpub(derivationPath);
} else {
strPubkey = await masterKey.getCurrentAddress();
strPubkey = await wallet.getMasterKey().getCurrentAddress();
}

// Construct the Contact Share URI
Expand All @@ -375,7 +374,7 @@ export async function guiRenderReceiveModal(
document.getElementById('clipboard').value = strPubkey;
} else {
// Get our current wallet address
const strAddress = await masterKey.getCurrentAddress();
const strAddress = await wallet.getMasterKey().getCurrentAddress();

// Update the QR Label (we'll show the address here for now, user can set Contact "Name" optionally later)
doms.domModalQrLabel.innerHTML =
Expand Down Expand Up @@ -405,7 +404,7 @@ export async function guiRenderReceiveModal(
}
} else if (cReceiveType === RECEIVE_TYPES.ADDRESS) {
// Get our current wallet address
const strAddress = await masterKey.getCurrentAddress();
const strAddress = await wallet.getMasterKey().getCurrentAddress();
createQR('pivx:' + strAddress, doms.domModalQR);
doms.domModalQrLabel.innerHTML =
strAddress +
Expand All @@ -416,11 +415,12 @@ export async function guiRenderReceiveModal(
document.getElementById('clipboard').value = strAddress;
} else {
// Get our current wallet XPub
const derivationPath = getDerivationPath(masterKey.isHardwareWallet)
const derivationPath = wallet
.getDerivationPath()
.split('/')
.slice(0, 4)
.join('/');
const strXPub = await masterKey.getxpub(derivationPath);
const strXPub = await wallet.getMasterKey().getxpub(derivationPath);

// Update the QR Label (we'll show the address here for now, user can set Contact "Name" optionally later)
doms.domModalQrLabel.innerHTML =
Expand Down Expand Up @@ -468,7 +468,7 @@ export let cReceiveType = RECEIVE_TYPES.CONTACT;
*/
export async function guiToggleReceiveType(nForceType = null) {
// Figure out which Types can be used with this wallet
const nTypeMax = masterKey.isHD ? 3 : 2;
const nTypeMax = wallet.isHD() ? 3 : 2;

// Loop back to the first if we hit the end
cReceiveType =
Expand Down Expand Up @@ -521,13 +521,16 @@ export async function guiAddContact() {

// Ensure we're not adding our own XPub
if (isXPub(strAddr)) {
if (masterKey.isHD) {
const derivationPath = getDerivationPath(masterKey.isHardwareWallet)
if (wallet.isHD()) {
const derivationPath = wallet
.getDerivationPath()
.split('/')
.slice(0, 4)
.join('/');
// Compare the XPub against our own
const fOurs = strAddr === (await masterKey.getxpub(derivationPath));
const fOurs =
strAddr ===
(await wallet.getMasterKey().getxpub(derivationPath));
if (fOurs) {
createAlert(
'warning',
Expand All @@ -539,7 +542,7 @@ export async function guiAddContact() {
}
} else {
// Ensure we're not adding (one of) our own address(es)
if (await masterKey.isOwnAddress(strAddr)) {
if (await wallet.isOwnAddress(strAddr)) {
createAlert('warning', ALERTS.CONTACTS_CANNOT_ADD_YOURSELF, 3500);
return false;
}
Expand Down Expand Up @@ -617,14 +620,16 @@ export async function guiAddContactPrompt(

// Ensure we're not adding our own XPub
if (isXPub(strPubkey)) {
if (masterKey.isHD) {
const derivationPath = getDerivationPath(masterKey.isHardwareWallet)
if (wallet.isHD()) {
const derivationPath = wallet
.getDerivationPath()
.split('/')
.slice(0, 4)
.join('/');
// Compare the XPub against our own
const fOurs =
strPubkey === (await masterKey.getxpub(derivationPath));
strPubkey ===
(await wallet.getMasterKey().getxpub(derivationPath));
if (fOurs) {
createAlert(
'warning',
Expand All @@ -636,7 +641,7 @@ export async function guiAddContactPrompt(
}
} else {
// Ensure we're not adding (one of) our own address(es)
if (await masterKey.isOwnAddress(strPubkey)) {
if (await wallet.isOwnAddress(strPubkey)) {
createAlert('warning', ALERTS.CONTACTS_CANNOT_ADD_YOURSELF, 3500);
return false;
}
Expand Down Expand Up @@ -978,15 +983,16 @@ export async function localContactToURI(account, pubkey) {

// If HD: use xpub, otherwise we'll fallback to our single address
if (!strPubkey) {
if (masterKey.isHD) {
if (wallet.isHD()) {
// Get our current wallet XPub
const derivationPath = getDerivationPath(masterKey.isHardwareWallet)
const derivationPath = wallet
.getDerivationPath()
.split('/')
.slice(0, 4)
.join('/');
strPubkey = await masterKey.getxpub(derivationPath);
strPubkey = await wallet.getMasterKey().getxpub(derivationPath);
} else {
strPubkey = await masterKey.getCurrentAddress();
strPubkey = await wallet.getMasterKey().getCurrentAddress();
}
}

Expand Down
Loading

0 comments on commit 4516123

Please sign in to comment.