@wagerr-wdk/client-factory
v0.8.2
Published
Query different blockchains with account management using a single and simple interface.
Downloads
4
Readme
@wagerr-sdk/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 @wagerr-sdk/client-factory
or
<script src="https://cdn.jsdelivr.net/npm/@wagerr-sdk/[email protected]/dist/client.min.js"></script>
<!-- sourceMap at https://cdn.jsdelivr.net/npm/@wagerr-sdk/[email protected]/dist/client.min.js.map -->
<!-- available as window.Client -->
Usage
import ClientFactory from '@wagerr-sdk/client-factory'
const wagerr = 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 [ wagerrAddress ] = await wagerr.wallet.getAddresses(0, 1)
const [ ethereumAddress ] = await ethereum.wallet.getAddresses(0, 1)
// Sign a message
const signedMessageWagerr = await wagerr.wallet.signMessage(
'The Times 3 January 2009 Chancellor on brink of second bailout for banks', wagerrAddress.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 wagerr.chain.sendTransaction(<to>, 1000)
await ethereum.chain.sendTransaction(<to>, 1000)