diff --git a/bin/template/iota-next-index-browser.js b/bin/template/iota-next-index-browser.js index fed1726..29188fd 100644 --- a/bin/template/iota-next-index-browser.js +++ b/bin/template/iota-next-index-browser.js @@ -3676,16 +3676,16 @@ let unlockConditions = output?.output?.unlockConditions || [] // TIMELOCK_UNLOCK_CONDITION_TYPE - let timelockUnlockCondition = unlockConditions.find(e => e.type === TIMELOCK_UNLOCK_CONDITION_TYPE) - if(timelockUnlockCondition && nowTime > timelockUnlockCondition.unixTime) { + let timelockUnlockCondition = unlockConditions.find((e) => e.type === TIMELOCK_UNLOCK_CONDITION_TYPE) + if (timelockUnlockCondition && nowTime > timelockUnlockCondition.unixTime) { timelockUnlockCondition = null } - // Storage Deposit Return Unlock - let storageDepositReturnUnlockCondition = unlockConditions.find(e => e.type === STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE) + // Storage Deposit Return Unlock + let storageDepositReturnUnlockCondition = unlockConditions.find((e) => e.type === STORAGE_DEPOSIT_RETURN_UNLOCK_CONDITION_TYPE) // Expiration Unlock Condition - let expirationUnlockCondition = unlockConditions.find(e => e.type === EXPIRATION_UNLOCK_CONDITION_TYPE) + let expirationUnlockCondition = unlockConditions.find((e) => e.type === EXPIRATION_UNLOCK_CONDITION_TYPE) let addressInExpirationUnlockCondition let unixTimeInExpirationUnlockCondition @@ -3693,14 +3693,14 @@ addressInExpirationUnlockCondition = hexToBech32(expirationUnlockCondition.returnAddress.pubKeyHash) unixTimeInExpirationUnlockCondition = expirationUnlockCondition.unixTime } - + if (addressInExpirationUnlockCondition && shimmerAddressList.includes(addressInExpirationUnlockCondition)) { - if(unixTimeInExpirationUnlockCondition < nowTime) { + if (unixTimeInExpirationUnlockCondition < nowTime) { expirationUnlockCondition = null storageDepositReturnUnlockCondition = null } } - + const features = output?.output?.features || [] let featuresLock = false if (features.length > 0) { diff --git a/package.json b/package.json index 9970b6a..d5b8281 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tangle-pay-chrome", - "version": "1.6.3", + "version": "1.6.4", "private": true, "homepage": "./", "dependencies": { @@ -47,7 +47,7 @@ "react-transition-group": "^4.4.2", "rimraf": "^5.0.1", "struct": "^0.0.12", - "tanglepay": "^2.7.1", + "tanglepay": "^2.7.4", "web-vitals": "^1.0.1", "web3": "^1.7.3", "yup": "^0.32.11" diff --git a/public/js/background.js b/public/js/background.js index 89ea7a4..d184973 100644 --- a/public/js/background.js +++ b/public/js/background.js @@ -1087,12 +1087,18 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { reqId, dappOrigin: dappOrigin, method - }) + }) + if (pendingImRequests[key].isAuthorizing && pendingImRequests[key].lastAuthroizingTimestamp && (Date.now() - pendingImRequests[key].lastAuthroizingTimestamp > 15 * 1000)) { + pendingImRequests[key].isAuthorizing = false + } if (!pendingImRequests[key].isAuthorizing) { pendingImRequests[key].isAuthorizing = true - setTimeout(() => { - pendingImRequests[key].isAuthorizing = false - }, 15 * 1000) + pendingImRequests[key].lastAuthroizingTimestamp = Date.now() + + // Sometimes it does not execute. + // setTimeout(() => { + // pendingImRequests[key].isAuthorizing = false + // }, 15 * 1000) const url = `tanglepay://iota_im_authorize?origin=${origin}&content=${dappOrigin}&expires=${expires}&reqId=${reqId}&isSilent=1` params.url = chrome.runtime.getURL('index.html') + `?url=${encodeURIComponent(url)}` } diff --git a/public/manifest.json b/public/manifest.json index e56e387..b82b1ce 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "TanglePay IOTA Wallet", - "version": "1.6.3", + "version": "1.6.4", "description": "TanglePay is your IOTA wallet available on Chrome to explore Defi, NFT and more.", "icons": { "16": "images/16.png", @@ -18,7 +18,13 @@ "service_worker": "./js/background.js" }, "permissions": ["storage", "unlimitedStorage"], - "host_permissions": ["https://test.api.iotacat.com/","https://test2.api.iotacat.com/","https://explorer-api.iota.org/", "https://node.iotaichi.com/", "https://api.lb-0.h.chrysalis-devnet.iota.cafe/"], + "host_permissions": [ + "https://test.api.iotacat.com/", + "https://test2.api.iotacat.com/", + "https://explorer-api.iota.org/", + "https://node.iotaichi.com/", + "https://api.lb-0.h.chrysalis-devnet.iota.cafe/" + ], "web_accessible_resources": [ { "resources": ["js/inject.js", "font/OpenSans-Regular.ttf", "font/OpenSans-Semibold.ttf"], diff --git a/src/common/components/DappDialog.js b/src/common/components/DappDialog.js index 90cf039..8bc9105 100644 --- a/src/common/components/DappDialog.js +++ b/src/common/components/DappDialog.js @@ -38,7 +38,11 @@ export const DappDialog = () => { const ensureWalletStatus = () => { checkWalletIsPasswordEnabled(curWallet.id).then((res) => { setIsWalletPassowrdEnabled(res) - setPassword(context.state.pin) + if (!res) { + setPassword(context.state.pin) + } else { + setPassword('') + } }) } useEffect(() => { @@ -236,7 +240,6 @@ export const DappDialog = () => { break case 'iota_im_authorize': { - await Bridge.iota_im_authorized(curWallet, password, content, reqId) } break @@ -479,16 +482,16 @@ export const DappDialog = () => { showValue = value / Math.pow(10, foundryData.decimals || 0) sendAmount = value showUnit = unit - } else if (IotaSDK.isIotaStardust(curNodeId)){ + } else if (IotaSDK.isIotaStardust(curNodeId)) { const iotaDecimal = IotaSDK.curNode?.decimal || 6 unit = 'IOTA' showValue = Base.formatNum(BigNumber(value).div(Math.pow(10, iotaDecimal)).valueOf(), iotaDecimal) - if(parseFloat(showValue) < Math.pow(10, -iotaDecimal)) { + if (parseFloat(showValue) < Math.pow(10, -iotaDecimal)) { showValue = Math.pow(10, -iotaDecimal) } sendAmount = BigNumber(showValue).times(Math.pow(10, iotaDecimal)).valueOf() showUnit = unit - }else { + } else { unit = unit || 'SMR' if (!['SMR', 'Glow', 'IOTA'].includes(unit)) { unit = 'SMR' @@ -525,8 +528,8 @@ export const DappDialog = () => { .replace('#fee#', gasFee) str = `${origin}
` + str - const dataFromLink = res.metadata ? {metadata: res.metadata} : null - const dataPerRequest = await Bridge.sendToContentScriptGetData('data_per_request_prefix_' + reqId) || dataFromLink + const dataFromLink = res.metadata ? { metadata: res.metadata } : null + const dataPerRequest = (await Bridge.sendToContentScriptGetData('data_per_request_prefix_' + reqId)) || dataFromLink setDappData({ texts: [{ text: str }], return_url, @@ -650,25 +653,24 @@ export const DappDialog = () => { show() } break - case 'iota_im_authorize': - { - let str = I18n.t('apps.ImAuthorize') - const texts = [ - { - text: str.replace(/\n/g, '
') - } - ] - setDappData({ - texts, - return_url, - type, - content, - origin, - expires, - reqId - }) - show() - } + case 'iota_im_authorize': { + let str = I18n.t('apps.ImAuthorize') + const texts = [ + { + text: str.replace(/\n/g, '
') + } + ] + setDappData({ + texts, + return_url, + type, + content, + origin, + expires, + reqId + }) + show() + } default: break } @@ -693,7 +695,7 @@ export const DappDialog = () => { if (canShowDappDialog) { const params = Base.handlerParams(window.location.search) const url = params.url - console.log('deeplinkurl',url) + console.log('deeplinkurl', url) if (checkDeepLink(url)) { // handle silent case let res = Base.handlerParams(url) @@ -706,19 +708,19 @@ export const DappDialog = () => { let [type, address] = path.split('/') res = Object.assign(res, { type, address }) } - console.log('dapp data',res) + console.log('dapp data', res) let { isSilent = '' } = res if (isSilent) { const isPasswordEnabled = await checkWalletIsPasswordEnabled(curWallet.id) if (!isPasswordEnabled) { console.log('entering silent ') - const {type, content, reqId} = res + const { type, content, reqId } = res let isSilentProcessed = false switch (type) { case 'iota_im_authorize': await Bridge.iota_im_authorized(curWallet, context.state.pin, content, reqId) isSilentProcessed = true - break; + break } if (isSilentProcessed) { Bridge.closeWindow() diff --git a/src/panels/account/into/pin.js b/src/panels/account/into/pin.js index 66e89c9..3a63170 100644 --- a/src/panels/account/into/pin.js +++ b/src/panels/account/into/pin.js @@ -139,7 +139,7 @@ export const AccountIntoPin = () => { )} -
{I18n.t('account.intoName')}
+
{I18n.t('account.intoName')}
{shouldShowPin && ( diff --git a/src/panels/assets/trading/index.js b/src/panels/assets/trading/index.js index 1a9c985..4491436 100644 --- a/src/panels/assets/trading/index.js +++ b/src/panels/assets/trading/index.js @@ -26,6 +26,7 @@ export const AssetsTrading = () => { const id = params.id const [unlockConditions] = useStore('common.unlockConditions') const [nftUnlockList] = useStore('nft.unlockList') + const [, refreshNftAssets] = useStore('nft.forceRequest') useGetNftList() useGetAssetsList(curWallet) const [isWalletPasswordEnabled, setIsWalletPasswordEnabled] = useState(false) @@ -118,7 +119,7 @@ export const AssetsTrading = () => { validateOnBlur={false} validateOnChange={false} validateOnMount={false} - validationSchema={(isLedger || !isWalletPasswordEnabled) ? schemaNopassword : schema} + validationSchema={isLedger || !isWalletPasswordEnabled ? schemaNopassword : schema} onSubmit={async (values) => { let { password } = values if (!isWalletPasswordEnabled) { @@ -132,6 +133,8 @@ export const AssetsTrading = () => { } try { Toast.showLoading() + const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) + await sleep(300) const info = { ...curInfo, curWallet: { ...curWallet, password } @@ -154,7 +157,11 @@ export const AssetsTrading = () => { // } Toast.hideLoading() Toast.show(I18n.t('assets.acceptSucc')) + await sleep(500) IotaSDK.refreshAssets() + if (info.nftId) { + refreshNftAssets() + } setTimeout(() => { IotaSDK.refreshAssets() }, 3000) diff --git a/src/panels/main/assets/index.js b/src/panels/main/assets/index.js index cac3bde..4af6c21 100644 --- a/src/panels/main/assets/index.js +++ b/src/panels/main/assets/index.js @@ -34,7 +34,7 @@ export const Assets = ({ tabKey }) => { const checkPush = (path) => { if (!curWallet.address) { if (isNewWalletFlow()) { - Base.push('/account/registerPin') + Base.push('/account/registerPin') } else { Base.push('/account/register') } @@ -133,7 +133,7 @@ export const Assets = ({ tabKey }) => {
- {assetsTab.includes('stake') && } + {/* {assetsTab.includes('stake') && } */}
{!isRequestAssets ? (
diff --git a/src/panels/main/assets/list.js b/src/panels/main/assets/list.js index bb0cbeb..35a889c 100644 --- a/src/panels/main/assets/list.js +++ b/src/panels/main/assets/list.js @@ -85,7 +85,7 @@ export const CoinList = () => { className='border-b flex flex1 row ac jsb'>
{String(e.name).toLocaleUpperCase()}
- {!IotaSDK.isWeb3Node && statedAmount && e.realBalance > 0 && statedAmount > 0 && !needRestake ? ( + {/* {!IotaSDK.isWeb3Node && statedAmount && e.realBalance > 0 && statedAmount > 0 && !needRestake ? (
{ className='fz12 border cS'> {I18n.t('staking.title')}
- ) : null} + ) : null} */}
{isShowAssets ? (
diff --git a/yarn.lock b/yarn.lock index 4bb9a74..f42f9b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12123,10 +12123,10 @@ tailwindcss@^3.0.2: resolve "^1.22.2" sucrase "^3.32.0" -tanglepay@^2.7.1: - version "2.7.1" - resolved "https://registry.yarnpkg.com/tanglepay/-/tanglepay-2.7.1.tgz#b396cc6f8d7c7e530c7759401b260bb815bb5703" - integrity sha512-UDlQ+3dGOdAK8KsB324kEzKenrJfq8HU7p3T8K7wel65jZxeD6LX2NDM6c0/hDySvD8lVnNWOajB+Br44JPeRw== +tanglepay@^2.7.4: + version "2.7.4" + resolved "https://registry.yarnpkg.com/tanglepay/-/tanglepay-2.7.4.tgz#5edf2f081f7d1f749d0589e712eadce1616e0620" + integrity sha512-7jlg5Jmbm63srfQXtKD+qL3VD5LUxzOPwyoxC3rofEcF2MbWGnLb10SJf/YC0/VjYB5YrIRzLlqdh60eUiG2WA== tapable@^1.0.0: version "1.1.3"