Skip to content

Commit

Permalink
update name from hardWalletSigners to hardWalletSigs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeesun Kim authored and Jeesun Kim committed Jun 5, 2024
1 parent dcc93c4 commit 908cac9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/app/(sidebar)/transaction/sign/components/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ export const Overview = () => {
txXdr: string,
signers: string[],
networkPassphrase: string,
hardWalletSigners?: xdr.DecoratedSignature[],
hardWalletSigs?: xdr.DecoratedSignature[],
) => {
const { xdr, message } = transactionSigner.signTx({
txXdr,
signers,
networkPassphrase,
hardWalletSigners,
hardWalletSigs,
});

if (xdr && message) {
Expand Down Expand Up @@ -270,7 +270,7 @@ export const Overview = () => {
<Button
disabled={
(!HAS_SECRET_KEYS || HAS_INVALID_SECRET_KEYS) &&
!sign.hardWalletSigners?.length
!sign.hardWalletSigs?.length
}
size="md"
variant="secondary"
Expand All @@ -279,7 +279,7 @@ export const Overview = () => {
sign.importXdr,
secretInputs,
network.passphrase,
sign.hardWalletSigners,
sign.hardWalletSigs,
)
}
>
Expand Down
11 changes: 6 additions & 5 deletions src/app/(sidebar)/transaction/sign/components/SignWithLedger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const SignWithLedger = ({
setSignSuccess: Dispatch<SetStateAction<boolean>>;
}) => {
const { network, transaction } = useStore();
const { sign, updateSignedTx, updateHardWalletSigners } = transaction;
const { sign, updateSignedTx, updateHardWalletSigs } = transaction;

const [isLoading, setIsLoading] = useState<boolean>(false);

Expand Down Expand Up @@ -69,9 +69,10 @@ export const SignWithLedger = ({
.getPublicKey(sign.bipPath)
.then((result: { publicKey: string }) => (publicKey = result.publicKey))
.then(() => {
if (isHash) {
return ledgerApi.signHash(sign.bipPath, transaction.hash());
}
// @TODO waiting on design
// if (isHash) {
// return ledgerApi.signHash(sign.bipPath, transaction.hash());
// }
return ledgerApi.signTransaction(
sign.bipPath,
transaction.signatureBase(),
Expand All @@ -85,7 +86,7 @@ export const SignWithLedger = ({
const hint = keyPair.signatureHint();
const decorated = new xdr.DecoratedSignature({ hint, signature });

updateHardWalletSigners([decorated]);
updateHardWalletSigs([decorated]);
setSignSuccess(true);
})
.catch(onError);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const SignWithTrezor = ({
setSignSuccess: Dispatch<SetStateAction<boolean>>;
}) => {
const { network, transaction } = useStore();
const { sign, updateSignedTx, updateHardWalletSigners } = transaction;
const { sign, updateSignedTx, updateHardWalletSigs } = transaction;

const [isLoading, setIsLoading] = useState<boolean>(false);

Expand Down Expand Up @@ -67,7 +67,7 @@ export const SignWithTrezor = ({
const hint = keyPair.signatureHint();
const decorated = new xdr.DecoratedSignature({ hint, signature });

updateHardWalletSigners([decorated]);
updateHardWalletSigs([decorated]);
setSignSuccess(true);
} else {
const errorPayload = trezorResponse.payload as { error: string };
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/transactionSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const signTx = ({
txXdr,
signers,
networkPassphrase,
hardWalletSigners,
hardWalletSigs,
}: {
txXdr: string;
signers: string[];
networkPassphrase: string;
hardWalletSigners?: xdr.DecoratedSignature[];
hardWalletSigs?: xdr.DecoratedSignature[];
}) => {
const validSecretKeys = [];
const validPreimages = [];
Expand Down Expand Up @@ -53,7 +53,7 @@ const signTx = ({
addedSigs++;
newTx.signHashX(Buffer.from(signer, "hex"));
});
hardWalletSigners?.forEach((signer) => {
hardWalletSigs?.forEach((signer) => {
addedSigs++;
newTx.signatures.push(signer);
});
Expand Down
10 changes: 5 additions & 5 deletions src/store/createStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export interface Store {
importXdr: string;
signedTx: string;
bipPath: string;
hardWalletSigners: xdr.DecoratedSignature[] | undefined;
hardWalletSigs: xdr.DecoratedSignature[] | undefined;
};
// TODO: update as needed
// simulate: AnyObject;
Expand Down Expand Up @@ -120,7 +120,7 @@ export interface Store {
updateSignImportXdr: (xdr: string) => void;
updateSignedTx: (tx: string) => void;
updateBipPath: (bipPath: string) => void;
updateHardWalletSigners: (signer: xdr.DecoratedSignature[]) => void;
updateHardWalletSigs: (signer: xdr.DecoratedSignature[]) => void;
resetSign: () => void;
};
}
Expand Down Expand Up @@ -165,7 +165,7 @@ const initTransactionState = {
importXdr: "",
signedTx: "",
bipPath: "",
hardWalletSigners: undefined,
hardWalletSigs: undefined,
},
};

Expand Down Expand Up @@ -333,9 +333,9 @@ export const createStore = (options: CreateStoreOptions) =>
set((state) => {
state.transaction.sign.bipPath = bipPath;
}),
updateHardWalletSigners: (signer: xdr.DecoratedSignature[]) =>
updateHardWalletSigs: (signer: xdr.DecoratedSignature[]) =>
set((state) => {
state.transaction.sign.hardWalletSigners = signer;
state.transaction.sign.hardWalletSigs = signer;
}),
resetSign: () =>
set((state) => {
Expand Down

0 comments on commit 908cac9

Please sign in to comment.