@forge-connect/react 1.0.4 → 1.0.5

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.cjs CHANGED
@@ -938,12 +938,14 @@ function WalletAdapterFlow() {
938
938
  setLoading(true);
939
939
  try {
940
940
  wallet.select(w.adapter.name);
941
- await wallet.connect();
942
- const pk = _nullishCoalesce(w.adapter.publicKey, () => ( wallet.publicKey));
941
+ if (!w.adapter.connected) {
942
+ await w.adapter.connect();
943
+ }
944
+ const pk = w.adapter.publicKey;
943
945
  if (!pk) throw new Error("Wallet did not provide a public key.");
944
946
  const address = pk.toBase58();
945
947
  const useCold = coldWalletRef.current;
946
- const adapterSignMessage = wallet.signMessage ? (msg) => wallet.signMessage(msg) : void 0;
948
+ const adapterSignMessage = w.adapter.signMessage ? (msg) => w.adapter.signMessage(msg) : void 0;
947
949
  await loginWithWallet(
948
950
  address,
949
951
  useCold ? void 0 : adapterSignMessage,
@@ -3595,11 +3597,11 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3595
3597
  setLoading(true);
3596
3598
  try {
3597
3599
  wallet.select(w.adapter.name);
3598
- await wallet.connect();
3599
- const pk = _nullishCoalesce(w.adapter.publicKey, () => ( wallet.publicKey));
3600
+ if (!w.adapter.connected) await w.adapter.connect();
3601
+ const pk = w.adapter.publicKey;
3600
3602
  if (!pk) throw new Error("Wallet did not provide a public key.");
3601
3603
  const useCold = coldWalletRef.current;
3602
- const adapterSignMessage = wallet.signMessage ? (msg) => wallet.signMessage(msg) : void 0;
3604
+ const adapterSignMessage = w.adapter.signMessage ? (msg) => w.adapter.signMessage(msg) : void 0;
3603
3605
  await linkWallet(
3604
3606
  pk.toBase58(),
3605
3607
  useCold ? void 0 : adapterSignMessage,