Skip to content

Commit

Permalink
changing global to globalthis, removing window references
Browse files Browse the repository at this point in the history
  • Loading branch information
bunnybones1 committed Aug 8, 2024
1 parent 953204e commit 0eafe34
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export * from './api.gen'

import { API as ApiRpc } from './api.gen'

const fetch = typeof global === 'object' ? global.fetch : window.fetch
const fetch = globalThis.fetch

export class SequenceAPIClient extends ApiRpc {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion packages/guard/src/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { encodeTypedDataDigest, TypedData } from '@0xsequence/utils'
import { BytesLike, ethers, TypedDataDomain } from 'ethers'
import { AuthMethodsReturn, Guard, RecoveryCode as GuardRecoveryCode } from './guard.gen'

const fetch = typeof global === 'object' ? global.fetch : window.fetch
const fetch = globalThis.fetch

export class GuardSigner implements signers.SapientSigner {
private guard: Guard
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export * from './indexer.gen'

import { Indexer as IndexerRpc } from './indexer.gen'

const fetch = typeof global === 'object' ? global.fetch : window.fetch
const fetch = globalThis.fetch

export class SequenceIndexer extends IndexerRpc {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion packages/metadata/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export * from './metadata.gen'

import { Metadata as MetadataRpc, Collections as CollectionsRpc } from './metadata.gen'

const fetch = typeof global === 'object' ? global.fetch : window.fetch
const fetch = globalThis.fetch

export class SequenceMetadata extends MetadataRpc {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion packages/relayer/src/rpc-relayer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function isRpcRelayerOptions(obj: any): obj is RpcRelayerOptions {
)
}

const fetch = typeof global === 'object' ? global.fetch : window.fetch
const fetch = globalThis.fetch

// TODO: rename to SequenceRelayer
export class RpcRelayer implements Relayer {
Expand Down
2 changes: 1 addition & 1 deletion packages/waas/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ export class SequenceWaaS {

// Special version of fetch that keeps track of the last seen Date header
async fetch(input: RequestInfo, init?: RequestInit) {
const res = await window.fetch(input, init)
const res = await globalThis.fetch(input, init)
const headerValue = res.headers.get('date')
if (headerValue) {
this.lastDate = new Date(headerValue)
Expand Down

0 comments on commit 0eafe34

Please sign in to comment.