@wagmi/core 1.0.0-next.0 → 1.0.0-next.2
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/dist/{chunk-BSUU37OK.js → chunk-YPGOLRBI.js} +164 -106
- package/dist/index.d.ts +42 -56
- package/dist/index.js +9 -9
- package/dist/internal/index.js +1 -1
- package/dist/internal/test.js +1 -1
- package/package.json +4 -4
|
@@ -127,11 +127,11 @@ var ConnectorAlreadyConnectedError = class extends Error {
|
|
|
127
127
|
this.message = "Connector already connected";
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
-
var
|
|
130
|
+
var ConfigChainsNotFound = class extends Error {
|
|
131
131
|
constructor() {
|
|
132
132
|
super(...arguments);
|
|
133
|
-
this.name = "
|
|
134
|
-
this.message = "No chains were found on the wagmi
|
|
133
|
+
this.name = "ConfigChainsNotFound";
|
|
134
|
+
this.message = "No chains were found on the wagmi config. Some functions that require a chain may not work.";
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
137
|
var SwitchChainNotSupportedError = class extends Error {
|
|
@@ -311,7 +311,7 @@ function serialize(value, replacer, indent, circularReplacer) {
|
|
|
311
311
|
);
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
// src/
|
|
314
|
+
// src/config.ts
|
|
315
315
|
import { persist, subscribeWithSelector } from "zustand/middleware";
|
|
316
316
|
import { createStore } from "zustand/vanilla";
|
|
317
317
|
|
|
@@ -353,10 +353,10 @@ function createStorage({
|
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
-
// src/
|
|
356
|
+
// src/config.ts
|
|
357
357
|
var storeKey = "store";
|
|
358
358
|
var _isAutoConnecting, _lastUsedConnector, _addEffects, addEffects_fn;
|
|
359
|
-
var
|
|
359
|
+
var Config = class {
|
|
360
360
|
constructor({
|
|
361
361
|
autoConnect = false,
|
|
362
362
|
connectors = [new InjectedConnector()],
|
|
@@ -374,7 +374,7 @@ var Client = class {
|
|
|
374
374
|
this.webSocketPublicClients = /* @__PURE__ */ new Map();
|
|
375
375
|
__privateAdd(this, _isAutoConnecting, void 0);
|
|
376
376
|
__privateAdd(this, _lastUsedConnector, void 0);
|
|
377
|
-
this.
|
|
377
|
+
this.constructorArgs = {
|
|
378
378
|
autoConnect,
|
|
379
379
|
connectors,
|
|
380
380
|
logger,
|
|
@@ -523,7 +523,7 @@ var Client = class {
|
|
|
523
523
|
publicClient_ = this.publicClients.get(chainId ?? -1);
|
|
524
524
|
if (publicClient_)
|
|
525
525
|
return publicClient_;
|
|
526
|
-
const { publicClient } = this.
|
|
526
|
+
const { publicClient } = this.constructorArgs;
|
|
527
527
|
publicClient_ = typeof publicClient === "function" ? publicClient({ chainId }) : publicClient;
|
|
528
528
|
this.publicClients.set(chainId ?? -1, publicClient_);
|
|
529
529
|
return publicClient_;
|
|
@@ -535,7 +535,7 @@ var Client = class {
|
|
|
535
535
|
webSocketPublicClient_ = this.webSocketPublicClients.get(chainId ?? -1);
|
|
536
536
|
if (webSocketPublicClient_)
|
|
537
537
|
return webSocketPublicClient_;
|
|
538
|
-
const { webSocketPublicClient } = this.
|
|
538
|
+
const { webSocketPublicClient } = this.constructorArgs;
|
|
539
539
|
webSocketPublicClient_ = typeof webSocketPublicClient === "function" ? webSocketPublicClient({ chainId }) : webSocketPublicClient;
|
|
540
540
|
if (webSocketPublicClient_)
|
|
541
541
|
this.webSocketPublicClients.set(chainId ?? -1, webSocketPublicClient_);
|
|
@@ -574,7 +574,7 @@ addEffects_fn = function() {
|
|
|
574
574
|
connector.on?.("error", onError);
|
|
575
575
|
}
|
|
576
576
|
);
|
|
577
|
-
const { publicClient, webSocketPublicClient } = this.
|
|
577
|
+
const { publicClient, webSocketPublicClient } = this.constructorArgs;
|
|
578
578
|
const subscribePublicClient = typeof publicClient === "function";
|
|
579
579
|
const subscribeWebSocketPublicClient = typeof webSocketPublicClient === "function";
|
|
580
580
|
if (subscribePublicClient || subscribeWebSocketPublicClient)
|
|
@@ -591,42 +591,42 @@ addEffects_fn = function() {
|
|
|
591
591
|
}
|
|
592
592
|
);
|
|
593
593
|
};
|
|
594
|
-
var
|
|
595
|
-
function
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
return
|
|
594
|
+
var config;
|
|
595
|
+
function createConfig(args) {
|
|
596
|
+
const config_ = new Config(args);
|
|
597
|
+
config = config_;
|
|
598
|
+
return config_;
|
|
599
599
|
}
|
|
600
|
-
function
|
|
601
|
-
if (!
|
|
600
|
+
function getConfig() {
|
|
601
|
+
if (!config) {
|
|
602
602
|
throw new Error(
|
|
603
|
-
"No wagmi
|
|
603
|
+
"No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config"
|
|
604
604
|
);
|
|
605
605
|
}
|
|
606
|
-
return
|
|
606
|
+
return config;
|
|
607
607
|
}
|
|
608
608
|
|
|
609
609
|
// src/actions/accounts/connect.ts
|
|
610
610
|
async function connect({ chainId, connector }) {
|
|
611
|
-
const
|
|
612
|
-
const activeConnector =
|
|
611
|
+
const config2 = getConfig();
|
|
612
|
+
const activeConnector = config2.connector;
|
|
613
613
|
if (activeConnector && connector.id === activeConnector.id)
|
|
614
614
|
throw new ConnectorAlreadyConnectedError();
|
|
615
615
|
try {
|
|
616
|
-
|
|
616
|
+
config2.setState((x) => ({ ...x, status: "connecting" }));
|
|
617
617
|
const data = await connector.connect({ chainId });
|
|
618
|
-
|
|
619
|
-
|
|
618
|
+
config2.setLastUsedConnector(connector.id);
|
|
619
|
+
config2.setState((x) => ({
|
|
620
620
|
...x,
|
|
621
621
|
connector,
|
|
622
622
|
chains: connector?.chains,
|
|
623
623
|
data,
|
|
624
624
|
status: "connected"
|
|
625
625
|
}));
|
|
626
|
-
|
|
626
|
+
config2.storage.setItem("connected", true);
|
|
627
627
|
return { ...data, connector };
|
|
628
628
|
} catch (err) {
|
|
629
|
-
|
|
629
|
+
config2.setState((x) => {
|
|
630
630
|
return {
|
|
631
631
|
...x,
|
|
632
632
|
status: x.connector ? "connected" : "disconnected"
|
|
@@ -638,11 +638,11 @@ async function connect({ chainId, connector }) {
|
|
|
638
638
|
|
|
639
639
|
// src/actions/accounts/disconnect.ts
|
|
640
640
|
async function disconnect() {
|
|
641
|
-
const
|
|
642
|
-
if (
|
|
643
|
-
await
|
|
644
|
-
|
|
645
|
-
|
|
641
|
+
const config2 = getConfig();
|
|
642
|
+
if (config2.connector)
|
|
643
|
+
await config2.connector.disconnect();
|
|
644
|
+
config2.clearState();
|
|
645
|
+
config2.storage.removeItem("connected");
|
|
646
646
|
}
|
|
647
647
|
|
|
648
648
|
// src/actions/accounts/fetchBalance.ts
|
|
@@ -1934,18 +1934,18 @@ async function fetchToken({
|
|
|
1934
1934
|
|
|
1935
1935
|
// src/actions/viem/getPublicClient.ts
|
|
1936
1936
|
function getPublicClient({ chainId } = {}) {
|
|
1937
|
-
const
|
|
1937
|
+
const config2 = getConfig();
|
|
1938
1938
|
if (chainId)
|
|
1939
|
-
return
|
|
1940
|
-
return
|
|
1939
|
+
return config2.getPublicClient({ chainId }) || config2.publicClient;
|
|
1940
|
+
return config2.publicClient;
|
|
1941
1941
|
}
|
|
1942
1942
|
|
|
1943
1943
|
// src/actions/viem/getWalletClient.ts
|
|
1944
1944
|
async function getWalletClient({
|
|
1945
1945
|
chainId
|
|
1946
1946
|
} = {}) {
|
|
1947
|
-
const
|
|
1948
|
-
const walletClient = await
|
|
1947
|
+
const config2 = getConfig();
|
|
1948
|
+
const walletClient = await config2.connector?.getWalletClient?.({ chainId }) || null;
|
|
1949
1949
|
return walletClient;
|
|
1950
1950
|
}
|
|
1951
1951
|
|
|
@@ -1953,17 +1953,17 @@ async function getWalletClient({
|
|
|
1953
1953
|
function getWebSocketPublicClient({
|
|
1954
1954
|
chainId
|
|
1955
1955
|
} = {}) {
|
|
1956
|
-
const
|
|
1956
|
+
const config2 = getConfig();
|
|
1957
1957
|
if (chainId)
|
|
1958
|
-
return
|
|
1959
|
-
return
|
|
1958
|
+
return config2.getWebSocketPublicClient({ chainId }) || config2.webSocketPublicClient;
|
|
1959
|
+
return config2.webSocketPublicClient;
|
|
1960
1960
|
}
|
|
1961
1961
|
|
|
1962
1962
|
// src/actions/viem/watchPublicClient.ts
|
|
1963
1963
|
function watchPublicClient(args, callback) {
|
|
1964
|
-
const
|
|
1964
|
+
const config2 = getConfig();
|
|
1965
1965
|
const handleChange = async () => callback(getPublicClient(args));
|
|
1966
|
-
const unsubscribe =
|
|
1966
|
+
const unsubscribe = config2.subscribe(
|
|
1967
1967
|
({ publicClient }) => publicClient,
|
|
1968
1968
|
handleChange
|
|
1969
1969
|
);
|
|
@@ -1973,14 +1973,14 @@ function watchPublicClient(args, callback) {
|
|
|
1973
1973
|
// src/actions/viem/watchWalletClient.ts
|
|
1974
1974
|
import { shallow } from "zustand/shallow";
|
|
1975
1975
|
function watchWalletClient({ chainId }, callback) {
|
|
1976
|
-
const
|
|
1976
|
+
const config2 = getConfig();
|
|
1977
1977
|
const handleChange = async () => {
|
|
1978
1978
|
const walletClient = await getWalletClient({ chainId });
|
|
1979
|
-
if (!
|
|
1979
|
+
if (!getConfig().connector)
|
|
1980
1980
|
return callback(null);
|
|
1981
1981
|
return callback(walletClient);
|
|
1982
1982
|
};
|
|
1983
|
-
const unsubscribe =
|
|
1983
|
+
const unsubscribe = config2.subscribe(
|
|
1984
1984
|
({ data, connector }) => ({
|
|
1985
1985
|
account: data?.account,
|
|
1986
1986
|
chainId: data?.chain?.id,
|
|
@@ -1996,9 +1996,9 @@ function watchWalletClient({ chainId }, callback) {
|
|
|
1996
1996
|
|
|
1997
1997
|
// src/actions/viem/watchWebSocketPublicClient.ts
|
|
1998
1998
|
function watchWebSocketPublicClient(args, callback) {
|
|
1999
|
-
const
|
|
1999
|
+
const config2 = getConfig();
|
|
2000
2000
|
const handleChange = async () => callback(getWebSocketPublicClient(args));
|
|
2001
|
-
const unsubscribe =
|
|
2001
|
+
const unsubscribe = config2.subscribe(
|
|
2002
2002
|
({ webSocketPublicClient }) => webSocketPublicClient,
|
|
2003
2003
|
handleChange
|
|
2004
2004
|
);
|
|
@@ -2013,7 +2013,7 @@ async function prepareWriteContract({
|
|
|
2013
2013
|
chainId,
|
|
2014
2014
|
functionName,
|
|
2015
2015
|
walletClient: walletClient_,
|
|
2016
|
-
...
|
|
2016
|
+
...config2
|
|
2017
2017
|
}) {
|
|
2018
2018
|
const publicClient = getPublicClient({ chainId });
|
|
2019
2019
|
const walletClient = walletClient_ ?? await getWalletClient({ chainId });
|
|
@@ -2031,7 +2031,7 @@ async function prepareWriteContract({
|
|
|
2031
2031
|
maxPriorityFeePerGas,
|
|
2032
2032
|
nonce,
|
|
2033
2033
|
value
|
|
2034
|
-
} = getCallParameters(
|
|
2034
|
+
} = getCallParameters(config2);
|
|
2035
2035
|
const { result, request } = await publicClient.simulateContract({
|
|
2036
2036
|
abi,
|
|
2037
2037
|
address,
|
|
@@ -2089,7 +2089,7 @@ async function multicall({
|
|
|
2089
2089
|
}) {
|
|
2090
2090
|
const publicClient = getPublicClient({ chainId });
|
|
2091
2091
|
if (!publicClient.chains)
|
|
2092
|
-
throw new
|
|
2092
|
+
throw new ConfigChainsNotFound();
|
|
2093
2093
|
if (chainId && publicClient.chain.id !== chainId)
|
|
2094
2094
|
throw new ChainNotConfiguredError({ chainId });
|
|
2095
2095
|
return publicClient.multicall({
|
|
@@ -2196,8 +2196,8 @@ function watchContractEvent({
|
|
|
2196
2196
|
});
|
|
2197
2197
|
};
|
|
2198
2198
|
watchEvent();
|
|
2199
|
-
const
|
|
2200
|
-
const unsubscribe =
|
|
2199
|
+
const config2 = getConfig();
|
|
2200
|
+
const unsubscribe = config2.subscribe(
|
|
2201
2201
|
({ publicClient, webSocketPublicClient }) => ({
|
|
2202
2202
|
publicClient,
|
|
2203
2203
|
webSocketPublicClient
|
|
@@ -2227,8 +2227,8 @@ function watchBlockNumber(args, callback) {
|
|
|
2227
2227
|
const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });
|
|
2228
2228
|
if (args.listen)
|
|
2229
2229
|
createListener(publicClient_);
|
|
2230
|
-
const
|
|
2231
|
-
const unsubscribe =
|
|
2230
|
+
const config2 = getConfig();
|
|
2231
|
+
const unsubscribe = config2.subscribe(
|
|
2232
2232
|
({ publicClient, webSocketPublicClient }) => ({
|
|
2233
2233
|
publicClient,
|
|
2234
2234
|
webSocketPublicClient
|
|
@@ -2250,11 +2250,11 @@ function watchBlockNumber(args, callback) {
|
|
|
2250
2250
|
}
|
|
2251
2251
|
|
|
2252
2252
|
// src/actions/contracts/watchMulticall.ts
|
|
2253
|
-
function watchMulticall(
|
|
2254
|
-
const
|
|
2255
|
-
const handleChange = async () => callback(await multicall(
|
|
2256
|
-
const unwatch =
|
|
2257
|
-
const unsubscribe =
|
|
2253
|
+
function watchMulticall(args, callback) {
|
|
2254
|
+
const config2 = getConfig();
|
|
2255
|
+
const handleChange = async () => callback(await multicall(args));
|
|
2256
|
+
const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;
|
|
2257
|
+
const unsubscribe = config2.subscribe(
|
|
2258
2258
|
({ publicClient }) => publicClient,
|
|
2259
2259
|
handleChange
|
|
2260
2260
|
);
|
|
@@ -2265,11 +2265,11 @@ function watchMulticall(config, callback) {
|
|
|
2265
2265
|
}
|
|
2266
2266
|
|
|
2267
2267
|
// src/actions/contracts/watchReadContract.ts
|
|
2268
|
-
function watchReadContract(
|
|
2269
|
-
const
|
|
2270
|
-
const handleChange = async () => callback(await readContract(
|
|
2271
|
-
const unwatch =
|
|
2272
|
-
const unsubscribe =
|
|
2268
|
+
function watchReadContract(args, callback) {
|
|
2269
|
+
const config2 = getConfig();
|
|
2270
|
+
const handleChange = async () => callback(await readContract(args));
|
|
2271
|
+
const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;
|
|
2272
|
+
const unsubscribe = config2.subscribe(
|
|
2273
2273
|
({ publicClient }) => publicClient,
|
|
2274
2274
|
handleChange
|
|
2275
2275
|
);
|
|
@@ -2280,11 +2280,11 @@ function watchReadContract(config, callback) {
|
|
|
2280
2280
|
}
|
|
2281
2281
|
|
|
2282
2282
|
// src/actions/contracts/watchReadContracts.ts
|
|
2283
|
-
function watchReadContracts(
|
|
2284
|
-
const
|
|
2285
|
-
const handleChange = async () => callback(await readContracts(
|
|
2286
|
-
const unwatch =
|
|
2287
|
-
const unsubscribe =
|
|
2283
|
+
function watchReadContracts(args, callback) {
|
|
2284
|
+
const config2 = getConfig();
|
|
2285
|
+
const handleChange = async () => callback(await readContracts(args));
|
|
2286
|
+
const unwatch = args.listenToBlock ? watchBlockNumber({ listen: true }, handleChange) : void 0;
|
|
2287
|
+
const unsubscribe = config2.subscribe(
|
|
2288
2288
|
({ publicClient }) => publicClient,
|
|
2289
2289
|
handleChange
|
|
2290
2290
|
);
|
|
@@ -2295,21 +2295,24 @@ function watchReadContracts(config, callback) {
|
|
|
2295
2295
|
}
|
|
2296
2296
|
|
|
2297
2297
|
// src/actions/contracts/writeContract.ts
|
|
2298
|
-
async function writeContract(
|
|
2298
|
+
async function writeContract(config2) {
|
|
2299
2299
|
const walletClient = await getWalletClient();
|
|
2300
2300
|
if (!walletClient)
|
|
2301
2301
|
throw new ConnectorNotFoundError();
|
|
2302
|
-
if (
|
|
2303
|
-
assertActiveChain({ chainId:
|
|
2302
|
+
if (config2.chainId)
|
|
2303
|
+
assertActiveChain({ chainId: config2.chainId, walletClient });
|
|
2304
2304
|
let request;
|
|
2305
|
-
if (
|
|
2306
|
-
request =
|
|
2305
|
+
if (config2.mode === "prepared") {
|
|
2306
|
+
request = config2;
|
|
2307
2307
|
} else {
|
|
2308
|
-
const { chainId, mode, ...args } =
|
|
2308
|
+
const { chainId, mode, ...args } = config2;
|
|
2309
2309
|
const res = await prepareWriteContract(args);
|
|
2310
2310
|
request = res.request;
|
|
2311
2311
|
}
|
|
2312
|
-
const hash = await walletClient.writeContract({
|
|
2312
|
+
const hash = await walletClient.writeContract({
|
|
2313
|
+
...request,
|
|
2314
|
+
chain: null
|
|
2315
|
+
});
|
|
2313
2316
|
return { hash };
|
|
2314
2317
|
}
|
|
2315
2318
|
|
|
@@ -2320,7 +2323,7 @@ async function fetchBalance({
|
|
|
2320
2323
|
formatUnits: unit,
|
|
2321
2324
|
token
|
|
2322
2325
|
}) {
|
|
2323
|
-
const
|
|
2326
|
+
const config2 = getConfig();
|
|
2324
2327
|
const publicClient = getPublicClient({ chainId });
|
|
2325
2328
|
if (token) {
|
|
2326
2329
|
const fetchContractBalance = async ({ abi }) => {
|
|
@@ -2360,8 +2363,8 @@ async function fetchBalance({
|
|
|
2360
2363
|
}
|
|
2361
2364
|
}
|
|
2362
2365
|
const chains = [
|
|
2363
|
-
...
|
|
2364
|
-
...
|
|
2366
|
+
...config2.publicClient.chains || [],
|
|
2367
|
+
...config2.chains ?? []
|
|
2365
2368
|
];
|
|
2366
2369
|
const value = await publicClient.getBalance({ address });
|
|
2367
2370
|
const chain = chains.find((x) => x.id === publicClient.chain.id);
|
|
@@ -2375,7 +2378,7 @@ async function fetchBalance({
|
|
|
2375
2378
|
|
|
2376
2379
|
// src/actions/accounts/getAccount.ts
|
|
2377
2380
|
function getAccount() {
|
|
2378
|
-
const { data, connector, status } =
|
|
2381
|
+
const { data, connector, status } = getConfig();
|
|
2379
2382
|
switch (status) {
|
|
2380
2383
|
case "connected":
|
|
2381
2384
|
return {
|
|
@@ -2422,11 +2425,11 @@ function getAccount() {
|
|
|
2422
2425
|
|
|
2423
2426
|
// src/actions/accounts/getNetwork.ts
|
|
2424
2427
|
function getNetwork() {
|
|
2425
|
-
const
|
|
2426
|
-
const chainId =
|
|
2427
|
-
const activeChains =
|
|
2428
|
+
const config2 = getConfig();
|
|
2429
|
+
const chainId = config2.data?.chain?.id;
|
|
2430
|
+
const activeChains = config2.chains ?? [];
|
|
2428
2431
|
const activeChain = [
|
|
2429
|
-
...
|
|
2432
|
+
...config2.publicClient?.chains || [],
|
|
2430
2433
|
...activeChains
|
|
2431
2434
|
].find((x) => x.id === chainId) ?? {
|
|
2432
2435
|
id: chainId,
|
|
@@ -2441,7 +2444,7 @@ function getNetwork() {
|
|
|
2441
2444
|
return {
|
|
2442
2445
|
chain: chainId ? {
|
|
2443
2446
|
...activeChain,
|
|
2444
|
-
...
|
|
2447
|
+
...config2.data?.chain,
|
|
2445
2448
|
id: chainId
|
|
2446
2449
|
} : void 0,
|
|
2447
2450
|
chains: activeChains
|
|
@@ -2483,7 +2486,7 @@ async function signTypedData({
|
|
|
2483
2486
|
async function switchNetwork({
|
|
2484
2487
|
chainId
|
|
2485
2488
|
}) {
|
|
2486
|
-
const { connector } =
|
|
2489
|
+
const { connector } = getConfig();
|
|
2487
2490
|
if (!connector)
|
|
2488
2491
|
throw new ConnectorNotFoundError();
|
|
2489
2492
|
if (!connector.switchChain)
|
|
@@ -2496,9 +2499,9 @@ async function switchNetwork({
|
|
|
2496
2499
|
// src/actions/accounts/watchAccount.ts
|
|
2497
2500
|
import { shallow as shallow4 } from "zustand/shallow";
|
|
2498
2501
|
function watchAccount(callback, { selector = (x) => x } = {}) {
|
|
2499
|
-
const
|
|
2502
|
+
const config2 = getConfig();
|
|
2500
2503
|
const handleChange = () => callback(getAccount());
|
|
2501
|
-
const unsubscribe =
|
|
2504
|
+
const unsubscribe = config2.subscribe(
|
|
2502
2505
|
({ data, connector, status }) => selector({
|
|
2503
2506
|
address: data?.account,
|
|
2504
2507
|
connector,
|
|
@@ -2515,9 +2518,9 @@ function watchAccount(callback, { selector = (x) => x } = {}) {
|
|
|
2515
2518
|
// src/actions/accounts/watchNetwork.ts
|
|
2516
2519
|
import { shallow as shallow5 } from "zustand/shallow";
|
|
2517
2520
|
function watchNetwork(callback, { selector = (x) => x } = {}) {
|
|
2518
|
-
const
|
|
2521
|
+
const config2 = getConfig();
|
|
2519
2522
|
const handleChange = () => callback(getNetwork());
|
|
2520
|
-
const unsubscribe =
|
|
2523
|
+
const unsubscribe = config2.subscribe(
|
|
2521
2524
|
({ data, chains }) => selector({ chainId: data?.chain?.id, chains }),
|
|
2522
2525
|
handleChange,
|
|
2523
2526
|
{
|
|
@@ -2638,8 +2641,17 @@ async function fetchTransaction({
|
|
|
2638
2641
|
// src/actions/transactions/prepareSendTransaction.ts
|
|
2639
2642
|
import { isAddress } from "viem";
|
|
2640
2643
|
async function prepareSendTransaction({
|
|
2644
|
+
accessList,
|
|
2645
|
+
account,
|
|
2641
2646
|
chainId,
|
|
2642
|
-
|
|
2647
|
+
data,
|
|
2648
|
+
gas,
|
|
2649
|
+
gasPrice,
|
|
2650
|
+
maxFeePerGas,
|
|
2651
|
+
maxPriorityFeePerGas,
|
|
2652
|
+
nonce,
|
|
2653
|
+
to: to_,
|
|
2654
|
+
value,
|
|
2643
2655
|
walletClient: walletClient_
|
|
2644
2656
|
}) {
|
|
2645
2657
|
const walletClient = walletClient_ ?? await getWalletClient({ chainId });
|
|
@@ -2647,30 +2659,76 @@ async function prepareSendTransaction({
|
|
|
2647
2659
|
throw new ConnectorNotFoundError();
|
|
2648
2660
|
if (chainId)
|
|
2649
2661
|
assertActiveChain({ chainId, walletClient });
|
|
2650
|
-
const to = (
|
|
2662
|
+
const to = (to_ && !isAddress(to_) ? await fetchEnsAddress({ name: to_ }) : to_) || void 0;
|
|
2651
2663
|
if (to && !isAddress(to))
|
|
2652
2664
|
throw new Error("Invalid address");
|
|
2653
2665
|
return {
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2666
|
+
accessList,
|
|
2667
|
+
account,
|
|
2668
|
+
data,
|
|
2669
|
+
gas,
|
|
2670
|
+
gasPrice,
|
|
2671
|
+
maxFeePerGas,
|
|
2672
|
+
maxPriorityFeePerGas,
|
|
2673
|
+
mode: "prepared",
|
|
2674
|
+
nonce,
|
|
2675
|
+
to,
|
|
2676
|
+
value,
|
|
2677
|
+
...chainId ? { chainId } : {}
|
|
2657
2678
|
};
|
|
2658
2679
|
}
|
|
2659
2680
|
|
|
2660
2681
|
// src/actions/transactions/sendTransaction.ts
|
|
2661
2682
|
async function sendTransaction({
|
|
2683
|
+
accessList,
|
|
2684
|
+
account,
|
|
2662
2685
|
chainId,
|
|
2663
|
-
|
|
2686
|
+
data,
|
|
2687
|
+
gas,
|
|
2688
|
+
gasPrice,
|
|
2689
|
+
maxFeePerGas,
|
|
2690
|
+
maxPriorityFeePerGas,
|
|
2691
|
+
mode,
|
|
2692
|
+
nonce,
|
|
2693
|
+
to,
|
|
2694
|
+
value
|
|
2664
2695
|
}) {
|
|
2665
2696
|
const walletClient = await getWalletClient();
|
|
2666
2697
|
if (!walletClient)
|
|
2667
2698
|
throw new ConnectorNotFoundError();
|
|
2668
2699
|
if (chainId)
|
|
2669
2700
|
assertActiveChain({ chainId, walletClient });
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2701
|
+
let args;
|
|
2702
|
+
if (mode === "prepared") {
|
|
2703
|
+
args = {
|
|
2704
|
+
account,
|
|
2705
|
+
accessList,
|
|
2706
|
+
chain: null,
|
|
2707
|
+
data,
|
|
2708
|
+
gas,
|
|
2709
|
+
gasPrice,
|
|
2710
|
+
maxFeePerGas,
|
|
2711
|
+
maxPriorityFeePerGas,
|
|
2712
|
+
nonce,
|
|
2713
|
+
to,
|
|
2714
|
+
value
|
|
2715
|
+
};
|
|
2716
|
+
} else {
|
|
2717
|
+
args = await prepareSendTransaction({
|
|
2718
|
+
accessList,
|
|
2719
|
+
account,
|
|
2720
|
+
chainId,
|
|
2721
|
+
data,
|
|
2722
|
+
gas,
|
|
2723
|
+
gasPrice,
|
|
2724
|
+
maxFeePerGas,
|
|
2725
|
+
maxPriorityFeePerGas,
|
|
2726
|
+
nonce,
|
|
2727
|
+
to,
|
|
2728
|
+
value
|
|
2729
|
+
});
|
|
2730
|
+
}
|
|
2731
|
+
const hash = await walletClient.sendTransaction(args);
|
|
2674
2732
|
return { hash };
|
|
2675
2733
|
}
|
|
2676
2734
|
|
|
@@ -2720,8 +2778,8 @@ function watchPendingTransactions(args, callback) {
|
|
|
2720
2778
|
};
|
|
2721
2779
|
const publicClient_ = getWebSocketPublicClient({ chainId: args.chainId }) ?? getPublicClient({ chainId: args.chainId });
|
|
2722
2780
|
createListener(publicClient_);
|
|
2723
|
-
const
|
|
2724
|
-
const unsubscribe =
|
|
2781
|
+
const config2 = getConfig();
|
|
2782
|
+
const unsubscribe = config2.subscribe(
|
|
2725
2783
|
({ publicClient, webSocketPublicClient }) => ({
|
|
2726
2784
|
publicClient,
|
|
2727
2785
|
webSocketPublicClient
|
|
@@ -2758,7 +2816,7 @@ function assertActiveChain({
|
|
|
2758
2816
|
if (walletClient) {
|
|
2759
2817
|
const walletClientChainId = walletClient.chain.id;
|
|
2760
2818
|
if (walletClientChainId && chainId !== walletClientChainId) {
|
|
2761
|
-
const connector =
|
|
2819
|
+
const connector = getConfig().connector;
|
|
2762
2820
|
throw new ChainNotConfiguredError({
|
|
2763
2821
|
chainId,
|
|
2764
2822
|
connectorId: connector?.id ?? "unknown"
|
|
@@ -2772,7 +2830,7 @@ export {
|
|
|
2772
2830
|
ChainMismatchError,
|
|
2773
2831
|
ChainNotConfiguredError,
|
|
2774
2832
|
ConnectorAlreadyConnectedError,
|
|
2775
|
-
|
|
2833
|
+
ConfigChainsNotFound,
|
|
2776
2834
|
SwitchChainNotSupportedError,
|
|
2777
2835
|
ConnectorNotFoundError,
|
|
2778
2836
|
deepEqual,
|
|
@@ -2783,9 +2841,9 @@ export {
|
|
|
2783
2841
|
serialize,
|
|
2784
2842
|
noopStorage,
|
|
2785
2843
|
createStorage,
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2844
|
+
Config,
|
|
2845
|
+
createConfig,
|
|
2846
|
+
getConfig,
|
|
2789
2847
|
connect,
|
|
2790
2848
|
disconnect,
|
|
2791
2849
|
erc20ABI,
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { Connector, ConnectorData, ConnectorEvents, ConnectorNotFoundError, Wind
|
|
|
7
7
|
import { P as PublicClient, W as WebSocketPublicClient, U as Unit, a as WalletClient, H as Hash, C as ChainProviderFn } from './index-fc9ab085.js';
|
|
8
8
|
import { Address, ResolvedConfig, TypedData, Abi, Narrow, ExtractAbiFunctionNames } from 'abitype';
|
|
9
9
|
export { Address } from 'abitype';
|
|
10
|
-
import { SignMessageReturnType, SignTypedDataParameters, Account, SignTypedDataReturnType, SimulateContractParameters, SimulateContractReturnType, GetContractParameters, Transport, Chain as Chain$1, PublicClient as PublicClient$1, GetContractReturnType, ContractFunctionConfig, MulticallParameters, MulticallReturnType, ReadContractParameters, ReadContractReturnType, MulticallContracts, WatchContractEventParameters, WriteContractParameters, WriteContractReturnType, GetEnsResolverReturnType, Hex, GetTransactionReturnType, SendTransactionParameters, SendTransactionReturnType, WaitForTransactionReceiptParameters, WaitForTransactionReceiptReturnType, WatchPendingTransactionsParameters, OnTransactionsParameter, FallbackTransportConfig, PublicClientConfig, FallbackTransport } from 'viem';
|
|
10
|
+
import { SignMessageReturnType, SignTypedDataParameters, Account, SignTypedDataReturnType, SimulateContractParameters, SimulateContractReturnType, GetContractParameters, Transport, Chain as Chain$1, PublicClient as PublicClient$1, GetContractReturnType, ContractFunctionConfig, MulticallParameters, MulticallReturnType, ReadContractParameters, ReadContractReturnType, MulticallContracts, WatchContractEventParameters, WriteContractParameters, WriteContractReturnType, GetEnsResolverReturnType, Hex, GetTransactionReturnType, SendTransactionParameters, SendTransactionReturnType, Address as Address$1, WaitForTransactionReceiptParameters, WaitForTransactionReceiptReturnType, WatchPendingTransactionsParameters, OnTransactionsParameter, FallbackTransportConfig, PublicClientConfig, FallbackTransport } from 'viem';
|
|
11
11
|
import { GetEnsAvatarReturnType } from 'viem/ens';
|
|
12
12
|
export { InjectedConnector, InjectedConnectorOptions } from '@wagmi/connectors/injected';
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ declare function createStorage({ deserialize, key: prefix, serialize, storage, }
|
|
|
25
25
|
storage: BaseStorage;
|
|
26
26
|
}): ClientStorage;
|
|
27
27
|
|
|
28
|
-
type
|
|
28
|
+
type CreateConfigParameters<TPublicClient extends PublicClient = PublicClient, TWebSocketPublicClient extends WebSocketPublicClient = WebSocketPublicClient> = {
|
|
29
29
|
/** Enables reconnecting to last used connector on init */
|
|
30
30
|
autoConnect?: boolean;
|
|
31
31
|
/**
|
|
@@ -62,9 +62,9 @@ type State<TPublicClient extends PublicClient = PublicClient, TWebSocketPublicCl
|
|
|
62
62
|
status: 'connected' | 'connecting' | 'reconnecting' | 'disconnected';
|
|
63
63
|
webSocketPublicClient?: TWebSocketPublicClient;
|
|
64
64
|
};
|
|
65
|
-
declare class
|
|
65
|
+
declare class Config<TPublicClient extends PublicClient = PublicClient, TWebSocketPublicClient extends WebSocketPublicClient = WebSocketPublicClient> {
|
|
66
66
|
#private;
|
|
67
|
-
|
|
67
|
+
constructorArgs: CreateConfigParameters<TPublicClient, TWebSocketPublicClient>;
|
|
68
68
|
publicClients: Map<number, TPublicClient | undefined>;
|
|
69
69
|
storage: ClientStorage;
|
|
70
70
|
store: Mutate<StoreApi<State<TPublicClient, TWebSocketPublicClient>>, [
|
|
@@ -78,7 +78,7 @@ declare class Client<TPublicClient extends PublicClient = PublicClient, TWebSock
|
|
|
78
78
|
]
|
|
79
79
|
]>;
|
|
80
80
|
webSocketPublicClients: Map<number, TWebSocketPublicClient | undefined>;
|
|
81
|
-
constructor({ autoConnect, connectors, publicClient, storage, logger, webSocketPublicClient, }:
|
|
81
|
+
constructor({ autoConnect, connectors, publicClient, storage, logger, webSocketPublicClient, }: CreateConfigParameters<TPublicClient, TWebSocketPublicClient>);
|
|
82
82
|
get chains(): _wagmi_chains.Chain[] | undefined;
|
|
83
83
|
get connectors(): Connector<any, any>[];
|
|
84
84
|
get connector(): Connector<any, any> | undefined;
|
|
@@ -108,8 +108,8 @@ declare class Client<TPublicClient extends PublicClient = PublicClient, TWebSock
|
|
|
108
108
|
}): TWebSocketPublicClient | undefined;
|
|
109
109
|
setLastUsedConnector(lastUsedConnector?: string | null): void;
|
|
110
110
|
}
|
|
111
|
-
declare function
|
|
112
|
-
declare function
|
|
111
|
+
declare function createConfig<TPublicClient extends PublicClient = PublicClient, TWebSocketPublicClient extends WebSocketPublicClient = WebSocketPublicClient>(args: CreateConfigParameters<TPublicClient, TWebSocketPublicClient>): Config<TPublicClient, TWebSocketPublicClient>;
|
|
112
|
+
declare function getConfig<TPublicClient extends PublicClient = PublicClient, TWebSocketPublicClient extends WebSocketPublicClient = WebSocketPublicClient>(): Config<TPublicClient, TWebSocketPublicClient>;
|
|
113
113
|
|
|
114
114
|
type ConnectArgs = {
|
|
115
115
|
/** Chain ID to connect to */
|
|
@@ -121,7 +121,7 @@ type Data = Required<ConnectorData>;
|
|
|
121
121
|
type ConnectResult<TPublicClient extends PublicClient = PublicClient> = {
|
|
122
122
|
account: Data['account'];
|
|
123
123
|
chain: Data['chain'];
|
|
124
|
-
connector:
|
|
124
|
+
connector: Config<TPublicClient>['connector'];
|
|
125
125
|
};
|
|
126
126
|
declare function connect<TPublicClient extends PublicClient = PublicClient>({ chainId, connector }: ConnectArgs): Promise<ConnectResult<TPublicClient>>;
|
|
127
127
|
|
|
@@ -147,7 +147,7 @@ declare function fetchBalance({ address, chainId, formatUnits: unit, token, }: F
|
|
|
147
147
|
|
|
148
148
|
type GetAccountResult<TPublicClient extends PublicClient = PublicClient> = {
|
|
149
149
|
address: NonNullable<Data$1['account']>;
|
|
150
|
-
connector: NonNullable<
|
|
150
|
+
connector: NonNullable<Config<TPublicClient>['connector']>;
|
|
151
151
|
isConnected: true;
|
|
152
152
|
isConnecting: false;
|
|
153
153
|
isDisconnected: false;
|
|
@@ -155,7 +155,7 @@ type GetAccountResult<TPublicClient extends PublicClient = PublicClient> = {
|
|
|
155
155
|
status: 'connected';
|
|
156
156
|
} | {
|
|
157
157
|
address: Data$1['account'];
|
|
158
|
-
connector:
|
|
158
|
+
connector: Config<TPublicClient>['connector'];
|
|
159
159
|
isConnected: boolean;
|
|
160
160
|
isConnecting: false;
|
|
161
161
|
isDisconnected: false;
|
|
@@ -163,7 +163,7 @@ type GetAccountResult<TPublicClient extends PublicClient = PublicClient> = {
|
|
|
163
163
|
status: 'reconnecting';
|
|
164
164
|
} | {
|
|
165
165
|
address: Data$1['account'];
|
|
166
|
-
connector:
|
|
166
|
+
connector: Config<TPublicClient>['connector'];
|
|
167
167
|
isConnected: false;
|
|
168
168
|
isReconnecting: false;
|
|
169
169
|
isConnecting: true;
|
|
@@ -320,19 +320,19 @@ type WatchMulticallConfig<TContracts extends ContractFunctionConfig[] = Contract
|
|
|
320
320
|
listenToBlock?: boolean;
|
|
321
321
|
};
|
|
322
322
|
type WatchMulticallCallback<TContracts extends ContractFunctionConfig[] = ContractFunctionConfig[], TAllowFailure extends boolean = true> = (results: MulticallResult<TContracts, TAllowFailure>) => void;
|
|
323
|
-
declare function watchMulticall<TContracts extends ContractFunctionConfig[], TAllowFailure extends boolean = true>(
|
|
323
|
+
declare function watchMulticall<TContracts extends ContractFunctionConfig[], TAllowFailure extends boolean = true>(args: WatchMulticallConfig<TContracts, TAllowFailure>, callback: WatchMulticallCallback<TContracts, TAllowFailure>): () => void;
|
|
324
324
|
|
|
325
325
|
type WatchReadContractConfig<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ReadContractConfig<TAbi, TFunctionName> & {
|
|
326
326
|
listenToBlock?: boolean;
|
|
327
327
|
};
|
|
328
328
|
type WatchReadContractCallback<TAbi extends Abi | readonly unknown[], TFunctionName extends string> = (result: ReadContractResult<TAbi, TFunctionName>) => void;
|
|
329
|
-
declare function watchReadContract<TAbi extends Abi | readonly unknown[], TFunctionName extends TAbi extends Abi ? ExtractAbiFunctionNames<TAbi, 'view' | 'pure'> : string>(
|
|
329
|
+
declare function watchReadContract<TAbi extends Abi | readonly unknown[], TFunctionName extends TAbi extends Abi ? ExtractAbiFunctionNames<TAbi, 'view' | 'pure'> : string>(args: WatchReadContractConfig<TAbi, TFunctionName>, callback: WatchReadContractCallback<TAbi, TFunctionName>): () => void;
|
|
330
330
|
|
|
331
331
|
type WatchReadContractsConfig<TContracts extends ContractFunctionConfig[] = ContractFunctionConfig[], TAllowFailure extends boolean = true> = ReadContractsConfig<TContracts, TAllowFailure> & {
|
|
332
332
|
listenToBlock?: boolean;
|
|
333
333
|
};
|
|
334
334
|
type WatchReadContractsCallback<TContracts extends ContractFunctionConfig[] = ContractFunctionConfig[], TAllowFailure extends boolean = true> = (results: ReadContractsResult<TContracts, TAllowFailure>) => void;
|
|
335
|
-
declare function watchReadContracts<TContracts extends ContractFunctionConfig[], TAllowFailure extends boolean = true>(
|
|
335
|
+
declare function watchReadContracts<TContracts extends ContractFunctionConfig[], TAllowFailure extends boolean = true>(args: WatchReadContractsConfig<TContracts, TAllowFailure>, callback: WatchReadContractsCallback<TContracts, TAllowFailure>): () => void;
|
|
336
336
|
|
|
337
337
|
type WriteContractMode = 'prepared' | undefined;
|
|
338
338
|
type WriteContractPreparedArgs<TAbi extends Abi | readonly unknown[] = readonly unknown[], TFunctionName extends string = string> = WriteContractParameters<TAbi, TFunctionName, Chain$1, Account> & {
|
|
@@ -485,73 +485,59 @@ type FetchTransactionResult = GetTransactionReturnType;
|
|
|
485
485
|
*/
|
|
486
486
|
declare function fetchTransaction({ chainId, hash, }: FetchTransactionArgs): Promise<FetchTransactionResult>;
|
|
487
487
|
|
|
488
|
-
type
|
|
488
|
+
type SendTransactionArgs = {
|
|
489
489
|
/** Chain ID used to validate if the walletClient is connected to the target chain */
|
|
490
490
|
chainId?: number;
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
};
|
|
497
|
-
type PrepareSendTransactionResult = {
|
|
498
|
-
chainId?: number;
|
|
499
|
-
request: SendTransactionParameters<Chain$1, Account>;
|
|
500
|
-
mode: 'prepared';
|
|
491
|
+
mode?: 'prepared';
|
|
492
|
+
to: string;
|
|
493
|
+
} & Omit<SendTransactionParameters<Chain$1, Account>, 'chain' | 'to'>;
|
|
494
|
+
type SendTransactionResult = {
|
|
495
|
+
hash: SendTransactionReturnType;
|
|
501
496
|
};
|
|
502
497
|
/**
|
|
503
|
-
* @description
|
|
498
|
+
* @description Function to send a transaction.
|
|
504
499
|
*
|
|
505
|
-
*
|
|
500
|
+
* It is recommended to pair this with the `prepareSendTransaction` function to avoid
|
|
501
|
+
* [UX pitfalls](https://wagmi.sh/react/prepare-hooks#ux-pitfalls-without-prepare-hooks).
|
|
506
502
|
*
|
|
507
503
|
* @example
|
|
508
504
|
* import { prepareSendTransaction, sendTransaction } from '@wagmi/core'
|
|
509
505
|
*
|
|
510
506
|
* const config = await prepareSendTransaction({
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
* value: parseEther('1'),
|
|
514
|
-
* }
|
|
507
|
+
* to: 'moxey.eth',
|
|
508
|
+
* value: parseEther('1'),
|
|
515
509
|
* })
|
|
516
510
|
* const result = await sendTransaction(config)
|
|
517
511
|
*/
|
|
518
|
-
declare function
|
|
512
|
+
declare function sendTransaction({ accessList, account, chainId, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, mode, nonce, to, value, }: SendTransactionArgs): Promise<SendTransactionResult>;
|
|
519
513
|
|
|
520
|
-
type
|
|
521
|
-
mode: 'prepared';
|
|
522
|
-
/** The prepared request for sending a transaction. */
|
|
523
|
-
request: SendTransactionParameters<Chain$1, Account>;
|
|
524
|
-
};
|
|
525
|
-
type SendTransactionUnpreparedRequest = {
|
|
526
|
-
mode?: never;
|
|
527
|
-
/** The unprepared request for sending a transaction. */
|
|
528
|
-
request: Omit<SendTransactionParameters<Chain$1, Account>, 'to'> & {
|
|
529
|
-
to?: string;
|
|
530
|
-
};
|
|
531
|
-
};
|
|
532
|
-
type SendTransactionArgs = {
|
|
514
|
+
type PrepareSendTransactionArgs<TWalletClient extends WalletClient = WalletClient> = Omit<SendTransactionParameters<Chain$1, Account>, 'chain' | 'to'> & {
|
|
533
515
|
/** Chain ID used to validate if the walletClient is connected to the target chain */
|
|
534
516
|
chainId?: number;
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
517
|
+
to?: string;
|
|
518
|
+
walletClient?: TWalletClient | null;
|
|
519
|
+
};
|
|
520
|
+
type PrepareSendTransactionResult = Omit<SendTransactionArgs, 'mode' | 'to'> & {
|
|
521
|
+
mode: 'prepared';
|
|
522
|
+
to: Address$1;
|
|
538
523
|
};
|
|
539
524
|
/**
|
|
540
|
-
* @description
|
|
525
|
+
* @description Prepares the parameters required for sending a transaction.
|
|
541
526
|
*
|
|
542
|
-
*
|
|
543
|
-
* [UX pitfalls](https://wagmi.sh/react/prepare-hooks#ux-pitfalls-without-prepare-hooks).
|
|
527
|
+
* Returns config to be passed through to `sendTransaction`.
|
|
544
528
|
*
|
|
545
529
|
* @example
|
|
546
530
|
* import { prepareSendTransaction, sendTransaction } from '@wagmi/core'
|
|
547
531
|
*
|
|
548
532
|
* const config = await prepareSendTransaction({
|
|
549
|
-
*
|
|
550
|
-
*
|
|
533
|
+
* request: {
|
|
534
|
+
* to: 'moxey.eth',
|
|
535
|
+
* value: parseEther('1'),
|
|
536
|
+
* }
|
|
551
537
|
* })
|
|
552
538
|
* const result = await sendTransaction(config)
|
|
553
539
|
*/
|
|
554
|
-
declare function
|
|
540
|
+
declare function prepareSendTransaction({ accessList, account, chainId, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to: to_, value, walletClient: walletClient_, }: PrepareSendTransactionArgs): Promise<PrepareSendTransactionResult>;
|
|
555
541
|
|
|
556
542
|
type WaitForTransactionArgs = {
|
|
557
543
|
/** Chain id to use for Public Client. */
|
|
@@ -1356,7 +1342,7 @@ declare class ConnectorAlreadyConnectedError extends Error {
|
|
|
1356
1342
|
name: string;
|
|
1357
1343
|
message: string;
|
|
1358
1344
|
}
|
|
1359
|
-
declare class
|
|
1345
|
+
declare class ConfigChainsNotFound extends Error {
|
|
1360
1346
|
name: string;
|
|
1361
1347
|
message: string;
|
|
1362
1348
|
}
|
|
@@ -1404,4 +1390,4 @@ type CircularReplacer = (key: string, value: any, referenceKey: string) => any;
|
|
|
1404
1390
|
*/
|
|
1405
1391
|
declare function serialize(value: any, replacer?: StandardReplacer | null | undefined, indent?: number | null | undefined, circularReplacer?: CircularReplacer | null | undefined): string;
|
|
1406
1392
|
|
|
1407
|
-
export { ChainMismatchError, ChainNotConfiguredError, ChainProviderFn,
|
|
1393
|
+
export { ChainMismatchError, ChainNotConfiguredError, ChainProviderFn, Config, ConfigChainsNotFound, ConfigureChainsConfig, ConnectArgs, ConnectResult, ConnectorAlreadyConnectedError, CreateConfigParameters, FetchBalanceArgs, FetchBalanceResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchFeeDataArgs, FetchFeeDataResult, FetchTokenArgs, FetchTokenResult, FetchTransactionArgs, FetchTransactionResult, GetAccountResult, GetContractArgs, GetContractResult, GetNetworkResult, GetPublicClientArgs, GetPublicClientResult, GetWalletClientArgs, GetWalletClientResult, GetWebSocketPublicClientArgs, GetWebSocketPublicClientResult, Hash, MulticallConfig, MulticallResult, PrepareSendTransactionArgs, PrepareSendTransactionResult, PrepareWriteContractConfig, PrepareWriteContractResult, PublicClient, ReadContractConfig, ReadContractResult, ReadContractsConfig, ReadContractsResult, SendTransactionArgs, SendTransactionResult, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, ClientStorage as Storage, SwitchChainNotSupportedError, SwitchNetworkArgs, SwitchNetworkResult, Unit, WaitForTransactionArgs, WaitForTransactionResult, WalletClient, WatchAccountCallback, WatchBlockNumberArgs, WatchBlockNumberCallback, WatchContractEventCallback, WatchContractEventConfig, WatchMulticallCallback, WatchMulticallConfig, WatchNetworkCallback, WatchPendingTransactionsArgs, WatchPendingTransactionsCallback, WatchPendingTransactionsResult, WatchPublicClientCallback, WatchReadContractCallback, WatchReadContractConfig, WatchReadContractsCallback, WatchReadContractsConfig, WatchWalletClientArgs, WatchWalletClientCallback, WatchWebSocketPublicClientCallback, WebSocketPublicClient, WriteContractArgs, WriteContractMode, WriteContractPreparedArgs, WriteContractResult, WriteContractUnpreparedArgs, configureChains, connect, createConfig, createStorage, deepEqual, deserialize, disconnect, erc20ABI, erc4626ABI, erc721ABI, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchToken, fetchTransaction, getAccount, getConfig, getContract, getNetwork, getPublicClient, getUnit, getWalletClient, getWebSocketPublicClient, multicall, noopStorage, prepareSendTransaction, prepareWriteContract, readContract, readContracts, sendTransaction, serialize, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchMulticall, watchNetwork, watchPendingTransactions, watchPublicClient, watchReadContract, watchReadContracts, watchWalletClient, watchWebSocketPublicClient, writeContract };
|
package/dist/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import "./chunk-KX4UEHS5.js";
|
|
|
2
2
|
import {
|
|
3
3
|
ChainMismatchError,
|
|
4
4
|
ChainNotConfiguredError,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Config,
|
|
6
|
+
ConfigChainsNotFound,
|
|
7
7
|
ConnectorAlreadyConnectedError,
|
|
8
8
|
ConnectorNotFoundError,
|
|
9
9
|
SwitchChainNotSupportedError,
|
|
10
10
|
configureChains,
|
|
11
11
|
connect,
|
|
12
|
-
|
|
12
|
+
createConfig,
|
|
13
13
|
createStorage,
|
|
14
14
|
deepEqual,
|
|
15
15
|
deserialize,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
fetchToken,
|
|
28
28
|
fetchTransaction,
|
|
29
29
|
getAccount,
|
|
30
|
-
|
|
30
|
+
getConfig,
|
|
31
31
|
getContract,
|
|
32
32
|
getNetwork,
|
|
33
33
|
getPublicClient,
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
watchWalletClient,
|
|
59
59
|
watchWebSocketPublicClient,
|
|
60
60
|
writeContract
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-YPGOLRBI.js";
|
|
62
62
|
import {
|
|
63
63
|
goerli,
|
|
64
64
|
mainnet,
|
|
@@ -74,8 +74,8 @@ import "./chunk-MQXBDTVK.js";
|
|
|
74
74
|
export {
|
|
75
75
|
ChainMismatchError,
|
|
76
76
|
ChainNotConfiguredError,
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
Config,
|
|
78
|
+
ConfigChainsNotFound,
|
|
79
79
|
Connector,
|
|
80
80
|
ConnectorAlreadyConnectedError,
|
|
81
81
|
ConnectorNotFoundError,
|
|
@@ -83,7 +83,7 @@ export {
|
|
|
83
83
|
SwitchChainNotSupportedError,
|
|
84
84
|
configureChains,
|
|
85
85
|
connect,
|
|
86
|
-
|
|
86
|
+
createConfig,
|
|
87
87
|
createStorage,
|
|
88
88
|
deepEqual,
|
|
89
89
|
deserialize,
|
|
@@ -101,7 +101,7 @@ export {
|
|
|
101
101
|
fetchToken,
|
|
102
102
|
fetchTransaction,
|
|
103
103
|
getAccount,
|
|
104
|
-
|
|
104
|
+
getConfig,
|
|
105
105
|
getContract,
|
|
106
106
|
getNetwork,
|
|
107
107
|
getPublicClient,
|
package/dist/internal/index.js
CHANGED
package/dist/internal/test.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@wagmi/core",
|
|
3
3
|
"description": "Vanilla JS library for Ethereum",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.0.0-next.
|
|
5
|
+
"version": "1.0.0-next.2",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/wagmi-dev/wagmi.git",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"/dist"
|
|
112
112
|
],
|
|
113
113
|
"peerDependencies": {
|
|
114
|
-
"viem": "~0.3.
|
|
114
|
+
"viem": "~0.3.16",
|
|
115
115
|
"typescript": ">=4.9.4"
|
|
116
116
|
},
|
|
117
117
|
"peerDependenciesMeta": {
|
|
@@ -124,10 +124,10 @@
|
|
|
124
124
|
"eventemitter3": "^4.0.7",
|
|
125
125
|
"zustand": "^4.3.1",
|
|
126
126
|
"@wagmi/chains": "0.2.18",
|
|
127
|
-
"@wagmi/connectors": "1.0.0-next.
|
|
127
|
+
"@wagmi/connectors": "1.0.0-next.3"
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
|
-
"viem": "~0.3.
|
|
130
|
+
"viem": "~0.3.16"
|
|
131
131
|
},
|
|
132
132
|
"keywords": [
|
|
133
133
|
"eth",
|