Skip to content

Commit

Permalink
chore: update dependencies and refactor deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed Aug 2, 2024
1 parent 0537cdc commit 42b734e
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 84 deletions.
2 changes: 1 addition & 1 deletion contracts/lib/forge-std
12 changes: 7 additions & 5 deletions lib/swap/SwapUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import ops from '@boltz/bitcoin-ops';
import * as bip65 from 'bip65';
import bip66 from 'bip66';
import { encode as bip66Encode } from 'bip66';
import { script } from 'bitcoinjs-lib';
import Bn from 'bn.js';
import * as varuint from 'varuint-bitcoin';
Expand Down Expand Up @@ -32,7 +32,7 @@ const derEncode = (point: string) => {
return zeroHexBuffer;
}

x = x.slice(i);
x = x.subarray(i);

if (x[0] & 0x80) {
return Buffer.concat([zeroHexBuffer, x], x.length + 1);
Expand All @@ -56,10 +56,12 @@ export const encodeSignature = (flag: number, signature: Buffer): Buffer => {

const hashType = Buffer.from([flag]);

const r = derEncode(getHexString(signature.slice(0, pointSize)));
const s = derEncode(getHexString(signature.slice(pointSize, signatureEnd)));
const r = derEncode(getHexString(signature.subarray(0, pointSize)));
const s = derEncode(
getHexString(signature.subarray(pointSize, signatureEnd)),
);

return Buffer.concat([bip66.encode(r, s), hashType]);
return Buffer.concat([bip66Encode(r, s), hashType]);
};

/**
Expand Down
Loading

0 comments on commit 42b734e

Please sign in to comment.