3.3.7 • Published 9 months ago

@yaswap/client v3.3.7

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

@yaswap/client

Build Status Coverage Status Standard Code Style MIT License @yaswap/client Gitter Telegram Greenkeeper badge

: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 @yaswap/client

or

<script src="https://cdn.jsdelivr.net/npm/@yaswap/client@0.2.3/dist/client.min.js"></script>
<!-- sourceMap at https://cdn.jsdelivr.net/npm/@yaswap/client@0.2.3/dist/client.min.js.map -->
<!-- available as window.Client -->

Usage

import { Client } from '@yaswap/client'
import { BitcoinRpcProvider } from '@yaswap/bitcoin-rpc-provider'
import { EthereumRpcProvider } from '@yaswap/ethereum-rpc-provider'

import { BitcoinLedgerProvider } from '@yaswap/bitcoin-ledger-provider'
import { EthereumLedgerProvider } from '@yaswap/ethereum-ledger-provider'

import { BitcoinNetworks } from '@yaswap/bitcoin-networks'
import { EthereumNetworks } from '@yaswap/ethereum-networks'

const bitcoin = new Client()
const ethereum = new Client()

bitcoin.addProvider(new BitcoinRpcProvider(
  'https://liquality.io/bitcointestnetrpc/', 'bitcoin', 'local321'
))
ethereum.addProvider(new EthereumRpcProvider(
  'https://rinkeby.infura.io/v3/xxx'
))

bitcoin.addProvider(new BitcoinLedgerProvider(
  { network: BitcoinNetworks.bitcoin_testnet }
))
ethereum.addProvider(new EthereumLedgerProvider(
  { network: EthereumNetworks.rinkeby }
))

// 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)

License

MIT

3.3.7

9 months ago

3.3.6

9 months ago

3.3.1

10 months ago

3.3.0

10 months ago

3.3.5

10 months ago

3.3.4

10 months ago

3.3.3

10 months ago

3.3.2

10 months ago

3.2.1

10 months ago

3.2.0

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

2.10.2

1 year ago

3.1.0

1 year ago

2.10.7

1 year ago

2.10.5

1 year ago

2.10.6

1 year ago

2.10.3

1 year ago

2.10.4

1 year ago

2.10.1

1 year ago

2.10.0

1 year ago

2.9.4

1 year ago

2.9.3

1 year ago

2.9.0

1 year ago

2.9.2

1 year ago

2.9.1

1 year ago

2.8.0

1 year ago

2.7.7

1 year ago

2.7.6

1 year ago

2.7.5

1 year ago

2.7.4

1 year ago

2.7.3

1 year ago

2.7.2

1 year ago

2.7.1

1 year ago

2.7.0

1 year ago

2.6.7

1 year ago

2.6.9

1 year ago

2.6.8

1 year ago

2.6.5

2 years ago

2.6.4

2 years ago

2.6.6

2 years ago

2.3.0

2 years ago

2.2.0

2 years ago

2.5.0

2 years ago

2.3.2

2 years ago

2.4.0

2 years ago

2.3.1

2 years ago

2.6.1

2 years ago

2.5.2

2 years ago

2.6.0

2 years ago

2.5.1

2 years ago

2.3.3

2 years ago

2.6.3

2 years ago

2.6.2

2 years ago

2.5.3

2 years ago

1.0.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.0.0

3 years ago