Socket
Socket
Sign inDemoInstall

@web3api/react

Package Overview
Dependencies
114
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1-prealpha.7 to 0.0.1-prealpha.8

2

build/index.d.ts
export { createWeb3ApiProvider, Web3ApiProvider } from "./provider";
export { useWeb3ApiQuery, UseWeb3ApiQueryProps } from "./query";
export { useWeb3ApiQuery } from "./query";

@@ -21,11 +21,13 @@ "use strict";

var redirects = _a.redirects, children = _a.children;
// If the client has already been set for this provider
if (exports.PROVIDERS[name].client) {
throw Error("Duplicate Web3ApiProvider detected. Please use \"createWeb3ApiProvider(\"provider-name\")\".");
}
// Instantiate the client
exports.PROVIDERS[name].client = new client_js_1.Web3ApiClient({ redirects: redirects });
// Unset the client in the global state when
// this provider is unmounted
var _b = react_1.default.useState(false), clientCreated = _b[0], setClientCreated = _b[1];
react_1.default.useEffect(function () {
// If the client has already been set for this provider
if (exports.PROVIDERS[name].client) {
throw Error("Duplicate Web3ApiProvider detected. Please use \"createWeb3ApiProvider(\"provider-name\")\".");
}
// Instantiate the client
exports.PROVIDERS[name].client = new client_js_1.Web3ApiClient({ redirects: redirects });
setClientCreated(true);
// Unset the client in the global state when
// this provider is unmounted
return function cleanup() {

@@ -37,3 +39,3 @@ exports.PROVIDERS[name].client = undefined;

var ClientProvider = exports.PROVIDERS[name].ClientContext.Provider;
return (react_1.default.createElement(ClientProvider, { value: exports.PROVIDERS[name].client }, children));
return clientCreated ? (react_1.default.createElement(ClientProvider, { value: exports.PROVIDERS[name].client }, children)) : null;
};

@@ -40,0 +42,0 @@ }

@@ -76,3 +76,3 @@ "use strict";

// Initialize the UseWeb3ApiQueryState
var _a = state_1.createStateReducer(exports.INITIAL_QUERY_STATE), state = _a.state, dispatch = _a.dispatch;
var _a = state_1.useStateReducer(exports.INITIAL_QUERY_STATE), state = _a.state, dispatch = _a.dispatch;
var execute = function (variables) { return __awaiter(_this, void 0, void 0, function () {

@@ -79,0 +79,0 @@ var _a, data, errors;

/// <reference types="react" />
export declare const createStateReducer: <TState>(initialState: TState) => {
export declare const useStateReducer: <TState>(initialState: TState) => {
state: TState;
dispatch: import("react").Dispatch<Partial<TState>>;
};

@@ -14,6 +14,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.createStateReducer = void 0;
exports.useStateReducer = void 0;
var react_1 = require("react");
var stateReducer = function () { return function (state, newState) { return (__assign(__assign({}, state), newState)); }; };
var createStateReducer = function (initialState) {
var useStateReducer = function (initialState) {
var _a = react_1.useReducer(stateReducer(), initialState), state = _a[0], dispatch = _a[1];

@@ -24,3 +24,3 @@ return react_1.useMemo(function () {

};
exports.createStateReducer = createStateReducer;
exports.useStateReducer = useStateReducer;
//# sourceMappingURL=state.js.map
{
"name": "@web3api/react",
"description": "Web3API React Integration",
"version": "0.0.1-prealpha.7",
"version": "0.0.1-prealpha.8",
"license": "MIT",

@@ -24,4 +24,4 @@ "repository": {

"dependencies": {
"@web3api/client-js": "0.0.1-prealpha.7",
"@web3api/core-js": "0.0.1-prealpha.7"
"@web3api/client-js": "0.0.1-prealpha.8",
"@web3api/core-js": "0.0.1-prealpha.8"
},

@@ -32,5 +32,5 @@ "devDependencies": {

"@types/jest": "26.0.8",
"@web3api/cli": "0.0.1-prealpha.7",
"@web3api/test-cases": "0.0.1-prealpha.7",
"@web3api/test-env-js": "0.0.1-prealpha.7",
"@web3api/cli": "0.0.1-prealpha.8",
"@web3api/test-cases": "0.0.1-prealpha.8",
"@web3api/test-env-js": "0.0.1-prealpha.8",
"jest": "26.2.2",

@@ -44,3 +44,3 @@ "jest-environment-jsdom": "^26.0.1",

},
"gitHead": "4e285019a0b3b0f371aab362afa6977acfb15c49",
"gitHead": "6a84f6875f7b6d9ca3e283b796f1c70f9eb6185b",
"publishConfig": {

@@ -47,0 +47,0 @@ "access": "public"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc