Skip to content

Commit

Permalink
chore: remove bitcoinjs-lib from inscription send
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Nov 28, 2023
1 parent 8a81f58 commit 97854b0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/app/components/text-input-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function TextInputField({
right: '-1px',
top: '-1px',
bottom: '-1px',
pointerEvents: 'none',
}}
border="default"
borderRadius="sm"
Expand Down
6 changes: 3 additions & 3 deletions src/app/features/ledger/components/ledger-inline-warnings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface CommonLedgerInlineWarningsProps extends RequiresChainProp {

function OutdatedLedgerAppWarning({ chain }: RequiresChainProp) {
return (
<WarningLabel fontSize="14px" textAlign="left">
<WarningLabel textAlign="left">
Latest version of <Capitalize>{chain} app</Capitalize> required
<styled.a href="ledgerlive://manager" textDecoration="underline">
Update on Ledger Live to continue
Expand All @@ -29,7 +29,7 @@ function OutdatedLedgerAppWarning({ chain }: RequiresChainProp) {

function LedgerDeviceLockedWarning({ chain }: RequiresChainProp) {
return (
<WarningLabel fontSize="14px" textAlign="left">
<WarningLabel textAlign="left">
Your Ledger is locked. Unlock it and open the {''}
<Capitalize>{chain}</Capitalize>
{''} app to continue.
Expand All @@ -39,7 +39,7 @@ function LedgerDeviceLockedWarning({ chain }: RequiresChainProp) {

function LedgerAppClosedWarning({ chain }: RequiresChainProp) {
return (
<WarningLabel fontSize="14px" textAlign="left">
<WarningLabel textAlign="left">
The <Capitalize>{chain}</Capitalize> app appears to be closed on Ledger. Open it to continue.
</WarningLabel>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';

import { Psbt } from 'bitcoinjs-lib';
import * as yup from 'yup';

import { logger } from '@shared/logger';
Expand Down Expand Up @@ -102,11 +101,9 @@ export function useSendInscriptionForm() {
return;
}

const bitcoinJsPsbt = Psbt.fromBuffer(Buffer.from(signedTx.toPSBT()));
signedTx.finalize();

logger.debug('Pre-finalized inscription PSBT', bitcoinJsPsbt.toHex());

bitcoinJsPsbt.finalizeAllInputs();
logger.debug('Pre-finalized inscription PSBT', signedTx.hex);

const feeRowValue = formFeeRowValue(values.feeRate, isCustomFee);
navigate(`/${RouteUrls.SendOrdinalInscription}/${RouteUrls.SendOrdinalInscriptionReview}`, {
Expand All @@ -117,7 +114,7 @@ export function useSendInscriptionForm() {
recipient: values.recipient,
time,
feeRowValue,
signedTx: bitcoinJsPsbt.extractTransaction().toBuffer(),
signedTx: signedTx.extract(),
},
});
},
Expand Down
6 changes: 3 additions & 3 deletions src/shared/crypto/bitcoin/bip322/sign-message-bip322.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,16 @@ describe(signBip322MessageSimple.name, () => {
);
});

test('Signature: "HiroWalletIsTheBest"', async () => {
test('Signature: "WearLeather"', async () => {
const { signature } = await signBip322MessageSimple({
address: taprootAddress,
message: 'HiroWalletIsTheBest',
message: 'WearLeather',
network: 'mainnet',
signPsbt,
});

expect(signature).toEqual(
'AUAJNdp5SEAFCDYrIR8TQRkgbNo6P+dUeL97eadGjPWC8iPrhngZSBZvcImVk/HEb3zq3xuyGqyP0dqR7CH2HCa7'
'AUDjK8SJX34boek3m3EKXI94AMBZynJUmdqgO7i4z6JKG6gkUgp+brkWl0ylzWb+8enM4s4B4TWel0iCmcQrKNWS'
);
});
});
Expand Down

0 comments on commit 97854b0

Please sign in to comment.