Skip to content

Commit

Permalink
Improved Payment Requests (#140)
Browse files Browse the repository at this point in the history
* fix: black screen on empty wallet + wipe after pay

* Prettier
  • Loading branch information
JSKitty committed Jun 2, 2023
1 parent eea8346 commit 2423f3e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
18 changes: 9 additions & 9 deletions scripts/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,21 +354,21 @@ export async function start() {
// Import the wallet, and toggle the startup flag, which delegates the chain data refresh to settingsStart();
if (publicKey) {
importWallet({ newWif: publicKey, fStartup: true });

// Payment processor popup
if (reqTo.length || reqAmount > 0) {
guiPreparePayment(
reqTo,
reqAmount,
urlParams.has('desc') ? urlParams.get('desc') : ''
);
}
} else {
// Display the password unlock upfront
await accessOrImportWallet();
}
}

// Payment processor redirect
if (reqTo.length || reqAmount > 0) {
guiPreparePayment(
reqTo,
reqAmount,
urlParams.has('desc') ? urlParams.get('desc') : ''
);
}

subscribeToNetworkEvents();

doms.domPrefix.value = '';
Expand Down
21 changes: 20 additions & 1 deletion scripts/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,26 @@ export async function createTxGUI() {
[],
2500
);
createAndSendTransaction({ address, amount: nValue, isDelegation: false });

// Create and send the TX
const cRes = await createAndSendTransaction({
address,
amount: nValue,
isDelegation: false,
});

// Wipe any payment request info
if (cRes.ok && doms.domReqDesc.value) {
// Description
doms.domReqDesc.value = '';
doms.domReqDisplay.style.display = 'none';
// Address
doms.domAddress1s.value = '';
// Amount
doms.domSendAmountCoins.value = '';
// Price
doms.domSendAmountValue.value = '';
}
}

/**
Expand Down

0 comments on commit 2423f3e

Please sign in to comment.