@getpara/evm-wallet-connectors 3.5.0 → 3.6.0
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/providers/EvmExternalWalletContext.js +18 -18
- package/dist/providers/ParaEvmContext.js +23 -10
- package/dist/providers/createParaWagmiConfig.js +13 -1
- package/dist/stores/wagmiConfigStore.d.ts +20 -1
- package/dist/stores/wagmiConfigStore.js +17 -3
- package/dist/utils/createWagmiConfigScope.d.ts +19 -0
- package/dist/utils/createWagmiConfigScope.js +40 -0
- package/dist/utils/getWalletConnectUri.js +1 -1
- package/package.json +5 -5
|
@@ -68,14 +68,14 @@ function EvmExternalWalletProvider({
|
|
|
68
68
|
const connectorsRef = useRef(connectors);
|
|
69
69
|
const [verificationStage, setVerificationStage] = useState("verifying");
|
|
70
70
|
useEffect(() => {
|
|
71
|
-
const initializeConfig = () => __async(
|
|
71
|
+
const initializeConfig = () => __async(null, null, function* () {
|
|
72
72
|
yield para.initExternalWalletProvider({
|
|
73
73
|
type: "EVM",
|
|
74
74
|
interface: {
|
|
75
|
-
disconnect: () => __async(
|
|
75
|
+
disconnect: () => __async(null, null, function* () {
|
|
76
76
|
yield disconnect(config);
|
|
77
77
|
}),
|
|
78
|
-
getAddress: () => __async(
|
|
78
|
+
getAddress: () => __async(null, null, function* () {
|
|
79
79
|
var _a, _b, _c;
|
|
80
80
|
const connections2 = getConnections(config);
|
|
81
81
|
const nonParaConnection = (_a = connections2.find((c) => {
|
|
@@ -85,7 +85,7 @@ function EvmExternalWalletProvider({
|
|
|
85
85
|
const address = (_c = (_b = nonParaConnection == null ? void 0 : nonParaConnection.accounts) == null ? void 0 : _b[0]) != null ? _c : null;
|
|
86
86
|
return address;
|
|
87
87
|
}),
|
|
88
|
-
signMessage: (_0) => __async(
|
|
88
|
+
signMessage: (_0) => __async(null, [_0], function* ({ message, address }) {
|
|
89
89
|
try {
|
|
90
90
|
const resp = yield signMessageBase({ message, address });
|
|
91
91
|
return { signature: resp.signature };
|
|
@@ -95,7 +95,7 @@ function EvmExternalWalletProvider({
|
|
|
95
95
|
}),
|
|
96
96
|
watchDisconnection: (callback) => {
|
|
97
97
|
return watchConnections(config, {
|
|
98
|
-
onChange: (connections2) => __async(
|
|
98
|
+
onChange: (connections2) => __async(null, null, function* () {
|
|
99
99
|
const nonParaConnections = connections2.filter((c) => c.connector.name !== "Para");
|
|
100
100
|
if (nonParaConnections.length === 0) {
|
|
101
101
|
yield callback();
|
|
@@ -127,7 +127,7 @@ function EvmExternalWalletProvider({
|
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
},
|
|
130
|
-
connectParaConnector: () => __async(
|
|
130
|
+
connectParaConnector: () => __async(null, null, function* () {
|
|
131
131
|
const connectors2 = getConnectors(config);
|
|
132
132
|
const paraConnector = connectors2.find((c) => {
|
|
133
133
|
return c.name === "Para";
|
|
@@ -144,7 +144,7 @@ function EvmExternalWalletProvider({
|
|
|
144
144
|
}, [para.isSetup]);
|
|
145
145
|
const updateExternalWalletState = useExternalWalletStore((state) => state.updateState);
|
|
146
146
|
const switchAccount = useCallback(
|
|
147
|
-
(connectorName) => __async(
|
|
147
|
+
(connectorName) => __async(null, null, function* () {
|
|
148
148
|
var _a;
|
|
149
149
|
const connector = (_a = connectionsRef.current.find((c) => {
|
|
150
150
|
var _a2;
|
|
@@ -161,7 +161,7 @@ function EvmExternalWalletProvider({
|
|
|
161
161
|
);
|
|
162
162
|
const getWalletBalance = useCallback(
|
|
163
163
|
// Format from wei to eth
|
|
164
|
-
() => __async(
|
|
164
|
+
() => __async(null, null, function* () {
|
|
165
165
|
const { data: balance } = yield getBalance();
|
|
166
166
|
return balance ? formatUnits(balance.value, etherUnits.wei) : void 0;
|
|
167
167
|
}),
|
|
@@ -183,7 +183,7 @@ function EvmExternalWalletProvider({
|
|
|
183
183
|
blockExplorerUrls: ((_a = chain.blockExplorers) == null ? void 0 : _a.default) ? [chain.blockExplorers.default.url] : void 0
|
|
184
184
|
};
|
|
185
185
|
};
|
|
186
|
-
const signMessageBase = (_0) => __async(
|
|
186
|
+
const signMessageBase = (_0) => __async(null, [_0], function* ({ message, address }) {
|
|
187
187
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
188
188
|
const connection = connectionsRef.current.find((c) => c.accounts.includes(address));
|
|
189
189
|
const connector = connection == null ? void 0 : connection.connector;
|
|
@@ -237,7 +237,7 @@ function EvmExternalWalletProvider({
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
|
-
const signMessage = (_0) => __async(
|
|
240
|
+
const signMessage = (_0) => __async(null, [_0], function* ({ message, externalWallet }) {
|
|
241
241
|
var _a;
|
|
242
242
|
let address = wagmiAddress;
|
|
243
243
|
if (externalWallet) {
|
|
@@ -250,7 +250,7 @@ function EvmExternalWalletProvider({
|
|
|
250
250
|
return { error: e.message };
|
|
251
251
|
}
|
|
252
252
|
});
|
|
253
|
-
const switchChain = (chainId2) => __async(
|
|
253
|
+
const switchChain = (chainId2) => __async(null, null, function* () {
|
|
254
254
|
var _a, _b, _c, _d;
|
|
255
255
|
let error;
|
|
256
256
|
try {
|
|
@@ -277,7 +277,7 @@ function EvmExternalWalletProvider({
|
|
|
277
277
|
}
|
|
278
278
|
return { error };
|
|
279
279
|
});
|
|
280
|
-
const connectBase = (connector) => __async(
|
|
280
|
+
const connectBase = (connector) => __async(null, null, function* () {
|
|
281
281
|
var _a, _b, _c, _d, _e, _f;
|
|
282
282
|
if (connector.type === "walletConnect" || ((_a = connector.paraDetails) == null ? void 0 : _a.internalId) === "WALLETCONNECT" || ((_b = connector.paraDetails) == null ? void 0 : _b.showQrModal)) {
|
|
283
283
|
yield emitWalletConnectUri(connector, connector.getUri);
|
|
@@ -293,7 +293,7 @@ function EvmExternalWalletProvider({
|
|
|
293
293
|
});
|
|
294
294
|
return (_f = data.accounts) == null ? void 0 : _f[0];
|
|
295
295
|
});
|
|
296
|
-
const connectCallback = (connector) => () => __async(
|
|
296
|
+
const connectCallback = (connector) => () => __async(null, null, function* () {
|
|
297
297
|
var _a, _b, _c, _d, _e, _f;
|
|
298
298
|
if (connector.type === "walletConnect" || ((_a = connector.paraDetails) == null ? void 0 : _a.internalId) === "WALLETCONNECT" || ((_b = connector.paraDetails) == null ? void 0 : _b.showQrModal)) {
|
|
299
299
|
yield emitWalletConnectUri(connector, connector.getUri);
|
|
@@ -332,7 +332,7 @@ function EvmExternalWalletProvider({
|
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
});
|
|
335
|
-
const connect = (connector) => __async(
|
|
335
|
+
const connect = (connector) => __async(null, null, function* () {
|
|
336
336
|
var _a;
|
|
337
337
|
updateExternalWalletState({ isConnecting: true });
|
|
338
338
|
yield disconnectAsync();
|
|
@@ -350,7 +350,7 @@ function EvmExternalWalletProvider({
|
|
|
350
350
|
updateExternalWalletState({ isConnecting: false });
|
|
351
351
|
return { address, authState, error };
|
|
352
352
|
});
|
|
353
|
-
const connectMobile = (connector, isManualWalletConnect) => __async(
|
|
353
|
+
const connectMobile = (connector, isManualWalletConnect) => __async(null, null, function* () {
|
|
354
354
|
const _isMobile = isManualWalletConnect !== void 0 ? isManualWalletConnect : isMobile();
|
|
355
355
|
const _connector = connector.walletConnectModalConnector && _isMobile ? connector.walletConnectModalConnector : connector;
|
|
356
356
|
return yield connect(_connector);
|
|
@@ -365,7 +365,7 @@ function EvmExternalWalletProvider({
|
|
|
365
365
|
);
|
|
366
366
|
return connector ? __spreadProps(__spreadValues({}, connector), { getUri: (_a = connector.paraDetails) == null ? void 0 : _a.getUri }) : void 0;
|
|
367
367
|
};
|
|
368
|
-
const requestInfo = (providerId) => __async(
|
|
368
|
+
const requestInfo = (providerId) => __async(null, null, function* () {
|
|
369
369
|
var _a, _b, _c, _d;
|
|
370
370
|
const connector = findConnector(providerId);
|
|
371
371
|
disconnectTypeRef.current = "ACCOUNT_LINKING";
|
|
@@ -393,7 +393,7 @@ function EvmExternalWalletProvider({
|
|
|
393
393
|
throw new Error((_d = e == null ? void 0 : e.message) != null ? _d : e);
|
|
394
394
|
}
|
|
395
395
|
});
|
|
396
|
-
const disconnectBase = (_0, ..._1) => __async(
|
|
396
|
+
const disconnectBase = (_0, ..._1) => __async(null, [_0, ..._1], function* (providerId, { disconnectType } = {}) {
|
|
397
397
|
var _a;
|
|
398
398
|
if (!providerId) {
|
|
399
399
|
throw new Error("Provider ID is required to disconnect");
|
|
@@ -497,7 +497,7 @@ function EvmExternalWalletProvider({
|
|
|
497
497
|
const address = (_a = connection == null ? void 0 : connection.accounts) == null ? void 0 : _a[0];
|
|
498
498
|
return address ? { isPresent: true, isConnected: true, address } : { isPresent: true, isConnected: false };
|
|
499
499
|
}, [connections]);
|
|
500
|
-
const connectParaEmbedded = useCallback(() => __async(
|
|
500
|
+
const connectParaEmbedded = useCallback(() => __async(null, null, function* () {
|
|
501
501
|
const paraConnectorInstance = connectors.find((c) => c.id === "para");
|
|
502
502
|
if (!paraConnectorInstance) {
|
|
503
503
|
return { error: "No para connector instance" };
|
|
@@ -6,16 +6,17 @@ import {
|
|
|
6
6
|
__spreadValues
|
|
7
7
|
} from "../chunk-MMUBH76A.js";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import { useEffect, useMemo,
|
|
9
|
+
import { useEffect, useMemo, useState } from "react";
|
|
10
10
|
import { createConfig as createWagmiConfig, WagmiProvider } from "wagmi";
|
|
11
11
|
import { connectorsForWallets } from "../wallets/connectorsForWallets.js";
|
|
12
12
|
import { http } from "viem";
|
|
13
13
|
import { computeWalletConnectMetaData } from "../utils/computeWalletConnectMetaData.js";
|
|
14
14
|
import { EvmExternalWalletProvider } from "./EvmExternalWalletContext.js";
|
|
15
15
|
import { paraConnector } from "@getpara/wagmi-v2-connector";
|
|
16
|
-
import { setWagmiConfig, getWagmiConfig } from "../stores/wagmiConfigStore.js";
|
|
16
|
+
import { setWagmiConfig, getWagmiConfig, getWagmiConfigSource, getWagmiConfigScope } from "../stores/wagmiConfigStore.js";
|
|
17
17
|
import { resolveWalletList } from "../utils/resolveWalletList.js";
|
|
18
18
|
import { farcasterWallet } from "../wallets/connectors/index.js";
|
|
19
|
+
import { areWagmiConfigScopesEqual, createWagmiConfigScope } from "../utils/createWagmiConfigScope.js";
|
|
19
20
|
const createDefaultTransports = (chains) => {
|
|
20
21
|
const transportsObject = chains.reduce((acc, chain) => {
|
|
21
22
|
const key = chain.id;
|
|
@@ -55,7 +56,9 @@ function ParaEvmProvider({
|
|
|
55
56
|
const propsWalletList = useMemo(() => {
|
|
56
57
|
return resolveWalletList(propsWallets != null ? propsWallets : []);
|
|
57
58
|
}, [propsWallets]);
|
|
58
|
-
const
|
|
59
|
+
const farcasterWalletList = useMemo(() => {
|
|
60
|
+
return [...propsWalletList, farcasterWallet];
|
|
61
|
+
}, [propsWalletList]);
|
|
59
62
|
const paraConnectorInstance = useMemo(() => {
|
|
60
63
|
return paraConnector({
|
|
61
64
|
para,
|
|
@@ -66,11 +69,21 @@ function ParaEvmProvider({
|
|
|
66
69
|
});
|
|
67
70
|
}, [para]);
|
|
68
71
|
const createConfig = (walletList, createFarcasterConnector) => {
|
|
72
|
+
const configScope = createWagmiConfigScope({
|
|
73
|
+
para,
|
|
74
|
+
appName,
|
|
75
|
+
appDescription,
|
|
76
|
+
appIcon,
|
|
77
|
+
appUrl,
|
|
78
|
+
projectId,
|
|
79
|
+
wallets: walletList,
|
|
80
|
+
chains,
|
|
81
|
+
transports
|
|
82
|
+
});
|
|
69
83
|
const existing = getWagmiConfig();
|
|
70
|
-
if (existing &&
|
|
84
|
+
if (existing && getWagmiConfigSource() === "factory" && areWagmiConfigScopesEqual(getWagmiConfigScope(), configScope)) {
|
|
71
85
|
return existing;
|
|
72
86
|
}
|
|
73
|
-
prevWallets.current = walletList;
|
|
74
87
|
const wcMetadata = computeWalletConnectMetaData({ appName, appDescription, appUrl, appIcon });
|
|
75
88
|
const baseConnectors = connectorsForWallets(walletList, {
|
|
76
89
|
para,
|
|
@@ -90,7 +103,7 @@ function ParaEvmProvider({
|
|
|
90
103
|
transports: transports || createDefaultTransports(chains),
|
|
91
104
|
connectors: allConnectors
|
|
92
105
|
}));
|
|
93
|
-
setWagmiConfig(createdConfig);
|
|
106
|
+
setWagmiConfig(createdConfig, "provider", configScope);
|
|
94
107
|
return createdConfig;
|
|
95
108
|
};
|
|
96
109
|
const [config, setConfig] = useState(null);
|
|
@@ -98,7 +111,7 @@ function ParaEvmProvider({
|
|
|
98
111
|
if (!para.isSetup) {
|
|
99
112
|
return;
|
|
100
113
|
}
|
|
101
|
-
const initializeConfig = () => __async(
|
|
114
|
+
const initializeConfig = () => __async(null, null, function* () {
|
|
102
115
|
var _a2;
|
|
103
116
|
let config2;
|
|
104
117
|
if (para.isFarcasterMiniApp) {
|
|
@@ -107,14 +120,14 @@ function ParaEvmProvider({
|
|
|
107
120
|
createFarcasterConnector = (_a2 = (yield import("@farcaster/miniapp-wagmi-connector")).farcasterMiniApp) != null ? _a2 : void 0;
|
|
108
121
|
} catch (e) {
|
|
109
122
|
}
|
|
110
|
-
config2 = createConfig(
|
|
123
|
+
config2 = createConfig(farcasterWalletList, createFarcasterConnector);
|
|
111
124
|
} else {
|
|
112
|
-
config2 = createConfig(
|
|
125
|
+
config2 = createConfig(propsWalletList);
|
|
113
126
|
}
|
|
114
127
|
setConfig(config2);
|
|
115
128
|
});
|
|
116
129
|
initializeConfig();
|
|
117
|
-
}, [para.isFarcasterMiniApp, para.isSetup, propsWalletList]);
|
|
130
|
+
}, [farcasterWalletList, para.isFarcasterMiniApp, para.isSetup, propsWalletList]);
|
|
118
131
|
if (!config) {
|
|
119
132
|
return null;
|
|
120
133
|
}
|
|
@@ -10,6 +10,7 @@ import { computeWalletConnectMetaData } from "../utils/computeWalletConnectMetaD
|
|
|
10
10
|
import { paraConnector } from "@getpara/wagmi-v2-connector";
|
|
11
11
|
import { setWagmiConfig } from "../stores/wagmiConfigStore.js";
|
|
12
12
|
import { resolveWalletList } from "../utils/resolveWalletList.js";
|
|
13
|
+
import { createWagmiConfigScope } from "../utils/createWagmiConfigScope.js";
|
|
13
14
|
function createParaWagmiConfig(para, cfg) {
|
|
14
15
|
const _a = cfg, {
|
|
15
16
|
projectId,
|
|
@@ -34,6 +35,17 @@ function createParaWagmiConfig(para, cfg) {
|
|
|
34
35
|
]);
|
|
35
36
|
const wcMetadata = computeWalletConnectMetaData({ appName, appDescription, appUrl, appIcon });
|
|
36
37
|
const walletFactories = resolveWalletList(wallets);
|
|
38
|
+
const configScope = createWagmiConfigScope({
|
|
39
|
+
para,
|
|
40
|
+
appName,
|
|
41
|
+
appDescription,
|
|
42
|
+
appIcon,
|
|
43
|
+
appUrl,
|
|
44
|
+
projectId,
|
|
45
|
+
wallets: walletFactories,
|
|
46
|
+
chains,
|
|
47
|
+
transports
|
|
48
|
+
});
|
|
37
49
|
const baseConnectors = connectorsForWallets(walletFactories, {
|
|
38
50
|
para,
|
|
39
51
|
projectId,
|
|
@@ -57,7 +69,7 @@ function createParaWagmiConfig(para, cfg) {
|
|
|
57
69
|
transports,
|
|
58
70
|
connectors: [...baseConnectors, paraConn]
|
|
59
71
|
}));
|
|
60
|
-
setWagmiConfig(created);
|
|
72
|
+
setWagmiConfig(created, "factory", configScope);
|
|
61
73
|
return created;
|
|
62
74
|
}
|
|
63
75
|
export {
|
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
import type { Config } from 'wagmi';
|
|
2
|
+
import type ParaWeb from '@getpara/web-sdk';
|
|
3
|
+
type WagmiConfigSource = 'factory' | 'provider';
|
|
4
|
+
export interface WagmiConfigScope {
|
|
5
|
+
para: ParaWeb;
|
|
6
|
+
appName: string;
|
|
7
|
+
appDescription?: string;
|
|
8
|
+
appUrl?: string;
|
|
9
|
+
appIcon?: string;
|
|
10
|
+
projectId: string;
|
|
11
|
+
chainIds: readonly number[];
|
|
12
|
+
transportChainIds: readonly number[];
|
|
13
|
+
walletIds: readonly string[];
|
|
14
|
+
}
|
|
2
15
|
/**
|
|
3
16
|
* Sets the Wagmi configuration in the global store.
|
|
4
17
|
*
|
|
5
18
|
* @param config - The Wagmi configuration object to be stored
|
|
19
|
+
* @param source - The owner that created the Wagmi configuration
|
|
20
|
+
* @param scope - The config fingerprint used to match app-created configs to provider configs
|
|
6
21
|
* @returns {void}
|
|
7
22
|
*/
|
|
8
|
-
export declare const setWagmiConfig: (config: Config) => void;
|
|
23
|
+
export declare const setWagmiConfig: (config: Config, source?: WagmiConfigSource, scope?: WagmiConfigScope) => void;
|
|
9
24
|
/**
|
|
10
25
|
* Retrieves the current Wagmi configuration from the global store.
|
|
11
26
|
*
|
|
12
27
|
* @returns {Config | null} - The current Wagmi configuration or null if not set
|
|
13
28
|
*/
|
|
14
29
|
export declare const getWagmiConfig: () => Config;
|
|
30
|
+
export declare const getWagmiConfigSource: () => WagmiConfigSource;
|
|
31
|
+
export declare const getWagmiConfigScope: () => WagmiConfigScope;
|
|
32
|
+
export declare const resetWagmiConfig: () => void;
|
|
33
|
+
export {};
|
|
@@ -2,15 +2,29 @@
|
|
|
2
2
|
import "../chunk-MMUBH76A.js";
|
|
3
3
|
import { createStore } from "zustand/vanilla";
|
|
4
4
|
const wagmiConfigStore = createStore(() => ({
|
|
5
|
-
config: null
|
|
5
|
+
config: null,
|
|
6
|
+
source: null,
|
|
7
|
+
scope: null
|
|
6
8
|
}));
|
|
7
|
-
const setWagmiConfig = (config) => {
|
|
8
|
-
wagmiConfigStore.setState({ config });
|
|
9
|
+
const setWagmiConfig = (config, source = "provider", scope) => {
|
|
10
|
+
wagmiConfigStore.setState({ config, source, scope: scope != null ? scope : null });
|
|
9
11
|
};
|
|
10
12
|
const getWagmiConfig = () => {
|
|
11
13
|
return wagmiConfigStore.getState().config;
|
|
12
14
|
};
|
|
15
|
+
const getWagmiConfigSource = () => {
|
|
16
|
+
return wagmiConfigStore.getState().source;
|
|
17
|
+
};
|
|
18
|
+
const getWagmiConfigScope = () => {
|
|
19
|
+
return wagmiConfigStore.getState().scope;
|
|
20
|
+
};
|
|
21
|
+
const resetWagmiConfig = () => {
|
|
22
|
+
wagmiConfigStore.setState({ config: null, source: null, scope: null });
|
|
23
|
+
};
|
|
13
24
|
export {
|
|
14
25
|
getWagmiConfig,
|
|
26
|
+
getWagmiConfigScope,
|
|
27
|
+
getWagmiConfigSource,
|
|
28
|
+
resetWagmiConfig,
|
|
15
29
|
setWagmiConfig
|
|
16
30
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type ParaWeb from '@getpara/web-sdk';
|
|
2
|
+
import type { TExternalWallet } from '@getpara/react-common';
|
|
3
|
+
import type { Chain, Transport } from 'viem';
|
|
4
|
+
import type { WalletList } from '../types/Wallet.js';
|
|
5
|
+
import type { WagmiConfigScope } from '../stores/wagmiConfigStore.js';
|
|
6
|
+
interface CreateWagmiConfigScopeParameters {
|
|
7
|
+
para: ParaWeb;
|
|
8
|
+
appName: string;
|
|
9
|
+
appDescription?: string;
|
|
10
|
+
appUrl?: string;
|
|
11
|
+
appIcon?: string;
|
|
12
|
+
projectId: string;
|
|
13
|
+
wallets?: WalletList | TExternalWallet[];
|
|
14
|
+
chains: readonly Chain[];
|
|
15
|
+
transports?: Record<number, Transport>;
|
|
16
|
+
}
|
|
17
|
+
export declare const createWagmiConfigScope: ({ para, appName, appDescription, appUrl, appIcon, projectId, wallets, chains, transports, }: CreateWagmiConfigScopeParameters) => WagmiConfigScope;
|
|
18
|
+
export declare const areWagmiConfigScopesEqual: (left: WagmiConfigScope | null, right: WagmiConfigScope) => boolean;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
|
+
import { resolveWalletList } from "./resolveWalletList.js";
|
|
4
|
+
const toNumberKeys = (value) => {
|
|
5
|
+
return Object.keys(value != null ? value : {}).map(Number);
|
|
6
|
+
};
|
|
7
|
+
const areArraysEqual = (left, right) => {
|
|
8
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
9
|
+
};
|
|
10
|
+
const createWagmiConfigScope = ({
|
|
11
|
+
para,
|
|
12
|
+
appName,
|
|
13
|
+
appDescription,
|
|
14
|
+
appUrl,
|
|
15
|
+
appIcon,
|
|
16
|
+
projectId,
|
|
17
|
+
wallets,
|
|
18
|
+
chains,
|
|
19
|
+
transports
|
|
20
|
+
}) => {
|
|
21
|
+
const walletIds = resolveWalletList(wallets).map((createWallet) => createWallet({ projectId, appName }).id);
|
|
22
|
+
return {
|
|
23
|
+
para,
|
|
24
|
+
appName,
|
|
25
|
+
appDescription,
|
|
26
|
+
appUrl,
|
|
27
|
+
appIcon,
|
|
28
|
+
projectId,
|
|
29
|
+
chainIds: chains.map((chain) => chain.id),
|
|
30
|
+
transportChainIds: toNumberKeys(transports),
|
|
31
|
+
walletIds
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const areWagmiConfigScopesEqual = (left, right) => {
|
|
35
|
+
return !!left && left.para === right.para && left.appName === right.appName && left.appDescription === right.appDescription && left.appUrl === right.appUrl && left.appIcon === right.appIcon && left.projectId === right.projectId && areArraysEqual(left.chainIds, right.chainIds) && areArraysEqual(left.transportChainIds, right.transportChainIds) && areArraysEqual(left.walletIds, right.walletIds);
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
areWagmiConfigScopesEqual,
|
|
39
|
+
createWagmiConfigScope
|
|
40
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
__async
|
|
4
4
|
} from "../chunk-MMUBH76A.js";
|
|
5
|
-
const emitWalletConnectUri = (connector, uriConverter) => __async(
|
|
5
|
+
const emitWalletConnectUri = (connector, uriConverter) => __async(null, null, function* () {
|
|
6
6
|
var _a, _b;
|
|
7
7
|
if (typeof window === "undefined") {
|
|
8
8
|
return;
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/evm-wallet-connectors",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@coinbase/wallet-sdk": "4.3.0",
|
|
6
|
-
"@getpara/wagmi-v2-connector": "3.
|
|
7
|
-
"@getpara/web-sdk": "3.
|
|
6
|
+
"@getpara/wagmi-v2-connector": "3.6.0",
|
|
7
|
+
"@getpara/web-sdk": "3.6.0",
|
|
8
8
|
"@walletconnect/ethereum-provider": "2.23.0",
|
|
9
9
|
"zustand": "^4.5.2",
|
|
10
10
|
"zustand-sync-tabs": "^0.2.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@getpara/react-common": "3.
|
|
13
|
+
"@getpara/react-common": "3.6.0",
|
|
14
14
|
"@tanstack/react-query": "^5.74.0",
|
|
15
15
|
"@types/react": "^18.3.3",
|
|
16
16
|
"@types/react-dom": "^18.3.0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dist",
|
|
27
27
|
"package.json"
|
|
28
28
|
],
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "565535ab0cf38d65f6996fc9f1ede52d133ddac0",
|
|
30
30
|
"main": "dist/index.js",
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@farcaster/miniapp-wagmi-connector": "^1.0.0",
|