Socket
Book a DemoInstallSign in
Socket

@demox-labs/aleo-wallet-adapter

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@demox-labs/aleo-wallet-adapter

Modular TypeScript wallet adapters and components for Aleo applications.

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
2
Created
Source

@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>
    );
};

FAQs

Package last updated on 19 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts