1.1.0 • Published 3 years ago

@siacentral/ledgerjs-sia v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Sia Ledger

Ledger hardware wallet Sia bindings

Package Install

npm i @siacentral/ledgerjs-sia

Static Install

Static javascript builds are available on the releases page.

Package Usage

import Sia from '@siacentral/ledgerjs-sia';
import TransportWebHID from '@ledgerhq/hw-transport-webhid';

/**
 * connect connects to the plugged in Ledger using the WebHID transport
 * and returns the first Sia address of the ledger wallet.
 */
async function connect() {
	try {
		const transport = await TransportWebHID.create(),
			sia = new Sia(transport),
			address = await sia.getAddress(0);

		console.log(address);
	} catch (ex) {
		// TODO: handle error
	}
}

connect();

Static Usage

<script type="text/javascript" src="/js/sia.js"></script>
<script type="text/javscript">
/**
 * connect connects to the plugged in Ledger using the WebHID transport
 * and returns the first Sia address of the ledger wallet.
 */
async function connect() {
	try {
		const transport = await TransportWebHID.create(),
			sia = new Sia(transport),
			address = await sia.getAddress(0);

		console.log(address);
	} catch (ex) {
		// TODO: handle error
	}
}

connect();
</script>