diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 109a1773f..26059eb44 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -861,9 +861,9 @@ SPEC CHECKSUMS: FBLazyVector: f1897022b53abf1469d6ad692ee2c69f57d967f3 FBReactNativeSpec: 627fd07f1b9d498c9fa572e76d7f1a6b1ee9a444 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 791fe035093b84822da7f0870421a25839ca7870 + glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b helium-react-native-sdk: 32c0a7e3abc733a7f3d291013b2db31475fc6980 - hermes-engine: 7a53ccac09146018a08239c5425625fdb79a6162 + hermes-engine: 0784cadad14b011580615c496f77e0ae112eed75 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 MapboxCommon: fdf7fd31c90b7b607cd9c63e37797f023c01d860 MapboxCoreMaps: 24270c7c6b8cb71819fc2f3c549db9620ee4d019 @@ -871,7 +871,7 @@ SPEC CHECKSUMS: MapboxMobileEvents: de50b3a4de180dd129c326e09cd12c8adaaa46d6 MultiplatformBleAdapter: 5a6a897b006764392f9cef785e4360f54fb9477d OneSignalXCFramework: 81ceac017a290f23793443323090cfbe888f74ea - RCT-Folly: 85766c3226c7ec638f05ad7cb3cf6a268d6c4241 + RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 RCTRequired: bd6045fbd511da5efe6db89eecb21e4e36bd7cbf RCTTypeSafety: c06d9f906faa69dd1c88223204c3a24767725fd8 React: b9ea33557ef1372af247f95d110fbdea114ed3b2 diff --git a/patches/@noble+curves+1.0.0.patch b/patches/@noble+curves+1.0.0.patch deleted file mode 100644 index f417d7a85..000000000 --- a/patches/@noble+curves+1.0.0.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff --git a/node_modules/@noble/curves/abstract/edwards.js b/node_modules/@noble/curves/abstract/edwards.js -index 12dcbc7..107b530 100644 ---- a/node_modules/@noble/curves/abstract/edwards.js -+++ b/node_modules/@noble/curves/abstract/edwards.js -@@ -7,6 +7,12 @@ const modular_js_1 = require("./modular.js"); - const ut = require("./utils.js"); - const utils_js_1 = require("./utils.js"); - const curve_js_1 = require("./curve.js"); -+ -+type BigIntOpInputs = number | bigint; -+const BigIntPow = (a: BigIntOpInputs, b: BigIntOpInputs) => { -+ return BigInt(eval(a + 'n ** ' + b + 'n')); -+} -+ - // Be friendly to bad ECMAScript parsers by not using bigint literals - // prettier-ignore - const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _8n = BigInt(8); -@@ -32,7 +38,7 @@ function validateOpts(curve) { - function twistedEdwards(curveDef) { - const CURVE = validateOpts(curveDef); - const { Fp, n: CURVE_ORDER, prehash: prehash, hash: cHash, randomBytes, nByteLength, h: cofactor, } = CURVE; -- const MASK = _2n ** BigInt(nByteLength * 8); -+ const MASK = BigIntPow(_2n, BigInt(nByteLength * 8)); - const modP = Fp.create; // Function overrides - // sqrt(u/v) - const uvRatio = CURVE.uvRatio || -diff --git a/node_modules/@noble/curves/abstract/weierstrass.js b/node_modules/@noble/curves/abstract/weierstrass.js -index 11833de..ca0f1a3 100644 ---- a/node_modules/@noble/curves/abstract/weierstrass.js -+++ b/node_modules/@noble/curves/abstract/weierstrass.js -@@ -2,6 +2,12 @@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.mapToCurveSimpleSWU = exports.SWUFpSqrtRatio = exports.weierstrass = exports.weierstrassPoints = exports.DER = void 0; - /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -+ -+type BigIntOpInputs = number | bigint; -+const BigIntPow = (a: BigIntOpInputs, b: BigIntOpInputs) => { -+ return BigInt(eval(a + 'n ** ' + b + 'n')); -+} -+ - // Short Weierstrass curve. The formula is: y² = x³ + ax + b - const mod = require("./modular.js"); - const ut = require("./utils.js"); -@@ -942,10 +948,10 @@ function SWUFpSqrtRatio(Fp, Z) { - for (let o = q - _1n; o % _2n === _0n; o /= _2n) - l += _1n; - const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1. -- const c2 = (q - _1n) / _2n ** c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic -+ const c2 = BigIntPow((q - _1n) / _2n, c1); // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic - const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic -- const c4 = _2n ** c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic -- const c5 = _2n ** (c1 - _1n); // 5. c5 = 2^(c1 - 1) # Integer arithmetic -+ const c4 = BigIntPow(_2n, c1 - _1n); // 4. c4 = 2^c1 - 1 # Integer arithmetic -+ const c5 = BigIntPow(_2n, (c1 - _1n)); // 5. c5 = 2^(c1 - 1) # Integer arithmetic - const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2 - const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2) - let sqrtRatio = (u, v) => { diff --git a/src/features/swaps/SwapScreen.tsx b/src/features/swaps/SwapScreen.tsx index 9f40e11f3..694c11164 100644 --- a/src/features/swaps/SwapScreen.tsx +++ b/src/features/swaps/SwapScreen.tsx @@ -119,16 +119,19 @@ const SwapScreen = () => { [visibleTokens, routeMap], ) - const validOutputMints = useMemo( - () => + const validOutputMints = useMemo(() => { + const routeMints = routeMap .get(inputMint?.toBase58() || '') ?.filter( (key) => visibleTokens.has(key) && !inputMint.equals(new PublicKey(key)), - ) || [], - [visibleTokens, routeMap, inputMint], - ) + ) || [] + + return inputMint.equals(HNT_MINT) + ? [DC_MINT.toBase58(), ...routeMints] + : routeMints + }, [visibleTokens, routeMap, inputMint]) const handleRecipientClick = useCallback(() => { LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut) @@ -161,7 +164,7 @@ const SwapScreen = () => { return ( !inputMint.equals(HNT_MINT) && - !(routes?.outAmount && Number(routes?.outAmount) > 0) && + !(routes?.outAmount && new BN(routes?.outAmount || 0).gt(new BN(0))) && inputAmount > 0 ) }, [hntBalance, inputAmount, inputMint, routes]) @@ -254,7 +257,7 @@ const SwapScreen = () => { !outputMint.equals(DC_MINT) ) { await getRoute({ - amount: toBN(inputAmount, inputMintDecimals).toNumber(), + amount: toBN(inputAmount || 0, inputMintDecimals).toNumber(), inputMint: inputMint.toBase58(), outputMint: outputMint.toBase58(), slippageBps,