Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@
"appium-adb": "^9.11.4",
"asyncstorage-down": "4.2.0",
"axios": "^1.8.2",
"base-64": "1.0.0",
"bignumber.js": "^9.0.1",
"bitcoin-address-validation": "2.2.3",
"bnjs4": "npm:bn.js@^4.12.0",
Expand Down
13 changes: 3 additions & 10 deletions shim.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable import/no-nodejs-modules */
import { Platform } from 'react-native';
import { decode, encode } from 'base-64';
import { getRandomValues, randomUUID } from 'react-native-quick-crypto';
import { LaunchArguments } from 'react-native-launch-arguments';
import {
Expand Down Expand Up @@ -54,14 +53,6 @@ if (isTest) {
: FIXTURE_SERVER_PORT;
}

if (!global.btoa) {
global.btoa = encode;
}

if (!global.atob) {
global.atob = decode;
}

// Fix for https://github.com/facebook/react-native/issues/5667
if (typeof global.self === 'undefined') {
global.self = global;
Expand All @@ -82,6 +73,9 @@ if (typeof process === 'undefined') {
}
}

// Use faster Buffer implementation for React Native
global.Buffer = require('@craftzdog/react-native-buffer').Buffer; // eslint-disable-line import/no-commonjs

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Base64 Encoding/Decoding Functions Missing

Removing the base-64 import also removed the global.btoa and global.atob polyfills. Since React Native environments typically don't provide these browser APIs natively, btoa and atob are now undefined. This causes runtime errors for code relying on these global functions for base64 encoding/decoding.

Fix in Cursor Fix in Web

// Polyfill crypto after process is polyfilled
const crypto = require('crypto'); // eslint-disable-line import/no-commonjs

Expand All @@ -94,7 +88,6 @@ global.crypto = {
};

process.browser = false;
if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer;

// EventTarget polyfills for Hyperliquid SDK WebSocket support
if (
Expand Down
8 changes: 0 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21585,13 +21585,6 @@ __metadata:
languageName: node
linkType: hard

"base-64@npm:1.0.0":
version: 1.0.0
resolution: "base-64@npm:1.0.0"
checksum: d10b64a1fc9b2c5a5f39f1ce1e6c9d1c5b249222bbfa3a0604c592d90623caf74419983feadd8a170f27dc0c3389704f72faafa3e645aeb56bfc030c93ff074a
languageName: node
linkType: hard

"base-x@npm:^1.1.0, base-x@npm:^3.0.2, base-x@npm:^3.0.8":
version: 3.0.11
resolution: "base-x@npm:3.0.11"
Expand Down Expand Up @@ -34260,7 +34253,6 @@ __metadata:
babel-plugin-react-compiler: ^19.1.0-rc.2
babel-plugin-transform-inline-environment-variables: ^0.4.4
babel-plugin-transform-remove-console: 6.9.4
base-64: 1.0.0
base64-js: ^1.5.1
bignumber.js: ^9.0.1
bitcoin-address-validation: 2.2.3
Expand Down
Loading