@atomicfinance/types 4.2.5 → 4.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/network-utils.d.ts +10 -0
- package/dist/network-utils.js +34 -0
- package/dist/network-utils.js.map +1 -0
- package/package.json +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @atomicfinance/types@4.2.
|
|
3
|
+
> @atomicfinance/types@4.2.6 build /Users/matthewblack/code/github.com/AtomicFinance/bitcoin-abstraction-layer/packages/types
|
|
4
4
|
> ../../node_modules/.bin/tsc --project tsconfig.json
|
|
5
5
|
|
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BitcoinNetwork } from 'bitcoin-network';
|
|
2
|
+
export type DdkNetworkString = 'bitcoin' | 'testnet' | 'regtest';
|
|
3
|
+
/**
|
|
4
|
+
* Convert BitcoinNetwork object to DDK-compatible network string
|
|
5
|
+
*/
|
|
6
|
+
export declare function bitcoinNetworkToDdkString(network: BitcoinNetwork | string): DdkNetworkString;
|
|
7
|
+
/**
|
|
8
|
+
* Type guard to check if a network string is valid for DDK
|
|
9
|
+
*/
|
|
10
|
+
export declare function isDdkNetworkString(value: string): value is DdkNetworkString;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bitcoinNetworkToDdkString = bitcoinNetworkToDdkString;
|
|
4
|
+
exports.isDdkNetworkString = isDdkNetworkString;
|
|
5
|
+
/**
|
|
6
|
+
* Convert BitcoinNetwork object to DDK-compatible network string
|
|
7
|
+
*/
|
|
8
|
+
function bitcoinNetworkToDdkString(network) {
|
|
9
|
+
if (typeof network === 'string') {
|
|
10
|
+
if (!isDdkNetworkString(network)) {
|
|
11
|
+
throw new Error(`Invalid network string: ${network}. ` +
|
|
12
|
+
`Expected one of: bitcoin, testnet, regtest`);
|
|
13
|
+
}
|
|
14
|
+
return network;
|
|
15
|
+
}
|
|
16
|
+
const mapping = {
|
|
17
|
+
bitcoin: 'bitcoin',
|
|
18
|
+
bitcoin_testnet: 'testnet',
|
|
19
|
+
bitcoin_regtest: 'regtest',
|
|
20
|
+
};
|
|
21
|
+
const result = mapping[network.name];
|
|
22
|
+
if (!result) {
|
|
23
|
+
throw new Error(`Unsupported network: ${network.name}. ` +
|
|
24
|
+
`Expected one of: bitcoin, bitcoin_testnet, bitcoin_regtest`);
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Type guard to check if a network string is valid for DDK
|
|
30
|
+
*/
|
|
31
|
+
function isDdkNetworkString(value) {
|
|
32
|
+
return ['bitcoin', 'testnet', 'regtest'].includes(value);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=network-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-utils.js","sourceRoot":"","sources":["../lib/network-utils.ts"],"names":[],"mappings":";;AAOA,8DA4BC;AAKD,gDAEC;AAtCD;;GAEG;AACH,SAAgB,yBAAyB,CACvC,OAAgC;IAEhC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CACb,2BAA2B,OAAO,IAAI;gBACpC,4CAA4C,CAC/C,CAAC;QACJ,CAAC;QACD,OAAO,OAA2B,CAAC;IACrC,CAAC;IAED,MAAM,OAAO,GAAqC;QAChD,OAAO,EAAE,SAAS;QAClB,eAAe,EAAE,SAAS;QAC1B,eAAe,EAAE,SAAS;KAC3B,CAAC;IAEF,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,wBAAwB,OAAO,CAAC,IAAI,IAAI;YACtC,4DAA4D,CAC/D,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAAa;IAC9C,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomicfinance/types",
|
|
3
3
|
"umdName": "Types",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.6",
|
|
5
5
|
"description": "Bitcoin Abstraction Layer Types",
|
|
6
6
|
"author": "Atomic Finance <info@atomic.finance>",
|
|
7
7
|
"homepage": "",
|
|
8
8
|
"license": "ISC",
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@node-dlc/bitcoin": "1.1.
|
|
12
|
-
"@node-dlc/messaging": "1.1.
|
|
13
|
-
"@node-dlc/noise": "1.1.
|
|
11
|
+
"@node-dlc/bitcoin": "1.1.5",
|
|
12
|
+
"@node-dlc/messaging": "1.1.5",
|
|
13
|
+
"@node-dlc/noise": "1.1.5",
|
|
14
14
|
"lodash": "^4.17.20"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|