-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from mintlayer/dev
* A-1206811020024239: fix transaction list (#124) * A-1206811020024239: fix transaction list * add icon * A-1206478979914858 (#125) * feat: update Mintlayer library and crypto srvices * feat: add new endpoints to Mintlayer API services * feat: add version number to the index page * feat: add Transaction context * feat: improves Mintlayer helpers to support delegations * feat: add Staking component * feat: add delegation item * feat: add delegation details * feat: add list of delegations * feat: update existing components to work with new data * feat: upate address field * feat: improvements for the mlWalletInfo hook * test: add unit tests * style: styles improvments * feat: uopdate Mintlayer library * fix: delegation fee estimates * feat: change block exlorer link title * feat: add tooltip with staking guide * remove date from delegation * feat: delegation item improvements * test: fix delegation test * feat: add pool id to the delegation details * feat: add pool list link * fix: back button click handler * feat: remove amout field if delegation transaction * feat: update delegation with action buttons * feat: update transaction result message, styles improvements * fix: spending from delegation max value * increase varsion to 1.2.0 * feat: add delegation description * feat: change send transaction button title if delegation mode * A-1206823923357146: explorer integration * + * + * update routes * feat: add unconfirmed delegation, refactorng and improvements * change button title if delegation * navigate to staking page if delegation transaction * feat: routing improvements * feat: button title * fix: fix dev env * autoupdate staking page * fix: unconfirmed transaction appearance * chore: remove console.log --------- Co-authored-by: Sergey Chystiakov <[email protected]> --------- Co-authored-by: Sergey <[email protected]>
- Loading branch information
Showing
78 changed files
with
5,883 additions
and
687 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* global chrome */ | ||
|
||
var popupWindowId = false | ||
var connectWindowId = false | ||
|
||
chrome.runtime.onMessageExternal.addListener(function ( | ||
request, | ||
sender, | ||
sendResponse, | ||
) { | ||
if (request) { | ||
if (request.message) { | ||
if (request.message === 'version') { | ||
sendResponse({ version: chrome.runtime.getManifest().version }) | ||
} | ||
|
||
if (request.message === 'connect') { | ||
if (connectWindowId === false) { | ||
popupWindowId = true | ||
chrome.windows.create( | ||
{ | ||
url: chrome.runtime.getURL('index.html'), | ||
type: 'popup', | ||
width: 800, | ||
height: 600, | ||
focused: true, | ||
}, | ||
function (win) { | ||
connectWindowId = win.id | ||
setTimeout(function () { | ||
chrome.runtime.sendMessage( | ||
{ | ||
action: 'connect', | ||
}, | ||
function (response) { | ||
sendResponse(response) | ||
}, | ||
) | ||
}, 1000) | ||
}, | ||
) | ||
} else if (typeof popupWindowId === 'number') { | ||
//The window is open, and the user clicked the button. | ||
// Focus the window. | ||
chrome.windows.update(popupWindowId, { focused: true }) | ||
} | ||
} | ||
|
||
if (request.message === 'delegate') { | ||
if (popupWindowId === false) { | ||
popupWindowId = true | ||
chrome.windows.create( | ||
{ | ||
url: chrome.runtime.getURL('index.html'), | ||
type: 'popup', | ||
width: 800, | ||
height: 600, | ||
focused: true, | ||
}, | ||
function (win) { | ||
popupWindowId = win.id | ||
setTimeout(function () { | ||
chrome.runtime.sendMessage({ | ||
action: 'createDelegate', | ||
data: { pool_id: request.pool_id }, | ||
}) | ||
}, 1000) | ||
}, | ||
) | ||
} else if (typeof popupWindowId === 'number') { | ||
//The window is open, and the user clicked the button. | ||
// Focus the window. | ||
chrome.windows.update(popupWindowId, { focused: true }) | ||
} | ||
} | ||
|
||
if (request.message === 'stake') { | ||
if (popupWindowId === false) { | ||
popupWindowId = true | ||
chrome.windows.create( | ||
{ | ||
url: chrome.runtime.getURL('index.html'), | ||
type: 'popup', | ||
width: 800, | ||
height: 600, | ||
focused: true, | ||
}, | ||
function (win) { | ||
popupWindowId = win.id | ||
setTimeout(function () { | ||
chrome.runtime.sendMessage({ | ||
action: 'addStake', | ||
data: { | ||
delegation_id: request.delegation_id, | ||
amount: request.amount, | ||
}, | ||
}) | ||
}, 1000) | ||
}, | ||
) | ||
} else if (typeof popupWindowId === 'number') { | ||
//The window is open, and the user clicked the button. | ||
// Focus the window. | ||
chrome.windows.update(popupWindowId, { focused: true }) | ||
} | ||
} | ||
} | ||
} | ||
return true | ||
}) | ||
|
||
chrome.windows.onRemoved.addListener(function (winId) { | ||
if (popupWindowId === winId) { | ||
popupWindowId = false | ||
} | ||
if (connectWindowId === winId) { | ||
connectWindowId = false | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function start() { | ||
window.addEventListener('InitWalletRequest', function (evt) { | ||
var content = { | ||
type: 'MOJITO_INIT', | ||
version: chrome.runtime.getManifest().version, | ||
extension_id: chrome.runtime.id, | ||
} | ||
var event = new CustomEvent('InitWalletResponse', { detail: content }) | ||
window.dispatchEvent(event) | ||
}) | ||
} | ||
|
||
start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useEffect, useState } from 'react' | ||
|
||
const Timer = ({ onTimerEnd, repeat, duration }) => { | ||
const [timer, setTimer] = useState(null) | ||
|
||
const stopTimer = () => { | ||
if (timer) { | ||
clearTimeout(timer) | ||
setTimer(null) | ||
} | ||
} | ||
|
||
const startTimer = () => { | ||
stopTimer() // Ensure no timer is already running | ||
const newTimer = setTimeout(() => { | ||
onTimerEnd() // Call the function provided via props | ||
if (repeat) { | ||
startTimer() // Restart the timer if `repeat` is true | ||
} | ||
}, duration) | ||
setTimer(newTimer) | ||
} | ||
|
||
useEffect(() => { | ||
startTimer() | ||
return () => stopTimer() // Cleanup on component unmount | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [repeat, duration, onTimerEnd]) | ||
|
||
return <div></div> | ||
} | ||
|
||
export default Timer |
Oops, something went wrong.