Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
feat(wallet): bugfixes, bump uc libs, adds coldcard support
Browse files Browse the repository at this point in the history
  • Loading branch information
humanumbrella authored and waldenraines committed Dec 13, 2020
1 parent 14b4f8d commit ac11da6
Show file tree
Hide file tree
Showing 66 changed files with 3,895 additions and 2,183 deletions.
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,36 @@ A particularly simple way to proxy requests to a private bitcoind node
is to make use of the [`corsproxy`](https://www.npmjs.com/package/corsproxy)
npm module. Instructions to install and run the module are on its
[home page](https://www.npmjs.com/package/corsproxy).
If you are running a local bitcoind node on your local machine on port 8332,
and you run `corsproxy` with the default settings, you should be able to
point caravan at 'http://localhost:1337/localhost:8332'.

Explicitly, install `corsproxy` with

```
$ npm install -g corsproxy
```

and then launch corsproxy

```
$ corsproxy
```
You should see:

```
$ [log,info], data: CORS Proxy running at: http://localhost:1337
...
```
If you are running a bitcoind node on the same machine as Caravan,
on port 8332, and you run `corsproxy` with the default settings,
you should be able to point Caravan at 'http://localhost:1337/localhost:8332'
to communicate with your node. A testnet node would be running on a
different port, for example: `http://localhost:1337/localhost:18332`, and you
would need to point Caravan to that URL instead.

Finally, a testnet/regtest node running on a different machine but still on the same
network might be accessible to you via `http://localhost:1337/192.168.0.22:18332`, but
you need to make sure the ports are open and accessible. It should be clear at this
point that if corsproxy is running, paste your node's IP:port on the end of the
`corsproxy` URL: `http://localhost:1337/`

## Contributing

Expand Down
2,670 changes: 1,316 additions & 1,354 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"react-bootstrap": "^1.0.0-beta.9",
"react-copy-to-clipboard": "^5.0.1",
"react-dom": "^16.8.6",
"react-dropzone": "^3.10.0",
"react-paginate": "^6.3.0",
"react-qr-reader": "^2.2.1",
"react-redux": "^7.2.0",
Expand All @@ -114,7 +115,7 @@
"redux-promise": "^0.6.0",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"unchained-bitcoin": "0.0.15",
"unchained-wallets": "0.1.7"
"unchained-bitcoin": "^0.1.0",
"unchained-wallets": "^0.1.13"
}
}
27 changes: 27 additions & 0 deletions public/fixtureConfigs/bitcoin-2-of-2--P2SH-MAINNET.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "P2SH-M",
"addressType": "P2SH",
"network": "mainnet",
"client": {
"type": "public"
},
"quorum": {
"requiredSigners": 2,
"totalSigners": 2
},
"extendedPublicKeys": [
{
"name": "osw",
"bip32Path": "m/45'/0'/100'",
"xpub": "xpub6CCHViYn5VzPfSR7baop9FtGcbm3UnqHwa54Z2eNvJnRFCJCdo9HtCYoLJKZCoATMLUowDDA1BMGfQGauY3fDYU3HyMzX4NDkoLYCSkLpbH",
"xfp" : "f57ec65d"
},
{
"name": "d",
"bip32Path": "m/45'/0'/100'",
"xpub": "xpub6Ca5CwTgRASgkXbXE5TeddTP9mPCbYHreCpmGt9dhz9y6femstHGCoFESHHKKRcm414xMKnuLjP9LDS7TwaJC9n5gxua6XB1rwPcC6hqDub",
"xfp" : "efa5d916"
}
],
"startingAddressIndex": 0
}
27 changes: 27 additions & 0 deletions public/fixtureConfigs/bitcoin-2-of-2--P2SH-TESTNET.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "P2SH-T",
"addressType": "P2SH",
"network": "testnet",
"client": {
"type": "public"
},
"quorum": {
"requiredSigners": 2,
"totalSigners": 2
},
"extendedPublicKeys": [
{
"name": "dev",
"bip32Path": "m/45'/1'/100'",
"xpub": "tpubDDinbKDXyddTUKcX6mv936Ux5utCJteq5S6EEKhfpM8CqN2rMAcccv6GecsB3cPt8eGL4e4K2eaZ9Jis9TGf7mbwBsRTN7ngnFR7yJZxBKC",
"xfp" : "efa5d916"
},
{
"name": "osw",
"bip32Path": "m/45'/1'/100'",
"xpub": "tpubDDQubdBx9cbwQtdcRTisKF7wVCwHgHewhU7wh77VzCi62Q9q81qyQeLoZjKWZ62FnQbWU8k7CuKo2A21pAWaFtPGDHP9WuhtAx4smcCxqn1",
"xfp" : "f57ec65d"
}
],
"startingAddressIndex": 0
}
27 changes: 27 additions & 0 deletions public/fixtureConfigs/bitcoin-2-of-2-P2SH-P2WSH-MAINNET.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "P2SH-P2WSH-M",
"addressType": "P2SH-P2WSH",
"network": "mainnet",
"client": {
"type": "public"
},
"quorum": {
"requiredSigners": 2,
"totalSigners": 2
},
"extendedPublicKeys": [
{
"name": "d",
"bip32Path": "m/48'/0'/100'/1'",
"xpub": "xpub6EwJjKaiocGvo9f7XSGXGwzo1GLB1URxSZ5Ccp1wqdxNkhrSoqNQkC2CeMsU675urdmFJLHSX62xz56HGcnn6u21wRy6uipovmzaE65PfBp",
"xfp" : "efa5d916"
},
{
"name": "osw",
"bip32Path": "m/48'/0'/100'/1'",
"xpub": "xpub6DcqYQxnbefzEBJF6osEuT5yXoHVZu1YCCsS5YkATvqD2h7tdMBgdBrUXk26FrJwawDGX6fHKPvhhZxKc5b8dPAPb8uANDhsjAPMJqTFDjH",
"xfp" : "f57ec65d"
}
],
"startingAddressIndex": 0
}
27 changes: 27 additions & 0 deletions public/fixtureConfigs/bitcoin-2-of-2-P2SH-P2WSH-TESTNET.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "P2SH-P2WSH-T",
"addressType": "P2SH-P2WSH",
"network": "testnet",
"client": {
"type": "public"
},
"quorum": {
"requiredSigners": 2,
"totalSigners": 2
},
"extendedPublicKeys": [
{
"name": "osw",
"bip32Path": "m/48'/1'/100'/1'",
"xpub": "tpubDFc9Mm4tw6EkdXuk24MnQYRrDsdKEFh498vFffqa2KJmxytpcHbWrcFYwTKAdLxkSWpadzb5M5VVZ7PDAUjDjymvUmQ7pBbRecz2FM952Am",
"xfp" : "f57ec65d"
},
{
"name": "d",
"bip32Path": "m/48'/1'/100'/1'",
"xpub": "tpubDErWN5qfdLwY9ZJo9HWpxjcuEFuEBVHSbQbPqF35LQr3etWNGirKcgAa93DZ4DmtHm36p2gTf4aj6KybLqHaS3UePM5LtPqtb3d3dYVDs2F",
"xfp" : "efa5d916"
}
],
"startingAddressIndex": 0
}
27 changes: 27 additions & 0 deletions public/fixtureConfigs/bitcoin-2-of-2-P2WSH-MAINNET.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "P2WSH-M",
"addressType": "P2WSH",
"network": "mainnet",
"client": {
"type": "public"
},
"quorum": {
"requiredSigners": 2,
"totalSigners": 2
},
"extendedPublicKeys": [
{
"name": "d",
"bip32Path": "m/48'/0'/100'/2'",
"xpub": "xpub6EwJjKaiocGvqSuM2jRZSuQ9HEddiFUFu9RdjE47zG7kXVNDQpJ3GyvskwYiLmvU4SBTNZyv8UH53QcmFEE23YwozE61V3dwzZJEFQr6H2b",
"xfp" : "efa5d916"
},
{
"name": "osw",
"bip32Path": "m/48'/0'/100'/2'",
"xpub": "xpub6DcqYQxnbefzFkaRBK63FSE2GzNuNnNhFGw1xV9RioVG7av6r3JDf1aELqBSq5gt5487CtNxvVtaiJjQU2HQWzgG5NzLyTPbYav6otW8qEc",
"xfp" : "f57ec65d"
}
],
"startingAddressIndex": 0
}
27 changes: 27 additions & 0 deletions public/fixtureConfigs/bitcoin-2-of-2-P2WSH-TESTNET.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "P2WSH-T",
"addressType": "P2WSH",
"network": "testnet",
"client": {
"type": "public"
},
"quorum": {
"requiredSigners": 2,
"totalSigners": 2
},
"extendedPublicKeys": [
{
"name": "osw",
"bip32Path": "m/48'/1'/100'/2'",
"xpub": "tpubDFc9Mm4tw6EkgR4YTC1GrU6CGEd9yw7KSBnSssL4LXAXh89D4uMZigRyv3csdXbeU3BhLQc4vWKTLewboA1Pt8Fu6fbHKu81MZ6VGdc32eM",
"xfp" : "f57ec65d"
},
{
"name": "d",
"bip32Path": "m/48'/1'/100'/2'",
"xpub": "tpubDErWN5qfdLwYE94mh12oWr4uURDDNKCjKVhCEcAgZ7jKnnAwq5tcTF2iEk3VuznkJuk2G8SCHft9gS6aKbBd18ptYWPqKLRSTRQY7e2rrDj",
"xfp" : "efa5d916"
}
],
"startingAddressIndex": 0
}
4 changes: 4 additions & 0 deletions src/actions/extendedPublicKeyImporterActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const SET_EXTENDED_PUBLIC_KEY_IMPORTER_METHOD =
"SET_EXTENDED_PUBLIC_KEY_IMPORTER_METHOD";
export const SET_EXTENDED_PUBLIC_KEY_IMPORTER_EXTENDED_PUBLIC_KEY =
"SET_EXTENDED_PUBLIC_KEY_IMPORTER_EXTENDED_PUBLIC_KEY";
export const SET_EXTENDED_PUBLIC_KEY_IMPORTER_EXTENDED_PUBLIC_KEY_ROOT_FINGERPRINT =
"SET_EXTENDED_PUBLIC_KEY_IMPORTER_EXTENDED_PUBLIC_KEY_ROOT_FINGERPRINT";
export const SET_EXTENDED_PUBLIC_KEY_IMPORTER_FINALIZED =
"SET_EXTENDED_PUBLIC_KEY_IMPORTER_FINALIZED";
export const SET_EXTENDED_PUBLIC_KEY_IMPORTER_VISIBLE =
Expand All @@ -21,13 +23,15 @@ export const {
resetExtendedPublicKeyImporterBIP32Path,
setExtendedPublicKeyImporterMethod,
setExtendedPublicKeyImporterExtendedPublicKey,
setExtendedPublicKeyImporterExtendedPublicKeyRootFingerprint,
setExtendedPublicKeyImporterFinalized,
} = wrappedNumberedActions({
setExtendedPublicKeyImporterName: SET_EXTENDED_PUBLIC_KEY_IMPORTER_NAME,
resetExtendedPublicKeyImporterBIP32Path: RESET_EXTENDED_PUBLIC_KEY_IMPORTER_BIP32_PATH,
setExtendedPublicKeyImporterBIP32Path: SET_EXTENDED_PUBLIC_KEY_IMPORTER_BIP32_PATH,
setExtendedPublicKeyImporterMethod: SET_EXTENDED_PUBLIC_KEY_IMPORTER_METHOD,
setExtendedPublicKeyImporterExtendedPublicKey: SET_EXTENDED_PUBLIC_KEY_IMPORTER_EXTENDED_PUBLIC_KEY,
setExtendedPublicKeyImporterExtendedPublicKeyRootFingerprint: SET_EXTENDED_PUBLIC_KEY_IMPORTER_EXTENDED_PUBLIC_KEY_ROOT_FINGERPRINT,
setExtendedPublicKeyImporterFinalized: SET_EXTENDED_PUBLIC_KEY_IMPORTER_FINALIZED,
});

