safe-core-sdk
safe-core-sdk copied to clipboard
Cannot propose transaction in browser environment
Description
I am running into an issue where I cannot propose a transaction through the safe-core-sdk and safe-service-client when running this code in our react application in the browser.
I am constructing a multisig transaction with the relevant libraries following this guide
When it comes to calling proposeTransaction
my application will throw with error createKeccakHash is not a function
.
Environment
- Safe Core SDK version: ^3.2.0
- Safe contract version: ?
- Environment:
- browser
Steps to reproduce
Following the stack trace, this comes from the following:
-
SafeServiceClient.proposeTransaction
calls a methodgetEip3770Address
which callsvalidateEip3770Address
from the safe-core-sdk-utils which then callsvalidateEthereumAddress
which uses the package web3-utilsisAddress
method which has a dependency on node cryptography libraries which do not exist in the browser.
To get around this problem temporarily, I have patched the library to bypass the validation here and the proposal is able to go through.
I have not found a way to polyfil this and get this to work in the browser without patching. I am using webpack as my bundler.
Expected result
To be able to propose and execute a transaction using safe-core-sdk libraries in react/browser code.