Skip to content

Commit 516a56c

Browse files
OttoAllmendingerllm-git
andcommitted
feat(abstract-utxo): add replay protection output scripts function
Add getReplayProtectionOutputScripts that converts replay protection addresses to output scripts using wasm-utxo. Issue: BTC-2732 Co-authored-by: llm-git <[email protected]>
1 parent 3d6585e commit 516a56c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

modules/abstract-utxo/src/replayProtection.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as wasmUtxo from '@bitgo/wasm-utxo';
12
import * as utxolib from '@bitgo/utxo-lib';
23

34
export function getReplayProtectionAddresses(network: utxolib.Network): string[] {
@@ -13,6 +14,12 @@ export function getReplayProtectionAddresses(network: utxolib.Network): string[]
1314
return [];
1415
}
1516

17+
export function getReplayProtectionOutputScripts(network: utxolib.Network): Buffer[] {
18+
return getReplayProtectionAddresses(network).map((address) =>
19+
Buffer.from(wasmUtxo.utxolibCompat.toOutputScript(address, network))
20+
);
21+
}
22+
1623
export function isReplayProtectionUnspent<TNumber extends number | bigint>(
1724
u: utxolib.bitgo.Unspent<TNumber>,
1825
network: utxolib.Network

0 commit comments

Comments
 (0)