Expand Down
10 changes: 9 additions & 1 deletion src/actions/transactionActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
estimateMultisigTransactionFee,
satoshisToBitcoins,
} from "unchained-bitcoin";

import { getSpendableSlices, getConfirmedBalance } from "../selectors/wallet";
import { DUST_IN_BTC } from "../utils/constants";

Expand All @@ -29,6 +28,7 @@ export const SET_TXID = "SET_TXID";
export const RESET_TRANSACTION = "RESET_TRANSACTION";
export const SET_IS_WALLET = "SET_IS_WALLET";
export const SET_CHANGE_OUTPUT_INDEX = "SET_CHANGE_OUTPUT_INDEX";
export const SET_CHANGE_OUTPUT_MULTISIG = "SET_CHANGE_OUTPUT_MULTISIG";
export const UPDATE_AUTO_SPEND = "UPDATE_AUTO_SPEND";
export const SET_CHANGE_ADDRESS = "SET_CHANGE_ADDRESS";
export const SET_SIGNING_KEY = "SET_SIGNING_KEY";
Expand Down Expand Up @@ -78,6 +78,14 @@ export function setChangeOutputIndex(number) {
};
}

export function setChangeOutputMultisig(number, multisig) {
return {
type: SET_CHANGE_OUTPUT_MULTISIG,
number,
value: multisig,
};
}

