Skip to content
Open
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fb7a9a5
Use tokenId in AddressTile2
peachbits Aug 29, 2025
61bf426
Remove gotTokenIdForced from WalletListCreateRow
peachbits Aug 29, 2025
db1c0b3
Use tokenIds in stake scenes and policies
peachbits Sep 1, 2025
a284bc0
Adjust stake policy filtering
peachbits Nov 18, 2025
9bb579d
Update getCurrencyCodeMultiplier to use tokenId
peachbits Sep 1, 2025
e40dbc9
Remove selectDisplayDenomByCurrencyCode
peachbits Sep 2, 2025
bbba84d
Remove some getWalletTokenId usage
peachbits Sep 2, 2025
52ef0b4
Remove most of getTokenIdForced usage
peachbits Nov 18, 2025
1970bc1
Cleanup getTokenId usage
peachbits Nov 18, 2025
16023be
Replace selectedCurrencyCode with selectedTokenId
peachbits Sep 10, 2025
3425e08
Remove preferred tokens
peachbits Sep 10, 2025
4013413
Remove enableTokenCurrencyCode
peachbits Sep 10, 2025
a65a891
Fix some currencyCode comparisons
peachbits Sep 10, 2025
7187b58
Handle tokenId in swap data
peachbits Sep 10, 2025
9ff151b
Remove duplicate currency code warning from EditTokenScene
peachbits Nov 24, 2025
78700b6
fixup! Use tokenId in AddressTile2
peachbits Dec 2, 2025
0465a94
fixup! Update getCurrencyCodeMultiplier to use tokenId
peachbits Dec 3, 2025
e3b0a71
fixup! Cleanup getTokenId usage
peachbits Dec 3, 2025
f0a2eb5
fixup! Handle tokenId in swap data
peachbits Dec 3, 2025
cb8bb32
Remove selectedWallet use from EdgeProvider
peachbits Dec 3, 2025
364d2b6
Replace currencyCode with tokenId in MostRecentWallet
peachbits Dec 3, 2025
8e12ebf
Use mostRecentWallet in DevTestScene and delete useSelectedWallet
peachbits Dec 3, 2025
02811a3
Remove selected wallet dispatches from FIO scenes
peachbits Dec 3, 2025
a0b7f88
Remove selectedWalletId and selectedTokenId
peachbits Dec 3, 2025
d04fc8a
Move fioWallets under fio in UiState
peachbits Dec 3, 2025
5a57421
fixup! Handle tokenId in swap data
peachbits Dec 3, 2025
1c303ef
fixup! Update getCurrencyCodeMultiplier to use tokenId
peachbits Dec 4, 2025
113e490
fixup! Use mostRecentWallet in DevTestScene and delete useSelectedWallet
peachbits Dec 4, 2025
f442403
fixup! Remove selectedWallet use from EdgeProvider
peachbits Dec 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PODS:
- disklet (0.5.2):
- React
- DoubleConversion (1.1.6)
- edge-core-js (2.35.0):
- edge-core-js (2.36.0):
- React-Core
- edge-currency-accountbased (4.65.0):
- React-Core
Expand Down Expand Up @@ -3333,7 +3333,7 @@ SPEC CHECKSUMS:
CNIOWindows: 3047f2d8165848a3936a0a755fee27c6b5ee479b
disklet: 8a20bf8a568635b6e6bb8f93297dac13ee5cef98
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
edge-core-js: 2e9266c5197e8f556058acf4874e5e554985e590
edge-core-js: 14585f490c37ceed37a021c6639251dd47ef4546
edge-currency-accountbased: 2675384ce7cf6bd99cb657bfc314511d22619a73
edge-currency-plugins: bcb24eb550c6bf1b94e03c59405c8967aa4fbb89
edge-exchange-plugins: 8211083b576441118577f2fbede95c4fa025dd05
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"deprecated-react-native-prop-types": "^5.0.0",
"detect-bundler": "^1.1.0",
"disklet": "^0.5.2",
"edge-core-js": "^2.35.0",
"edge-core-js": "file:../edge-core-js",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Local file dependency in package.json

The edge-core-js dependency is changed to "file:../edge-core-js", which is a local file reference for development. This breaks the build for anyone without that specific directory structure and should not be committed to the repository. The dependency should reference a published version or a git URL instead.

Fix in Cursor Fix in Web

