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

Commit

Permalink
chore: upgrade unchained-bitcoin to v1.0.0 and unchained-wallets to v…
Browse files Browse the repository at this point in the history
…1.0.2
  • Loading branch information
dylan-thompson committed Nov 17, 2023
1 parent f5c3e90 commit 6ce7618
Show file tree
Hide file tree
Showing 35 changed files with 185 additions and 225 deletions.
148 changes: 63 additions & 85 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"eslint-import-resolver-typescript": "^3.5.4",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest-dom": "^3.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-testing-library": "^3.1.0",
"gh-pages": "^3.1.0",
"husky": "^4.3.6",
Expand Down Expand Up @@ -144,7 +144,7 @@
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"sass": "^1.56.2",
"unchained-bitcoin": "^0.4.1",
"unchained-wallets": "^0.6.2"
"unchained-bitcoin": "^1.0.1",
"unchained-wallets": "^1.0.2"
}
}
8 changes: 3 additions & 5 deletions src/actions/transactionActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export function setMaxSpendOnOutput(outputIndex) {
"Not enough available funds for max spend. Clear other outputs or wait for incoming deposits to confirm."
)
);
return dispatch(setOutputAmount(outputIndex, spendAllAmount.toFixed()));
return dispatch(setOutputAmount(outputIndex, spendAllAmount));
};
}

Expand Down Expand Up @@ -364,15 +364,13 @@ export function importPSBT(psbtText) {
dispatch(setChangeAddressAction(output.address));
}
dispatch(setOutputAddress(number, output.address));
dispatch(
setOutputAmount(number, satoshisToBitcoins(output.value).toFixed(8))
);
dispatch(setOutputAmount(number, satoshisToBitcoins(output.value)));
});

state = getState();
const inputsTotalSats = BigNumber(state.spend.transaction.inputsTotalSats);
const feeSats = inputsTotalSats - outputsTotalSats;
const fee = satoshisToBitcoins(feeSats).toFixed(8);
const fee = satoshisToBitcoins(feeSats);
dispatch(setFee(fee));

dispatch(finalizeOutputs(true));
Expand Down
4 changes: 2 additions & 2 deletions src/actions/walletActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function autoSelectCoins() {
dispatch(
setChangeOutput({
address: changeAddress,
value: satoshisToBitcoins(changeAmount).toFixed(),
value: satoshisToBitcoins(changeAmount),
})
);
} else {
Expand All @@ -151,7 +151,7 @@ export function autoSelectCoins() {
});
}

dispatch(setFee(satoshisToBitcoins(fee).toFixed()));
dispatch(setFee(satoshisToBitcoins(fee)));
// set chosen selectedUtxos in the transaction store
dispatch(setInputs(selectedUtxos));
dispatch(finalizeOutputs(true));
Expand Down
2 changes: 1 addition & 1 deletion src/block_explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function blockExplorerGetAddresesUTXOs(address, network) {
confirmed: utxo.status.confirmed,
txid: utxo.txid,
index: utxo.vout,
amount: satoshisToBitcoins(amount).toFixed(8),
amount: satoshisToBitcoins(amount),
amountSats: amount,
transactionHex,
time: utxo.status.block_time,
Expand Down
12 changes: 8 additions & 4 deletions src/components/BitcoinIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React from "react";
import { SvgIcon } from "@mui/material";
import { MAINNET, TESTNET, REGTEST, SIGNET } from "unchained-bitcoin";
import { Network } from "unchained-bitcoin";

interface BitcoinIconProps {
network: typeof MAINNET | typeof TESTNET | typeof REGTEST | typeof SIGNET;
network:
| typeof Network.MAINNET
| typeof Network.TESTNET
| typeof Network.REGTEST
| typeof Network.SIGNET;
}

const BitcoinIcon = ({ network = MAINNET }: BitcoinIconProps) => (
const BitcoinIcon = ({ network = Network.MAINNET }: BitcoinIconProps) => (
<SvgIcon
data-cy="bitcoin-icon"
htmlColor={network === MAINNET ? "orange" : "grey"}
htmlColor={network === Network.MAINNET ? "orange" : "grey"}
>
<svg
xmlns="http://www.w3.org/2000/svg"
Expand Down
Loading

0 comments on commit 6ce7618

Please sign in to comment.