@getpara/cosmos-wallet-connectors 2.0.0-alpha.20 → 2.0.0-alpha.22
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 +1 -1
- package/dist/index.js +5 -1
- package/dist/providers/CosmosExternalWalletContext.d.ts +18 -38
- package/dist/providers/CosmosExternalWalletContext.js +146 -79
- package/dist/wallets/connectors/cosmostation/cosmostation.js +1 -0
- package/dist/wallets/connectors/keplr/keplr.js +1 -0
- package/dist/wallets/connectors/leap/leap.js +1 -0
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CosmosExternalWalletContext } from './providers/CosmosExternalWalletContext.js';
|
|
2
|
-
export type
|
|
2
|
+
export { type CosmosExternalWalletContextType, type CosmosSignResult, defaultCosmosExternalWallet, } from './providers/CosmosExternalWalletContext.js';
|
|
3
3
|
export { ParaCosmosProvider } from './providers/ParaCosmosContext.js';
|
|
4
4
|
export type { ParaCosmosProviderProps, ParaGrazProviderProps, ParaCosmosProviderConfig, } from './providers/ParaCosmosContext.js';
|
|
5
5
|
export * from './wallets/connectors/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./chunk-IV3L3JVM.js";
|
|
3
3
|
import { CosmosExternalWalletContext } from "./providers/CosmosExternalWalletContext.js";
|
|
4
|
+
import {
|
|
5
|
+
defaultCosmosExternalWallet
|
|
6
|
+
} from "./providers/CosmosExternalWalletContext.js";
|
|
4
7
|
import { ParaCosmosProvider } from "./providers/ParaCosmosContext.js";
|
|
5
8
|
export * from "./wallets/connectors/index.js";
|
|
6
9
|
export {
|
|
7
10
|
CosmosExternalWalletContext,
|
|
8
|
-
ParaCosmosProvider
|
|
11
|
+
ParaCosmosProvider,
|
|
12
|
+
defaultCosmosExternalWallet
|
|
9
13
|
};
|
|
@@ -1,46 +1,26 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { ParaCosmosProviderConfig } from './ParaCosmosContext.js';
|
|
3
3
|
import { WalletWithType } from '../types/Wallet.js';
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
chainId?: string;
|
|
4
|
+
import type { ChainManagement, ConnectParaEmbedded, ExternalWalletContextType, ExternalWalletProviderConfig, ExternalWalletProviderConfigBase, SignResult } from '@getpara/react-common';
|
|
5
|
+
export declare const defaultCosmosExternalWallet: {
|
|
6
|
+
wallets: any[];
|
|
7
|
+
chains: any[];
|
|
8
|
+
chainId: any;
|
|
10
9
|
disconnect: () => Promise<void>;
|
|
11
|
-
switchChain: (
|
|
12
|
-
|
|
13
|
-
}>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}>;
|
|
18
|
-
signMessage: (message: string) => Promise<{
|
|
19
|
-
signature?: string;
|
|
20
|
-
error?: string;
|
|
21
|
-
}>;
|
|
22
|
-
signVerificationMessage: () => Promise<{
|
|
23
|
-
address?: string;
|
|
24
|
-
signature?: string;
|
|
25
|
-
cosmosPublicKeyHex?: string;
|
|
26
|
-
cosmosSigner?: string;
|
|
27
|
-
error?: string;
|
|
28
|
-
addressBech32?: string;
|
|
29
|
-
}>;
|
|
10
|
+
switchChain: () => Promise<void>;
|
|
11
|
+
connectParaEmbedded: () => Promise<{}>;
|
|
12
|
+
signMessage: () => Promise<{}>;
|
|
13
|
+
signVerificationMessage: () => Promise<{}>;
|
|
14
|
+
requestInfo: () => Promise<any>;
|
|
15
|
+
disconnectBase: () => Promise<void>;
|
|
30
16
|
};
|
|
31
|
-
export type
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}) => void;
|
|
36
|
-
para: ParaWeb;
|
|
37
|
-
walletsWithFullAuth: TExternalWallet[];
|
|
38
|
-
includeWalletVerification?: boolean;
|
|
39
|
-
connectionOnly?: boolean;
|
|
40
|
-
connectedWallet?: Omit<Wallet, 'signer'> | null;
|
|
17
|
+
export type CosmosSignResult = SignResult & {
|
|
18
|
+
cosmosPublicKeyHex?: string;
|
|
19
|
+
cosmosSigner?: string;
|
|
20
|
+
addressBech32?: string;
|
|
41
21
|
};
|
|
42
|
-
export type
|
|
43
|
-
|
|
44
|
-
|
|
22
|
+
export type CosmosExternalWalletContextType = ExternalWalletContextType<CosmosSignResult> & ChainManagement<string> & ConnectParaEmbedded;
|
|
23
|
+
export type CosmosExternalWalletProviderConfig = ExternalWalletProviderConfigBase;
|
|
24
|
+
export type CosmosExternalWalletProviderConfigFull = ExternalWalletProviderConfig<WalletWithType, Omit<ParaCosmosProviderConfig, 'wallets'>>;
|
|
45
25
|
export declare const CosmosExternalWalletContext: import("react").Context<CosmosExternalWalletContextType>;
|
|
46
26
|
export declare function CosmosExternalWalletProvider({ children, onSwitchWallet, selectedChainId, wallets: incompleteWallets, chains, multiChain, shouldUseSuggestChainAndConnect, onSwitchChain, para, walletsWithFullAuth, connectedWallet, includeWalletVerification, connectionOnly, }: CosmosExternalWalletProviderConfigFull & PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
@@ -25,10 +25,12 @@ const defaultCosmosExternalWallet = {
|
|
|
25
25
|
chains: [],
|
|
26
26
|
chainId: void 0,
|
|
27
27
|
disconnect: () => Promise.resolve(),
|
|
28
|
-
switchChain: () => Promise.resolve(
|
|
28
|
+
switchChain: () => Promise.resolve(),
|
|
29
29
|
connectParaEmbedded: () => Promise.resolve({}),
|
|
30
30
|
signMessage: () => Promise.resolve({}),
|
|
31
|
-
signVerificationMessage: () => Promise.resolve({})
|
|
31
|
+
signVerificationMessage: () => Promise.resolve({}),
|
|
32
|
+
requestInfo: () => Promise.resolve({}),
|
|
33
|
+
disconnectBase: () => Promise.resolve()
|
|
32
34
|
};
|
|
33
35
|
const CosmosExternalWalletContext = createContext(defaultCosmosExternalWallet);
|
|
34
36
|
function CosmosExternalWalletProvider({
|
|
@@ -64,6 +66,7 @@ function CosmosExternalWalletProvider({
|
|
|
64
66
|
const updateExternalWalletState = useExternalWalletStore((state) => state.updateState);
|
|
65
67
|
const ethAddress = multiChain ? (_b = (_a = account == null ? void 0 : account[selectedChainId]) == null ? void 0 : _a.ethereumHexAddress) == null ? void 0 : _b.toLowerCase() : (_c = account == null ? void 0 : account.ethereumHexAddress) == null ? void 0 : _c.toLowerCase();
|
|
66
68
|
const address = multiChain ? (_d = account == null ? void 0 : account[selectedChainId]) == null ? void 0 : _d.bech32Address : account == null ? void 0 : account.bech32Address;
|
|
69
|
+
const isLinkingAccount = useRef(false);
|
|
67
70
|
const verificationMessage = useRef();
|
|
68
71
|
const reset = () => __async(this, null, function* () {
|
|
69
72
|
yield disconnectAsync();
|
|
@@ -97,10 +100,12 @@ function CosmosExternalWalletProvider({
|
|
|
97
100
|
if (!changeResp.error) {
|
|
98
101
|
onSwitchChain(chainId);
|
|
99
102
|
const storedExternalWallet = para.externalWallets[(_a2 = changeResp.ethAddress) != null ? _a2 : ""];
|
|
103
|
+
const { provider, providerId } = getProvider(walletType);
|
|
100
104
|
para.setExternalWallet({
|
|
101
105
|
address: changeResp.ethAddress,
|
|
102
106
|
type: "COSMOS",
|
|
103
|
-
provider
|
|
107
|
+
provider,
|
|
108
|
+
providerId,
|
|
104
109
|
addressBech32: changeResp.address,
|
|
105
110
|
withFullParaAuth: storedExternalWallet.isExternalWithParaAuth,
|
|
106
111
|
withVerification: includeWalletVerification,
|
|
@@ -109,15 +114,22 @@ function CosmosExternalWalletProvider({
|
|
|
109
114
|
}
|
|
110
115
|
return { error };
|
|
111
116
|
});
|
|
112
|
-
const login = (
|
|
117
|
+
const login = (_0) => __async(this, [_0], function* ({
|
|
118
|
+
address: address2,
|
|
119
|
+
addressBech32,
|
|
120
|
+
withFullParaAuth,
|
|
121
|
+
providerId,
|
|
122
|
+
provider
|
|
123
|
+
}) {
|
|
113
124
|
try {
|
|
114
125
|
return yield para.loginExternalWallet({
|
|
115
126
|
externalWallet: {
|
|
116
|
-
address:
|
|
127
|
+
address: address2,
|
|
117
128
|
type: "COSMOS",
|
|
118
|
-
provider
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
provider,
|
|
130
|
+
providerId,
|
|
131
|
+
addressBech32,
|
|
132
|
+
withFullParaAuth,
|
|
121
133
|
withVerification: includeWalletVerification,
|
|
122
134
|
isConnectionOnly: connectionOnly
|
|
123
135
|
}
|
|
@@ -129,14 +141,14 @@ function CosmosExternalWalletProvider({
|
|
|
129
141
|
});
|
|
130
142
|
useEffect(() => {
|
|
131
143
|
const storedExternalWallet = para.externalWallets[ethAddress != null ? ethAddress : ""];
|
|
132
|
-
if (isConnected && !isConnecting && !isReconnecting && !isLocalConnecting && !!ethAddress && !storedExternalWallet && walletType !== GrazWalletType.PARA) {
|
|
144
|
+
if (isConnected && !isConnecting && !isReconnecting && !isLocalConnecting && !!ethAddress && !storedExternalWallet && walletType !== GrazWalletType.PARA && !isLinkingAccount.current) {
|
|
133
145
|
reset();
|
|
134
146
|
}
|
|
135
147
|
}, [isConnecting, isLocalConnecting, isReconnecting, isConnected]);
|
|
136
148
|
useEffect(() => {
|
|
137
149
|
const connect2 = () => __async(this, null, function* () {
|
|
138
150
|
var _a2;
|
|
139
|
-
if (!isLocalConnecting && !isConnecting && !isReconnecting && connectedWallet && connectedWallet.type === "COSMOS" && (connectedWallet.isExternal ? walletType !== ((_a2 = connectedWallet.name) == null ? void 0 : _a2.toLowerCase()) : walletType !== "para")) {
|
|
151
|
+
if (!isLocalConnecting && !isConnecting && !isReconnecting && connectedWallet && connectedWallet.type === "COSMOS" && (connectedWallet.isExternal ? walletType !== ((_a2 = connectedWallet.name) == null ? void 0 : _a2.toLowerCase()) : walletType !== "para") && !isLinkingAccount.current) {
|
|
140
152
|
const isLoggedIn = yield para.isFullyLoggedIn();
|
|
141
153
|
if (!isLoggedIn) {
|
|
142
154
|
return;
|
|
@@ -150,20 +162,30 @@ function CosmosExternalWalletProvider({
|
|
|
150
162
|
});
|
|
151
163
|
connect2();
|
|
152
164
|
}, [isLocalConnecting, isConnecting, isReconnecting, walletType, connectedWallet]);
|
|
153
|
-
const signMessage = (
|
|
154
|
-
|
|
165
|
+
const signMessage = (_0) => __async(this, [_0], function* ({ message, externalWallet }) {
|
|
166
|
+
let wallet, signAddress, signEthAddress;
|
|
167
|
+
if (externalWallet) {
|
|
168
|
+
const commonWallet = wallets.find((w) => w.internalId === externalWallet.providerId);
|
|
169
|
+
wallet = grazGetWallet(commonWallet == null ? void 0 : commonWallet.grazType);
|
|
170
|
+
signAddress = externalWallet.addressBech32;
|
|
171
|
+
signEthAddress = externalWallet.address;
|
|
172
|
+
} else {
|
|
173
|
+
wallet = grazGetWallet(walletType);
|
|
174
|
+
signAddress = address;
|
|
175
|
+
signEthAddress = ethAddress;
|
|
176
|
+
}
|
|
155
177
|
if (!wallet) {
|
|
156
178
|
return { error: "Connected wallet not found" };
|
|
157
179
|
}
|
|
158
180
|
try {
|
|
159
181
|
const publicKey = (yield wallet.getKey(selectedChainId)).pubKey;
|
|
160
|
-
const signature = yield wallet.signArbitrary(selectedChainId,
|
|
182
|
+
const signature = yield wallet.signArbitrary(selectedChainId, signAddress, message);
|
|
161
183
|
return {
|
|
162
|
-
address:
|
|
163
|
-
addressBech32:
|
|
184
|
+
address: signEthAddress,
|
|
185
|
+
addressBech32: signAddress,
|
|
164
186
|
signature: signature.signature,
|
|
165
187
|
cosmosPublicKeyHex: Buffer.from(publicKey).toString("hex"),
|
|
166
|
-
cosmosSigner:
|
|
188
|
+
cosmosSigner: signAddress
|
|
167
189
|
};
|
|
168
190
|
} catch (e) {
|
|
169
191
|
if (e.message.includes("Request rejected")) {
|
|
@@ -173,82 +195,94 @@ function CosmosExternalWalletProvider({
|
|
|
173
195
|
}
|
|
174
196
|
});
|
|
175
197
|
const signVerificationMessage = () => __async(this, null, function* () {
|
|
176
|
-
const signature = yield signMessage(verificationMessage.current);
|
|
198
|
+
const signature = yield signMessage({ message: verificationMessage.current });
|
|
177
199
|
return signature;
|
|
178
200
|
});
|
|
179
|
-
const
|
|
201
|
+
const connectBase = (walletType2, chainId) => __async(this, null, function* () {
|
|
180
202
|
var _a2;
|
|
181
|
-
updateExternalWalletState({ isConnecting: true });
|
|
182
|
-
const walletId = (_a2 = getWallet(walletType2)) == null ? void 0 : _a2.id;
|
|
183
|
-
const isFullAuthWallet = walletsWithFullAuth.includes(walletId.toUpperCase());
|
|
184
203
|
if (!chainId) {
|
|
185
204
|
yield disconnectAsync();
|
|
186
205
|
}
|
|
187
206
|
const _chainId = chainId != null ? chainId : multiChain ? chains.map((c) => c.chainId) : selectedChainId;
|
|
188
207
|
if (!_chainId) {
|
|
189
|
-
|
|
190
|
-
return;
|
|
208
|
+
throw new Error("Chain id not provided.");
|
|
191
209
|
}
|
|
192
|
-
let address2;
|
|
193
|
-
let ethAddress2;
|
|
194
|
-
let error;
|
|
195
|
-
let authState;
|
|
196
210
|
if (!walletType2) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
chainInfo = getChainInfo({ chainId: _chainId });
|
|
208
|
-
if (!chainInfo) {
|
|
209
|
-
console.error("Chain not found.");
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
const connectedWallet2 = yield shouldUseSuggestChainAndConnect ? suggestAndConnectAsync({ walletType: walletType2, chainInfo }) : connectAsync({ walletType: walletType2, chainId: _chainId });
|
|
214
|
-
const firstChain = !chainId ? selectedChainId : typeof _chainId === "string" ? _chainId : _chainId[0];
|
|
215
|
-
address2 = connectedWallet2.accounts[firstChain].bech32Address;
|
|
216
|
-
let rawAddress;
|
|
217
|
-
const accountAddress = connectedWallet2.accounts[firstChain].address;
|
|
218
|
-
if (!accountAddress || accountAddress.length === 0 || accountAddress.byteLength === 0) {
|
|
219
|
-
const pubKey = connectedWallet2.accounts[firstChain].pubKey;
|
|
220
|
-
rawAddress = rawSecp256k1PubkeyToRawAddress(pubKey);
|
|
221
|
-
} else {
|
|
222
|
-
rawAddress = accountAddress;
|
|
223
|
-
}
|
|
224
|
-
ethAddress2 = formatEthHexAddress(rawAddress);
|
|
225
|
-
if (connectedWallet2.accounts[firstChain]) {
|
|
226
|
-
try {
|
|
227
|
-
authState = yield login(ethAddress2, address2, isFullAuthWallet, getProviderName(walletType2));
|
|
228
|
-
verificationMessage.current = authState.stage === "verify" ? authState.signatureVerificationMessage : void 0;
|
|
229
|
-
} catch (err) {
|
|
230
|
-
authState = void 0;
|
|
231
|
-
ethAddress2 = void 0;
|
|
232
|
-
address2 = void 0;
|
|
233
|
-
error = err;
|
|
234
|
-
}
|
|
211
|
+
throw new Error("Graz wallet type not provided.");
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
let chainInfo;
|
|
215
|
+
if (shouldUseSuggestChainAndConnect) {
|
|
216
|
+
if (typeof _chainId !== "string") {
|
|
217
|
+
console.error("multiChain is not compatible with shouldUseSuggestChainAndConnect.");
|
|
218
|
+
return;
|
|
235
219
|
}
|
|
236
|
-
|
|
237
|
-
if (
|
|
238
|
-
error
|
|
239
|
-
|
|
240
|
-
console.error("Graz connection error:", err);
|
|
241
|
-
error = "An unknown error occurred.";
|
|
220
|
+
chainInfo = getChainInfo({ chainId: _chainId });
|
|
221
|
+
if (!chainInfo) {
|
|
222
|
+
console.error("Chain not found.");
|
|
223
|
+
return;
|
|
242
224
|
}
|
|
243
225
|
}
|
|
226
|
+
const connectedWallet2 = yield shouldUseSuggestChainAndConnect ? suggestAndConnectAsync({ walletType: walletType2, chainInfo }) : connectAsync({ walletType: walletType2, chainId: _chainId });
|
|
227
|
+
const firstChain = !chainId ? selectedChainId : typeof _chainId === "string" ? _chainId : _chainId[0];
|
|
228
|
+
const addressBech32 = connectedWallet2.accounts[firstChain].bech32Address;
|
|
229
|
+
let rawAddress;
|
|
230
|
+
const accountAddress = connectedWallet2.accounts[firstChain].address;
|
|
231
|
+
if (!accountAddress || accountAddress.length === 0 || accountAddress.byteLength === 0) {
|
|
232
|
+
const pubKey = connectedWallet2.accounts[firstChain].pubKey;
|
|
233
|
+
rawAddress = rawSecp256k1PubkeyToRawAddress(pubKey);
|
|
234
|
+
} else {
|
|
235
|
+
rawAddress = accountAddress;
|
|
236
|
+
}
|
|
237
|
+
const address2 = formatEthHexAddress(rawAddress);
|
|
238
|
+
const { provider, providerId } = getProvider(walletType2);
|
|
239
|
+
return {
|
|
240
|
+
type: "COSMOS",
|
|
241
|
+
address: address2,
|
|
242
|
+
addressBech32,
|
|
243
|
+
provider,
|
|
244
|
+
providerId
|
|
245
|
+
};
|
|
246
|
+
} catch (e) {
|
|
247
|
+
let error;
|
|
248
|
+
if (e.message === "No wallet exists") {
|
|
249
|
+
error = e.message;
|
|
250
|
+
} else {
|
|
251
|
+
error = `Graz connection error: ${(_a2 = e == null ? void 0 : e.message) != null ? _a2 : e}`;
|
|
252
|
+
}
|
|
253
|
+
throw error;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
const connect = (walletType2, chainId) => __async(this, null, function* () {
|
|
257
|
+
var _a2, _b2;
|
|
258
|
+
updateExternalWalletState({ isConnecting: true });
|
|
259
|
+
const walletId = (_a2 = getWallet(walletType2)) == null ? void 0 : _a2.id;
|
|
260
|
+
const isFullAuthWallet = walletsWithFullAuth.includes(walletId.toUpperCase());
|
|
261
|
+
try {
|
|
262
|
+
const externalWallet = yield connectBase(walletType2, chainId);
|
|
263
|
+
const authState = yield login(__spreadProps(__spreadValues({}, externalWallet), {
|
|
264
|
+
withFullParaAuth: isFullAuthWallet
|
|
265
|
+
}));
|
|
266
|
+
verificationMessage.current = authState.stage === "verify" ? authState.signatureVerificationMessage : void 0;
|
|
267
|
+
return {
|
|
268
|
+
address: externalWallet.address,
|
|
269
|
+
authState
|
|
270
|
+
};
|
|
271
|
+
} catch (e) {
|
|
272
|
+
return {
|
|
273
|
+
error: (_b2 = e == null ? void 0 : e.message) != null ? _b2 : e
|
|
274
|
+
};
|
|
275
|
+
} finally {
|
|
276
|
+
updateExternalWalletState({ isConnecting: false });
|
|
244
277
|
}
|
|
245
|
-
updateExternalWalletState({ isConnecting: false });
|
|
246
|
-
return { authState, address: address2, ethAddress: ethAddress2, error };
|
|
247
278
|
});
|
|
248
279
|
const getWallet = (walletType2) => incompleteWallets.find((w) => w.grazType === walletType2 || w.grazMobileType === walletType2);
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
return
|
|
280
|
+
const getProvider = (walletType2) => {
|
|
281
|
+
const wallet = getWallet(walletType2);
|
|
282
|
+
return {
|
|
283
|
+
provider: wallet == null ? void 0 : wallet.name,
|
|
284
|
+
providerId: wallet == null ? void 0 : wallet.internalId
|
|
285
|
+
};
|
|
252
286
|
};
|
|
253
287
|
const wallets = incompleteWallets.map((wallet) => {
|
|
254
288
|
return __spreadProps(__spreadValues({
|
|
@@ -279,6 +313,34 @@ function CosmosExternalWalletProvider({
|
|
|
279
313
|
return { error };
|
|
280
314
|
}
|
|
281
315
|
}), [para, multiChain, chains, selectedChainId]);
|
|
316
|
+
const requestInfo = (providerId) => __async(this, null, function* () {
|
|
317
|
+
var _a2;
|
|
318
|
+
const wallet = wallets.find((w) => w.internalId === providerId);
|
|
319
|
+
if (!wallet) {
|
|
320
|
+
throw new Error(`Wallet for provider ${providerId} not found`);
|
|
321
|
+
}
|
|
322
|
+
isLinkingAccount.current = true;
|
|
323
|
+
try {
|
|
324
|
+
const externalWallet = yield connectBase(
|
|
325
|
+
wallet.grazType,
|
|
326
|
+
multiChain ? chains.map((c) => c.chainId) : selectedChainId
|
|
327
|
+
);
|
|
328
|
+
return externalWallet;
|
|
329
|
+
} catch (e) {
|
|
330
|
+
console.error("Error linking account:", e);
|
|
331
|
+
throw new Error((_a2 = e == null ? void 0 : e.message) != null ? _a2 : e);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
const disconnectBase = () => __async(this, null, function* () {
|
|
335
|
+
var _a2;
|
|
336
|
+
isLinkingAccount.current = true;
|
|
337
|
+
try {
|
|
338
|
+
yield disconnectAsync();
|
|
339
|
+
} catch (e) {
|
|
340
|
+
console.error("Error linking account:", e);
|
|
341
|
+
throw new Error((_a2 = e == null ? void 0 : e.message) != null ? _a2 : e);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
282
344
|
return /* @__PURE__ */ jsx(
|
|
283
345
|
CosmosExternalWalletContext.Provider,
|
|
284
346
|
{
|
|
@@ -291,7 +353,9 @@ function CosmosExternalWalletProvider({
|
|
|
291
353
|
switchChain,
|
|
292
354
|
connectParaEmbedded,
|
|
293
355
|
signMessage,
|
|
294
|
-
signVerificationMessage
|
|
356
|
+
signVerificationMessage,
|
|
357
|
+
requestInfo,
|
|
358
|
+
disconnectBase
|
|
295
359
|
}),
|
|
296
360
|
[
|
|
297
361
|
wallets,
|
|
@@ -301,7 +365,9 @@ function CosmosExternalWalletProvider({
|
|
|
301
365
|
switchChain,
|
|
302
366
|
connectParaEmbedded,
|
|
303
367
|
signMessage,
|
|
304
|
-
signVerificationMessage
|
|
368
|
+
signVerificationMessage,
|
|
369
|
+
requestInfo,
|
|
370
|
+
disconnectBase
|
|
305
371
|
]
|
|
306
372
|
),
|
|
307
373
|
children
|
|
@@ -310,5 +376,6 @@ function CosmosExternalWalletProvider({
|
|
|
310
376
|
}
|
|
311
377
|
export {
|
|
312
378
|
CosmosExternalWalletContext,
|
|
313
|
-
CosmosExternalWalletProvider
|
|
379
|
+
CosmosExternalWalletProvider,
|
|
380
|
+
defaultCosmosExternalWallet
|
|
314
381
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/cosmos-wallet-connectors",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"@cosmjs/proto-signing": "<=0.31.3",
|
|
20
20
|
"@cosmjs/stargate": "<=0.33.1",
|
|
21
21
|
"@cosmjs/tendermint-rpc": "<=0.31.3",
|
|
22
|
-
"@getpara/graz": "
|
|
23
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
22
|
+
"@getpara/graz": "2.0.0-alpha.3",
|
|
23
|
+
"@getpara/web-sdk": "2.0.0-alpha.22",
|
|
24
24
|
"@leapwallet/cosmos-social-login-capsule-provider": "^0.0.41",
|
|
25
25
|
"zustand": "^4.5.2",
|
|
26
26
|
"zustand-sync-tabs": "^0.2.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
29
|
+
"@getpara/react-common": "2.0.0-alpha.22",
|
|
30
30
|
"@types/react": "^18.0.31",
|
|
31
31
|
"@types/react-dom": "^18.2.7",
|
|
32
32
|
"typescript": "^5.4.3"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"dist",
|
|
40
40
|
"package.json"
|
|
41
41
|
],
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "e23258f6af4d3445bf4717a9e524c63e0088e159"
|
|
43
43
|
}
|