Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/packages/caravan-wal…
Browse files Browse the repository at this point in the history
…lets/axios-1.7.4
  • Loading branch information
waldenraines authored Nov 26, 2024
2 parents 91d6f43 + 48da7df commit 1e2d7f4
Show file tree
Hide file tree
Showing 64 changed files with 7,360 additions and 314 deletions.
27 changes: 27 additions & 0 deletions apps/coordinator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## 1.4.1

### Patch Changes

- [#147](https://github.com/caravan-bitcoin/caravan/pull/147) [`0a73b09`](https://github.com/caravan-bitcoin/caravan/commit/0a73b094984fd59c7564eda0fa31eb8f05b96927) Thanks [@bucko13](https://github.com/bucko13)! - Adds support for translatePSBT for segwit PSBTs. This enables loading tx data directly from a psbt for ledger and trezor

- Updated dependencies [[`0a73b09`](https://github.com/caravan-bitcoin/caravan/commit/0a73b094984fd59c7564eda0fa31eb8f05b96927)]:
- @caravan/psbt@1.6.0
- @caravan/wallets@0.4.0

## 1.4.0

### Minor Changes

- [#117](https://github.com/caravan-bitcoin/caravan/pull/117) [`d0e08e8`](https://github.com/caravan-bitcoin/caravan/commit/d0e08e872a63011d2ed72b6b9a68e54db1649b44) Thanks [@benma](https://github.com/benma)! - Add support for the BitBox02 hardware wallet

### Patch Changes

- Updated dependencies [[`d0e08e8`](https://github.com/caravan-bitcoin/caravan/commit/d0e08e872a63011d2ed72b6b9a68e54db1649b44)]:
- @caravan/wallets@0.3.0

## 1.3.0

### Minor Changes

- [#138](https://github.com/caravan-bitcoin/caravan/pull/138) [`4ecc56a`](https://github.com/caravan-bitcoin/caravan/commit/4ecc56aefc1ecdde7a2ffa157e0d1e29515a5bc4) Thanks [@bucko13](https://github.com/bucko13)! - Add bip32 package and UI for blinded xpub support in wallet creation

## 1.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/coordinator/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "caravan-coordinator",
"private": true,
"version": "1.2.0",
"version": "1.4.1",
"description": "Unchained Capital's Bitcoin Multisig Coordinator Application",
"main": "index.jsx",
"type": "module",
Expand Down
3 changes: 2 additions & 1 deletion apps/coordinator/src/actions/keystoreActions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { TREZOR, LEDGER, HERMIT, COLDCARD } from "@caravan/wallets";
import { BITBOX, TREZOR, LEDGER, HERMIT, COLDCARD } from "@caravan/wallets";

export const SET_KEYSTORE = "SET_KEYSTORE";
export const SET_KEYSTORE_NOTE = "SET_KEYSTORE_NOTE";
export const SET_KEYSTORE_STATUS = "SET_KEYSTORE_STATUS";

type KeyStoreType =
| typeof BITBOX
| typeof TREZOR
| typeof LEDGER
| typeof HERMIT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ACTIVE,
ERROR,
ExportPublicKey,
BITBOX,
TREZOR,
LEDGER,
} from "@caravan/wallets";
Expand Down Expand Up @@ -172,7 +173,7 @@ const HardwareWalletPublicKeyImporter = ({

HardwareWalletPublicKeyImporter.propTypes = {
network: PropTypes.string.isRequired,
method: PropTypes.oneOf([LEDGER, TREZOR]).isRequired,
method: PropTypes.oneOf([BITBOX, LEDGER, TREZOR]).isRequired,
defaultBIP32Path: PropTypes.string.isRequired,
validatePublicKey: PropTypes.func.isRequired,
enableChangeMethod: PropTypes.func.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import { validatePublicKey as baseValidatePublicKey } from "@caravan/bitcoin";
import { TREZOR, LEDGER } from "@caravan/wallets";
import { BITBOX, TREZOR, LEDGER } from "@caravan/wallets";

// Components
import {
Expand Down Expand Up @@ -213,6 +213,7 @@ const PublicKeyImporter = ({

const renderImportByMethod = () => {
if (
publicKeyImporter.method === BITBOX ||
publicKeyImporter.method === TREZOR ||
publicKeyImporter.method === LEDGER
) {
Expand Down Expand Up @@ -261,6 +262,7 @@ const PublicKeyImporter = ({
variant="standard"
>
<MenuItem value="">{"< Select method >"}</MenuItem>
<MenuItem value={BITBOX}>BitBox</MenuItem>
<MenuItem value={TREZOR}>Trezor</MenuItem>
<MenuItem value={LEDGER}>Ledger</MenuItem>
<MenuItem value={XPUB}>Derive from extended public key</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { useState } from "react";
import { Button } from "@mui/material";
import { useDispatch, useSelector } from "react-redux";
import { BITBOX, RegisterWalletPolicy } from "@caravan/wallets";
import { getWalletConfig } from "../../selectors/wallet";
import { setErrorNotification } from "../../actions/errorNotificationActions";

const RegisterBitBoxButton = ({ ...otherProps }) => {
const [isActive, setIsActive] = useState(false);
const walletConfig = useSelector(getWalletConfig);
const dispatch = useDispatch();

const registerWallet = async () => {
setIsActive(true);
try {
const interaction = new RegisterWalletPolicy({
keystore: BITBOX,
...walletConfig,
});
await interaction.run();
} catch (e) {
dispatch(setErrorNotification(e.message));
} finally {
setIsActive(false);
}
};
return (
<Button
variant="outlined"
onClick={registerWallet}
disabled={isActive}
{...otherProps}
>
Register w/ BitBox
</Button>
);
};

export default RegisterBitBoxButton;
2 changes: 2 additions & 0 deletions apps/coordinator/src/components/RegisterWallet/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import DownloadColdardConfigButton from "./DownloadColdcardConfig";
import PolicyRegistrationTable from "./PolicyRegistrationsTable";
import RegisterBitBoxButton from "./RegisterBitBoxButton";
import RegisterLedgerButton from "./RegisterLedgerButton";

export {
DownloadColdardConfigButton,
PolicyRegistrationTable,
RegisterBitBoxButton,
RegisterLedgerButton,
};
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ class DirectSignatureImporter extends React.Component {
const policyHmac = walletConfig.ledgerPolicyHmacs.find(
(hmac) => hmac.xfp === extendedPublicKeyImporter.rootXfp,
)?.policyHmac;

const keyDetails = {
xfp: extendedPublicKeyImporter.rootXfp,
path: signatureImporter.bip32Path,
};
return SignMultisigTransaction({
network,
keystore,
Expand All @@ -65,6 +68,7 @@ class DirectSignatureImporter extends React.Component {
bip32Paths,
walletConfig,
policyHmac,
keyDetails,
psbt: unsignedPSBT,
returnSignatureArray: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import {
multisigBIP32Root,
validateBIP32Path,
getMaskedDerivation,
P2SH,
} from "@caravan/bitcoin";
import { TREZOR, LEDGER, HERMIT, COLDCARD } from "@caravan/wallets";
import { BITBOX, TREZOR, LEDGER, HERMIT, COLDCARD } from "@caravan/wallets";
import {
Card,
CardHeader,
Expand Down Expand Up @@ -93,7 +94,7 @@ class SignatureImporter extends React.Component {
};

renderImport = () => {
const { signatureImporter, number, isWallet } = this.props;
const { signatureImporter, number, isWallet, addressType } = this.props;
const currentNumber = this.getCurrent();
const notMyTurn = number > currentNumber;
const { disableChangeMethod } = this.state;
Expand All @@ -119,6 +120,7 @@ class SignatureImporter extends React.Component {
onChange={this.handleMethodChange}
>
<MenuItem value={UNKNOWN}>{"< Select method >"}</MenuItem>
{addressType != P2SH && <MenuItem value={BITBOX}>BitBox</MenuItem>}
<MenuItem value={TREZOR}>Trezor</MenuItem>
<MenuItem value={LEDGER}>Ledger</MenuItem>
<MenuItem value={COLDCARD} disabled={!isWallet}>
Expand Down Expand Up @@ -155,7 +157,7 @@ class SignatureImporter extends React.Component {
} = this.props;
const { method } = signatureImporter;

if (method === TREZOR || method === LEDGER) {
if (method === BITBOX || method === TREZOR || method === LEDGER) {
return (
<DirectSignatureImporter
network={network}
Expand Down
6 changes: 6 additions & 0 deletions apps/coordinator/src/components/Slices/ConfirmAddress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ import {
multisigAddressType,
multisigRequiredSigners,
multisigTotalSigners,
P2SH,
} from "@caravan/bitcoin";
import {
BITBOX,
TREZOR,
LEDGER,
COLDCARD,
Expand Down Expand Up @@ -138,6 +140,7 @@ const ConfirmAddress = ({ slice, network }) => {
}
// FIXME - hardcoded to just show up for trezor
if (
extendedPublicKeyImporter.method === BITBOX ||
extendedPublicKeyImporter.method === TREZOR ||
extendedPublicKeyImporter.method === LEDGER
) {
Expand Down Expand Up @@ -230,6 +233,9 @@ const ConfirmAddress = ({ slice, network }) => {
variant="standard"
>
<MenuItem value="">{"< Select method >"}</MenuItem>
{addressType != P2SH && (
<MenuItem value={BITBOX}>BitBox</MenuItem>
)}
<MenuItem value={TREZOR}>Trezor</MenuItem>
<MenuItem value={LEDGER}>Ledger</MenuItem>
<MenuItem value={COLDCARD} disabled>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import { connect } from "react-redux";

import {
BITBOX,
TREZOR,
LEDGER,
HERMIT,
Expand Down Expand Up @@ -89,6 +90,7 @@ const KeystorePickerBase = ({
variant="standard"
>
<MenuItem value="">{"< Select type >"}</MenuItem>
<MenuItem value={BITBOX}>BitBox</MenuItem>
<MenuItem value={TREZOR}>Trezor</MenuItem>
<MenuItem value={LEDGER}>Ledger</MenuItem>
<MenuItem value={COLDCARD}>Coldcard</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import moment from "moment";
import { useSelector, useDispatch } from "react-redux";
import Bowser from "bowser";
import {
BITBOX,
TREZOR,
LEDGER,
HERMIT,
Expand Down Expand Up @@ -178,6 +179,8 @@ const TestSuiteRunSummaryBase = () => {

const keystoreName = (type: string) => {
switch (type) {
case BITBOX:
return "BitBox";
case TREZOR:
return "Trezor";
case LEDGER:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import {
convertExtendedPublicKey,
validateExtendedPublicKey,
Network,
P2SH,
} from "@caravan/bitcoin";
import { TREZOR, LEDGER, HERMIT, COLDCARD } from "@caravan/wallets";
import { BITBOX, TREZOR, LEDGER, HERMIT, COLDCARD } from "@caravan/wallets";
import {
Card,
CardHeader,
Expand Down Expand Up @@ -68,7 +69,7 @@ class ExtendedPublicKeyImporter extends React.Component {
};

renderImport = () => {
const { extendedPublicKeyImporter, number } = this.props;
const { extendedPublicKeyImporter, number, addressType } = this.props;
const { disableChangeMethod } = this.state;
return (
<div>
Expand All @@ -82,6 +83,7 @@ class ExtendedPublicKeyImporter extends React.Component {
variant="standard"
onChange={this.handleMethodChange}
>
{addressType != P2SH && <MenuItem value={BITBOX}>BitBox</MenuItem>}
<MenuItem value={TREZOR}>Trezor</MenuItem>
<MenuItem value={COLDCARD}>Coldcard</MenuItem>
<MenuItem value={LEDGER}>Ledger</MenuItem>
Expand All @@ -105,7 +107,7 @@ class ExtendedPublicKeyImporter extends React.Component {
} = this.props;
const { method } = extendedPublicKeyImporter;

if (method === TREZOR || method === LEDGER) {
if (method === BITBOX || method === TREZOR || method === LEDGER) {
return (
<DirectExtendedPublicKeyImporter
extendedPublicKeyImporter={extendedPublicKeyImporter}
Expand Down
4 changes: 4 additions & 0 deletions apps/coordinator/src/components/Wallet/RegisterWallet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { getWalletConfig } from "../../selectors/wallet";
import PolicyRegistrationTable from "../RegisterWallet/PolicyRegistrationsTable";
import {
DownloadColdardConfigButton,
RegisterBitBoxButton,
RegisterLedgerButton,
} from "../RegisterWallet";

Expand Down Expand Up @@ -89,6 +90,9 @@ const WalletRegistrations = () => {
<AccordionDetails>
<Box>
<Grid container spacing={2}>
<Grid item>
<RegisterBitBoxButton />
</Grid>
<Grid item>
<RegisterLedgerButton />
</Grid>
Expand Down
1 change: 1 addition & 0 deletions apps/coordinator/src/components/Wallet/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class CreateWallet extends React.Component {
method: (method, index) => {
if (
[
"bitbox",
"trezor",
"coldcard",
"ledger",
Expand Down
1 change: 1 addition & 0 deletions apps/coordinator/src/reducers/transactionReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ function finalizeOutputs(state, action) {
network: state.network,
inputs: state.inputs.map(convertLegacyInput),
outputs: state.outputs.map(convertLegacyOutput),
includeGlobalXpubs: true,
};
const psbt = getUnsignedMultisigPsbtV0(args);
unsignedTransaction = Transaction.fromHex(
Expand Down
13 changes: 13 additions & 0 deletions apps/coordinator/src/tests/bitbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { BITBOX } from "@caravan/wallets";

import publicKeyTests from "./publicKeys";
import extendedPublicKeyTests from "./extendedPublicKeys";
import { signingTests } from "./signing";
import addressTests from "./addresses";
import registrationTests from "./registration";

export default publicKeyTests(BITBOX)
.concat(extendedPublicKeyTests(BITBOX))
.concat(signingTests(BITBOX))
.concat(addressTests(BITBOX))
.concat(registrationTests(BITBOX));
4 changes: 3 additions & 1 deletion apps/coordinator/src/tests/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { TREZOR, LEDGER, HERMIT, COLDCARD } from "@caravan/wallets";
import { BITBOX, TREZOR, LEDGER, HERMIT, COLDCARD } from "@caravan/wallets";
import { TEST_FIXTURES } from "@caravan/bitcoin";

import bitboxTests from "./bitbox";
import trezorTests from "./trezor";
import ledgerTests from "./ledger";
import hermitTests from "./hermit";
import coldcardTests from "./coldcard";

const SUITE = {};

SUITE[BITBOX] = bitboxTests;
SUITE[TREZOR] = trezorTests;
SUITE[LEDGER] = ledgerTests;
SUITE[HERMIT] = hermitTests;
Expand Down
6 changes: 5 additions & 1 deletion apps/coordinator/src/tests/registration.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

import { TEST_FIXTURES } from "@caravan/bitcoin";
import { RegisterWalletPolicy } from "@caravan/wallets";
import { BITBOX, RegisterWalletPolicy } from "@caravan/wallets";
import { Box, Table, TableBody, TableRow, TableCell } from "@mui/material";

import Test from "./Test";
Expand All @@ -13,6 +13,10 @@ class RegisterWalletPolicyTest extends Test {
}

expected() {
if (this.params.keystore === BITBOX) {
// BitBox does not use HMACs to register policies.
return undefined;
}
return this.params.policyHmac;
}

Expand Down
Loading

0 comments on commit 1e2d7f4

Please sign in to comment.