Skip to content

Commit 2cd9eaf

Browse files
OttoAllmendingerllm-git
andcommitted
feat(abstract-utxo): move coin implementations from sdk modules
Move UTXO coin implementations from coin-specific modules into the abstract-utxo module. Each coin implementation now resides in its own directory under src/impl/ and is re-exported from the main module. This allows coin-specific modules to simply re-export the implementations from abstract-utxo, which simplifies maintenance and keeps the code DRY. Migrates test files from individual UTXO coin modules into the abstract-utxo module under test/impl/<coin>. This consolidates all tests in one place for better organization and reuse. Added sdk-test and mocha as devDependencies to abstract-utxo package.json. Issue: BTC-2652 Co-authored-by: llm-git <llm-git@ttll.de>
1 parent 4d8719d commit 2cd9eaf

File tree

93 files changed

+291
-249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+291
-249
lines changed

modules/abstract-utxo/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"lint": "eslint --quiet .",
1616
"prepare": "npm run build",
1717
"test": "npm run unit-test",
18-
"unit-test": "mocha --recursive test/"
18+
"unit-test": "mocha --recursive test/unit/",
19+
"integration-test": "mocha --recursive test/integration/"
1920
},
2021
"author": "BitGo SDK Team <sdkteam@bitgo.com>",
2122
"license": "MIT",
@@ -47,6 +48,7 @@
4748
"@bitgo/sdk-core": "^36.15.0",
4849
"@bitgo/secp256k1": "^1.6.0",
4950
"@bitgo/unspents": "^0.50.5",
51+
"@bitgo/utxo-ord": "^1.22.7",
5052
"@bitgo/utxo-core": "^1.21.1",
5153
"@bitgo/utxo-lib": "^11.13.0",
5254
"@bitgo/wasm-miniscript": "2.0.0-beta.7",
@@ -59,5 +61,9 @@
5961
"lodash": "^4.17.14",
6062
"superagent": "^9.0.1"
6163
},
64+
"devDependencies": {
65+
"@bitgo/sdk-test": "^9.1.7",
66+
"mocha": "^10.2.0"
67+
},
6268
"gitHead": "18e460ddf02de2dbf13c2aa243478188fb539f0c"
6369
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { AbstractUtxoCoin, UtxoNetwork } from '@bitgo/abstract-utxo';
21
import { BitGoBase, BaseCoin } from '@bitgo/sdk-core';
32
import * as utxolib from '@bitgo/utxo-lib';
43

4+
import { AbstractUtxoCoin, UtxoNetwork } from '../../abstractUtxoCoin';
5+
56
export class Bch extends AbstractUtxoCoin {
67
protected constructor(bitgo: BitGoBase, network?: UtxoNetwork) {
78
super(bitgo, network || utxolib.networks.bitcoincash);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './bch';
2+
export * from './tbch';

modules/sdk-coin-bch/src/tbch.ts renamed to modules/abstract-utxo/src/impl/bch/tbch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
* @prettier
33
*/
44
import { BaseCoin, BitGoBase } from '@bitgo/sdk-core';
5-
import { Bch } from './bch';
65
import * as bitcoin from '@bitgo/utxo-lib';
76

7+
import { Bch } from './bch';
8+
89
export class Tbch extends Bch {
910
constructor(bitgo: BitGoBase) {
1011
super(bitgo, bitcoin.networks.bitcoincashTestnet);

modules/sdk-coin-bcha/src/bcha.ts renamed to modules/abstract-utxo/src/impl/bcha/bcha.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { BitGoBase, BaseCoin } from '@bitgo/sdk-core';
2-
import { Bch } from '@bitgo/sdk-coin-bch';
32
import * as utxolib from '@bitgo/utxo-lib';
4-
import { UtxoNetwork } from '@bitgo/abstract-utxo';
3+
4+
import { Bch } from '../bch/bch';
5+
import { UtxoNetwork } from '../../abstractUtxoCoin';
56

67
export class Bcha extends Bch {
78
constructor(bitgo: BitGoBase, network?: UtxoNetwork) {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './bcha';
2+
export * from './tbcha';

modules/sdk-coin-bcha/src/tbcha.ts renamed to modules/abstract-utxo/src/impl/bcha/tbcha.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44
import { BitGoBase, BaseCoin } from '@bitgo/sdk-core';
55
import * as utxolib from '@bitgo/utxo-lib';
6+
67
import { Bcha } from './bcha';
78

89
export class Tbcha extends Bcha {
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { UtxoNetwork } from '@bitgo/abstract-utxo';
2-
import { Bch } from '@bitgo/sdk-coin-bch';
31
import { BitGoBase, BaseCoin } from '@bitgo/sdk-core';
42
import * as utxolib from '@bitgo/utxo-lib';
53

4+
import { UtxoNetwork } from '../../abstractUtxoCoin';
5+
import { Bch } from '../bch/bch';
6+
67
export class Bsv extends Bch {
78
constructor(bitgo: BitGoBase, network?: UtxoNetwork) {
89
super(bitgo, network || utxolib.networks.bitcoinsv);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './bsv';
2+
export * from './tbsv';

modules/sdk-coin-bsv/src/tbsv.ts renamed to modules/abstract-utxo/src/impl/bsv/tbsv.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
* @prettier
33
*/
44
import { BitGoBase, BaseCoin } from '@bitgo/sdk-core';
5-
import { Bsv } from './bsv';
65
import * as utxolib from '@bitgo/utxo-lib';
76

7+
import { Bsv } from './bsv';
8+
89
export class Tbsv extends Bsv {
910
constructor(bitgo: BitGoBase) {
1011
super(bitgo, utxolib.networks.bitcoinsvTestnet);

0 commit comments

Comments
 (0)