polkadot-js / api

Promise and RxJS APIs around Polkadot and Substrate based chains via RPC calls. It is dynamically generated based on what the Substrate runtime provides in terms of metadata.
Apache License 2.0
1.06k stars 349 forks source link

Error when archive app with @polkadot/api: 10.9.1 #5689

Closed Hiraki99 closed 9 months ago

Hiraki99 commented 1 year ago

I update @polkadot/api with lastest version to use lastest metadata of pokadot chain. On mode "debug", lib work very well, But when I archive app to publish store, I got error node_modules/@polkadot/api/cjs/promise/Combinator.js: Unexpected token: operator (=) in file node_modules/@polkadot/api/cjs/promise/Combinator.js at 48:39.

My package.json { "name": "bhonetworkmobile", "version": "0.0.1", "private": true, "dependencies": { "@bholdus/api-options": "^0.8.0", "@connext/nxtp-sdk": "0.1.36", "@emurgo/cip14-js": "^3.0.1", "@emurgo/react-native-haskell-shelley": "3.1.4", "@emurgo/yoroi-lib-mobile": "^0.9.3-alpha.55", "@ethersproject/shims": "^5.5.0", "@kyberswap/aggregator-sdk": "^0.1.22", "@metaplex-foundation/js": "^0.17.1", "@notifee/react-native": "^4.1.0", "@polkadot/api": "10.9.1", "@polkadot/util-crypto": "12.3.2", "@polkadot/wasm-crypto": "5.1.1", "@project-serum/serum": "^0.13.65", "@react-native-clipboard/clipboard": "^1.8.5", "@react-native-community/async-storage": "^1.12.1", "@react-native-community/blur": "^4.2.0", "@react-native-community/netinfo": "^9.3.4", "@react-native-community/slider": "^4.3.2", "@react-native-firebase/app": "^14.4.0", "@react-native-firebase/messaging": "^14.4.0", "@react-navigation/bottom-tabs": "^6.0.9", "@react-navigation/native": "^6.0.6", "@react-navigation/native-stack": "^6.6.2", "@sentry/react-native": "^3.3.5", "@solana/spl-token": "^0.3.6", "@solana/web3.js": "^1.69.0", "@tradle/react-native-http": "^2.0.1", "@types/big.js": "^6.1.3", "@types/elliptic": "^6.4.14", "@types/lodash": "^4.14.178", "@types/lodash.memoize": "^4.1.6", "@types/moment": "^2.13.0", "@types/react-redux": "^7.1.21", "@types/redux-saga": "^0.10.5", "@walletconnect/client": "1.8.0", "@walletconnect/legacy-utils": "^2.0.0-rc.0", "@walletconnect/react-native-compat": "^2.1.3", "@walletconnect/sign-client": "^2.1.3", "@walletconnect/utils": "^2.1.3", "apisauce": "^2.1.5", "asyncstorage-down": "^4.2.0", "base-64": "^1.0.0", "big-integer": "^1.6.51", "big.js": "^6.1.1", "bip39": "2.6.0", "browserify-zlib": "^0.1.4", "bs58": "^5.0.0", "buffer": "^4.9.2", "crypto-js": "^4.1.1", "dns.js": "^1.0.1", "ed25519-hd-key": "^1.3.0", "elliptic": "^6.5.4", "eth-sig-util": "^3.0.1", "ethereumjs-util": "^7.1.5", "ethereumjs-wallet": "^1.0.2", "ethers": "5.6.1", "events": "3.3.0", "fast-text-encoding": "1.0.4", "https-browserify": "^0.0.1", "i18next": "^21.6.5", "instabug-reactnative": "^10.13.0", "lodash": "^4.17.21", "lodash.memoize": "^4.1.2", "lottie-ios": "3.2.3", "lottie-react-native": "^5.1.2", "mixpanel-react-native": "^1.4.1", "moment": "^2.29.4", "node-libs-browser": "^2.2.1", "patch-package": "^6.4.7", "path-browserify": "^0.0.0", "punycode": "^1.4.1", "qs": "^6.11.0", "random-words": "^1.1.1", "react": "17.0.2", "react-i18next": "^11.15.3", "react-native": "0.67.5", "react-native-autocomplete-input": "^5.0.2", "react-native-awesome-pin": "^1.3.2", "react-native-biometrics": "^2.2.2", "react-native-camera": "3.36.0", "react-native-change-icon": "^4.0.0", "react-native-chart-kit": "^6.12.0", "react-native-check-version": "^1.0.17", "react-native-code-push": "^7.0.4", "react-native-config": "^1.4.5", "react-native-countdown-component": "^2.7.1", "react-native-crypto": "^2.2.0", "react-native-device-info": "^8.4.8", "react-native-fast-image": "^8.5.11", "react-native-flash-message": "^0.2.1", "react-native-fs": "^2.18.0", "react-native-gesture-handler": "^2.1.1", "react-native-get-random-values": "^1.7.2", "react-native-image-crop-picker": "^0.37.3", "react-native-keep-awake": "^4.0.0", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-keychain": "^8.0.0", "react-native-level-fs": "^3.0.1", "react-native-linear-gradient": "^2.5.6", "react-native-localize": "^2.2.2", "react-native-minimizer": "1.3.3", "react-native-modal": "^13.0.0", "react-native-os": "^1.2.6", "react-native-pager-view": "^5.4.9", "react-native-permissions": "^3.2.0", "react-native-popover-view": "^4.1.0", "react-native-progress": "^5.0.0", "react-native-qrcode-scanner": "^1.5.4", "react-native-qrcode-svg": "^6.1.2", "react-native-quick-base64": "^2.0.5", "react-native-quick-crypto": "^0.5.0", "react-native-randombytes": "^3.6.1", "react-native-reanimated": "^2.4.1", "react-native-restart": "^0.0.24", "react-native-safe-area-context": "^3.3.2", "react-native-screen-capture-secure": "^1.0.5", "react-native-screens": "^3.10.1", "react-native-scrollable-tab-view": "^1.0.0", "react-native-scrypt": "^1.2.1", "react-native-share": "^7.3.6", "react-native-splash-screen": "^3.3.0", "react-native-status-bar-height": "^2.6.0", "react-native-svg": "^12.1.1", "react-native-swiper": "^1.6.0", "react-native-system-navigation-bar": "^1.0.4", "react-native-tab-view": "^3.1.1", "react-native-tcp": "^3.3.2", "react-native-toast-message": "^2.1.5", "react-native-udp": "^2.7.0", "react-native-url-polyfill": "^1.3.0", "react-native-vector-icons": "^9.0.0", "react-native-video": "^5.2.1", "react-native-view-shot": "^3.1.2", "react-native-webview": "^11.17.0", "react-redux": "^7.2.6", "readable-stream": "^1.0.33", "redux": "^4.1.2", "redux-persist": "^6.0.0", "redux-saga": "^1.1.3", "reselect": "^4.1.5", "rn-qr-generator": "^1.2.0", "slip44": "^1.2.22", "stream-browserify": "^1.0.0", "string_decoder": "^0.10.31", "styled-components": "^5.3.3", "timers-browserify": "^1.4.2", "tweetnacl": "^1.0.3", "url": "^0.10.3", "util": "^0.10.4", "vm-browserify": "^0.0.4" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/plugin-syntax-bigint": "^7.8.3", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "@typechain/ethers-v5": "^10.2.0", "@types/bip39": "^3.0.0", "@types/jest": "^26.0.23", "@types/react-native": "^0.66.15", "@types/react-native-autocomplete-input": "^5.0.0", "@types/react-native-vector-icons": "^6.4.10", "@types/react-native-video": "^5.0.14", "@types/react-test-renderer": "^17.0.1", "@types/scryptsy": "^2.0.0", "@types/styled-components": "^5.1.19", "@types/styled-components-react-native": "^5.1.3", "@typescript-eslint/eslint-plugin": "^5.7.0", "@typescript-eslint/parser": "^5.7.0", "@walletconnect/legacy-types": "^2.0.0-rc.0", "@walletconnect/types": "^2.1.0", "appcenter-cli": "^2.10.10", "babel-cli": "^6.26.0", "babel-jest": "^26.6.3", "babel-plugin-module-resolver": "^4.1.0", "babel-plugin-transform-remove-console": "^6.9.4", "babel-preset-es2015": "^6.24.1", "detox": "19.4.1", "eslint": "^7.14.0", "eslint-config-airbnb-typescript": "^16.1.0", "eslint-config-prettier": "^8.3.0", "eslint-import-resolver-babel-module": "^5.3.1", "eslint-import-resolver-typescript": "^2.5.0", "eslint-plugin-import": "^2.25.4", "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-react": "^7.28.0", "eslint-plugin-react-native": "^4.0.0", "jest": "^26.6.3", "jest-allure": "^0.1.3", "jest-circus": "^27.5.1", "metro-react-native-babel-preset": "^0.66.2", "mocha": "^9.2.2", "prettier": "^2.5.1", "react-native-flipper-performance-plugin": "^0.3.1", "react-test-renderer": "17.0.2", "rn-nodeify": "^10.3.0", "typechain": "^8.1.1", "typescript": "^4.4.4" }, "resolutions": { "@types/react": "^17", "@polkadot/util-crypto": "12.3.2", "@polkadot/wasm-crypto": "^5.1.1" }, "jest": { "preset": "react-native", "moduleFileExtensions": [ "ts", "tsx", "js", "jsx", "json", "node" ] }, "detox": { "testRunner": "jest", "runnerConfig": "e2e/config.json", "skipLegacyWorkersInjection": false, "behavior": { "init": { "exposeGlobals": true }, "cleanup": { "shutdownDevice": false } }, "artifacts": { "plugins": { "log": "all", "screenshot": { "shouldTakeAutomaticSnapshots": true, "takeWhen": {} }, "timeline": "all", "uiHierarchy": "enabled" } }, "devices": { "simulator": { "type": "ios.simulator", "device": { "type": "iPhone 12 Pro Max" } }, "emulator": { "type": "android.emulator", "device": { "avdName": "Pixel_2_API_32" } } }, "apps": { "ios.release": { "name": "3S Wallet", "type": "ios.app", "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/BHOWallet.app", "build": "xcodebuild -workspace ios/BHOWallet.xcworkspace -scheme BHOWalletRelease -sdk iphonesimulator -derivedDataPath ios/build clean build" }, "ios.debug": { "name": "3S Wallet", "type": "ios.app", "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/BHOWallet.app", "build": "xcodebuild -workspace ios/BHOWallet.xcworkspace -scheme BHOWallet -sdk iphonesimulator -derivedDataPath ios/build clean build" }, "android.debug": { "type": "android.apk", "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk", "build": "cd android && ./gradlew clean && ./gradlew :app:assembleDebug assembleAndroidTest -DtestBuildType=debug && cd .." }, "android.release": { "type": "android.apk", "binaryPath": "android/app/build/outputs/apk/release/app-release.apk", "build": "cd android && ./gradlew clean && ./gradlew :app:assembleRelease assembleAndroidTest -DtestBuildType=release && cd .." } }, "configurations": { "ios.sim.release": { "device": "simulator", "app": "ios.release" }, "ios.sim.debug": { "device": "simulator", "app": "ios.debug" }, "android.emu.debug": { "device": "emulator", "app": "android.debug" }, "android.emu.release": { "device": "emulator", "app": "android.release" } } }, "react-native": { "zlib": "browserify-zlib", "console": "console-browserify", "constants": "constants-browserify", "crypto": "react-native-crypto", "dns": "dns.js", "net": "react-native-tcp", "domain": "domain-browser", "http": "@tradle/react-native-http", "https": "https-browserify", "os": "react-native-os", "path": "path-browserify", "querystring": "querystring-es3", "fs": "react-native-level-fs", "_stream_transform": "readable-stream/transform", "_stream_readable": "readable-stream/readable", "_stream_writable": "readable-stream/writable", "_stream_duplex": "readable-stream/duplex", "_stream_passthrough": "readable-stream/passthrough", "dgram": "react-native-udp", "stream": "stream-browserify", "timers": "timers-browserify", "tty": "tty-browserify", "vm": "vm-browserify", "tls": false }, "browser": { "zlib": "browserify-zlib", "console": "console-browserify", "constants": "constants-browserify", "crypto": "react-native-crypto", "dns": "dns.js", "net": "react-native-tcp", "domain": "domain-browser", "http": "@tradle/react-native-http", "https": "https-browserify", "os": "react-native-os", "path": "path-browserify", "querystring": "querystring-es3", "fs": "react-native-level-fs", "_stream_transform": "readable-stream/transform", "_stream_readable": "readable-stream/readable", "_stream_writable": "readable-stream/writable", "_stream_duplex": "readable-stream/duplex", "_stream_passthrough": "readable-stream/passthrough", "dgram": "react-native-udp", "stream": "stream-browserify", "timers": "timers-browserify", "tty": "tty-browserify", "vm": "vm-browserify", "tls": false } } Please re-check and resolve this bug, thanks

jacogr commented 1 year ago

This is quite possibly caused by this line - https://github.com/polkadot-js/api/blob/47df39e02d81dd088bf762ed7a3a62c37a91e5f0/packages/api/src/promise/Combinator.ts#L43

Which compiles to

this.__internal__allHasFired ||= this.__internal__fired.filter((hasFired) => !hasFired).length === 0;

In the actual output. This is all valid JS syntax, i.e. the TypeScript compiler output is correct for the target.

If I would hazard a guess it is that your rather environment doesn't support the JavaScript logical or assignment. So depending on your options, you probably need to compile constructs like that down, i.e. for using Babel.

TL;DR Completely valid JS syntax, as outputted by the TypeScript compiler.

jacogr commented 1 year ago

Here is the RN issue for supporting ||= also including a comment around how to add support to your environment - https://github.com/facebook/react-native/issues/31704

polkadot-js-bot commented 9 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.