"edge-currency-accountbased": "^4.65.0",
"edge-currency-monero": "^2.0.1",
"edge-currency-plugins": "^3.8.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ exports[`initialState 1`] = `
},
"fio": {
"connectedWalletsByFioAddress": {},
"fioWallets": [],
},
"fioAddress": {
"fioAddresses": [],
Expand Down Expand Up @@ -156,11 +157,6 @@ exports[`initialState 1`] = `
"walletsSort": "manual",
},
"subcategories": [],
"wallets": {
"fioWallets": [],
"selectedCurrencyCode": "",
"selectedWalletId": "",
},
},
}
`;
15 changes: 9 additions & 6 deletions src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, test } from '@jest/globals'
import { log10 } from 'biggystring'

import { selectDisplayDenomByCurrencyCode } from '../selectors/DenominationSelectors'
import { selectDisplayDenom } from '../selectors/DenominationSelectors'
import { btcCurrencyInfo } from '../util/fake/fakeBtcInfo'
import { makeFakeCurrencyConfig } from '../util/fake/fakeCurrencyConfig'
import { ethCurrencyInfo } from '../util/fake/fakeEthInfo'
Expand Down Expand Up @@ -393,15 +393,18 @@ describe('getDisplayDenomination', function () {
const input = [
{
pluginId: 'bitcoin',
currencyCode: 'BTC'
currencyCode: 'BTC',
tokenId: null
},
{
pluginId: 'ethereum',
currencyCode: 'ETH'
currencyCode: 'ETH',
tokenId: null
},
{
pluginId: 'ethereum',
currencyCode: 'TKN'
currencyCode: 'TKN',
tokenId: '1985365e9f78359a9B6AD760e32412f4a445E862'
}
] as const
const output = [
Expand All @@ -425,10 +428,10 @@ describe('getDisplayDenomination', function () {
const currencyConfig =
state.core.account.currencyConfig[currency.pluginId]
expect(
selectDisplayDenomByCurrencyCode(
selectDisplayDenom(
state as any,
currencyConfig as any,
currency.currencyCode
currency.tokenId
)
).toMatchObject(output[index])
})
Expand Down
11 changes: 3 additions & 8 deletions src/actions/CreateWalletActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ import type {
import { Airship } from '../components/services/AirshipInstance'
import { SPECIAL_CURRENCY_INFO } from '../constants/WalletAndCurrencyConstants'
import { lstrings } from '../locales/strings'
import { getExchangeDenomByCurrencyCode } from '../selectors/DenominationSelectors'
import { getExchangeDenom } from '../selectors/DenominationSelectors'
import type { TokenWalletCreateItem } from '../selectors/getCreateWalletList'
import { config } from '../theme/appConfig'
import type { ThunkAction } from '../types/reduxTypes'
import type { NavigationBase } from '../types/routerTypes'
import type { EdgeAsset } from '../types/types'
import { getWalletTokenId } from '../util/CurrencyInfoHelpers'
import { logActivity } from '../util/logger'
import { filterNull } from '../util/safeFilters'
import { logEvent } from '../util/tracking'
Expand Down Expand Up @@ -155,16 +154,12 @@ export function createAccountTransaction(
createdCurrencyWallet.currencyInfo.currencyCode
const currencyPlugin =
account.currencyConfig[createdCurrencyWallet.currencyInfo.pluginId]
const { paymentAddress, amount, currencyCode } = activationPaymentInfo
const { paymentAddress, amount, tokenId } = activationPaymentInfo
const handleAvailability =
await currencyPlugin.otherMethods.validateAccount(accountName)
const paymentDenom = getExchangeDenomByCurrencyCode(
paymentWallet.currencyConfig,
currencyCode
)
const paymentDenom = getExchangeDenom(paymentWallet.currencyConfig, tokenId)
let nativeAmount = mul(amount, paymentDenom.multiplier)
nativeAmount = toFixed(nativeAmount, 0, 0)
const tokenId = getWalletTokenId(paymentWallet, currencyCode)

if (handleAvailability.result === 'AccountAvailable') {
navigation.push('send2', {
Expand Down
4 changes: 2 additions & 2 deletions src/actions/FioActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const refreshConnectedWallets = async (
getState: GetState
) => {
const wallets: EdgeCurrencyWallet[] = []
const fioWallets: EdgeCurrencyWallet[] = getState().ui.wallets.fioWallets
const fioWallets: EdgeCurrencyWallet[] = getState().ui.fio.fioWallets
const currencyWallets = getState().core.account.currencyWallets
for (const walletId of Object.keys(currencyWallets)) {
wallets.push(currencyWallets[walletId])
Expand Down Expand Up @@ -69,7 +69,7 @@ export function checkFioObtData(
let loopCount = 0
while (true) {
account = state.core.account
fioWallets = state.ui.wallets.fioWallets
fioWallets = state.ui.fio.fioWallets
if (account?.currencyConfig != null && fioWallets.length > 0) break
if (loopCount++ > MAX_OBT_DATA_CHECKS) return
await snooze(400)
Expand Down
2 changes: 1 addition & 1 deletion src/actions/FioAddressActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function refreshAllFioAddresses(): ThunkAction<Promise<void>> {
})
const state = getState()
const { currencyWallets } = state.core.account
const fioWallets: EdgeCurrencyWallet[] = state.ui.wallets.fioWallets
const fioWallets: EdgeCurrencyWallet[] = state.ui.fio.fioWallets

const { fioAddresses, fioDomains, fioWalletsById } = await refreshFioNames(
fioWallets
Expand Down
18 changes: 11 additions & 7 deletions src/actions/LoginActions.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import type { EdgeAccount, EdgeCreateCurrencyWallet } from 'edge-core-js/types'
import type {
EdgeAccount,
EdgeCreateCurrencyWallet,
EdgeTokenId
} from 'edge-core-js/types'
import {
getSupportedBiometryType,
hasSecurityAlerts,
Expand Down Expand Up @@ -53,7 +57,7 @@ const MIN_CREATE_WALLET_TIMEOUT = 20000

function getFirstActiveWalletInfo(account: EdgeAccount): {
walletId: string
currencyCode: string
tokenId: EdgeTokenId
} {
// Find the first wallet:
const [walletId] = account.activeWalletIds
Expand All @@ -64,13 +68,13 @@ function getFirstActiveWalletInfo(account: EdgeAccount): {
for (const pluginId of Object.keys(account.currencyConfig)) {
const { currencyInfo } = account.currencyConfig[pluginId]
if (currencyInfo.walletType === walletKey.type) {
return { walletId, currencyCode: currencyInfo.currencyCode }
return { walletId, tokenId: null }
}
}
}

// The user has no wallets:
return { walletId: '', currencyCode: '' }
return { walletId: '', tokenId: null }
}

export function initializeAccount(
Expand Down Expand Up @@ -257,7 +261,7 @@ export function initializeAccount(
let accountInitObject: AccountInitPayload = {
...initialState,
account,
currencyCode: '',
tokenId: null,
pinLoginEnabled: false,
isTouchEnabled: await isTouchEnabled(account),
isTouchSupported: (await getSupportedBiometryType()) !== false,
Expand All @@ -267,9 +271,9 @@ export function initializeAccount(
try {
if (!newAccount) {
// We have a wallet
const { walletId, currencyCode } = getFirstActiveWalletInfo(account)
const { walletId, tokenId } = getFirstActiveWalletInfo(account)
accountInitObject.walletId = walletId
accountInitObject.currencyCode = currencyCode
accountInitObject.tokenId = tokenId
}

accountInitObject = { ...accountInitObject, ...syncedSettings }
Expand Down
11 changes: 3 additions & 8 deletions src/actions/ScanActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ import {
} from '../components/services/AirshipInstance'
import { getSpecialCurrencyInfo } from '../constants/WalletAndCurrencyConstants'
import { lstrings } from '../locales/strings'
import { getExchangeDenom } from '../selectors/DenominationSelectors'
import { getExchangeRate } from '../selectors/WalletSelectors'
import { config } from '../theme/appConfig'
import type { RequestAddressLink } from '../types/DeepLinkTypes'
import type { Dispatch, RootState, ThunkAction } from '../types/reduxTypes'
import type { NavigationBase } from '../types/routerTypes'
import {
getCurrencyCode,
getCurrencyCodeMultiplier
} from '../util/CurrencyInfoHelpers'
import { getCurrencyCode } from '../util/CurrencyInfoHelpers'
import { parseDeepLink } from '../util/DeepLinkParser'
import { logActivity } from '../util/logger'
import { runOnce } from '../util/runOnce'
Expand Down Expand Up @@ -401,10 +399,7 @@ async function sweepPrivateKeys(

// Check for a $50 maximum sweep for light accounts:
const sendNativeAmount = abs(unsignedTx.nativeAmount)
const multiplier = getCurrencyCodeMultiplier(
wallet.currencyConfig,
wallet.currencyInfo.currencyCode
)
const { multiplier } = getExchangeDenom(wallet.currencyConfig, null)
const sendExchangeAmount = div(
sendNativeAmount,
multiplier,
Expand Down
60 changes: 12 additions & 48 deletions src/actions/WalletActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@ import {
SPECIAL_CURRENCY_INFO
} from '../constants/WalletAndCurrencyConstants'
import { lstrings } from '../locales/strings'
import { selectDisplayDenomByCurrencyCode } from '../selectors/DenominationSelectors'
import {
getExchangeDenom,
selectDisplayDenom
} from '../selectors/DenominationSelectors'
import { convertCurrency } from '../selectors/WalletSelectors'
import type { ThunkAction } from '../types/reduxTypes'
import type { NavigationBase } from '../types/routerTypes'
import type { MapObject } from '../types/types'
import {
getCurrencyCode,
getCurrencyCodeMultiplier,
isKeysOnlyPlugin
} from '../util/CurrencyInfoHelpers'
import { getCurrencyCode, isKeysOnlyPlugin } from '../util/CurrencyInfoHelpers'
import { getWalletName } from '../util/CurrencyWalletHelpers'
import { fetchInfo } from '../util/network'

Expand Down Expand Up @@ -77,9 +76,6 @@ export function selectWalletToken({
const currencyCode = getCurrencyCode(wallet, tokenId)
dispatch(updateMostRecentWalletsSelected(walletId, tokenId))

const currentWalletId = state.ui.wallets.selectedWalletId
const currentWalletCurrencyCode = state.ui.wallets.selectedCurrencyCode

if (tokenId != null) {
const { unactivatedTokenIds } = wallet
if (
Expand All @@ -90,15 +86,7 @@ export function selectWalletToken({
await dispatch(activateWalletTokens(navigation, wallet, [tokenId]))
return false
}
if (
walletId !== currentWalletId ||
currencyCode !== currentWalletCurrencyCode
) {
dispatch({
type: 'UI/WALLETS/SELECT_WALLET',
data: { walletId, currencyCode }
})
}

return true
}

Expand All @@ -107,27 +95,14 @@ export function selectWalletToken({
)
if (isAccountActivationRequired) {
// activation-required wallets need different path in case not activated yet
if (
alwaysActivate ||
walletId !== currentWalletId ||
currencyCode !== currentWalletCurrencyCode
) {
if (alwaysActivate) {
return await dispatch(
selectActivationRequiredWallet(navigation, walletId, currencyCode)
)
}
return true
}

if (
walletId !== currentWalletId ||
currencyCode !== currentWalletCurrencyCode
) {
dispatch({
type: 'UI/WALLETS/SELECT_WALLET',
data: { walletId, currencyCode }
})
}
return true
}
}
Expand All @@ -146,10 +121,6 @@ function selectActivationRequiredWallet(

if (publicAddress !== '') {
// already activated
dispatch({
type: 'UI/WALLETS/SELECT_WALLET',
data: { walletId, currencyCode }
})
return true
} else {
// not activated yet
Expand Down Expand Up @@ -185,16 +156,14 @@ export function updateMostRecentWalletsSelected(
return (dispatch, getState) => {
const state = getState()
const { account } = state.core
const wallet = account.currencyWallets[walletId]
const currencyCode = getCurrencyCode(wallet, tokenId)
const { mostRecentWallets } = state.ui.settings
const currentMostRecentWallets = mostRecentWallets.filter(wallet => {
return wallet.id !== walletId || wallet.currencyCode !== currencyCode
return wallet.id !== walletId || wallet.tokenId !== tokenId
})
if (currentMostRecentWallets.length === 100) {
currentMostRecentWallets.pop()
}
currentMostRecentWallets.unshift({ id: walletId, currencyCode })
currentMostRecentWallets.unshift({ id: walletId, tokenId })

writeMostRecentWalletsSelected(account, currentMostRecentWallets)
.then(() => {
Expand Down Expand Up @@ -257,17 +226,12 @@ export function activateWalletTokens(
if (currencyPluginId !== pluginId)
throw new Error('Internal Error: Fee asset mismatch.')

const paymentCurrencyCode = getCurrencyCode(wallet, feeTokenId)

const multiplier = getCurrencyCodeMultiplier(
wallet.currencyConfig,
paymentCurrencyCode
)
const { multiplier } = getExchangeDenom(wallet.currencyConfig, feeTokenId)
const exchangeNetworkFee = div(nativeFee, multiplier, multiplier.length)
const feeDenom = selectDisplayDenomByCurrencyCode(
const feeDenom = selectDisplayDenom(
state,
wallet.currencyConfig,
paymentCurrencyCode
feeTokenId
)
const displayFee = div(
nativeFee,
Expand Down
Loading