@dfns/lib-bitcoinjs
Advanced tools
Comparing version 0.3.1 to 0.3.2
/// <reference types="node" /> | ||
import { DfnsApiClient } from '@dfns/sdk'; | ||
import { Psbt, SignerAsync } from 'bitcoinjs-lib'; | ||
import { Network, Psbt, SignerAsync } from 'bitcoinjs-lib'; | ||
export type DfnsWalletOptions = { | ||
@@ -18,1 +18,5 @@ walletId: string; | ||
} | ||
export declare const litecoin: { | ||
mainnet: Network; | ||
testnet: Network; | ||
}; |
32
index.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DfnsWallet = void 0; | ||
exports.litecoin = exports.DfnsWallet = void 0; | ||
const sdk_1 = require("@dfns/sdk"); | ||
const bitcoinjs_lib_1 = require("bitcoinjs-lib"); | ||
const compatibleNetworks = ['Bitcoin', 'BitcoinTestnet3', 'Litecoin', 'LitecoinTestnet']; | ||
const assertSigned = (res) => { | ||
@@ -26,4 +27,4 @@ if (res.status === 'Failed') { | ||
} | ||
if (res.network !== 'Bitcoin' && res.network !== 'BitcoinTestnet3') { | ||
throw new sdk_1.DfnsError(-1, 'wallet is not bound to Bitcoin or BitcoinTestnet3', { walletId, network: res.network }); | ||
if (!compatibleNetworks.includes(res.network)) { | ||
throw new sdk_1.DfnsError(-1, 'wallet is not bound to a Bitcoin compatible network', { walletId, network: res.network }); | ||
} | ||
@@ -62,1 +63,26 @@ return new DfnsWallet(res, options); | ||
exports.DfnsWallet = DfnsWallet; | ||
/// Litecoin networks | ||
exports.litecoin = { | ||
mainnet: { | ||
messagePrefix: '\x19Litecoin Signed Message:\n', | ||
bech32: 'ltc', | ||
bip32: { | ||
public: 0x019da462, | ||
private: 0x019d9cfe, | ||
}, | ||
pubKeyHash: 0x30, | ||
scriptHash: 0x32, | ||
wif: 0xb0, | ||
}, | ||
testnet: { | ||
messagePrefix: '\x19Litecoin Signed Message:\n', | ||
bech32: 'tltc', | ||
bip32: { | ||
public: 0x043587cf, | ||
private: 0x04358394, | ||
}, | ||
pubKeyHash: 0x6f, | ||
scriptHash: 0xc4, | ||
wif: 0xef, | ||
}, | ||
}; |
{ | ||
"name": "@dfns/lib-bitcoinjs", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"main": "./index.js", | ||
"type": "commonjs" | ||
} |
3820
107