import { encodeURL, createQR, createQROptions } from "@solana/pay";
import { PublicKey } from "@solana/web3.js";
import BigNumber from "bignumber.js";
const recipient = new PublicKey("2V4TiQYA4EdN7xrsUFHc5phvU1ozKZVHEtxbKVA8WPFv");
const amount = new BigNumber(1);
const label = "Michael";
const message = "Thanks for all the fish";
const url = encodeURL({
recipient,
amount,
label,
message,
});
const options = createQROptions(url);
const qrcode = createQR(url)
When i run the code i get this error :
webpack://QRCodeStyling/./src/core/QRSVG.ts:48
this._element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
^
ReferenceError: document is not defined
at new t (webpack://QRCodeStyling/./src/core/QRSVG.ts:48:21)
at t._setupSvg (webpack://QRCodeStyling/./src/core/QRCodeStyling.ts:37:19)
at t.update (webpack://QRCodeStyling/./src/core/QRCodeStyling.ts:109:12)
at new t (webpack://QRCodeStyling/./src/core/QRCodeStyling.ts:24:10)
I want to save the qrcode as a svg or png on my desktop using fs module can i ?