summaryrefslogtreecommitdiff
path: root/packages/taler-util/src/bitcoin.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util/src/bitcoin.ts')
-rw-r--r--packages/taler-util/src/bitcoin.ts16
1 files changed, 7 insertions, 9 deletions
diff --git a/packages/taler-util/src/bitcoin.ts b/packages/taler-util/src/bitcoin.ts
index 822652a8a..37b7ae6b9 100644
--- a/packages/taler-util/src/bitcoin.ts
+++ b/packages/taler-util/src/bitcoin.ts
@@ -23,10 +23,9 @@
* Imports.
*/
import { AmountJson, Amounts } from "./amounts.js";
-import { decodeCrock } from "./talerCrypto.js";
+import { decodeCrock } from "./taler-crypto.js";
import * as segwit from "./segwit_addr.js";
-
function buf2hex(buffer: Uint8Array) {
// buffer is an ArrayBuffer
return [...new Uint8Array(buffer)]
@@ -35,24 +34,23 @@ function buf2hex(buffer: Uint8Array) {
}
const hext2buf = (hexString: string) =>
- new Uint8Array(hexString.match(/.{1,2}/g)!.map(byte => parseInt(byte, 16)));
-
+ new Uint8Array(hexString.match(/.{1,2}/g)!.map((byte) => parseInt(byte, 16)));
export function generateFakeSegwitAddress(
reservePub: string | undefined,
- addr: string
+ addr: string,
): string[] {
- if (!reservePub) return []
+ if (!reservePub) return [];
let pub;
try {
pub = decodeCrock(reservePub);
} catch {
// pub = new Uint8Array(0)
}
- if (!pub || pub.length !== 32) return []
+ if (!pub || pub.length !== 32) return [];
const first_rnd = new Uint8Array(4);
- first_rnd.set(pub.subarray(0, 4))
+ first_rnd.set(pub.subarray(0, 4));
const second_rnd = new Uint8Array(4);
second_rnd.set(pub.subarray(0, 4));
@@ -80,7 +78,7 @@ export function generateFakeSegwitAddress(
const addr1 = segwit.default.encode(prefix, 0, first_part);
const addr2 = segwit.default.encode(prefix, 0, second_part);
- return [addr1, addr2]
+ return [addr1, addr2];
}
// https://github.com/bitcoin/bitcoin/blob/master/src/policy/policy.cpp