-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffer is not defined #40
Comments
I having this same problem. Edit: I found a workaround, use siwe package on the server. The problem is due to this: remix-run/remix#2248 (comment) I followed that maintainer's suggestion and took this advice: https://remix.run/docs/en/1.15.0/pages/gotchas Here's how it looks:
export * from "siwe";
import { SiweMessage } from "~/utils/siwe.server";
export const action: ActionFunction = async ({ request, context }) => {
const formData = await request.formData();
const address = formData.get("address") as string;
const statement = formData.get("statement") as string;
try {
const siweOptions = {
domain: "localhost:4000",
address,
statement,
uri: "https://localhost:4000/",
version: "1",
chainId: 1,
};
const message = new SiweMessage(siweOptions);
...
} catch (error) {
console.log({ error });
} |
@coindegen I don't think it's a valid option because we need to create |
I agree it's not ideal. To get around that I'm just going back-and forth with the server: const actionData = useActionData<typeof action>();
useEffect(() => {
(async function getSignature() {
if (!actionData?.message || !provider) {
return;
}
const signer = provider?.getSigner();
const signature = await signer.signMessage(actionData.message);
...
})();
}, [actionData?.message]); Other alternative is to
But obviously that's super messy. |
I tried to use your lib but I faced a problem in browser: seems like the
Buffer
code leaked to client build.The text was updated successfully, but these errors were encountered: