@getpara/evm-wallet-connectors 2.0.0-alpha.22 → 2.0.0-alpha.24
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/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createParaWagmiConfig } from './providers/createParaWagmiConfig.js';
|
|
2
2
|
export { EvmExternalWalletContext } from './providers/EvmExternalWalletContext.js';
|
|
3
|
-
export { type EvmExternalWalletContextType
|
|
3
|
+
export { type EvmExternalWalletContextType } from './providers/EvmExternalWalletContext.js';
|
|
4
4
|
export { ParaEvmProvider } from './providers/ParaEvmContext.js';
|
|
5
5
|
export type { ParaEvmProviderProps, ParaEvmProviderConfig, ParaWagmiProviderProps } from './providers/ParaEvmContext.js';
|
|
6
6
|
export { getWagmiConfig } from './stores/wagmiConfigStore.js';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import "./chunk-MMUBH76A.js";
|
|
3
3
|
import { createParaWagmiConfig } from "./providers/createParaWagmiConfig.js";
|
|
4
4
|
import { EvmExternalWalletContext } from "./providers/EvmExternalWalletContext.js";
|
|
5
|
-
import { defaultEvmExternalWallet } from "./providers/EvmExternalWalletContext.js";
|
|
6
5
|
import { ParaEvmProvider } from "./providers/ParaEvmContext.js";
|
|
7
6
|
import { getWagmiConfig } from "./stores/wagmiConfigStore.js";
|
|
8
7
|
export * from "./wallets/connectors/index.js";
|
|
@@ -10,6 +9,5 @@ export {
|
|
|
10
9
|
EvmExternalWalletContext,
|
|
11
10
|
ParaEvmProvider,
|
|
12
11
|
createParaWagmiConfig,
|
|
13
|
-
defaultEvmExternalWallet,
|
|
14
12
|
getWagmiConfig
|
|
15
13
|
};
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import type
|
|
3
|
-
import { ExternalWalletInfo } from '@getpara/web-sdk';
|
|
4
|
-
export declare const defaultEvmExternalWallet: {
|
|
5
|
-
wallets: any[];
|
|
6
|
-
chains: any[];
|
|
7
|
-
chainId: any;
|
|
8
|
-
username: any;
|
|
9
|
-
avatar: any;
|
|
10
|
-
balance: any;
|
|
11
|
-
disconnect: () => Promise<void>;
|
|
12
|
-
switchChain: () => Promise<void>;
|
|
13
|
-
connectParaEmbedded: () => Promise<{}>;
|
|
14
|
-
signMessage: () => Promise<{}>;
|
|
15
|
-
signVerificationMessage: () => Promise<{}>;
|
|
16
|
-
getWalletBalance: () => Promise<any>;
|
|
17
|
-
requestInfo: () => Promise<ExternalWalletInfo>;
|
|
18
|
-
disconnectBase: () => Promise<void>;
|
|
19
|
-
};
|
|
2
|
+
import { type BalanceManagement, type ChainManagement, type ConnectParaEmbedded, type ExternalWalletContextType, type ExternalWalletProviderConfigBase } from '@getpara/react-common';
|
|
20
3
|
export type EvmExternalWalletContextType = ExternalWalletContextType & ChainManagement<number> & BalanceManagement & ConnectParaEmbedded & {
|
|
21
4
|
username?: string;
|
|
22
5
|
avatar?: string;
|
|
@@ -22,24 +22,11 @@ import { isEIP6963Connector } from "../utils/isEIP6963Connector.js";
|
|
|
22
22
|
import { getWalletConnectUri } from "../utils/getWalletConnectUri.js";
|
|
23
23
|
import { normalize } from "viem/ens";
|
|
24
24
|
import { useExternalWalletStore } from "../stores/useStore.js";
|
|
25
|
+
import {
|
|
26
|
+
defaultEvmExternalWallet
|
|
27
|
+
} from "@getpara/react-common";
|
|
25
28
|
import { isMobile } from "@getpara/web-sdk";
|
|
26
29
|
import { etherUnits, formatUnits } from "viem";
|
|
27
|
-
const defaultEvmExternalWallet = {
|
|
28
|
-
wallets: [],
|
|
29
|
-
chains: [],
|
|
30
|
-
chainId: void 0,
|
|
31
|
-
username: void 0,
|
|
32
|
-
avatar: void 0,
|
|
33
|
-
balance: void 0,
|
|
34
|
-
disconnect: () => Promise.resolve(),
|
|
35
|
-
switchChain: () => Promise.resolve(),
|
|
36
|
-
connectParaEmbedded: () => Promise.resolve({}),
|
|
37
|
-
signMessage: () => Promise.resolve({}),
|
|
38
|
-
signVerificationMessage: () => Promise.resolve({}),
|
|
39
|
-
getWalletBalance: () => Promise.resolve(void 0),
|
|
40
|
-
requestInfo: () => Promise.resolve({}),
|
|
41
|
-
disconnectBase: () => Promise.resolve()
|
|
42
|
-
};
|
|
43
30
|
const EvmExternalWalletContext = createContext(defaultEvmExternalWallet);
|
|
44
31
|
function EvmExternalWalletProvider({
|
|
45
32
|
children,
|
|
@@ -311,10 +298,6 @@ function EvmExternalWalletProvider({
|
|
|
311
298
|
const _connector = connector.walletConnectModalConnector && _isMobile ? connector.walletConnectModalConnector : connector;
|
|
312
299
|
return yield connect(_connector);
|
|
313
300
|
});
|
|
314
|
-
const getQrUri = (connector) => () => {
|
|
315
|
-
var _a;
|
|
316
|
-
return getWalletConnectUri(connector, (_a = connector.paraDetails) == null ? void 0 : _a.getUri);
|
|
317
|
-
};
|
|
318
301
|
const requestInfo = (providerId) => __async(this, null, function* () {
|
|
319
302
|
var _a, _b;
|
|
320
303
|
const connector = connectors.find((c) => {
|
|
@@ -381,14 +364,18 @@ function EvmExternalWalletProvider({
|
|
|
381
364
|
return c;
|
|
382
365
|
}).filter((c) => !!c);
|
|
383
366
|
const wallets = dedupedConnectors.map((c) => {
|
|
367
|
+
var _a, _b, _c;
|
|
368
|
+
if (((_a = c.paraDetails) == null ? void 0 : _a.internalId) === "SAFE" && (typeof window === "undefined" || window.parent === window)) {
|
|
369
|
+
return void 0;
|
|
370
|
+
}
|
|
384
371
|
const connector = __spreadValues(__spreadValues({}, c), c.paraDetails);
|
|
385
|
-
|
|
372
|
+
const supportsWalletConnect = connector.type === "walletConnect" || ((_b = connector.paraDetails) == null ? void 0 : _b.internalId) === "WALLETCONNECT" || ((_c = connector.paraDetails) == null ? void 0 : _c.showQrModal);
|
|
373
|
+
return __spreadValues(__spreadProps(__spreadValues({}, connector), {
|
|
386
374
|
connect: () => connect(connector),
|
|
387
|
-
connectMobile: (
|
|
388
|
-
type: "EVM"
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
});
|
|
375
|
+
connectMobile: (manual) => connectMobile(connector, manual),
|
|
376
|
+
type: "EVM"
|
|
377
|
+
}), supportsWalletConnect && { getQrUri: () => getWalletConnectUri(connector, connector.getUri) });
|
|
378
|
+
}).filter(Boolean);
|
|
392
379
|
const getConnectorInfo = (connector) => {
|
|
393
380
|
const paraDetails = connector.paraDetails;
|
|
394
381
|
const providerId = paraDetails == null ? void 0 : paraDetails.internalId;
|
|
@@ -450,6 +437,5 @@ function EvmExternalWalletProvider({
|
|
|
450
437
|
}
|
|
451
438
|
export {
|
|
452
439
|
EvmExternalWalletContext,
|
|
453
|
-
EvmExternalWalletProvider
|
|
454
|
-
defaultEvmExternalWallet
|
|
440
|
+
EvmExternalWalletProvider
|
|
455
441
|
};
|
|
@@ -3,19 +3,22 @@ import {
|
|
|
3
3
|
__async
|
|
4
4
|
} from "../chunk-MMUBH76A.js";
|
|
5
5
|
const getWalletConnectUri = (connector, uriConverter) => __async(void 0, null, function* () {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const provider = yield (_b = (_a = connector.getProvider) == null ? void 0 : _a.call(connector)) != null ? _b : void 0;
|
|
8
|
+
if (connector.type === "coinbaseWallet" && (provider == null ? void 0 : provider.qrUrl)) {
|
|
8
9
|
return provider.qrUrl;
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
if (!provider || typeof provider.once !== "function" && typeof provider.on !== "function") {
|
|
12
|
+
throw new Error("display_uri event not supported for this connector");
|
|
13
|
+
}
|
|
14
|
+
const listen = typeof provider.once === "function" ? provider.once.bind(provider) : provider.on.bind(provider);
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const cancel = setTimeout(() => reject(new Error("display_uri event not emitted")), 1e4);
|
|
17
|
+
listen("display_uri", (uri) => {
|
|
18
|
+
clearTimeout(cancel);
|
|
19
|
+
resolve(uriConverter ? uriConverter(uri) : uri);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
19
22
|
});
|
|
20
23
|
export {
|
|
21
24
|
getWalletConnectUri
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/evm-wallet-connectors",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@coinbase/wallet-sdk": "4.3.0",
|
|
13
|
-
"@getpara/wagmi-v2-connector": "2.0.0-alpha.
|
|
14
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
13
|
+
"@getpara/wagmi-v2-connector": "2.0.0-alpha.24",
|
|
14
|
+
"@getpara/web-sdk": "2.0.0-alpha.24",
|
|
15
15
|
"viem": "^2.24.2",
|
|
16
16
|
"wagmi": "^2.14.16",
|
|
17
17
|
"zustand": "^4.5.2",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test": "vitest run --coverage"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
26
|
+
"@getpara/react-common": "2.0.0-alpha.24",
|
|
27
27
|
"@tanstack/react-query": ">=5.0.0",
|
|
28
28
|
"@types/react": "^18.0.31",
|
|
29
29
|
"@types/react-dom": "^18.2.7",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"dist",
|
|
40
40
|
"package.json"
|
|
41
41
|
],
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "bc885e0cfe1efeacab0f72b0a68c5af2710e32e0"
|
|
43
43
|
}
|