fixed js thread issue from calling ethers package

This commit is contained in:
Blake Kaufman
2025-10-23 16:42:52 +02:00
parent e79569d4eb
commit 52e99c14cd
2 changed files with 23 additions and 2 deletions
+1 -1
View File
@@ -125,7 +125,7 @@ export const RootstockSwapProvider = ({ children }) => {
);
}, []);
const createSigner = useCallback(async () => {
const createSigner = useCallback(() => {
try {
console.log('PROCESSS WALLET', new Date().getTime());
const wallet = Wallet.fromPhrase(accountMnemoinc);
+22 -1
View File
@@ -5,12 +5,33 @@ import 'react-native-gesture-handler';
import '@azure/core-asynciterator-polyfill';
//neeed for encription + spark
import 'react-native-quick-base64';
import {Buffer} from '@craftzdog/react-native-buffer';
import { Buffer } from '@craftzdog/react-native-buffer';
import { pbkdf2Sync, createHash } from 'react-native-quick-crypto';
global.Buffer = Buffer;
// import 'text-encoding-polyfill';
import 'text-encoding'; // needed for spark
//Fixing js blocking from ethers package
import { ethers } from 'ethers';
// --- Register native SHA512 implementation ---
ethers.sha512.register(data => {
return Uint8Array.from(createHash('sha512').update(data).digest());
});
// --- Register native PBKDF2 implementation ---
ethers.pbkdf2.register((password, salt, iterations, keyLen, algo) => {
const derivedKey = pbkdf2Sync(
Buffer.from(password),
Buffer.from(salt),
iterations,
keyLen,
algo.toLowerCase(),
);
return Uint8Array.from(derivedKey);
});
// Process polyfill
global.process = global.process || {};
global.process.env = global.process.env || {};