@liquality/client-factory
v1.13.12
Published
[![Build Status](https://travis-ci.com/liquality/chainabstractionlayer.svg?branch=master)](https://travis-ci.com/liquality/chainabstractionlayer) [![Coverage Status](https://coveralls.io/repos/github/liquality/chainabstractionlayer/badge.svg?branch=master
Downloads
230
Keywords
Readme
@liquality/client-factory
:warning: This project is under heavy development. Expect bugs & breaking changes.
:pencil: Introductory Blog Post: The Missing Tool to Cross-Chain Development
Query different blockchains with account management using a single and simple interface.
Installation
npm i @liquality/client-factory
or
<script src="https://cdn.jsdelivr.net/npm/@liquality/[email protected]/dist/client.min.js"></script>
<!-- sourceMap at https://cdn.jsdelivr.net/npm/@liquality/[email protected]/dist/client.min.js.map -->
<!-- available as window.Client -->
Usage
import { ClientFactory } from '@liquality/client-factory'
const bitcoin = ClientFactory.create('mainnet', 'btc', { mnemonic: 'xxx' })
const ethereum = ClientFactory.create('mainnet', 'eth', { mnemonic: 'xxx' })
// Fetch addresses from Ledger wallet using a single-unified API
const [ bitcoinAddress ] = await bitcoin.wallet.getAddresses(0, 1)
const [ ethereumAddress ] = await ethereum.wallet.getAddresses(0, 1)
// Sign a message
const signedMessageBitcoin = await bitcoin.wallet.signMessage(
'The Times 3 January 2009 Chancellor on brink of second bailout for banks', bitcoinAddress.address
)
const signedMessageEthereum = await ethereum.wallet.signMessage(
'The Times 3 January 2009 Chancellor on brink of second bailout for banks', ethereumAddress.address
)
// Send a transaction
await bitcoin.chain.sendTransaction(<to>, 1000)
await ethereum.chain.sendTransaction(<to>, 1000)