appkit-react-native icon indicating copy to clipboard operation
appkit-react-native copied to clipboard

[bug]: An Issue about the createAppKit() Function -> add custom token

Open ianmunge0 opened this issue 2 years ago • 9 comments

Description

Expected Behavior

The modal should show the balance of the token specified in createAppKit() function

What is Actually Happening

The token passed as the value of the token property in the createAppKit() function does not display its balance when the modal is open. It shows the balance of the chain's native token

AppKit SDK version

@reown/appkit-wagmi-react-native: ^1.0.1

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
  CPU: (4) x64 Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
  Memory: 2.56 GB / 7.63 GB
  Shell:
    version: 5.1.16
    path: /bin/bash
Binaries:
  Node:
    version: 18.19.0
    path: ~/.nvm/versions/node/v18.19.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.yarn/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v18.19.0/bin/npm
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "33"
      - "34"
      - "34"
      - "34"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-34 | Google APIs Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: Not Found
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.5
    wanted: 0.74.5
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

info React Native v0.75.4 is now available (your project is running on v0.74.5).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.75.4
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.74.5
info For more info, check out "https://reactnative.dev/docs/upgrading?os=linux".

Expo Version (if applies)

~51.0.28

Steps to reproduce

Procucing the Bug

Install Valora from here and set up a wallet. Use Celo mainnet on Valora

Run these from terminal/cli

git clone https://github.com/ianmunge0/debugreown.git cd debugreown npm install

Register debugreown as a project in your Reown Cloud account here

Create .env file at the root directory of your project. Have an env variable of PROJECT_ID. Put the project ID of debugreown from your Reown Cloud account as the value of PROJECT_ID

Resume to terminal/cli and run npx expo run:android

Snack, code example, screenshot, or link to a repository

https://github.com/ianmunge0/debugreown.git

ianmunge0 avatar Oct 06 '24 13:10 ianmunge0

hey @ianmunge0 👋 thanks for reporting! Can you check if this canary version works?

"@reown/appkit-wagmi-react-native": "0.0.0-fix-token-balance-20241017200828"

ignaciosantise avatar Oct 17 '24 20:10 ignaciosantise

hello @ignaciosantise . In this version, I can now see the param token in the Activity tab. Is it possible to show its balance where the native token is?

ianmunge0 avatar Oct 18 '24 15:10 ianmunge0

@ianmunge0 can you share a picture of what you expect? I can see the custom token balance correctly

Screenshot 2024-10-18 at 12 59 18 PM Screenshot 2024-10-18 at 12 59 26 PM

In my case, i added USDT address so it's shown when the user is in mainnet

createAppKit({
  projectId,
  wagmiConfig,
  ...
  tokens: {
    1: {
      address: '0xdAC17F958D2ee523a2206206994597C13D831ec7'
    }
  }
});

ignaciosantise avatar Oct 18 '24 16:10 ignaciosantise

Hi @ignaciosantise 👋. I have not tested it in Ethereum but this bug appears in the Celo chain. tokenbug

The code here should show the cUSD balance on Celo but instead it shows the native token

createAppKit({
  projectId,
  wagmiConfig,
  tokens: {
    42220: {
      address: '0x765de816845861e75a25fca122bb6898b8b1282a'
    }
  }
});

ianmunge0 avatar Oct 18 '24 19:10 ianmunge0

@ianmunge0 works for me

Screenshot 2024-10-18 at 5 02 35 PM

can you close and open your app? also, are you sure you installed the version correctly?

your package json should be:

{
  "name": "reown",
  "version": "1.0.0",
  "main": "expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-community/netinfo": "11.3.1",
    "@reown/appkit-wagmi-react-native": "0.0.0-fix-token-balance-20241017200828",
    "@tanstack/react-query": "^5.56.2",
    "@walletconnect/react-native-compat": "^2.16.2",
    "expo": "~51.0.28",
    "expo-application": "~5.9.1",
    "expo-status-bar": "~1.12.1",
    "react": "18.2.0",
    "react-native": "0.74.5",
    "react-native-dotenv": "^3.4.11",
    "react-native-get-random-values": "~1.11.0",
    "react-native-modal": "^13.0.1",
    "react-native-reanimated": "^3.15.3",
    "react-native-svg": "15.2.0",
    "viem": "^2.21.15",
    "wagmi": "^2.12.16"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "private": true
}

and remember to run npm install after changing the package.json

ignaciosantise avatar Oct 18 '24 20:10 ignaciosantise

Let me test with your package.json

ianmunge0 avatar Oct 19 '24 06:10 ianmunge0

@ignaciosantise it works with your package.json :white_check_mark: tokenbug2

ianmunge0 avatar Oct 19 '24 08:10 ianmunge0

@ianmunge0 did something happen?

ignaciosantise avatar Nov 05 '24 14:11 ignaciosantise

The modal was showing no wallet. But I assumed it was an internet connection issue

ianmunge0 avatar Nov 05 '24 15:11 ianmunge0