wagmi 0.5.9 → 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -16,10 +16,10 @@ npm install wagmi ethers
|
|
|
16
16
|
|
|
17
17
|
Check out the following places for more wagmi-related content:
|
|
18
18
|
|
|
19
|
-
- Join the [discussions on GitHub](https://github.com/
|
|
19
|
+
- Join the [discussions on GitHub](https://github.com/wagmi-dev/wagmi/discussions)
|
|
20
20
|
- Follow [@awkweb](https://twitter.com/awkweb) and [@wagmi_sh](https://twitter.com/wagmi_sh) on Twitter for project updates
|
|
21
|
-
- Share [your project/organization](https://github.com/
|
|
22
|
-
- Browse the [awesome-wagmi](https://github.com/
|
|
21
|
+
- Share [your project/organization](https://github.com/wagmi-dev/wagmi/discussions/201) using wagmi
|
|
22
|
+
- Browse the [awesome-wagmi](https://github.com/wagmi-dev/awesome-wagmi) list of awesome projects and resources
|
|
23
23
|
|
|
24
24
|
## Support
|
|
25
25
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// are you seeing an error that a default export doesn't exist but your source file has a default export?
|
|
2
|
+
// you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
|
|
3
|
+
|
|
4
|
+
// curious why you need to?
|
|
5
|
+
// this file exists so that you can import from the entrypoint normally
|
|
6
|
+
// except that it points to your source file and you don't need to run build constantly
|
|
7
|
+
// which means we need to re-export all of the modules from your source file
|
|
8
|
+
// and since export * doesn't include default exports, we need to read your source file
|
|
9
|
+
// to check for a default export and re-export it if it exists
|
|
10
|
+
// it's not ideal, but it works pretty well ¯\_(ツ)_/¯
|
|
11
|
+
export * from "../../../src/connectors/mock";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// this file might look strange and you might be wondering what it's for
|
|
3
|
+
// it's lets you import your source files by importing this entrypoint
|
|
4
|
+
// as you would import it if it was built with preconstruct build
|
|
5
|
+
// this file is slightly different to some others though
|
|
6
|
+
// it has a require hook which compiles your code with Babel
|
|
7
|
+
// this means that you don't have to set up @babel/register or anything like that
|
|
8
|
+
// but you can still require this module and it'll be compiled
|
|
9
|
+
|
|
10
|
+
// this bit of code imports the require hook and registers it
|
|
11
|
+
let unregister = require("../../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../../..", "../../..");
|
|
12
|
+
|
|
13
|
+
// this re-exports the source file
|
|
14
|
+
module.exports = require("../../../src/connectors/mock.ts");
|
|
15
|
+
|
|
16
|
+
unregister();
|
package/dist/wagmi.cjs.dev.js
CHANGED
|
@@ -447,42 +447,26 @@ function useProvider() {
|
|
|
447
447
|
let {
|
|
448
448
|
chainId
|
|
449
449
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
450
|
-
|
|
451
|
-
const client = useClient();
|
|
452
|
-
const provider = React__namespace.useRef(core.getProvider({
|
|
450
|
+
return withSelector_js.useSyncExternalStoreWithSelector(cb => core.watchProvider({
|
|
453
451
|
chainId
|
|
454
|
-
}))
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
provider.current = provider_;
|
|
460
|
-
forceUpdate();
|
|
461
|
-
});
|
|
462
|
-
return unwatch;
|
|
463
|
-
}, [chainId, client, forceUpdate]);
|
|
464
|
-
return provider.current;
|
|
452
|
+
}, cb), () => core.getProvider({
|
|
453
|
+
chainId
|
|
454
|
+
}), () => core.getProvider({
|
|
455
|
+
chainId
|
|
456
|
+
}), x => x, (a, b) => a.network.chainId === b.network.chainId);
|
|
465
457
|
}
|
|
466
458
|
|
|
467
459
|
function useWebSocketProvider() {
|
|
468
460
|
let {
|
|
469
461
|
chainId
|
|
470
462
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
471
|
-
|
|
472
|
-
const client = useClient();
|
|
473
|
-
const webSocketProvider = React__namespace.useRef(core.getWebSocketProvider({
|
|
463
|
+
return withSelector_js.useSyncExternalStoreWithSelector(cb => core.watchWebSocketProvider({
|
|
474
464
|
chainId
|
|
475
|
-
}))
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
webSocketProvider.current = webSocketProvider_;
|
|
481
|
-
forceUpdate();
|
|
482
|
-
});
|
|
483
|
-
return unwatch;
|
|
484
|
-
}, [chainId, client, forceUpdate]);
|
|
485
|
-
return webSocketProvider.current;
|
|
465
|
+
}, cb), () => core.getWebSocketProvider({
|
|
466
|
+
chainId
|
|
467
|
+
}), () => core.getWebSocketProvider({
|
|
468
|
+
chainId
|
|
469
|
+
}), x => x, (a, b) => (a === null || a === void 0 ? void 0 : a.network.chainId) === (b === null || b === void 0 ? void 0 : b.network.chainId));
|
|
486
470
|
}
|
|
487
471
|
|
|
488
472
|
function useChainId() {
|
|
@@ -1389,7 +1373,9 @@ const queryKeyHashFn$1 = _ref2 => {
|
|
|
1389
1373
|
return reactQuery.hashQueryKey([rest]);
|
|
1390
1374
|
};
|
|
1391
1375
|
|
|
1392
|
-
const queryFn$7 = _ref3 => {
|
|
1376
|
+
const queryFn$7 = async _ref3 => {
|
|
1377
|
+
var _await$readContract;
|
|
1378
|
+
|
|
1393
1379
|
let {
|
|
1394
1380
|
queryKey: [{
|
|
1395
1381
|
addressOrName,
|
|
@@ -1400,14 +1386,14 @@ const queryFn$7 = _ref3 => {
|
|
|
1400
1386
|
overrides
|
|
1401
1387
|
}]
|
|
1402
1388
|
} = _ref3;
|
|
1403
|
-
return core.readContract({
|
|
1389
|
+
return (_await$readContract = await core.readContract({
|
|
1404
1390
|
addressOrName,
|
|
1405
1391
|
args,
|
|
1406
1392
|
chainId,
|
|
1407
1393
|
contractInterface,
|
|
1408
1394
|
functionName,
|
|
1409
1395
|
overrides
|
|
1410
|
-
});
|
|
1396
|
+
})) !== null && _await$readContract !== void 0 ? _await$readContract : null;
|
|
1411
1397
|
};
|
|
1412
1398
|
|
|
1413
1399
|
function useContractRead(_ref4) {
|
package/dist/wagmi.cjs.prod.js
CHANGED
|
@@ -447,42 +447,26 @@ function useProvider() {
|
|
|
447
447
|
let {
|
|
448
448
|
chainId
|
|
449
449
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
450
|
-
|
|
451
|
-
const client = useClient();
|
|
452
|
-
const provider = React__namespace.useRef(core.getProvider({
|
|
450
|
+
return withSelector_js.useSyncExternalStoreWithSelector(cb => core.watchProvider({
|
|
453
451
|
chainId
|
|
454
|
-
}))
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
provider.current = provider_;
|
|
460
|
-
forceUpdate();
|
|
461
|
-
});
|
|
462
|
-
return unwatch;
|
|
463
|
-
}, [chainId, client, forceUpdate]);
|
|
464
|
-
return provider.current;
|
|
452
|
+
}, cb), () => core.getProvider({
|
|
453
|
+
chainId
|
|
454
|
+
}), () => core.getProvider({
|
|
455
|
+
chainId
|
|
456
|
+
}), x => x, (a, b) => a.network.chainId === b.network.chainId);
|
|
465
457
|
}
|
|
466
458
|
|
|
467
459
|
function useWebSocketProvider() {
|
|
468
460
|
let {
|
|
469
461
|
chainId
|
|
470
462
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
471
|
-
|
|
472
|
-
const client = useClient();
|
|
473
|
-
const webSocketProvider = React__namespace.useRef(core.getWebSocketProvider({
|
|
463
|
+
return withSelector_js.useSyncExternalStoreWithSelector(cb => core.watchWebSocketProvider({
|
|
474
464
|
chainId
|
|
475
|
-
}))
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
webSocketProvider.current = webSocketProvider_;
|
|
481
|
-
forceUpdate();
|
|
482
|
-
});
|
|
483
|
-
return unwatch;
|
|
484
|
-
}, [chainId, client, forceUpdate]);
|
|
485
|
-
return webSocketProvider.current;
|
|
465
|
+
}, cb), () => core.getWebSocketProvider({
|
|
466
|
+
chainId
|
|
467
|
+
}), () => core.getWebSocketProvider({
|
|
468
|
+
chainId
|
|
469
|
+
}), x => x, (a, b) => (a === null || a === void 0 ? void 0 : a.network.chainId) === (b === null || b === void 0 ? void 0 : b.network.chainId));
|
|
486
470
|
}
|
|
487
471
|
|
|
488
472
|
function useChainId() {
|
|
@@ -1389,7 +1373,9 @@ const queryKeyHashFn$1 = _ref2 => {
|
|
|
1389
1373
|
return reactQuery.hashQueryKey([rest]);
|
|
1390
1374
|
};
|
|
1391
1375
|
|
|
1392
|
-
const queryFn$7 = _ref3 => {
|
|
1376
|
+
const queryFn$7 = async _ref3 => {
|
|
1377
|
+
var _await$readContract;
|
|
1378
|
+
|
|
1393
1379
|
let {
|
|
1394
1380
|
queryKey: [{
|
|
1395
1381
|
addressOrName,
|
|
@@ -1400,14 +1386,14 @@ const queryFn$7 = _ref3 => {
|
|
|
1400
1386
|
overrides
|
|
1401
1387
|
}]
|
|
1402
1388
|
} = _ref3;
|
|
1403
|
-
return core.readContract({
|
|
1389
|
+
return (_await$readContract = await core.readContract({
|
|
1404
1390
|
addressOrName,
|
|
1405
1391
|
args,
|
|
1406
1392
|
chainId,
|
|
1407
1393
|
contractInterface,
|
|
1408
1394
|
functionName,
|
|
1409
1395
|
overrides
|
|
1410
|
-
});
|
|
1396
|
+
})) !== null && _await$readContract !== void 0 ? _await$readContract : null;
|
|
1411
1397
|
};
|
|
1412
1398
|
|
|
1413
1399
|
function useContractRead(_ref4) {
|
package/dist/wagmi.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { createClient as createClient$1, getProvider,
|
|
2
|
+
import { createClient as createClient$1, watchProvider, getProvider, watchWebSocketProvider, getWebSocketProvider, fetchBlockNumber, fetchFeeData, deepEqual, getAccount, watchAccount, fetchBalance, connect, disconnect, getNetwork, watchNetwork, watchSigner, fetchSigner, signMessage, signTypedData, switchNetwork, getContract, readContracts, parseContractResult, readContract, writeContract, fetchToken, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, sendTransaction, waitForTransaction } from '@wagmi/core';
|
|
3
3
|
export { AddChainError, ChainDoesNotSupportMulticallError, ChainMismatchError, ChainNotConfiguredError, Client, Connector, ConnectorAlreadyConnectedError, ConnectorNotFoundError, ContractMethodNoResultError, ProviderChainsNotFound, ProviderRpcError, ResourceUnavailableError, RpcError, SwitchChainError, SwitchChainNotSupportedError, UserRejectedRequestError, alchemyRpcUrls, allChains, chain, chainId, configureChains, createStorage, deepEqual, defaultChains, defaultL2Chains, erc20ABI, erc721ABI, etherscanBlockExplorers, infuraRpcUrls, publicRpcUrls, readContracts } from '@wagmi/core';
|
|
4
4
|
import { QueryClient, QueryClientProvider, useQueryClient, useIsRestoring, useQueryErrorResetBoundary, notifyManager, InfiniteQueryObserver, QueryObserver, useMutation, hashQueryKey } from 'react-query';
|
|
5
5
|
import { persistQueryClient } from 'react-query/persistQueryClient';
|
|
@@ -423,42 +423,26 @@ function useProvider() {
|
|
|
423
423
|
let {
|
|
424
424
|
chainId
|
|
425
425
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
426
|
-
|
|
427
|
-
const client = useClient();
|
|
428
|
-
const provider = React.useRef(getProvider({
|
|
426
|
+
return useSyncExternalStoreWithSelector(cb => watchProvider({
|
|
429
427
|
chainId
|
|
430
|
-
}))
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
provider.current = provider_;
|
|
436
|
-
forceUpdate();
|
|
437
|
-
});
|
|
438
|
-
return unwatch;
|
|
439
|
-
}, [chainId, client, forceUpdate]);
|
|
440
|
-
return provider.current;
|
|
428
|
+
}, cb), () => getProvider({
|
|
429
|
+
chainId
|
|
430
|
+
}), () => getProvider({
|
|
431
|
+
chainId
|
|
432
|
+
}), x => x, (a, b) => a.network.chainId === b.network.chainId);
|
|
441
433
|
}
|
|
442
434
|
|
|
443
435
|
function useWebSocketProvider() {
|
|
444
436
|
let {
|
|
445
437
|
chainId
|
|
446
438
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
447
|
-
|
|
448
|
-
const client = useClient();
|
|
449
|
-
const webSocketProvider = React.useRef(getWebSocketProvider({
|
|
439
|
+
return useSyncExternalStoreWithSelector(cb => watchWebSocketProvider({
|
|
450
440
|
chainId
|
|
451
|
-
}))
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
webSocketProvider.current = webSocketProvider_;
|
|
457
|
-
forceUpdate();
|
|
458
|
-
});
|
|
459
|
-
return unwatch;
|
|
460
|
-
}, [chainId, client, forceUpdate]);
|
|
461
|
-
return webSocketProvider.current;
|
|
441
|
+
}, cb), () => getWebSocketProvider({
|
|
442
|
+
chainId
|
|
443
|
+
}), () => getWebSocketProvider({
|
|
444
|
+
chainId
|
|
445
|
+
}), x => x, (a, b) => (a === null || a === void 0 ? void 0 : a.network.chainId) === (b === null || b === void 0 ? void 0 : b.network.chainId));
|
|
462
446
|
}
|
|
463
447
|
|
|
464
448
|
function useChainId() {
|
|
@@ -1365,7 +1349,9 @@ const queryKeyHashFn$1 = _ref2 => {
|
|
|
1365
1349
|
return hashQueryKey([rest]);
|
|
1366
1350
|
};
|
|
1367
1351
|
|
|
1368
|
-
const queryFn$7 = _ref3 => {
|
|
1352
|
+
const queryFn$7 = async _ref3 => {
|
|
1353
|
+
var _await$readContract;
|
|
1354
|
+
|
|
1369
1355
|
let {
|
|
1370
1356
|
queryKey: [{
|
|
1371
1357
|
addressOrName,
|
|
@@ -1376,14 +1362,14 @@ const queryFn$7 = _ref3 => {
|
|
|
1376
1362
|
overrides
|
|
1377
1363
|
}]
|
|
1378
1364
|
} = _ref3;
|
|
1379
|
-
return readContract({
|
|
1365
|
+
return (_await$readContract = await readContract({
|
|
1380
1366
|
addressOrName,
|
|
1381
1367
|
args,
|
|
1382
1368
|
chainId,
|
|
1383
1369
|
contractInterface,
|
|
1384
1370
|
functionName,
|
|
1385
1371
|
overrides
|
|
1386
|
-
});
|
|
1372
|
+
})) !== null && _await$readContract !== void 0 ? _await$readContract : null;
|
|
1387
1373
|
};
|
|
1388
1374
|
|
|
1389
1375
|
function useContractRead(_ref4) {
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "wagmi",
|
|
3
3
|
"description": "React Hooks for Ethereum",
|
|
4
4
|
"license": "WAGMIT",
|
|
5
|
-
"version": "0.5.
|
|
6
|
-
"repository": "
|
|
5
|
+
"version": "0.5.12",
|
|
6
|
+
"repository": "wagmi-dev/wagmi",
|
|
7
7
|
"author": "awkweb.eth",
|
|
8
8
|
"homepage": "https://wagmi.sh",
|
|
9
9
|
"ethereum": "awkweb.eth",
|
|
@@ -96,10 +96,10 @@
|
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@coinbase/wallet-sdk": "^3.3.0",
|
|
99
|
-
"@wagmi/core": "^0.4.
|
|
99
|
+
"@wagmi/core": "^0.4.9",
|
|
100
100
|
"@walletconnect/ethereum-provider": "^1.7.8",
|
|
101
|
-
"react-query": "
|
|
102
|
-
"use-sync-external-store": "^1.
|
|
101
|
+
"react-query": "4.0.0-beta.23",
|
|
102
|
+
"use-sync-external-store": "^1.2.0"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@testing-library/react": "^13.2.0",
|