@forge-connect/react 1.0.3 → 1.0.4

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
@@ -937,14 +937,13 @@ function WalletAdapterFlow() {
937
937
  setError("");
938
938
  setLoading(true);
939
939
  try {
940
- if (!w.adapter.connected) {
941
- await w.adapter.connect();
942
- }
943
- const pk = w.adapter.publicKey;
940
+ wallet.select(w.adapter.name);
941
+ await wallet.connect();
942
+ const pk = _nullishCoalesce(w.adapter.publicKey, () => ( wallet.publicKey));
944
943
  if (!pk) throw new Error("Wallet did not provide a public key.");
945
944
  const address = pk.toBase58();
946
945
  const useCold = coldWalletRef.current;
947
- const adapterSignMessage = w.adapter.signMessage ? (msg) => w.adapter.signMessage(msg) : void 0;
946
+ const adapterSignMessage = wallet.signMessage ? (msg) => wallet.signMessage(msg) : void 0;
948
947
  await loginWithWallet(
949
948
  address,
950
949
  useCold ? void 0 : adapterSignMessage,
@@ -3578,6 +3577,7 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3578
3577
  return btoa(String.fromCharCode(...new Uint8Array(signedTx.serialize())));
3579
3578
  };
3580
3579
  }, [_optionalChain([walletConfig, 'optionalAccess', _117 => _117.Transaction])]);
3580
+ const wallet = walletAdapter;
3581
3581
  const handleConnect = async (w) => {
3582
3582
  if (w.readyState !== "Installed") {
3583
3583
  if (mobile) {
@@ -3594,11 +3594,12 @@ function WalletLinkStep({ onBack, onSuccess, onFatalError }) {
3594
3594
  setError("");
3595
3595
  setLoading(true);
3596
3596
  try {
3597
- if (!w.adapter.connected) await w.adapter.connect();
3598
- const pk = w.adapter.publicKey;
3597
+ wallet.select(w.adapter.name);
3598
+ await wallet.connect();
3599
+ const pk = _nullishCoalesce(w.adapter.publicKey, () => ( wallet.publicKey));
3599
3600
  if (!pk) throw new Error("Wallet did not provide a public key.");
3600
3601
  const useCold = coldWalletRef.current;
3601
- const adapterSignMessage = w.adapter.signMessage ? (msg) => w.adapter.signMessage(msg) : void 0;
3602
+ const adapterSignMessage = wallet.signMessage ? (msg) => wallet.signMessage(msg) : void 0;
3602
3603
  await linkWallet(
3603
3604
  pk.toBase58(),
3604
3605
  useCold ? void 0 : adapterSignMessage,