Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@swapkit/helpers

Package Overview
Dependencies
Maintainers
2
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swapkit/helpers - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

14

package.json

@@ -10,8 +10,8 @@ {

"devDependencies": {
"@swapkit/toolbox-cosmos": "1.0.11",
"@swapkit/toolbox-evm": "1.1.5",
"@swapkit/toolbox-solana": "1.0.10",
"@swapkit/toolbox-radix": "1.0.10",
"@swapkit/toolbox-substrate": "1.1.5",
"@swapkit/toolbox-utxo": "1.0.10"
"@swapkit/toolbox-cosmos": "1.0.12",
"@swapkit/toolbox-evm": "1.1.6",
"@swapkit/toolbox-solana": "1.0.11",
"@swapkit/toolbox-radix": "1.0.11",
"@swapkit/toolbox-substrate": "1.1.6",
"@swapkit/toolbox-utxo": "1.0.11"
},

@@ -41,3 +41,3 @@ "files": [

"types": "./src/index.ts",
"version": "1.2.1"
"version": "1.2.2"
}

@@ -1,2 +0,2 @@

type Options = {
type Options = Parameters<typeof fetch>[1] & {
headers?: Record<string, string>;

@@ -7,3 +7,4 @@ apiKey?: string;

responseHandler?: (response: NotWorth) => NotWorth;
[key: string]: NotWorth;
searchParams?: Record<string, string>;
json?: unknown;
};

@@ -22,10 +23,26 @@

async function fetchWithConfig(url: string, options: Options = {}) {
async function fetchWithConfig(url: string, options: Options) {
const { apiKey, ...config } = clientConfig;
const headers = { ...defaultRequestHeaders, ...config.headers, ...options.headers };
const { searchParams, json, body } = options;
const headers = { ...defaultRequestHeaders, ...config.headers, ...options.headers } as Record<
string,
string
>;
const bodyToSend = json ? JSON.stringify(json) : body;
const urlInstance = new URL(url);
if (searchParams) {
urlInstance.search = new URLSearchParams(searchParams).toString();
}
if (apiKey) headers["x-api-key"] = apiKey;
try {
const response = await fetch(url, { ...config, ...options, headers });
const response = await fetch(urlInstance.toString(), {
...config,
...options,
body: bodyToSend,
headers,
});
const body = await response.json();

@@ -32,0 +49,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc