# blockchain-wallet-ts

> TypeScript wrapper for Blockchain.info's wallet API

Latest version **1.0.3** (published 2019-11-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install blockchain-wallet-ts
pnpm add blockchain-wallet-ts
yarn add blockchain-wallet-ts
bun add blockchain-wallet-ts
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2019-11-20 |
| First published | 2019-11-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=6.4 |
| Dependencies | 1 |
| Unpacked size | 34.2 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jørgen |
| Maintainers | jorgenvatle |
| Keywords | TypeScript, Node, Blockchain.info, Bitcoin |

## Links

- npm: https://www.npmjs.com/package/blockchain-wallet-ts
- Repository: https://github.com/JorgenVatle/blockchain-wallet-ts
- Homepage: https://github.com/JorgenVatle/blockchain-wallet-ts#readme
- Issues: https://github.com/JorgenVatle/blockchain-wallet-ts/issues
- npm.io page: https://npm.io/package/blockchain-wallet-ts

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.19.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2019-11-20
- 1.0.1 — 2019-11-19
- 1.0.0 — 2019-11-19

## README

# Blockchain.com Wallet API
A Node.js wrapper around Blockchain.com's [Service-My-Wallet](https://github.com/blockchain/service-my-wallet-v3) API.
Written in TypeScript to provide you with all that autocomplete niceness.

[![Downloads](https://img.shields.io/npm/dt/blockchain-wallet-ts.svg)](https://www.npmjs.com/package/blockchain-wallet-ts)
[![Version](https://img.shields.io/npm/v/blockchain-wallet-ts.svg)](https://www.npmjs.com/package/blockchain-wallet-ts)
[![Node Version](https://img.shields.io/node/v/blockchain-wallet-ts.svg)](https://www.npmjs.com/package/blockchain-wallet-ts)

## Prerequisites
- A running instance of [Service-My-Wallet](https://github.com/blockchain/service-my-wallet-v3).
- Some features are limited to users with a [Blockchain.com](https://blockchain.com) API key.
    - See [Service-My-Wallet](https://github.com/blockchain/service-my-wallet-v3) for more info.

## Installation
```bash
npm i blockchain-wallet-ts
```

## Usage
Import and initialize the Blockchain API.
```typescript
import BlockchainApi from 'blockchain-wallet-ts';

const Blockchain = BlockchainApi({
    apiUrl: 'http://localhost:3035', // URL to your locally running instance of Service-My-Wallet.
    apiKey: 'c889f326-e94a-47a3-a475-6c1ea5e9d232' // Optional Blockchain.com API key.
})
```

#### Create a wallet.
```typescript
const Wallet = await Blockchain.createWallet({
    password: 'some-secure-wallet-password.'
});
```
Returns an instance of [`BlockchainWallet`](src/BlockchainWallet.ts).

#### Fetch wallet addresses
```typescript
const accounts = await Wallet.accounts;
```
Returns an array of accounts attached to your wallet.
```typescript
[{
  balance: 0,
  index: 12,
  archived: false,
  extendedPublicKey: 'xpub6CcWKuBb3XZK3PLpM...',
  extendedPrivateKey: 'xprv9yd9vPehDA11puGM...',
  receiveIndex: 0,
  lastUsedReceiveIndex: null,
  receiveAddress: '1H5rvJbGNK7gmyR28pknmj...'
}]
```

#### Check balance
```typescript
const account = await Wallet.balance;  
```
Returns the overall balance of your wallet.
```typescript
{ balance: 0 }
```

#### Create a payment
```typescript
Wallet.pay({
    to: '1H5rvJbGNK7gmyR28pknmj...', // Recipient address.
    amount: 100000000,               // Amount to send in satoshis. (100000000 = 1 BTC)
})
```

#### Send Bitcoin to multiple recipients
```typescript
Wallet.payMany({
    recipients: { 
        '1FBkNpMubKM9Y89aVv6JQXAQfYSPLc2fn7': 100000,
        '12EQPNFpao2Gu1xAQvjkfd8vQYmwpP9Eiz': 250000,
    }
})
```

## License
This repository is licensed under the ISC license.

Copyright (c) 2019, Jørgen Vatle.

---
_Source: https://npm.io/package/blockchain-wallet-ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
