@demox-labs/aleo-wallet-adapter
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

@demox-labs/aleo-wallet-adapter

Modular TypeScript wallet adapters and components for Aleo applications.

Install

Install these dependencies:

yarn add @demox-labs/aleo-wallet-adapter && yarn add react

Usage

import { useWallet, WalletNotConnectedError, LeoWalletAdapter } from '@demox-labs/aleo-wallet-adapter';
import React, { FC, useCallback } from 'react';

export const SignMessageForAleo: FC = () => {
    const { publicKey, wallet } = useWallet();

    const onClick = async () => {
        if (!publicKey) throw new WalletNotConnectedError();
        
        const message = "I'm a message!";
        const messageBytes = new TextEncoder().encode(message);

        const signatureBytes = await (wallet?.adapter as LeoWalletAdapter).signMessage(messageBytes);
        const signature = new TextDecoder().decode(signatureBytes);

        console.log(signature);
    };

    return (
        <button onClick={onClick} disabled={!publicKey}>
            Sign a message!
        </button>
    );
};

Readme

Keywords

none

Package Sidebar

Install

npm i @demox-labs/aleo-wallet-adapter

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

554 kB

Total Files

126

Last publish

Collaborators

  • krwang4094
  • julian-demox
  • dagarcia
  • johndonavon
  • chirswomack
  • fulltimemike
  • evanmars