-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
1,431 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# @0xsequence/indexergw | ||
|
||
## 1.0.0 | ||
|
||
### Initial Release | ||
|
||
- Initial release of the Indexer Gateway |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@0xsequence/indexer | ||
=================== | ||
|
||
See [0xsequence project page](https://github.com/0xsequence/sequence.js). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "@0xsequence/indexergw", | ||
"version": "2.1.6", | ||
"description": "indexergw sub-package for Sequence", | ||
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/indexergw", | ||
"source": "src/index.ts", | ||
"main": "dist/0xsequence-indexergw.cjs.js", | ||
"module": "dist/0xsequence-indexergw.esm.js", | ||
"author": "Horizon Blockchain Games", | ||
"license": "Apache-2.0", | ||
"scripts": { | ||
"test": "echo", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": {}, | ||
"peerDependencies": {}, | ||
"devDependencies": {}, | ||
"files": [ | ||
"src", | ||
"dist" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export * from './indexergw.gen' | ||
|
||
import { IndexerGateway as IndexerGatewayRpc } from './indexergw.gen' | ||
|
||
const fetch = globalThis.fetch | ||
|
||
export class SequenceIndexerGateway extends IndexerGatewayRpc { | ||
constructor( | ||
hostname: string, | ||
) { | ||
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch) | ||
this.fetch = this._fetch | ||
} | ||
|
||
_fetch = (input: RequestInfo, init?: RequestInit): Promise<Response> => { | ||
// no additional headers for now, but we might add some later | ||
const headers: { [key: string]: any } = {} | ||
|
||
init!.headers = { ...init!.headers, ...headers } | ||
|
||
return fetch(input, init) | ||
} | ||
} |
Oops, something went wrong.