Skip to content

Commit c13ce93

Browse files
committed
fix set problems
stash work
1 parent 256c4f7 commit c13ce93

Some content is hidden

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

44 files changed

+10650
-157
lines changed

.yarn/patches/@walletconnect-sign-client-npm-2.16.1-b9bdaa2d98.patch

Lines changed: 4383 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/patches/@walletconnect-utils-npm-2.17.2-43f96abc05.patch

Lines changed: 83 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
"@scure/bip39/@noble/hashes": "1.8.0",
5252
"@scure/btc-signer/@noble/hashes": "1.8.0",
5353
"lodash@4.17.3": "4.17.21",
54-
"@ledgerhq/hw-transport": "6.31.0"
54+
"@ledgerhq/hw-transport": "6.31.0",
55+
"@walletconnect/sign-client@2.16.1": "patch:@walletconnect/sign-client@npm%3A2.16.1#./.yarn/patches/@walletconnect-sign-client-npm-2.16.1-b9bdaa2d98.patch",
56+
"@walletconnect/utils@2.17.2": "patch:@walletconnect/utils@npm%3A2.17.2#./.yarn/patches/@walletconnect-utils-npm-2.17.2-43f96abc05.patch"
5557
},
5658
"engines": {
5759
"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
import io.branch.rnbranch.*
2223

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

49+
RootedCheck.precompute(this);
50+
4851
increaseWindowCursorSize()
4952
RNBranchModule.getAutoInstance(this);
5053

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/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
@@ -77,6 +77,7 @@
7777
"@paraswap/sdk": "7.2.3",
7878
"@react-native-async-storage/async-storage": "2.1.2",
7979
"@react-native-clipboard/clipboard": "1.15.0",
80+
"@react-native-community/cli-tools": "^20.0.2",
8081
"@react-native-community/datetimepicker": "8.4.1",
8182
"@react-native-community/netinfo": "11.4.1",
8283
"@react-native-community/slider": "4.5.6",
@@ -153,6 +154,7 @@
153154
"lodash.merge": "4.6.2",
154155
"lottie-react-native": "7.2.2",
155156
"lru-cache": "11.0.2",
157+
"metro-symbolicate": "^0.83.3",
156158
"moment": "2.30.1",
157159
"path-browserify": "1.0.1",
158160
"qrcode-reader": "1.0.4",
@@ -189,6 +191,8 @@
189191
"react-native-localize": "3.2.1",
190192
"react-native-mmkv": "3.2.0",
191193
"react-native-modal-datetime-picker": "18.0.0",
194+
"react-native-nitro-avalabs-crypto": "workspace:*",
195+
"react-native-nitro-modules": "^0.30.2",
192196
"react-native-os": "1.2.6",
193197
"react-native-pager-view": "6.7.1",
194198
"react-native-passkey": "3.1.0",
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
usage() {
5+
echo "usage: $0 <package[@version]> [-v <version>] [--locator <locator>]"
6+
echo "examples:"
7+
echo " $0 @walletconnect/core"
8+
echo " $0 @walletconnect/utils -v 2.16.1"
9+
echo " $0 @walletconnect/utils --locator @walletconnect/utils@npm:2.16.1"
10+
exit 1
11+
}
12+
13+
[[ $# -ge 1 ]] || usage
14+
PKG="$1"; shift || true
15+
16+
VER=""
17+
LOC=""
18+
while [[ $# -gt 0 ]]; do
19+
case "$1" in
20+
-v|--version) VER="${2:-}"; shift 2 ;;
21+
--locator) LOC="${2:-}"; shift 2 ;;
22+
-h|--help) usage ;;
23+
*) echo "unknown arg: $1"; usage ;;
24+
esac
25+
done
26+
27+
# If --locator given, use it verbatim. Else build from PKG + optional -v.
28+
if [[ -n "$LOC" ]]; then
29+
PATCH_ARG="$LOC"
30+
else
31+
if [[ -n "$VER" ]]; then
32+
# Yarn Berry expects protocol when multiple versions exist
33+
PATCH_ARG="${PKG%@*}@npm:${VER}"
34+
else
35+
PATCH_ARG="$PKG"
36+
fi
37+
fi
38+
39+
# Resolve node_modules path (supports @scope/name and optional @version)
40+
if [[ "$PKG" == @*/* ]]; then
41+
SCOPE="${PKG%%/*}" # @scope
42+
REST="${PKG#*/}" # name[@version]
43+
NAME="${REST%%@*}" # name
44+
PKG_DIR="node_modules/$SCOPE/$NAME"
45+
else
46+
NAME="${PKG%%@*}"
47+
PKG_DIR="node_modules/$NAME"
48+
fi
49+
50+
echo "→ yarn patch $PATCH_ARG"
51+
OUT="$(yarn patch "$PATCH_ARG" 2>&1 | tee /dev/stderr)"
52+
53+
# Handle the “multiple candidate packages found” case nicely
54+
if grep -q "Multiple candidate packages found" <<<"$OUT"; then
55+
echo "❌ Multiple versions installed. Try:"
56+
echo " yarn why ${PKG%@*}"
57+
echo " then re-run with:"
58+
echo " $0 ${PKG%@*} --locator ${PKG%@*}@npm:<version>"
59+
exit 1
60+
fi
61+
62+
TMP_DIR="$(sed -nE 's/.*edit the following folder: (.*)$/\1/p' <<<"$OUT" | tail -n1)"
63+
[[ -d "$TMP_DIR" ]] || { echo "❌ Failed to get yarn patch temp dir"; exit 1; }
64+
[[ -d "$PKG_DIR" ]] || { echo "❌ Package dir not found: $PKG_DIR"; exit 1; }
65+
66+
echo "→ Copying $PKG_DIR$TMP_DIR"
67+
cp -a "$PKG_DIR"/. "$TMP_DIR"/
68+
69+
echo "→ yarn patch-commit"
70+
# NOTE: On Yarn Berry, -s takes NO message string
71+
yarn patch-commit -s "$TMP_DIR"
72+
73+
echo "✅ Patch created under .yarn/patches"

0 commit comments

Comments
 (0)