Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: portfolio wire up #3241

Merged
merged 76 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
585d306
chore(types): added SupportedNetworks
stackchain Apr 22, 2024
5005443
refactor(portfolio): refactor portfolio balance for pt
stackchain Apr 23, 2024
216535f
refactor(portfolio): disabling auto hydrate to avoid confunsion
stackchain Apr 24, 2024
3efe8d7
reafactor(wallet-mobile): calc locked - to resolve without api
stackchain Apr 24, 2024
3bc4d12
chore(wallet-mobile): wip wiring up portoflio
stackchain Apr 24, 2024
7161e4a
chore(common): helpers to deal with bigint
stackchain Apr 25, 2024
19fa578
refactor(portfolio): refactor balance to amount
stackchain Apr 26, 2024
bdbb3a3
chore(wallet-mobile): avoid some renders and dropping RNP slowly
stackchain Apr 26, 2024
19eacc7
chore(wallet-mobile): storage initialization / new types
stackchain Apr 26, 2024
2dfda2c
chore(wallet-mobile): wip wire up
stackchain Apr 26, 2024
3015ccb
chore(wallet-mobile): updated PairedBalance
stackchain Apr 26, 2024
85a80e4
chore(wallet-mobile): added helpers to handle info
stackchain Apr 26, 2024
b4259a5
chore(portfolio): added description
stackchain Apr 26, 2024
9d30546
chore(portfolio): wip wire up
stackchain Apr 27, 2024
9b8bc07
chore(portfolio): wip wire up
stackchain Apr 27, 2024
41bea04
chore(portfolio): added clear function to balance manager
stackchain Apr 27, 2024
a68578c
chore(portfolio): added clear function to balance manager
stackchain Apr 27, 2024
ac00e4f
chore(wallet-mobile): sync pause and resume
stackchain Apr 27, 2024
f436acf
chore(transfer): adapted to portfolio amount
stackchain Apr 29, 2024
f36478d
chore(portfolio): moved info filter to portfolio
stackchain Apr 29, 2024
e3080ea
chore(portfolio): added records type to balance manager
stackchain Apr 29, 2024
73a4a86
chore(portfolio): added isprimary helper
stackchain Apr 29, 2024
889385c
chore(transfer): moved helpers to transfer
stackchain Apr 29, 2024
e0ff1d4
chore(portfolio): refactor isprimary
stackchain Apr 29, 2024
ef584b1
chore(portfolio): exporting helpers
stackchain Apr 29, 2024
1f0ace4
chore(portfolio): helpers renamed
stackchain Apr 30, 2024
a347fab
refactor(transfer): helpers
stackchain May 1, 2024
82d7c10
fix(theme): added flowgen script
stackchain May 1, 2024
1ec97fc
chore(transfer) changed the allocated behavior
stackchain May 1, 2024
9cd45d5
chore(portfolio): added more helpers
stackchain May 1, 2024
7afdc86
chore(wallet-mobile): more helpers
stackchain May 1, 2024
b87e0a7
chore(wallet-mobile): improved search ctx
stackchain May 1, 2024
ce35d8a
chore(common): redesing asAtomic
stackchain May 2, 2024
acee14a
chore(wallet-mobile): clean ups
stackchain May 2, 2024
4f6c79b
chore(wallet-mobile): more helpers
stackchain May 2, 2024
c8f6475
chore(wallet-mobile): wiring up
stackchain May 3, 2024
9207b56
chore(wallet-mobile): wiring up
stackchain May 3, 2024
a0905e0
refactor(wallet-mobile): refactored privacy
stackchain May 3, 2024
2f27b05
refactor(wallet-mobile): refactored privacy
stackchain May 3, 2024
a48d52a
chore(wallet-mobile): wiring up
stackchain May 3, 2024
ccf0a89
chore(wallet-mobile): wiring up
stackchain May 3, 2024
1f7ffe8
chore(transfer): fixes
stackchain May 4, 2024
b8ecb13
chore(wallet-mobile): revart bump csl
stackchain May 4, 2024
2be954a
chore(wallet-mobile): fixed privacy txs
stackchain May 4, 2024
5962ae5
chore(wallet-mobile): portfolio wire up
stackchain May 5, 2024
34b3b92
chore(wallet-mobile): updating port api
stackchain May 5, 2024
f3cb982
chore: making lists faster
stackchain May 6, 2024
3e9df52
chore: making lists faster
stackchain May 6, 2024
aa06667
chore(portfolio): updated TokenDiscovery
stackchain May 6, 2024
ac93ccb
chore(portfolio): parser trying in the stream
stackchain May 6, 2024
db53883
chore(wallet-mobile): loading or error placeholder
stackchain May 6, 2024
f8a0ee0
chore(portfolio): discover update
stackchain May 6, 2024
87e78e4
chore(types): discover update
stackchain May 6, 2024
ce9e11e
chore(types): discover update
stackchain May 6, 2024
e446c0e
chore: udpates
stackchain May 6, 2024
da432b9
chore: udpates
stackchain May 6, 2024
a06f891
chore: udpates
stackchain May 6, 2024
b540556
chore: udpates
stackchain May 6, 2024
9a95c6a
chore: udpates
stackchain May 6, 2024
c51aae8
chore: clean ups
stackchain May 7, 2024
1533874
chore: clean ups
stackchain May 7, 2024
f963545
chore(wallet-mobile): put back paired balance on governance conf
stackchain May 7, 2024
8a4d8ec
chore(wallet-mobile): put back paired balance on tx summary
stackchain May 7, 2024
e185dab
chore(portfolio): refactor token discovery single endpoint
stackchain May 7, 2024
62f1d24
chore: PR template
stackchain May 7, 2024
a673cf6
chore(portfolio): added translator
stackchain May 7, 2024
ccc779d
chore(portfolio): added translator
stackchain May 7, 2024
2127af7
fix(wallet-mobile): nft navigation
stackchain May 8, 2024
ba60237
chore(portfolio): dropped bigint on discovery
stackchain May 8, 2024
e03cc83
fix(portfolio): endpoint token -> tokens for discovery
stackchain May 8, 2024
aa361d1
chore(wallet-mobile): moving + clean ups
stackchain May 8, 2024
5f5e4b9
chore(wallet-mobile): caching token discovery while the app is open
stackchain May 8, 2024
0a93409
chore(wallet-mobile): clean ups
stackchain May 8, 2024
83abdd5
merge: develop
stackchain May 9, 2024
69d5b35
chore(wallet-mobile): trans file upd
stackchain May 9, 2024
01f4c16
chore: CR updates
stackchain May 9, 2024
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
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Description / Change(s) / Related issue(s)

