Skip to content

Commit

Permalink
fix(sign): error message, update ordit-sdk (#169)
Browse files Browse the repository at this point in the history
* fix(sign): error message

* bump(deps): update ordit-sdk to 1.0.7
  • Loading branch information
Nanosync authored Nov 23, 2023
1 parent 182c746 commit bc35d37
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/ord-connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"dependencies": {
"@headlessui/react": "^1.7.17",
"@ordzaar/ordit-sdk": "1.0.6",
"@ordzaar/ordit-sdk": "1.0.7",
"bitcoinjs-lib": "6.1.5",
"boring-avatars": "^1.10.1"
},
Expand All @@ -60,7 +60,7 @@
]
},
"peerDependencies": {
"@ordzaar/ordit-sdk": "1.0.6",
"@ordzaar/ordit-sdk": "1.0.7",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
Expand Down
8 changes: 6 additions & 2 deletions packages/ord-connect/src/SampleApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import "./style.css";
function TestControls() {
const [send, sendError, isSending] = useSend();
const [getBalance, balanceError, isLoadingBalance] = useBalance();
const [sign] = useSign();
const { signMsg } = useSignMessage();
const [sign, signPsbtError] = useSign();
const { signMsg, error: signMessageError } = useSignMessage();
const [result, setResult] = useState("");
const [balance, setBalance] = useState(0);

Expand Down Expand Up @@ -84,6 +84,10 @@ function TestControls() {
) : null}
{balanceError ? <p>Wallet Balance Error: {balanceError}</p> : null}
{result ? <p>Transaction ID: {result}</p> : null}
{signPsbtError ? <p>Sign Psbt Error: {signPsbtError}</p> : null}
{signMessageError ? (
<p>Sign Message Error: {signMessageError}</p>
) : null}
{sendError ? <p>Send Error: {sendError}</p> : null}
{isSending ? <p>Sending</p> : null}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/ord-connect/src/hooks/useSign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function useSign(): [
} catch (err) {
setError(err.message);
setLoading(false);
throw new Error(err);
throw err;
}
};

Expand Down
6 changes: 3 additions & 3 deletions packages/ord-connect/src/hooks/useSignMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export function useSignMessage(): {

setIsLoading(false);
return signedMessage;
} catch (e) {
setError(e.message);
} catch (err) {
setError(err.message);
setIsLoading(false);
throw new Error(e);
throw err;
}
};

Expand Down
5 changes: 2 additions & 3 deletions packages/ord-connect/src/lib/signPsbt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default async function signPsbt({
if (wallet === Wallet.XVERSE) {
const getAllInputIndices = () =>
psbt.data.inputs.map((value, index) => index);
const xverseSignPsbtOptions = {
const signedXversePsbt = await signXversePsbt(psbt, {
network,
inputsToSign: [
{
Expand All @@ -63,8 +63,7 @@ export default async function signPsbt({
],
finalize,
extractTx,
};
const signedXversePsbt = await signXversePsbt(psbt, xverseSignPsbtOptions);
});
return signedXversePsbt;
}
// else throw error
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

0 comments on commit bc35d37

Please sign in to comment.