@berachain/config 0.2.8-beta.1 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/bepolia.cjs +1 -7
  2. package/dist/bepolia.d.ts +0 -4
  3. package/dist/bepolia.d.ts.map +1 -1
  4. package/dist/bepolia.mjs +1 -7
  5. package/dist/chunk-2GCBWNKH.mjs +1 -0
  6. package/dist/chunk-2OLL4MUY.cjs +1 -0
  7. package/dist/chunk-2RLHVELA.mjs +2 -0
  8. package/dist/chunk-5YLBFOPA.mjs +1 -0
  9. package/dist/chunk-6CZTBBJT.cjs +2 -0
  10. package/dist/chunk-DUO7UEQD.cjs +1 -0
  11. package/dist/chunk-HJ25KNL4.cjs +1 -0
  12. package/dist/chunk-HLFO7V5I.cjs +1 -0
  13. package/dist/chunk-ITASDGG4.cjs +1 -0
  14. package/dist/chunk-MS6UGFXI.mjs +1 -0
  15. package/dist/chunk-MW34QRNX.cjs +1 -0
  16. package/dist/chunk-N45AQAIZ.mjs +1 -0
  17. package/dist/chunk-O243TIHY.mjs +1 -0
  18. package/dist/chunk-QHBQ2EN5.mjs +1 -0
  19. package/dist/chunk-QYM6VRYU.mjs +1 -0
  20. package/dist/chunk-WMZLZQ6E.mjs +1 -0
  21. package/dist/chunk-X5MTSC5T.cjs +1 -0
  22. package/dist/chunk-YLWSSHG6.cjs +1 -0
  23. package/dist/index.cjs +1 -10
  24. package/dist/index.mjs +1 -10
  25. package/dist/internal/header-sources.cjs +13 -409
  26. package/dist/internal/header-sources.d.ts +11 -1
  27. package/dist/internal/header-sources.d.ts.map +1 -1
  28. package/dist/internal/header-sources.mjs +13 -409
  29. package/dist/internal/index.cjs +1 -37
  30. package/dist/internal/index.d.ts +0 -16
  31. package/dist/internal/index.d.ts.map +1 -1
  32. package/dist/internal/index.mjs +1 -37
  33. package/dist/internal/maintenance.cjs +1 -24
  34. package/dist/internal/maintenance.mjs +1 -24
  35. package/dist/internal/nextjs/index.cjs +1 -83
  36. package/dist/internal/nextjs/index.mjs +1 -83
  37. package/dist/internal/nextjs/utils/index.cjs +1 -40
  38. package/dist/internal/nextjs/utils/index.mjs +1 -40
  39. package/dist/internal/sentry/index.cjs +1 -10
  40. package/dist/internal/sentry/index.mjs +1 -10
  41. package/dist/internal/sentry/sentry.client.config.cjs +1 -65
  42. package/dist/internal/sentry/sentry.client.config.mjs +1 -65
  43. package/dist/internal/tailwind/index.cjs +1 -237
  44. package/dist/internal/tailwind/index.mjs +1 -237
  45. package/dist/internal/wagmi/index.cjs +1 -57
  46. package/dist/internal/wagmi/index.mjs +1 -57
  47. package/dist/mainnet.cjs +1 -8
  48. package/dist/mainnet.d.ts +0 -4
  49. package/dist/mainnet.d.ts.map +1 -1
  50. package/dist/mainnet.mjs +1 -8
  51. package/dist/sentry.edge.config-AU3IBVBN.cjs +1 -0
  52. package/dist/sentry.edge.config-PXSVFOH6.mjs +1 -0
  53. package/dist/sentry.server.config-IOCQ5KDF.cjs +1 -0
  54. package/dist/sentry.server.config-NEPRXZ2E.mjs +1 -0
  55. package/dist/types.d.ts +0 -5
  56. package/dist/types.d.ts.map +1 -1
  57. package/package.json +1 -1
  58. package/dist/chunk-6OF46MO2.mjs +0 -135
  59. package/dist/chunk-AU3LYJAB.cjs +0 -75
  60. package/dist/chunk-B2BTOQVP.cjs +0 -25
  61. package/dist/chunk-CBAAKY4N.cjs +0 -152
  62. package/dist/chunk-DEP7BIPJ.cjs +0 -151
  63. package/dist/chunk-EYYJ2UZT.cjs +0 -10
  64. package/dist/chunk-F5UIDRP6.mjs +0 -77
  65. package/dist/chunk-FEDP4MQE.cjs +0 -135
  66. package/dist/chunk-GB6ZGTAF.mjs +0 -152
  67. package/dist/chunk-KJXYSGNH.mjs +0 -10
  68. package/dist/chunk-LALEUPWL.mjs +0 -8
  69. package/dist/chunk-NF5WIUL6.cjs +0 -77
  70. package/dist/chunk-OWAB24JG.mjs +0 -25
  71. package/dist/chunk-VWRKCGMU.mjs +0 -75
  72. package/dist/chunk-XA5DMTFW.mjs +0 -75
  73. package/dist/chunk-XHPQ7VX6.mjs +0 -151
  74. package/dist/chunk-YT7WZDGI.cjs +0 -8
  75. package/dist/chunk-ZTYHPIUW.cjs +0 -75
  76. package/dist/sentry.edge.config-3Y5ABKSB.cjs +0 -22
  77. package/dist/sentry.edge.config-SIWSKDGR.mjs +0 -22
  78. package/dist/sentry.server.config-HY6I2WQ5.mjs +0 -22
  79. package/dist/sentry.server.config-ZXGUVYT6.cjs +0 -22