##### Ticket

YOMO-

[!NOTE]
Please create the ticket if missing it.
3 changes: 3 additions & 0 deletions apps/wallet-mobile/.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ WALLET_1_NETWORK_ID=300
WALLET_2_NETWORK_ID=300
WALLET_2_MNEMONIC=abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon share

WALLET_3_NETWORK_ID=300
WALLET_3_MNEMONIC=typical evoke despair burger ripple venue assist shoot donate alter twice bomb glimpse asthma explain

BANXA_TEST_WALLET=addr1qyfuspldlchc5kechfe5jzdrr9jms2s9w0tq4hggy9zgkhxssydveuc8xyx4zh27fwcmr62mraeezjwf24hzkyejwfmq7yptmd

FRONTEND_FEE_ADDRESS_MAINNET=addr1q9ry6jfdgm0lcrtfpgwrgxg7qfahv80jlghhrthy6w8hmyjuw9ngccy937pm7yw0jjnxasm7hzxjrf8rzkqcj26788lqws5fke
Expand Down
3 changes: 2 additions & 1 deletion apps/wallet-mobile/.storybook/storybook.requires.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions apps/wallet-mobile/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"name": "yoroi",
"displayName": "Yoroi",
"expo": {
"plugins": ["sentry-expo"]
"name": "yoroi",
"slug": "yoroi",
"plugins": [
"sentry-expo"
]
}
}
}
62 changes: 60 additions & 2 deletions apps/wallet-mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ PODS:
- ExpoModulesCore
- ExpoDevice (5.4.0):
- ExpoModulesCore
- ExpoImage (1.3.0):
- ExpoModulesCore
- SDWebImage (~> 5.15.8)
- SDWebImageAVIFCoder (~> 0.10.0)
- SDWebImageSVGCoder (~> 1.7.0)
- SDWebImageWebPCoder (~> 0.11.0)
- ExpoKeepAwake (12.0.1):
- ExpoModulesCore
- ExpoModulesCore (1.2.7):
Expand All @@ -48,7 +54,28 @@ PODS:
- hermes-engine (0.71.14):
- hermes-engine/Pre-built (= 0.71.14)
- hermes-engine/Pre-built (0.71.14)
- libaom (3.0.0):
- libvmaf (>= 2.2.0)
- libavif (0.11.1):
- libavif/libaom (= 0.11.1)
- libavif/core (0.11.1)
- libavif/libaom (0.11.1):
- libaom (>= 2.0.0)
- libavif/core
- libevent (2.1.12)
- libvmaf (2.3.1)
- libwebp (1.3.2):
- libwebp/demux (= 1.3.2)
- libwebp/mux (= 1.3.2)
- libwebp/sharpyuv (= 1.3.2)
- libwebp/webp (= 1.3.2)
- libwebp/demux (1.3.2):
- libwebp/webp
- libwebp/mux (1.3.2):
- libwebp/demux
- libwebp/sharpyuv (1.3.2)
- libwebp/webp (1.3.2):
- libwebp/sharpyuv
- MMKV (1.3.3):
- MMKVCore (~> 1.3.3)
- MMKVCore (1.3.3)
Expand Down Expand Up @@ -492,6 +519,17 @@ PODS:
- React-Core
- RNSVG (13.8.0):
- React-Core
- SDWebImage (5.15.8):
- SDWebImage/Core (= 5.15.8)
- SDWebImage/Core (5.15.8)
- SDWebImageAVIFCoder (0.10.1):
- libavif (>= 0.11.0)
- SDWebImage (~> 5.10)
- SDWebImageSVGCoder (1.7.0):
- SDWebImage/Core (~> 5.6)
- SDWebImageWebPCoder (0.11.0):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.15)
- Sentry/HybridSDK (8.9.3):
- SentryPrivate (= 8.9.3)
- SentryPrivate (8.9.3)
Expand All @@ -517,6 +555,7 @@ DEPENDENCIES:
- Expo (from `../../../node_modules/expo`)
- ExpoBlur (from `../../../node_modules/expo-blur/ios`)
- ExpoDevice (from `../../../node_modules/expo-device/ios`)
- ExpoImage (from `../../../node_modules/expo-image/ios`)
- ExpoKeepAwake (from `../../../node_modules/expo-keep-awake/ios`)
- ExpoModulesCore (from `../../../node_modules/expo-modules-core`)
- FBLazyVector (from `../../../node_modules/react-native/Libraries/FBLazyVector`)
Expand Down Expand Up @@ -592,10 +631,18 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- fmt
- libaom
- libavif
- libevent
- libvmaf
- libwebp
- MMKV
- MMKVCore
- MultiplatformBleAdapter
- SDWebImage
- SDWebImageAVIFCoder
- SDWebImageSVGCoder
- SDWebImageWebPCoder
- Sentry
- SentryPrivate
- ZXingObjC
Expand Down Expand Up @@ -629,6 +676,8 @@ EXTERNAL SOURCES:
:path: "../../../node_modules/expo-blur/ios"
ExpoDevice:
:path: "../../../node_modules/expo-device/ios"
ExpoImage:
:path: "../../../node_modules/expo-image/ios"
ExpoKeepAwake:
:path: "../../../node_modules/expo-keep-awake/ios"
ExpoModulesCore:
Expand Down Expand Up @@ -772,7 +821,7 @@ SPEC CHECKSUMS:
amplitude-react-native: 1ea3d5e1f80ccc357dd178c55c29e51c89f1cd11
boost: 57d2868c099736d80fcd648bf211b4431e51a558
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
EXApplication: d8f53a7eee90a870a75656280e8d4b85726ea903
EXBarCodeScanner: 8e23fae8d267dbef9f04817833a494200f1fce35
EXCamera: 0fbfa338a3776af2722d626a3437abe33f708aad
Expand All @@ -783,14 +832,19 @@ SPEC CHECKSUMS:
Expo: b7d2843b0a0027d0ce76121a63085764355a16ed
ExpoBlur: e832d874bd94afc0645daddbd3162ec1ce172080
ExpoDevice: 1c1b0c9cad96c292c1de73948649cfd654b2b3c0
ExpoImage: bf714e0101812ccbbd1a4fdbfd34905feeefd9f5
ExpoKeepAwake: 69f5f627670d62318410392d03e0b5db0f85759a
ExpoModulesCore: 653958063a301098b541ae4dfed1ac0b98db607b
FBLazyVector: 12ea01e587c9594e7b144e1bfc86ac4d9ac28fde
FBReactNativeSpec: faca7d16c37626ca5780a87adef703817722fe61
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
hermes-engine: d7cc127932c89c53374452d6f93473f1970d8e88
libaom: 144606b1da4b5915a1054383c3a4459ccdb3c661
libavif: 84bbb62fb232c3018d6f1bab79beea87e35de7b7
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libvmaf: 27f523f1e63c694d14d534cd0fddd2fab0ae8711
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
MMKV: f902fb6719da13c2ab0965233d8963a59416f911
MMKVCore: d26e4d3edd5cb8588c2569222cbd8be4231374e9
MultiplatformBleAdapter: 5a6a897b006764392f9cef785e4360f54fb9477d
Expand Down Expand Up @@ -856,6 +910,10 @@ SPEC CHECKSUMS:
RNSentry: f9e637773502a61c7b455c4ce65bc7008ce22a6e
RNShare: 859ff710211285676b0bcedd156c12437ea1d564
RNSVG: c1e76b81c76cdcd34b4e1188852892dc280eb902
SDWebImage: cb032eba469c54e0000e78bcb0a13cdde0a52798
SDWebImageAVIFCoder: 8348fef6d0ec69e129c66c9fe4d74fbfbf366112
SDWebImageSVGCoder: 15a300a97ec1c8ac958f009c02220ac0402e936c
SDWebImageWebPCoder: 295a6573c512f54ad2dd58098e64e17dcf008499
Sentry: 97161cac725da1ecbe77d1445bf8a61c1e5667f1
SentryPrivate: 9a76def09fb08f9501997b8df946e8097947b94f
Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9
Expand Down
12 changes: 10 additions & 2 deletions apps/wallet-mobile/ios/yoroi.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,11 @@
"-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1",
);
OTHER_LDFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
SDKROOT = iphoneos;
};
Expand Down Expand Up @@ -1055,7 +1059,11 @@
"-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1",
);
OTHER_LDFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
Expand Down
3 changes: 2 additions & 1 deletion apps/wallet-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"prestart": "sb-rn-get-stories",
"start": "yarn react-native start --reset-cache --verbose",
"storybook:watch": "sb-rn-watcher",
"test": "jest src --ci --bail --silent",
"test": "jest src --ci --bail --silent --maxWorkers=1",
"tsc": "tsc --noEmit -p tsconfig.json",
"tsc:cover": "yarn typescript-coverage-report -i '**/*.test.*' -i '**/*.stories*' -t html --threshold=100"
},
Expand Down Expand Up @@ -151,6 +151,7 @@
"expo-blur": "12.9.2",
"expo-camera": "^13.2.1",
"expo-device": "^5.4.0",
"expo-image": "1.3.0",
"expo-status-bar": "~1.4.4",
"immer": "^10.0.2",
"jsc-android": "241213.1.0",
Expand Down
8 changes: 4 additions & 4 deletions apps/wallet-mobile/src/AppNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const AppNavigator = () => {
})

