@wagmi/core 0.8.0 → 0.8.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-F4A7FMUQ.js → chunk-63RNYADG.js} +15 -8
- package/dist/{chunk-VCRGL4ZG.js → chunk-6E4ZWCDO.js} +17 -5
- package/dist/connectors/coinbaseWallet.js +1 -1
- package/dist/connectors/metaMask.d.ts +2 -2
- package/dist/connectors/metaMask.js +3 -1
- package/dist/connectors/mock/index.d.ts +8 -5
- package/dist/connectors/mock/index.js +2 -2
- package/dist/connectors/walletConnect.js +1 -1
- package/dist/{index-971cda79.d.ts → index-37d6352e.d.ts} +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/{injected-610c34b6.d.ts → injected-27788d9f.d.ts} +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/test.d.ts +1 -1
- package/dist/internal/test.js +2 -2
- package/dist/providers/alchemy.d.ts +1 -1
- package/dist/providers/infura.d.ts +1 -1
- package/dist/providers/jsonRpc.d.ts +1 -1
- package/dist/providers/public.d.ts +1 -1
- package/package.json +2 -2
|
@@ -340,6 +340,8 @@ function getInjectedName(ethereum) {
|
|
|
340
340
|
return "1inch Wallet";
|
|
341
341
|
if (provider.isOpera)
|
|
342
342
|
return "Opera";
|
|
343
|
+
if (provider.isPhantom)
|
|
344
|
+
return "Phantom";
|
|
343
345
|
if (provider.isPortal)
|
|
344
346
|
return "Ripio Portal";
|
|
345
347
|
if (provider.isTally)
|
|
@@ -807,8 +809,8 @@ var Client = class {
|
|
|
807
809
|
let chainId;
|
|
808
810
|
if (autoConnect) {
|
|
809
811
|
try {
|
|
810
|
-
const rawState = storage.getItem(storeKey
|
|
811
|
-
const data =
|
|
812
|
+
const rawState = storage.getItem(storeKey);
|
|
813
|
+
const data = rawState?.state?.data;
|
|
812
814
|
status = data?.account ? "reconnecting" : "connecting";
|
|
813
815
|
chainId = data?.chain?.id;
|
|
814
816
|
} catch (_error) {
|
|
@@ -3249,11 +3251,11 @@ async function signTypedData({
|
|
|
3249
3251
|
const chainId = chainId_ ? normalizeChainId(chainId_) : void 0;
|
|
3250
3252
|
if (chainId)
|
|
3251
3253
|
assertActiveChain({ chainId, signer });
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
);
|
|
3254
|
+
const types_ = Object.entries(types).filter(([key]) => key !== "EIP712Domain").reduce((types2, [key, attributes]) => {
|
|
3255
|
+
types2[key] = attributes.filter((attr) => attr.type !== "EIP712Domain");
|
|
3256
|
+
return types2;
|
|
3257
|
+
}, {});
|
|
3258
|
+
return signer._signTypedData(domain, types_, value);
|
|
3257
3259
|
}
|
|
3258
3260
|
|
|
3259
3261
|
// src/actions/accounts/switchNetwork.ts
|
|
@@ -3308,7 +3310,12 @@ function watchNetwork(callback, { selector = (x) => x } = {}) {
|
|
|
3308
3310
|
import shallow5 from "zustand/shallow";
|
|
3309
3311
|
function watchSigner({ chainId }, callback) {
|
|
3310
3312
|
const client2 = getClient();
|
|
3311
|
-
const handleChange = async () =>
|
|
3313
|
+
const handleChange = async () => {
|
|
3314
|
+
const signer = await fetchSigner({ chainId });
|
|
3315
|
+
if (!getClient().connector)
|
|
3316
|
+
return callback(null);
|
|
3317
|
+
return callback(signer);
|
|
3318
|
+
};
|
|
3312
3319
|
const unsubscribe = client2.subscribe(
|
|
3313
3320
|
({ data, connector }) => ({
|
|
3314
3321
|
account: data?.account,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Connector,
|
|
3
3
|
UserRejectedRequestError,
|
|
4
4
|
normalizeChainId
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-63RNYADG.js";
|
|
6
6
|
import {
|
|
7
7
|
__privateAdd,
|
|
8
8
|
__privateGet,
|
|
@@ -20,7 +20,7 @@ import { default as EventEmitter } from "eventemitter3";
|
|
|
20
20
|
var _options, _signer;
|
|
21
21
|
var MockProvider = class extends providers.BaseProvider {
|
|
22
22
|
constructor(options) {
|
|
23
|
-
super({ name: "Network", chainId: options.chainId
|
|
23
|
+
super({ name: "Network", chainId: options.chainId });
|
|
24
24
|
this.events = new EventEmitter();
|
|
25
25
|
__privateAdd(this, _options, void 0);
|
|
26
26
|
__privateAdd(this, _signer, void 0);
|
|
@@ -87,8 +87,17 @@ _signer = new WeakMap();
|
|
|
87
87
|
// src/connectors/mock/connector.ts
|
|
88
88
|
var _provider, _switchChain, switchChain_fn;
|
|
89
89
|
var MockConnector = class extends Connector {
|
|
90
|
-
constructor(
|
|
91
|
-
|
|
90
|
+
constructor({
|
|
91
|
+
chains,
|
|
92
|
+
options
|
|
93
|
+
}) {
|
|
94
|
+
super({
|
|
95
|
+
chains,
|
|
96
|
+
options: {
|
|
97
|
+
...options,
|
|
98
|
+
chainId: options.chainId ?? chains?.[0]?.id
|
|
99
|
+
}
|
|
100
|
+
});
|
|
92
101
|
__privateAdd(this, _switchChain);
|
|
93
102
|
this.id = "mock";
|
|
94
103
|
this.name = "Mock";
|
|
@@ -147,7 +156,10 @@ var MockConnector = class extends Connector {
|
|
|
147
156
|
}
|
|
148
157
|
async getProvider({ chainId } = {}) {
|
|
149
158
|
if (!__privateGet(this, _provider) || chainId)
|
|
150
|
-
__privateSet(this, _provider, new MockProvider({
|
|
159
|
+
__privateSet(this, _provider, new MockProvider({
|
|
160
|
+
...this.options,
|
|
161
|
+
chainId: chainId ?? this.options.chainId ?? this.chains[0].id
|
|
162
|
+
}));
|
|
151
163
|
return __privateGet(this, _provider);
|
|
152
164
|
}
|
|
153
165
|
async getSigner() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Chain } from '@wagmi/chains';
|
|
2
|
-
import { E as Ethereum } from '../index-
|
|
3
|
-
import { a as InjectedConnectorOptions, I as InjectedConnector } from '../injected-
|
|
2
|
+
import { E as Ethereum } from '../index-37d6352e.js';
|
|
3
|
+
import { a as InjectedConnectorOptions, I as InjectedConnector } from '../injected-27788d9f.js';
|
|
4
4
|
import 'abitype';
|
|
5
5
|
import 'ethers';
|
|
6
6
|
import '../base-a82112a9.js';
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
ResourceUnavailableError,
|
|
5
5
|
UserRejectedRequestError,
|
|
6
6
|
getClient
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-63RNYADG.js";
|
|
8
8
|
import "../chunk-6KG5TOAU.js";
|
|
9
9
|
import {
|
|
10
10
|
__privateAdd,
|
|
@@ -35,6 +35,8 @@ var MetaMaskConnector = class extends InjectedConnector {
|
|
|
35
35
|
return;
|
|
36
36
|
if (ethereum.isKuCoinWallet)
|
|
37
37
|
return;
|
|
38
|
+
if (ethereum.isPhantom)
|
|
39
|
+
return;
|
|
38
40
|
if (ethereum.isPortal)
|
|
39
41
|
return;
|
|
40
42
|
if (ethereum.isTokenPocket)
|
|
@@ -3,11 +3,11 @@ import { providers } from 'ethers';
|
|
|
3
3
|
import { Chain } from '@wagmi/chains';
|
|
4
4
|
import { C as Connector, a as ConnectorData } from '../../base-a82112a9.js';
|
|
5
5
|
import EventEmitter from 'eventemitter3';
|
|
6
|
-
import { S as Signer } from '../../index-
|
|
6
|
+
import { S as Signer } from '../../index-37d6352e.js';
|
|
7
7
|
import 'abitype';
|
|
8
8
|
|
|
9
9
|
type MockProviderOptions = {
|
|
10
|
-
chainId
|
|
10
|
+
chainId: number;
|
|
11
11
|
flags?: {
|
|
12
12
|
isAuthorized?: boolean;
|
|
13
13
|
failConnect?: boolean;
|
|
@@ -44,14 +44,17 @@ declare class MockProvider extends providers.BaseProvider {
|
|
|
44
44
|
toJSON(): string;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
type MockConnectorOptions = Omit<MockProviderOptions, 'chainId'> & {
|
|
48
|
+
chainId?: number;
|
|
49
|
+
};
|
|
50
|
+
declare class MockConnector extends Connector<MockProvider, MockConnectorOptions> {
|
|
48
51
|
#private;
|
|
49
52
|
readonly id = "mock";
|
|
50
53
|
readonly name = "Mock";
|
|
51
54
|
readonly ready = true;
|
|
52
|
-
constructor(
|
|
55
|
+
constructor({ chains, options, }: {
|
|
53
56
|
chains?: Chain[];
|
|
54
|
-
options:
|
|
57
|
+
options: MockConnectorOptions;
|
|
55
58
|
});
|
|
56
59
|
connect({ chainId }?: {
|
|
57
60
|
chainId?: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MockConnector,
|
|
3
3
|
MockProvider
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
4
|
+
} from "../../chunk-6E4ZWCDO.js";
|
|
5
|
+
import "../../chunk-63RNYADG.js";
|
|
6
6
|
import "../../chunk-6KG5TOAU.js";
|
|
7
7
|
import "../../chunk-MQXBDTVK.js";
|
|
8
8
|
export {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,17 +2,17 @@ import * as _wagmi_chains from '@wagmi/chains';
|
|
|
2
2
|
import { Chain } from '@wagmi/chains';
|
|
3
3
|
export { Chain, goerli, mainnet } from '@wagmi/chains';
|
|
4
4
|
import { Mutate, StoreApi } from 'zustand/vanilla';
|
|
5
|
-
import { P as Provider, W as WebSocketProvider, U as Unit, S as Signer, H as Hash, C as ChainProviderFn, a as ProviderWithFallbackConfig } from './index-
|
|
6
|
-
export { C as ChainProviderFn, E as Ethereum, F as FallbackProviderConfig, H as Hash, P as Provider, a as ProviderWithFallbackConfig, S as Signer, U as Unit, W as WebSocketProvider, u as units } from './index-
|
|
5
|
+
import { P as Provider, W as WebSocketProvider, U as Unit, S as Signer, H as Hash, C as ChainProviderFn, a as ProviderWithFallbackConfig } from './index-37d6352e.js';
|
|
6
|
+
export { C as ChainProviderFn, E as Ethereum, F as FallbackProviderConfig, H as Hash, P as Provider, a as ProviderWithFallbackConfig, S as Signer, U as Unit, W as WebSocketProvider, u as units } from './index-37d6352e.js';
|
|
7
7
|
import { C as Connector, a as ConnectorData } from './base-a82112a9.js';
|
|
8
8
|
export { C as Connector, a as ConnectorData, b as ConnectorEvents } from './base-a82112a9.js';
|
|
9
|
-
import * as abitype from 'abitype';
|
|
10
9
|
import { Address, ResolvedConfig, TypedDataDomain, Narrow, TypedData, TypedDataToPrimitiveTypes, Abi, ExtractAbiFunction, ExtractAbiEventNames, AbiParametersToPrimitiveTypes, ExtractAbiEvent, AbiFunction, AbiParameter, AbiParameterToPrimitiveType, AbiEvent, ExtractAbiFunctionNames } from 'abitype';
|
|
11
10
|
export { Address } from 'abitype';
|
|
12
11
|
import { PopulatedTransaction, Signer as Signer$1, providers, Contract as Contract$1, ethers, ContractInterface } from 'ethers';
|
|
13
12
|
import { O as Options$2, D as DefaultOptions, G as GetConfig$1, a as GetOverridesForAbiStateMutability, U as UnionToIntersection, C as CountOccurrences, A as AbiItemName, I as IsUnknown, E as Event, b as ContractsConfig, c as ContractsResult, d as GetReturnType, e as Or, f as IsNever, N as NotEqual } from './contracts-3880ee54.js';
|
|
14
13
|
import { TransactionResponse } from '@ethersproject/providers';
|
|
15
|
-
export { I as InjectedConnector, a as InjectedConnectorOptions } from './injected-
|
|
14
|
+
export { I as InjectedConnector, a as InjectedConnectorOptions } from './injected-27788d9f.js';
|
|
15
|
+
import * as abitype_dist_abi_b1bae27f from 'abitype/dist/abi-b1bae27f';
|
|
16
16
|
import 'eventemitter3';
|
|
17
17
|
|
|
18
18
|
type BaseStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
|
|
@@ -1736,7 +1736,7 @@ declare function deserialize(cachedString: string): any;
|
|
|
1736
1736
|
declare function minimizeContractInterface<TAbi extends Abi | readonly unknown[]>(config: {
|
|
1737
1737
|
abi: TAbi;
|
|
1738
1738
|
functionName: TAbi extends Abi ? ExtractAbiFunctionNames<TAbi> : string;
|
|
1739
|
-
}): string[] | (
|
|
1739
|
+
}): string[] | (abitype_dist_abi_b1bae27f.q | abitype_dist_abi_b1bae27f.p | abitype_dist_abi_b1bae27f.o)[];
|
|
1740
1740
|
|
|
1741
1741
|
declare function normalizeChainId(chainId: string | number | bigint): number;
|
|
1742
1742
|
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Chain } from '@wagmi/chains';
|
|
|
2
2
|
import { Address } from 'abitype';
|
|
3
3
|
import { providers } from 'ethers';
|
|
4
4
|
import { C as Connector } from './base-a82112a9.js';
|
|
5
|
-
import { E as Ethereum } from './index-
|
|
5
|
+
import { E as Ethereum } from './index-37d6352e.js';
|
|
6
6
|
|
|
7
7
|
type InjectedConnectorOptions = {
|
|
8
8
|
/** Name of connector */
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { g as AbiParameter, h as ContractConfig, b as ContractsConfig, c as ContractsResult, E as Event, i as GetArgs, G as GetConfig, d as GetReturnType, f as IsNever, N as NotEqual, j as Optional, e as Or } from '../contracts-3880ee54.js';
|
|
2
|
-
import '../index-
|
|
2
|
+
import '../index-37d6352e.js';
|
|
3
3
|
import 'abitype';
|
|
4
4
|
import 'ethers';
|
|
5
5
|
import '@wagmi/chains';
|
package/dist/internal/index.js
CHANGED
package/dist/internal/test.d.ts
CHANGED
package/dist/internal/test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { providers } from 'ethers';
|
|
2
2
|
import { Chain } from '@wagmi/chains';
|
|
3
|
-
import { F as FallbackProviderConfig, C as ChainProviderFn } from '../index-
|
|
3
|
+
import { F as FallbackProviderConfig, C as ChainProviderFn } from '../index-37d6352e.js';
|
|
4
4
|
import 'abitype';
|
|
5
5
|
|
|
6
6
|
type JsonRpcProviderConfig = FallbackProviderConfig & {
|
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": "0.8.
|
|
5
|
+
"version": "0.8.2",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/wagmi-dev/wagmi.git",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"@wagmi/chains": "^0.1.0",
|
|
103
|
-
"abitype": "^0.
|
|
103
|
+
"abitype": "^0.2.5",
|
|
104
104
|
"eventemitter3": "^4.0.7",
|
|
105
105
|
"zustand": "^4.1.4"
|
|
106
106
|
},
|