1.12.0 • Published 3 years ago
use-anchor v1.12.0
Use-Anchor
Utilise anchor-link
easier in Vue 3.
Properties
isAuthenticated
- reactive string of the authenticated user account name else empty if not logged inlogout()
- function to logoutlogin()
- function to logintransact(simpleAction[])
- function to trigger transactions which accepts SimpleAction type
Example
const transport = new AnchorLinkBrowserTransport();
const chainId =
"aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906";
const link = new AnchorLink({
transport,
chains: [
{
chainId,
nodeUrl: "https://eos.greymass.com",
},
],
});
Simple Action
{
account: string;
name: string;
data: { ... };
}
const { login, isAuthenticated, logout, transact } = useAnchor(
"appName",
link
);
const transfer = () =>
transact([
{
name: "transfer",
account: "eosio.token",
data: {
from: "account",
to: "account2",
memo: "",
quantity: "0.0001 EOS",
},
},
]);