const firstAction = useFirstAction()
const onReady = () => {
const onReady = React.useCallback(() => {
if (isLoggedIn) return

// try first OS auth before navigating to os login screen
Expand All @@ -69,12 +69,12 @@ export const AppNavigator = () => {
} else {
RNBootSplash.hide({fade: true})
}
}
}, [authWithOs, firstAction, isLoggedIn])

const handleStateChange = () => {
const handleStateChange = React.useCallback(() => {
const currentRouteName = navRef.current?.getCurrentRoute()?.name
setRouteName(currentRouteName)
}
}, [])

return (
<NavigationContainer
Expand Down
8 changes: 4 additions & 4 deletions apps/wallet-mobile/src/NftDetails/NftDetails.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {storiesOf} from '@storybook/react-native'
import React from 'react'

import {QueryProvider, RouteProvider} from '../../.storybook/decorators'
import {MediaDetails} from '../features/Portfolio/common/MediaDetails/MediaDetails'
import {SelectedWalletProvider} from '../features/WalletManager/Context'
import {mocks, nft} from '../yoroi-wallets/mocks'
import {NftDetails} from './NftDetails'

storiesOf('NFT/Details', module)
stackchain marked this conversation as resolved.
Show resolved Hide resolved
.add('Default', () => {
Expand All @@ -17,7 +17,7 @@ storiesOf('NFT/Details', module)
<RouteProvider params={{id: nft.id}}>
<QueryProvider>
<SelectedWalletProvider wallet={loadedWallet}>
<NftDetails />
<MediaDetails />
</SelectedWalletProvider>
</QueryProvider>
</RouteProvider>
Expand All @@ -33,7 +33,7 @@ storiesOf('NFT/Details', module)
<RouteProvider params={{id: nft.id}}>
<QueryProvider>
<SelectedWalletProvider wallet={wallet}>
<NftDetails />
<MediaDetails />
</SelectedWalletProvider>
</QueryProvider>
</RouteProvider>
Expand All @@ -49,7 +49,7 @@ storiesOf('NFT/Details', module)
<RouteProvider params={{id: nft.id}}>
<QueryProvider>
<SelectedWalletProvider wallet={wallet}>
<NftDetails />
<MediaDetails />
</SelectedWalletProvider>
</QueryProvider>
</RouteProvider>
Expand Down
22 changes: 13 additions & 9 deletions apps/wallet-mobile/src/NftDetails/NftDetailsImage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React from 'react'
import {Dimensions, StyleSheet, View} from 'react-native'
import {StyleSheet, useWindowDimensions, View} from 'react-native'
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import ViewTransformer from 'react-native-easy-view-transformer'

import {FadeIn} from '../components'
import {NftPreview} from '../components/NftPreview'
import {MediaPreview} from '../features/Portfolio/common/MediaPreview/MediaPreview'
import {useSelectedWallet} from '../features/WalletManager/Context'
import {useMetrics} from '../metrics/metricsManager'
import {NftRoutes, useParams} from '../navigation'
import {isEmptyString} from '../utils/utils'
import {useNft} from '../yoroi-wallets/hooks'

type Params = NftRoutes['nft-details']

Expand All @@ -21,20 +20,25 @@ const isParams = (params?: Params | object | undefined): params is Params => {
export const NftDetailsImage = () => {
const {id} = useParams<Params>(isParams)
const wallet = useSelectedWallet()
const nft = useNft(wallet, {id})
const {track} = useMetrics()
const dimensions = useWindowDimensions()

// reading from the getter, there is no need to subscribe to changes
const [amount] = React.useState(wallet.balances.records.get(id))
stackchain marked this conversation as resolved.
Show resolved Hide resolved

const {track} = useMetrics()
React.useEffect(() => {
if (!isEmptyString(nft?.id)) track.nftGalleryDetailsImageViewed()
stackchain marked this conversation as resolved.
Show resolved Hide resolved
}, [nft?.id, track])
track.nftGalleryDetailsImageViewed()
}, [track, id])

const dimensions = Dimensions.get('window')
// record can be gone when arriving here, need a state
// TODO: revisit + product definition (missing is gone state)
if (!amount) return null

return (
<FadeIn style={styles.container}>
<ViewTransformer maxScale={3} minScale={1}>
<View style={styles.contentContainer}>
<NftPreview nft={nft} width={dimensions.width} height={dimensions.height} zoom={1} contentFit="contain" />
<MediaPreview info={amount.info} width={dimensions.width} height={dimensions.height} contentFit="contain" />
</View>
</ViewTransformer>
</FadeIn>
Expand Down
Loading
Loading