export function setOutputAddress(number, address) {
return {
type: SET_OUTPUT_ADDRESS,
Expand Down
2 changes: 2 additions & 0 deletions src/actions/walletActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ export function autoSelectCoins() {
* @description Given the state of the transaction store, check status of
* the slices being used in the spend tx and update them once changed state is confirmed.
* @param {Object} changeSlice - the slice that was chosen as the change output
* @param {number} retries - number of retries
* @param {Set} skipAddresses - set of addresses to skip
*/
export function updateTxSlices(
changeSlice,
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoind.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function bitcoindListUnspent({ url, auth, address, addresses }) {
} catch (e) {
// eslint-disable-next-line no-console
console.error("There was a problem:", e.message);
return e;
throw e;
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/components/ClientPicker/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ class ClientPicker extends React.Component {
};

testConnection = async () => {
const { network, client } = this.props;
const { network, client, onSuccess } = this.props;
this.setState({ connectError: "", connectSuccess: false });
try {
await fetchFeeEstimate(network, client);
if (onSuccess) {
onSuccess();
}
this.setState({ connectSuccess: true });
} catch (e) {
this.setState({ connectError: e.message });
Expand Down Expand Up @@ -184,6 +187,7 @@ ClientPicker.propTypes = {
privateNotes: PropTypes.shape({}),
setUrl: PropTypes.func.isRequired,
urlError: PropTypes.string,
onSuccess: PropTypes.func,
setUrlError: PropTypes.func.isRequired,
setPassword: PropTypes.func.isRequired,
passwordError: PropTypes.string,
Expand All @@ -197,6 +201,7 @@ ClientPicker.propTypes = {
ClientPicker.defaultProps = {
urlError: "",
usernameError: "",
onSuccess: null,
passwordError: "",
privateNotes: React.createElement("span"),
};
Expand Down
Loading

0 comments on commit ac11da6

Please sign in to comment.