@atomicfinance/types 3.5.2 → 3.6.0

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.
@@ -1 +0,0 @@
1
-
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atomicfinance/types
2
2
 
3
+ ## 3.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cbf35c5: - **BREAKING CHANGE**: Migrated from `@node-lightning` packages to `@node-dlc` packages
8
+ - Updated all imports from `@node-lightning/*` to `@node-dlc/*`
9
+ - Update @node-dlc 0.24.0 and Node 18+
10
+ - Upgraded Node.js requirement to v18+
11
+ - Updated cfd-dlc-js to v0.0.51 and cfd-js to v0.3.13
12
+ - Removed unused dependencies: lerna, mocha-webpack
13
+
14
+ ## 3.5.3
15
+
16
+ ### Patch Changes
17
+
18
+ - 87ff085: Fix enum hashed outcomes
19
+
3
20
  ## 3.5.2
4
21
 
5
22
  ### Patch Changes
package/dist/dlc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
+ import { Tx } from '@node-dlc/bitcoin';
2
3
  import { CetAdaptorSignaturesV0, ContractInfo, DlcAccept, DlcClose, DlcCloseMetadata, DlcOffer, DlcSign, DlcTransactions, FundingInput, OracleAttestationV0 } from '@node-dlc/messaging';
3
- import { Tx } from '@node-lightning/bitcoin';
4
4
  import { TxOutRequest } from './common';
5
5
  import Input from './models/Input';