@@ -1,412 +1,16 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
- var _chunkB2BTOQVPcjs = require('../chunk-B2BTOQVP.cjs');
5
-
6
-
7
- var _chunkYT7WZDGIcjs = require('../chunk-YT7WZDGI.cjs');
8
-
9
-
10
- var _chunkFEDP4MQEcjs = require('../chunk-FEDP4MQE.cjs');
11
- require('../chunk-CBAAKY4N.cjs');
12
- require('../chunk-DEP7BIPJ.cjs');
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
- var _chunkAU3LYJABcjs = require('../chunk-AU3LYJAB.cjs');
22
- require('../chunk-EYYJ2UZT.cjs');
23
-
24
- // src/internal/dedupeCspSources.ts
25
- function parseSource(raw) {
26
- const schemeSplit = raw.indexOf("://");
27
- if (schemeSplit === -1) {
28
- return void 0;
29
- }
30
- const scheme = raw.slice(0, schemeSplit).toLowerCase();
31
- const rest = raw.slice(schemeSplit + 3);
32
- const pathStart = rest.indexOf("/");
33
- const host = (pathStart === -1 ? rest : rest.slice(0, pathStart)).toLowerCase();
34
- const path = pathStart === -1 ? "/" : rest.slice(pathStart);
35
- if (!host) {
36
- return void 0;
37
- }
38
- return { raw, scheme, host, path };
39
- }
40
- function hostMatches(patternHost, targetHost) {
41
- if (!patternHost.startsWith("*.")) {
42
- return patternHost === targetHost;
43
- }
44
- const suffix = patternHost.slice(1);
45
- return targetHost.endsWith(suffix) && targetHost.length > suffix.length;
46
- }
47
- function covers(pattern, target) {
48
- if (pattern.scheme !== target.scheme) {
49
- return false;
50
- }
51
- if (!hostMatches(pattern.host, target.host)) {
52
- return false;
53
- }
54
- if (pattern.path.endsWith("/")) {
55
- return target.path.startsWith(pattern.path);
56
- }
57
- return target.path === pattern.path;
58
- }
59
- function dedupeCspSources(sources) {
60
- const parsed = sources.map((raw) => ({ raw, parsed: parseSource(raw) }));
61
- return parsed.filter(({ parsed: target }, i) => {
62
- if (!target) {
63
- return true;
64
- }
65
- return !parsed.some(({ parsed: pattern }, j) => {
66
- if (i === j || !pattern) {
67
- return false;
68
- }
69
- if (!covers(pattern, target)) {
70
- return false;
71
- }
72
- if (covers(target, pattern)) {
73
- return j < i;
74
- }
75
- return true;
76
- });
77
- }).map(({ raw }) => raw);
78
- }
79
-
80
- // src/internal/sentry/getSentryKeys.ts
81
- function getSentryKeys({
82
- dsn = process.env.NEXT_PUBLIC_SENTRY_DSN
83
- } = {}) {
84
- if (!dsn) {
85
- return void 0;
86
- }
87
- const re = /^(?:https:\/\/)([A-z0-9]{32})(?::{0,1})([A-z0-9]*)(?:@)(o[a-z0-9]+)(?:\.ingest\.us\.sentry\.io)\/([0-9]{16})/i;
88
- const match = _optionalChain([dsn, 'optionalAccess', _ => _.match, 'call', _2 => _2(re)]);
89
- if (!match) {
90
- return void 0;
91
- }
92
- const [
93
- ,
94
- key,
95
- // this is a secret stored in a deprecated dns format
96
- deprecatedSecret,
97
- org,
98
- projectId
99
- ] = match;
100
- const cspEndpoint = new URL(
101
- `https://${org}.ingest.us.sentry.io/api/${projectId}/security/?sentry_key=${key}`
102
- );
103
- cspEndpoint.searchParams.set("sentry_key", key);
104
- cspEndpoint.searchParams.set("sentry_env", _chunkB2BTOQVPcjs.sentryEnvironment);
105
- cspEndpoint.searchParams.set("sentry_release", _chunkB2BTOQVPcjs.sentryRelease);
106
- return {
107
- dsn: match[0],
108
- projectId,
109
- deprecatedSecret: deprecatedSecret || void 0,
110
- cspEndpoint,
111
- org,
112
- publicKey: match[1]
113
- };
114
- }
115
-
116
- // src/internal/header-sources.ts
117
- var config = _chunkFEDP4MQEcjs.chainConfigs[_chunkAU3LYJABcjs.defaultChainId];
118
- var modules = {
119
- berachain: {
120
- connect: [
121
- "https://*.berachain.com/",
122
- // staging hosts are only reachable outside production
123
- _chunkAU3LYJABcjs.isProduction ? null : "https://*.berachain-staging.com/",
124
- "https://raw.githubusercontent.com/berachain/metadata/",
125
- `${_chunkAU3LYJABcjs.imageBaseUrl}/`,
126
- "https://*.quiknode.pro",
127
- // Subgraph queries are served by same-origin typed REST endpoints under
128
- // /api/honey/* and /api/pol/* (covered by 'self'), not direct browser
129
- // requests to the upstream URLs.
130
- config.pol.bribeBoostApi,
131
- _chunkYT7WZDGIcjs.getUriFromLink.call(void 0, config.beep),
132
- _chunkYT7WZDGIcjs.getUriFromLink.call(void 0, config.api),
133
- _chunkAU3LYJABcjs.jsonRpcUrl,
134
- _chunkAU3LYJABcjs.publicJsonRpcUrl,
135
- _chunkAU3LYJABcjs.alchemyJsonRpcUrl,
136
- "https://api.routescan.io/v2/network/"
137
- ],
138
- img: [
139
- // trailing slash so sub-paths (e.g. /bend-curators/x.png/public) match;
140
- // CSP path-matches exactly without it
141
- `${_chunkAU3LYJABcjs.imageBaseUrl}/`,
142
- "https://raw.githubusercontent.com/berachain/metadata/"
143
- ]
144
- },
145
- beranames: {
146
- connect: [
147
- // avatars
148
- "https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/"
149
- ],
150
- img: [
151
- "https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/"
152
- ]
153
- },
154
- swapAggregators: {
155
- connect: [
156
- // empty on chains without a proxy — omit rather than emit a bare "/"
157
- config.bex.aggregatorsProxyUrl ? `${config.bex.aggregatorsProxyUrl}/` : null,
158
- "https://open-api.openocean.finance/",
159
- "https://api.haiku.trade/",
160
- "https://api.fly.trade/",
161
- "https://api.enso.finance/",
162
- "https://api.enso.build/",
163
- // zaps
164
- "https://api.relay.link/"
165
- ]
166
- },
167
- walletConnect: {
168
- connect: [
169
- "wss://relay.walletconnect.com/",
170
- "wss://relay.walletconnect.org/",
171
- "https://verify.walletconnect.org/v3/public-key"
172
- ],
173
- frame: [
174
- "https://verify.walletconnect.com/",
175
- "https://verify.walletconnect.org/"
176
- ]
177
- },
178
- coinbaseWallet: {
179
- connect: [
180
- "wss://www.walletlink.org/rpc",
181
- "https://www.walletlink.org/events",
182
- "https://chain-proxy.wallet.coinbase.com/"
183
- ]
184
- },
185
- metamask: {
186
- connect: [
187
- "wss://metamask-sdk.api.cx.metamask.io/socket.io/",
188
- "https://metamask-sdk.api.cx.metamask.io"
189
- ]
190
- },
191
- thirdweb: {
192
- connect: ["https://*.thirdweb.com/"],
193
- // export pk iframe
194
- frame: ["https://embedded-wallet.thirdweb.com/"]
195
- },
196
- dynamic: {
197
- connect: ["https://app.dynamicauth.com/api"]
198
- },
199
- binance: {
200
- connect: ["https://wallet.binance.com/tonbridge/"]
201
- },
202
- tron: {
203
- connect: ["https://api.trongrid.io/"]
204
- },
205
- layerZero: {
206
- connect: [
207
- "https://*.layerzero-scan.com/",
208
- "https://scan.layerzero-api.com/"
209
- ]
210
- },
211
- pelagus: {
212
- img: ["https://pelaguswallet.io/docs/img"]
213
- },
214
- externalRpcs: {
215
- // non-Berachain chains read by wallets/bridges
216
- connect: [
217
- "https://api.avax.network/ext/bc/C/rpc",
218
- "https://polygon-rpc.com",
219
- "https://mainnet.optimism.io/",
220
- "https://arb1.arbitrum.io/rpc",
221
- "https://mainnet.base.org/",
222
- "https://eth.merkle.io"
223
- ]
224
- },
225
- tokenIcons: {
226
- img: [
227
- "https://assets.coingecko.com/coins/images/",
228
- "https://coin-images.coingecko.com/coins/images/",
229
- "https://icons.llama.fi/",
230
- "https://icons.llamao.fi/",
231
- "https://static.debank.com/",
232
- "https://raw.githubusercontent.com/trustwallet/assets/"
233
- ]
234
- },
235
- bend: {
236
- img: ["https://cdn.morpho.org/"]
237
- },
238
- pyth: {
239
- connect: ["https://hermes.pyth.network/v2/"]
240
- },
241
- fonts: {
242
- font: [
243
- "https://cdn.jsdelivr.net/npm/@fontsource/",
244
- // collected by sentry (needed by browser extensions)
245
- "https://fonts.gstatic.com",
246
- "https://use.typekit.net/"
247
- ]
248
- },
249
- sentry: {
250
- // csp reporting
251
- connect: ["https://*.sentry.io/"]
252
- },
253
- posthog: {
254
- // toolbar + heatmaps
255
- connect: ["https://*.posthog.com"],
256
- img: ["https://*.posthog.com"],
257
- frame: ["https://*.posthog.com"],
258
- font: ["https://*.posthog.com"],
259
- style: ["https://*.posthog.com"],
260
- media: ["https://*.posthog.com"]
261
- },
262
- vercel: {
263
- // toolbar + live comments
264
- connect: ["https://vercel.live", "wss://ws-us3.pusher.com"],
265
- img: ["https://vercel.live", "https://vercel.com"],
266
- frame: ["https://vercel.live/"],
267
- font: ["https://vercel.live", "https://assets.vercel.com"],
268
- style: ["https://vercel.live"]
269
- }
270
- };
271
- var headerSourceModules = modules;
272
- function getContentSecurityPolicy({
273
- isDevelopment,
274
- cspReporting,
275
- dynamicScriptCsp = {},
276
- modules: enabledModules = {},
277
- ...args
278
- }) {
279
- const defaultSrc = [];
280
- function collect(directive) {
281
- return Object.entries(headerSourceModules).filter(
282
- ([module]) => enabledModules[module] !== false
283
- ).flatMap(([, sources]) => _nullishCoalesce(sources[directive], () => ( []))).filter((url) => Boolean(_optionalChain([url, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()])));
284
- }
285
- const connectionSources = dedupeCspSources(
286
- collect("connect").concat(_nullishCoalesce(args.connectionSources, () => ( []))).filter((link) => {
287
- const url = _chunkYT7WZDGIcjs.getUriFromLink.call(void 0, link);
288
- if (!url || url.trim() === "") {
289
- return false;
290
- }
291
- if (url.startsWith(_chunkAU3LYJABcjs.goldskyBaseUrl) && url !== _chunkAU3LYJABcjs.goldskyBaseUrl) {
292
- return false;
293
- }
294
- return true;
295
- })
296
- );
297
- const pictureSources = dedupeCspSources(
298
- collect("img").concat(_nullishCoalesce(args.pictureSources, () => ( [])))
299
- );
300
- const frameSources = dedupeCspSources(
301
- collect("frame").concat(_nullishCoalesce(args.frameSources, () => ( [])))
302
- );
303
- const fontSources = dedupeCspSources(
304
- collect("font").concat(_nullishCoalesce(args.fontSources, () => ( [])))
305
- );
306
- const styleSources = dedupeCspSources(
307
- collect("style").concat(_nullishCoalesce(args.styleSources, () => ( [])))
308
- );
309
- const workerSources = dedupeCspSources(
310
- collect("worker").concat(_nullishCoalesce(args.workerSources, () => ( [])))
311
- );
312
- const mediaSources = dedupeCspSources(
313
- collect("media").concat(_nullishCoalesce(args.mediaSources, () => ( [])))
314
- );
315
- const scriptSources = dynamicScriptCsp === "disabled" ? dedupeCspSources(collect("script").concat(_nullishCoalesce(args.scriptSources, () => ( [])))) : dedupeCspSources(
316
- [
317
- dynamicScriptCsp.nonce ? `'nonce-${dynamicScriptCsp.nonce}'` : "",
318
- "'strict-dynamic'",
319
- "'sha256-k2HGvaYkGyYZxOwKGxgE1mr06tZEDcEXNZ5mdcldK0o='",
320
- ..._nullishCoalesce(dynamicScriptCsp.sha, () => ( []))
321
- ].filter((source) => source !== "")
322
- );
323
- let cspHeader = `
324
- default-src 'self' ${defaultSrc.join(" ")};
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkHLFO7V5Icjs = require('../chunk-HLFO7V5I.cjs');var _chunkDUO7UEQDcjs = require('../chunk-DUO7UEQD.cjs');var _chunkX5MTSC5Tcjs = require('../chunk-X5MTSC5T.cjs');require('../chunk-MW34QRNX.cjs');require('../chunk-HJ25KNL4.cjs');var _chunk6CZTBBJTcjs = require('../chunk-6CZTBBJT.cjs');require('../chunk-2OLL4MUY.cjs');function _(t){let e=t.indexOf("://");if(e===-1)return;let s=t.slice(0,e).toLowerCase(),o=t.slice(e+3),n=o.indexOf("/"),r=(n===-1?o:o.slice(0,n)).toLowerCase(),c=n===-1?"/":o.slice(n);if(r)return{raw:t,scheme:s,host:r,path:c}}function M(t,e){if(!t.startsWith("*."))return t===e;let s=t.slice(1);return e.endsWith(s)&&e.length>s.length}function C(t,e){return t.scheme!==e.scheme||!M(t.host,e.host)?!1:t.path.endsWith("/")?e.path.startsWith(t.path):e.path===t.path}function a(t){let e=t.map(s=>({raw:s,parsed:_(s)}));return e.filter(({parsed:s},o)=>s?!e.some(({parsed:n},r)=>o===r||!n||!C(n,s)?!1:C(s,n)?r<o:!0):!0).map(({raw:s})=>s)}function $({dsn:t=process.env.NEXT_PUBLIC_SENTRY_DSN}={}){if(!t)return;let e=/^(?:https:\/\/)([A-z0-9]{32})(?::{0,1})([A-z0-9]*)(?:@)(o[a-z0-9]+)(?:\.ingest\.us\.sentry\.io)\/([0-9]{16})/i,s=_optionalChain([t, 'optionalAccess', _2 => _2.match, 'call', _3 => _3(e)]);if(!s)return;let[,o,n,r,c]=s,p=new URL(`https://${r}.ingest.us.sentry.io/api/${c}/security/?sentry_key=${o}`);return p.searchParams.set("sentry_key",o),p.searchParams.set("sentry_env",_chunkHLFO7V5Icjs.a),p.searchParams.set("sentry_release",_chunkHLFO7V5Icjs.c),{dsn:s[0],projectId:c,deprecatedSecret:n||void 0,cspEndpoint:p,org:r,publicKey:s[1]}}var u=_chunkX5MTSC5Tcjs.a[_chunk6CZTBBJTcjs.a],z={berachain:{connect:["https://*.berachain.com/",_chunk6CZTBBJTcjs.b?null:"https://*.berachain-staging.com/","https://raw.githubusercontent.com/berachain/metadata/",`${_chunk6CZTBBJTcjs.g}/`,"https://*.quiknode.pro/",u.pol.bribeBoostApi,_chunkDUO7UEQDcjs.a.call(void 0, u.beep),_chunkDUO7UEQDcjs.a.call(void 0, u.api),_chunk6CZTBBJTcjs.k,_chunk6CZTBBJTcjs.j,_chunk6CZTBBJTcjs.l,"https://api.routescan.io/v2/network/"],img:[`${_chunk6CZTBBJTcjs.g}/`,"https://raw.githubusercontent.com/berachain/metadata/"]},beranames:{connect:["https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/"],img:["https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/"]},swapAggregators:{connect:[u.bex.aggregatorsProxyUrl?`${u.bex.aggregatorsProxyUrl}/`:null,"https://open-api.openocean.finance/","https://api.haiku.trade/","https://api.fly.trade/","https://api.enso.finance/","https://api.enso.build/","https://api.relay.link/"]},walletConnect:{connect:["wss://relay.walletconnect.com/","wss://relay.walletconnect.org/","https://verify.walletconnect.org/v3/public-key"],frame:["https://verify.walletconnect.com/","https://verify.walletconnect.org/"]},coinbaseWallet:{connect:["wss://www.walletlink.org/rpc","https://www.walletlink.org/events","https://chain-proxy.wallet.coinbase.com/"]},metamask:{connect:["wss://metamask-sdk.api.cx.metamask.io/socket.io/","https://metamask-sdk.api.cx.metamask.io"]},thirdweb:{connect:["https://*.thirdweb.com/"],frame:["https://embedded-wallet.thirdweb.com/"]},dynamic:{connect:["https://app.dynamicauth.com/api"]},binance:{connect:["https://wallet.binance.com/tonbridge/"]},tron:{connect:["https://api.trongrid.io/"]},layerZero:{connect:["https://*.layerzero-scan.com/","https://scan.layerzero-api.com/"]},pelagus:{img:["https://pelaguswallet.io/docs/img"]},externalRpcs:{connect:["https://api.avax.network/ext/bc/C/rpc","https://polygon-rpc.com","https://mainnet.optimism.io/","https://arb1.arbitrum.io/rpc","https://mainnet.base.org/","https://eth.merkle.io"]},tokenIcons:{img:["https://assets.coingecko.com/coins/images/","https://coin-images.coingecko.com/coins/images/","https://icons.llama.fi/","https://icons.llamao.fi/","https://static.debank.com/","https://raw.githubusercontent.com/trustwallet/assets/"]},bend:{img:["https://cdn.morpho.org/"]},pyth:{connect:["https://hermes.pyth.network/v2/"]},fonts:{font:["https://cdn.jsdelivr.net/npm/@fontsource/","https://fonts.gstatic.com","https://use.typekit.net/"]},sentry:{connect:["https://*.sentry.io/"]},posthog:{connect:["https://*.posthog.com"],img:["https://*.posthog.com"],frame:["https://*.posthog.com"],font:["https://*.posthog.com"],style:["https://*.posthog.com"],media:["https://*.posthog.com"]},vercel:{connect:["https://vercel.live","wss://ws-us3.pusher.com"],img:["https://vercel.live","https://vercel.com"],frame:["https://vercel.live/"],font:["https://vercel.live","https://assets.vercel.com"],style:["https://vercel.live"]}},D= exports.headerSourceModules =z;function H({isDevelopment:t,cspReporting:e,dynamicScriptCsp:s={},modules:o={},...n}){let r=[];function c(l){return Object.entries(D).filter(([i])=>o[i]!==!1).flatMap(([,i])=>_nullishCoalesce(i[l], () => ([]))).filter(i=>!!_optionalChain([i, 'optionalAccess', _4 => _4.trim, 'call', _5 => _5()]))}let p=a(c("connect").concat(_nullishCoalesce(n.connectionSources, () => ([]))).filter(l=>{let i=_chunkDUO7UEQDcjs.a.call(void 0, l);return!(!i||i.trim()===""||i.startsWith(_chunk6CZTBBJTcjs.h)&&i!==_chunk6CZTBBJTcjs.h)})),R=a(c("img").concat(_nullishCoalesce(n.pictureSources, () => ([])))),P=a(c("frame").concat(_nullishCoalesce(n.frameSources, () => ([])))),E=a(c("font").concat(_nullishCoalesce(n.fontSources, () => ([])))),N=a(c("style").concat(_nullishCoalesce(n.styleSources, () => ([])))),j=a(c("worker").concat(_nullishCoalesce(n.workerSources, () => ([])))),O=a(c("media").concat(_nullishCoalesce(n.mediaSources, () => ([])))),U=s==="disabled"?a(c("script").concat(_nullishCoalesce(n.scriptSources, () => ([])))):a([s.nonce?`'nonce-${s.nonce}'`:"","'strict-dynamic'","'sha256-k2HGvaYkGyYZxOwKGxgE1mr06tZEDcEXNZ5mdcldK0o='",..._nullishCoalesce(s.sha, () => ([]))].filter(l=>l!=="")),f=`
2
+ default-src 'self' ${r.join(" ")};
325
3
  base-uri 'self';
326
- frame-src 'self' ${frameSources.join(" ")};
4
+ frame-src 'self' ${P.join(" ")};
327
5
  frame-ancestors 'self' https://*.posthog.com;
328
- script-src 'self' ${scriptSources.concat([isDevelopment ? "'unsafe-eval'" : ""]).join(" ")};
329
- worker-src 'self' blob: data: ${workerSources.join(" ")};
330
- font-src 'self' ${fontSources.join(" ")};
331
- style-src 'self' ${styleSources.join(" ")} 'unsafe-inline';
332
- img-src 'self' data: ${pictureSources.join(" ")};
333
- connect-src 'self' ${connectionSources.join(" ")};
334
- media-src 'self' ${mediaSources.join(" ")};
335
- `;
336
- if (cspReporting) {
337
- cspHeader += `
338
- report-uri ${cspReporting};
6
+ script-src 'self' ${U.concat([t?"'unsafe-eval'":""]).join(" ")};
7
+ worker-src 'self' blob: data: ${j.join(" ")};
8
+ font-src 'self' ${E.join(" ")};
9
+ style-src 'self' ${N.join(" ")} 'unsafe-inline';
10
+ img-src 'self' data: ${R.join(" ")};
11
+ connect-src 'self' ${p.join(" ")};
12
+ media-src 'self' ${O.join(" ")};
13
+ `;return e&&(f+=`
14
+ report-uri ${e};
339
15
  report-to csp-endpoint;
340
- `;
341
- }
342
- return cspHeader.replace(/\s{2,}/g, " ").trim();
343
- }
344
- var staticPictureSources = [
345
- // Only add image delivery URL if it exists and can be processed
346
- `${_chunkAU3LYJABcjs.imageBaseUrl}/`,
347
- "https://raw.githubusercontent.com/berachain/metadata/",
348
- "https://assets.coingecko.com/coins/images/",
349
- "https://berachain.ghost.io/content/images/"
350
- ].filter((url) => {
351
- if (!url || url.trim() === "") {
352
- return false;
353
- }
354
- return true;
355
- });
356
- function cspMiddleware({
357
- response,
358
- csp
359
- }) {
360
- const sentryCspEndpoint = _optionalChain([getSentryKeys, 'call', _5 => _5(), 'optionalAccess', _6 => _6.cspEndpoint]);
361
- const nonce = _optionalChain([csp, 'optionalAccess', _7 => _7.dynamicScriptCsp]) !== "disabled" ? _nullishCoalesce(_optionalChain([csp, 'optionalAccess', _8 => _8.dynamicScriptCsp, 'optionalAccess', _9 => _9.nonce]), () => ( Buffer.from(crypto.randomUUID()).toString("base64"))) : void 0;
362
- const isDevelopment = process.env.NODE_ENV === "development";
363
- const headers = [
364
- {
365
- key: "Content-Security-Policy",
366
- value: getContentSecurityPolicy({
367
- ...csp,
368
- dynamicScriptCsp: _optionalChain([csp, 'optionalAccess', _10 => _10.dynamicScriptCsp]) === "disabled" ? csp.dynamicScriptCsp : {
369
- ..._optionalChain([csp, 'optionalAccess', _11 => _11.dynamicScriptCsp]),
370
- nonce
371
- },
372
- isDevelopment,
373
- cspReporting: _optionalChain([sentryCspEndpoint, 'optionalAccess', _12 => _12.toString, 'call', _13 => _13()])
374
- })
375
- },
376
- {
377
- key: "X-Frame-Options",
378
- value: "DENY"
379
- },
380
- {
381
- key: "X-Content-Type-Options",
382
- value: "nosniff"
383
- },
384
- {
385
- key: "X-Nonce",
386
- value: nonce
387
- }
388
- ];
389
- if (sentryCspEndpoint) {
390
- headers.push({
391
- key: "Reporting-To",
392
- value: `{"group":"csp-endpoint","max_age":10886400,"endpoints":[{"url":"${sentryCspEndpoint}"}],"include_subdomains":true}"`
393
- });
394
- headers.push({
395
- key: "Reporting-Endpoints",
396
- value: `csp-endpoint="${sentryCspEndpoint}"`
397
- });
398
- }
399
- for (const header of headers) {
400
- if (!header.value) {
401
- continue;
402
- }
403
- response.headers.set(header.key, header.value);
404
- }
405
- return response;
406
- }
407
-
408
-
409
-
410
-
411
-
412
- exports.cspMiddleware = cspMiddleware; exports.getContentSecurityPolicy = getContentSecurityPolicy; exports.headerSourceModules = headerSourceModules; exports.staticPictureSources = staticPictureSources;
16
+ `),f.replace(/\s{2,}/g," ").trim()}var Z=[`${_chunk6CZTBBJTcjs.g}/`,"https://raw.githubusercontent.com/berachain/metadata/","https://assets.coingecko.com/coins/images/","https://berachain.ghost.io/content/images/"].filter(t=>!(!t||t.trim()===""));function G({response:t,csp:e}){let s=_optionalChain([e, 'optionalAccess', _6 => _6.dynamicScriptCsp])!=="disabled"?_nullishCoalesce(_optionalChain([e, 'optionalAccess', _7 => _7.dynamicScriptCsp, 'optionalAccess', _8 => _8.nonce]), () => (Buffer.from(crypto.randomUUID()).toString("base64"))):void 0,o=B({...e,dynamicScriptCsp:_optionalChain([e, 'optionalAccess', _9 => _9.dynamicScriptCsp])==="disabled"?e.dynamicScriptCsp:{..._optionalChain([e, 'optionalAccess', _10 => _10.dynamicScriptCsp]),nonce:s}});for(let n of o)n.value&&t.headers.set(n.key,n.value);return t}function B(t){let e=_optionalChain([$, 'call', _11 => _11(), 'optionalAccess', _12 => _12.cspEndpoint]),s=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _13 => _13.dynamicScriptCsp]), () => ("disabled")),o=s==="disabled"?void 0:s.nonce,n=process.env.NODE_ENV==="development",r=[{key:"Content-Security-Policy",value:H({...t,dynamicScriptCsp:s,isDevelopment:n,cspReporting:_optionalChain([e, 'optionalAccess', _14 => _14.toString, 'call', _15 => _15()])})},{key:"X-Frame-Options",value:"DENY"},{key:"X-Content-Type-Options",value:"nosniff"}];return o&&r.push({key:"X-Nonce",value:o}),e&&(r.push({key:"Report-To",value:JSON.stringify({group:"csp-endpoint",max_age:10886400,endpoints:[{url:e}],include_subdomains:!0})}),r.push({key:"Reporting-Endpoints",value:`csp-endpoint="${e}"`})),r}exports.cspHeaders = B; exports.cspMiddleware = G; exports.getContentSecurityPolicy = H; exports.headerSourceModules = D; exports.staticPictureSources = Z;
@@ -24,7 +24,7 @@ interface HeaderSources {
24
24
  }
25
25
  declare const modules: {
26
26
  readonly berachain: {
27
- readonly connect: ["https://*.berachain.com/", "https://*.berachain-staging.com/" | null, "https://raw.githubusercontent.com/berachain/metadata/", "https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/", "https://*.quiknode.pro", string | null, string, string, string, string, string | undefined, "https://api.routescan.io/v2/network/"];
27
+ readonly connect: ["https://*.berachain.com/", "https://*.berachain-staging.com/" | null, "https://raw.githubusercontent.com/berachain/metadata/", "https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/", "https://*.quiknode.pro/", string | null, string, string, string, string, string | undefined, "https://api.routescan.io/v2/network/"];
28
28
  readonly img: ["https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/", "https://raw.githubusercontent.com/berachain/metadata/"];
29
29
  };
30
30
  readonly beranames: {
@@ -145,5 +145,15 @@ export declare function cspMiddleware({ response, csp, }: {
145
145
  /** per-request CSP customization — toggle modules off and/or append extra sources per directive */
146
146
  csp?: CspOptions;
147
147
  }): NextResponse<unknown>;
148
+ /**
149
+ * Builds static security headers. Dynamic script CSP is disabled by default;
150
+ * callers must provide their own nonce to opt into a nonce-based policy.
151
+ */
152
+ export declare function cspHeaders(
153
+ /** static CSP customization — toggle modules off and/or append extra sources per directive */
154
+ csp?: CspOptions): {
155
+ key: string;
156
+ value: string;
157
+ }[];
148
158
  export {};
149
159
  //# sourceMappingURL=header-sources.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"header-sources.d.ts","sourceRoot":"","sources":["../../src/internal/header-sources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAiB7D;;;;GAIG;AACH,UAAU,aAAa;IACrB,kBAAkB;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,S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