Skip to content

Commit e9315c0

Browse files
Merge pull request #5624 from BitGo/BTC-1826.baby-staking-transactions
feat(utxo-staking): Add single key finality provider script generation
2 parents 51e7bf0 + 7cf7bdc commit e9315c0

File tree

17 files changed

+1205
-422
lines changed

17 files changed

+1205
-422
lines changed

modules/abstract-utxo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@bitgo/unspents": "^0.47.18",
4949
"@bitgo/utxo-core": "^1.3.0",
5050
"@bitgo/utxo-lib": "^11.2.2",
51-
"@bitgo/wasm-miniscript": "2.0.0-beta.4",
51+
"@bitgo/wasm-miniscript": "2.0.0-beta.6",
5252
"@types/bluebird": "^3.5.25",
5353
"@types/lodash": "^4.14.121",
5454
"@types/superagent": "4.1.15",

modules/utxo-bin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@bitgo/statics": "^51.0.1",
3131
"@bitgo/unspents": "^0.47.18",
3232
"@bitgo/utxo-lib": "^11.2.2",
33-
"@bitgo/wasm-miniscript": "2.0.0-beta.4",
33+
"@bitgo/wasm-miniscript": "2.0.0-beta.6",
3434
"@noble/curves": "1.8.1",
3535
"archy": "^1.0.0",
3636
"bech32": "^2.0.0",

modules/utxo-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"dependencies": {
5454
"@bitgo/unspents": "^0.47.18",
5555
"@bitgo/utxo-lib": "^11.2.2",
56-
"@bitgo/wasm-miniscript": "2.0.0-beta.4",
56+
"@bitgo/wasm-miniscript": "2.0.0-beta.6",
5757
"bip174": "npm:@bitgo-forks/[email protected]"
5858
},
5959
"gitHead": "18e460ddf02de2dbf13c2aa243478188fb539f0c"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.nyc_output/
22
dist/
3+
test/fixtures
34
test/unit/babylon/vendor/btc-staking-ts

modules/utxo-staking/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@bitgo/unspents": "^0.47.18",
4343
"@bitgo/utxo-core": "^1.3.0",
4444
"@bitgo/utxo-lib": "^11.2.2",
45-
"@bitgo/wasm-miniscript": "2.0.0-beta.4"
45+
"@bitgo/wasm-miniscript": "2.0.0-beta.6"
4646
},
4747
"devDependencies": {
4848
"bip174": "=2.1.1",

modules/utxo-staking/src/babylon/descriptor.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function pk(b: Buffer): ast.MiniscriptNode {
1111
}
1212

1313
function sortedKeys(keys: Buffer[]): Buffer[] {
14-
return keys.sort((a, b) => a.compare(b));
14+
return [...keys].sort((a, b) => a.compare(b));
1515
}
1616

1717
function multiArgs(threshold: number, keys: Buffer[]): [number, ...string[]] {
@@ -44,7 +44,12 @@ export class BabylonDescriptorBuilder {
4444
return {
4545
and_v: [
4646
{
47-
and_v: [pk(this.stakerKey), { 'v:multi_a': multiArgs(1, this.finalityProviderKeys) }],
47+
and_v: [
48+
pk(this.stakerKey),
49+
this.finalityProviderKeys.length === 1
50+
? { 'v:pk': this.finalityProviderKeys[0].toString('hex') }
51+
: { 'v:multi_a': multiArgs(1, this.finalityProviderKeys) },
52+
],
4853
},
4954
{ multi_a: multiArgs(this.covenantThreshold, this.covenantKeys) },
5055
],

modules/utxo-staking/test/fixtures/babylon/scripts.2f2c.json

Lines changed: 0 additions & 128 deletions
This file was deleted.

modules/utxo-staking/test/fixtures/babylon/scripts.3f3c.json

Lines changed: 0 additions & 136 deletions
This file was deleted.

0 commit comments

Comments
 (0)