```\nmodule.exports.onRpcRequest = async ({ origin, request }) => {\n if (\n !origin ||\n (\n !origin.match(/^https?:\/\/localhost:[0-9]{1,4}$/) &&\n !origin.match(/^https?:\/\/(?:\S+\.)?solflare\.com$/) &&\n !origin.match(/^https?:\/\/(?:\S+\.)?solflare\.dev$/)\n )\n ) {\n throw new Error('Invalid origin');\n }\n```\n