diff --git a/package.json b/package.json index 3afd8938e89..26db783b445 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "dependencies": { "@bitcoinerlab/secp256k1": "1.0.2", "@coinbase/cbpay-js": "1.0.2", - "@dlc-link/dlc-tools": "1.1.1", + "@dlc-link/dlc-tools": "1.0.9", "@fungible-systems/zone-file": "2.0.0", "@hirosystems/token-metadata-api-client": "1.1.0", "@ledgerhq/hw-transport-webusb": "6.27.19", diff --git a/src/app/common/hooks/use-bitcoin-contracts.ts b/src/app/common/hooks/use-bitcoin-contracts.ts index 88355b05eb5..1f434476aaa 100644 --- a/src/app/common/hooks/use-bitcoin-contracts.ts +++ b/src/app/common/hooks/use-bitcoin-contracts.ts @@ -207,27 +207,17 @@ export function useBitcoinContracts() { close(); } - async function getAllActiveBitcoinContracts(): Promise { + async function getAllSignedBitcoinContracts(): Promise { const bitcoinContractInterface = await getBitcoinContractInterface(); if (!bitcoinContractInterface) return; - await bitcoinContractInterface.periodic_check(); const bitcoinContracts = await bitcoinContractInterface.get_contracts(); + const signedBitcoinContracts = bitcoinContracts.filter( + (bitcoinContract: BitcoinContractListItem) => bitcoinContract.state === 'Signed' + ); - const stateOrder = ['Signed', 'Confirmed']; - - const activeBitcoinContracts = bitcoinContracts - .filter( - (bitcoinContract: BitcoinContractListItem) => - bitcoinContract.state === 'Signed' || bitcoinContract.state === 'Confirmed' - ) - .sort( - (a: BitcoinContractListItem, b: BitcoinContractListItem) => - stateOrder.indexOf(a.state) - stateOrder.indexOf(b.state) - ); - - return activeBitcoinContracts; + return signedBitcoinContracts; } function getTransactionDetails(txId: string, bitcoinCollateral: number) { @@ -249,7 +239,7 @@ export function useBitcoinContracts() { async function sumBitcoinContractCollateralAmounts(): Promise { let bitcoinContractsCollateralSum = 0; - const bitcoinContracts = await getAllActiveBitcoinContracts(); + const bitcoinContracts = await getAllSignedBitcoinContracts(); if (!bitcoinContracts) return createMoneyFromDecimal(0, 'BTC'); bitcoinContracts.forEach((bitcoinContract: BitcoinContractListItem) => { @@ -323,7 +313,7 @@ export function useBitcoinContracts() { handleOffer, handleAccept, handleReject, - getAllActiveBitcoinContracts, + getAllSignedBitcoinContracts, sumBitcoinContractCollateralAmounts, sendRpcResponse, }; diff --git a/src/app/pages/bitcoin-contract-list/bitcoin-contract-list.tsx b/src/app/pages/bitcoin-contract-list/bitcoin-contract-list.tsx index 5f8766e5a95..069ff293fa5 100644 --- a/src/app/pages/bitcoin-contract-list/bitcoin-contract-list.tsx +++ b/src/app/pages/bitcoin-contract-list/bitcoin-contract-list.tsx @@ -12,14 +12,14 @@ import { BitcoinContractListItemLayout } from './components/bitcoin-contract-lis import { BitcoinContractListLayout } from './components/bitcoin-contract-list-layout'; export function BitcoinContractList() { - const { getAllActiveBitcoinContracts } = useBitcoinContracts(); + const { getAllSignedBitcoinContracts } = useBitcoinContracts(); const [bitcoinContracts, setBitcoinContracts] = useState([]); const [isLoading, setLoading] = useState(true); const [isError, setError] = useState(false); useOnMount(() => { const fetchAndFormatBitcoinContracts = async () => { - const fetchedBitcoinContracts = await getAllActiveBitcoinContracts(); + const fetchedBitcoinContracts = await getAllSignedBitcoinContracts(); if (!fetchedBitcoinContracts) { setError(true); setLoading(false); diff --git a/src/app/pages/onboarding/sign-in/mnemonic-form.tsx b/src/app/pages/onboarding/sign-in/mnemonic-form.tsx index 594cc3e95e1..56b148ed5d8 100644 --- a/src/app/pages/onboarding/sign-in/mnemonic-form.tsx +++ b/src/app/pages/onboarding/sign-in/mnemonic-form.tsx @@ -96,7 +96,7 @@ export function MnemonicForm({ mnemonic, setMnemonic, twentyFourWordMode }: Mnem