@0xsequence/api
Advanced tools
Comparing version
{ | ||
"name": "@0xsequence/api", | ||
"version": "0.0.0-26b08ee9-20220629135033", | ||
"version": "0.0.0-anypay-20250527101311", | ||
"description": "api sub-package for Sequence", | ||
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/api", | ||
"source": "src/index.ts", | ||
"main": "dist/0xsequence-api.cjs.js", | ||
"module": "dist/0xsequence-api.esm.js", | ||
"author": "Horizon Blockchain Games", | ||
"author": "Sequence Platforms Inc.", | ||
"license": "Apache-2.0", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"private": false, | ||
"exports": { | ||
".": { | ||
"types": "./src/index.ts", | ||
"default": "./dist/index.js" | ||
} | ||
}, | ||
"peerDependencies": {}, | ||
"devDependencies": { | ||
"@types/node": "^22.13.9", | ||
"typescript": "^5.7.3", | ||
"@repo/typescript-config": "^0.0.0" | ||
}, | ||
"dependencies": {}, | ||
"scripts": { | ||
"build": "tsc", | ||
"dev": "tsc --watch", | ||
"test": "echo", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"cross-fetch": "^3.1.5" | ||
}, | ||
"peerDependencies": {}, | ||
"devDependencies": {}, | ||
"files": [ | ||
"src", | ||
"dist" | ||
] | ||
} | ||
} | ||
} |
@@ -1,4 +0,3 @@ | ||
@0xsequence/api | ||
=============== | ||
# @0xsequence/api | ||
See [0xsequence project page](https://github.com/0xsequence/sequence.js). |
export * from './api.gen' | ||
import fetch from 'cross-fetch' | ||
import { API as ApiRpc } from './api.gen' | ||
import { API as BaseSequenceAPI } from './api.gen' | ||
export class SequenceAPIClient extends BaseSequenceAPI { | ||
constructor(hostname: string, public jwtAuth?: string) { | ||
export class SequenceAPIClient extends ApiRpc { | ||
constructor( | ||
hostname: string, | ||
public projectAccessKey?: string, | ||
public jwtAuth?: string, | ||
) { | ||
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch) | ||
@@ -14,9 +16,17 @@ this.fetch = this._fetch | ||
_fetch = (input: RequestInfo, init?: RequestInit): Promise<Response> => { | ||
// automatically include jwt auth header to requests | ||
// automatically include jwt and access key auth header to requests | ||
// if its been set on the api client | ||
const headers: { [key: string]: any } = {} | ||
if (this.jwtAuth && this.jwtAuth.length > 0) { | ||
headers['Authorization'] = `BEARER ${this.jwtAuth}` | ||
const jwtAuth = this.jwtAuth | ||
const projectAccessKey = this.projectAccessKey | ||
if (jwtAuth && jwtAuth.length > 0) { | ||
headers['Authorization'] = `BEARER ${jwtAuth}` | ||
} | ||
if (projectAccessKey && projectAccessKey.length > 0) { | ||
headers['X-Access-Key'] = projectAccessKey | ||
} | ||
// before the request is made | ||
@@ -23,0 +33,0 @@ init!.headers = { ...init!.headers, ...headers } |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
334625
374.63%0
-100%14
27.27%7044
217.58%0
-100%1
-50%3
Infinity%4
-20%2
100%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed