From d29aafb560662864678681ba8a8a0fc2f9a6205a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Tue, 25 Jun 2024 09:49:34 -0400 Subject: [PATCH 01/12] feat: start using native token uid and data --- src/components/TokenAdministrative.js | 2 +- src/components/TxData.js | 13 ++++++++----- src/sagas/wallet.js | 9 +++++---- src/screens/CreateNFT.js | 2 +- src/screens/CreateToken.js | 2 +- src/screens/Server.js | 2 +- src/screens/Settings.js | 2 +- src/screens/TransactionDetail.js | 4 ++-- src/screens/Wallet.js | 4 ++-- src/utils/atomicSwap.js | 4 ++-- src/utils/tokens.js | 4 ++-- src/utils/wallet.js | 4 ++-- 12 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/components/TokenAdministrative.js b/src/components/TokenAdministrative.js index b9fa1252..aeb957f4 100644 --- a/src/components/TokenAdministrative.js +++ b/src/components/TokenAdministrative.js @@ -22,7 +22,7 @@ import { TOKEN_DOWNLOAD_STATUS } from '../sagas/tokens'; import LOCAL_STORE from '../storage'; const mapStateToProps = (state) => { - const HTR_UID = hathorLib.constants.HATHOR_TOKEN_CONFIG.uid; + const HTR_UID = hathorLib.constants.NATIVE_TOKEN_UID; const htrBalance = get(state.tokensBalance, `${HTR_UID}.data.available`, 0); return { diff --git a/src/components/TxData.js b/src/components/TxData.js index 66c81b4f..44b36824 100644 --- a/src/components/TxData.js +++ b/src/components/TxData.js @@ -311,7 +311,8 @@ class TxData extends React.Component { */ getOutputToken = (tokenData) => { if (tokenData === hathorLib.constants.HATHOR_TOKEN_INDEX) { - return hathorLib.constants.HATHOR_TOKEN_CONFIG; + const wallet = getGlobalWallet(); + return wallet.storage.config.getNativeTokenData(); } const tokenConfig = this.props.transaction.tokens[tokenData - 1]; return tokenConfig; @@ -325,8 +326,10 @@ class TxData extends React.Component { * @return {string} Token symbol */ getSymbol = (uid) => { - if (uid === hathorLib.constants.HATHOR_TOKEN_CONFIG.uid) { - return hathorLib.constants.HATHOR_TOKEN_CONFIG.symbol; + if (uid === hathorLib.constants.NATIVE_TOKEN_UID) { + const wallet = getGlobalWallet(); + const nativeToken = wallet.storage.config.getNativeTokenData(); + return nativeToken.symbol; } const tokenConfig = this.props.transaction.tokens.find((token) => token.uid === uid); if (tokenConfig === undefined) return ''; @@ -342,7 +345,7 @@ class TxData extends React.Component { */ getUIDFromTokenData = (tokenData) => { if (tokenData === hathorLib.constants.HATHOR_TOKEN_INDEX) { - return hathorLib.constants.HATHOR_TOKEN_CONFIG.uid; + return hathorLib.constants.NATIVE_TOKEN_UID; } const tokenConfig = this.props.transaction.tokens[tokenData - 1]; return tokenConfig.uid; @@ -718,7 +721,7 @@ class TxData extends React.Component { const renderTokenList = () => { const renderTokenUID = (token) => { - if (token.uid === hathorLib.constants.HATHOR_TOKEN_CONFIG.uid) { + if (token.uid === hathorLib.constants.NATIVE_TOKEN_UID) { return token.uid; } else if (token.unknown) { return ( diff --git a/src/sagas/wallet.js b/src/sagas/wallet.js index b8ee5897..7bbb2363 100644 --- a/src/sagas/wallet.js +++ b/src/sagas/wallet.js @@ -313,7 +313,8 @@ export function* startWallet(action) { } } - yield call([wallet.storage, wallet.storage.registerToken], hathorLibConstants.HATHOR_TOKEN_CONFIG); + const nativeToken = wallet.storage.config.getNativeTokenData(); + yield call([wallet.storage, wallet.storage.registerToken], nativeToken); if (hardware) { // This will verify all ledger trusted tokens to check their validity @@ -366,7 +367,7 @@ export function* startWallet(action) { * to asynchronously load all registered tokens */ export function* loadTokens() { - const htrUid = hathorLibConstants.HATHOR_TOKEN_CONFIG.uid; + const htrUid = hathorLibConstants.NATIVE_TOKEN_UID; yield call(fetchTokenData, htrUid); const wallet = getGlobalWallet(); @@ -647,7 +648,7 @@ export function* bestBlockUpdate({ payload }) { } if (currentHeight !== payload) { - yield put(tokenFetchBalanceRequested(hathorLibConstants.HATHOR_TOKEN_CONFIG.uid)); + yield put(tokenFetchBalanceRequested(hathorLibConstants.NATIVE_TOKEN_UID)); } } @@ -682,7 +683,7 @@ export function* walletReloading() { // We might have lost transactions during the reload, so we must invalidate the // token histories: for (const tokenUid of Object.keys(allTokens)) { - if (tokenUid === hathorLibConstants.HATHOR_TOKEN_CONFIG.uid) { + if (tokenUid === hathorLibConstants.NATIVE_TOKEN_UID) { continue; } yield put(tokenInvalidateHistory(tokenUid)); diff --git a/src/screens/CreateNFT.js b/src/screens/CreateNFT.js index 33a6ddf5..5096ab50 100644 --- a/src/screens/CreateNFT.js +++ b/src/screens/CreateNFT.js @@ -48,7 +48,7 @@ function CreateNFT() { const createMeltAuthorityRef = useRef(); const { htrBalance, useWalletService } = useSelector((state) => { - const HTR_UID = hathorLib.constants.HATHOR_TOKEN_CONFIG.uid; + const HTR_UID = hathorLib.constants.NATIVE_TOKEN_UID; const htrBalance = get(state.tokensBalance, `${HTR_UID}.data.available`, 0); return { diff --git a/src/screens/CreateToken.js b/src/screens/CreateToken.js index 97d52e01..3be1ba3b 100644 --- a/src/screens/CreateToken.js +++ b/src/screens/CreateToken.js @@ -33,7 +33,7 @@ import { getGlobalWallet } from "../modules/wallet"; function CreateToken() { const { htrBalance, useWalletService } = useSelector(state => ({ - htrBalance: get(state.tokensBalance, `${hathorLib.constants.HATHOR_TOKEN_CONFIG.uid}.data.available`, 0), + htrBalance: get(state.tokensBalance, `${hathorLib.constants.NATIVE_TOKEN_UID}.data.available`, 0), useWalletService: state.useWalletService, })); const wallet = getGlobalWallet(); diff --git a/src/screens/Server.js b/src/screens/Server.js index b0949ed5..4ca3f1b0 100644 --- a/src/screens/Server.js +++ b/src/screens/Server.js @@ -260,7 +260,7 @@ function Server() { // Forces the selected token back to the default, as custom tokens will not be available in different networks if (networkChanged) { - dispatch(selectToken(hathorLib.constants.HATHOR_TOKEN_CONFIG.uid)); + dispatch(selectToken(hathorLib.constants.NATIVE_TOKEN_UID)); } // We don't have PIN on hardware wallet diff --git a/src/screens/Settings.js b/src/screens/Settings.js index 2dd1e5f9..34e9ff80 100644 --- a/src/screens/Settings.js +++ b/src/screens/Settings.js @@ -111,7 +111,7 @@ function Settings() { // First we get all token configs from registered tokens array, // remove the HTR token with filter, then map to each configuration string const configurationStrings = registeredTokens.filter((token) => { - return token.uid !== hathorLib.constants.HATHOR_TOKEN_CONFIG.uid; + return token.uid !== hathorLib.constants.NATIVE_TOKEN_UID; }).map((token) => { return hathorLib.tokensUtils.getConfigurationString(token.uid, token.name, token.symbol); }); diff --git a/src/screens/TransactionDetail.js b/src/screens/TransactionDetail.js index 13e67e18..c4d950f4 100644 --- a/src/screens/TransactionDetail.js +++ b/src/screens/TransactionDetail.js @@ -72,7 +72,7 @@ function TransactionDetail() { for (const output of data.tx.outputs) { if (!output.token) { if (output.token_data === 0) { - output.token = hathorLib.constants.HATHOR_TOKEN_CONFIG.uid; + output.token = hathorLib.constants.NATIVE_TOKEN_UID; } else { output.token = data.tx.tokens[(output.token_data & hathorLib.constants.TOKEN_INDEX_MASK) -1].uid; } @@ -82,7 +82,7 @@ function TransactionDetail() { for (const input of data.tx.inputs) { if (!input.token) { if (input.token_data === 0) { - input.token = hathorLib.constants.HATHOR_TOKEN_CONFIG.uid; + input.token = hathorLib.constants.NATIVE_TOKEN_UID; } else { input.token = data.tx.tokens[(input.token_data & hathorLib.constants.TOKEN_INDEX_MASK) -1].uid; } diff --git a/src/screens/Wallet.js b/src/screens/Wallet.js index 6c2721d1..92abaa17 100644 --- a/src/screens/Wallet.js +++ b/src/screens/Wallet.js @@ -114,7 +114,7 @@ function Wallet() { setShouldShowAdministrativeTab(false); // No need to download token info and mint/melt info if the token is hathor - if (selectedToken === hathorLib.constants.HATHOR_TOKEN_CONFIG.uid) { + if (selectedToken === hathorLib.constants.NATIVE_TOKEN_UID) { return; } @@ -151,7 +151,7 @@ function Wallet() { */ async function updateTokenInfo(tokenUid) { // No need to fetch token info if the token is hathor - if (tokenUid === hathorLib.constants.HATHOR_TOKEN_CONFIG.uid) { + if (tokenUid === hathorLib.constants.NATIVE_TOKEN_UID) { return; } const tokenDetails = await wallet.getTokenDetails(tokenUid); diff --git a/src/utils/atomicSwap.js b/src/utils/atomicSwap.js index 7dce7009..06ed0bf6 100644 --- a/src/utils/atomicSwap.js +++ b/src/utils/atomicSwap.js @@ -13,7 +13,7 @@ import { tokensUtils, config as hathorLibConfig, } from "@hathor/wallet-lib"; -import { TOKEN_MINT_MASK, TOKEN_MELT_MASK, HATHOR_TOKEN_CONFIG } from "@hathor/wallet-lib/lib/constants"; +import { TOKEN_MINT_MASK, TOKEN_MELT_MASK, NATIVE_TOKEN_UID } from "@hathor/wallet-lib/lib/constants"; import { get } from 'lodash'; import walletUtil from "./wallet"; @@ -306,7 +306,7 @@ export const translateTxToProposalUtxo = async (txId, index, wallet) => { if (!tokenId) { // This should never happen since the fullnode always sends the token uid. const tokenIndex = tokensUtils.getTokenIndexFromData(txout.token_data); - tokenId = [HATHOR_TOKEN_CONFIG.uid, ...tx.tokens][tokenIndex]; + tokenId = [NATIVE_TOKEN_UID, ...tx.tokens][tokenIndex]; } return { diff --git a/src/utils/tokens.js b/src/utils/tokens.js index 34a2ac91..5b564062 100644 --- a/src/utils/tokens.js +++ b/src/utils/tokens.js @@ -26,7 +26,7 @@ const tokens = { * @returns {Promise} */ async getRegisteredTokens(wallet, excludeDefaultToken = false) { - const htrUid = hathorLib.constants.HATHOR_TOKEN_CONFIG.uid; + const htrUid = hathorLib.constants.NATIVE_TOKEN_UID; const tokens = []; // redux-saga generator magic does not work well with the "for await..of" syntax @@ -78,7 +78,7 @@ const tokens = { const globalWallet = getGlobalWallet(); await globalWallet.storage.unregisterToken(uid); const tokens = await this.getRegisteredTokens(globalWallet); - store.dispatch(newTokens({tokens, uid: hathorLib.constants.HATHOR_TOKEN_CONFIG.uid})); + store.dispatch(newTokens({tokens, uid: hathorLib.constants.NATIVE_TOKEN_UID})); store.dispatch(removeTokenMetadata(uid)); }, diff --git a/src/utils/wallet.js b/src/utils/wallet.js index 36f25848..87832e1a 100644 --- a/src/utils/wallet.js +++ b/src/utils/wallet.js @@ -175,7 +175,7 @@ const wallet = { const tokenChunks = chunk(tokens, METADATA_CONCURRENT_DOWNLOAD); for (const chunk of tokenChunks) { await Promise.all(chunk.map(async (token) => { - if (token === hathorConstants.HATHOR_TOKEN_CONFIG.uid) { + if (token === hathorConstants.NATIVE_TOKEN_UID) { return; } @@ -286,7 +286,7 @@ const wallet = { }; // If we indicated this token should always be exhibited, add it already. - const isTokenHTR = tokenUid === hathorConstants.HATHOR_TOKEN_CONFIG.uid; + const isTokenHTR = tokenUid === hathorConstants.NATIVE_TOKEN_UID; const alwaysShowThisToken = alwaysShowTokensArray.find(alwaysShowUid => alwaysShowUid === tokenUid); if (isTokenHTR || alwaysShowThisToken) { From ada5b7a93757a78aa2e6170e761db0e11b83f7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Tue, 25 Jun 2024 10:09:28 -0400 Subject: [PATCH 02/12] feat: reducer changes --- src/reducers/index.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/reducers/index.js b/src/reducers/index.js index cc491ef1..fec1c8f1 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -12,7 +12,7 @@ import { get } from 'lodash'; import { TOKEN_DOWNLOAD_STATUS } from '../sagas/tokens'; import { WALLET_STATUS } from '../sagas/wallet'; import { PROPOSAL_DOWNLOAD_STATUS } from '../utils/atomicSwap'; -import { HATHOR_TOKEN_CONFIG } from "@hathor/wallet-lib/lib/constants"; +import { NATIVE_TOKEN_UID } from "@hathor/wallet-lib/lib/constants"; import helpersUtils from '../utils/helpers'; import LOCAL_STORE from '../storage'; @@ -63,9 +63,9 @@ const initialState = { requestErrorStatusCode: undefined, // Tokens already saved: array of objects // {'name', 'symbol', 'uid'} - tokens: [hathorLib.constants.HATHOR_TOKEN_CONFIG], + tokens: [], // Token selected (by default is HATHOR) - selectedToken: hathorLib.constants.HATHOR_TOKEN_CONFIG.uid, + selectedToken: NATIVE_TOKEN_UID, /** * List of all tokens seen in transactions * @type {Record} @@ -118,14 +118,7 @@ const initialState = { * - Those that were present in at least one proposal in which this wallet participated * @type {Record} */ - tokensCache: { - '00': { - tokenUid: HATHOR_TOKEN_CONFIG.uid, - symbol: HATHOR_TOKEN_CONFIG.symbol, - name: HATHOR_TOKEN_CONFIG.name, - status: TOKEN_DOWNLOAD_STATUS.READY - } - }, + tokensCache: {}, featureTogglesInitialized: false, featureToggles: { ...FEATURE_TOGGLE_DEFAULTS, @@ -373,8 +366,7 @@ const onUpdateTokenHistory = (state, action) => { const onUpdateHeight = (state, action) => { if (action.payload.height !== state.height) { const tokensBalance = {}; - const { uid } = hathorLib.constants.HATHOR_TOKEN_CONFIG; - tokensBalance[uid] = action.payload.htrUpdatedBalance; + tokensBalance[hathorLib.constants.NATIVE_TOKEN_UID] = action.payload.htrUpdatedBalance; const newTokensBalance = Object.assign({}, state.tokensBalance, tokensBalance); return { ...state, @@ -496,7 +488,7 @@ export const resetSelectedTokenIfNeeded = (state, action) => { if (hasZeroBalance) { return { ...state, - selectedToken: hathorLib.constants.HATHOR_TOKEN_CONFIG.uid + selectedToken: hathorLib.constants.NATIVE_TOKEN_UID, }; } From 736de05ebdffc4d99dc096c0eaa5593560acdbc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Tue, 25 Jun 2024 12:15:36 -0400 Subject: [PATCH 03/12] feat: set native token data before starting the wallet --- src/actions/index.js | 6 ++++++ src/reducers/index.js | 34 ++++++++++++++++++++++++++++++---- src/sagas/wallet.js | 38 +++++++++++++++++++++++++------------- 3 files changed, 61 insertions(+), 17 deletions(-) diff --git a/src/actions/index.js b/src/actions/index.js index 2cae24e2..3831ae7c 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -54,6 +54,7 @@ export const types = { UPDATE_TX_HISTORY: 'UPDATE_TX_HISTORY', UPDATE_MINING_SERVER: 'UPDATE_MINING_SERVER', SET_MINING_SERVER: 'SET_MINING_SERVER', + SET_NATIVE_TOKEN_DATA: 'SET_NATIVE_TOKEN_DATA', }; /** @@ -502,3 +503,8 @@ export const setMiningServer = (url) => ({ type: types.SET_MINING_SERVER, payload: url, }); + +export const setNativeTokenData = (data) => ({ + type: types.SET_NATIVE_TOKEN_DATA, + payload: data, +}); diff --git a/src/reducers/index.js b/src/reducers/index.js index fec1c8f1..e917f49c 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -5,10 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import hathorLib from '@hathor/wallet-lib'; import { FEATURE_TOGGLE_DEFAULTS, VERSION } from '../constants'; import { types } from '../actions'; -import { get } from 'lodash'; +import { get, findIndex } from 'lodash'; import { TOKEN_DOWNLOAD_STATUS } from '../sagas/tokens'; import { WALLET_STATUS } from '../sagas/wallet'; import { PROPOSAL_DOWNLOAD_STATUS } from '../utils/atomicSwap'; @@ -252,6 +251,8 @@ const rootReducer = (state = initialState, action) => { return onWalletStateChanged(state, action); case types.SET_MINING_SERVER: return onSetMiningServer(state, action); + case types.SET_NATIVE_TOKEN_DATA: + return onSetNativeTokenData(state, action); default: return state; } @@ -366,7 +367,7 @@ const onUpdateTokenHistory = (state, action) => { const onUpdateHeight = (state, action) => { if (action.payload.height !== state.height) { const tokensBalance = {}; - tokensBalance[hathorLib.constants.NATIVE_TOKEN_UID] = action.payload.htrUpdatedBalance; + tokensBalance[NATIVE_TOKEN_UID] = action.payload.htrUpdatedBalance; const newTokensBalance = Object.assign({}, state.tokensBalance, tokensBalance); return { ...state, @@ -488,7 +489,7 @@ export const resetSelectedTokenIfNeeded = (state, action) => { if (hasZeroBalance) { return { ...state, - selectedToken: hathorLib.constants.NATIVE_TOKEN_UID, + selectedToken: NATIVE_TOKEN_UID, }; } @@ -1004,4 +1005,29 @@ export const onSetMiningServer = (state, { payload }) => ({ miningServer: payload, }); +export const onSetNativeTokenData = (state, { payload }) => { + let tokens = [...state.tokens]; + if (state.tokens.length === 0) { + tokens = [{...payload, uid: NATIVE_TOKEN_UID}]; + } else { + const nativeTokenIndex = findIndex(state.tokens, (e) => e.uid === NATIVE_TOKEN_UID); + tokens[nativeTokenIndex] = {...payload, uid: NATIVE_TOKEN_UID}; + } + + return { + ...state, + nativeTokenData: payload, + tokens, + tokensCache: { + ...state.tokensCache, + [NATIVE_TOKEN_UID]: { + tokenUid: NATIVE_TOKEN_UID, + symbol: payload.symbol, + name: payload.name, + status: TOKEN_DOWNLOAD_STATUS.READY + } + } + }; +}; + export default rootReducer; diff --git a/src/sagas/wallet.js b/src/sagas/wallet.js index 7bbb2363..59b6296a 100644 --- a/src/sagas/wallet.js +++ b/src/sagas/wallet.js @@ -7,6 +7,7 @@ import { transactionUtils, errors as hathorErrors, cryptoUtils, + versionApi, } from '@hathor/wallet-lib'; import { takeLatest, @@ -242,6 +243,9 @@ export function* startWallet(action) { // wait until the wallet is ready yield fork(listenForWalletReady, wallet); + // Call the server version api and update the server info + yield call(updateServerInfo, wallet); + try { console.log('[*] Start wallet.'); const serverInfo = yield call([wallet, wallet.start], { @@ -249,19 +253,6 @@ export function* startWallet(action) { password, }); console.log('[+] Start wallet.', serverInfo); - - let version; - let serverNetworkName = networkName; - - if (serverInfo) { - version = serverInfo.version; - serverNetworkName = serverInfo.network && serverInfo.network.split('-')[0]; - } - - yield put(setServerInfo({ - version, - network: serverNetworkName, - })); } catch(e) { if (useWalletService) { // Wallet Service start wallet will fail if the status returned from @@ -362,6 +353,27 @@ export function* startWallet(action) { } } +/** + * Get the configured fullnode's version data and dispatch it to the store. + * @returns {Promise} + */ +export function* updateServerInfo(wallet) { + const versionData = await new Promise((resolve, reject) => { + versionApi.getVersion(resolve).catch(error => reject(error)); + }); + + yield put(setServerInfo({ + version: versionData.version, + network: versionData.network && versionData.network.split('-')[0], + })); + + if (versionData.native_token) { + wallet.storage.config.setNativeTokenData(versionData.native_token); + // Update redux store + yield put(nativeTokenUpdated(versionData.native_token)); + } +} + /** * This saga will load HTR history and balance and dispatch actions * to asynchronously load all registered tokens From fa52900a7691dd86d9e7150aa7e124aba06bf535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Tue, 25 Jun 2024 15:04:58 -0400 Subject: [PATCH 04/12] chore: do not use await outside async --- src/sagas/wallet.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sagas/wallet.js b/src/sagas/wallet.js index 59b6296a..ab6f26d3 100644 --- a/src/sagas/wallet.js +++ b/src/sagas/wallet.js @@ -358,8 +358,10 @@ export function* startWallet(action) { * @returns {Promise} */ export function* updateServerInfo(wallet) { - const versionData = await new Promise((resolve, reject) => { - versionApi.getVersion(resolve).catch(error => reject(error)); + const versionData = yield call(async () => { + return new Promise((resolve, reject) => { + versionApi.getVersion(resolve).catch(error => reject(error)); + }); }); yield put(setServerInfo({ From 07d8c7ce7aafb4265bd5142225ea5b575123b4a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Tue, 25 Jun 2024 17:23:29 -0400 Subject: [PATCH 05/12] chore: native token is updated on wallet start --- src/sagas/wallet.js | 48 +++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/src/sagas/wallet.js b/src/sagas/wallet.js index ab6f26d3..47e7311d 100644 --- a/src/sagas/wallet.js +++ b/src/sagas/wallet.js @@ -8,6 +8,7 @@ import { errors as hathorErrors, cryptoUtils, versionApi, + defaults as hathorLibDefaults, } from '@hathor/wallet-lib'; import { takeLatest, @@ -61,6 +62,7 @@ import { changeWalletState, updateTxHistory, setMiningServer, + setNativeTokenData, } from '../actions'; import { specificTypeAndPayload, @@ -243,9 +245,6 @@ export function* startWallet(action) { // wait until the wallet is ready yield fork(listenForWalletReady, wallet); - // Call the server version api and update the server info - yield call(updateServerInfo, wallet); - try { console.log('[*] Start wallet.'); const serverInfo = yield call([wallet, wallet.start], { @@ -253,6 +252,26 @@ export function* startWallet(action) { password, }); console.log('[+] Start wallet.', serverInfo); + + // Use HTR as default + let nativeToken = hathorLibDefaults.HATHOR_TOKEN_CONFIG; + if (info.native_token) { + nativeToken = info.native_token; + } + yield put(setNativeTokenData(nativeToken)); + + let version; + let serverNetworkName = networkName; + + if (serverInfo) { + version = serverInfo.version; + serverNetworkName = serverInfo.network && serverInfo.network.split('-')[0]; + } + + yield put(setServerInfo({ + version, + network: serverNetworkName, + })); } catch(e) { if (useWalletService) { // Wallet Service start wallet will fail if the status returned from @@ -353,29 +372,6 @@ export function* startWallet(action) { } } -/** - * Get the configured fullnode's version data and dispatch it to the store. - * @returns {Promise} - */ -export function* updateServerInfo(wallet) { - const versionData = yield call(async () => { - return new Promise((resolve, reject) => { - versionApi.getVersion(resolve).catch(error => reject(error)); - }); - }); - - yield put(setServerInfo({ - version: versionData.version, - network: versionData.network && versionData.network.split('-')[0], - })); - - if (versionData.native_token) { - wallet.storage.config.setNativeTokenData(versionData.native_token); - // Update redux store - yield put(nativeTokenUpdated(versionData.native_token)); - } -} - /** * This saga will load HTR history and balance and dispatch actions * to asynchronously load all registered tokens From 63e9afb7acba49a8adcce49244d6cfac06964846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Tue, 25 Jun 2024 18:00:36 -0400 Subject: [PATCH 06/12] feat: get native token data from storage --- src/components/TxData.js | 4 ++-- src/sagas/wallet.js | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/TxData.js b/src/components/TxData.js index 44b36824..b59f9e86 100644 --- a/src/components/TxData.js +++ b/src/components/TxData.js @@ -312,7 +312,7 @@ class TxData extends React.Component { getOutputToken = (tokenData) => { if (tokenData === hathorLib.constants.HATHOR_TOKEN_INDEX) { const wallet = getGlobalWallet(); - return wallet.storage.config.getNativeTokenData(); + return wallet.storage.getNativeTokenData(); } const tokenConfig = this.props.transaction.tokens[tokenData - 1]; return tokenConfig; @@ -328,7 +328,7 @@ class TxData extends React.Component { getSymbol = (uid) => { if (uid === hathorLib.constants.NATIVE_TOKEN_UID) { const wallet = getGlobalWallet(); - const nativeToken = wallet.storage.config.getNativeTokenData(); + const nativeToken = wallet.storage.getNativeTokenData(); return nativeToken.symbol; } const tokenConfig = this.props.transaction.tokens.find((token) => token.uid === uid); diff --git a/src/sagas/wallet.js b/src/sagas/wallet.js index 47e7311d..84ca7ab6 100644 --- a/src/sagas/wallet.js +++ b/src/sagas/wallet.js @@ -8,7 +8,6 @@ import { errors as hathorErrors, cryptoUtils, versionApi, - defaults as hathorLibDefaults, } from '@hathor/wallet-lib'; import { takeLatest, @@ -254,7 +253,7 @@ export function* startWallet(action) { console.log('[+] Start wallet.', serverInfo); // Use HTR as default - let nativeToken = hathorLibDefaults.HATHOR_TOKEN_CONFIG; + let nativeToken = hathorLibConstants.DEFAULT_TOKEN_CONFIG; if (info.native_token) { nativeToken = info.native_token; } @@ -323,7 +322,7 @@ export function* startWallet(action) { } } - const nativeToken = wallet.storage.config.getNativeTokenData(); + const nativeToken = wallet.storage.getNativeTokenData(); yield call([wallet.storage, wallet.storage.registerToken], nativeToken); if (hardware) { From b294634ed81cb24bb5635bc2f2305f46feefd4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Wed, 26 Jun 2024 12:27:58 -0400 Subject: [PATCH 07/12] feat: remove all HTR mentions --- src/components/tokens/TokenMint.js | 5 +++-- src/screens/CreateNFT.js | 13 +++++++------ src/screens/CreateToken.js | 7 ++++--- src/screens/CustomTokens.js | 2 +- src/screens/Welcome.js | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/components/tokens/TokenMint.js b/src/components/tokens/TokenMint.js index af409ab6..543be758 100644 --- a/src/components/tokens/TokenMint.js +++ b/src/components/tokens/TokenMint.js @@ -210,13 +210,14 @@ class TokenMint extends React.Component { const wallet = getGlobalWallet(); const depositPercent = wallet.storage.getTokenDepositPercentage(); + const nativeTokenConfig = wallet.storage.getNativeTokenData(); return (

Create NFT

{t`Here you will create a new NFT. After the creation, you will be able to send the units of this NFT to other addresses.`}

-

{t`NFTs share the address space with all other tokens, including HTR. This means that you can send and receive tokens using any valid address.`}

+

{t`NFTs share the address space with all other tokens, including ${nativeTokenConfig.symbol}. This means that you can send and receive tokens using any valid address.`}

{t`Remember to make a backup of your new token's configuration string. You will need to send it to other people to allow them to use your NFT.`}

{str2jsx( - t`When creating and minting NFTs, a |bold:deposit of ${htrDeposit}%| in HTR is required and an additional |bold:fee of ${nftFee} HTR|. If these tokens are later melted, this HTR deposit will be returned (depending on the amount melted) and the fee will never be returned. Read more about the NFT standard |link:here|.`, + t`When creating and minting NFTs, a |bold:deposit of ${htrDeposit}%| in ${nativeTokenConfig.symbol} is required and an additional |bold:fee of ${nftFee} ${nativeTokenConfig.symbol}|. If these tokens are later melted, this ${nativeTokenConfig.symbol} deposit will be returned (depending on the amount melted) and the fee will never be returned. Read more about the NFT standard |link:here|.`, { bold: (x, i) => {x}, link: (x, i) => {x}, @@ -345,10 +346,10 @@ function CreateNFT() {


-

HTR available: {hathorLib.numberUtils.prettyValue(htrBalance)} HTR

-

Deposit: {hathorLib.numberUtils.prettyValue(depositAmount)} HTR

-

Fee: {nftFee} HTR

-

Total: {hathorLib.numberUtils.prettyValue(tokensUtils.getNFTFee() + depositAmount)} HTR

+

${nativeTokenConfig.symbol} available: {hathorLib.numberUtils.prettyValue(htrBalance)} ${nativeTokenConfig.symbol}

+

Deposit: {hathorLib.numberUtils.prettyValue(depositAmount)} ${nativeTokenConfig.symbol}

+

Fee: {nftFee} ${nativeTokenConfig.symbol}

+

Total: {hathorLib.numberUtils.prettyValue(tokensUtils.getNFTFee() + depositAmount)} ${nativeTokenConfig.symbol}

{errorMessage}

diff --git a/src/screens/CreateToken.js b/src/screens/CreateToken.js index 3be1ba3b..510d18a3 100644 --- a/src/screens/CreateToken.js +++ b/src/screens/CreateToken.js @@ -238,17 +238,18 @@ function CreateToken() { const depositPercent = wallet.storage.getTokenDepositPercentage(); const htrDeposit = depositPercent * 100; + const nativeTokenConfig = wallet.storage.getNativeTokenData(); return (

Create Token

{t`Here you will create a new customized token. After the creation, you will be able to send this new token to other addresses.`}

-

{t`Custom tokens share the address space with all other tokens, including HTR. This means that you can send and receive tokens using any valid address.`}

+

{t`Custom tokens share the address space with all other tokens, including ${nativeTokenConfig.symbol}. This means that you can send and receive tokens using any valid address.`}

{t`Remember to make a backup of your new token's configuration string. You will need to send it to other people to allow them to use your new token.`}

{str2jsx( - t`When creating and minting tokens, a |bold:deposit of ${htrDeposit}%| in HTR is required. If these tokens are later melted, this HTR deposit will be returned. Read more about it |link:here|.`, + t`When creating and minting tokens, a |bold:deposit of ${htrDeposit}%| in ${nativeTokenConfig.symbol} is required. If these tokens are later melted, this ${nativeTokenConfig.symbol} deposit will be returned. Read more about it |link:here|.`, { bold: (x, i) => {x}, link: (x, i) => {x}, @@ -290,7 +291,7 @@ function CreateToken() {

-

Deposit: {tokens.getDepositAmount(amount, depositPercent)} HTR ({hathorLib.numberUtils.prettyValue(htrBalance)} HTR available)

+

Deposit: {tokens.getDepositAmount(amount, depositPercent)} ${nativeTokenConfig.symbol} ({hathorLib.numberUtils.prettyValue(htrBalance)} ${nativeTokenConfig.symbol} available)

{errorMessage}

diff --git a/src/screens/CustomTokens.js b/src/screens/CustomTokens.js index 1be07610..c55a20f7 100644 --- a/src/screens/CustomTokens.js +++ b/src/screens/CustomTokens.js @@ -72,7 +72,7 @@ function CustomTokens() {

{t`Custom Tokens`}

-

{t`You can create your own digital token with customized specifications on Hathor Network with only a few clicks. They will fully work under the same technical assumptions of high scalability and decentralized consensus of our native HTR tokens. Custom tokens will always work independently of the price of the native HTR token, and they can serve multiple purposes.`}

+

{t`You can create your own digital token with customized specifications on Hathor Network with only a few clicks. They will fully work under the same technical assumptions of high scalability and decentralized consensus of our native tokens. Custom tokens will always work independently of the price of the native token, and they can serve multiple purposes.`}

{t`Every custom token has a unique **Configuration String** which must be shared with all other people that will use the custom token.`}

{t`If you want to use a custom token that already exists, you need to register this token in your Hathor Wallet. For this, you will need the custom token's Configuration String, which you can get from the creators of the token.`}

diff --git a/src/screens/Welcome.js b/src/screens/Welcome.js index 6ec1911b..880e22e3 100644 --- a/src/screens/Welcome.js +++ b/src/screens/Welcome.js @@ -76,7 +76,7 @@ function Welcome() {

{t`Welcome to Hathor Wallet!`}

{t`This wallet is connected to the **mainnet**.`}

-

{t`Using this wallet you can (i) check your balance and history, (ii) send & receive HTR and other tokens running on Hathor, and (iii) create and manage your own tokens.`}

+

{t`Using this wallet you can (i) check your balance and history, (ii) send & receive tokens running on Hathor, and (iii) create and manage your own tokens.`}

{t`You should never share any information besides your addresses to other people. You're fully responsible for keeping your tokens safe.`}

{t`For further information, check our website (https://hathor.network/).`}

From 8134ae40fe85f9bfdf1211b8d9d98bead437c0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Fri, 28 Jun 2024 12:37:01 -0400 Subject: [PATCH 08/12] feat: review changes --- src/actions/index.js | 3 +++ src/reducers/index.js | 5 +++++ src/sagas/wallet.js | 6 +----- src/screens/CustomTokens.js | 5 ++++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/actions/index.js b/src/actions/index.js index 3831ae7c..cc4b6605 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -504,6 +504,9 @@ export const setMiningServer = (url) => ({ payload: url, }); +/** + * Set the native token data + */ export const setNativeTokenData = (data) => ({ type: types.SET_NATIVE_TOKEN_DATA, payload: data, diff --git a/src/reducers/index.js b/src/reducers/index.js index e917f49c..b329f9ed 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -123,6 +123,7 @@ const initialState = { ...FEATURE_TOGGLE_DEFAULTS, }, miningServer: null, + nativeTokenData: null, }; const rootReducer = (state = initialState, action) => { @@ -1011,6 +1012,10 @@ export const onSetNativeTokenData = (state, { payload }) => { tokens = [{...payload, uid: NATIVE_TOKEN_UID}]; } else { const nativeTokenIndex = findIndex(state.tokens, (e) => e.uid === NATIVE_TOKEN_UID); + if (nativeTokenIndex === -1) { + // In case the native token is not in the list, we add it as the first token + tokens = [{...payload, uid: NATIVE_TOKEN_UID}, ...state.tokens]; + } tokens[nativeTokenIndex] = {...payload, uid: NATIVE_TOKEN_UID}; } diff --git a/src/sagas/wallet.js b/src/sagas/wallet.js index 84ca7ab6..c750c265 100644 --- a/src/sagas/wallet.js +++ b/src/sagas/wallet.js @@ -252,11 +252,7 @@ export function* startWallet(action) { }); console.log('[+] Start wallet.', serverInfo); - // Use HTR as default - let nativeToken = hathorLibConstants.DEFAULT_TOKEN_CONFIG; - if (info.native_token) { - nativeToken = info.native_token; - } + const nativeToken = wallet.storage.getNativeTokenData(); yield put(setNativeTokenData(nativeToken)); let version; diff --git a/src/screens/CustomTokens.js b/src/screens/CustomTokens.js index c55a20f7..153749ae 100644 --- a/src/screens/CustomTokens.js +++ b/src/screens/CustomTokens.js @@ -16,6 +16,7 @@ import { GlobalModalContext, MODAL_TYPES } from '../components/GlobalModal'; import { useSelector } from 'react-redux'; import LOCAL_STORE from '../storage'; import { useNavigate } from 'react-router-dom'; +import { getGlobalWallet } from '../modules/wallet'; /** * Initial screen of custom tokens @@ -27,6 +28,8 @@ function CustomTokens() { const alertSuccessRef = useRef(null); const navigate = useNavigate(); const { tokensBalance } = useSelector(state => ({ tokensBalance: state.tokensBalance })); + const wallet = getGlobalWallet(); + const nativeToken = wallet.storage.getNativeTokenData(); /** * Called when a new token was registered with success, then close the modal and show alert success @@ -72,7 +75,7 @@ function CustomTokens() {

{t`Custom Tokens`}

-

{t`You can create your own digital token with customized specifications on Hathor Network with only a few clicks. They will fully work under the same technical assumptions of high scalability and decentralized consensus of our native tokens. Custom tokens will always work independently of the price of the native token, and they can serve multiple purposes.`}

+

{t`You can create your own digital token with customized specifications on Hathor Network with only a few clicks. They will fully work under the same technical assumptions of high scalability and decentralized consensus of our native ${nativeToken.symbol} tokens. Custom tokens will always work independently of the price of the native ${nativeToken.symbol} token, and they can serve multiple purposes.`}

{t`Every custom token has a unique **Configuration String** which must be shared with all other people that will use the custom token.`}

{t`If you want to use a custom token that already exists, you need to register this token in your Hathor Wallet. For this, you will need the custom token's Configuration String, which you can get from the creators of the token.`}

From 93887fadfcc7453b89e6f28158b8d6c8933fd6e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Mon, 1 Jul 2024 12:09:19 -0400 Subject: [PATCH 09/12] chore: review suggestion --- src/reducers/index.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/reducers/index.js b/src/reducers/index.js index b329f9ed..5c765962 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -123,6 +123,8 @@ const initialState = { ...FEATURE_TOGGLE_DEFAULTS, }, miningServer: null, + // The native token data of the current network + // @type {{symbol: string, name: string, uid: string}} nativeTokenData: null, }; @@ -1006,16 +1008,26 @@ export const onSetMiningServer = (state, { payload }) => ({ miningServer: payload, }); +/** + * When starting a wallet we need to update the native token data on store. + * This includes: + * - adding the native token to the registered tokens (state.tokens) + * - adding the native token as ready on loading cache (state.tokensCache) + * - updating the native token data (state.nativeTokenData) + * + * @param {Object} state + * @param {Object} payload + * @param {string} payload.symbol + * @param {string} payload.name + * @param {string} payload.uid + */ export const onSetNativeTokenData = (state, { payload }) => { let tokens = [...state.tokens]; - if (state.tokens.length === 0) { - tokens = [{...payload, uid: NATIVE_TOKEN_UID}]; + const nativeTokenIndex = findIndex(state.tokens, (e) => e.uid === NATIVE_TOKEN_UID); + if (nativeTokenIndex === -1) { + // In case the native token is not in the list, we add it as the first token + tokens = [{...payload, uid: NATIVE_TOKEN_UID}, ...state.tokens]; } else { - const nativeTokenIndex = findIndex(state.tokens, (e) => e.uid === NATIVE_TOKEN_UID); - if (nativeTokenIndex === -1) { - // In case the native token is not in the list, we add it as the first token - tokens = [{...payload, uid: NATIVE_TOKEN_UID}, ...state.tokens]; - } tokens[nativeTokenIndex] = {...payload, uid: NATIVE_TOKEN_UID}; } From 6915cddb8ccc8e51fc74a8f895c2bae9f142caaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Tue, 2 Jul 2024 12:47:18 -0400 Subject: [PATCH 10/12] chore: bump wallet-lib v1.8.0 --- package-lock.json | 155 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 80 insertions(+), 77 deletions(-) diff --git a/package-lock.json b/package-lock.json index 08baff44..541db763 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.28.1", "hasInstallScript": true, "dependencies": { - "@hathor/wallet-lib": "1.0.4", + "@hathor/wallet-lib": "1.8.0", "@ledgerhq/hw-transport-node-hid": "6.28.1", "@reduxjs/toolkit": "2.2.3", "@sentry/electron": "3.0.7", @@ -2598,20 +2598,44 @@ } }, "node_modules/@hathor/wallet-lib": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@hathor/wallet-lib/-/wallet-lib-1.0.4.tgz", - "integrity": "sha512-6tslGEYTec3i8RhgZ0D9YSVht0XKmCiyyO0GiT+opweXYBdSP7cUjBO+U0Ym8GDgEVgxuF6xKNLick20ekxqJg==", - "dependencies": { - "axios": "^0.21.4", - "bitcore-lib": "^8.25.10", - "bitcore-mnemonic": "^8.25.10", - "buffer": "^6.0.3", - "crypto-js": "^3.1.9-1", - "isomorphic-ws": "^4.0.1", - "level": "^8.0.0", - "lodash": "^4.17.21", - "long": "^4.0.0", - "ws": "^7.5.9" + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@hathor/wallet-lib/-/wallet-lib-1.8.0.tgz", + "integrity": "sha512-G1kLlxZ4Ev3S7hPiq/y9wUl4ns4pndOvuK37q+xqdxieZKCl2/O7lXiiHVOgRN9xOntL/TR66n2UZPpe0p29zQ==", + "dependencies": { + "axios": "1.7.2", + "bitcore-lib": "8.25.10", + "bitcore-mnemonic": "8.25.10", + "buffer": "6.0.3", + "crypto-js": "4.2.0", + "isomorphic-ws": "5.0.0", + "level": "8.0.1", + "lodash": "4.17.21", + "long": "5.2.3", + "ws": "8.17.0" + }, + "engines": { + "node": ">=20.0.0", + "npm": ">=10.0.0" + } + }, + "node_modules/@hathor/wallet-lib/node_modules/ws": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", + "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, "node_modules/@humanwhocodes/config-array": { @@ -5804,11 +5828,26 @@ } }, "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/axios/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dependencies": { - "follow-redirects": "^1.14.0" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" } }, "node_modules/axobject-query": { @@ -6328,9 +6367,9 @@ } }, "node_modules/bech32": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", - "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.3.tgz", + "integrity": "sha512-yuVFUvrNcoJi0sv5phmqc6P+Fl1HjRDRNOOkHY2X/3LBy2bIGNSFx4fZ95HMaXHupuS7cZR15AsvtmCIF4UEyg==" }, "node_modules/bfj": { "version": "7.1.0", @@ -6355,11 +6394,6 @@ "node": "*" } }, - "node_modules/bigi": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz", - "integrity": "sha512-ddkU+dFIuEIW8lE7ZwdIAf2UPoM90eaprg5m3YXAVVTmKlqV/9BX4A2M8BOK2yOq6/VgZFVhK6QAxJebhlbhzw==" - }, "node_modules/binary-extensions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", @@ -6380,28 +6414,12 @@ "file-uri-to-path": "1.0.0" } }, - "node_modules/bip-schnorr": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/bip-schnorr/-/bip-schnorr-0.6.4.tgz", - "integrity": "sha512-dNKw7Lea8B0wMIN4OjEmOk/Z5qUGqoPDY0P2QttLqGk1hmDPytLWW8PR5Pb6Vxy6CprcdEgfJpOjUu+ONQveyg==", - "dependencies": { - "bigi": "^1.4.2", - "ecurve": "^1.0.6", - "js-sha256": "^0.9.0", - "randombytes": "^2.1.0", - "safe-buffer": "^5.2.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, "node_modules/bitcore-lib": { - "version": "8.25.47", - "resolved": "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-8.25.47.tgz", - "integrity": "sha512-qDZr42HuP4P02I8kMGZUx/vvwuDsz8X3rQxXLfM0BtKzlQBcbSM7ycDkDN99Xc5jzpd4fxNQyyFXOmc6owUsrQ==", + "version": "8.25.10", + "resolved": "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-8.25.10.tgz", + "integrity": "sha512-MyHpSg7aFRHe359RA/gdkaQAal3NswYZTLEuu0tGX1RGWXAYN9i/24fsjPqVKj+z0ua+gzAT7aQs0KiKXWCgKA==", "dependencies": { - "bech32": "=2.0.0", - "bip-schnorr": "=0.6.4", + "bech32": "=1.1.3", "bn.js": "=4.11.8", "bs58": "^4.0.1", "buffer-compare": "=1.1.1", @@ -6411,11 +6429,11 @@ } }, "node_modules/bitcore-mnemonic": { - "version": "8.25.47", - "resolved": "https://registry.npmjs.org/bitcore-mnemonic/-/bitcore-mnemonic-8.25.47.tgz", - "integrity": "sha512-wTa0imZZpFTqwlpyokvU8CNl+YdaIvQIrWKp/0AEL9gPX2vuzBnE+U8Ok6D5lHCnbG6dvmoesmtyf6R3aYI86A==", + "version": "8.25.10", + "resolved": "https://registry.npmjs.org/bitcore-mnemonic/-/bitcore-mnemonic-8.25.10.tgz", + "integrity": "sha512-FeXxO37BLV5JRvxPmVFB91zRHalavV8H4TdQGt1/hz0AkoPymIV68OkuB+TptpjeYgatcgKPoPvPhglJkTzFQQ==", "dependencies": { - "bitcore-lib": "^8.25.47", + "bitcore-lib": "^8.25.10", "unorm": "^1.4.1" }, "peerDependencies": { @@ -8173,9 +8191,9 @@ } }, "node_modules/crypto-js": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.3.0.tgz", - "integrity": "sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" }, "node_modules/crypto-random-string": { "version": "1.0.0", @@ -9641,15 +9659,6 @@ "safer-buffer": "^2.1.0" } }, - "node_modules/ecurve": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/ecurve/-/ecurve-1.0.6.tgz", - "integrity": "sha512-/BzEjNfiSuB7jIWKcS/z8FK9jNjmEWvUV2YZ4RLSmcDtP7Lq0m6FvDuSnJpBlDpGRpfRQeTLGLBI8H+kEv0r+w==", - "dependencies": { - "bigi": "^1.1.0", - "safe-buffer": "^5.0.1" - } - }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -14438,9 +14447,9 @@ } }, "node_modules/isomorphic-ws": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", + "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", "peerDependencies": { "ws": "*" } @@ -15646,11 +15655,6 @@ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" }, - "node_modules/js-sha256": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", - "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -16539,9 +16543,9 @@ } }, "node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" }, "node_modules/loose-envify": { "version": "1.4.0", @@ -20534,8 +20538,7 @@ "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "node_modules/prr": { "version": "1.0.1", diff --git a/package.json b/package.json index ad12bf73..d839d6d4 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "private": true, "dependencies": { - "@hathor/wallet-lib": "1.0.4", + "@hathor/wallet-lib": "1.8.0", "@ledgerhq/hw-transport-node-hid": "6.28.1", "@reduxjs/toolkit": "2.2.3", "@sentry/electron": "3.0.7", From 58cff5e37b3145f4a3eb495fe2e9151344dc60fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Tue, 2 Jul 2024 13:02:26 -0400 Subject: [PATCH 11/12] chore: locale update --- locale/texts.pot | 341 +++++++++++++++++++++++++++-------------------- 1 file changed, 200 insertions(+), 141 deletions(-) diff --git a/locale/texts.pot b/locale/texts.pot index b60e4e70..ee544d9d 100644 --- a/locale/texts.pot +++ b/locale/texts.pot @@ -21,8 +21,8 @@ msgstr "" #: src/components/atomic-swap/ModalAtomicSend.js:333 #: src/components/tokens/TokenMint.js:148 #: src/screens/AddressList.js:191 -#: src/screens/CreateNFT.js:326 -#: src/screens/CreateToken.js:290 +#: src/screens/CreateNFT.js:327 +#: src/screens/CreateToken.js:291 msgid "Address" msgstr "" @@ -52,11 +52,12 @@ msgstr "" #: src/components/ModalPin.js:76 #: src/screens/ChoosePassphrase.js:76 #: src/screens/LockedWallet.js:67 +#: src/screens/MiningServer.js:78 msgid "Invalid PIN" msgstr "" #: src/screens/ChoosePassphrase.js:83 -#: src/screens/Settings.js:316 +#: src/screens/Settings.js:324 #. Everything is fine, so show confirm modal msgid "Set a passphrase" msgstr "" @@ -85,6 +86,7 @@ msgstr "" #: src/screens/ChoosePassphrase.js:157 #: src/screens/LockedWallet.js:117 +#: src/screens/MiningServer.js:108 #: src/screens/Server.js:406 msgid "PIN" msgstr "" @@ -155,35 +157,38 @@ msgstr "" msgid "Remember to **make a backup** of this configuration string." msgstr "" -#: src/screens/CreateNFT.js:272 +#: src/screens/CreateNFT.js:273 msgid "" "Here you will create a new NFT. After the creation, you will be able to " "send the units of this NFT to other addresses." msgstr "" -#: src/screens/CreateNFT.js:273 +#: src/screens/CreateNFT.js:274 +#, javascript-format msgid "" -"NFTs share the address space with all other tokens, including HTR. This " -"means that you can send and receive tokens using any valid address." +"NFTs share the address space with all other tokens, including ${ " +"nativeTokenConfig.symbol }. This means that you can send and receive tokens " +"using any valid address." msgstr "" -#: src/screens/CreateNFT.js:274 +#: src/screens/CreateNFT.js:275 msgid "" "Remember to make a backup of your new token's configuration string. You " "will need to send it to other people to allow them to use your NFT." msgstr "" -#: src/screens/CreateNFT.js:277 +#: src/screens/CreateNFT.js:278 #, javascript-format msgid "" -"When creating and minting NFTs, a |bold:deposit of ${ htrDeposit }%| in HTR " -"is required and an additional |bold:fee of ${ nftFee } HTR|. If these " -"tokens are later melted, this HTR deposit will be returned (depending on " +"When creating and minting NFTs, a |bold:deposit of ${ htrDeposit }%| in ${ " +"nativeTokenConfig.symbol } is required and an additional |bold:fee of ${ " +"nftFee } ${ nativeTokenConfig.symbol }|. If these tokens are later melted, " +"this ${ nativeTokenConfig.symbol } deposit will be returned (depending on " "the amount melted) and the fee will never be returned. Read more about the " "NFT standard |link:here|." msgstr "" -#: src/screens/CreateNFT.js:286 +#: src/screens/CreateNFT.js:287 msgid "" "The most common usage for an NFT is to represent a digital asset. Please " "see |link:this guide| that explains how to create an NFT data (including " @@ -191,56 +196,56 @@ msgid "" "standard in order to be able to show your asset in our explorer." msgstr "" -#: src/screens/CreateNFT.js:296 +#: src/screens/CreateNFT.js:297 msgid "NFT Data" msgstr "" -#: src/screens/CreateNFT.js:297 +#: src/screens/CreateNFT.js:298 msgid "ipfs://..." msgstr "" -#: src/screens/CreateNFT.js:303 -#: src/screens/CreateToken.js:262 +#: src/screens/CreateNFT.js:304 +#: src/screens/CreateToken.js:263 msgid "Short name" msgstr "" -#: src/screens/CreateNFT.js:304 -#: src/screens/CreateToken.js:263 +#: src/screens/CreateNFT.js:305 +#: src/screens/CreateToken.js:264 msgid "MyCoin" msgstr "" -#: src/screens/CreateNFT.js:307 -#: src/screens/CreateToken.js:266 +#: src/screens/CreateNFT.js:308 +#: src/screens/CreateToken.js:267 msgid "Symbol" msgstr "" -#: src/screens/CreateNFT.js:308 -#: src/screens/CreateToken.js:267 +#: src/screens/CreateNFT.js:309 +#: src/screens/CreateToken.js:268 msgid "MYC (2-5 characters)" msgstr "" #: src/components/atomic-swap/ModalAtomicReceive.js:114 #: src/components/atomic-swap/ModalAtomicSend.js:323 -#: src/screens/CreateNFT.js:313 -#: src/screens/CreateToken.js:272 +#: src/screens/CreateNFT.js:314 +#: src/screens/CreateToken.js:273 msgid "Amount" msgstr "" -#: src/screens/CreateNFT.js:320 -#: src/screens/CreateToken.js:284 +#: src/screens/CreateNFT.js:321 +#: src/screens/CreateToken.js:285 msgid "Select address automatically" msgstr "" -#: src/screens/CreateNFT.js:325 -#: src/screens/CreateToken.js:289 +#: src/screens/CreateNFT.js:326 +#: src/screens/CreateToken.js:290 msgid "Destination address" msgstr "" -#: src/screens/CreateNFT.js:334 +#: src/screens/CreateNFT.js:335 msgid "Create a mint authority" msgstr "" -#: src/screens/CreateNFT.js:342 +#: src/screens/CreateNFT.js:343 msgid "Create a melt authority" msgstr "" @@ -268,52 +273,57 @@ msgid "" "them use your brand new token." msgstr "" -#: src/screens/CreateToken.js:246 +#: src/screens/CreateToken.js:247 msgid "" "Here you will create a new customized token. After the creation, you will " "be able to send this new token to other addresses." msgstr "" -#: src/screens/CreateToken.js:247 +#: src/screens/CreateToken.js:248 +#, javascript-format msgid "" -"Custom tokens share the address space with all other tokens, including HTR. " -"This means that you can send and receive tokens using any valid address." +"Custom tokens share the address space with all other tokens, including ${ " +"nativeTokenConfig.symbol }. This means that you can send and receive tokens " +"using any valid address." msgstr "" -#: src/screens/CreateToken.js:248 +#: src/screens/CreateToken.js:249 msgid "" "Remember to make a backup of your new token's configuration string. You " "will need to send it to other people to allow them to use your new token." msgstr "" -#: src/screens/CreateToken.js:251 +#: src/screens/CreateToken.js:252 #, javascript-format msgid "" "When creating and minting tokens, a |bold:deposit of ${ htrDeposit }%| in " -"HTR is required. If these tokens are later melted, this HTR deposit will be " -"returned. Read more about it |link:here|." +"${ nativeTokenConfig.symbol } is required. If these tokens are later " +"melted, this ${ nativeTokenConfig.symbol } deposit will be returned. Read " +"more about it |link:here|." msgstr "" -#: src/screens/CustomTokens.js:74 +#: src/screens/CustomTokens.js:77 msgid "Custom Tokens" msgstr "" -#: src/screens/CustomTokens.js:75 +#: src/screens/CustomTokens.js:78 +#, javascript-format msgid "" "You can create your own digital token with customized specifications on " "Hathor Network with only a few clicks. They will fully work under the same " "technical assumptions of high scalability and decentralized consensus of " -"our native HTR tokens. Custom tokens will always work independently of the " -"price of the native HTR token, and they can serve multiple purposes." +"our native ${ nativeToken.symbol } tokens. Custom tokens will always work " +"independently of the price of the native ${ nativeToken.symbol } token, and " +"they can serve multiple purposes." msgstr "" -#: src/screens/CustomTokens.js:76 +#: src/screens/CustomTokens.js:79 msgid "" "Every custom token has a unique **Configuration String** which must be " "shared with all other people that will use the custom token." msgstr "" -#: src/screens/CustomTokens.js:77 +#: src/screens/CustomTokens.js:80 msgid "" "If you want to use a custom token that already exists, you need to register " "this token in your Hathor Wallet. For this, you will need the custom " @@ -321,19 +331,19 @@ msgid "" "token." msgstr "" -#: src/screens/CustomTokens.js:79 +#: src/screens/CustomTokens.js:82 msgid "Create a new token" msgstr "" -#: src/screens/CustomTokens.js:80 +#: src/screens/CustomTokens.js:83 msgid "Create an NFT" msgstr "" -#: src/screens/CustomTokens.js:81 +#: src/screens/CustomTokens.js:84 msgid "Register a token" msgstr "" -#: src/screens/CustomTokens.js:83 +#: src/screens/CustomTokens.js:86 msgid "Token registered with success!" msgstr "" @@ -394,7 +404,7 @@ msgstr "" #: src/components/ModalConfirmClearStorage.js:58 #: src/components/ModalResetAllData.js:128 #: src/screens/LockedWallet.js:121 -#: src/screens/Settings.js:318 +#: src/screens/Settings.js:326 msgid "Reset all data" msgstr "" @@ -402,6 +412,56 @@ msgstr "" msgid "Unlock" msgstr "" +#: src/screens/MiningServer.js:48 +msgid "Already using the default server" +msgstr "" + +#: src/screens/MiningServer.js:53 +msgid "New server cannot be empty" +msgstr "" + +#: src/screens/MiningServer.js:63 +#: src/screens/Server.js:83 +#: src/screens/Server.js:93 +msgid "New server is not valid" +msgstr "" + +#: src/screens/MiningServer.js:70 +msgid "New server is the same as the current server" +msgstr "" + +#: src/screens/MiningServer.js:94 +msgid "Change the transaction mining server" +msgstr "" + +#: src/screens/MiningServer.js:99 +msgid "You are currently using the default mining server." +msgstr "" + +#: src/screens/MiningServer.js:100 +msgid "You are not using the default mining server." +msgstr "" + +#: src/screens/MiningServer.js:102 +msgid "Current server" +msgstr "" + +#: src/screens/MiningServer.js:106 +msgid "New mining server" +msgstr "" + +#: src/screens/MiningServer.js:111 +msgid "Set mining server" +msgstr "" + +#: src/screens/MiningServer.js:112 +msgid "Reset mining server" +msgstr "" + +#: src/screens/MiningServer.js:115 +msgid "Mining server changed" +msgstr "" + #: src/screens/NFTList.js:100 msgid "Your list is empty." msgstr "" @@ -587,11 +647,6 @@ msgstr "" msgid "I allow Hathor Wallet to report error information to Hathor team." msgstr "" -#: src/screens/Server.js:83 -#: src/screens/Server.js:93 -msgid "New server is not valid" -msgstr "" - #: src/screens/Server.js:88 #: src/screens/Server.js:97 msgid "New real-time server is not valid" @@ -639,125 +694,129 @@ msgstr "" msgid "|fn:More info| about this on Ledger." msgstr "" -#: src/screens/Settings.js:152 +#: src/screens/Settings.js:159 msgid "Turn notifications off" msgstr "" -#: src/screens/Settings.js:153 +#: src/screens/Settings.js:160 msgid "Are you sure you don't want to receive wallet notifications?" msgstr "" -#: src/screens/Settings.js:155 +#: src/screens/Settings.js:162 msgid "Turn notifications on" msgstr "" -#: src/screens/Settings.js:156 +#: src/screens/Settings.js:163 msgid "Are you sure you want to receive wallet notifications?" msgstr "" -#: src/screens/Settings.js:177 +#: src/screens/Settings.js:184 msgid "Show zero-balance tokens" msgstr "" -#: src/screens/Settings.js:178 +#: src/screens/Settings.js:185 msgid "Are you sure you want to show all tokens, including those with zero balance?" msgstr "" -#: src/screens/Settings.js:180 +#: src/screens/Settings.js:187 msgid "Hide zero-balance tokens" msgstr "" -#: src/screens/Settings.js:181 +#: src/screens/Settings.js:188 msgid "Are you sure you want to hide tokens with zero balance?" msgstr "" -#: src/screens/Settings.js:281 +#: src/screens/Settings.js:288 msgid "Date and time:" msgstr "" -#: src/screens/Settings.js:284 +#: src/screens/Settings.js:291 #, javascript-format msgid "**Server:** You are connected to ${ serverURL }" msgstr "" -#: src/screens/Settings.js:287 +#: src/screens/Settings.js:294 msgid "**Real-time server:** You are connected to ${ wsServerURL }" msgstr "" #: src/components/RequestError.js:164 -#: src/screens/Settings.js:290 +#: src/screens/Settings.js:297 msgid "Change server" msgstr "" -#: src/screens/Settings.js:295 +#: src/screens/Settings.js:302 msgid "Advanced Settings" msgstr "" -#: src/screens/Settings.js:297 +#: src/screens/Settings.js:304 msgid "Allow notifications:" msgstr "" #: src/components/ModalResetAllData.js:164 #: src/components/TokenGeneralInfo.js:138 -#: src/screens/Settings.js:297 -#: src/screens/Settings.js:301 -#: src/screens/Settings.js:309 +#: src/screens/Settings.js:304 +#: src/screens/Settings.js:308 +#: src/screens/Settings.js:316 msgid "Yes" msgstr "" #: src/components/ModalResetAllData.js:163 #: src/components/TokenGeneralInfo.js:139 -#: src/screens/Settings.js:297 -#: src/screens/Settings.js:302 +#: src/screens/Settings.js:304 #: src/screens/Settings.js:309 +#: src/screens/Settings.js:316 msgid "No" msgstr "" #: src/components/TokenGeneralInfo.js:141 -#: src/screens/Settings.js:297 #: src/screens/Settings.js:304 -#: src/screens/Settings.js:309 +#: src/screens/Settings.js:311 +#: src/screens/Settings.js:316 msgid "Change" msgstr "" -#: src/screens/Settings.js:299 +#: src/screens/Settings.js:306 msgid "Hide zero-balance tokens:" msgstr "" -#: src/screens/Settings.js:306 +#: src/screens/Settings.js:313 msgid "" "When selected, any tokens with a balance of zero will not be displayed " "anywhere in the wallet." msgstr "" -#: src/screens/Settings.js:309 +#: src/screens/Settings.js:316 msgid "Automatically report bugs to Hathor:" msgstr "" -#: src/screens/Settings.js:312 +#: src/screens/Settings.js:319 msgid "Unique identifier" msgstr "" #: src/components/ModalAddressQRCode.js:101 #: src/components/TokenGeneralInfo.js:164 #: src/components/WalletAddress.js:175 -#: src/screens/Settings.js:312 +#: src/screens/Settings.js:319 #: src/screens/atomic-swap/EditSwap.js:91 #: src/screens/atomic-swap/EditSwap.js:105 msgid "Copy to clipboard" msgstr "" -#: src/screens/Settings.js:315 +#: src/screens/Settings.js:322 +msgid "Change mining server" +msgstr "" + +#: src/screens/Settings.js:323 msgid "Export Registered Tokens" msgstr "" -#: src/screens/Settings.js:317 +#: src/screens/Settings.js:325 msgid "Untrust all tokens on Ledger" msgstr "" -#: src/components/TxData.js:955 +#: src/components/TxData.js:958 #: src/components/WalletAddress.js:195 -#: src/screens/Settings.js:327 +#: src/screens/Settings.js:335 #: src/screens/atomic-swap/EditSwap.js:590 msgid "Copied to clipboard!" msgstr "" @@ -855,9 +914,9 @@ msgstr "" msgid "Download failed, please" msgstr "" -#: src/components/TxData.js:671 -#: src/components/TxData.js:686 -#: src/components/TxData.js:842 +#: src/components/TxData.js:674 +#: src/components/TxData.js:689 +#: src/components/TxData.js:845 #: src/screens/UnknownTokens.js:216 #: src/screens/Wallet.js:464 msgid "try again" @@ -1053,8 +1112,8 @@ msgstr "" #: src/screens/Welcome.js:79 msgid "" "Using this wallet you can (i) check your balance and history, (ii) send & " -"receive HTR and other tokens running on Hathor, and (iii) create and manage " -"your own tokens." +"receive tokens running on Hathor, and (iii) create and manage your own " +"tokens." msgstr "" #: src/screens/Welcome.js:80 @@ -1429,7 +1488,7 @@ msgstr "" #: src/components/ModalBackupWords.js:203 #: src/components/ModalPin.js:123 #: src/components/tokens/TokenMelt.js:185 -#: src/components/tokens/TokenMint.js:220 +#: src/components/tokens/TokenMint.js:221 msgid "Go" msgstr "" @@ -1913,7 +1972,7 @@ msgid "Destroy melt" msgstr "" #: src/components/TokenAdministrative.js:164 -#: src/components/tokens/TokenMint.js:217 +#: src/components/tokens/TokenMint.js:218 msgid "Mint tokens" msgstr "" @@ -2047,7 +2106,7 @@ msgid "Page ${ page }" msgstr "" #: src/components/TokenInfoBox.js:27 -#: src/components/TxData.js:879 +#: src/components/TxData.js:882 msgid "Type:" msgstr "" @@ -2075,210 +2134,210 @@ msgstr "" msgid "Total number of transactions:" msgstr "" -#: src/components/TxData.js:449 +#: src/components/TxData.js:452 msgid "Mint authority" msgstr "" -#: src/components/TxData.js:451 +#: src/components/TxData.js:454 msgid "Melt authority" msgstr "" -#: src/components/TxData.js:454 +#: src/components/TxData.js:457 #. Should never come here msgid "Unknown authority" msgstr "" -#: src/components/TxData.js:464 +#: src/components/TxData.js:467 msgid "This token is not registered in your wallet." msgstr "" -#: src/components/TxData.js:480 +#: src/components/TxData.js:483 msgid "Spent" msgstr "" -#: src/components/TxData.js:538 +#: src/components/TxData.js:541 #, javascript-format msgid "${ ret } | Locked until ${ parsedTimestamp }" msgstr "" -#: src/components/TxData.js:545 +#: src/components/TxData.js:548 #, javascript-format msgid "" "Match values (nano contract), oracle id: ${ decoded.oracle_data_id } hash: " "${ decoded.oracle_pubkey_hash }" msgstr "" -#: src/components/TxData.js:585 -#: src/components/TxData.js:594 +#: src/components/TxData.js:588 +#: src/components/TxData.js:597 #. there are conflicts, but it is not voided msgid "This ${ typeStr } is valid." msgstr "" -#: src/components/TxData.js:596 +#: src/components/TxData.js:599 #. there are conflicts, but it is not voided msgid "" "Although there is a double-spending transaction, this transaction has the " "highest accumulated weight and is valid." msgstr "" -#: src/components/TxData.js:601 +#: src/components/TxData.js:604 #. there are conflicts, but it is not voided msgid "Transactions double spending the same outputs as this transaction:" msgstr "" -#: src/components/TxData.js:615 +#: src/components/TxData.js:618 #. it is voided, but there is no conflict #, javascript-format msgid "This ${ typeStr } is voided and **NOT** valid." msgstr "" -#: src/components/TxData.js:617 +#: src/components/TxData.js:620 #. it is voided, but there is no conflict msgid "" "This ${ typeStr } is verifying (directly or indirectly) a voided " "double-spending transaction, hence it is voided as well." msgstr "" -#: src/components/TxData.js:620 +#: src/components/TxData.js:623 #. it is voided, but there is no conflict #, javascript-format msgid "This ${ typeStr } is voided because of these transactions: " msgstr "" -#: src/components/TxData.js:630 +#: src/components/TxData.js:633 #. it is voided, and there is a conflict msgid "This ${ typeStr } is **NOT** valid." msgstr "" -#: src/components/TxData.js:632 +#: src/components/TxData.js:635 #. it is voided, and there is a conflict msgid "It is voided by: " msgstr "" -#: src/components/TxData.js:638 +#: src/components/TxData.js:641 #. it is voided, and there is a conflict msgid "Conflicts with: " msgstr "" -#: src/components/TxData.js:668 +#: src/components/TxData.js:671 msgid "Download failed" msgstr "" -#: src/components/TxData.js:685 +#: src/components/TxData.js:688 msgid "Error retrieving accumulated weight data..." msgstr "" -#: src/components/TxData.js:694 +#: src/components/TxData.js:697 #, javascript-format msgid "Over ${ acc }" msgstr "" -#: src/components/TxData.js:699 +#: src/components/TxData.js:702 msgid "Retrieving accumulated weight data..." msgstr "" -#: src/components/TxData.js:751 +#: src/components/TxData.js:754 msgid "Tokens:" msgstr "" -#: src/components/TxData.js:765 +#: src/components/TxData.js:768 msgid "Your address" msgstr "" -#: src/components/TxData.js:779 +#: src/components/TxData.js:782 #, javascript-format msgid "**${ tokenSymbol }:** Received" msgstr "" -#: src/components/TxData.js:785 +#: src/components/TxData.js:788 msgid "**${ tokenSymbol }:** Sent" msgstr "" -#: src/components/TxData.js:808 +#: src/components/TxData.js:811 msgid "Balance:" msgstr "" -#: src/components/TxData.js:817 +#: src/components/TxData.js:820 msgid "First block:" msgstr "" -#: src/components/TxData.js:826 +#: src/components/TxData.js:829 msgid "Accumulated weight:" msgstr "" -#: src/components/TxData.js:841 +#: src/components/TxData.js:844 msgid "Error retrieving confirmation level..." msgstr "" -#: src/components/TxData.js:851 +#: src/components/TxData.js:854 msgid "Retrieving confirmation level data..." msgstr "" -#: src/components/TxData.js:856 +#: src/components/TxData.js:859 msgid "Confirmation level:" msgstr "" -#: src/components/TxData.js:875 +#: src/components/TxData.js:878 msgid "Block" msgstr "" -#: src/components/TxData.js:875 +#: src/components/TxData.js:878 msgid "Transaction" msgstr "" -#: src/components/TxData.js:880 +#: src/components/TxData.js:883 msgid "Time:" msgstr "" -#: src/components/TxData.js:881 +#: src/components/TxData.js:884 msgid "Nonce:" msgstr "" -#: src/components/TxData.js:882 +#: src/components/TxData.js:885 msgid "Weight:" msgstr "" -#: src/components/TxData.js:894 +#: src/components/TxData.js:897 msgid "Inputs:" msgstr "" -#: src/components/TxData.js:898 +#: src/components/TxData.js:901 msgid "Outputs:" msgstr "" -#: src/components/TxData.js:905 +#: src/components/TxData.js:908 msgid "Parents:" msgstr "" -#: src/components/TxData.js:909 +#: src/components/TxData.js:912 msgid "Children:" msgstr "" -#: src/components/TxData.js:909 +#: src/components/TxData.js:912 msgid "Click to hide" msgstr "" -#: src/components/TxData.js:909 +#: src/components/TxData.js:912 msgid "Click to show" msgstr "" -#: src/components/TxData.js:915 +#: src/components/TxData.js:918 msgid "Verification neighbors" msgstr "" -#: src/components/TxData.js:924 +#: src/components/TxData.js:927 msgid "Funds neighbors" msgstr "" -#: src/components/TxData.js:941 +#: src/components/TxData.js:944 msgid "Hide raw transaction" msgstr "" -#: src/components/TxData.js:941 +#: src/components/TxData.js:944 msgid "Show raw transaction" msgstr "" -#: src/components/TxData.js:944 +#: src/components/TxData.js:947 msgid "Copy raw tx to clipboard" msgstr "" @@ -2465,7 +2524,7 @@ msgstr "" msgid "Create another mint output for you?" msgstr "" -#: src/components/tokens/TokenMint.js:224 +#: src/components/tokens/TokenMint.js:225 msgid "Minting tokens" msgstr "" From daf711d62cab517cf9f0b95aa3c8d70b779ba430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Wed, 3 Jul 2024 10:34:06 -0300 Subject: [PATCH 12/12] chore: docstring typing --- src/actions/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/actions/index.js b/src/actions/index.js index cc4b6605..9421e8e2 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -506,6 +506,10 @@ export const setMiningServer = (url) => ({ /** * Set the native token data + * @param {Object} data + * @param {string} data.symbol + * @param {string} data.name + * @param {string} data.uid */ export const setNativeTokenData = (data) => ({ type: types.SET_NATIVE_TOKEN_DATA,