0.2.0 • Published 1 year ago

@tequ/use-xumm-hook v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

React Xumm Hook

npm version

use-xumm-hook enables access to Xumm from React Hooks.

It uses Xumm-Universal-SDK to communicate with Xumm.

installation

You can use npm or yarn to install.

npm

npm install @tequ/use-xumm-hook

yarn

yarn add @tequ/use-xumm-hook

usage

Usage is simple. Just import the hook and pass your Xumm API key.

You can get your Xumm API key from here.

import useXumm from "@tequ/use-xumm-hook";

function App() {
  const { connect, disconnect, user, signTransaction } = useXumm(
    "7fcb00b9-b846-4ddf-ae02-************"
  );

  const payment = () => {
    signTransaction({
      TransactionType: "Payment",
      Destination: "rQQQrUdN1cLdNmxH4dHfKgmX5P4kf3ZrM",
      Amount: "1000000",
    }).then((payload) => {
      if (payload.response.txid) {
        alert("txId:" + payload.response.txid);
      } else {
        alert("canceled");
      }
    });
  };

  return (
    <div>
      <div>
        <button onClick={connect}>Connect</button>
        <button onClick={disconnect}>Disconnect</button>
      </div>
      {user?.account && (
        <>
          <button onClick={payment}>Payment Transaction</button>
          <button onClick={mintNFT}>NFT Mint Transaction</button>
        </>
      )}
    </div>
  );
}

export default App;
0.2.0

1 year ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago