Connecting to Wallets without TypeScript or React

Programmers are not required to use TypeScript or React when extending their websites to support Ethereum wallets such as MetaMask. It appears however that the use of both TypeScript and React is mandatory when seeking to connect to Sui Wallet or Suiet. Is there any way to connect to Sui Wallet or Suiet in the absence of TypeScript and React? Alternatively, are there any other reasonably functional wallets for Sui which do not require the adoption of those two elements? Thanks for your understanding.

12 Likes

I didn’t find any relevant documentation, but after digging into the sdk source code, I found these.

let provider;
window.addEventListener("wallet-standard:register-wallet", ({ detail }) => {
  detail({
    register(val) {
      provider = val;
    },
  });
});

const connectSuiWallet = async () => {
  if (!provider) return;
  await provider.features["standard:connect"].connect();
  console.log(provider.accounts[0]);
};

const signMessage = async () => {
  if (!provider) return;
  const result = await provider.features["sui:signMessage"].signMessage({
    message: new TextEncoder().encode("helloworld"),
    account: provider.accounts[0],
  });
  console.log(result);
};

or @mysten/wallet-adapter-wallet-standard

1 Like