6
6
  export interface DlcProvider {
package/lib/dlc.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable max-len */
2
2
  /* eslint-disable indent */
3
3
 
4
+ import { Tx } from '@node-dlc/bitcoin';
4
5
  import {
5
6
  CetAdaptorSignaturesV0,
6
7
  ContractInfo,
@@ -13,7 +14,6 @@ import {
13
14
  FundingInput,
14
15
  OracleAttestationV0,
15
16
  } from '@node-dlc/messaging';
16
- import { Tx } from '@node-lightning/bitcoin';
17
17
 
18
18
  import { TxOutRequest } from './common';
19
19
  import Input from './models/Input';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atomicfinance/types",
3
3
  "umdName": "Types",
4
- "version": "3.5.2",
4
+ "version": "3.6.0",
5
5
  "description": "Bitcoin Abstraction Layer Types",
6
6
  "author": "Atomic Finance <info@atomic.finance>",
7
7
  "homepage": "",
@@ -15,9 +15,9 @@
15
15
  "lint:fix": "../../node_modules/.bin/eslint --fix --ignore-path ../../.eslintignore -c ../../.eslintrc.js ."
16
16
  },
17
17
  "dependencies": {
18
- "@node-dlc/messaging": "0.23.6",
19
- "@node-lightning/bitcoin": "0.26.1",
20
- "@node-lightning/noise": "0.26.1",
18
+ "@node-dlc/bitcoin": "0.24.0",
19
+ "@node-dlc/messaging": "0.24.0",
20
+ "@node-dlc/noise": "0.24.0",
21
21
  "lodash": "^4.17.20"
22
22
  },
23
23
  "devDependencies": {
@@ -1 +0,0 @@
1
-
package/lib/address.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Address = void 0;
4
- class Address {
5
- constructor(fields) {
6
- if (fields)
7
- Object.assign(this, fields);
8
- }
9
- }
10
- exports.Address = Address;
11
- //# sourceMappingURL=address.js.map
package/lib/bitcoin.js DELETED
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwapMode = exports.AddressType = void 0;
4
- var AddressType;
5
- (function (AddressType) {
6
- AddressType["LEGACY"] = "legacy";
7
- AddressType["P2SH_SEGWIT"] = "p2sh-segwit";
8
- AddressType["BECH32"] = "bech32";
9
- })(AddressType = exports.AddressType || (exports.AddressType = {}));
10
- var SwapMode;
11
- (function (SwapMode) {
12
- SwapMode["P2SH"] = "p2sh";
13
- SwapMode["P2SH_SEGWIT"] = "p2shSegwit";
14
- SwapMode["P2WSH"] = "p2wsh";
15
- })(SwapMode = exports.SwapMode || (exports.SwapMode = {}));
16
- //# sourceMappingURL=bitcoin.js.map
package/lib/block.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=block.js.map
package/lib/cfd.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /* eslint-disable max-len */
3
- /* eslint-disable indent */
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- //# sourceMappingURL=cfd.js.map
package/lib/chain.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=chain.js.map
package/lib/common.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=common.js.map
package/lib/dlc.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /* eslint-disable max-len */
3
- /* eslint-disable indent */
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- //# sourceMappingURL=dlc.js.map
package/lib/fees.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=fees.js.map
package/lib/index.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.bitcoin = exports.BitcoinJsonRpcTypes = exports.TxStatus = exports.Address = exports.BigNumber = exports.Utxo = exports.Output = exports.Outcome = exports.OracleInfo = exports.Input = exports.Amount = void 0;
33
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
34
- exports.BigNumber = bignumber_js_1.default;
35
- const address_1 = require("./address");
36
- Object.defineProperty(exports, "Address", { enumerable: true, get: function () { return address_1.Address; } });
37
- const bitcoin = __importStar(require("./bitcoin"));
38
- exports.bitcoin = bitcoin;
39
- const BitcoinJsonRpcTypes = __importStar(require("./jsonrpc"));
40
- exports.BitcoinJsonRpcTypes = BitcoinJsonRpcTypes;
41
- const transaction_1 = require("./transaction");
42
- Object.defineProperty(exports, "TxStatus", { enumerable: true, get: function () { return transaction_1.TxStatus; } });
43
- __exportStar(require("./cfd"), exports);
44
- __exportStar(require("./common"), exports);
45
- __exportStar(require("./dlc"), exports);
46
- var Amount_1 = require("./models/Amount");
47
- Object.defineProperty(exports, "Amount", { enumerable: true, get: function () { return __importDefault(Amount_1).default; } });
48
- var Input_1 = require("./models/Input");
49
- Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return __importDefault(Input_1).default; } });
50
- var OracleInfo_1 = require("./models/OracleInfo");
51
- Object.defineProperty(exports, "OracleInfo", { enumerable: true, get: function () { return __importDefault(OracleInfo_1).default; } });
52
- var Outcome_1 = require("./models/Outcome");
53
- Object.defineProperty(exports, "Outcome", { enumerable: true, get: function () { return __importDefault(Outcome_1).default; } });
54
- var Output_1 = require("./models/Output");
55
- Object.defineProperty(exports, "Output", { enumerable: true, get: function () { return __importDefault(Output_1).default; } });
56
- var Utxo_1 = require("./models/Utxo");
57
- Object.defineProperty(exports, "Utxo", { enumerable: true, get: function () { return __importDefault(Utxo_1).default; } });
58
- __exportStar(require("./wallet"), exports);
59
- //# sourceMappingURL=index.js.map
package/lib/jsonrpc.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=jsonrpc.js.map
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // Used to convert between satoshi and bitcoin.
4
- const ConversionFactor = 100000000;
5
- class Amount {
6
- constructor(satoshis) {
7
- this._satoshis = satoshis;
8
- this.toJSON = Amount.prototype.toJSON;
9
- this.GetSatoshiAmount = Amount.prototype.GetSatoshiAmount;
10
- }
11
- // Create an Amount object using bitcoin unit.
12
- static FromBitcoin(bitcoin) {
13
- return new Amount(bitcoin * ConversionFactor);
14
- }
15
- // Create an Amount object using satoshi unit.
16
- static FromSatoshis(satoshis) {
17
- return new Amount(satoshis);
18
- }
19
- // Get the amount value in bitcoin.
20
- GetBitcoinAmount() {
21
- return this._satoshis / ConversionFactor;
22
- }
23
- // Get the amount value in satoshi.
24
- GetSatoshiAmount() {
25
- return this._satoshis;
26
- }
27
- // Return a new Amount object with value increased by the given amount of
28
- // satoshi.
29
- AddSatoshis(satoshis) {
30
- return new Amount(this._satoshis + satoshis);
31
- }
32
- // Return a new Amount object with value increased by the given amount of
33
- // bitcoin.
34
- AddBitcoins(bitcoins) {
35
- return new Amount(this._satoshis + bitcoins * ConversionFactor);
36
- }
37
- // Return a new Amount object with value increased by the given amount.
38
- AddAmount(amount) {
39
- return new Amount(this._satoshis + amount._satoshis);
40
- }
41
- // Returns the difference between the amount of satoshi in this object and
42
- // the amount of satoshi of the given object.
43
- CompareWith(amount) {
44
- return new Amount(this._satoshis - amount._satoshis);
45
- }
46
- toJSON() {
47
- return Object.assign({}, this, {
48
- _satoshis: this._satoshis,
49
- });
50
- }
51
- static fromJSON(json) {
52
- if (!json)
53
- return;
54
- const amount = Object.create(Amount.prototype);
55
- return Object.assign(amount, json, {
56
- _satoshis: json._satoshis,
57
- GetSatoshiAmount: Amount.prototype.GetSatoshiAmount,
58
- });
59
- }
60
- static reviver(key, value) {
61
- return key === '' ? Amount.fromJSON(value) : value;
62
- }
63
- }
64
- exports.default = Amount;
65
- //# sourceMappingURL=Amount.js.map
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const Amount_1 = __importDefault(require("./Amount"));
7
- const Utxo_1 = __importDefault(require("./Utxo"));
8
- /**
9
- * Class for interfacing with inputs/utxos in Liquality Chainify
10
- * https://github.com/liquality/chainify
11
- *
12
- * These inputs can have different fields for value
13
- * satoshis (sats): https://github.com/liquality/chainify/blob/dev/packages/bitcoin-esplora-api-provider/lib/BitcoinEsploraApiProvider.js#L65
14
- * amount (btc): https://github.com/liquality/chainify/blob/dev/packages/bitcoin-esplora-api-provider/lib/BitcoinEsploraApiProvider.js#L74
15
- * value (sats): https://github.com/liquality/chainify/blob/dev/packages/bitcoin-wallet-provider/lib/BitcoinWalletProvider.js#L331
16
- *
17
- * This will be fixed once typescript branch is merged:
18
- * https://github.com/liquality/chainify/tree/typescript
19
- * satoshis and amount will not be necessary, only value
20
- * https://github.com/liquality/chainify/blob/typescript/packages/types/lib/bitcoin.ts#L46
21
- */
22
- class Input {
23
- constructor(txid, vout, address, amount, // in BTC
24
- value, // in sats
25
- derivationPath, maxWitnessLength, redeemScript, inputSerialId, scriptPubKey, label, confirmations, spendable, solvable, safe) {
26
- this.txid = txid;
27
- this.vout = vout;
28
- this.address = address;
29
- this.amount = amount;
30
- this.value = value;
31
- this.derivationPath = derivationPath;
32
- this.maxWitnessLength = maxWitnessLength;
33
- this.redeemScript = redeemScript;
34
- this.inputSerialId = inputSerialId;
35
- this.scriptPubKey = scriptPubKey;
36
- this.label = label;
37
- this.confirmations = confirmations;
38
- this.spendable = spendable;
39
- this.solvable = solvable;
40
- this.safe = safe;
41
- }
42
- toUtxo() {
43
- let amount;
44
- if (this.value) {
45
- amount = Amount_1.default.FromSatoshis(this.value);
46
- }
47
- else if (this.amount) {
48
- amount = Amount_1.default.FromBitcoin(this.amount);
49
- }
50
- return {
51
- txid: this.txid,
52
- vout: this.vout,
53
- amount,
54
- address: this.address,
55
- derivationPath: this.derivationPath,
56
- maxWitnessLength: this.maxWitnessLength ? this.maxWitnessLength : 108,
57
- inputSerialId: this.inputSerialId,
58
- toJSON: Utxo_1.default.prototype.toJSON,
59
- toInput: Utxo_1.default.prototype.toInput,
60
- };
61
- }
62
- static fromUTXO(utxo) {
63
- const amount = Amount_1.default.FromSatoshis(utxo.value);
64
- return {
65
- txid: utxo.txid,
66
- vout: utxo.vout,
67
- address: utxo.address,
68
- value: utxo.value,
69
- amount: amount.GetBitcoinAmount(),
70
- toUtxo: Input.prototype.toUtxo,
71
- };
72
- }
73
- }
74
- exports.default = Input;
75
- //# sourceMappingURL=Input.js.map
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class OracleInfo {
4
- constructor(name, rValues, publicKey) {
5
- this.name = name;
6
- this.rValues = rValues;
7
- this.publicKey = publicKey;
8
- }
9
- }
10
- exports.default = OracleInfo;
11
- //# sourceMappingURL=OracleInfo.js.map
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const Amount_1 = __importDefault(require("./Amount"));
7
- class Outcome {
8
- constructor(message, local, remote) {
9
- this.message = message;
10
- this.local = local;
11
- this.remote = remote;
12
- }
13
- toJSON() {
14
- return Object.assign({}, this, {
15
- message: this.message,
16
- local: this.local.toJSON(),
17
- remote: this.remote.toJSON(),
18
- });
19
- }
20
- static fromJSON(json) {
21
- const outcome = Object.create(Outcome.prototype);
22
- return Object.assign(outcome, json, {
23
- message: json.message,
24
- local: Amount_1.default.fromJSON(json.local),
25
- remote: Amount_1.default.fromJSON(json.remote),
26
- });
27
- }
28
- static reviver(key, value) {
29
- return key === '' ? Outcome.fromJSON(value) : value;
30
- }
31
- }
32
- exports.default = Outcome;
33
- //# sourceMappingURL=Outcome.js.map
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class Output {
4
- constructor(value, to) {
5
- this.value = value;
6
- this.to = to;
7
- }
8
- }
9
- exports.default = Output;
10
- //# sourceMappingURL=Output.js.map
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const Amount_1 = __importDefault(require("./Amount"));
7
- const Input_1 = __importDefault(require("./Input"));
8
- /**
9
- * Class for interfacing with utxos in CFD DLC JS
10
- * https://github.com/atomicfinance/cfd-dlc-js.git#v0.0.18
11
- */
12
- class Utxo {
13
- constructor(txid, vout, amount, address, derivationPath, maxWitnessLength, inputSerialId) {
14
- this.txid = txid;
15
- this.vout = vout;
16
- this.amount = amount;
17
- this.address = address;
18
- this.derivationPath = derivationPath;
19
- this.maxWitnessLength = maxWitnessLength;
20
- this.inputSerialId = inputSerialId;
21
- }
22
- toInput() {
23
- return {
24
- txid: this.txid,
25
- vout: this.vout,
26
- address: this.address,
27
- amount: this.amount.GetBitcoinAmount(),
28
- value: this.amount.GetSatoshiAmount(),
29
- derivationPath: this.derivationPath,
30
- maxWitnessLength: this.maxWitnessLength,
31
- inputSerialId: BigInt(this.inputSerialId),
32
- toUtxo: Input_1.default.prototype.toUtxo,
33
- };
34
- }
35
- toJSON() {
36
- return Object.assign({}, this, {
37
- txid: this.txid,
38
- vout: this.vout,
39
- amount: this.amount.toJSON(),
40
- address: this.address,
41
- derivationPath: this.derivationPath,
42
- maxWitnessLength: this.maxWitnessLength,
43
- inputSerialId: this.inputSerialId,
44
- });
45
- }
46
- static fromJSON(json) {
47
- const utxo = Object.create(Utxo.prototype);
48
- return Object.assign(utxo, json, {
49
- txid: json.txid,
50
- vout: json.vout,
51
- amount: Amount_1.default.fromJSON(json.amount),
52
- address: json.address,
53
- derivationPath: json.derivationPath,
54
- maxWitnessLength: json.maxWitnessLength,
55
- });
56
- }
57
- static reviver(key, value) {
58
- return key === '' ? Utxo.fromJSON(value) : value;
59
- }
60
- }
61
- exports.default = Utxo;
62
- //# sourceMappingURL=Utxo.js.map
package/lib/network.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=network.js.map
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TxStatus = void 0;
4
- var TxStatus;
5
- (function (TxStatus) {
6
- TxStatus["Pending"] = "PENDING";
7
- TxStatus["Failed"] = "FAILED";
8
- TxStatus["Success"] = "SUCCESS";
9
- })(TxStatus = exports.TxStatus || (exports.TxStatus = {}));
10
- //# sourceMappingURL=transaction.js.map
package/lib/wallet.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=wallet.js.map