@@ -105,16 +105,20 @@ function Network(options: {
105105 archive ?: string | string [ ] ;
106106 lightnetAccountManager ?: string ;
107107 bypassTransactionLimits ?: boolean ;
108+ minaDefaultHeaders ?: HeadersInit ;
109+ archiveDefaultHeaders ?: HeadersInit ;
108110} ) : Mina ;
109111function Network (
110112 options :
111113 | {
112- networkId ?: NetworkId ;
113- mina : string | string [ ] ;
114- archive ?: string | string [ ] ;
115- lightnetAccountManager ?: string ;
116- bypassTransactionLimits ?: boolean ;
117- }
114+ networkId ?: NetworkId ;
115+ mina : string | string [ ] ;
116+ archive ?: string | string [ ] ;
117+ lightnetAccountManager ?: string ;
118+ bypassTransactionLimits ?: boolean ;
119+ minaDefaultHeaders ?: HeadersInit ;
120+ archiveDefaultHeaders ?: HeadersInit ;
121+ }
118122 | string
119123) : Mina {
120124 let minaNetworkId : NetworkId = 'devnet' ;
@@ -136,21 +140,27 @@ function Network(
136140 ) ;
137141 if ( Array . isArray ( options . mina ) && options . mina . length !== 0 ) {
138142 minaGraphqlEndpoint = options . mina [ 0 ] ;
139- Fetch . setGraphqlEndpoint ( minaGraphqlEndpoint ) ;
143+ Fetch . setGraphqlEndpoint ( minaGraphqlEndpoint , options . minaDefaultHeaders ) ;
140144 Fetch . setMinaGraphqlFallbackEndpoints ( options . mina . slice ( 1 ) ) ;
141145 } else if ( typeof options . mina === 'string' ) {
142146 minaGraphqlEndpoint = options . mina ;
143- Fetch . setGraphqlEndpoint ( minaGraphqlEndpoint ) ;
147+ Fetch . setGraphqlEndpoint ( minaGraphqlEndpoint , options . minaDefaultHeaders ) ;
144148 }
145149
146150 if ( options . archive !== undefined ) {
147151 if ( Array . isArray ( options . archive ) && options . archive . length !== 0 ) {
148152 archiveEndpoint = options . archive [ 0 ] ;
149- Fetch . setArchiveGraphqlEndpoint ( archiveEndpoint ) ;
153+ Fetch . setArchiveGraphqlEndpoint (
154+ archiveEndpoint ,
155+ options . archiveDefaultHeaders
156+ ) ;
150157 Fetch . setArchiveGraphqlFallbackEndpoints ( options . archive . slice ( 1 ) ) ;
151158 } else if ( typeof options . archive === 'string' ) {
152159 archiveEndpoint = options . archive ;
153- Fetch . setArchiveGraphqlEndpoint ( archiveEndpoint ) ;
160+ Fetch . setArchiveGraphqlEndpoint (
161+ archiveEndpoint ,
162+ options . archiveDefaultHeaders
163+ ) ;
154164 }
155165 }
156166
@@ -162,8 +172,10 @@ function Network(
162172 Fetch . setLightnetAccountManagerEndpoint ( lightnetAccountManagerEndpoint ) ;
163173 }
164174
165- if ( options . bypassTransactionLimits !== undefined &&
166- typeof options . bypassTransactionLimits === 'boolean' ) {
175+ if (
176+ options . bypassTransactionLimits !== undefined &&
177+ typeof options . bypassTransactionLimits === 'boolean'
178+ ) {
167179 enforceTransactionLimits = ! options . bypassTransactionLimits ;
168180 }
169181 } else {
@@ -282,8 +294,8 @@ function Network(
282294 data : response ?. data ,
283295 errors : updatedErrors ,
284296 transaction : txn . transaction ,
285- setFee : txn . setFee ,
286- setFeePerSnarkCost : txn . setFeePerSnarkCost ,
297+ setFee : txn . setFee ,
298+ setFeePerSnarkCost : txn . setFeePerSnarkCost ,
287299 hash,
288300 toJSON : txn . toJSON ,
289301 toPretty : txn . toPretty ,
0 commit comments