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

@stakekit/api-hooks

Package Overview
Dependencies
Maintainers
0
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stakekit/api-hooks - npm Package Compare versions

Comparing version 0.0.76 to 0.0.77

41

dist/index.js

@@ -8,8 +8,6 @@ export { ActionStatus, ActionTypes, BalanceTypes, DailyCumulativeStakeDtoStatus, DailyCumulativeStakeDtoType, EvmEIP1559GasArgsDtoType, EvmLegacyGasArgsDtoType, GasMode, GeolocationErrorTagsItem, GeolocationErrorType, KeyCategory, MasterBannedRegionDtoTagsItem, Networks, RequiredArgumentWithNetworkDtoNetwork, RewardClaiming, RewardSchedule, RewardTypes, Role, TeamCategory, TokenGetTokensNetwork, TransactionStatus, TransactionType, TronResourceType, UpdatePayoutAddressDtoNetwork, ValidatorStatusTypes, WebhookSubscriptionEventDtoEvent, YieldGetMyYieldsNetwork, YieldGetMyYieldsSortBy, YieldGetMyYieldsType, YieldProviders, YieldType, YieldYieldsNetwork, YieldYieldsRevenueOption, YieldYieldsSortBy, YieldYieldsType } from './chunk-6WGTFAQI.js';

var ApiClientProvider = ({
apiClient,
children
}) => {
return /* @__PURE__ */ jsx(Context.Provider, { value: apiClient, children });
};
var useApiClient = () => {
children,
...apiClientProps
}) => /* @__PURE__ */ jsx(Context.Provider, { value: apiClientProps, children });
var useApiClientProps = () => {
const value = useContext(Context);

@@ -23,5 +21,32 @@ if (!value) {

// src/use-api-client.ts
var defaultBaseURL = "https://api.stakek.it/";
var getUrl = ({
baseURL,
path,
params
}) => {
const url = new URL(baseURL);
url.pathname = path;
url.search = new URLSearchParams(params).toString();
return url.toString();
};
var useApi = () => {
const apiClient = useApiClient();
return (config) => apiClient(config).then((response) => response.data);
const {
fetchInstance,
apiKey,
baseURL = defaultBaseURL
} = useApiClientProps();
return ({
url,
data,
method,
params,
headers,
signal
}) => fetchInstance(getUrl({ baseURL, path: url, params }), {
method,
data,
headers: { ...headers, "X-API-KEY": apiKey },
signal
});
};

@@ -28,0 +53,0 @@

11

package.json
{
"name": "@stakekit/api-hooks",
"description": "React hooks for StakeKit API",
"version": "0.0.76",
"version": "0.0.77",
"type": "module",

@@ -44,2 +44,3 @@ "types": "./dist/index.d.ts",

"@faker-js/faker": "^8",
"@tanstack/react-query": "^5",
"msw": "^2",

@@ -52,2 +53,5 @@ "react": ">=18"

},
"@tanstack/react-query": {
"optional": true
},
"msw": {

@@ -57,8 +61,5 @@ "optional": true

},
"dependencies": {
"@tanstack/react-query": "^5",
"axios": ">=1.6"
},
"devDependencies": {
"@faker-js/faker": "^8",
"@tanstack/react-query": "^5",
"@types/react": "^18.2.67",

@@ -65,0 +66,0 @@ "eslint": "^8.57.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