Skip to content

Commit 4a3bb83

Browse files
committed
stash work
1 parent fc817c4 commit 4a3bb83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+6755
-166
lines changed
10.5 KB
Binary file not shown.
9.93 KB
Binary file not shown.

package.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,24 @@
5656
"@walletconnect/[email protected]": "patch:@walletconnect/core@npm%3A2.16.1#./.yarn/patches/@walletconnect-core-npm-2.16.1-42d08707e6.patch",
5757
"@walletconnect/[email protected]": "patch:@walletconnect/sign-client@npm%3A2.16.1#./.yarn/patches/@walletconnect-sign-client-npm-2.16.1-b9bdaa2d98.patch",
5858
"@walletconnect/[email protected]": "patch:@walletconnect/utils@npm%3A2.17.2#./.yarn/patches/@walletconnect-utils-npm-2.17.2-43f96abc05.patch",
59-
"@walletconnect/[email protected]": "patch:@walletconnect/utils@npm%3A2.17.2#./.yarn/patches/@walletconnect-utils-npm-2.17.2-43f96abc05.patch"
59+
"@walletconnect/[email protected]": "patch:@walletconnect/utils@npm%3A2.17.2#./.yarn/patches/@walletconnect-utils-npm-2.17.2-43f96abc05.patch",
60+
"@noble/[email protected]": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
61+
"@noble/curves@^1.7.0": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
62+
"@noble/[email protected]": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
63+
"@noble/curves@^1.6.0": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
64+
"@noble/[email protected]": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
65+
"@noble/[email protected]": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
66+
"@noble/[email protected]": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
67+
"@noble/curves@~1.3.0": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
68+
"@noble/curves@^1.4.0": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
69+
"@noble/curves@~1.4.0": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
70+
"@noble/curves@~1.6.0": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
71+
"@noble/[email protected]": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
72+
"@noble/curves@~1.2.0": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
73+
"@noble/curves@~1.1.0": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
74+
"@noble/curves@^1.8.0": "patch:@noble/curves@npm%3A1.9.7#./.yarn/patches/@noble-curves-npm-1.9.7-2b9efc8ab4.patch",
75+
"@bitcoinerlab/[email protected]": "patch:@bitcoinerlab/secp256k1@npm%3A1.2.0#./.yarn/patches/@bitcoinerlab-secp256k1-npm-1.2.0-1098d4b329.patch",
76+
"@bitcoinerlab/secp256k1@^1.0.5": "patch:@bitcoinerlab/secp256k1@npm%3A1.2.0#./.yarn/patches/@bitcoinerlab-secp256k1-npm-1.2.0-1098d4b329.patch"
6077
},
6178
"engines": {
6279
"node": ">=20.18.0",

packages/core-mobile/android/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ android {
128128
}
129129

130130
release {
131+
signingConfig signingConfigs.debug
131132
minifyEnabled enableProguardInReleaseBuilds
132133
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
133134
}

packages/core-mobile/android/app/src/main/java/com/avaxwallet/MainApplication.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import com.facebook.react.defaults.DefaultReactNativeHost
1717
import com.facebook.react.modules.network.OkHttpClientProvider
1818
import com.facebook.react.soloader.OpenSourceMergedSoMapping
1919
import com.facebook.soloader.SoLoader
20+
import com.gantix.JailMonkey.Rooted.RootedCheck
2021
import java.lang.reflect.Field
2122

2223
class MainApplication : Application(), ReactApplication {
@@ -44,6 +45,8 @@ class MainApplication : Application(), ReactApplication {
4445
override fun onCreate() {
4546
super.onCreate()
4647

48+
RootedCheck.precompute(this);
49+
4750
increaseWindowCursorSize()
4851

4952
// Manually set user agent to our format. This helps avoid getting identified as a bot and rate limited by cloudflare

packages/core-mobile/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# The setting is particularly useful for tweaking memory settings.
1212
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
1313
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14-
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m
14+
org.gradle.jvmargs=-Xmx8096m -XX:MaxMetaspaceSize=4096m
1515

1616
# When configured, Gradle will run in incubating parallel mode.
1717
# This option should only be used with decoupled projects. More details, visit
Lines changed: 81 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import axios from 'axios'
12
import { Zodios } from '@zodios/core'
23
import Config from 'react-native-config'
3-
import { array, string } from 'zod'
4+
import { array, string, z } from 'zod'
45
import Logger from 'utils/Logger'
56
import {
67
SimplePriceResponseSchema,
@@ -11,37 +12,85 @@ import {
1112
if (!Config.PROXY_URL)
1213
Logger.warn('PROXY_URL is missing in env file. Watchlist is disabled.')
1314

14-
const baseUrl = Config.PROXY_URL + '/watchlist'
15-
16-
export const watchListCacheClient = new Zodios(
17-
baseUrl,
18-
[
19-
{
20-
method: 'get',
21-
path: '/price',
22-
alias: 'simplePrice',
23-
response: SimplePriceResponseSchema
24-
},
25-
// tokens endpoint is top 250 + additional markets
26-
{
27-
method: 'get',
28-
path: '/tokens',
29-
parameters: [{ name: 'currency', type: 'Query', schema: string() }],
30-
alias: 'tokens',
31-
response: array(TopTokenSchema)
32-
},
33-
{
34-
method: 'get',
35-
path: '/trending',
36-
alias: 'trending',
37-
response: array(TrendingTokenSchema)
38-
}
39-
],
15+
const baseUrl = `${Config.PROXY_URL}/watchlist`
16+
17+
// Zodios endpoint definitions
18+
const endpoints = [
19+
{
20+
method: 'get',
21+
path: '/price',
22+
alias: 'simplePrice',
23+
response: SimplePriceResponseSchema
24+
},
25+
{
26+
method: 'get',
27+
path: '/tokens',
28+
parameters: [{ name: 'currency', type: 'Query', schema: string() }],
29+
alias: 'tokens',
30+
response: array(TopTokenSchema)
31+
},
4032
{
41-
axiosConfig: {
42-
headers: {
43-
'Content-Type': 'application/json'
44-
}
33+
method: 'get',
34+
path: '/trending',
35+
alias: 'trending',
36+
response: array(TrendingTokenSchema)
37+
}
38+
] as const
39+
40+
// Infer types from schemas for typings
41+
export type SimplePriceResponse = z.infer<typeof SimplePriceResponseSchema>
42+
export type TopToken = z.infer<typeof TopTokenSchema>
43+
export type TrendingToken = z.infer<typeof TrendingTokenSchema>
44+
45+
// Dev (validated) and Prod (raw) clients
46+
const devClient = new Zodios(baseUrl, endpoints, {
47+
axiosConfig: {
48+
headers: { 'Content-Type': 'application/json' }
49+
}
50+
})
51+
52+
const prodClient = axios.create({
53+
baseURL: baseUrl,
54+
headers: { 'Content-Type': 'application/json' }
55+
})
56+
57+
// Force validation on/off
58+
const useValidation = __DEV__ //in normal use
59+
60+
export const watchListCacheClient = {
61+
/**
62+
* GET /price
63+
*/
64+
async simplePrice(): Promise<SimplePriceResponse> {
65+
if (useValidation) {
66+
return devClient.simplePrice()
67+
}
68+
const { data } = await prodClient.get<SimplePriceResponse>('/price')
69+
return data
70+
},
71+
72+
/**
73+
* GET /tokens?currency=...
74+
*/
75+
async tokens(params: { queries: { currency: string } }): Promise<TopToken[]> {
76+
if (useValidation) {
77+
// Match Zodios’ expected input shape exactly
78+
return devClient.tokens(params)
79+
}
80+
const { data } = await prodClient.get<TopToken[]>('/tokens', {
81+
params: params.queries
82+
})
83+
return data
84+
},
85+
86+
/**
87+
* GET /trending
88+
*/
89+
async trending(params?: Record<string, never>): Promise<TrendingToken[]> {
90+
if (useValidation) {
91+
return devClient.trending(params)
4592
}
93+
const { data } = await prodClient.get<TrendingToken[]>('/trending')
94+
return data
4695
}
47-
)
96+
}

packages/core-mobile/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import './profiler'
2+
3+
14
import { AppRegistry, LogBox, Platform, UIManager } from 'react-native'
25
import './polyfills'
36
import Big from 'big.js'

packages/core-mobile/metro.config.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
const { mergeConfig } = require('@react-native/metro-config')
22
const { getSentryExpoConfig } = require('@sentry/react-native/metro')
33
const merge = require('lodash.merge')
4+
const path = require('path')
5+
6+
// Workspace paths (adjust if your monorepo depth is different)
7+
const projectRoot = __dirname
8+
const workspaceRoot = path.resolve(projectRoot, '..', '..')
9+
const nitroCryptoPath = path.resolve(workspaceRoot, 'packages/react-native-nitro-avalabs-crypto')
410

511
const monorepoConfig = require('./metro.monorepo.config')
612
const defaultConfig = getSentryExpoConfig(__dirname)
@@ -25,13 +31,22 @@ const baseConfig = {
2531
}),
2632
babelTransformerPath: require.resolve('react-native-svg-transformer')
2733
},
34+
watchFolders: [
35+
workspaceRoot,
36+
nitroCryptoPath,
37+
],
2838
resolver: {
2939
// mute warnings about circular dependencies
3040
requireCycleIgnorePatterns: [/^app\/.*/, /^node_modules\/.*/],
3141
extraNodeModules: {
3242
stream: require.resolve('./node_modules/stream-browserify'),
33-
'@noble/hashes': require.resolve('./node_modules/@noble/hashes')
43+
'@noble/hashes': require.resolve('./node_modules/@noble/hashes'),
44+
"react-native-nitro-avalabs-crypto": nitroCryptoPath
3445
},
46+
nodeModulesPaths: [
47+
path.resolve(workspaceRoot, 'node_modules'),
48+
path.resolve(projectRoot, 'node_modules'),
49+
],
3550
// TODO: should this be a temporary fix?
3651
unstable_enablePackageExports: false,
3752
// sbmodern is needed for storybook

packages/core-mobile/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"@paraswap/sdk": "7.2.3",
7575
"@react-native-async-storage/async-storage": "2.1.2",
7676
"@react-native-clipboard/clipboard": "1.15.0",
77+
"@react-native-community/cli-tools": "^20.0.2",
7778
"@react-native-community/datetimepicker": "8.4.1",
7879
"@react-native-community/netinfo": "11.4.1",
7980
"@react-native-community/slider": "4.5.6",
@@ -150,6 +151,7 @@
150151
"lodash.merge": "4.6.2",
151152
"lottie-react-native": "7.2.2",
152153
"lru-cache": "11.0.2",
154+
"metro-symbolicate": "^0.83.3",
153155
"moment": "2.30.1",
154156
"path-browserify": "1.0.1",
155157
"qrcode-reader": "1.0.4",
@@ -185,6 +187,8 @@
185187
"react-native-localize": "3.2.1",
186188
"react-native-mmkv": "3.2.0",
187189
"react-native-modal-datetime-picker": "18.0.0",
190+
"react-native-nitro-avalabs-crypto": "workspace:*",
191+
"react-native-nitro-modules": "^0.30.2",
188192
"react-native-os": "1.2.6",
189193
"react-native-pager-view": "6.7.1",
190194
"react-native-passkey": "3.1.0",

0 commit comments

Comments
 (0)