Skip to content

Commit

Permalink
fix: fixed cleanHexPrefix function to handle odd-length hex strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Z4karia committed Sep 17, 2024
1 parent 9ba000a commit d127488
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/BtcNew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,12 @@ export default class BtcNew {
};
}
cleanHexPrefix(hexString: string): string {
return hexString.startsWith("0x") ? hexString.slice(2) : hexString;
}
let cleanedHex = hexString.startsWith("0x") ? hexString.slice(2) : hexString;
if (cleanedHex.length % 2 !== 0) {
cleanedHex = '0' + cleanedHex;
}
return cleanedHex;
}

formatAcreWithdrawalData(withdrawalData: AcreWithdrawalData): AcreWithdrawalDataBuffer {
console.log("withdrawalData", withdrawalData);
Expand Down

0 comments on commit d127488

Please sign in to comment.