This package is currently in development and is not yet stable. Feel free to check it out and give us some feedback!
ternoa-connect uses ternoa-js under the hood for signing and submitting transactions. To install this package, run the following command:
yarn add ternoa-connect
yarn add ternoa-js
To use this package, import it in your project as follows:
// In your app entry point, import TernoaConnectProvider and wrap your app with it
import { TernoaConnectProvider } from 'ternoa-connect'
<TernoaConnectProvider>
<div>...</div>
</TernoaConnectProvider>
Then within the TernoaConnectProvider, you will be able to import the Connect Button
// ConnectButton must be imported within the TernoaConnectProvider
import { ConnectButton } from 'ternoa-connect'
...
<ConnectButton />
...
Last step is to sign a transaction hash
import { useTernoaConnect } from "ternoa-connect";
const { sign } = useTernoaConnect()
const signedTx = await sign(txHex);
"ReferenceError: window is not defined": If using Next.js, the window object used under the hood cannot be called on a SSR environnement, a solution is to use the dynamic imports
import dynamic from 'next/dynamic'
const DynamicTernoaConnectProvider = dynamic(
() => import("ternoa-connect").then((mod) => mod.TernoaConnectProvider),
{
loading: () => <>Loading</>,
ssr: false
}
);
We welcome contributions to this package. To contribute, follow these steps:
- Fork the repository
- Create a new branch for your changes
- Make your changes
- Run the tests to ensure they pass
- Commit your changes and push to your fork
- Submit a pull request